Source_Code
stringlengths 69
484k
| IR_Original
stringlengths 2.05k
17.9M
|
---|---|
#include <stdio.h>
int main(int argc, char const* argv[])
{
int masu[1100];
int dice[1000];
int n, m;
int cur;
int i;
while (1) {
scanf("%d%d", &n, &m);
if (n == 0 && m == 0){
break;
}
for (i = 0; i < n; i++) {
scanf("%d", &masu[i + 1]);
}
cur = 1;
for (i = 0; i < m; i++) {
scanf("%d", &dice[i]);
}
for (i = 0; i < m; i++) {
cur += dice[i];
if (cur >= n){
break;
}
cur += masu[cur];
if (cur >= n){
break;
}
}
printf("%d\n", i + 1);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326838/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326838/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%masu = alloca [1100 x i32], align 16
%dice = alloca [1000 x i32], align 16
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4400, ptr nonnull %masu) #3
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %dice) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
%call56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp57 = icmp eq i32 %0, 0
%1 = load i32, ptr %m, align 4
%cmp158 = icmp eq i32 %1, 0
%or.cond59 = select i1 %cmp57, i1 %cmp158, i1 false
br i1 %or.cond59, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end30
%2 = phi i32 [ %15, %for.end30 ], [ %1, %entry ]
%3 = phi i32 [ %14, %for.end30 ], [ %0, %entry ]
%cmp246 = icmp sgt i32 %3, 0
br i1 %cmp246, label %for.body, label %for.cond4.preheader
for.cond4.preheader.loopexit: ; preds = %for.body
%.pre = load i32, ptr %m, align 4, !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond4.preheader.loopexit, %for.cond.preheader
%4 = phi i32 [ %.pre, %for.cond4.preheader.loopexit ], [ %2, %for.cond.preheader ]
%cmp548 = icmp sgt i32 %4, 0
br i1 %cmp548, label %for.body6, label %for.end30
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [1100 x i32], ptr %masu, i64 0, i64 %indvars.iv.next
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp2, label %for.body, label %for.cond4.preheader.loopexit, !llvm.loop !9
for.cond13.preheader: ; preds = %for.body6
%cmp1450 = icmp sgt i32 %8, 0
br i1 %cmp1450, label %for.body15.lr.ph, label %for.end30
for.body15.lr.ph: ; preds = %for.cond13.preheader
%7 = load i32, ptr %n, align 4, !tbaa !5
%wide.trip.count = zext i32 %8 to i64
br label %for.body15
for.body6: ; preds = %for.cond4.preheader, %for.body6
%indvars.iv62 = phi i64 [ %indvars.iv.next63, %for.body6 ], [ 0, %for.cond4.preheader ]
%arrayidx8 = getelementptr inbounds [1000 x i32], ptr %dice, i64 0, i64 %indvars.iv62
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx8)
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%8 = load i32, ptr %m, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp5 = icmp slt i64 %indvars.iv.next63, %9
br i1 %cmp5, label %for.body6, label %for.cond13.preheader, !llvm.loop !11
for.body15: ; preds = %for.body15.lr.ph, %for.inc28
%indvars.iv65 = phi i64 [ 0, %for.body15.lr.ph ], [ %indvars.iv.next66, %for.inc28 ]
%cur.051 = phi i32 [ 1, %for.body15.lr.ph ], [ %add24, %for.inc28 ]
%arrayidx17 = getelementptr inbounds [1000 x i32], ptr %dice, i64 0, i64 %indvars.iv65
%10 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%add18 = add nsw i32 %10, %cur.051
%cmp19.not = icmp slt i32 %add18, %7
br i1 %cmp19.not, label %if.end21, label %for.end30.loopexit.split.loop.exit70
if.end21: ; preds = %for.body15
%idxprom22 = sext i32 %add18 to i64
%arrayidx23 = getelementptr inbounds [1100 x i32], ptr %masu, i64 0, i64 %idxprom22
%11 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%add24 = add nsw i32 %11, %add18
%cmp25.not = icmp slt i32 %add24, %7
br i1 %cmp25.not, label %for.inc28, label %for.end30.loopexit.split.loop.exit
for.inc28: ; preds = %if.end21
%indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
%exitcond.not = icmp eq i64 %indvars.iv.next66, %wide.trip.count
br i1 %exitcond.not, label %for.end30, label %for.body15, !llvm.loop !12
for.end30.loopexit.split.loop.exit: ; preds = %if.end21
%12 = trunc i64 %indvars.iv65 to i32
br label %for.end30
for.end30.loopexit.split.loop.exit70: ; preds = %for.body15
%13 = trunc i64 %indvars.iv65 to i32
br label %for.end30
for.end30: ; preds = %for.inc28, %for.end30.loopexit.split.loop.exit, %for.end30.loopexit.split.loop.exit70, %for.cond4.preheader, %for.cond13.preheader
%i.2.lcssa = phi i32 [ 0, %for.cond13.preheader ], [ 0, %for.cond4.preheader ], [ %12, %for.end30.loopexit.split.loop.exit ], [ %13, %for.end30.loopexit.split.loop.exit70 ], [ %8, %for.inc28 ]
%add31 = add nuw nsw i32 %i.2.lcssa, 1
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add31)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%14 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %14, 0
%15 = load i32, ptr %m, align 4
%cmp1 = icmp eq i32 %15, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end30, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %dice) #3
call void @llvm.lifetime.end.p0(i64 4400, ptr nonnull %masu) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(void)
{
int A,B,C;
scanf("%d%d%d",&A,&B,&C);
if(A+B>=C) printf("Yes\n");
else printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326881/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326881/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %C, align 4, !tbaa !5
%cmp.not = icmp slt i32 %add, %2
%str.str.3 = select i1 %cmp.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int A, B, C;
scanf("%d%d%d", &A, &B, &C);
if (A + B >= C) {
printf("Yes\n");
}
else {
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326931/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326931/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %C, align 4, !tbaa !5
%cmp.not = icmp slt i32 %add, %2
%str.str.3 = select i1 %cmp.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
# include <stdio.h>
int main()
{
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
if (a+b >= c) {
printf("Yes\n");
} else {
printf("No\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326982/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326982/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %c, align 4, !tbaa !5
%cmp.not = icmp slt i32 %add, %2
%str.str.3 = select i1 %cmp.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int A,B,C;
scanf("%d %d %d",&A,&B,&C);
if(A+B>=C){
printf("Yes\n");
}
else{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327024/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327024/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %C, align 4, !tbaa !5
%cmp.not = icmp slt i32 %add, %2
%str.str.3 = select i1 %cmp.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if (a + b >= c)
{
printf("Yes\n");
}if (a + b < c)
{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327068/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327068/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %c, align 4, !tbaa !5
%cmp.not = icmp slt i32 %add, %2
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre8 = load i32, ptr %b, align 4, !tbaa !5
%.pre9 = load i32, ptr %c, align 4, !tbaa !5
%.pre10 = add nsw i32 %.pre8, %.pre
br label %if.end
if.end: ; preds = %if.then, %entry
%add2.pre-phi = phi i32 [ %.pre10, %if.then ], [ %add, %entry ]
%3 = phi i32 [ %.pre9, %if.then ], [ %2, %entry ]
%cmp3 = icmp slt i32 %add2.pre-phi, %3
br i1 %cmp3, label %if.then4, label %if.end6
if.then4: ; preds = %if.end
%puts7 = call i32 @puts(ptr nonnull dereferenceable(1) @str.3)
br label %if.end6
if.end6: ; preds = %if.then4, %if.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(c<=a+b){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327118/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327118/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %c, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%cmp.not = icmp sgt i32 %0, %add
%str.str.3 = select i1 %cmp.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#define N 100
#define INF 10000000
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n;
int G[N+1][N+1];
int color[N+1];
int d[N+1];
int Q[N+1];
int a=0,b=0;
void enqueue(int s){
Q[b] = s;
b++;
}
int dequeue(){
a++;
return Q[a-1];
}
int empty(){
if(a==b) return 1;
else return 0;
}
void bfs(int s){
int i,u;
for(i=1;i<=n;i++){
color[i] = WHITE;
d[i] = -1;
}
color[s] = GRAY;
d[s] = 0;
//Q = empty;
enqueue(s);
while(empty()!=1){
u = dequeue();
for(i=1;i<=n;i++){
if(color[i]==WHITE && G[u][i]==1){
enqueue(i);
color[i] = GRAY;
d[i] = d[u] + 1;
}
}
color[u] = BLACK;
}
}
int main(){
int i,j,k;
int flag;
scanf("%d",&n);
int Adj[n+1][n+2];
for(i=1;i<=n;i++){
scanf("%d",&Adj[i][0]);
scanf("%d",&Adj[i][1]);
for(j=0;j<Adj[i][1];j++){
scanf("%d",&Adj[i][j+2]);
}
}
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
G[i][j]=0;
for(k=0;k<Adj[i][1];k++){
if(j==Adj[i][k+2]){
G[i][j]=1;
break;
}
}
}
}
bfs(1);
for(i=1;i<=n;i++){
printf("%d %d\n",i,d[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327169/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327169/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@a = dso_local local_unnamed_addr global i32 0, align 4
@b = dso_local local_unnamed_addr global i32 0, align 4
@Q = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@n = dso_local global i32 0, align 4
@color = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@d = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@G = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @enqueue(i32 noundef %s) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @b, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %idxprom
store i32 %s, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @b, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @dequeue() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @a, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @a, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @empty() local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @a, align 4, !tbaa !5
%1 = load i32, ptr @b, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
%. = zext i1 %cmp to i32
ret i32 %.
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @bfs(i32 noundef %s) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not51 = icmp slt i32 %0, 1
br i1 %cmp.not51, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([101 x i32], ptr @color, i64 0, i64 1), i8 0, i64 %2, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([101 x i32], ptr @d, i64 0, i64 1), i8 -1, i64 %2, i1 false), !tbaa !5
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%idxprom3 = sext i32 %s to i64
%arrayidx4 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom3
store i32 1, ptr %arrayidx4, align 4, !tbaa !5
%arrayidx6 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %idxprom3
store i32 0, ptr %arrayidx6, align 4, !tbaa !5
%3 = load i32, ptr @b, align 4, !tbaa !5
%idxprom.i = sext i32 %3 to i64
%arrayidx.i = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %idxprom.i
store i32 %s, ptr %arrayidx.i, align 4, !tbaa !5
%inc.i = add nsw i32 %3, 1
store i32 %inc.i, ptr @b, align 4, !tbaa !5
%a.promoted = load i32, ptr @a, align 4, !tbaa !5
%cmp.i.not64 = icmp eq i32 %a.promoted, %inc.i
br i1 %cmp.i.not64, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
br i1 %cmp.not51, label %while.body.us.preheader, label %while.body.preheader
while.body.preheader: ; preds = %while.body.lr.ph
%4 = add nuw i32 %0, 1
%5 = sext i32 %a.promoted to i64
%wide.trip.count = zext i32 %4 to i64
br label %while.body
while.body.us.preheader: ; preds = %while.body.lr.ph
%6 = sext i32 %a.promoted to i64
%7 = add nsw i64 %idxprom.i, 1
%8 = sub nsw i64 %7, %6
%9 = sub nsw i64 %idxprom.i, %6
%xtraiter = and i64 %8, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.body.us.prol.loopexit, label %while.body.us.prol
while.body.us.prol: ; preds = %while.body.us.preheader, %while.body.us.prol
%indvars.iv73.prol = phi i64 [ %indvars.iv.next74.prol, %while.body.us.prol ], [ %6, %while.body.us.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %while.body.us.prol ], [ 0, %while.body.us.preheader ]
%indvars.iv.next74.prol = add nsw i64 %indvars.iv73.prol, 1
%arrayidx.i47.us.prol = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %indvars.iv73.prol
%10 = load i32, ptr %arrayidx.i47.us.prol, align 4, !tbaa !5
%idxprom29.us.prol = sext i32 %10 to i64
%arrayidx30.us.prol = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom29.us.prol
store i32 2, ptr %arrayidx30.us.prol, align 4, !tbaa !5
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %while.body.us.prol.loopexit, label %while.body.us.prol, !llvm.loop !9
while.body.us.prol.loopexit: ; preds = %while.body.us.prol, %while.body.us.preheader
%indvars.iv.next74.lcssa.unr = phi i64 [ undef, %while.body.us.preheader ], [ %indvars.iv.next74.prol, %while.body.us.prol ]
%indvars.iv73.unr = phi i64 [ %6, %while.body.us.preheader ], [ %indvars.iv.next74.prol, %while.body.us.prol ]
%11 = icmp ult i64 %9, 3
br i1 %11, label %while.cond.while.end_crit_edge.loopexit, label %while.body.us
while.body.us: ; preds = %while.body.us.prol.loopexit, %while.body.us
%indvars.iv73 = phi i64 [ %indvars.iv.next74.3, %while.body.us ], [ %indvars.iv73.unr, %while.body.us.prol.loopexit ]
%indvars.iv.next74 = add nsw i64 %indvars.iv73, 1
%arrayidx.i47.us = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %indvars.iv73
%12 = load i32, ptr %arrayidx.i47.us, align 4, !tbaa !5
%idxprom29.us = sext i32 %12 to i64
%arrayidx30.us = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom29.us
store i32 2, ptr %arrayidx30.us, align 4, !tbaa !5
%indvars.iv.next74.1 = add nsw i64 %indvars.iv73, 2
%arrayidx.i47.us.1 = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %indvars.iv.next74
%13 = load i32, ptr %arrayidx.i47.us.1, align 4, !tbaa !5
%idxprom29.us.1 = sext i32 %13 to i64
%arrayidx30.us.1 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom29.us.1
store i32 2, ptr %arrayidx30.us.1, align 4, !tbaa !5
%indvars.iv.next74.2 = add nsw i64 %indvars.iv73, 3
%arrayidx.i47.us.2 = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %indvars.iv.next74.1
%14 = load i32, ptr %arrayidx.i47.us.2, align 4, !tbaa !5
%idxprom29.us.2 = sext i32 %14 to i64
%arrayidx30.us.2 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom29.us.2
store i32 2, ptr %arrayidx30.us.2, align 4, !tbaa !5
%indvars.iv.next74.3 = add nsw i64 %indvars.iv73, 4
%arrayidx.i47.us.3 = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %indvars.iv.next74.2
%15 = load i32, ptr %arrayidx.i47.us.3, align 4, !tbaa !5
%idxprom29.us.3 = sext i32 %15 to i64
%arrayidx30.us.3 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom29.us.3
store i32 2, ptr %arrayidx30.us.3, align 4, !tbaa !5
%16 = icmp eq i64 %indvars.iv.next74.2, %idxprom.i
br i1 %16, label %while.cond.while.end_crit_edge.loopexit, label %while.body.us, !llvm.loop !11
while.body: ; preds = %while.body.preheader, %for.cond9.for.end28_crit_edge
%indvars.iv70 = phi i64 [ %5, %while.body.preheader ], [ %indvars.iv.next71, %for.cond9.for.end28_crit_edge ]
%b.promoted6365 = phi i32 [ %inc.i, %while.body.preheader ], [ %b.promoted60, %for.cond9.for.end28_crit_edge ]
%arrayidx.i47 = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %indvars.iv70
%17 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom15 = sext i32 %17 to i64
%arrayidx23 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %idxprom15
br label %for.body11
for.body11: ; preds = %while.body, %for.inc26
%indvars.iv = phi i64 [ 1, %while.body ], [ %indvars.iv.next, %for.inc26 ]
%b.promoted61 = phi i32 [ %b.promoted6365, %while.body ], [ %b.promoted60, %for.inc26 ]
%inc.i505456 = phi i32 [ %b.promoted6365, %while.body ], [ %inc.i5053, %for.inc26 ]
%arrayidx13 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %indvars.iv
%18 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp14 = icmp eq i32 %18, 0
br i1 %cmp14, label %land.lhs.true, label %for.inc26
land.lhs.true: ; preds = %for.body11
%arrayidx18 = getelementptr inbounds [101 x [101 x i32]], ptr @G, i64 0, i64 %idxprom15, i64 %indvars.iv
%19 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%cmp19 = icmp eq i32 %19, 1
br i1 %cmp19, label %if.then, label %for.inc26
if.then: ; preds = %land.lhs.true
%idxprom.i48 = sext i32 %inc.i505456 to i64
%arrayidx.i49 = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %idxprom.i48
%20 = trunc i64 %indvars.iv to i32
store i32 %20, ptr %arrayidx.i49, align 4, !tbaa !5
%inc.i50 = add nsw i32 %inc.i505456, 1
store i32 %inc.i50, ptr @b, align 4, !tbaa !5
store i32 1, ptr %arrayidx13, align 4, !tbaa !5
%21 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%add = add nsw i32 %21, 1
%arrayidx25 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %indvars.iv
store i32 %add, ptr %arrayidx25, align 4, !tbaa !5
br label %for.inc26
for.inc26: ; preds = %for.body11, %land.lhs.true, %if.then
%b.promoted60 = phi i32 [ %b.promoted61, %for.body11 ], [ %b.promoted61, %land.lhs.true ], [ %inc.i50, %if.then ]
%inc.i5053 = phi i32 [ %inc.i505456, %for.body11 ], [ %inc.i505456, %land.lhs.true ], [ %inc.i50, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond9.for.end28_crit_edge, label %for.body11, !llvm.loop !13
for.cond9.for.end28_crit_edge: ; preds = %for.inc26
%indvars.iv.next71 = add i64 %indvars.iv70, 1
%arrayidx30 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom15
store i32 2, ptr %arrayidx30, align 4, !tbaa !5
%22 = trunc i64 %indvars.iv.next71 to i32
%cmp.i.not = icmp eq i32 %b.promoted60, %22
br i1 %cmp.i.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !11
while.cond.while.end_crit_edge.loopexit: ; preds = %while.body.us, %while.body.us.prol.loopexit
%indvars.iv.next74.lcssa = phi i64 [ %indvars.iv.next74.lcssa.unr, %while.body.us.prol.loopexit ], [ %indvars.iv.next74.3, %while.body.us ]
%23 = trunc i64 %indvars.iv.next74.lcssa to i32
br label %while.cond.while.end_crit_edge
while.cond.while.end_crit_edge: ; preds = %for.cond9.for.end28_crit_edge, %while.cond.while.end_crit_edge.loopexit
%.us-phi = phi i32 [ %23, %while.cond.while.end_crit_edge.loopexit ], [ %b.promoted60, %for.cond9.for.end28_crit_edge ]
store i32 %.us-phi, ptr @a, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %for.end
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%1 = zext i32 %add to i64
%add1 = add nsw i32 %0, 2
%2 = zext i32 %add1 to i64
%3 = mul nuw i64 %1, %2
%vla = alloca i32, i64 %3, align 16
%cmp.not93 = icmp slt i32 %0, 1
br i1 %cmp.not93, label %for.end.i, label %for.body
for.cond23.preheader: ; preds = %for.inc20
%cmp24.not100 = icmp slt i32 %11, 1
br i1 %cmp24.not100, label %for.end.i, label %for.cond26.preheader.preheader
for.cond26.preheader.preheader: ; preds = %for.cond23.preheader
%4 = zext i32 %11 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw i32 %11, 1
%wide.trip.count122 = zext i32 %6 to i64
br label %for.cond26.preheader
for.body: ; preds = %entry, %for.inc20
%indvars.iv108 = phi i64 [ %indvars.iv.next109, %for.inc20 ], [ 1, %entry ]
%7 = mul nuw nsw i64 %indvars.iv108, %2
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %7
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%arrayidx6 = getelementptr inbounds i32, ptr %arrayidx, i64 1
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6)
%8 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp1291 = icmp sgt i32 %8, 0
br i1 %cmp1291, label %for.body13.preheader, label %for.inc20
for.body13.preheader: ; preds = %for.body
%invariant.gep = getelementptr i32, ptr %arrayidx, i64 2
br label %for.body13
for.body13: ; preds = %for.body13.preheader, %for.body13
%indvars.iv = phi i64 [ 0, %for.body13.preheader ], [ %indvars.iv.next, %for.body13 ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %gep)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp12 = icmp slt i64 %indvars.iv.next, %10
br i1 %cmp12, label %for.body13, label %for.inc20, !llvm.loop !14
for.inc20: ; preds = %for.body13, %for.body
%indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
%11 = load i32, ptr @n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp.not.not = icmp slt i64 %indvars.iv108, %12
br i1 %cmp.not.not, label %for.body, label %for.cond23.preheader, !llvm.loop !15
for.cond26.preheader: ; preds = %for.cond26.preheader.preheader, %for.cond26.for.inc55_crit_edge
%indvars.iv124 = phi i64 [ 1, %for.cond26.preheader.preheader ], [ %indvars.iv.next125, %for.cond26.for.inc55_crit_edge ]
%indvar = phi i64 [ 0, %for.cond26.preheader.preheader ], [ %indvar.next, %for.cond26.for.inc55_crit_edge ]
%13 = mul nuw nsw i64 %indvars.iv124, %2
%arrayidx35 = getelementptr inbounds i32, ptr %vla, i64 %13
%arrayidx36 = getelementptr inbounds i32, ptr %arrayidx35, i64 1
%14 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%cmp3795 = icmp sgt i32 %14, 0
br i1 %cmp3795, label %for.body28.us.preheader, label %for.body28.preheader
for.body28.preheader: ; preds = %for.cond26.preheader
%15 = mul nuw nsw i64 %indvar, 404
%gep138 = getelementptr i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @G, i64 0, i64 1, i64 1), i64 %15
call void @llvm.memset.p0.i64(ptr align 4 %gep138, i8 0, i64 %5, i1 false), !tbaa !5
br label %for.cond26.for.inc55_crit_edge
for.body28.us.preheader: ; preds = %for.cond26.preheader
%wide.trip.count = zext i32 %14 to i64
%invariant.gep136 = getelementptr i32, ptr %arrayidx35, i64 2
br label %for.body28.us
for.body28.us: ; preds = %for.body28.us.preheader, %for.inc52.us
%indvars.iv119 = phi i64 [ 1, %for.body28.us.preheader ], [ %indvars.iv.next120, %for.inc52.us ]
%arrayidx32.us = getelementptr inbounds [101 x [101 x i32]], ptr @G, i64 0, i64 %indvars.iv124, i64 %indvars.iv119
store i32 0, ptr %arrayidx32.us, align 4, !tbaa !5
br label %for.body38.us
for.cond33.us: ; preds = %for.body38.us
%indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
%exitcond.not = icmp eq i64 %indvars.iv.next115, %wide.trip.count
br i1 %exitcond.not, label %for.inc52.us, label %for.body38.us, !llvm.loop !16
for.body38.us: ; preds = %for.body28.us, %for.cond33.us
%indvars.iv114 = phi i64 [ 0, %for.body28.us ], [ %indvars.iv.next115, %for.cond33.us ]
%gep137 = getelementptr i32, ptr %invariant.gep136, i64 %indvars.iv114
%16 = load i32, ptr %gep137, align 4, !tbaa !5
%17 = zext i32 %16 to i64
%cmp44.us = icmp eq i64 %indvars.iv119, %17
br i1 %cmp44.us, label %if.then.us, label %for.cond33.us
if.then.us: ; preds = %for.body38.us
store i32 1, ptr %arrayidx32.us, align 4, !tbaa !5
br label %for.inc52.us
for.inc52.us: ; preds = %for.cond33.us, %if.then.us
%indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
%exitcond123.not = icmp eq i64 %indvars.iv.next120, %wide.trip.count122
br i1 %exitcond123.not, label %for.cond26.for.inc55_crit_edge, label %for.body28.us, !llvm.loop !17
for.cond26.for.inc55_crit_edge: ; preds = %for.inc52.us, %for.body28.preheader
%indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
%indvar.next = add nuw nsw i64 %indvar, 1
%exitcond128.not = icmp eq i64 %indvar.next, %4
br i1 %exitcond128.not, label %for.end57, label %for.cond26.preheader, !llvm.loop !18
for.end57: ; preds = %for.cond26.for.inc55_crit_edge
br i1 %cmp24.not100, label %for.end.i, label %for.body.preheader.i
for.body.preheader.i: ; preds = %for.end57
%18 = zext i32 %11 to i64
%19 = shl nuw nsw i64 %18, 2
call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([101 x i32], ptr @color, i64 0, i64 1), i8 0, i64 %19, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([101 x i32], ptr @d, i64 0, i64 1), i8 -1, i64 %19, i1 false), !tbaa !5
br label %for.end.i
for.end.i: ; preds = %entry, %for.cond23.preheader, %for.body.preheader.i, %for.end57
%20 = phi i32 [ %11, %for.body.preheader.i ], [ %11, %for.end57 ], [ %11, %for.cond23.preheader ], [ %0, %entry ]
%cmp24.not100133135 = phi i1 [ false, %for.body.preheader.i ], [ true, %for.end57 ], [ true, %for.cond23.preheader ], [ true, %entry ]
store i32 1, ptr getelementptr inbounds ([101 x i32], ptr @color, i64 0, i64 1), align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([101 x i32], ptr @d, i64 0, i64 1), align 4, !tbaa !5
%21 = load i32, ptr @b, align 4, !tbaa !5
%idxprom.i.i = sext i32 %21 to i64
%arrayidx.i.i = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %idxprom.i.i
store i32 1, ptr %arrayidx.i.i, align 4, !tbaa !5
%inc.i.i = add nsw i32 %21, 1
store i32 %inc.i.i, ptr @b, align 4, !tbaa !5
%a.promoted.i = load i32, ptr @a, align 4, !tbaa !5
%cmp.i.not64.i = icmp eq i32 %a.promoted.i, %inc.i.i
br i1 %cmp.i.not64.i, label %bfs.exit, label %while.body.lr.ph.i
while.body.lr.ph.i: ; preds = %for.end.i
br i1 %cmp24.not100133135, label %while.body.us.preheader.i, label %while.body.preheader.i
while.body.preheader.i: ; preds = %while.body.lr.ph.i
%22 = add nuw nsw i32 %20, 1
%23 = sext i32 %a.promoted.i to i64
%wide.trip.count.i = zext i32 %22 to i64
br label %while.body.i
while.body.us.preheader.i: ; preds = %while.body.lr.ph.i
%24 = sext i32 %a.promoted.i to i64
%25 = add nsw i64 %idxprom.i.i, 1
%26 = sub nsw i64 %25, %24
%27 = sub nsw i64 %idxprom.i.i, %24
%xtraiter = and i64 %26, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.body.us.i.prol.loopexit, label %while.body.us.i.prol
while.body.us.i.prol: ; preds = %while.body.us.preheader.i, %while.body.us.i.prol
%indvars.iv73.i.prol = phi i64 [ %indvars.iv.next74.i.prol, %while.body.us.i.prol ], [ %24, %while.body.us.preheader.i ]
%prol.iter = phi i64 [ %prol.iter.next, %while.body.us.i.prol ], [ 0, %while.body.us.preheader.i ]
%indvars.iv.next74.i.prol = add nsw i64 %indvars.iv73.i.prol, 1
%arrayidx.i47.us.i.prol = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %indvars.iv73.i.prol
%28 = load i32, ptr %arrayidx.i47.us.i.prol, align 4, !tbaa !5
%idxprom29.us.i.prol = sext i32 %28 to i64
%arrayidx30.us.i.prol = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom29.us.i.prol
store i32 2, ptr %arrayidx30.us.i.prol, align 4, !tbaa !5
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %while.body.us.i.prol.loopexit, label %while.body.us.i.prol, !llvm.loop !19
while.body.us.i.prol.loopexit: ; preds = %while.body.us.i.prol, %while.body.us.preheader.i
%indvars.iv.next74.i.lcssa.unr = phi i64 [ undef, %while.body.us.preheader.i ], [ %indvars.iv.next74.i.prol, %while.body.us.i.prol ]
%indvars.iv73.i.unr = phi i64 [ %24, %while.body.us.preheader.i ], [ %indvars.iv.next74.i.prol, %while.body.us.i.prol ]
%29 = icmp ult i64 %27, 3
br i1 %29, label %while.cond.while.end_crit_edge.loopexit.i, label %while.body.us.i
while.body.us.i: ; preds = %while.body.us.i.prol.loopexit, %while.body.us.i
%indvars.iv73.i = phi i64 [ %indvars.iv.next74.i.3, %while.body.us.i ], [ %indvars.iv73.i.unr, %while.body.us.i.prol.loopexit ]
%indvars.iv.next74.i = add nsw i64 %indvars.iv73.i, 1
%arrayidx.i47.us.i = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %indvars.iv73.i
%30 = load i32, ptr %arrayidx.i47.us.i, align 4, !tbaa !5
%idxprom29.us.i = sext i32 %30 to i64
%arrayidx30.us.i = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom29.us.i
store i32 2, ptr %arrayidx30.us.i, align 4, !tbaa !5
%indvars.iv.next74.i.1 = add nsw i64 %indvars.iv73.i, 2
%arrayidx.i47.us.i.1 = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %indvars.iv.next74.i
%31 = load i32, ptr %arrayidx.i47.us.i.1, align 4, !tbaa !5
%idxprom29.us.i.1 = sext i32 %31 to i64
%arrayidx30.us.i.1 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom29.us.i.1
store i32 2, ptr %arrayidx30.us.i.1, align 4, !tbaa !5
%indvars.iv.next74.i.2 = add nsw i64 %indvars.iv73.i, 3
%arrayidx.i47.us.i.2 = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %indvars.iv.next74.i.1
%32 = load i32, ptr %arrayidx.i47.us.i.2, align 4, !tbaa !5
%idxprom29.us.i.2 = sext i32 %32 to i64
%arrayidx30.us.i.2 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom29.us.i.2
store i32 2, ptr %arrayidx30.us.i.2, align 4, !tbaa !5
%indvars.iv.next74.i.3 = add nsw i64 %indvars.iv73.i, 4
%arrayidx.i47.us.i.3 = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %indvars.iv.next74.i.2
%33 = load i32, ptr %arrayidx.i47.us.i.3, align 4, !tbaa !5
%idxprom29.us.i.3 = sext i32 %33 to i64
%arrayidx30.us.i.3 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom29.us.i.3
store i32 2, ptr %arrayidx30.us.i.3, align 4, !tbaa !5
%34 = icmp eq i64 %indvars.iv.next74.i.2, %idxprom.i.i
br i1 %34, label %while.cond.while.end_crit_edge.loopexit.i, label %while.body.us.i, !llvm.loop !11
while.body.i: ; preds = %for.cond9.for.end28_crit_edge.i, %while.body.preheader.i
%indvars.iv70.i = phi i64 [ %23, %while.body.preheader.i ], [ %indvars.iv.next71.i, %for.cond9.for.end28_crit_edge.i ]
%b.promoted6365.i = phi i32 [ %inc.i.i, %while.body.preheader.i ], [ %b.promoted60.i, %for.cond9.for.end28_crit_edge.i ]
%arrayidx.i47.i = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %indvars.iv70.i
%35 = load i32, ptr %arrayidx.i47.i, align 4, !tbaa !5
%idxprom15.i = sext i32 %35 to i64
%arrayidx23.i = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %idxprom15.i
br label %for.body11.i
for.body11.i: ; preds = %for.inc26.i, %while.body.i
%indvars.iv.i = phi i64 [ 1, %while.body.i ], [ %indvars.iv.next.i, %for.inc26.i ]
%b.promoted61.i = phi i32 [ %b.promoted6365.i, %while.body.i ], [ %b.promoted60.i, %for.inc26.i ]
%inc.i505456.i = phi i32 [ %b.promoted6365.i, %while.body.i ], [ %inc.i5053.i, %for.inc26.i ]
%arrayidx13.i = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %indvars.iv.i
%36 = load i32, ptr %arrayidx13.i, align 4, !tbaa !5
%cmp14.i = icmp eq i32 %36, 0
br i1 %cmp14.i, label %land.lhs.true.i, label %for.inc26.i
land.lhs.true.i: ; preds = %for.body11.i
%arrayidx18.i = getelementptr inbounds [101 x [101 x i32]], ptr @G, i64 0, i64 %idxprom15.i, i64 %indvars.iv.i
%37 = load i32, ptr %arrayidx18.i, align 4, !tbaa !5
%cmp19.i = icmp eq i32 %37, 1
br i1 %cmp19.i, label %if.then.i, label %for.inc26.i
if.then.i: ; preds = %land.lhs.true.i
%idxprom.i48.i = sext i32 %inc.i505456.i to i64
%arrayidx.i49.i = getelementptr inbounds [101 x i32], ptr @Q, i64 0, i64 %idxprom.i48.i
%38 = trunc i64 %indvars.iv.i to i32
store i32 %38, ptr %arrayidx.i49.i, align 4, !tbaa !5
%inc.i50.i = add nsw i32 %inc.i505456.i, 1
store i32 %inc.i50.i, ptr @b, align 4, !tbaa !5
store i32 1, ptr %arrayidx13.i, align 4, !tbaa !5
%39 = load i32, ptr %arrayidx23.i, align 4, !tbaa !5
%add.i = add nsw i32 %39, 1
%arrayidx25.i = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %indvars.iv.i
store i32 %add.i, ptr %arrayidx25.i, align 4, !tbaa !5
br label %for.inc26.i
for.inc26.i: ; preds = %if.then.i, %land.lhs.true.i, %for.body11.i
%b.promoted60.i = phi i32 [ %b.promoted61.i, %for.body11.i ], [ %b.promoted61.i, %land.lhs.true.i ], [ %inc.i50.i, %if.then.i ]
%inc.i5053.i = phi i32 [ %inc.i505456.i, %for.body11.i ], [ %inc.i505456.i, %land.lhs.true.i ], [ %inc.i50.i, %if.then.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %for.cond9.for.end28_crit_edge.i, label %for.body11.i, !llvm.loop !13
for.cond9.for.end28_crit_edge.i: ; preds = %for.inc26.i
%indvars.iv.next71.i = add i64 %indvars.iv70.i, 1
%arrayidx30.i = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom15.i
store i32 2, ptr %arrayidx30.i, align 4, !tbaa !5
%40 = trunc i64 %indvars.iv.next71.i to i32
%cmp.i.not.i = icmp eq i32 %b.promoted60.i, %40
br i1 %cmp.i.not.i, label %while.cond.while.end_crit_edge.i, label %while.body.i, !llvm.loop !11
while.cond.while.end_crit_edge.loopexit.i: ; preds = %while.body.us.i, %while.body.us.i.prol.loopexit
%indvars.iv.next74.i.lcssa = phi i64 [ %indvars.iv.next74.i.lcssa.unr, %while.body.us.i.prol.loopexit ], [ %indvars.iv.next74.i.3, %while.body.us.i ]
%41 = trunc i64 %indvars.iv.next74.i.lcssa to i32
br label %while.cond.while.end_crit_edge.i
while.cond.while.end_crit_edge.i: ; preds = %for.cond9.for.end28_crit_edge.i, %while.cond.while.end_crit_edge.loopexit.i
%.us-phi.i = phi i32 [ %41, %while.cond.while.end_crit_edge.loopexit.i ], [ %b.promoted60.i, %for.cond9.for.end28_crit_edge.i ]
store i32 %.us-phi.i, ptr @a, align 4, !tbaa !5
br label %bfs.exit
bfs.exit: ; preds = %for.end.i, %while.cond.while.end_crit_edge.i
br i1 %cmp24.not100133135, label %for.end66, label %for.body60
for.body60: ; preds = %bfs.exit, %for.body60
%indvars.iv129 = phi i64 [ %indvars.iv.next130, %for.body60 ], [ 1, %bfs.exit ]
%arrayidx62 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %indvars.iv129
%42 = load i32, ptr %arrayidx62, align 4, !tbaa !5
%43 = trunc i64 %indvars.iv129 to i32
%call63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %43, i32 noundef %42)
%indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
%44 = load i32, ptr @n, align 4, !tbaa !5
%45 = sext i32 %44 to i64
%cmp59.not.not = icmp slt i64 %indvars.iv129, %45
br i1 %cmp59.not.not, label %for.body60, label %for.end66, !llvm.loop !20
for.end66: ; preds = %for.body60, %bfs.exit
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) 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 nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) 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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 #3 = { 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 #4 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
!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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !12}
|
#include <stdio.h>
#include <stdlib.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define MAX_N 100
int n,time,head,tail;
int *queue;
int *dist;
int *color;
int **matrix;
void enqueue(int);
int dequeue(void);
void bfs(void);
int main(){
int i,j,u,k,v;
scanf("%d",&n);
queue = malloc(MAX_N * sizeof(int));
color = malloc(n * sizeof(int));
dist = malloc(n * sizeof(int));
matrix = malloc(n * sizeof(int *));
for(i = 0 ; i < n ; i++){
matrix[i] = malloc(n * sizeof(int));
}
for(i = 0 ; i < n ; i++){
dist[i] = -1;
}
for(i = 0 ; i < n ; i++){
for(j = 0 ; j < n ; j++){
matrix[i][j] = 0;
}
}
for(i = 0 ; i < n ; i++){
scanf("%d",&u); u--;
scanf("%d",&k);
for(j = 0 ; j < k ; j++){
scanf("%d",&v); v--;
matrix[u][v] = 1;
}
}
bfs();
for(i = 0 ; i < n ; i++){
printf("%d %d\n",i+1,dist[i]);
}
for(i = 0 ; i < n ; i++){
free(matrix[i]);
}
free(matrix);
free(queue);
free(dist);
free(color);
return 0;
}
void bfs(){
int u,i;
head = tail = 0;
color[0] = GRAY;
dist[0] = 0;
enqueue(0);
while(head != tail){
u = dequeue();
for(i = 0 ; i < n ; i++){
if(matrix[u][i] == 1 && color[i] == WHITE){
color[i] = GRAY;
dist[i] = dist[u] + 1;
enqueue(i);
}
}
color[u] = BLACK;
}
}
void enqueue(int q){
queue[tail] = q;
if(++tail == n+1) tail = 0;
}
int dequeue(){
int v = queue[head];
if(++head == n+1) head = 0;
return v;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327226/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327226/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@queue = dso_local local_unnamed_addr global ptr null, align 8
@color = dso_local local_unnamed_addr global ptr null, align 8
@dist = dso_local local_unnamed_addr global ptr null, align 8
@matrix = dso_local local_unnamed_addr global ptr null, align 8
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@tail = dso_local local_unnamed_addr global i32 0, align 4
@head = dso_local local_unnamed_addr global i32 0, align 4
@time = dso_local local_unnamed_addr global i32 0, align 4
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #8
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%call1 = tail call noalias dereferenceable_or_null(400) ptr @malloc(i64 noundef 400) #9
store ptr %call1, ptr @queue, align 8, !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !9
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call2 = tail call noalias ptr @malloc(i64 noundef %mul) #9
store ptr %call2, ptr @color, align 8, !tbaa !5
%call5 = tail call noalias ptr @malloc(i64 noundef %mul) #9
store ptr %call5, ptr @dist, align 8, !tbaa !5
%mul7 = shl nsw i64 %conv, 3
%call8 = tail call noalias ptr @malloc(i64 noundef %mul7) #9
store ptr %call8, ptr @matrix, align 8, !tbaa !5
%cmp102 = icmp sgt i32 %0, 0
br i1 %cmp102, label %for.body.preheader, label %for.end61
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.cond13.preheader: ; preds = %for.body
br i1 %cmp102, label %for.body16.lr.ph, label %for.end61
for.body16.lr.ph: ; preds = %for.cond13.preheader
%1 = load ptr, ptr @dist, align 8, !tbaa !5
br label %for.body16
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%call12 = tail call noalias ptr @malloc(i64 noundef %mul) #9
%2 = load ptr, ptr @matrix, align 8, !tbaa !5
%arrayidx = getelementptr inbounds ptr, ptr %2, i64 %indvars.iv
store ptr %call12, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond13.preheader, label %for.body, !llvm.loop !11
for.cond22.preheader: ; preds = %for.body16
%cmp23108 = icmp sgt i32 %4, 0
br i1 %cmp23108, label %for.cond26.preheader.preheader, label %for.end61
for.cond26.preheader.preheader: ; preds = %for.cond22.preheader
%3 = load ptr, ptr @matrix, align 8
br label %for.cond26.preheader
for.body16: ; preds = %for.body16.lr.ph, %for.body16
%indvars.iv120 = phi i64 [ 0, %for.body16.lr.ph ], [ %indvars.iv.next121, %for.body16 ]
%arrayidx18 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv120
store i32 -1, ptr %arrayidx18, align 4, !tbaa !9
%indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
%4 = load i32, ptr @n, align 4, !tbaa !9
%5 = sext i32 %4 to i64
%cmp14 = icmp slt i64 %indvars.iv.next121, %5
br i1 %cmp14, label %for.body16, label %for.cond22.preheader, !llvm.loop !13
for.cond26.preheader: ; preds = %for.cond26.preheader.preheader, %for.inc37
%6 = phi i32 [ %4, %for.cond26.preheader.preheader ], [ %11, %for.inc37 ]
%indvars.iv126 = phi i64 [ 0, %for.cond26.preheader.preheader ], [ %indvars.iv.next127, %for.inc37 ]
%cmp27106 = icmp sgt i32 %6, 0
br i1 %cmp27106, label %for.body29.lr.ph, label %for.cond26.preheader.for.inc37_crit_edge
for.cond26.preheader.for.inc37_crit_edge: ; preds = %for.cond26.preheader
%.pre = sext i32 %6 to i64
br label %for.inc37
for.body29.lr.ph: ; preds = %for.cond26.preheader
%arrayidx31 = getelementptr inbounds ptr, ptr %3, i64 %indvars.iv126
%7 = load ptr, ptr %arrayidx31, align 8, !tbaa !5
br label %for.body29
for.cond40.preheader: ; preds = %for.inc37
%8 = icmp sgt i32 %11, 0
br i1 %8, label %for.body43, label %for.end61
for.body29: ; preds = %for.body29.lr.ph, %for.body29
%indvars.iv123 = phi i64 [ 0, %for.body29.lr.ph ], [ %indvars.iv.next124, %for.body29 ]
%arrayidx33 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv123
store i32 0, ptr %arrayidx33, align 4, !tbaa !9
%indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
%9 = load i32, ptr @n, align 4, !tbaa !9
%10 = sext i32 %9 to i64
%cmp27 = icmp slt i64 %indvars.iv.next124, %10
br i1 %cmp27, label %for.body29, label %for.inc37, !llvm.loop !14
for.inc37: ; preds = %for.body29, %for.cond26.preheader.for.inc37_crit_edge
%.pre-phi = phi i64 [ %.pre, %for.cond26.preheader.for.inc37_crit_edge ], [ %10, %for.body29 ]
%11 = phi i32 [ %6, %for.cond26.preheader.for.inc37_crit_edge ], [ %9, %for.body29 ]
%indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
%cmp23 = icmp slt i64 %indvars.iv.next127, %.pre-phi
br i1 %cmp23, label %for.cond26.preheader, label %for.cond40.preheader, !llvm.loop !15
for.body43: ; preds = %for.cond40.preheader, %for.inc59
%i.3113 = phi i32 [ %inc60, %for.inc59 ], [ 0, %for.cond40.preheader ]
%call44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %u)
%12 = load i32, ptr %u, align 4, !tbaa !9
%dec = add nsw i32 %12, -1
store i32 %dec, ptr %u, align 4, !tbaa !9
%call45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%13 = load i32, ptr %k, align 4, !tbaa !9
%cmp47110 = icmp sgt i32 %13, 0
br i1 %cmp47110, label %for.body49, label %for.inc59
for.body49: ; preds = %for.body43, %for.body49
%j.1111 = phi i32 [ %inc57, %for.body49 ], [ 0, %for.body43 ]
%call50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%14 = load i32, ptr %v, align 4, !tbaa !9
%dec51 = add nsw i32 %14, -1
store i32 %dec51, ptr %v, align 4, !tbaa !9
%15 = load ptr, ptr @matrix, align 8, !tbaa !5
%16 = load i32, ptr %u, align 4, !tbaa !9
%idxprom52 = sext i32 %16 to i64
%arrayidx53 = getelementptr inbounds ptr, ptr %15, i64 %idxprom52
%17 = load ptr, ptr %arrayidx53, align 8, !tbaa !5
%idxprom54 = sext i32 %dec51 to i64
%arrayidx55 = getelementptr inbounds i32, ptr %17, i64 %idxprom54
store i32 1, ptr %arrayidx55, align 4, !tbaa !9
%inc57 = add nuw nsw i32 %j.1111, 1
%18 = load i32, ptr %k, align 4, !tbaa !9
%cmp47 = icmp slt i32 %inc57, %18
br i1 %cmp47, label %for.body49, label %for.inc59, !llvm.loop !17
for.inc59: ; preds = %for.body49, %for.body43
%inc60 = add nuw nsw i32 %i.3113, 1
%19 = load i32, ptr @n, align 4, !tbaa !9
%cmp41 = icmp slt i32 %inc60, %19
br i1 %cmp41, label %for.body43, label %for.end61, !llvm.loop !18
for.end61: ; preds = %for.inc59, %entry, %for.cond13.preheader, %for.cond22.preheader, %for.cond40.preheader
call void @bfs()
%20 = load i32, ptr @n, align 4, !tbaa !9
%cmp63114 = icmp sgt i32 %20, 0
br i1 %cmp63114, label %for.body65, label %for.end80
for.cond72.preheader: ; preds = %for.body65
%21 = icmp sgt i32 %25, 0
br i1 %21, label %for.body75, label %for.end80
for.body65: ; preds = %for.end61, %for.body65
%indvars.iv129 = phi i64 [ %indvars.iv.next130, %for.body65 ], [ 0, %for.end61 ]
%indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
%22 = load ptr, ptr @dist, align 8, !tbaa !5
%arrayidx67 = getelementptr inbounds i32, ptr %22, i64 %indvars.iv129
%23 = load i32, ptr %arrayidx67, align 4, !tbaa !9
%24 = trunc i64 %indvars.iv.next130 to i32
%call68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %24, i32 noundef %23)
%25 = load i32, ptr @n, align 4, !tbaa !9
%26 = sext i32 %25 to i64
%cmp63 = icmp slt i64 %indvars.iv.next130, %26
br i1 %cmp63, label %for.body65, label %for.cond72.preheader, !llvm.loop !19
for.body75: ; preds = %for.cond72.preheader, %for.body75
%indvars.iv132 = phi i64 [ %indvars.iv.next133, %for.body75 ], [ 0, %for.cond72.preheader ]
%27 = load ptr, ptr @matrix, align 8, !tbaa !5
%arrayidx77 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv132
%28 = load ptr, ptr %arrayidx77, align 8, !tbaa !5
call void @free(ptr noundef %28) #8
%indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
%29 = load i32, ptr @n, align 4, !tbaa !9
%30 = sext i32 %29 to i64
%cmp73 = icmp slt i64 %indvars.iv.next133, %30
br i1 %cmp73, label %for.body75, label %for.end80, !llvm.loop !20
for.end80: ; preds = %for.body75, %for.end61, %for.cond72.preheader
%31 = load ptr, ptr @matrix, align 8, !tbaa !5
call void @free(ptr noundef %31) #8
%32 = load ptr, ptr @queue, align 8, !tbaa !5
call void @free(ptr noundef %32) #8
%33 = load ptr, ptr @dist, align 8, !tbaa !5
call void @free(ptr noundef %33) #8
%34 = load ptr, ptr @color, align 8, !tbaa !5
call void @free(ptr noundef %34) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #8
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @bfs() local_unnamed_addr #4 {
entry:
store i32 0, ptr @tail, align 4, !tbaa !9
store i32 0, ptr @head, align 4, !tbaa !9
%0 = load ptr, ptr @color, align 8, !tbaa !5
store i32 1, ptr %0, align 4, !tbaa !9
%1 = load ptr, ptr @dist, align 8, !tbaa !5
store i32 0, ptr %1, align 4, !tbaa !9
%2 = load ptr, ptr @queue, align 8, !tbaa !5
%3 = load i32, ptr @tail, align 4, !tbaa !9
%idxprom.i = sext i32 %3 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %2, i64 %idxprom.i
store i32 0, ptr %arrayidx.i, align 4, !tbaa !9
%4 = load i32, ptr @tail, align 4, !tbaa !9
%inc.i = add nsw i32 %4, 1
%5 = load i32, ptr @n, align 4, !tbaa !9
%cmp.i = icmp eq i32 %4, %5
%spec.store.select.i = select i1 %cmp.i, i32 0, i32 %inc.i
store i32 %spec.store.select.i, ptr @tail, align 4
%6 = load i32, ptr @head, align 4, !tbaa !9
%cmp.not38 = icmp eq i32 %6, %spec.store.select.i
br i1 %cmp.not38, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%7 = load ptr, ptr @matrix, align 8
br label %while.body
while.body: ; preds = %while.body.lr.ph, %for.end
%8 = phi i32 [ %6, %while.body.lr.ph ], [ %21, %for.end ]
%idxprom.i26 = sext i32 %8 to i64
%arrayidx.i27 = getelementptr inbounds i32, ptr %2, i64 %idxprom.i26
%9 = load i32, ptr %arrayidx.i27, align 4, !tbaa !9
%inc.i28 = add nsw i32 %8, 1
%10 = load i32, ptr @n, align 4, !tbaa !9
%cmp.i29 = icmp eq i32 %8, %10
%spec.store.select.i30 = select i1 %cmp.i29, i32 0, i32 %inc.i28
store i32 %spec.store.select.i30, ptr @head, align 4
%cmp236 = icmp sgt i32 %10, 0
%idxprom = sext i32 %9 to i64
br i1 %cmp236, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %while.body
%arrayidx3 = getelementptr inbounds ptr, ptr %7, i64 %idxprom
%arrayidx13 = getelementptr inbounds i32, ptr %1, i64 %idxprom
%.pre = load ptr, ptr %arrayidx3, align 8, !tbaa !5
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%11 = phi i32 [ %10, %for.body.lr.ph ], [ %19, %for.inc ]
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%arrayidx5 = getelementptr inbounds i32, ptr %.pre, i64 %indvars.iv
%12 = load i32, ptr %arrayidx5, align 4, !tbaa !9
%cmp6 = icmp eq i32 %12, 1
br i1 %cmp6, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%arrayidx8 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv
%13 = load i32, ptr %arrayidx8, align 4, !tbaa !9
%cmp9 = icmp eq i32 %13, 0
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true
store i32 1, ptr %arrayidx8, align 4, !tbaa !9
%14 = load i32, ptr %arrayidx13, align 4, !tbaa !9
%add = add nsw i32 %14, 1
%arrayidx15 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv
store i32 %add, ptr %arrayidx15, align 4, !tbaa !9
%15 = load i32, ptr @tail, align 4, !tbaa !9
%idxprom.i31 = sext i32 %15 to i64
%arrayidx.i32 = getelementptr inbounds i32, ptr %2, i64 %idxprom.i31
%16 = trunc i64 %indvars.iv to i32
store i32 %16, ptr %arrayidx.i32, align 4, !tbaa !9
%17 = load i32, ptr @tail, align 4, !tbaa !9
%inc.i33 = add nsw i32 %17, 1
%18 = load i32, ptr @n, align 4, !tbaa !9
%cmp.i34 = icmp eq i32 %17, %18
%spec.store.select.i35 = select i1 %cmp.i34, i32 0, i32 %inc.i33
store i32 %spec.store.select.i35, ptr @tail, align 4
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %if.then
%19 = phi i32 [ %11, %for.body ], [ %11, %land.lhs.true ], [ %18, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%20 = sext i32 %19 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %20
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !21
for.end: ; preds = %for.inc, %while.body
%arrayidx17 = getelementptr inbounds i32, ptr %0, i64 %idxprom
store i32 2, ptr %arrayidx17, align 4, !tbaa !9
%21 = load i32, ptr @head, align 4, !tbaa !9
%22 = load i32, ptr @tail, align 4, !tbaa !9
%cmp.not = icmp eq i32 %21, %22
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !22
while.end: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: write, inaccessiblemem: none) uwtable
define dso_local void @enqueue(i32 noundef %q) local_unnamed_addr #6 {
entry:
%0 = load ptr, ptr @queue, align 8, !tbaa !5
%1 = load i32, ptr @tail, align 4, !tbaa !9
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds i32, ptr %0, i64 %idxprom
store i32 %q, ptr %arrayidx, align 4, !tbaa !9
%2 = load i32, ptr @tail, align 4, !tbaa !9
%inc = add nsw i32 %2, 1
%3 = load i32, ptr @n, align 4, !tbaa !9
%cmp = icmp eq i32 %2, %3
%spec.store.select = select i1 %cmp, i32 0, i32 %inc
store i32 %spec.store.select, ptr @tail, align 4
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @dequeue() local_unnamed_addr #7 {
entry:
%0 = load ptr, ptr @queue, align 8, !tbaa !5
%1 = load i32, ptr @head, align 4, !tbaa !9
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds i32, ptr %0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !9
%inc = add nsw i32 %1, 1
%3 = load i32, ptr @n, align 4, !tbaa !9
%cmp = icmp eq i32 %1, %3
%spec.store.select = select i1 %cmp, i32 0, i32 %inc
store i32 %spec.store.select, ptr @head, align 4
ret i32 %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 = { 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 = { 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 #4 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) 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 #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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: write, inaccessiblemem: none) 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 #7 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: read, inaccessiblemem: none) 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 #8 = { nounwind }
attributes #9 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12, !16}
!16 = !{!"llvm.loop.unswitch.partial.disable"}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
|
#include<stdio.h>
#define LEN 100
#define INF 100000000
int Q[LEN];
int G[LEN][LEN];
int head,tail;
int d[LEN];
int n;
void enqueue(int x){
Q[tail] = x;
tail = (tail+1) % LEN;
}
int dequeue(){
int x = Q[head];
head = (head+1)%LEN;
return x;
}
int enpty(){
if(tail == head)return 1;
else return 0;
}
void bfs(int s){
int i;
int u,v;
enqueue(s);
for(i=0;i<n;i++){
d[i] = INF;
}
d[s] = 0;
while(!enpty()){
u = dequeue();
for(v=0;v<n;v++){
if(G[u][v] == 0)continue;
if(d[v] != INF)continue;
d[v] = d[u] + 1;
enqueue(v);
}
}
for(i=0;i<n;i++){
printf("%d %d\n",i+1,((d[i] == INF)? -1 : d[i]));
}
}
int main(){
int k,u,v;
int i,j;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
G[i][j] = 0;
}
}
for(i=0;i<n;i++){
scanf("%d%d",&u,&k);
u--;
for(j=0;j<k;j++){
scanf("%d",&v);
v--;
G[u][v] = 1;
}
}
bfs(0);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327284/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327284/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@Q = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@tail = dso_local local_unnamed_addr global i32 0, align 4
@head = dso_local local_unnamed_addr global i32 0, align 4
@n = dso_local global i32 0, align 4
@d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@G = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @enqueue(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @Q, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @dequeue() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @Q, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100
store i32 %rem, ptr @head, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @enpty() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%1 = load i32, ptr @head, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
%. = zext i1 %cmp to i32
ret i32 %.
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @bfs(i32 noundef %s) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom.i = sext i32 %0 to i64
%arrayidx.i = getelementptr inbounds [100 x i32], ptr @Q, i64 0, i64 %idxprom.i
store i32 %s, ptr %arrayidx.i, align 4, !tbaa !5
%add.i = add nsw i32 %0, 1
%rem.i = srem i32 %add.i, 100
store i32 %rem.i, ptr @tail, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp59 = icmp sgt i32 %1, 0
br i1 %cmp59, label %for.body.preheader, label %for.end.thread
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %1 to i64
%min.iters.check = icmp ult i32 %1, 8
br i1 %min.iters.check, label %for.body.preheader96, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %index
store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %3, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader96
for.body.preheader96: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader96, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader96 ]
%arrayidx = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv
store i32 100000000, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block
%idxprom1 = sext i32 %s to i64
%arrayidx2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom1
store i32 0, ptr %arrayidx2, align 4, !tbaa !5
%head.promoted = load i32, ptr @head, align 4, !tbaa !5
%cmp.i.not72 = icmp eq i32 %rem.i, %head.promoted
br i1 %cmp.i.not72, label %for.cond24.preheader, label %while.body.lr.ph
for.end.thread: ; preds = %entry
%idxprom187 = sext i32 %s to i64
%arrayidx288 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom187
store i32 0, ptr %arrayidx288, align 4, !tbaa !5
%head.promoted89 = load i32, ptr @head, align 4, !tbaa !5
%cmp.i.not7290 = icmp eq i32 %rem.i, %head.promoted89
br i1 %cmp.i.not7290, label %for.end36, label %while.cond.for.cond24.preheader_crit_edge
while.body.lr.ph: ; preds = %for.end
br i1 %cmp59, label %while.body.us.preheader, label %while.cond.for.cond24.preheader_crit_edge
while.body.us.preheader: ; preds = %while.body.lr.ph
%wide.trip.count82 = zext i32 %1 to i64
br label %while.body.us
while.body.us: ; preds = %while.body.us.preheader, %for.cond4.while.cond.loopexit_crit_edge.us
%tail.promoted7074.us = phi i32 [ %tail.promoted68.us, %for.cond4.while.cond.loopexit_crit_edge.us ], [ %rem.i, %while.body.us.preheader ]
%rem.i547173.us = phi i32 [ %rem.i54.us, %for.cond4.while.cond.loopexit_crit_edge.us ], [ %head.promoted, %while.body.us.preheader ]
%idxprom.i51.us = sext i32 %rem.i547173.us to i64
%arrayidx.i52.us = getelementptr inbounds [100 x i32], ptr @Q, i64 0, i64 %idxprom.i51.us
%5 = load i32, ptr %arrayidx.i52.us, align 4, !tbaa !5
%add.i53.us = add nsw i32 %rem.i547173.us, 1
%idxprom7.us = sext i32 %5 to i64
%arrayidx18.us = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom7.us
br label %for.body6.us
for.body6.us: ; preds = %while.body.us, %for.inc21.us
%indvars.iv79 = phi i64 [ 0, %while.body.us ], [ %indvars.iv.next80, %for.inc21.us ]
%tail.promoted69.us = phi i32 [ %tail.promoted7074.us, %while.body.us ], [ %tail.promoted68.us, %for.inc21.us ]
%rem.i586264.us = phi i32 [ %tail.promoted7074.us, %while.body.us ], [ %rem.i5861.us, %for.inc21.us ]
%arrayidx10.us = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %idxprom7.us, i64 %indvars.iv79
%6 = load i32, ptr %arrayidx10.us, align 4, !tbaa !5
%cmp11.us = icmp eq i32 %6, 0
br i1 %cmp11.us, label %for.inc21.us, label %if.end.us
if.end.us: ; preds = %for.body6.us
%arrayidx13.us = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv79
%7 = load i32, ptr %arrayidx13.us, align 4, !tbaa !5
%cmp14.not.us = icmp eq i32 %7, 100000000
br i1 %cmp14.not.us, label %if.end16.us, label %for.inc21.us
if.end16.us: ; preds = %if.end.us
%8 = load i32, ptr %arrayidx18.us, align 4, !tbaa !5
%add.us = add nsw i32 %8, 1
store i32 %add.us, ptr %arrayidx13.us, align 4, !tbaa !5
%idxprom.i55.us = sext i32 %rem.i586264.us to i64
%arrayidx.i56.us = getelementptr inbounds [100 x i32], ptr @Q, i64 0, i64 %idxprom.i55.us
%9 = trunc i64 %indvars.iv79 to i32
store i32 %9, ptr %arrayidx.i56.us, align 4, !tbaa !5
%add.i57.us = add nsw i32 %rem.i586264.us, 1
%rem.i58.us = srem i32 %add.i57.us, 100
store i32 %rem.i58.us, ptr @tail, align 4, !tbaa !5
br label %for.inc21.us
for.inc21.us: ; preds = %if.end16.us, %if.end.us, %for.body6.us
%tail.promoted68.us = phi i32 [ %tail.promoted69.us, %if.end.us ], [ %tail.promoted69.us, %for.body6.us ], [ %rem.i58.us, %if.end16.us ]
%rem.i5861.us = phi i32 [ %rem.i586264.us, %if.end.us ], [ %rem.i586264.us, %for.body6.us ], [ %rem.i58.us, %if.end16.us ]
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%exitcond83.not = icmp eq i64 %indvars.iv.next80, %wide.trip.count82
br i1 %exitcond83.not, label %for.cond4.while.cond.loopexit_crit_edge.us, label %for.body6.us, !llvm.loop !14
for.cond4.while.cond.loopexit_crit_edge.us: ; preds = %for.inc21.us
%rem.i54.us = srem i32 %add.i53.us, 100
%cmp.i.not.us = icmp eq i32 %tail.promoted68.us, %rem.i54.us
br i1 %cmp.i.not.us, label %while.cond.for.cond24.preheader_crit_edge, label %while.body.us, !llvm.loop !15
while.cond.for.cond24.preheader_crit_edge: ; preds = %for.cond4.while.cond.loopexit_crit_edge.us, %for.end.thread, %while.body.lr.ph
%.us-phi = phi i32 [ %rem.i, %while.body.lr.ph ], [ %rem.i, %for.end.thread ], [ %tail.promoted68.us, %for.cond4.while.cond.loopexit_crit_edge.us ]
store i32 %.us-phi, ptr @head, align 4, !tbaa !5
br label %for.cond24.preheader
for.cond24.preheader: ; preds = %while.cond.for.cond24.preheader_crit_edge, %for.end
br i1 %cmp59, label %for.body26, label %for.end36
for.body26: ; preds = %for.cond24.preheader, %for.body26
%indvars.iv84 = phi i64 [ %indvars.iv.next85, %for.body26 ], [ 0, %for.cond24.preheader ]
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%arrayidx29 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv84
%10 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30 = icmp eq i32 %10, 100000000
%spec.select = select i1 %cmp30, i32 -1, i32 %10
%11 = trunc i64 %indvars.iv.next85 to i32
%call33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11, i32 noundef %spec.select)
%12 = load i32, ptr @n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp25 = icmp slt i64 %indvars.iv.next85, %13
br i1 %cmp25, label %for.body26, label %for.end36, !llvm.loop !16
for.end36: ; preds = %for.body26, %for.end.thread, %for.cond24.preheader
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%k = alloca i32, align 4
%u = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #6
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp38 = icmp sgt i32 %0, 0
br i1 %cmp38, label %for.cond1.preheader.us.preheader, label %for.end27
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr @G, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 400), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep46 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 800), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 16 %gep46, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep47 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 1200), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 16 %gep47, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep48 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 1600), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 16 %gep48, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep49 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 2000), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 16 %gep49, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep50 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 2400), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 16 %gep50, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep51 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 2800), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 16 %gep51, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !17
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr @G, i64 %12
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !18
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp38, label %for.body11, label %for.end27
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.143 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %u, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %u, align 4, !tbaa !5
%14 = load i32, ptr %k, align 4, !tbaa !5
%cmp1440 = icmp sgt i32 %14, 0
br i1 %cmp1440, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.141 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v)
%15 = load i32, ptr %v, align 4, !tbaa !5
%dec17 = add nsw i32 %15, -1
store i32 %dec17, ptr %v, align 4, !tbaa !5
%16 = load i32, ptr %u, align 4, !tbaa !5
%idxprom18 = sext i32 %16 to i64
%idxprom20 = sext i32 %dec17 to i64
%arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %idxprom18, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.141, 1
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %17
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !20
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.143, 1
%18 = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %18
br i1 %cmp10, label %for.body11, label %for.end27, !llvm.loop !21
for.end27: ; preds = %for.inc25, %entry, %for.cond9.preheader
call void @bfs(i32 noundef 0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) 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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) 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 #3 = { 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 #4 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
|
#include<stdio.h>
#define INF -1
#define WHITE 0
#define GRAY 1
#define BLACK 2
int A[1000][1000],d[1000],color[1000],Q[1000],top=1,tail=1,n,v,u;
void bfs(int);
int main(){
int i,j,k;
// printf("wa-i1\n");
scanf("%d",&n);
//printf("wa-i2\n");
for(i=1;i<=n;i++){
A[i][i]=0;
}
for(i=1;i<=n;i++){
scanf("%d%d",&u,&k);
//printf("wa-i3\n");
for(j=0;j<k;j++){
scanf("%d",&v);
A[u][v]=1;
}
}
// for(i=1;i<=n;i++){
// for(j=1;j<=n;j++){
// printf("%d ",A[i][j]);
//}
//printf("\n");
//}
// printf("wa-i5\n");
bfs(1);
// printf("wa-i6\n");
for(i=1;i<=n;i++){
printf("%d %d\n",i,d[i]);
}
return 0;
}
void bfs(int s){
int i,u1;
// printf("wa-i6\n");
for(i=1;i<=n;i++){
color[i] = WHITE;
d[i] = INF;
}
//printf("wa-i7\n");
// printf("s: %d\n",s);
color[s] = GRAY;
d[s] = 0;
//printf("wa-i8\n");
for(i=1;i<=n;i++){
Q[i]=INF;
}
//printf("wa-i9\n");
tail++;
Q[tail-1]=s;
while(tail != top){
//printf("wa-i10\n");
top++;
u1=Q[top-1];
//printf("Q[top-1]: %d\n",Q[top-1]);
for(i=1;i<=n;i++){
//printf("wa-i11\n");
if(A[u1][i]==1 && color[i]==WHITE){
//printf("<wa-iwa-iwai>u1:%d,i: %d\n",u1,i);
color[i]=GRAY;
d[i]= d[u1] + 1;
// printf("d[%d]=%d\n",i,d[i]);
tail++;
Q[tail-1]=i;
}
}
color[u1] = BLACK;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327334/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327334/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@top = dso_local local_unnamed_addr global i32 1, align 4
@tail = dso_local local_unnamed_addr global i32 1, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@A = dso_local local_unnamed_addr global [1000 x [1000 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@u = dso_local global i32 0, align 4
@v = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@d = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@color = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@Q = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not40 = icmp slt i32 %0, 1
br i1 %cmp.not40, label %for.end20, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = add nuw i32 %0, 1
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -1
%3 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %2, 3
%4 = icmp ult i64 %3, 3
br i1 %4, label %for.cond3.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %2, -4
br label %for.body
for.cond3.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond3.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond3.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond3.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond3.preheader.unr-lcssa ]
%arrayidx2.epil = getelementptr inbounds [1000 x [1000 x i32]], ptr @A, i64 0, i64 %indvars.iv.epil, i64 %indvars.iv.epil
store i32 0, ptr %arrayidx2.epil, align 4, !tbaa !5
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond3.preheader, label %for.body.epil, !llvm.loop !9
for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa
br i1 %cmp.not40, label %for.end20, label %for.body5
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx2 = getelementptr inbounds [1000 x [1000 x i32]], ptr @A, i64 0, i64 %indvars.iv, i64 %indvars.iv
store i32 0, ptr %arrayidx2, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx2.1 = getelementptr inbounds [1000 x [1000 x i32]], ptr @A, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next
store i32 0, ptr %arrayidx2.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx2.2 = getelementptr inbounds [1000 x [1000 x i32]], ptr @A, i64 0, i64 %indvars.iv.next.1, i64 %indvars.iv.next.1
store i32 0, ptr %arrayidx2.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx2.3 = getelementptr inbounds [1000 x [1000 x i32]], ptr @A, i64 0, i64 %indvars.iv.next.2, i64 %indvars.iv.next.2
store i32 0, ptr %arrayidx2.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond3.preheader.unr-lcssa, label %for.body, !llvm.loop !11
for.body5: ; preds = %for.cond3.preheader, %for.inc18
%i.145 = phi i32 [ %inc19, %for.inc18 ], [ 1, %for.cond3.preheader ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @u, ptr noundef nonnull %k)
%5 = load i32, ptr %k, align 4, !tbaa !5
%cmp842 = icmp sgt i32 %5, 0
br i1 %cmp842, label %for.body9, label %for.inc18
for.body9: ; preds = %for.body5, %for.body9
%j.043 = phi i32 [ %inc16, %for.body9 ], [ 0, %for.body5 ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @v)
%6 = load i32, ptr @u, align 4, !tbaa !5
%idxprom11 = sext i32 %6 to i64
%7 = load i32, ptr @v, align 4, !tbaa !5
%idxprom13 = sext i32 %7 to i64
%arrayidx14 = getelementptr inbounds [1000 x [1000 x i32]], ptr @A, i64 0, i64 %idxprom11, i64 %idxprom13
store i32 1, ptr %arrayidx14, align 4, !tbaa !5
%inc16 = add nuw nsw i32 %j.043, 1
%8 = load i32, ptr %k, align 4, !tbaa !5
%cmp8 = icmp slt i32 %inc16, %8
br i1 %cmp8, label %for.body9, label %for.inc18, !llvm.loop !13
for.inc18: ; preds = %for.body9, %for.body5
%inc19 = add nuw nsw i32 %i.145, 1
%9 = load i32, ptr @n, align 4, !tbaa !5
%cmp4.not.not = icmp slt i32 %i.145, %9
br i1 %cmp4.not.not, label %for.body5, label %for.end20, !llvm.loop !14
for.end20: ; preds = %for.inc18, %entry, %for.cond3.preheader
call void @bfs(i32 noundef 1)
%10 = load i32, ptr @n, align 4, !tbaa !5
%cmp22.not46 = icmp slt i32 %10, 1
br i1 %cmp22.not46, label %for.end29, label %for.body23
for.body23: ; preds = %for.end20, %for.body23
%indvars.iv49 = phi i64 [ %indvars.iv.next50, %for.body23 ], [ 1, %for.end20 ]
%arrayidx25 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %indvars.iv49
%11 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%12 = trunc i64 %indvars.iv49 to i32
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12, i32 noundef %11)
%indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
%13 = load i32, ptr @n, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp22.not.not = icmp slt i64 %indvars.iv49, %14
br i1 %cmp22.not.not, label %for.body23, label %for.end29, !llvm.loop !15
for.end29: ; preds = %for.body23, %for.end20
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @bfs(i32 noundef %s) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not66 = icmp slt i32 %0, 1
br i1 %cmp.not66, label %for.end.thread, label %for.body9.preheader
for.end.thread: ; preds = %entry
%idxprom394 = sext i32 %s to i64
%arrayidx495 = getelementptr inbounds [1000 x i32], ptr @color, i64 0, i64 %idxprom394
store i32 1, ptr %arrayidx495, align 4, !tbaa !5
%arrayidx696 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %idxprom394
store i32 0, ptr %arrayidx696, align 4, !tbaa !5
br label %for.end14
for.body9.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([1000 x i32], ptr @color, i64 0, i64 1), i8 0, i64 %2, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([1000 x i32], ptr @d, i64 0, i64 1), i8 -1, i64 %2, i1 false), !tbaa !5
%idxprom3 = sext i32 %s to i64
%arrayidx4 = getelementptr inbounds [1000 x i32], ptr @color, i64 0, i64 %idxprom3
store i32 1, ptr %arrayidx4, align 4, !tbaa !5
%arrayidx6 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %idxprom3
store i32 0, ptr %arrayidx6, align 4, !tbaa !5
%3 = zext i32 %0 to i64
%4 = shl nuw nsw i64 %3, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([1000 x i32], ptr @Q, i64 0, i64 1), i8 -1, i64 %4, i1 false), !tbaa !5
br label %for.end14
for.end14: ; preds = %for.end.thread, %for.body9.preheader
%5 = load i32, ptr @tail, align 4, !tbaa !5
%inc15 = add nsw i32 %5, 1
store i32 %inc15, ptr @tail, align 4, !tbaa !5
%idxprom16 = sext i32 %5 to i64
%arrayidx17 = getelementptr inbounds [1000 x i32], ptr @Q, i64 0, i64 %idxprom16
store i32 %s, ptr %arrayidx17, align 4, !tbaa !5
%top.promoted = load i32, ptr @top, align 4, !tbaa !5
%cmp18.not81 = icmp eq i32 %inc15, %top.promoted
br i1 %cmp18.not81, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end14
br i1 %cmp.not66, label %while.body.us.preheader, label %while.body.preheader
while.body.preheader: ; preds = %while.body.lr.ph
%6 = add nuw i32 %0, 1
%7 = sext i32 %top.promoted to i64
%wide.trip.count = zext i32 %6 to i64
br label %while.body
while.body.us.preheader: ; preds = %while.body.lr.ph
%8 = sext i32 %top.promoted to i64
%9 = add nsw i64 %idxprom16, 1
%10 = sub nsw i64 %9, %8
%11 = sub nsw i64 %idxprom16, %8
%xtraiter = and i64 %10, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.body.us.prol.loopexit, label %while.body.us.prol
while.body.us.prol: ; preds = %while.body.us.preheader, %while.body.us.prol
%indvars.iv91.prol = phi i64 [ %indvars.iv.next92.prol, %while.body.us.prol ], [ %8, %while.body.us.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %while.body.us.prol ], [ 0, %while.body.us.preheader ]
%indvars.iv.next92.prol = add nsw i64 %indvars.iv91.prol, 1
%arrayidx22.us.prol = getelementptr inbounds [1000 x i32], ptr @Q, i64 0, i64 %indvars.iv91.prol
%12 = load i32, ptr %arrayidx22.us.prol, align 4, !tbaa !5
%idxprom47.us.prol = sext i32 %12 to i64
%arrayidx48.us.prol = getelementptr inbounds [1000 x i32], ptr @color, i64 0, i64 %idxprom47.us.prol
store i32 2, ptr %arrayidx48.us.prol, align 4, !tbaa !5
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %while.body.us.prol.loopexit, label %while.body.us.prol, !llvm.loop !16
while.body.us.prol.loopexit: ; preds = %while.body.us.prol, %while.body.us.preheader
%indvars.iv.next92.lcssa.unr = phi i64 [ undef, %while.body.us.preheader ], [ %indvars.iv.next92.prol, %while.body.us.prol ]
%indvars.iv91.unr = phi i64 [ %8, %while.body.us.preheader ], [ %indvars.iv.next92.prol, %while.body.us.prol ]
%13 = icmp ult i64 %11, 3
br i1 %13, label %while.cond.while.end_crit_edge.loopexit, label %while.body.us
while.body.us: ; preds = %while.body.us.prol.loopexit, %while.body.us
%indvars.iv91 = phi i64 [ %indvars.iv.next92.3, %while.body.us ], [ %indvars.iv91.unr, %while.body.us.prol.loopexit ]
%indvars.iv.next92 = add nsw i64 %indvars.iv91, 1
%arrayidx22.us = getelementptr inbounds [1000 x i32], ptr @Q, i64 0, i64 %indvars.iv91
%14 = load i32, ptr %arrayidx22.us, align 4, !tbaa !5
%idxprom47.us = sext i32 %14 to i64
%arrayidx48.us = getelementptr inbounds [1000 x i32], ptr @color, i64 0, i64 %idxprom47.us
store i32 2, ptr %arrayidx48.us, align 4, !tbaa !5
%indvars.iv.next92.1 = add nsw i64 %indvars.iv91, 2
%arrayidx22.us.1 = getelementptr inbounds [1000 x i32], ptr @Q, i64 0, i64 %indvars.iv.next92
%15 = load i32, ptr %arrayidx22.us.1, align 4, !tbaa !5
%idxprom47.us.1 = sext i32 %15 to i64
%arrayidx48.us.1 = getelementptr inbounds [1000 x i32], ptr @color, i64 0, i64 %idxprom47.us.1
store i32 2, ptr %arrayidx48.us.1, align 4, !tbaa !5
%indvars.iv.next92.2 = add nsw i64 %indvars.iv91, 3
%arrayidx22.us.2 = getelementptr inbounds [1000 x i32], ptr @Q, i64 0, i64 %indvars.iv.next92.1
%16 = load i32, ptr %arrayidx22.us.2, align 4, !tbaa !5
%idxprom47.us.2 = sext i32 %16 to i64
%arrayidx48.us.2 = getelementptr inbounds [1000 x i32], ptr @color, i64 0, i64 %idxprom47.us.2
store i32 2, ptr %arrayidx48.us.2, align 4, !tbaa !5
%indvars.iv.next92.3 = add nsw i64 %indvars.iv91, 4
%arrayidx22.us.3 = getelementptr inbounds [1000 x i32], ptr @Q, i64 0, i64 %indvars.iv.next92.2
%17 = load i32, ptr %arrayidx22.us.3, align 4, !tbaa !5
%idxprom47.us.3 = sext i32 %17 to i64
%arrayidx48.us.3 = getelementptr inbounds [1000 x i32], ptr @color, i64 0, i64 %idxprom47.us.3
store i32 2, ptr %arrayidx48.us.3, align 4, !tbaa !5
%18 = icmp eq i64 %indvars.iv.next92.2, %idxprom16
br i1 %18, label %while.cond.while.end_crit_edge.loopexit, label %while.body.us, !llvm.loop !17
while.body: ; preds = %while.body.preheader, %for.cond23.for.end46_crit_edge
%indvars.iv88 = phi i64 [ %7, %while.body.preheader ], [ %indvars.iv.next89, %for.cond23.for.end46_crit_edge ]
%tail.promoted7983 = phi i32 [ %inc15, %while.body.preheader ], [ %tail.promoted76, %for.cond23.for.end46_crit_edge ]
%arrayidx22 = getelementptr inbounds [1000 x i32], ptr @Q, i64 0, i64 %indvars.iv88
%19 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%idxprom26 = sext i32 %19 to i64
%arrayidx37 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %idxprom26
br label %for.body25
for.body25: ; preds = %while.body, %for.inc44
%indvars.iv = phi i64 [ 1, %while.body ], [ %indvars.iv.next, %for.inc44 ]
%tail.promoted77 = phi i32 [ %tail.promoted7983, %while.body ], [ %tail.promoted76, %for.inc44 ]
%inc407173 = phi i32 [ %tail.promoted7983, %while.body ], [ %inc4070, %for.inc44 ]
%arrayidx29 = getelementptr inbounds [1000 x [1000 x i32]], ptr @A, i64 0, i64 %idxprom26, i64 %indvars.iv
%20 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30 = icmp eq i32 %20, 1
br i1 %cmp30, label %land.lhs.true, label %for.inc44
land.lhs.true: ; preds = %for.body25
%arrayidx32 = getelementptr inbounds [1000 x i32], ptr @color, i64 0, i64 %indvars.iv
%21 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%cmp33 = icmp eq i32 %21, 0
br i1 %cmp33, label %if.then, label %for.inc44
if.then: ; preds = %land.lhs.true
store i32 1, ptr %arrayidx32, align 4, !tbaa !5
%22 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%add = add nsw i32 %22, 1
%arrayidx39 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %indvars.iv
store i32 %add, ptr %arrayidx39, align 4, !tbaa !5
%inc40 = add nsw i32 %inc407173, 1
store i32 %inc40, ptr @tail, align 4, !tbaa !5
%idxprom42 = sext i32 %inc407173 to i64
%arrayidx43 = getelementptr inbounds [1000 x i32], ptr @Q, i64 0, i64 %idxprom42
%23 = trunc i64 %indvars.iv to i32
store i32 %23, ptr %arrayidx43, align 4, !tbaa !5
br label %for.inc44
for.inc44: ; preds = %for.body25, %land.lhs.true, %if.then
%tail.promoted76 = phi i32 [ %tail.promoted77, %for.body25 ], [ %tail.promoted77, %land.lhs.true ], [ %inc40, %if.then ]
%inc4070 = phi i32 [ %inc407173, %for.body25 ], [ %inc407173, %land.lhs.true ], [ %inc40, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond23.for.end46_crit_edge, label %for.body25, !llvm.loop !18
for.cond23.for.end46_crit_edge: ; preds = %for.inc44
%indvars.iv.next89 = add i64 %indvars.iv88, 1
%arrayidx48 = getelementptr inbounds [1000 x i32], ptr @color, i64 0, i64 %idxprom26
store i32 2, ptr %arrayidx48, align 4, !tbaa !5
%24 = trunc i64 %indvars.iv.next89 to i32
%cmp18.not = icmp eq i32 %tail.promoted76, %24
br i1 %cmp18.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !17
while.cond.while.end_crit_edge.loopexit: ; preds = %while.body.us, %while.body.us.prol.loopexit
%indvars.iv.next92.lcssa = phi i64 [ %indvars.iv.next92.lcssa.unr, %while.body.us.prol.loopexit ], [ %indvars.iv.next92.3, %while.body.us ]
%25 = trunc i64 %indvars.iv.next92.lcssa to i32
br label %while.cond.while.end_crit_edge
while.cond.while.end_crit_edge: ; preds = %for.cond23.for.end46_crit_edge, %while.cond.while.end_crit_edge.loopexit
%.us-phi = phi i32 [ %25, %while.cond.while.end_crit_edge.loopexit ], [ %tail.promoted76, %for.cond23.for.end46_crit_edge ]
store i32 %.us-phi, ptr @top, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %for.end14
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { 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 #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 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
|
#include<stdio.h>
#define MAX 1000
#define N 100
int G[MAX][MAX];
int d[MAX],Q[N];
int n;
int max=0;
int min=0;
void en(int q){
Q[max] = q;
max++;
}
int de(){
min++;
return Q[min-1];
}
int size(){
return max-min;
}
void bfs(int i){
int a;
for(a = 0; a < n; a++){
if(G[i][a] == 1 && d[a] == -1){
d[a] = d[i]+1;
en(a);
}
}
}
int main(){
int i,j,u,k,c;
scanf("%d",&n);
for(i=0;i<MAX;i++){
d[i]=-1;
}
for(i=0;i<n;i++){
scanf("%d",&u);
scanf("%d",&k);
for(j=0;j<k;j++){
scanf("%d",&c);
G[u-1][c-1]=1;
}
}
d[0]=0;
bfs(0);
while(size()!=0){
bfs(de());
}
for(i=0;i<n;i++){
printf("%d ",i+1);
printf("%d\n",d[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327378/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327378/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@max = dso_local local_unnamed_addr global i32 0, align 4
@min = dso_local local_unnamed_addr global i32 0, align 4
@Q = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@n = dso_local global i32 0, align 4
@G = dso_local local_unnamed_addr global [1000 x [1000 x i32]] zeroinitializer, align 16
@d = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @en(i32 noundef %q) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @max, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @Q, i64 0, i64 %idxprom
store i32 %q, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @max, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @de() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @min, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @min, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @Q, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @size() local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @max, align 4, !tbaa !5
%1 = load i32, ptr @min, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @bfs(i32 noundef %i) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%max.promoted = load i32, ptr @max, align 4, !tbaa !5
%idxprom = sext i32 %i to i64
%arrayidx8 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %idxprom
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%inc.i1820 = phi i32 [ %max.promoted, %for.body.lr.ph ], [ %inc.i17, %for.inc ]
%arrayidx2 = getelementptr inbounds [1000 x [1000 x i32]], ptr @G, i64 0, i64 %idxprom, i64 %indvars.iv
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp3 = icmp eq i32 %1, 1
br i1 %cmp3, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%arrayidx5 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %indvars.iv
%2 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %2, -1
br i1 %cmp6, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true
%3 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%add = add nsw i32 %3, 1
store i32 %add, ptr %arrayidx5, align 4, !tbaa !5
%idxprom.i = sext i32 %inc.i1820 to i64
%arrayidx.i = getelementptr inbounds [100 x i32], ptr @Q, i64 0, i64 %idxprom.i
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx.i, align 4, !tbaa !5
%inc.i = add nsw i32 %inc.i1820, 1
store i32 %inc.i, ptr @max, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %if.then
%inc.i17 = phi i32 [ %inc.i1820, %for.body ], [ %inc.i1820, %land.lhs.true ], [ %inc.i, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%u = alloca i32, align 4
%k = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #7
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000) @d, i8 -1, i64 4000, i1 false), !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp269 = icmp sgt i32 %0, 0
br i1 %cmp269, label %for.body3, label %for.end20.thread
for.end20.thread: ; preds = %entry
store i32 0, ptr @d, align 16, !tbaa !5
br label %for.end20.bfs.exit_crit_edge
for.body3: ; preds = %entry, %for.inc18
%i.170 = phi i32 [ %inc19, %for.inc18 ], [ 0, %entry ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %u)
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp767 = icmp sgt i32 %1, 0
br i1 %cmp767, label %for.body8, label %for.inc18
for.body8: ; preds = %for.body3, %for.body8
%j.068 = phi i32 [ %inc16, %for.body8 ], [ 0, %for.body3 ]
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%2 = load i32, ptr %u, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom10 = sext i32 %sub to i64
%3 = load i32, ptr %c, align 4, !tbaa !5
%sub12 = add nsw i32 %3, -1
%idxprom13 = sext i32 %sub12 to i64
%arrayidx14 = getelementptr inbounds [1000 x [1000 x i32]], ptr @G, i64 0, i64 %idxprom10, i64 %idxprom13
store i32 1, ptr %arrayidx14, align 4, !tbaa !5
%inc16 = add nuw nsw i32 %j.068, 1
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp7 = icmp slt i32 %inc16, %4
br i1 %cmp7, label %for.body8, label %for.inc18, !llvm.loop !11
for.inc18: ; preds = %for.body8, %for.body3
%inc19 = add nuw nsw i32 %i.170, 1
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc19, %5
br i1 %cmp2, label %for.body3, label %for.end20, !llvm.loop !12
for.end20: ; preds = %for.inc18
store i32 0, ptr @d, align 16, !tbaa !5
%cmp19.i = icmp sgt i32 %5, 0
br i1 %cmp19.i, label %for.body.lr.ph.i, label %for.end20.bfs.exit_crit_edge
for.end20.bfs.exit_crit_edge: ; preds = %for.end20.thread, %for.end20
%6 = phi i32 [ %0, %for.end20.thread ], [ %5, %for.end20 ]
%max.promoted.pre = load i32, ptr @max, align 4, !tbaa !5
br label %bfs.exit
for.body.lr.ph.i: ; preds = %for.end20
%max.promoted.i = load i32, ptr @max, align 4, !tbaa !5
%wide.trip.count.i = zext i32 %5 to i64
br label %for.body.i
for.body.i: ; preds = %for.inc.i, %for.body.lr.ph.i
%indvars.iv.i = phi i64 [ 0, %for.body.lr.ph.i ], [ %indvars.iv.next.i, %for.inc.i ]
%inc.i1820.i = phi i32 [ %max.promoted.i, %for.body.lr.ph.i ], [ %inc.i17.i, %for.inc.i ]
%arrayidx2.i = getelementptr inbounds [1000 x [1000 x i32]], ptr @G, i64 0, i64 0, i64 %indvars.iv.i
%7 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp3.i = icmp eq i32 %7, 1
br i1 %cmp3.i, label %land.lhs.true.i, label %for.inc.i
land.lhs.true.i: ; preds = %for.body.i
%arrayidx5.i = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %indvars.iv.i
%8 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp eq i32 %8, -1
br i1 %cmp6.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %land.lhs.true.i
%9 = load i32, ptr @d, align 16, !tbaa !5
%add.i = add nsw i32 %9, 1
store i32 %add.i, ptr %arrayidx5.i, align 4, !tbaa !5
%idxprom.i.i = sext i32 %inc.i1820.i to i64
%arrayidx.i.i = getelementptr inbounds [100 x i32], ptr @Q, i64 0, i64 %idxprom.i.i
%10 = trunc i64 %indvars.iv.i to i32
store i32 %10, ptr %arrayidx.i.i, align 4, !tbaa !5
%inc.i.i = add nsw i32 %inc.i1820.i, 1
store i32 %inc.i.i, ptr @max, align 4, !tbaa !5
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %land.lhs.true.i, %for.body.i
%inc.i17.i = phi i32 [ %inc.i1820.i, %for.body.i ], [ %inc.i1820.i, %land.lhs.true.i ], [ %inc.i.i, %if.then.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %bfs.exit, label %for.body.i, !llvm.loop !9
bfs.exit: ; preds = %for.inc.i, %for.end20.bfs.exit_crit_edge
%cmp19.i90 = phi i1 [ false, %for.end20.bfs.exit_crit_edge ], [ %cmp19.i, %for.inc.i ]
%11 = phi i32 [ %6, %for.end20.bfs.exit_crit_edge ], [ %5, %for.inc.i ]
%max.promoted = phi i32 [ %max.promoted.pre, %for.end20.bfs.exit_crit_edge ], [ %inc.i17.i, %for.inc.i ]
%min.promoted = load i32, ptr @min, align 4, !tbaa !5
%cmp22.not76 = icmp eq i32 %max.promoted, %min.promoted
br i1 %cmp22.not76, label %for.cond24.preheader, label %while.body.lr.ph
while.body.lr.ph: ; preds = %bfs.exit
%wide.trip.count.i47 = zext i32 %11 to i64
br i1 %cmp19.i90, label %while.body.us.preheader, label %while.cond.for.cond24.preheader_crit_edge
while.body.us.preheader: ; preds = %while.body.lr.ph
%12 = sext i32 %min.promoted to i64
br label %while.body.us
while.body.us: ; preds = %while.body.us.preheader, %bfs.exit65.loopexit.us
%indvars.iv = phi i64 [ %12, %while.body.us.preheader ], [ %indvars.iv.next, %bfs.exit65.loopexit.us ]
%inc.i.i647478.us = phi i32 [ %max.promoted, %while.body.us.preheader ], [ %inc.i.i6472.us, %bfs.exit65.loopexit.us ]
%arrayidx.i.us = getelementptr inbounds [100 x i32], ptr @Q, i64 0, i64 %indvars.iv
%13 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%idxprom.i46.us = sext i32 %13 to i64
%arrayidx8.i.us = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %idxprom.i46.us
br label %for.body.i48.us
for.body.i48.us: ; preds = %for.inc.i53.us, %while.body.us
%inc.i.i6473.us = phi i32 [ %inc.i.i647478.us, %while.body.us ], [ %inc.i.i6472.us, %for.inc.i53.us ]
%indvars.iv.i49.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv.next.i55.us, %for.inc.i53.us ]
%inc.i1820.i50.us = phi i32 [ %inc.i.i647478.us, %while.body.us ], [ %inc.i17.i54.us, %for.inc.i53.us ]
%arrayidx2.i51.us = getelementptr inbounds [1000 x [1000 x i32]], ptr @G, i64 0, i64 %idxprom.i46.us, i64 %indvars.iv.i49.us
%14 = load i32, ptr %arrayidx2.i51.us, align 4, !tbaa !5
%cmp3.i52.us = icmp eq i32 %14, 1
br i1 %cmp3.i52.us, label %land.lhs.true.i57.us, label %for.inc.i53.us
land.lhs.true.i57.us: ; preds = %for.body.i48.us
%arrayidx5.i58.us = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %indvars.iv.i49.us
%15 = load i32, ptr %arrayidx5.i58.us, align 4, !tbaa !5
%cmp6.i59.us = icmp eq i32 %15, -1
br i1 %cmp6.i59.us, label %if.then.i60.us, label %for.inc.i53.us
if.then.i60.us: ; preds = %land.lhs.true.i57.us
%16 = load i32, ptr %arrayidx8.i.us, align 4, !tbaa !5
%add.i61.us = add nsw i32 %16, 1
store i32 %add.i61.us, ptr %arrayidx5.i58.us, align 4, !tbaa !5
%idxprom.i.i62.us = sext i32 %inc.i1820.i50.us to i64
%arrayidx.i.i63.us = getelementptr inbounds [100 x i32], ptr @Q, i64 0, i64 %idxprom.i.i62.us
%17 = trunc i64 %indvars.iv.i49.us to i32
store i32 %17, ptr %arrayidx.i.i63.us, align 4, !tbaa !5
%inc.i.i64.us = add nsw i32 %inc.i1820.i50.us, 1
store i32 %inc.i.i64.us, ptr @max, align 4, !tbaa !5
br label %for.inc.i53.us
for.inc.i53.us: ; preds = %if.then.i60.us, %land.lhs.true.i57.us, %for.body.i48.us
%inc.i.i6472.us = phi i32 [ %inc.i.i6473.us, %for.body.i48.us ], [ %inc.i.i6473.us, %land.lhs.true.i57.us ], [ %inc.i.i64.us, %if.then.i60.us ]
%inc.i17.i54.us = phi i32 [ %inc.i1820.i50.us, %for.body.i48.us ], [ %inc.i1820.i50.us, %land.lhs.true.i57.us ], [ %inc.i.i64.us, %if.then.i60.us ]
%indvars.iv.next.i55.us = add nuw nsw i64 %indvars.iv.i49.us, 1
%exitcond.not.i56.us = icmp eq i64 %indvars.iv.next.i55.us, %wide.trip.count.i47
br i1 %exitcond.not.i56.us, label %bfs.exit65.loopexit.us, label %for.body.i48.us, !llvm.loop !9
bfs.exit65.loopexit.us: ; preds = %for.inc.i53.us
%indvars.iv.next = add i64 %indvars.iv, 1
%18 = trunc i64 %indvars.iv.next to i32
%cmp22.not.us = icmp eq i32 %inc.i.i6472.us, %18
br i1 %cmp22.not.us, label %while.cond.for.cond24.preheader_crit_edge, label %while.body.us, !llvm.loop !13
while.cond.for.cond24.preheader_crit_edge: ; preds = %bfs.exit65.loopexit.us, %while.body.lr.ph
%.us-phi = phi i32 [ %max.promoted, %while.body.lr.ph ], [ %inc.i.i6472.us, %bfs.exit65.loopexit.us ]
store i32 %.us-phi, ptr @min, align 4, !tbaa !5
br label %for.cond24.preheader
for.cond24.preheader: ; preds = %while.cond.for.cond24.preheader_crit_edge, %bfs.exit
br i1 %cmp19.i90, label %for.body26, label %for.end33
for.body26: ; preds = %for.cond24.preheader, %for.body26
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.body26 ], [ 0, %for.cond24.preheader ]
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%19 = trunc i64 %indvars.iv.next86 to i32
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %19)
%arrayidx29 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %indvars.iv85
%20 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%21 = load i32, ptr @n, align 4, !tbaa !5
%22 = sext i32 %21 to i64
%cmp25 = icmp slt i64 %indvars.iv.next86, %22
br i1 %cmp25, label %for.body26, label %for.end33, !llvm.loop !14
for.end33: ; preds = %for.body26, %for.cond24.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) 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 nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) 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 norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(){
int n;
scanf("%d", &n);
int g[102][102],d[102];
int i,j;
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
g[i][j] = 0;
}
d[i]=-1;
}
int u,k;
for(i=0;i<n;i++){
scanf("%d %d", &u,&k);
for(j=0;j<k;j++){
int v;
scanf("%d", &v);
g[u][v] = 1;
}
}
int Q[102];
int head=0,tail;
tail=head+1;
Q[head]=1;
// tail+=1;
d[Q[head]]=0;
while(head!=tail){
u=Q[head];
head++;
for(i=1;i<=n;i++){
if(g[u][i]==1 && d[i]==-1){
g[u][i]=0;
d[i]=d[u]+1;
Q[tail++]=i;
}
}
}
for(i=1;i<=n;i++){
printf("%d %d\n", i, d[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327420/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327420/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%g = alloca [102 x [102 x i32]], align 16
%d = alloca [102 x i32], align 16
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
%Q = alloca [102 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 41616, ptr nonnull %g) #4
call void @llvm.lifetime.start.p0(i64 408, ptr nonnull %d) #4
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not102 = icmp slt i32 %0, 1
br i1 %cmp.not102, label %for.end10.thread, label %for.cond1.preheader.preheader
for.end10.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
br label %for.end28.thread
for.cond1.preheader.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%scevgep120 = getelementptr inbounds i8, ptr %d, i64 4
call void @llvm.memset.p0.i64(ptr nonnull align 4 %scevgep120, i8 -1, i64 %2, i1 false), !tbaa !5
%invariant.gep = getelementptr inbounds i8, ptr %g, i64 412
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.end10.unr-lcssa, label %for.cond1.preheader.preheader.new
for.cond1.preheader.preheader.new: ; preds = %for.cond1.preheader.preheader
%unroll_iter = and i64 %1, 4294967288
%invariant.gep142 = getelementptr i8, ptr %invariant.gep, i64 408
%invariant.gep144 = getelementptr i8, ptr %invariant.gep, i64 816
%invariant.gep146 = getelementptr i8, ptr %invariant.gep, i64 1224
%invariant.gep148 = getelementptr i8, ptr %invariant.gep, i64 1632
%invariant.gep150 = getelementptr i8, ptr %invariant.gep, i64 2040
%invariant.gep152 = getelementptr i8, ptr %invariant.gep, i64 2448
%invariant.gep154 = getelementptr i8, ptr %invariant.gep, i64 2856
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader, %for.cond1.preheader.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.preheader.new ], [ %indvar.next.7, %for.cond1.preheader ]
%niter = phi i64 [ 0, %for.cond1.preheader.preheader.new ], [ %niter.next.7, %for.cond1.preheader ]
%4 = mul nuw nsw i64 %indvar, 408
%gep = getelementptr i8, ptr %invariant.gep, i64 %4
call void @llvm.memset.p0.i64(ptr align 4 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 408
%gep143 = getelementptr i8, ptr %invariant.gep142, i64 %5
call void @llvm.memset.p0.i64(ptr align 4 %gep143, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 408
%gep145 = getelementptr i8, ptr %invariant.gep144, i64 %6
call void @llvm.memset.p0.i64(ptr align 4 %gep145, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 408
%gep147 = getelementptr i8, ptr %invariant.gep146, i64 %7
call void @llvm.memset.p0.i64(ptr align 4 %gep147, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 408
%gep149 = getelementptr i8, ptr %invariant.gep148, i64 %8
call void @llvm.memset.p0.i64(ptr align 4 %gep149, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 408
%gep151 = getelementptr i8, ptr %invariant.gep150, i64 %9
call void @llvm.memset.p0.i64(ptr align 4 %gep151, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 408
%gep153 = getelementptr i8, ptr %invariant.gep152, i64 %10
call void @llvm.memset.p0.i64(ptr align 4 %gep153, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 408
%gep155 = getelementptr i8, ptr %invariant.gep154, i64 %11
call void @llvm.memset.p0.i64(ptr align 4 %gep155, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end10.unr-lcssa, label %for.cond1.preheader, !llvm.loop !9
for.end10.unr-lcssa: ; preds = %for.cond1.preheader, %for.cond1.preheader.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvar.next.7, %for.cond1.preheader ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end10, label %for.cond1.preheader.epil
for.cond1.preheader.epil: ; preds = %for.end10.unr-lcssa, %for.cond1.preheader.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.epil ], [ %indvar.unr, %for.end10.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.epil ], [ 0, %for.end10.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 408
%gep.epil = getelementptr i8, ptr %invariant.gep, i64 %12
call void @llvm.memset.p0.i64(ptr align 4 %gep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end10, label %for.cond1.preheader.epil, !llvm.loop !11
for.end10: ; preds = %for.cond1.preheader.epil, %for.end10.unr-lcssa
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%cmp12106 = icmp sgt i32 %0, 0
br i1 %cmp12106, label %for.body13, label %for.end28.thread
for.body13: ; preds = %for.end10, %for.inc26
%i.1107 = phi i32 [ %inc27, %for.inc26 ], [ 0, %for.end10 ]
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %k, align 4, !tbaa !5
%cmp16104 = icmp sgt i32 %13, 0
br i1 %cmp16104, label %for.body17, label %for.inc26
for.body17: ; preds = %for.body13, %for.body17
%j.1105 = phi i32 [ %inc24, %for.body17 ], [ 0, %for.body13 ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
%call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%14 = load i32, ptr %u, align 4, !tbaa !5
%idxprom19 = sext i32 %14 to i64
%15 = load i32, ptr %v, align 4, !tbaa !5
%idxprom21 = sext i32 %15 to i64
%arrayidx22 = getelementptr inbounds [102 x [102 x i32]], ptr %g, i64 0, i64 %idxprom19, i64 %idxprom21
store i32 1, ptr %arrayidx22, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
%inc24 = add nuw nsw i32 %j.1105, 1
%16 = load i32, ptr %k, align 4, !tbaa !5
%cmp16 = icmp slt i32 %inc24, %16
br i1 %cmp16, label %for.body17, label %for.inc26, !llvm.loop !13
for.inc26: ; preds = %for.body17, %for.body13
%inc27 = add nuw nsw i32 %i.1107, 1
%17 = load i32, ptr %n, align 4, !tbaa !5
%cmp12 = icmp slt i32 %inc27, %17
br i1 %cmp12, label %for.body13, label %for.end28, !llvm.loop !14
for.end28.thread: ; preds = %for.end10, %for.end10.thread
call void @llvm.lifetime.start.p0(i64 408, ptr nonnull %Q) #4
br label %for.end73
for.end28: ; preds = %for.inc26
call void @llvm.lifetime.start.p0(i64 408, ptr nonnull %Q) #4
store i32 1, ptr %Q, align 16, !tbaa !5
%arrayidx34 = getelementptr inbounds [102 x i32], ptr %d, i64 0, i64 1
store i32 0, ptr %arrayidx34, align 4, !tbaa !5
%cmp40.not108 = icmp slt i32 %17, 1
br i1 %cmp40.not108, label %for.end73, label %while.body.preheader
while.body.preheader: ; preds = %for.end28
%18 = add nuw i32 %17, 1
%wide.trip.count123 = zext i32 %18 to i64
br label %while.body
for.cond39.while.cond.loopexit_crit_edge: ; preds = %for.inc62
%indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
%19 = zext i32 %tail.2 to i64
%cmp35.not = icmp eq i64 %indvars.iv.next126, %19
br i1 %cmp35.not, label %for.cond65.preheader, label %while.body, !llvm.loop !15
for.cond65.preheader: ; preds = %for.cond39.while.cond.loopexit_crit_edge
store i32 %20, ptr %u, align 4, !tbaa !5
br i1 %cmp40.not108, label %for.end73, label %for.body67
while.body: ; preds = %while.body.preheader, %for.cond39.while.cond.loopexit_crit_edge
%indvars.iv125 = phi i64 [ 0, %while.body.preheader ], [ %indvars.iv.next126, %for.cond39.while.cond.loopexit_crit_edge ]
%tail.0113 = phi i32 [ 1, %while.body.preheader ], [ %tail.2, %for.cond39.while.cond.loopexit_crit_edge ]
%arrayidx37 = getelementptr inbounds [102 x i32], ptr %Q, i64 0, i64 %indvars.iv125
%20 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%idxprom42 = sext i32 %20 to i64
%arrayidx55 = getelementptr inbounds [102 x i32], ptr %d, i64 0, i64 %idxprom42
br label %for.body41
for.body41: ; preds = %while.body, %for.inc62
%indvars.iv = phi i64 [ 1, %while.body ], [ %indvars.iv.next, %for.inc62 ]
%tail.1110 = phi i32 [ %tail.0113, %while.body ], [ %tail.2, %for.inc62 ]
%arrayidx45 = getelementptr inbounds [102 x [102 x i32]], ptr %g, i64 0, i64 %idxprom42, i64 %indvars.iv
%21 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%cmp46 = icmp eq i32 %21, 1
br i1 %cmp46, label %land.lhs.true, label %for.inc62
land.lhs.true: ; preds = %for.body41
%arrayidx48 = getelementptr inbounds [102 x i32], ptr %d, i64 0, i64 %indvars.iv
%22 = load i32, ptr %arrayidx48, align 4, !tbaa !5
%cmp49 = icmp eq i32 %22, -1
br i1 %cmp49, label %if.then, label %for.inc62
if.then: ; preds = %land.lhs.true
store i32 0, ptr %arrayidx45, align 4, !tbaa !5
%23 = load i32, ptr %arrayidx55, align 4, !tbaa !5
%add56 = add nsw i32 %23, 1
store i32 %add56, ptr %arrayidx48, align 4, !tbaa !5
%inc59 = add nsw i32 %tail.1110, 1
%idxprom60 = sext i32 %tail.1110 to i64
%arrayidx61 = getelementptr inbounds [102 x i32], ptr %Q, i64 0, i64 %idxprom60
%24 = trunc i64 %indvars.iv to i32
store i32 %24, ptr %arrayidx61, align 4, !tbaa !5
br label %for.inc62
for.inc62: ; preds = %for.body41, %land.lhs.true, %if.then
%tail.2 = phi i32 [ %inc59, %if.then ], [ %tail.1110, %land.lhs.true ], [ %tail.1110, %for.body41 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond124.not = icmp eq i64 %indvars.iv.next, %wide.trip.count123
br i1 %exitcond124.not, label %for.cond39.while.cond.loopexit_crit_edge, label %for.body41, !llvm.loop !16
for.body67: ; preds = %for.cond65.preheader, %for.body67
%indvars.iv128 = phi i64 [ %indvars.iv.next129, %for.body67 ], [ 1, %for.cond65.preheader ]
%arrayidx69 = getelementptr inbounds [102 x i32], ptr %d, i64 0, i64 %indvars.iv128
%25 = load i32, ptr %arrayidx69, align 4, !tbaa !5
%26 = trunc i64 %indvars.iv128 to i32
%call70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26, i32 noundef %25)
%indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1
%27 = load i32, ptr %n, align 4, !tbaa !5
%28 = sext i32 %27 to i64
%cmp66.not.not = icmp slt i64 %indvars.iv128, %28
br i1 %cmp66.not.not, label %for.body67, label %for.end73, !llvm.loop !17
for.end73: ; preds = %for.body67, %for.end28, %for.end28.thread, %for.cond65.preheader
call void @llvm.lifetime.end.p0(i64 408, ptr nonnull %Q) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.end.p0(i64 408, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 41616, ptr nonnull %g) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
int matrix[101][101];
int level[101];
int queue[101];
int main()
{
int n,i,j,u,v,k;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%d",&u,&k);
for(j=0;j<k;j++){
scanf("%d",&v);
matrix[u][v]=1;
}
}
for(i=1;i<=n;i++)
level[i]=-1;
int qHead=0,qTail=0;
queue[qTail++]=1;
level[1]=0;
while(qHead!=qTail){
int v=queue[qHead++];
for(i=1;i<=n;i++){
if(level[i]==-1 && matrix[v][i]==1){
level[i]=level[v]+1;
queue[qTail++]=i;
}
}
}
for(i=1;i<=n;i++){
printf("%d %d\n",i, level[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327464/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327464/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@matrix = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
@level = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@queue = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%u = alloca i32, align 4
%v = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp78 = icmp sgt i32 %0, 0
br i1 %cmp78, label %for.body, label %for.cond48.preheader.thread
for.cond11.preheader: ; preds = %for.inc8
%cmp12.not80 = icmp slt i32 %5, 1
br i1 %cmp12.not80, label %for.cond48.preheader.thread, label %while.body.preheader
for.body: ; preds = %entry, %for.inc8
%i.079 = phi i32 [ %inc9, %for.inc8 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp376 = icmp sgt i32 %1, 0
br i1 %cmp376, label %for.body4, label %for.inc8
for.body4: ; preds = %for.body, %for.body4
%j.077 = phi i32 [ %inc, %for.body4 ], [ 0, %for.body ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%2 = load i32, ptr %u, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%3 = load i32, ptr %v, align 4, !tbaa !5
%idxprom6 = sext i32 %3 to i64
%arrayidx7 = getelementptr inbounds [101 x [101 x i32]], ptr @matrix, i64 0, i64 %idxprom, i64 %idxprom6
store i32 1, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %j.077, 1
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc, %4
br i1 %cmp3, label %for.body4, label %for.inc8, !llvm.loop !9
for.inc8: ; preds = %for.body4, %for.body
%inc9 = add nuw nsw i32 %i.079, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc9, %5
br i1 %cmp, label %for.body, label %for.cond11.preheader, !llvm.loop !11
while.body.preheader: ; preds = %for.cond11.preheader
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([101 x i32], ptr @level, i64 0, i64 1), i8 -1, i64 %7, i1 false), !tbaa !5
store i32 1, ptr @queue, align 16, !tbaa !5
store i32 0, ptr getelementptr inbounds ([101 x i32], ptr @level, i64 0, i64 1), align 4, !tbaa !5
%8 = add nuw i32 %5, 1
%wide.trip.count = zext i32 %8 to i64
br label %while.body
for.cond48.preheader.thread: ; preds = %for.cond11.preheader, %entry
store i32 1, ptr @queue, align 16, !tbaa !5
store i32 0, ptr getelementptr inbounds ([101 x i32], ptr @level, i64 0, i64 1), align 4, !tbaa !5
br label %for.end56
for.cond27.while.cond.loopexit_crit_edge: ; preds = %for.inc45
%indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
%9 = zext i32 %qTail.2 to i64
%cmp22.not = icmp eq i64 %indvars.iv.next95, %9
br i1 %cmp22.not, label %for.cond48.preheader, label %while.body, !llvm.loop !12
for.cond48.preheader: ; preds = %for.cond27.while.cond.loopexit_crit_edge
br i1 %cmp12.not80, label %for.end56, label %for.body50
while.body: ; preds = %while.body.preheader, %for.cond27.while.cond.loopexit_crit_edge
%indvars.iv94 = phi i64 [ 0, %while.body.preheader ], [ %indvars.iv.next95, %for.cond27.while.cond.loopexit_crit_edge ]
%qTail.087 = phi i32 [ 1, %while.body.preheader ], [ %qTail.2, %for.cond27.while.cond.loopexit_crit_edge ]
%arrayidx26 = getelementptr inbounds [101 x i32], ptr @queue, i64 0, i64 %indvars.iv94
%10 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%idxprom33 = sext i32 %10 to i64
%arrayidx39 = getelementptr inbounds [101 x i32], ptr @level, i64 0, i64 %idxprom33
br label %for.body29
for.body29: ; preds = %while.body, %for.inc45
%indvars.iv = phi i64 [ 1, %while.body ], [ %indvars.iv.next, %for.inc45 ]
%qTail.183 = phi i32 [ %qTail.087, %while.body ], [ %qTail.2, %for.inc45 ]
%arrayidx31 = getelementptr inbounds [101 x i32], ptr @level, i64 0, i64 %indvars.iv
%11 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%cmp32 = icmp eq i32 %11, -1
br i1 %cmp32, label %land.lhs.true, label %for.inc45
land.lhs.true: ; preds = %for.body29
%arrayidx36 = getelementptr inbounds [101 x [101 x i32]], ptr @matrix, i64 0, i64 %idxprom33, i64 %indvars.iv
%12 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%cmp37 = icmp eq i32 %12, 1
br i1 %cmp37, label %if.then, label %for.inc45
if.then: ; preds = %land.lhs.true
%13 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%add = add nsw i32 %13, 1
store i32 %add, ptr %arrayidx31, align 4, !tbaa !5
%inc42 = add nsw i32 %qTail.183, 1
%idxprom43 = sext i32 %qTail.183 to i64
%arrayidx44 = getelementptr inbounds [101 x i32], ptr @queue, i64 0, i64 %idxprom43
%14 = trunc i64 %indvars.iv to i32
store i32 %14, ptr %arrayidx44, align 4, !tbaa !5
br label %for.inc45
for.inc45: ; preds = %for.body29, %land.lhs.true, %if.then
%qTail.2 = phi i32 [ %inc42, %if.then ], [ %qTail.183, %land.lhs.true ], [ %qTail.183, %for.body29 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond27.while.cond.loopexit_crit_edge, label %for.body29, !llvm.loop !13
for.body50: ; preds = %for.cond48.preheader, %for.body50
%indvars.iv97 = phi i64 [ %indvars.iv.next98, %for.body50 ], [ 1, %for.cond48.preheader ]
%arrayidx52 = getelementptr inbounds [101 x i32], ptr @level, i64 0, i64 %indvars.iv97
%15 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%16 = trunc i64 %indvars.iv97 to i32
%call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16, i32 noundef %15)
%indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
%17 = load i32, ptr %n, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp49.not.not = icmp slt i64 %indvars.iv97, %18
br i1 %cmp49.not.not, label %for.body50, label %for.end56, !llvm.loop !14
for.end56: ; preds = %for.body50, %for.cond48.preheader.thread, %for.cond48.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#define Q 100
void bfs();
void enqueue(int);
int dequeue();
int head = 0,tail = 0,n;
int q[Q+1],b[Q+1][Q+1],color[Q+1] = {},d[Q+1] = {};
int main(){
int i,j,id,k,v;
scanf("%d",&n);
for(i = 1; i < n+1; i++){
scanf("%d %d",&id,&k);
for(j = 0;j < k;j++){
scanf("%d",&v);
b[id][v] = v;
}
}
bfs();
for(i = 1; i < n+1; i++){
if(i != 1 && d[i] == 0)printf("%d -1\n",i);
else printf("%d %d\n",i,d[i]);
}
return 0;
}
void bfs(){
int i,u;
color[1] = -1;
enqueue(1);
while(head != tail){
u = dequeue();
for(i = 1;i < n+1;i++){
if(b[u][i] != 0){
if(color[i] == 0){
color[i] = -1;
d[i] = d[u] + 1;
enqueue(i);
}
}
}
}
color[u] = -2;
}
void enqueue(int a){
int next;
next = (tail+1)%Q;
if(tail != next){
q[tail] = a;
tail = next;
}
}
int dequeue(){
int val;
if(head != tail){
val = q[head];
head = (head+1)%Q;
}
return val;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327521/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327521/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@head = dso_local local_unnamed_addr global i32 0, align 4
@tail = dso_local local_unnamed_addr global i32 0, align 4
@color = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@d = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@b = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [7 x i8] c"%d -1\0A\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@q = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%id = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not37 = icmp slt i32 %0, 1
br i1 %cmp.not37, label %for.end10, label %for.body
for.body: ; preds = %entry, %for.inc8
%i.038 = phi i32 [ %inc9, %for.inc8 ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %id, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp335 = icmp sgt i32 %1, 0
br i1 %cmp335, label %for.body4, label %for.inc8
for.body4: ; preds = %for.body, %for.body4
%j.036 = phi i32 [ %inc, %for.body4 ], [ 0, %for.body ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%2 = load i32, ptr %v, align 4, !tbaa !5
%3 = load i32, ptr %id, align 4, !tbaa !5
%idxprom = sext i32 %3 to i64
%idxprom6 = sext i32 %2 to i64
%arrayidx7 = getelementptr inbounds [101 x [101 x i32]], ptr @b, i64 0, i64 %idxprom, i64 %idxprom6
store i32 %2, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %j.036, 1
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc, %4
br i1 %cmp3, label %for.body4, label %for.inc8, !llvm.loop !9
for.inc8: ; preds = %for.body4, %for.body
%inc9 = add nuw nsw i32 %i.038, 1
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.038, %5
br i1 %cmp.not.not, label %for.body, label %for.end10, !llvm.loop !11
for.end10: ; preds = %for.inc8, %entry
call void @bfs()
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp13.not39 = icmp slt i32 %6, 1
br i1 %cmp13.not39, label %for.end25, label %for.inc23.peel
for.inc23.peel: ; preds = %for.end10
%.pre = load i32, ptr getelementptr inbounds ([101 x i32], ptr @d, i64 0, i64 1), align 4, !tbaa !5
%call22.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 1, i32 noundef %.pre)
%.pre43 = load i32, ptr @n, align 4, !tbaa !5
%cmp13.not.not.peel = icmp sgt i32 %.pre43, 1
br i1 %cmp13.not.not.peel, label %land.lhs.true, label %for.end25
land.lhs.true: ; preds = %for.inc23.peel, %for.inc23
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc23 ], [ 2, %for.inc23.peel ]
%arrayidx17 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %indvars.iv
%7 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%cmp18 = icmp eq i32 %7, 0
%8 = trunc i64 %indvars.iv to i32
br i1 %cmp18, label %if.then, label %if.else
if.then: ; preds = %land.lhs.true
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
br label %for.inc23
if.else: ; preds = %land.lhs.true
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8, i32 noundef %7)
br label %for.inc23
for.inc23: ; preds = %if.then, %if.else
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr @n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp13.not.not = icmp slt i64 %indvars.iv, %10
br i1 %cmp13.not.not, label %land.lhs.true, label %for.end25, !llvm.loop !12
for.end25: ; preds = %for.inc23, %for.inc23.peel, %for.end10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @bfs() local_unnamed_addr #3 {
entry:
store i32 -1, ptr getelementptr inbounds ([101 x i32], ptr @color, i64 0, i64 1), align 4, !tbaa !5
%0 = load i32, ptr @tail, align 4, !tbaa !5
%add.i = add nsw i32 %0, 1
%rem.i = srem i32 %add.i, 100
%cmp.not.i = icmp eq i32 %0, %rem.i
br i1 %cmp.not.i, label %enqueue.exit, label %if.then.i
if.then.i: ; preds = %entry
%idxprom.i = sext i32 %0 to i64
%arrayidx.i = getelementptr inbounds [101 x i32], ptr @q, i64 0, i64 %idxprom.i
store i32 1, ptr %arrayidx.i, align 4, !tbaa !5
store i32 %rem.i, ptr @tail, align 4, !tbaa !5
br label %enqueue.exit
enqueue.exit: ; preds = %entry, %if.then.i
%tail.promoted46 = phi i32 [ %0, %entry ], [ %rem.i, %if.then.i ]
%head.promoted = load i32, ptr @head, align 4, !tbaa !5
%cmp.not51 = icmp eq i32 %head.promoted, %tail.promoted46
br i1 %cmp.not51, label %while.end, label %dequeue.exit.lr.ph
dequeue.exit.lr.ph: ; preds = %enqueue.exit
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp1.not42 = icmp slt i32 %1, 1
br i1 %cmp1.not42, label %dequeue.exit.us, label %dequeue.exit.preheader
dequeue.exit.preheader: ; preds = %dequeue.exit.lr.ph
%2 = add nuw i32 %1, 1
%wide.trip.count = zext i32 %2 to i64
br label %dequeue.exit
dequeue.exit.us: ; preds = %dequeue.exit.lr.ph, %dequeue.exit.us
%rem.i324553.us = phi i32 [ %rem.i32.us, %dequeue.exit.us ], [ %head.promoted, %dequeue.exit.lr.ph ]
%add.i31.us = add nsw i32 %rem.i324553.us, 1
%rem.i32.us = srem i32 %add.i31.us, 100
%cmp.not.us = icmp eq i32 %rem.i32.us, %tail.promoted46
br i1 %cmp.not.us, label %while.cond.while.end_crit_edge.split.us, label %dequeue.exit.us, !llvm.loop !14
while.cond.while.end_crit_edge.split.us: ; preds = %dequeue.exit.us
%idxprom.i29.us.le = sext i32 %rem.i324553.us to i64
%arrayidx.i30.us.le = getelementptr inbounds [101 x i32], ptr @q, i64 0, i64 %idxprom.i29.us.le
%3 = load i32, ptr %arrayidx.i30.us.le, align 4, !tbaa !5
%.pre = sext i32 %3 to i64
br label %while.cond.while.end_crit_edge
for.cond.while.cond.loopexit_crit_edge: ; preds = %for.inc
%rem.i32 = srem i32 %add.i31, 100
%cmp.not = icmp eq i32 %rem.i32, %tail.promoted47
br i1 %cmp.not, label %while.cond.while.end_crit_edge, label %dequeue.exit, !llvm.loop !14
dequeue.exit: ; preds = %dequeue.exit.preheader, %for.cond.while.cond.loopexit_crit_edge
%rem.i324553 = phi i32 [ %rem.i32, %for.cond.while.cond.loopexit_crit_edge ], [ %head.promoted, %dequeue.exit.preheader ]
%tail.promoted5052 = phi i32 [ %tail.promoted47, %for.cond.while.cond.loopexit_crit_edge ], [ %tail.promoted46, %dequeue.exit.preheader ]
%idxprom.i29 = sext i32 %rem.i324553 to i64
%arrayidx.i30 = getelementptr inbounds [101 x i32], ptr @q, i64 0, i64 %idxprom.i29
%4 = load i32, ptr %arrayidx.i30, align 4, !tbaa !5
%add.i31 = add nsw i32 %rem.i324553, 1
%idxprom = sext i32 %4 to i64
%arrayidx12 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %idxprom
br label %for.body
for.body: ; preds = %dequeue.exit, %for.inc
%indvars.iv = phi i64 [ 1, %dequeue.exit ], [ %indvars.iv.next, %for.inc ]
%tail.promoted48 = phi i32 [ %tail.promoted5052, %dequeue.exit ], [ %tail.promoted47, %for.inc ]
%rem.i344143 = phi i32 [ %tail.promoted5052, %dequeue.exit ], [ %rem.i3440, %for.inc ]
%arrayidx3 = getelementptr inbounds [101 x [101 x i32]], ptr @b, i64 0, i64 %idxprom, i64 %indvars.iv
%5 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp4.not = icmp eq i32 %5, 0
br i1 %cmp4.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%arrayidx6 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %indvars.iv
%6 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %6, 0
br i1 %cmp7, label %if.then8, label %for.inc
if.then8: ; preds = %if.then
store i32 -1, ptr %arrayidx6, align 4, !tbaa !5
%7 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%add13 = add nsw i32 %7, 1
%arrayidx15 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %indvars.iv
store i32 %add13, ptr %arrayidx15, align 4, !tbaa !5
%add.i33 = add nsw i32 %rem.i344143, 1
%rem.i34 = srem i32 %add.i33, 100
%cmp.not.i35 = icmp eq i32 %rem.i344143, %rem.i34
br i1 %cmp.not.i35, label %for.inc, label %if.then.i36
if.then.i36: ; preds = %if.then8
%idxprom.i37 = sext i32 %rem.i344143 to i64
%arrayidx.i38 = getelementptr inbounds [101 x i32], ptr @q, i64 0, i64 %idxprom.i37
%8 = trunc i64 %indvars.iv to i32
store i32 %8, ptr %arrayidx.i38, align 4, !tbaa !5
store i32 %rem.i34, ptr @tail, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then.i36, %if.then8, %for.body, %if.then
%tail.promoted47 = phi i32 [ %rem.i34, %if.then.i36 ], [ %tail.promoted48, %if.then8 ], [ %tail.promoted48, %for.body ], [ %tail.promoted48, %if.then ]
%rem.i3440 = phi i32 [ %rem.i34, %if.then.i36 ], [ %rem.i344143, %if.then8 ], [ %rem.i344143, %for.body ], [ %rem.i344143, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.while.cond.loopexit_crit_edge, label %for.body, !llvm.loop !15
while.cond.while.end_crit_edge: ; preds = %for.cond.while.cond.loopexit_crit_edge, %while.cond.while.end_crit_edge.split.us
%.pre-phi = phi i64 [ %.pre, %while.cond.while.end_crit_edge.split.us ], [ %idxprom, %for.cond.while.cond.loopexit_crit_edge ]
%.us-phi = phi i32 [ %tail.promoted46, %while.cond.while.end_crit_edge.split.us ], [ %tail.promoted47, %for.cond.while.cond.loopexit_crit_edge ]
store i32 %.us-phi, ptr @head, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %enqueue.exit
%u.0.lcssa = phi i64 [ %.pre-phi, %while.cond.while.end_crit_edge ], [ 0, %enqueue.exit ]
%arrayidx18 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %u.0.lcssa
store i32 -2, ptr %arrayidx18, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @enqueue(i32 noundef %a) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100
%cmp.not = icmp eq i32 %0, %rem
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @q, i64 0, i64 %idxprom
store i32 %a, ptr %arrayidx, align 4, !tbaa !5
store i32 %rem, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @dequeue() local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%1 = load i32, ptr @tail, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @q, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100
store i32 %rem, ptr @head, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%val.0 = phi i32 [ %2, %if.then ], [ undef, %entry ]
ret i32 %val.0
}
attributes #0 = { 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 #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 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define NIL -1
#define N 150
typedef struct{
int id;
int k;
int v[N];
}DATA;
void bfs(int,int,int);
void enqueue(int);
int dequeue(void);
int count=0;
int d[N],color[N],G[N][N],Q[N];
DATA data[N];
int main() {
int i,j,n;
scanf("%d",&n);
for(i = 1; i <= n; i++) {
scanf("%d%d",&data[i].id,&data[i].k);
if(data[i].k == 0 ) data[i].v[1] = 0;
for(j = 1; j <= data[i].k; j++) {
scanf("%d",&data[i].v[j]);
if(data[i].v[j] == data[i].v[data[i].k]) data[i].v[(data[i].k)+1] = NIL;
}
}
for(i = 1; i <= n; i++) {
for(j = 1; j <= n; j++) {
G[i][data[i].v[j]] = 1;
}
}
bfs(1,data[1].id,n);
for(i = 1; i <= n; i++) {
printf("%d %d\n",data[i].id,d[i]);
}
return 0;
}
void bfs(int s,int u,int V)
{
int i,x;
for(i = u; i <= V; i++) {
color[i] = WHITE;
d[i] = NIL;
}
color[s] = GRAY;
d[s] = 0;
enqueue(s);
while(count != 0) {
x = dequeue();
for(i = u; i <= V; i++) {
if(G[x][i] == 1 && color[i] == WHITE) {
color[i] = GRAY;
d[i] = d[x]+1;
enqueue(i);
}
}
color[x] = BLACK;
}
}
void enqueue(int a)
{
Q[count] = a;
count++;
}
int dequeue(void)
{
int head,i;
head = Q[0];
for(i = 0; i < count; i++) {
Q[i] = Q[i+1];
}
count--;
return head;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327565/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327565/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.DATA = type { i32, i32, [150 x i32] }
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@data = dso_local global [150 x %struct.DATA] zeroinitializer, align 16
@G = dso_local local_unnamed_addr global [150 x [150 x i32]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@d = dso_local local_unnamed_addr global [150 x i32] zeroinitializer, align 16
@color = dso_local local_unnamed_addr global [150 x i32] zeroinitializer, align 16
@Q = dso_local local_unnamed_addr global [150 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not111 = icmp slt i32 %0, 1
br i1 %cmp.not111, label %for.end70, label %for.body
for.cond50.preheader: ; preds = %for.inc47
%cmp51.not115 = icmp slt i32 %9, 1
br i1 %cmp51.not115, label %for.end70, label %for.cond53.preheader.preheader
for.cond53.preheader.preheader: ; preds = %for.cond50.preheader
%1 = add nuw i32 %9, 1
%wide.trip.count130 = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count130, -1
%3 = add nsw i64 %wide.trip.count130, -2
%xtraiter = and i64 %2, 3
%4 = icmp ult i64 %3, 3
%unroll_iter = and i64 %2, -4
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond53.preheader
for.body: ; preds = %entry, %for.inc47
%indvars.iv121 = phi i64 [ %indvars.iv.next122, %for.inc47 ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [150 x %struct.DATA], ptr @data, i64 0, i64 %indvars.iv121
%k = getelementptr inbounds [150 x %struct.DATA], ptr @data, i64 0, i64 %indvars.iv121, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %k)
%5 = load i32, ptr %k, align 4, !tbaa !9
%cmp7 = icmp eq i32 %5, 0
br i1 %cmp7, label %if.end.thread, label %if.end
if.end.thread: ; preds = %for.body
%arrayidx10 = getelementptr inbounds [150 x %struct.DATA], ptr @data, i64 0, i64 %indvars.iv121, i32 2, i64 1
store i32 0, ptr %arrayidx10, align 4, !tbaa !5
br label %for.inc47
if.end: ; preds = %for.body
%cmp15.not109 = icmp slt i32 %5, 1
br i1 %cmp15.not109, label %for.inc47, label %for.body16
for.body16: ; preds = %if.end, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %if.end ]
%arrayidx21 = getelementptr inbounds [150 x %struct.DATA], ptr @data, i64 0, i64 %indvars.iv121, i32 2, i64 %indvars.iv
%call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx21)
%6 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%7 = load i32, ptr %k, align 4, !tbaa !9
%idxprom34 = sext i32 %7 to i64
%arrayidx35 = getelementptr inbounds [150 x %struct.DATA], ptr @data, i64 0, i64 %indvars.iv121, i32 2, i64 %idxprom34
%8 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%cmp36 = icmp eq i32 %6, %8
br i1 %cmp36, label %if.then37, label %for.inc
if.then37: ; preds = %for.body16
%add = add nsw i32 %7, 1
%idxprom44 = sext i32 %add to i64
%arrayidx45 = getelementptr inbounds [150 x %struct.DATA], ptr @data, i64 0, i64 %indvars.iv121, i32 2, i64 %idxprom44
store i32 -1, ptr %arrayidx45, align 4, !tbaa !5
%.pre = load i32, ptr %k, align 4, !tbaa !9
%.pre135 = sext i32 %.pre to i64
br label %for.inc
for.inc: ; preds = %for.body16, %if.then37
%.pre-phi = phi i64 [ %idxprom34, %for.body16 ], [ %.pre135, %if.then37 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%cmp15.not.not = icmp slt i64 %indvars.iv, %.pre-phi
br i1 %cmp15.not.not, label %for.body16, label %for.inc47, !llvm.loop !11
for.inc47: ; preds = %for.inc, %if.end.thread, %if.end
%indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp.not.not = icmp slt i64 %indvars.iv121, %10
br i1 %cmp.not.not, label %for.body, label %for.cond50.preheader, !llvm.loop !13
for.cond53.preheader: ; preds = %for.cond53.preheader.preheader, %for.cond53.for.inc68_crit_edge
%indvars.iv127 = phi i64 [ 1, %for.cond53.preheader.preheader ], [ %indvars.iv.next128, %for.cond53.for.inc68_crit_edge ]
br i1 %4, label %for.cond53.for.inc68_crit_edge.unr-lcssa, label %for.body55
for.body55: ; preds = %for.cond53.preheader, %for.body55
%indvars.iv124 = phi i64 [ %indvars.iv.next125.3, %for.body55 ], [ 1, %for.cond53.preheader ]
%niter = phi i64 [ %niter.next.3, %for.body55 ], [ 0, %for.cond53.preheader ]
%arrayidx62 = getelementptr inbounds [150 x %struct.DATA], ptr @data, i64 0, i64 %indvars.iv127, i32 2, i64 %indvars.iv124
%11 = load i32, ptr %arrayidx62, align 4, !tbaa !5
%idxprom63 = sext i32 %11 to i64
%arrayidx64 = getelementptr inbounds [150 x [150 x i32]], ptr @G, i64 0, i64 %indvars.iv127, i64 %idxprom63
store i32 1, ptr %arrayidx64, align 4, !tbaa !5
%indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
%arrayidx62.1 = getelementptr inbounds [150 x %struct.DATA], ptr @data, i64 0, i64 %indvars.iv127, i32 2, i64 %indvars.iv.next125
%12 = load i32, ptr %arrayidx62.1, align 4, !tbaa !5
%idxprom63.1 = sext i32 %12 to i64
%arrayidx64.1 = getelementptr inbounds [150 x [150 x i32]], ptr @G, i64 0, i64 %indvars.iv127, i64 %idxprom63.1
store i32 1, ptr %arrayidx64.1, align 4, !tbaa !5
%indvars.iv.next125.1 = add nuw nsw i64 %indvars.iv124, 2
%arrayidx62.2 = getelementptr inbounds [150 x %struct.DATA], ptr @data, i64 0, i64 %indvars.iv127, i32 2, i64 %indvars.iv.next125.1
%13 = load i32, ptr %arrayidx62.2, align 4, !tbaa !5
%idxprom63.2 = sext i32 %13 to i64
%arrayidx64.2 = getelementptr inbounds [150 x [150 x i32]], ptr @G, i64 0, i64 %indvars.iv127, i64 %idxprom63.2
store i32 1, ptr %arrayidx64.2, align 4, !tbaa !5
%indvars.iv.next125.2 = add nuw nsw i64 %indvars.iv124, 3
%arrayidx62.3 = getelementptr inbounds [150 x %struct.DATA], ptr @data, i64 0, i64 %indvars.iv127, i32 2, i64 %indvars.iv.next125.2
%14 = load i32, ptr %arrayidx62.3, align 4, !tbaa !5
%idxprom63.3 = sext i32 %14 to i64
%arrayidx64.3 = getelementptr inbounds [150 x [150 x i32]], ptr @G, i64 0, i64 %indvars.iv127, i64 %idxprom63.3
store i32 1, ptr %arrayidx64.3, align 4, !tbaa !5
%indvars.iv.next125.3 = add nuw nsw i64 %indvars.iv124, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond53.for.inc68_crit_edge.unr-lcssa, label %for.body55, !llvm.loop !14
for.cond53.for.inc68_crit_edge.unr-lcssa: ; preds = %for.body55, %for.cond53.preheader
%indvars.iv124.unr = phi i64 [ 1, %for.cond53.preheader ], [ %indvars.iv.next125.3, %for.body55 ]
br i1 %lcmp.mod.not, label %for.cond53.for.inc68_crit_edge, label %for.body55.epil
for.body55.epil: ; preds = %for.cond53.for.inc68_crit_edge.unr-lcssa, %for.body55.epil
%indvars.iv124.epil = phi i64 [ %indvars.iv.next125.epil, %for.body55.epil ], [ %indvars.iv124.unr, %for.cond53.for.inc68_crit_edge.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body55.epil ], [ 0, %for.cond53.for.inc68_crit_edge.unr-lcssa ]
%arrayidx62.epil = getelementptr inbounds [150 x %struct.DATA], ptr @data, i64 0, i64 %indvars.iv127, i32 2, i64 %indvars.iv124.epil
%15 = load i32, ptr %arrayidx62.epil, align 4, !tbaa !5
%idxprom63.epil = sext i32 %15 to i64
%arrayidx64.epil = getelementptr inbounds [150 x [150 x i32]], ptr @G, i64 0, i64 %indvars.iv127, i64 %idxprom63.epil
store i32 1, ptr %arrayidx64.epil, align 4, !tbaa !5
%indvars.iv.next125.epil = add nuw nsw i64 %indvars.iv124.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond53.for.inc68_crit_edge, label %for.body55.epil, !llvm.loop !15
for.cond53.for.inc68_crit_edge: ; preds = %for.body55.epil, %for.cond53.for.inc68_crit_edge.unr-lcssa
%indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
%exitcond131.not = icmp eq i64 %indvars.iv.next128, %wide.trip.count130
br i1 %exitcond131.not, label %for.end70, label %for.cond53.preheader, !llvm.loop !17
for.end70: ; preds = %for.cond53.for.inc68_crit_edge, %entry, %for.cond50.preheader
%.lcssa138 = phi i32 [ %9, %for.cond50.preheader ], [ %0, %entry ], [ %9, %for.cond53.for.inc68_crit_edge ]
%16 = load i32, ptr getelementptr inbounds ([150 x %struct.DATA], ptr @data, i64 0, i64 1), align 16, !tbaa !18
call void @bfs(i32 noundef 1, i32 noundef %16, i32 noundef %.lcssa138)
%17 = load i32, ptr %n, align 4, !tbaa !5
%cmp72.not117 = icmp slt i32 %17, 1
br i1 %cmp72.not117, label %for.end82, label %for.body73
for.body73: ; preds = %for.end70, %for.body73
%indvars.iv132 = phi i64 [ %indvars.iv.next133, %for.body73 ], [ 1, %for.end70 ]
%arrayidx75 = getelementptr inbounds [150 x %struct.DATA], ptr @data, i64 0, i64 %indvars.iv132
%18 = load i32, ptr %arrayidx75, align 16, !tbaa !18
%arrayidx78 = getelementptr inbounds [150 x i32], ptr @d, i64 0, i64 %indvars.iv132
%19 = load i32, ptr %arrayidx78, align 4, !tbaa !5
%call79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18, i32 noundef %19)
%indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
%20 = load i32, ptr %n, align 4, !tbaa !5
%21 = sext i32 %20 to i64
%cmp72.not.not = icmp slt i64 %indvars.iv132, %21
br i1 %cmp72.not.not, label %for.body73, label %for.end82, !llvm.loop !19
for.end82: ; preds = %for.body73, %for.end70
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @bfs(i32 noundef %s, i32 noundef %u, i32 noundef %V) local_unnamed_addr #3 {
entry:
%cmp.not49 = icmp sgt i32 %u, %V
br i1 %cmp.not49, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %u to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr @color, i64 %1
%2 = sub i32 %V, %u
%3 = zext i32 %2 to i64
%4 = shl nuw nsw i64 %3, 2
%5 = add nuw nsw i64 %4, 4
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i8 0, i64 %5, i1 false), !tbaa !5
%scevgep62 = getelementptr i8, ptr @d, i64 %1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep62, i8 -1, i64 %5, i1 false), !tbaa !5
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%idxprom3 = sext i32 %s to i64
%arrayidx4 = getelementptr inbounds [150 x i32], ptr @color, i64 0, i64 %idxprom3
store i32 1, ptr %arrayidx4, align 4, !tbaa !5
%arrayidx6 = getelementptr inbounds [150 x i32], ptr @d, i64 0, i64 %idxprom3
store i32 0, ptr %arrayidx6, align 4, !tbaa !5
%6 = load i32, ptr @count, align 4, !tbaa !5
%idxprom.i = sext i32 %6 to i64
%arrayidx.i = getelementptr inbounds [150 x i32], ptr @Q, i64 0, i64 %idxprom.i
store i32 %s, ptr %arrayidx.i, align 4, !tbaa !5
%inc.i = add nsw i32 %6, 1
store i32 %inc.i, ptr @count, align 4, !tbaa !5
%cmp7.not58 = icmp eq i32 %inc.i, 0
br i1 %cmp7.not58, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
br i1 %cmp.not49, label %while.body.us.preheader, label %while.body.preheader
while.body.preheader: ; preds = %while.body.lr.ph
%7 = sext i32 %u to i64
%8 = add i32 %V, 1
br label %while.body
while.body.us.preheader: ; preds = %while.body.lr.ph
%9 = zext i32 %inc.i to i64
%.pre68 = load i32, ptr @Q, align 16, !tbaa !5
%xtraiter = and i32 %inc.i, 1
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.body.us.prol.loopexit, label %while.body.us.prol
while.body.us.prol: ; preds = %while.body.us.preheader
%cmp6.i.us.prol = icmp sgt i32 %6, -1
br i1 %cmp6.i.us.prol, label %for.body.preheader.i.us.prol, label %dequeue.exit.us.prol
for.body.preheader.i.us.prol: ; preds = %while.body.us.prol
%10 = shl nuw nsw i64 %9, 2
tail call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 @Q, ptr nonnull align 4 getelementptr inbounds ([150 x i32], ptr @Q, i64 0, i64 1), i64 %10, i1 false), !tbaa !5
%.pre.prol = load i32, ptr @Q, align 16, !tbaa !5
br label %dequeue.exit.us.prol
dequeue.exit.us.prol: ; preds = %for.body.preheader.i.us.prol, %while.body.us.prol
%11 = phi i32 [ %.pre.prol, %for.body.preheader.i.us.prol ], [ %.pre68, %while.body.us.prol ]
%indvars.iv.next66.prol = add nsw i64 %9, -1
%idxprom28.us.prol = sext i32 %.pre68 to i64
%arrayidx29.us.prol = getelementptr inbounds [150 x i32], ptr @color, i64 0, i64 %idxprom28.us.prol
store i32 2, ptr %arrayidx29.us.prol, align 4, !tbaa !5
br label %while.body.us.prol.loopexit
while.body.us.prol.loopexit: ; preds = %dequeue.exit.us.prol, %while.body.us.preheader
%.unr = phi i32 [ %.pre68, %while.body.us.preheader ], [ %11, %dequeue.exit.us.prol ]
%indvars.iv65.unr = phi i64 [ %9, %while.body.us.preheader ], [ %indvars.iv.next66.prol, %dequeue.exit.us.prol ]
%12 = icmp eq i32 %6, 0
br i1 %12, label %while.cond.while.end_crit_edge, label %while.body.us
while.body.us: ; preds = %while.body.us.prol.loopexit, %dequeue.exit.us.1
%13 = phi i32 [ %19, %dequeue.exit.us.1 ], [ %.unr, %while.body.us.prol.loopexit ]
%indvars.iv65 = phi i64 [ %indvars.iv.next66.1, %dequeue.exit.us.1 ], [ %indvars.iv65.unr, %while.body.us.prol.loopexit ]
%14 = trunc i64 %indvars.iv65 to i32
%cmp6.i.us = icmp sgt i32 %14, 0
br i1 %cmp6.i.us, label %for.body.preheader.i.us, label %dequeue.exit.us
for.body.preheader.i.us: ; preds = %while.body.us
%15 = shl nuw nsw i64 %indvars.iv65, 2
tail call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 @Q, ptr nonnull align 4 getelementptr inbounds ([150 x i32], ptr @Q, i64 0, i64 1), i64 %15, i1 false), !tbaa !5
%.pre = load i32, ptr @Q, align 16, !tbaa !5
br label %dequeue.exit.us
dequeue.exit.us: ; preds = %for.body.preheader.i.us, %while.body.us
%16 = phi i32 [ %.pre, %for.body.preheader.i.us ], [ %13, %while.body.us ]
%indvars.iv.next66 = add nsw i64 %indvars.iv65, -1
%idxprom28.us = sext i32 %13 to i64
%arrayidx29.us = getelementptr inbounds [150 x i32], ptr @color, i64 0, i64 %idxprom28.us
store i32 2, ptr %arrayidx29.us, align 4, !tbaa !5
%17 = trunc i64 %indvars.iv.next66 to i32
%cmp6.i.us.1 = icmp sgt i32 %17, 0
br i1 %cmp6.i.us.1, label %for.body.preheader.i.us.1, label %dequeue.exit.us.1
for.body.preheader.i.us.1: ; preds = %dequeue.exit.us
%18 = shl nuw nsw i64 %indvars.iv.next66, 2
tail call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 @Q, ptr nonnull align 4 getelementptr inbounds ([150 x i32], ptr @Q, i64 0, i64 1), i64 %18, i1 false), !tbaa !5
%.pre.1 = load i32, ptr @Q, align 16, !tbaa !5
br label %dequeue.exit.us.1
dequeue.exit.us.1: ; preds = %for.body.preheader.i.us.1, %dequeue.exit.us
%19 = phi i32 [ %.pre.1, %for.body.preheader.i.us.1 ], [ %16, %dequeue.exit.us ]
%indvars.iv.next66.1 = add nsw i64 %indvars.iv65, -2
%idxprom28.us.1 = sext i32 %16 to i64
%arrayidx29.us.1 = getelementptr inbounds [150 x i32], ptr @color, i64 0, i64 %idxprom28.us.1
store i32 2, ptr %arrayidx29.us.1, align 4, !tbaa !5
%20 = and i64 %indvars.iv.next66.1, 4294967295
%cmp7.not.us.1 = icmp eq i64 %20, 0
br i1 %cmp7.not.us.1, label %while.cond.while.end_crit_edge, label %while.body.us, !llvm.loop !20
while.body: ; preds = %while.body.preheader, %for.cond8.for.end27_crit_edge
%21 = phi i32 [ %inc.i4851, %for.cond8.for.end27_crit_edge ], [ %inc.i, %while.body.preheader ]
%22 = load i32, ptr @Q, align 16, !tbaa !5
%cmp6.i = icmp sgt i32 %21, 0
br i1 %cmp6.i, label %for.body.preheader.i, label %dequeue.exit
for.body.preheader.i: ; preds = %while.body
%23 = zext i32 %21 to i64
%24 = shl nuw nsw i64 %23, 2
tail call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 @Q, ptr nonnull align 4 getelementptr inbounds ([150 x i32], ptr @Q, i64 0, i64 1), i64 %24, i1 false), !tbaa !5
br label %dequeue.exit
dequeue.exit: ; preds = %while.body, %for.body.preheader.i
%dec.i = add nsw i32 %21, -1
%idxprom11 = sext i32 %22 to i64
%arrayidx22 = getelementptr inbounds [150 x i32], ptr @d, i64 0, i64 %idxprom11
br label %for.body10
for.body10: ; preds = %dequeue.exit, %for.inc25
%indvars.iv = phi i64 [ %7, %dequeue.exit ], [ %indvars.iv.next, %for.inc25 ]
%inc.i485254 = phi i32 [ %dec.i, %dequeue.exit ], [ %inc.i4851, %for.inc25 ]
%arrayidx14 = getelementptr inbounds [150 x [150 x i32]], ptr @G, i64 0, i64 %idxprom11, i64 %indvars.iv
%25 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15 = icmp eq i32 %25, 1
br i1 %cmp15, label %land.lhs.true, label %for.inc25
land.lhs.true: ; preds = %for.body10
%arrayidx17 = getelementptr inbounds [150 x i32], ptr @color, i64 0, i64 %indvars.iv
%26 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%cmp18 = icmp eq i32 %26, 0
br i1 %cmp18, label %if.then, label %for.inc25
if.then: ; preds = %land.lhs.true
store i32 1, ptr %arrayidx17, align 4, !tbaa !5
%27 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%add = add nsw i32 %27, 1
%arrayidx24 = getelementptr inbounds [150 x i32], ptr @d, i64 0, i64 %indvars.iv
store i32 %add, ptr %arrayidx24, align 4, !tbaa !5
%idxprom.i46 = sext i32 %inc.i485254 to i64
%arrayidx.i47 = getelementptr inbounds [150 x i32], ptr @Q, i64 0, i64 %idxprom.i46
%28 = trunc i64 %indvars.iv to i32
store i32 %28, ptr %arrayidx.i47, align 4, !tbaa !5
%inc.i48 = add nsw i32 %inc.i485254, 1
br label %for.inc25
for.inc25: ; preds = %for.body10, %land.lhs.true, %if.then
%inc.i4851 = phi i32 [ %inc.i485254, %for.body10 ], [ %inc.i485254, %land.lhs.true ], [ %inc.i48, %if.then ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %8, %lftr.wideiv
br i1 %exitcond.not, label %for.cond8.for.end27_crit_edge, label %for.body10, !llvm.loop !21
for.cond8.for.end27_crit_edge: ; preds = %for.inc25
%arrayidx29 = getelementptr inbounds [150 x i32], ptr @color, i64 0, i64 %idxprom11
store i32 2, ptr %arrayidx29, align 4, !tbaa !5
%cmp7.not = icmp eq i32 %inc.i4851, 0
br i1 %cmp7.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !20
while.cond.while.end_crit_edge: ; preds = %for.cond8.for.end27_crit_edge, %while.body.us.prol.loopexit, %dequeue.exit.us.1
store i32 0, ptr @count, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %for.end
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @enqueue(i32 noundef %a) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @count, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [150 x i32], ptr @Q, i64 0, i64 %idxprom
store i32 %a, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @count, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @dequeue() local_unnamed_addr #5 {
entry:
%0 = load i32, ptr @Q, align 16, !tbaa !5
%1 = load i32, ptr @count, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %1, 0
br i1 %cmp6, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%2 = zext i32 %1 to i64
%3 = shl nuw nsw i64 %2, 2
tail call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 @Q, ptr nonnull align 4 getelementptr inbounds ([150 x i32], ptr @Q, i64 0, i64 1), i64 %3, i1 false), !tbaa !5
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%dec = add nsw i32 %1, -1
store i32 %dec, ptr @count, align 4, !tbaa !5
ret i32 %0
}
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
attributes #0 = { 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 #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 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) 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 #5 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"", !6, i64 0, !6, i64 4, !7, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !12}
!18 = !{!10, !6, i64 0}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
|
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define N 100
int head = 0, tail = 0, que[N], M[N][N] = {0}, n;
int INF = (1 << 21);
void bfs(void);
void push(int);
int pop(void);
int isEmpty(void);
int main(void){
int u, k, v, i, j;
for(i = 0; i < N; i++){
que[i] = -1;
}
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &u);
u--;
scanf("%d", &k);
for(j = 0; j < k; j++){
scanf("%d", &v);
v--;
M[u][v] = 1;
}
}
bfs();
return 0;
}
void bfs(){
int d[N], i = 0, u, v;
while( i < N){
d[i++] = INF;
}
d[0] = 0;
push(0);
while(!isEmpty()){
u = pop();
for(i = 0; i < n; i++){
if(M[u][i] == 0) continue;
if(d[i] != INF) continue;
d[i] = d[u] + 1;
push(i);
}
}
for(i = 0; i < n; i++){
printf("%d %d\n", i + 1, (d[i] == INF ? -1 : d[i]));
}
}
void push(int a){
que[tail++] = a;
}
int pop(){
int ret = que[head];
que[head++] = -1;
return ret;
}
int isEmpty(){
return (head == tail);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327615/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327615/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@head = dso_local local_unnamed_addr global i32 0, align 4
@tail = dso_local local_unnamed_addr global i32 0, align 4
@M = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@INF = dso_local local_unnamed_addr global i32 2097152, align 4
@que = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #6
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) @que, i8 -1, i64 400, i1 false), !tbaa !5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp229 = icmp sgt i32 %0, 0
br i1 %cmp229, label %for.body3, label %for.end20
for.body3: ; preds = %entry, %for.inc18
%i.130 = phi i32 [ %inc19, %for.inc18 ], [ 0, %entry ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %u)
%1 = load i32, ptr %u, align 4, !tbaa !5
%dec = add nsw i32 %1, -1
store i32 %dec, ptr %u, align 4, !tbaa !5
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%2 = load i32, ptr %k, align 4, !tbaa !5
%cmp727 = icmp sgt i32 %2, 0
br i1 %cmp727, label %for.body8, label %for.inc18
for.body8: ; preds = %for.body3, %for.body8
%j.028 = phi i32 [ %inc16, %for.body8 ], [ 0, %for.body3 ]
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%3 = load i32, ptr %v, align 4, !tbaa !5
%dec10 = add nsw i32 %3, -1
store i32 %dec10, ptr %v, align 4, !tbaa !5
%4 = load i32, ptr %u, align 4, !tbaa !5
%idxprom11 = sext i32 %4 to i64
%idxprom13 = sext i32 %dec10 to i64
%arrayidx14 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom11, i64 %idxprom13
store i32 1, ptr %arrayidx14, align 4, !tbaa !5
%inc16 = add nuw nsw i32 %j.028, 1
%5 = load i32, ptr %k, align 4, !tbaa !5
%cmp7 = icmp slt i32 %inc16, %5
br i1 %cmp7, label %for.body8, label %for.inc18, !llvm.loop !9
for.inc18: ; preds = %for.body8, %for.body3
%inc19 = add nuw nsw i32 %i.130, 1
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc19, %6
br i1 %cmp2, label %for.body3, label %for.end20, !llvm.loop !11
for.end20: ; preds = %for.inc18, %entry
call void @bfs()
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #6
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @bfs() local_unnamed_addr #0 {
entry:
%d = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #6
%0 = load i32, ptr @INF, align 4
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
store <4 x i32> %broadcast.splat, ptr %d, align 16, !tbaa !5
%1 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 4
store <4 x i32> %broadcast.splat, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 8
store <4 x i32> %broadcast.splat, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 12
store <4 x i32> %broadcast.splat, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 16
store <4 x i32> %broadcast.splat, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 20
store <4 x i32> %broadcast.splat, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 24
store <4 x i32> %broadcast.splat, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 28
store <4 x i32> %broadcast.splat, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 32
store <4 x i32> %broadcast.splat, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 36
store <4 x i32> %broadcast.splat, ptr %9, align 16, !tbaa !5
%10 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 40
store <4 x i32> %broadcast.splat, ptr %10, align 16, !tbaa !5
%11 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 44
store <4 x i32> %broadcast.splat, ptr %11, align 16, !tbaa !5
%12 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 48
store <4 x i32> %broadcast.splat, ptr %12, align 16, !tbaa !5
%13 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 52
store <4 x i32> %broadcast.splat, ptr %13, align 16, !tbaa !5
%14 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 56
store <4 x i32> %broadcast.splat, ptr %14, align 16, !tbaa !5
%15 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 60
store <4 x i32> %broadcast.splat, ptr %15, align 16, !tbaa !5
%16 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 64
store <4 x i32> %broadcast.splat, ptr %16, align 16, !tbaa !5
%17 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 68
store <4 x i32> %broadcast.splat, ptr %17, align 16, !tbaa !5
%18 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 72
store <4 x i32> %broadcast.splat, ptr %18, align 16, !tbaa !5
%19 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 76
store <4 x i32> %broadcast.splat, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 80
store <4 x i32> %broadcast.splat, ptr %20, align 16, !tbaa !5
%21 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 84
store <4 x i32> %broadcast.splat, ptr %21, align 16, !tbaa !5
%22 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 88
store <4 x i32> %broadcast.splat, ptr %22, align 16, !tbaa !5
%23 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 92
store <4 x i32> %broadcast.splat, ptr %23, align 16, !tbaa !5
%24 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 96
store <4 x i32> %broadcast.splat, ptr %24, align 16, !tbaa !5
store i32 0, ptr %d, align 16, !tbaa !5
%25 = load i32, ptr @tail, align 4, !tbaa !5
%inc.i = add nsw i32 %25, 1
store i32 %inc.i, ptr @tail, align 4, !tbaa !5
%idxprom.i = sext i32 %25 to i64
%arrayidx.i = getelementptr inbounds [100 x i32], ptr @que, i64 0, i64 %idxprom.i
store i32 0, ptr %arrayidx.i, align 4, !tbaa !5
%head.promoted = load i32, ptr @head, align 4, !tbaa !5
%cmp.i.not66 = icmp eq i32 %head.promoted, %inc.i
%.pre = load i32, ptr @n, align 4, !tbaa !5
br i1 %cmp.i.not66, label %for.cond22.preheader, label %while.body3.lr.ph
while.body3.lr.ph: ; preds = %entry
%cmp557 = icmp sgt i32 %.pre, 0
%26 = sext i32 %head.promoted to i64
br i1 %cmp557, label %while.body3.us.preheader, label %while.body3.preheader
while.body3.preheader: ; preds = %while.body3.lr.ph
%27 = shl nsw i64 %26, 2
%scevgep = getelementptr i8, ptr @que, i64 %27
%28 = sub i32 %25, %head.promoted
%29 = zext i32 %28 to i64
%30 = shl nuw nsw i64 %29, 2
%31 = add nuw nsw i64 %30, 4
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i8 -1, i64 %31, i1 false), !tbaa !5
%32 = add i32 %25, 1
br label %while.cond2.for.cond22.preheader_crit_edge
while.body3.us.preheader: ; preds = %while.body3.lr.ph
%wide.trip.count = zext i32 %.pre to i64
br label %while.body3.us
while.body3.us: ; preds = %while.body3.us.preheader, %for.cond.while.cond2.loopexit_crit_edge.us
%indvars.iv80 = phi i64 [ %26, %while.body3.us.preheader ], [ %indvars.iv.next81, %for.cond.while.cond2.loopexit_crit_edge.us ]
%tail.promoted6567.us = phi i32 [ %inc.i, %while.body3.us.preheader ], [ %tail.promoted63.us, %for.cond.while.cond2.loopexit_crit_edge.us ]
%arrayidx.i49.us = getelementptr inbounds [100 x i32], ptr @que, i64 0, i64 %indvars.iv80
%33 = load i32, ptr %arrayidx.i49.us, align 4, !tbaa !5
store i32 -1, ptr %arrayidx.i49.us, align 4, !tbaa !5
%idxprom6.us = sext i32 %33 to i64
%arrayidx17.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom6.us
br label %for.body.us
for.body.us: ; preds = %while.body3.us, %for.inc.us
%indvars.iv76 = phi i64 [ 0, %while.body3.us ], [ %indvars.iv.next77, %for.inc.us ]
%tail.promoted64.us = phi i32 [ %tail.promoted6567.us, %while.body3.us ], [ %tail.promoted63.us, %for.inc.us ]
%inc.i515658.us = phi i32 [ %tail.promoted6567.us, %while.body3.us ], [ %inc.i5155.us, %for.inc.us ]
%arrayidx9.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom6.us, i64 %indvars.iv76
%34 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%cmp10.us = icmp eq i32 %34, 0
br i1 %cmp10.us, label %for.inc.us, label %if.end.us
if.end.us: ; preds = %for.body.us
%arrayidx12.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv76
%35 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5
%cmp13.not.us = icmp eq i32 %35, %0
br i1 %cmp13.not.us, label %if.end15.us, label %for.inc.us
if.end15.us: ; preds = %if.end.us
%36 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5
%add.us = add nsw i32 %36, 1
store i32 %add.us, ptr %arrayidx12.us, align 4, !tbaa !5
%inc.i51.us = add nsw i32 %inc.i515658.us, 1
store i32 %inc.i51.us, ptr @tail, align 4, !tbaa !5
%idxprom.i52.us = sext i32 %inc.i515658.us to i64
%arrayidx.i53.us = getelementptr inbounds [100 x i32], ptr @que, i64 0, i64 %idxprom.i52.us
%37 = trunc i64 %indvars.iv76 to i32
store i32 %37, ptr %arrayidx.i53.us, align 4, !tbaa !5
br label %for.inc.us
for.inc.us: ; preds = %if.end15.us, %if.end.us, %for.body.us
%tail.promoted63.us = phi i32 [ %tail.promoted64.us, %if.end.us ], [ %tail.promoted64.us, %for.body.us ], [ %inc.i51.us, %if.end15.us ]
%inc.i5155.us = phi i32 [ %inc.i515658.us, %if.end.us ], [ %inc.i515658.us, %for.body.us ], [ %inc.i51.us, %if.end15.us ]
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%exitcond79.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count
br i1 %exitcond79.not, label %for.cond.while.cond2.loopexit_crit_edge.us, label %for.body.us, !llvm.loop !12
for.cond.while.cond2.loopexit_crit_edge.us: ; preds = %for.inc.us
%indvars.iv.next81 = add i64 %indvars.iv80, 1
%38 = trunc i64 %indvars.iv.next81 to i32
%cmp.i.not.us = icmp eq i32 %tail.promoted63.us, %38
br i1 %cmp.i.not.us, label %while.cond2.for.cond22.preheader_crit_edge, label %while.body3.us, !llvm.loop !13
while.cond2.for.cond22.preheader_crit_edge: ; preds = %for.cond.while.cond2.loopexit_crit_edge.us, %while.body3.preheader
%.us-phi = phi i32 [ %32, %while.body3.preheader ], [ %tail.promoted63.us, %for.cond.while.cond2.loopexit_crit_edge.us ]
store i32 %.us-phi, ptr @head, align 4, !tbaa !5
br label %for.cond22.preheader
for.cond22.preheader: ; preds = %while.cond2.for.cond22.preheader_crit_edge, %entry
%cmp2369 = icmp sgt i32 %.pre, 0
br i1 %cmp2369, label %for.body24, label %for.end34
for.body24: ; preds = %for.cond22.preheader, %for.body24
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.body24 ], [ 0, %for.cond22.preheader ]
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%arrayidx27 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv83
%39 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%40 = load i32, ptr @INF, align 4, !tbaa !5
%cmp28 = icmp eq i32 %39, %40
%spec.select = select i1 %cmp28, i32 -1, i32 %39
%41 = trunc i64 %indvars.iv.next84 to i32
%call31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %41, i32 noundef %spec.select)
%42 = load i32, ptr @n, align 4, !tbaa !5
%43 = sext i32 %42 to i64
%cmp23 = icmp slt i64 %indvars.iv.next84, %43
br i1 %cmp23, label %for.body24, label %for.end34, !llvm.loop !14
for.end34: ; preds = %for.body24, %for.cond22.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #6
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %a) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @que, i64 0, i64 %idxprom
store i32 %a, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @isEmpty() local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%1 = load i32, ptr @tail, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @que, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @head, align 4, !tbaa !5
store i32 -1, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { 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 #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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) 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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#include<stdlib.h>
int t = 0;
typedef struct {
int t1;
int t2;
int *v;
int d;
int k;
}DP;
void visit(DP *G, int i){
int j;
for(j=0; j<G[i].k; j++){
if(G[G[i].v[j]-1].d > G[i].d || G[G[i].v[j]-1].d == -1){
G[G[i].v[j]-1].d = 1 + G[i].d;
visit(G, G[i].v[j]-1);
}
}
return;
}
int main(){
int n, i, j, u, k, l[100];
DP *G;
scanf("%d", &n);
G = (DP *)malloc(sizeof(DP)*n);
for(i=0; i<n; i++){
scanf("%d%d", &u, &k);
G[u-1].v = (int *)malloc(sizeof(int)*(k+1));
G[u-1].k = k;
G[u-1].d = -1;
for(j=0; j<k; j++){
scanf("%d", &G[u-1].v[j]);
}
}
G[0].d = 0;
visit(G, 0);
for(i=0; i<n; i++){
printf("%d %d\n", i+1, G[i].d);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327666/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327666/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.DP = type { i32, i32, ptr, i32, i32 }
@t = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @visit(ptr nocapture noundef %G, i32 noundef %i) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %i to i64
%k = getelementptr inbounds %struct.DP, ptr %G, i64 %idxprom, i32 4
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp60 = icmp sgt i32 %0, 0
br i1 %cmp60, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%v = getelementptr inbounds %struct.DP, ptr %G, i64 %idxprom, i32 2
%d9 = getelementptr inbounds %struct.DP, ptr %G, i64 %idxprom, i32 3
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%1 = phi i32 [ %0, %for.body.lr.ph ], [ %7, %for.inc ]
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%2 = load ptr, ptr %v, align 8, !tbaa !11
%arrayidx4 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv
%3 = load i32, ptr %arrayidx4, align 4, !tbaa !12
%sub = add nsw i32 %3, -1
%idxprom5 = sext i32 %sub to i64
%d = getelementptr inbounds %struct.DP, ptr %G, i64 %idxprom5, i32 3
%4 = load i32, ptr %d, align 8, !tbaa !13
%5 = load i32, ptr %d9, align 8, !tbaa !13
%cmp10 = icmp sgt i32 %4, %5
%cmp20 = icmp eq i32 %4, -1
%or.cond = or i1 %cmp20, %cmp10
br i1 %or.cond, label %if.then, label %for.inc
if.then: ; preds = %for.body
%add = add nsw i32 %5, 1
store i32 %add, ptr %d, align 8, !tbaa !13
%6 = load i32, ptr %arrayidx4, align 4, !tbaa !12
%sub38 = add nsw i32 %6, -1
tail call void @visit(ptr noundef nonnull %G, i32 noundef %sub38)
%.pre = load i32, ptr %k, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%7 = phi i32 [ %1, %for.body ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %for.inc, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%u = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !12
%conv = sext i32 %0 to i64
%mul = mul nsw i64 %conv, 24
%call1 = call noalias ptr @malloc(i64 noundef %mul) #6
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body, label %for.end27.thread
for.end27.thread: ; preds = %entry
%d2966 = getelementptr inbounds %struct.DP, ptr %call1, i64 0, i32 3
store i32 0, ptr %d2966, align 8, !tbaa !13
call void @visit(ptr noundef %call1, i32 noundef 0)
br label %for.end41
for.body: ; preds = %entry, %for.inc25
%i.058 = phi i32 [ %inc26, %for.inc25 ], [ 0, %entry ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !12
%add = add nsw i32 %1, 1
%conv4 = sext i32 %add to i64
%mul5 = shl nsw i64 %conv4, 2
%call6 = call noalias ptr @malloc(i64 noundef %mul5) #6
%2 = load i32, ptr %u, align 4, !tbaa !12
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%v = getelementptr inbounds %struct.DP, ptr %call1, i64 %idxprom, i32 2
store ptr %call6, ptr %v, align 8, !tbaa !11
%k10 = getelementptr inbounds %struct.DP, ptr %call1, i64 %idxprom, i32 4
store i32 %1, ptr %k10, align 4, !tbaa !5
%d = getelementptr inbounds %struct.DP, ptr %call1, i64 %idxprom, i32 3
store i32 -1, ptr %d, align 8, !tbaa !13
%cmp1555 = icmp sgt i32 %1, 0
br i1 %cmp1555, label %for.body17, label %for.inc25
for.body17: ; preds = %for.body, %for.body17
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body17 ], [ 0, %for.body ]
%3 = load i32, ptr %u, align 4, !tbaa !12
%sub18 = add nsw i32 %3, -1
%idxprom19 = sext i32 %sub18 to i64
%v21 = getelementptr inbounds %struct.DP, ptr %call1, i64 %idxprom19, i32 2
%4 = load ptr, ptr %v21, align 8, !tbaa !11
%arrayidx23 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv
%call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx23)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %k, align 4, !tbaa !12
%6 = sext i32 %5 to i64
%cmp15 = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp15, label %for.body17, label %for.inc25, !llvm.loop !16
for.inc25: ; preds = %for.body17, %for.body
%inc26 = add nuw nsw i32 %i.058, 1
%7 = load i32, ptr %n, align 4, !tbaa !12
%cmp = icmp slt i32 %inc26, %7
br i1 %cmp, label %for.body, label %for.end27, !llvm.loop !17
for.end27: ; preds = %for.inc25
%8 = icmp sgt i32 %7, 0
%d29 = getelementptr inbounds %struct.DP, ptr %call1, i64 0, i32 3
store i32 0, ptr %d29, align 8, !tbaa !13
call void @visit(ptr noundef nonnull %call1, i32 noundef 0)
br i1 %8, label %for.body33, label %for.end41
for.body33: ; preds = %for.end27, %for.body33
%indvars.iv62 = phi i64 [ %indvars.iv.next63, %for.body33 ], [ 0, %for.end27 ]
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%d37 = getelementptr inbounds %struct.DP, ptr %call1, i64 %indvars.iv62, i32 3
%9 = load i32, ptr %d37, align 8, !tbaa !13
%10 = trunc i64 %indvars.iv.next63 to i32
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10, i32 noundef %9)
%11 = load i32, ptr %n, align 4, !tbaa !12
%12 = sext i32 %11 to i64
%cmp31 = icmp slt i64 %indvars.iv.next63, %12
br i1 %cmp31, label %for.body33, label %for.end41, !llvm.loop !18
for.end41: ; preds = %for.body33, %for.end27.thread, %for.end27
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; 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
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) 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 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 #3 = { 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 #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 = { nounwind }
attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 20}
!6 = !{!"", !7, i64 0, !7, i64 4, !10, i64 8, !7, i64 16, !7, i64 20}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!7, !7, i64 0}
!13 = !{!6, !7, i64 16}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}
|
#include<stdio.h>
int main(){
int n;
scanf("%d",&n);
int divisors=0;
while(1){
divisors=0;
for(int i=2;i*i<=n;i++){
if(n%i==0){
divisors+=1;
}
}
if(divisors==0){
printf("%d",n);
return 0;
}
n++;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327767/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327767/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%n.promoted = load i32, ptr %n, align 4, !tbaa !5
%cmp.not1118 = icmp slt i32 %n.promoted, 4
br i1 %cmp.not1118, label %if.then3, label %for.body.preheader
for.body.preheader: ; preds = %entry, %if.end5
%inc61519 = phi i32 [ %inc6, %if.end5 ], [ %n.promoted, %entry ]
br label %for.body
for.cond.cleanup: ; preds = %for.body
%cmp2 = icmp eq i32 %spec.select, 0
br i1 %cmp2, label %if.then3, label %if.end5
for.body: ; preds = %for.body.preheader, %for.body
%i.013 = phi i32 [ %inc, %for.body ], [ 2, %for.body.preheader ]
%divisors.012 = phi i32 [ %spec.select, %for.body ], [ 0, %for.body.preheader ]
%rem = srem i32 %inc61519, %i.013
%cmp1 = icmp eq i32 %rem, 0
%add = zext i1 %cmp1 to i32
%spec.select = add nuw nsw i32 %divisors.012, %add
%inc = add nuw nsw i32 %i.013, 1
%mul = mul nsw i32 %inc, %inc
%cmp.not = icmp sgt i32 %mul, %inc61519
br i1 %cmp.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
if.then3: ; preds = %for.cond.cleanup, %if.end5, %entry
%inc615.lcssa = phi i32 [ %n.promoted, %entry ], [ %inc61519, %for.cond.cleanup ], [ %inc6, %if.end5 ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %inc615.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
if.end5: ; preds = %for.cond.cleanup
%inc6 = add nsw i32 %inc61519, 1
store i32 %inc6, ptr %n, align 4, !tbaa !5
%cmp.not11 = icmp slt i32 %inc61519, 3
br i1 %cmp.not11, label %if.then3, label %for.body.preheader
}
; 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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int cad[100], n, h, m, l, r, x, c=0;
int main(){
scanf("%d %d %d", &n, &h, &m);
for(int i=0;i<n; i++){
cad[i]=h;
}
for(int i=0; i<m; i++){
scanf("%d %d %d", &l, &r, &x);
for(int j=l-1;j<=r-1;j++){
if(cad[j]>x)
cad[j]=x;
}
}
for(int i=0;i<n; i++){
c=c+(cad[i]*cad[i]);
}
printf("%d", c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_32781/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_32781/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@c = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@n = dso_local global i32 0, align 4
@h = dso_local global i32 0, align 4
@m = dso_local global i32 0, align 4
@cad = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@l = dso_local global i32 0, align 4
@r = dso_local global i32 0, align 4
@x = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @h, ptr noundef nonnull @m)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp45 = icmp sgt i32 %0, 0
br i1 %cmp45, label %for.body.lr.ph, label %for.cond2.preheader
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr @h, align 4, !tbaa !5
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader, label %vector.ph
vector.ph: ; preds = %for.body.lr.ph
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %1, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%2 = getelementptr inbounds [100 x i32], ptr @cad, i64 0, i64 %index
store <4 x i32> %broadcast.splat, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> %broadcast.splat, ptr %3, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond2.preheader, label %for.body.preheader
for.body.preheader: ; preds = %for.body.lr.ph, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.lr.ph ], [ %n.vec, %middle.block ]
br label %for.body
for.cond2.preheader: ; preds = %for.body, %middle.block, %entry
%5 = load i32, ptr @m, align 4, !tbaa !5
%cmp349 = icmp sgt i32 %5, 0
br i1 %cmp349, label %for.body5, label %for.cond24.preheader
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader ]
%arrayidx = getelementptr inbounds [100 x i32], ptr @cad, i64 0, i64 %indvars.iv
store i32 %1, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.preheader, label %for.body, !llvm.loop !13
for.cond24.preheader.loopexit: ; preds = %for.cond.cleanup10
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.cond24.preheader
for.cond24.preheader: ; preds = %for.cond24.preheader.loopexit, %for.cond2.preheader
%6 = phi i32 [ %.pre, %for.cond24.preheader.loopexit ], [ %0, %for.cond2.preheader ]
%c.promoted = load i32, ptr @c, align 4, !tbaa !5
%cmp2552 = icmp sgt i32 %6, 0
br i1 %cmp2552, label %for.body27.preheader, label %for.cond.cleanup26
for.body27.preheader: ; preds = %for.cond24.preheader
%wide.trip.count63 = zext i32 %6 to i64
%min.iters.check95 = icmp ult i32 %6, 8
br i1 %min.iters.check95, label %for.body27.preheader107, label %vector.ph96
vector.ph96: ; preds = %for.body27.preheader
%n.vec98 = and i64 %wide.trip.count63, 4294967288
%7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %c.promoted, i64 0
br label %vector.body101
vector.body101: ; preds = %vector.body101, %vector.ph96
%index102 = phi i64 [ 0, %vector.ph96 ], [ %index.next106, %vector.body101 ]
%vec.phi = phi <4 x i32> [ %7, %vector.ph96 ], [ %12, %vector.body101 ]
%vec.phi103 = phi <4 x i32> [ zeroinitializer, %vector.ph96 ], [ %13, %vector.body101 ]
%8 = getelementptr inbounds [100 x i32], ptr @cad, i64 0, i64 %index102
%wide.load104 = load <4 x i32>, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load105 = load <4 x i32>, ptr %9, align 16, !tbaa !5
%10 = mul nsw <4 x i32> %wide.load104, %wide.load104
%11 = mul nsw <4 x i32> %wide.load105, %wide.load105
%12 = add <4 x i32> %10, %vec.phi
%13 = add <4 x i32> %11, %vec.phi103
%index.next106 = add nuw i64 %index102, 8
%14 = icmp eq i64 %index.next106, %n.vec98
br i1 %14, label %middle.block93, label %vector.body101, !llvm.loop !14
middle.block93: ; preds = %vector.body101
%bin.rdx = add <4 x i32> %13, %12
%15 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n100 = icmp eq i64 %n.vec98, %wide.trip.count63
br i1 %cmp.n100, label %for.cond24.for.cond.cleanup26_crit_edge, label %for.body27.preheader107
for.body27.preheader107: ; preds = %for.body27.preheader, %middle.block93
%indvars.iv60.ph = phi i64 [ 0, %for.body27.preheader ], [ %n.vec98, %middle.block93 ]
%add5153.ph = phi i32 [ %c.promoted, %for.body27.preheader ], [ %15, %middle.block93 ]
br label %for.body27
for.body5: ; preds = %for.cond2.preheader, %for.cond.cleanup10
%i1.050 = phi i32 [ %inc21, %for.cond.cleanup10 ], [ 0, %for.cond2.preheader ]
%call6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @l, ptr noundef nonnull @r, ptr noundef nonnull @x)
%16 = load i32, ptr @l, align 4, !tbaa !5
%17 = load i32, ptr @r, align 4, !tbaa !5
%cmp9.not.not47.not = icmp sgt i32 %16, %17
br i1 %cmp9.not.not47.not, label %for.cond.cleanup10, label %for.body11.lr.ph
for.body11.lr.ph: ; preds = %for.body5
%sub = add i32 %16, -1
%18 = load i32, ptr @x, align 4, !tbaa !5
%19 = sext i32 %sub to i64
%20 = sub i32 %17, %16
%21 = zext i32 %20 to i64
%22 = add nuw nsw i64 %21, 1
%min.iters.check67 = icmp ult i32 %20, 7
br i1 %min.iters.check67, label %for.body11.preheader, label %vector.ph68
vector.ph68: ; preds = %for.body11.lr.ph
%n.vec70 = and i64 %22, 8589934584
%ind.end = add nsw i64 %n.vec70, %19
%broadcast.splatinsert76 = insertelement <4 x i32> poison, i32 %18, i64 0
%broadcast.splat77 = shufflevector <4 x i32> %broadcast.splatinsert76, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body73
vector.body73: ; preds = %pred.store.continue91, %vector.ph68
%index74 = phi i64 [ 0, %vector.ph68 ], [ %index.next92, %pred.store.continue91 ]
%offset.idx = add i64 %index74, %19
%23 = add i64 %offset.idx, 4
%24 = getelementptr inbounds [100 x i32], ptr @cad, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %24, align 4, !tbaa !5
%25 = getelementptr inbounds i32, ptr %24, i64 4
%wide.load75 = load <4 x i32>, ptr %25, align 4, !tbaa !5
%26 = icmp sgt <4 x i32> %wide.load, %broadcast.splat77
%27 = icmp sgt <4 x i32> %wide.load75, %broadcast.splat77
%28 = extractelement <4 x i1> %26, i64 0
br i1 %28, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body73
%29 = getelementptr inbounds [100 x i32], ptr @cad, i64 0, i64 %offset.idx
store i32 %18, ptr %29, align 4, !tbaa !5
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body73
%30 = extractelement <4 x i1> %26, i64 1
br i1 %30, label %pred.store.if78, label %pred.store.continue79
pred.store.if78: ; preds = %pred.store.continue
%31 = add i64 %offset.idx, 1
%32 = getelementptr inbounds [100 x i32], ptr @cad, i64 0, i64 %31
store i32 %18, ptr %32, align 4, !tbaa !5
br label %pred.store.continue79
pred.store.continue79: ; preds = %pred.store.if78, %pred.store.continue
%33 = extractelement <4 x i1> %26, i64 2
br i1 %33, label %pred.store.if80, label %pred.store.continue81
pred.store.if80: ; preds = %pred.store.continue79
%34 = add i64 %offset.idx, 2
%35 = getelementptr inbounds [100 x i32], ptr @cad, i64 0, i64 %34
store i32 %18, ptr %35, align 4, !tbaa !5
br label %pred.store.continue81
pred.store.continue81: ; preds = %pred.store.if80, %pred.store.continue79
%36 = extractelement <4 x i1> %26, i64 3
br i1 %36, label %pred.store.if82, label %pred.store.continue83
pred.store.if82: ; preds = %pred.store.continue81
%37 = add i64 %offset.idx, 3
%38 = getelementptr inbounds [100 x i32], ptr @cad, i64 0, i64 %37
store i32 %18, ptr %38, align 4, !tbaa !5
br label %pred.store.continue83
pred.store.continue83: ; preds = %pred.store.if82, %pred.store.continue81
%39 = extractelement <4 x i1> %27, i64 0
br i1 %39, label %pred.store.if84, label %pred.store.continue85
pred.store.if84: ; preds = %pred.store.continue83
%40 = getelementptr inbounds [100 x i32], ptr @cad, i64 0, i64 %23
store i32 %18, ptr %40, align 4, !tbaa !5
br label %pred.store.continue85
pred.store.continue85: ; preds = %pred.store.if84, %pred.store.continue83
%41 = extractelement <4 x i1> %27, i64 1
br i1 %41, label %pred.store.if86, label %pred.store.continue87
pred.store.if86: ; preds = %pred.store.continue85
%42 = add i64 %offset.idx, 5
%43 = getelementptr inbounds [100 x i32], ptr @cad, i64 0, i64 %42
store i32 %18, ptr %43, align 4, !tbaa !5
br label %pred.store.continue87
pred.store.continue87: ; preds = %pred.store.if86, %pred.store.continue85
%44 = extractelement <4 x i1> %27, i64 2
br i1 %44, label %pred.store.if88, label %pred.store.continue89
pred.store.if88: ; preds = %pred.store.continue87
%45 = add i64 %offset.idx, 6
%46 = getelementptr inbounds [100 x i32], ptr @cad, i64 0, i64 %45
store i32 %18, ptr %46, align 4, !tbaa !5
br label %pred.store.continue89
pred.store.continue89: ; preds = %pred.store.if88, %pred.store.continue87
%47 = extractelement <4 x i1> %27, i64 3
br i1 %47, label %pred.store.if90, label %pred.store.continue91
pred.store.if90: ; preds = %pred.store.continue89
%48 = add i64 %offset.idx, 7
%49 = getelementptr inbounds [100 x i32], ptr @cad, i64 0, i64 %48
store i32 %18, ptr %49, align 4, !tbaa !5
br label %pred.store.continue91
pred.store.continue91: ; preds = %pred.store.if90, %pred.store.continue89
%index.next92 = add nuw i64 %index74, 8
%50 = icmp eq i64 %index.next92, %n.vec70
br i1 %50, label %middle.block65, label %vector.body73, !llvm.loop !15
middle.block65: ; preds = %pred.store.continue91
%cmp.n72 = icmp eq i64 %22, %n.vec70
br i1 %cmp.n72, label %for.cond.cleanup10, label %for.body11.preheader
for.body11.preheader: ; preds = %for.body11.lr.ph, %middle.block65
%indvars.iv56.ph = phi i64 [ %19, %for.body11.lr.ph ], [ %ind.end, %middle.block65 ]
br label %for.body11
for.cond.cleanup10: ; preds = %for.inc17, %middle.block65, %for.body5
%inc21 = add nuw nsw i32 %i1.050, 1
%51 = load i32, ptr @m, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc21, %51
br i1 %cmp3, label %for.body5, label %for.cond24.preheader.loopexit, !llvm.loop !16
for.body11: ; preds = %for.body11.preheader, %for.inc17
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.inc17 ], [ %indvars.iv56.ph, %for.body11.preheader ]
%arrayidx13 = getelementptr inbounds [100 x i32], ptr @cad, i64 0, i64 %indvars.iv56
%52 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp14 = icmp sgt i32 %52, %18
br i1 %cmp14, label %if.then, label %for.inc17
if.then: ; preds = %for.body11
store i32 %18, ptr %arrayidx13, align 4, !tbaa !5
br label %for.inc17
for.inc17: ; preds = %for.body11, %if.then
%indvars.iv.next57 = add nsw i64 %indvars.iv56, 1
%lftr.wideiv = trunc i64 %indvars.iv.next57 to i32
%exitcond59.not = icmp eq i32 %17, %lftr.wideiv
br i1 %exitcond59.not, label %for.cond.cleanup10, label %for.body11, !llvm.loop !17
for.cond24.for.cond.cleanup26_crit_edge: ; preds = %for.body27, %middle.block93
%add.lcssa = phi i32 [ %15, %middle.block93 ], [ %add, %for.body27 ]
store i32 %add.lcssa, ptr @c, align 4, !tbaa !5
br label %for.cond.cleanup26
for.cond.cleanup26: ; preds = %for.cond24.for.cond.cleanup26_crit_edge, %for.cond24.preheader
%53 = phi i32 [ %add.lcssa, %for.cond24.for.cond.cleanup26_crit_edge ], [ %c.promoted, %for.cond24.preheader ]
%call35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %53)
ret i32 0
for.body27: ; preds = %for.body27.preheader107, %for.body27
%indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.body27 ], [ %indvars.iv60.ph, %for.body27.preheader107 ]
%add5153 = phi i32 [ %add, %for.body27 ], [ %add5153.ph, %for.body27.preheader107 ]
%arrayidx29 = getelementptr inbounds [100 x i32], ptr @cad, i64 0, i64 %indvars.iv60
%54 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%mul = mul nsw i32 %54, %54
%add = add nsw i32 %mul, %add5153
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
%exitcond64.not = icmp eq i64 %indvars.iv.next61, %wide.trip.count63
br i1 %exitcond64.not, label %for.cond24.for.cond.cleanup26_crit_edge, label %for.body27, !llvm.loop !18
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #2
attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !12, !11}
!18 = distinct !{!18, !10, !12, !11}
|
#include<stdio.h>
#include<stdlib.h>
int main()
{
int j,n,i,c=0;
scanf("%d",&n);
for(i=n;i>=n;i++)
{
c=0;
for(j=2;j<i;j++)
{
if(i%j==0)
c++;
}
if(c==0)
{
printf("%d",i);
exit(0);
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327853/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327853/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = add i32 %0, -2
%2 = add i32 %0, -3
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc10
%indvar = phi i32 [ 0, %entry ], [ %indvar.next, %for.inc10 ]
%i.024 = phi i32 [ %0, %entry ], [ %inc11, %for.inc10 ]
%3 = add i32 %1, %indvar
%cmp221 = icmp sgt i32 %i.024, 2
br i1 %cmp221, label %for.body3.preheader, label %if.then7
for.body3.preheader: ; preds = %for.cond1.preheader
%xtraiter = and i32 %3, 1
%4 = sub i32 0, %indvar
%5 = icmp eq i32 %2, %4
br i1 %5, label %for.end.unr-lcssa, label %for.body3.preheader.new
for.body3.preheader.new: ; preds = %for.body3.preheader
%unroll_iter = and i32 %3, -2
br label %for.body3
for.body3: ; preds = %for.body3, %for.body3.preheader.new
%c.023 = phi i32 [ 0, %for.body3.preheader.new ], [ %spec.select.1, %for.body3 ]
%j.022 = phi i32 [ 2, %for.body3.preheader.new ], [ %inc5.1, %for.body3 ]
%niter = phi i32 [ 0, %for.body3.preheader.new ], [ %niter.next.1, %for.body3 ]
%rem = srem i32 %i.024, %j.022
%cmp4 = icmp eq i32 %rem, 0
%inc = zext i1 %cmp4 to i32
%spec.select = add nuw nsw i32 %c.023, %inc
%inc5 = or i32 %j.022, 1
%rem.1 = srem i32 %i.024, %inc5
%cmp4.1 = icmp eq i32 %rem.1, 0
%inc.1 = zext i1 %cmp4.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc.1
%inc5.1 = add nuw nsw i32 %j.022, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.unr-lcssa, label %for.body3, !llvm.loop !9
for.end.unr-lcssa: ; preds = %for.body3, %for.body3.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body3.preheader ], [ %spec.select.1, %for.body3 ]
%c.023.unr = phi i32 [ 0, %for.body3.preheader ], [ %spec.select.1, %for.body3 ]
%j.022.unr = phi i32 [ 2, %for.body3.preheader ], [ %inc5.1, %for.body3 ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body3.epil
for.body3.epil: ; preds = %for.end.unr-lcssa
%rem.epil = srem i32 %i.024, %j.022.unr
%cmp4.epil = icmp eq i32 %rem.epil, 0
%inc.epil = zext i1 %cmp4.epil to i32
%spec.select.epil = add nuw nsw i32 %c.023.unr, %inc.epil
br label %for.end
for.end: ; preds = %for.end.unr-lcssa, %for.body3.epil
%spec.select.lcssa = phi i32 [ %spec.select.lcssa.ph, %for.end.unr-lcssa ], [ %spec.select.epil, %for.body3.epil ]
%cmp6 = icmp eq i32 %spec.select.lcssa, 0
br i1 %cmp6, label %if.then7, label %for.inc10
if.then7: ; preds = %for.cond1.preheader, %for.end
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i.024)
call void @exit(i32 noundef 0) #5
unreachable
for.inc10: ; preds = %for.end
%inc11 = add nsw i32 %i.024, 1
%cmp.not = icmp slt i32 %inc11, %0
%indvar.next = add i32 %indvar, 1
br i1 %cmp.not, label %for.end12, label %for.cond1.preheader, !llvm.loop !11
for.end12: ; preds = %for.inc10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3
; 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 = { noreturn 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 }
attributes #5 = { noreturn 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
static int primeTbl[] = {2,3,5,7,11,13,17,19,23,29};
#define PTBL_SIZE (sizeof(primeTbl)/sizeof(primeTbl[0]))
int main(void)
{
int x;
int i;
int end = 0;
scanf("%d", &x);
while(end == 0)
{
for(i=0; i<PTBL_SIZE; i++)
{
if(x==primeTbl[i])
{
end = 1;
break;
}
if(!(x%primeTbl[i]))
{
x++;
break;
}
}
if(i == PTBL_SIZE){
// 29の次の素数からカウントアップして割り切れるかチェックする
for(i=31; i < x; i++)
{
if(!(x%i))
{
x++;
break;
}
}
if(i == x)
{
end = 1;
}
}
}
printf("%d\n",x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327897/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327897/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%x.promoted = load i32, ptr %x, align 4, !tbaa !5
br label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %if.end30
%0 = phi i32 [ %x.promoted, %entry ], [ %5, %if.end30 ]
%1 = phi i32 [ %x.promoted, %entry ], [ %6, %if.end30 ]
%cmp3 = icmp eq i32 %1, 2
br i1 %cmp3, label %while.end, label %if.end
if.end: ; preds = %for.cond.preheader
%2 = and i32 %1, 1
%tobool.not = icmp eq i32 %2, 0
br i1 %tobool.not, label %if.then7, label %for.inc
if.then7: ; preds = %if.end.9, %if.end.8, %if.end.7, %if.end.6, %if.end.5, %if.end.4, %if.end.3, %if.end.2, %if.end.1, %if.end
%inc = add nsw i32 %1, 1
store i32 %inc, ptr %x, align 4, !tbaa !5
br label %if.end30
for.inc: ; preds = %if.end
%cmp3.1 = icmp eq i32 %1, 3
br i1 %cmp3.1, label %while.end, label %if.end.1
if.end.1: ; preds = %for.inc
%rem.1 = srem i32 %1, 3
%tobool.not.1 = icmp eq i32 %rem.1, 0
br i1 %tobool.not.1, label %if.then7, label %for.inc.1
for.inc.1: ; preds = %if.end.1
%cmp3.2 = icmp eq i32 %1, 5
br i1 %cmp3.2, label %while.end, label %if.end.2
if.end.2: ; preds = %for.inc.1
%rem.2 = srem i32 %1, 5
%tobool.not.2 = icmp eq i32 %rem.2, 0
br i1 %tobool.not.2, label %if.then7, label %for.inc.2
for.inc.2: ; preds = %if.end.2
%cmp3.3 = icmp eq i32 %1, 7
br i1 %cmp3.3, label %while.end, label %if.end.3
if.end.3: ; preds = %for.inc.2
%rem.3 = srem i32 %1, 7
%tobool.not.3 = icmp eq i32 %rem.3, 0
br i1 %tobool.not.3, label %if.then7, label %for.inc.3
for.inc.3: ; preds = %if.end.3
%cmp3.4 = icmp eq i32 %1, 11
br i1 %cmp3.4, label %while.end, label %if.end.4
if.end.4: ; preds = %for.inc.3
%rem.4 = srem i32 %1, 11
%tobool.not.4 = icmp eq i32 %rem.4, 0
br i1 %tobool.not.4, label %if.then7, label %for.inc.4
for.inc.4: ; preds = %if.end.4
%cmp3.5 = icmp eq i32 %1, 13
br i1 %cmp3.5, label %while.end, label %if.end.5
if.end.5: ; preds = %for.inc.4
%rem.5 = srem i32 %1, 13
%tobool.not.5 = icmp eq i32 %rem.5, 0
br i1 %tobool.not.5, label %if.then7, label %for.inc.5
for.inc.5: ; preds = %if.end.5
%cmp3.6 = icmp eq i32 %1, 17
br i1 %cmp3.6, label %while.end, label %if.end.6
if.end.6: ; preds = %for.inc.5
%rem.6 = srem i32 %1, 17
%tobool.not.6 = icmp eq i32 %rem.6, 0
br i1 %tobool.not.6, label %if.then7, label %for.inc.6
for.inc.6: ; preds = %if.end.6
%cmp3.7 = icmp eq i32 %1, 19
br i1 %cmp3.7, label %while.end, label %if.end.7
if.end.7: ; preds = %for.inc.6
%rem.7 = srem i32 %1, 19
%tobool.not.7 = icmp eq i32 %rem.7, 0
br i1 %tobool.not.7, label %if.then7, label %for.inc.7
for.inc.7: ; preds = %if.end.7
%cmp3.8 = icmp eq i32 %1, 23
br i1 %cmp3.8, label %while.end, label %if.end.8
if.end.8: ; preds = %for.inc.7
%rem.8 = srem i32 %1, 23
%tobool.not.8 = icmp eq i32 %rem.8, 0
br i1 %tobool.not.8, label %if.then7, label %for.inc.8
for.inc.8: ; preds = %if.end.8
%cmp3.9 = icmp eq i32 %1, 29
br i1 %cmp3.9, label %while.end, label %if.end.9
if.end.9: ; preds = %for.inc.8
%rem.9 = srem i32 %1, 29
%tobool.not.9 = icmp eq i32 %rem.9, 0
br i1 %tobool.not.9, label %if.then7, label %for.cond14.preheader
for.cond14.preheader: ; preds = %if.end.9
%cmp1551 = icmp sgt i32 %1, 31
br i1 %cmp1551, label %for.body17, label %for.end25
for.body17: ; preds = %for.cond14.preheader, %for.inc23
%i.152 = phi i32 [ %inc24, %for.inc23 ], [ 31, %for.cond14.preheader ]
%rem18 = srem i32 %1, %i.152
%tobool19.not = icmp eq i32 %rem18, 0
br i1 %tobool19.not, label %if.then20, label %for.inc23
if.then20: ; preds = %for.body17
%inc21 = add nuw nsw i32 %1, 1
store i32 %inc21, ptr %x, align 4, !tbaa !5
br label %for.end25
for.inc23: ; preds = %for.body17
%inc24 = add nuw nsw i32 %i.152, 1
%exitcond.not = icmp eq i32 %inc24, %1
br i1 %exitcond.not, label %for.end25, label %for.body17, !llvm.loop !9
for.end25: ; preds = %for.inc23, %for.cond14.preheader, %if.then20
%3 = phi i32 [ %inc21, %if.then20 ], [ %0, %for.cond14.preheader ], [ %0, %for.inc23 ]
%4 = phi i32 [ %inc21, %if.then20 ], [ %1, %for.cond14.preheader ], [ %1, %for.inc23 ]
%i.149 = phi i32 [ %i.152, %if.then20 ], [ 31, %for.cond14.preheader ], [ %1, %for.inc23 ]
%cmp26 = icmp eq i32 %i.149, %4
%spec.select = zext i1 %cmp26 to i32
br label %if.end30
if.end30: ; preds = %if.then7, %for.end25
%5 = phi i32 [ %3, %for.end25 ], [ %inc, %if.then7 ]
%6 = phi i32 [ %4, %for.end25 ], [ %inc, %if.then7 ]
%end.2 = phi i32 [ %spec.select, %for.end25 ], [ 0, %if.then7 ]
%cmp = icmp eq i32 %end.2, 0
br i1 %cmp, label %for.cond.preheader, label %while.end, !llvm.loop !11
while.end: ; preds = %for.cond.preheader, %for.inc, %for.inc.1, %for.inc.2, %for.inc.3, %for.inc.4, %for.inc.5, %for.inc.6, %for.inc.7, %for.inc.8, %if.end30
%7 = phi i32 [ %5, %if.end30 ], [ %0, %for.inc.8 ], [ %0, %for.inc.7 ], [ %0, %for.inc.6 ], [ %0, %for.inc.5 ], [ %0, %for.inc.4 ], [ %0, %for.inc.3 ], [ %0, %for.inc.2 ], [ %0, %for.inc.1 ], [ %0, %for.inc ], [ %0, %for.cond.preheader ]
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main()
{
int i, j;
int x;
scanf("%d", &x);
int flag;
int cnt = 0;
for (i = 2; i <= 1000000; ++i) {
flag = 0;
for (j = 2; j < i; ++j) {
if (i % j == 0) {
flag = 1;
break;
}
}
if (flag==0&&x == i) {
printf("%d\n", x);
return 0;
}
else if (flag==0&&x < i) {
printf("%d\n", i);
return 0;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_327954/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_327954/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc16
%i.037 = phi i32 [ 2, %entry ], [ %inc17, %for.inc16 ]
%cmp2.not35 = icmp ugt i32 %i.037, 2
br i1 %cmp2.not35, label %for.body3, label %land.lhs.true
for.cond1: ; preds = %for.body3
%inc = add nuw nsw i32 %j.036, 1
%exitcond.not = icmp eq i32 %inc, %i.037
br i1 %exitcond.not, label %land.lhs.true, label %for.body3, !llvm.loop !5
for.body3: ; preds = %for.cond1.preheader, %for.cond1
%j.036 = phi i32 [ %inc, %for.cond1 ], [ 2, %for.cond1.preheader ]
%rem = urem i32 %i.037, %j.036
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %for.inc16, label %for.cond1
land.lhs.true: ; preds = %for.cond1, %for.cond1.preheader
%cmp6 = icmp eq i32 %0, %i.037
br i1 %cmp6, label %cleanup.sink.split, label %if.else
if.else: ; preds = %land.lhs.true
%cmp11 = icmp slt i32 %0, %i.037
br i1 %cmp11, label %cleanup.sink.split, label %for.inc16
for.inc16: ; preds = %for.body3, %if.else
%inc17 = add nuw nsw i32 %i.037, 1
%exitcond40.not = icmp eq i32 %inc17, 1000001
br i1 %exitcond40.not, label %cleanup, label %for.cond1.preheader, !llvm.loop !7
cleanup.sink.split: ; preds = %if.else, %land.lhs.true
%i.037.lcssa41.sink = phi i32 [ %0, %land.lhs.true ], [ %i.037, %if.else ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.037.lcssa41.sink)
br label %cleanup
cleanup: ; preds = %for.inc16, %cleanup.sink.split
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
|
#include<stdio.h>
int main(){
int n,m,i,c,mi,d[10010];
while(scanf("%d %d",&n,&m),n||m){
for(i=c=mi=0;i<n;i++)scanf("%d",&d[i]);
for(i=1;i<n;i++){
if(m%d[mi]==m%d[i]){
if(d[i]==d[mi])c++;
if(d[i]<d[mi]){
mi=i;
c=0;
}
}
if(m%d[mi]<m%d[i]){
mi=i;
c=0;
}
}
printf("%d\n",c?n:mi+1);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328003/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328003/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%d = alloca [10010 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.start.p0(i64 40040, ptr nonnull %d) #3
%call68 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4
%tobool69 = icmp ne i32 %0, 0
%1 = load i32, ptr %m, align 4
%tobool170 = icmp ne i32 %1, 0
%2 = select i1 %tobool69, i1 true, i1 %tobool170
br i1 %2, label %for.cond.preheader, label %while.end
for.cond.preheader: ; preds = %entry, %10
%3 = phi i32 [ %12, %10 ], [ %0, %entry ]
%cmp60 = icmp sgt i32 %3, 0
br i1 %cmp60, label %for.body, label %for.end38.thread
for.cond3.preheader: ; preds = %for.body
%cmp462 = icmp sgt i32 %5, 1
br i1 %cmp462, label %for.body5.lr.ph, label %for.end38.thread
for.body5.lr.ph: ; preds = %for.cond3.preheader
%4 = load i32, ptr %m, align 4, !tbaa !5
%wide.trip.count = zext i32 %5 to i64
br label %for.body5
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [10010 x i32], ptr %d, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %if.end26
%indvars.iv73 = phi i64 [ 1, %for.body5.lr.ph ], [ %indvars.iv.next74, %if.end26 ]
%mi.065 = phi i32 [ 0, %for.body5.lr.ph ], [ %spec.select57, %if.end26 ]
%c.064 = phi i32 [ 0, %for.body5.lr.ph ], [ %spec.select56.fr, %if.end26 ]
%idxprom6 = sext i32 %mi.065 to i64
%arrayidx7 = getelementptr inbounds [10010 x i32], ptr %d, i64 0, i64 %idxprom6
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%rem = srem i32 %4, %7
%arrayidx9 = getelementptr inbounds [10010 x i32], ptr %d, i64 0, i64 %indvars.iv73
%8 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%rem10 = srem i32 %4, %8
%cmp11 = icmp eq i32 %rem, %rem10
br i1 %cmp11, label %if.then, label %for.body5.if.end26_crit_edge
for.body5.if.end26_crit_edge: ; preds = %for.body5
%.pre78 = trunc i64 %indvars.iv73 to i32
br label %if.end26
if.then: ; preds = %for.body5
%cmp16 = icmp eq i32 %8, %7
%inc18 = zext i1 %cmp16 to i32
%spec.select = add nsw i32 %c.064, %inc18
%cmp23 = icmp slt i32 %8, %7
%spec.select58 = select i1 %cmp23, i32 0, i32 %spec.select
%9 = trunc i64 %indvars.iv73 to i32
%spec.select59 = select i1 %cmp23, i32 %9, i32 %mi.065
%.pre = sext i32 %spec.select59 to i64
%arrayidx28.phi.trans.insert = getelementptr inbounds [10010 x i32], ptr %d, i64 0, i64 %.pre
%.pre76 = load i32, ptr %arrayidx28.phi.trans.insert, align 4, !tbaa !5
%.pre77 = srem i32 %4, %.pre76
br label %if.end26
if.end26: ; preds = %for.body5.if.end26_crit_edge, %if.then
%.pre-phi = phi i32 [ %.pre78, %for.body5.if.end26_crit_edge ], [ %9, %if.then ]
%rem29.pre-phi = phi i32 [ %rem, %for.body5.if.end26_crit_edge ], [ %.pre77, %if.then ]
%c.2 = phi i32 [ %c.064, %for.body5.if.end26_crit_edge ], [ %spec.select58, %if.then ]
%mi.1 = phi i32 [ %mi.065, %for.body5.if.end26_crit_edge ], [ %spec.select59, %if.then ]
%cmp33 = icmp slt i32 %rem29.pre-phi, %rem10
%spec.select56 = select i1 %cmp33, i32 0, i32 %c.2
%spec.select56.fr = freeze i32 %spec.select56
%spec.select57 = select i1 %cmp33, i32 %.pre-phi, i32 %mi.1
%indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
%exitcond.not = icmp eq i64 %indvars.iv.next74, %wide.trip.count
br i1 %exitcond.not, label %for.end38, label %for.body5, !llvm.loop !11
for.end38: ; preds = %if.end26
%tobool39.not = icmp eq i32 %spec.select56.fr, 0
%add = add nsw i32 %spec.select57, 1
br i1 %tobool39.not, label %for.end38.thread, label %10
for.end38.thread: ; preds = %for.cond.preheader, %for.cond3.preheader, %for.end38
%add88 = phi i32 [ %add, %for.end38 ], [ 1, %for.cond3.preheader ], [ 1, %for.cond.preheader ]
br label %10
10: ; preds = %for.end38, %for.end38.thread
%11 = phi i32 [ %add88, %for.end38.thread ], [ %5, %for.end38 ]
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%12 = load i32, ptr %n, align 4
%tobool = icmp ne i32 %12, 0
%13 = load i32, ptr %m, align 4
%tobool1 = icmp ne i32 %13, 0
%14 = select i1 %tobool, i1 true, i1 %tobool1
br i1 %14, label %for.cond.preheader, label %while.end, !llvm.loop !12
while.end: ; preds = %10, %entry
call void @llvm.lifetime.end.p0(i64 40040, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#define limit 100000
int par[limit];
long long rank[limit];
void init(int N){
for(int i = 0;i < N;i++){
par[i] = i;
rank[i] = 1;
}
}
int root(int x){
if(x == par[x]) return x;
return par[x] = root(par[x]);
}
int same(int x,int y){
if(root(x) == root(y))
return 1;
return 0;
}
long long unite(int x,int y){
x = root(x);
y = root(y);
if(x == y) return 0;
if(rank[x] < rank[y]){
par[x] = y;
rank[y] += rank[x];
return rank[x]*(rank[y]-rank[x]);
}else{
par[y] = x;
rank[x] += rank[y];
return rank[y]*(rank[x]-rank[y]);
}
}
int main(void){
long long N,M;
scanf("%lld%lld",&N,&M);
int A[M],B[M];
for(int i = 0;i < M;i++){
scanf("%d%d",&A[i],&B[i]);
A[i]--; B[i]--;
}
init(N);
long long ans[M];
ans[M-1] = N*(N-1)/2;
for(int i = M-1;i > 0;i--){
ans[i-1] = ans[i]-unite(A[i],B[i]);
}
for(int i = 0;i < M;i++){
printf("%lld\n",ans[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328076/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328076/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@par = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@rank = dso_local local_unnamed_addr global [100000 x i64] zeroinitializer, align 16
@.str = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @init(i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp7 = icmp sgt i32 %N, 0
br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%min.iters.check = icmp ult i32 %N, 4
br i1 %min.iters.check, label %for.body.preheader11, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
%0 = getelementptr inbounds [100000 x i32], ptr @par, i64 0, i64 %index
store <2 x i32> %vec.ind, ptr %0, align 16, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 2
store <2 x i32> %step.add, ptr %1, align 8, !tbaa !5
%2 = getelementptr inbounds [100000 x i64], ptr @rank, i64 0, i64 %index
store <2 x i64> <i64 1, i64 1>, ptr %2, align 16, !tbaa !9
%3 = getelementptr inbounds i64, ptr %2, i64 2
store <2 x i64> <i64 1, i64 1>, ptr %3, align 16, !tbaa !9
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader11
for.body.preheader11: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
ret void
for.body: ; preds = %for.body.preheader11, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader11 ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr @par, i64 0, i64 %indvars.iv
%5 = trunc i64 %indvars.iv to i32
store i32 %5, ptr %arrayidx, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [100000 x i64], ptr @rank, i64 0, i64 %indvars.iv
store i64 1, ptr %arrayidx2, align 8, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @root(i32 noundef %x) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %x to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @par, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %x
br i1 %cmp, label %common.ret9, label %if.end
common.ret9: ; preds = %entry, %if.end
%common.ret9.op = phi i32 [ %call, %if.end ], [ %x, %entry ]
ret i32 %common.ret9.op
if.end: ; preds = %entry
%call = tail call i32 @root(i32 noundef %0)
store i32 %call, ptr %arrayidx, align 4, !tbaa !5
br label %common.ret9
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @same(i32 noundef %x, i32 noundef %y) local_unnamed_addr #3 {
entry:
%call = tail call i32 @root(i32 noundef %x)
%call1 = tail call i32 @root(i32 noundef %y)
%cmp = icmp eq i32 %call, %call1
%. = zext i1 %cmp to i32
ret i32 %.
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i64 @unite(i32 noundef %x, i32 noundef %y) local_unnamed_addr #3 {
entry:
%call = tail call i32 @root(i32 noundef %x)
%call1 = tail call i32 @root(i32 noundef %y)
%cmp = icmp eq i32 %call, %call1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom = sext i32 %call to i64
%arrayidx = getelementptr inbounds [100000 x i64], ptr @rank, i64 0, i64 %idxprom
%0 = load i64, ptr %arrayidx, align 8, !tbaa !9
%idxprom2 = sext i32 %call1 to i64
%arrayidx3 = getelementptr inbounds [100000 x i64], ptr @rank, i64 0, i64 %idxprom2
%1 = load i64, ptr %arrayidx3, align 8, !tbaa !9
%cmp4 = icmp slt i64 %0, %1
%add = add nsw i64 %1, %0
br i1 %cmp4, label %if.then5, label %if.else
if.then5: ; preds = %if.end
%arrayidx7 = getelementptr inbounds [100000 x i32], ptr @par, i64 0, i64 %idxprom
store i32 %call1, ptr %arrayidx7, align 4, !tbaa !5
store i64 %add, ptr %arrayidx3, align 8, !tbaa !9
%2 = load i64, ptr %arrayidx, align 8, !tbaa !9
%sub = sub nsw i64 %add, %2
%mul = mul nsw i64 %sub, %2
br label %return
if.else: ; preds = %if.end
%arrayidx19 = getelementptr inbounds [100000 x i32], ptr @par, i64 0, i64 %idxprom2
store i32 %call, ptr %arrayidx19, align 4, !tbaa !5
store i64 %add, ptr %arrayidx, align 8, !tbaa !9
%3 = load i64, ptr %arrayidx3, align 8, !tbaa !9
%sub31 = sub nsw i64 %add, %3
%mul32 = mul nsw i64 %sub31, %3
br label %return
return: ; preds = %entry, %if.else, %if.then5
%retval.0 = phi i64 [ %mul, %if.then5 ], [ %mul32, %if.else ], [ 0, %entry ]
ret i64 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%N = alloca i64, align 8
%M = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %M) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i64, ptr %M, align 8, !tbaa !9
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %0, align 16
%2 = load i64, ptr %M, align 8, !tbaa !9
%vla1 = alloca i32, i64 %2, align 16
%cmp63 = icmp sgt i64 %2, 0
br i1 %cmp63, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i64 [ %2, %entry ], [ %15, %for.body ]
%3 = load i64, ptr %N, align 8, !tbaa !9
%conv11 = trunc i64 %3 to i32
%cmp7.i = icmp sgt i32 %conv11, 0
br i1 %cmp7.i, label %for.body.preheader.i, label %init.exit
for.body.preheader.i: ; preds = %for.cond.cleanup
%wide.trip.count.i = and i64 %3, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count.i, 4
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body.preheader.i
%n.mod.vf = and i64 %3, 3
%n.vec = sub nsw i64 %wide.trip.count.i, %n.mod.vf
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
%4 = getelementptr inbounds [100000 x i32], ptr @par, i64 0, i64 %index
store <2 x i32> %vec.ind, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 2
store <2 x i32> %step.add, ptr %5, align 8, !tbaa !5
%6 = getelementptr inbounds [100000 x i64], ptr @rank, i64 0, i64 %index
store <2 x i64> <i64 1, i64 1>, ptr %6, align 16, !tbaa !9
%7 = getelementptr inbounds i64, ptr %6, i64 2
store <2 x i64> <i64 1, i64 1>, ptr %7, align 16, !tbaa !9
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %init.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%arrayidx.i = getelementptr inbounds [100000 x i32], ptr @par, i64 0, i64 %indvars.iv.i
%9 = trunc i64 %indvars.iv.i to i32
store i32 %9, ptr %arrayidx.i, align 4, !tbaa !5
%arrayidx2.i = getelementptr inbounds [100000 x i64], ptr @rank, i64 0, i64 %indvars.iv.i
store i64 1, ptr %arrayidx2.i, align 8, !tbaa !9
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %init.exit, label %for.body.i, !llvm.loop !17
init.exit: ; preds = %for.body.i, %middle.block, %for.cond.cleanup
%vla12 = alloca i64, i64 %.lcssa, align 16
%sub = add nsw i64 %3, -1
%mul = mul nsw i64 %sub, %3
%div = sdiv i64 %mul, 2
%10 = getelementptr i64, ptr %vla12, i64 %.lcssa
%arrayidx14 = getelementptr i64, ptr %10, i64 -1
store i64 %div, ptr %arrayidx14, align 8, !tbaa !9
%11 = trunc i64 %.lcssa to i32
%i15.066 = add i32 %11, -1
%cmp1967 = icmp sgt i32 %i15.066, 0
br i1 %cmp1967, label %for.body22.preheader, label %for.cond38.preheader
for.body22.preheader: ; preds = %init.exit
%12 = zext i32 %i15.066 to i64
br label %for.body22
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx4)
%13 = load i32, ptr %arrayidx, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %arrayidx, align 4, !tbaa !5
%14 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%dec10 = add nsw i32 %14, -1
store i32 %dec10, ptr %arrayidx4, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%15 = load i64, ptr %M, align 8, !tbaa !9
%cmp = icmp sgt i64 %15, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !18
for.cond38.preheader.loopexit: ; preds = %unite.exit
%.pre = load i64, ptr %M, align 8, !tbaa !9
br label %for.cond38.preheader
for.cond38.preheader: ; preds = %for.cond38.preheader.loopexit, %init.exit
%16 = phi i64 [ %.pre, %for.cond38.preheader.loopexit ], [ %.lcssa, %init.exit ]
%cmp4070 = icmp sgt i64 %16, 0
br i1 %cmp4070, label %for.body43, label %for.cond.cleanup42
for.body22: ; preds = %for.body22.preheader, %unite.exit
%indvars.iv75 = phi i64 [ %12, %for.body22.preheader ], [ %indvars.iv.next76, %unite.exit ]
%i15.0.in68 = phi i64 [ %.lcssa, %for.body22.preheader ], [ %indvars.iv75, %unite.exit ]
%arrayidx24 = getelementptr inbounds i64, ptr %vla12, i64 %indvars.iv75
%17 = load i64, ptr %arrayidx24, align 8, !tbaa !9
%arrayidx26 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv75
%18 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%arrayidx28 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv75
%19 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%call.i = call i32 @root(i32 noundef %18)
%call1.i = call i32 @root(i32 noundef %19)
%cmp.i = icmp eq i32 %call.i, %call1.i
br i1 %cmp.i, label %unite.exit, label %if.end.i
if.end.i: ; preds = %for.body22
%idxprom.i = sext i32 %call.i to i64
%arrayidx.i62 = getelementptr inbounds [100000 x i64], ptr @rank, i64 0, i64 %idxprom.i
%20 = load i64, ptr %arrayidx.i62, align 8, !tbaa !9
%idxprom2.i = sext i32 %call1.i to i64
%arrayidx3.i = getelementptr inbounds [100000 x i64], ptr @rank, i64 0, i64 %idxprom2.i
%21 = load i64, ptr %arrayidx3.i, align 8, !tbaa !9
%cmp4.i = icmp slt i64 %20, %21
%add.i = add nsw i64 %21, %20
br i1 %cmp4.i, label %if.then5.i, label %if.else.i
if.then5.i: ; preds = %if.end.i
%arrayidx7.i = getelementptr inbounds [100000 x i32], ptr @par, i64 0, i64 %idxprom.i
store i32 %call1.i, ptr %arrayidx7.i, align 4, !tbaa !5
store i64 %add.i, ptr %arrayidx3.i, align 8, !tbaa !9
%22 = load i64, ptr %arrayidx.i62, align 8, !tbaa !9
%sub.i.neg = sub i64 %22, %add.i
%mul.i.neg = mul i64 %sub.i.neg, %22
br label %unite.exit
if.else.i: ; preds = %if.end.i
%arrayidx19.i = getelementptr inbounds [100000 x i32], ptr @par, i64 0, i64 %idxprom2.i
store i32 %call.i, ptr %arrayidx19.i, align 4, !tbaa !5
store i64 %add.i, ptr %arrayidx.i62, align 8, !tbaa !9
%23 = load i64, ptr %arrayidx3.i, align 8, !tbaa !9
%sub31.i.neg = sub i64 %23, %add.i
%mul32.i.neg = mul i64 %sub31.i.neg, %23
br label %unite.exit
unite.exit: ; preds = %for.body22, %if.then5.i, %if.else.i
%retval.0.i.neg = phi i64 [ %mul.i.neg, %if.then5.i ], [ %mul32.i.neg, %if.else.i ], [ 0, %for.body22 ]
%sub30 = add i64 %retval.0.i.neg, %17
%sub31 = add i64 %i15.0.in68, 4294967294
%idxprom32 = and i64 %sub31, 4294967295
%arrayidx33 = getelementptr inbounds i64, ptr %vla12, i64 %idxprom32
store i64 %sub30, ptr %arrayidx33, align 8, !tbaa !9
%indvars.iv.next76 = add nsw i64 %indvars.iv75, -1
%indvars = trunc i64 %indvars.iv.next76 to i32
%cmp19 = icmp sgt i32 %indvars, 0
br i1 %cmp19, label %for.body22, label %for.cond38.preheader.loopexit, !llvm.loop !19
for.cond.cleanup42: ; preds = %for.body43, %for.cond38.preheader
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %M) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #7
ret i32 0
for.body43: ; preds = %for.cond38.preheader, %for.body43
%indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body43 ], [ 0, %for.cond38.preheader ]
%arrayidx45 = getelementptr inbounds i64, ptr %vla12, i64 %indvars.iv78
%24 = load i64, ptr %arrayidx45, align 8, !tbaa !9
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %24)
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%25 = load i64, ptr %M, align 8, !tbaa !9
%cmp40 = icmp sgt i64 %25, %indvars.iv.next79
br i1 %cmp40, label %for.body43, label %for.cond.cleanup42, !llvm.loop !20
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #6
attributes #0 = { nofree norecurse nosync nounwind memory(write, argmem: none, inaccessiblemem: none) 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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 #3 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) 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 = { 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 #5 = { 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 #6 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #7 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!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 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !14, !13}
!16 = distinct !{!16, !12, !13, !14}
!17 = distinct !{!17, !12, !14, !13}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
|
#include<stdio.h>
#include<stdlib.h>
typedef struct {
int mass;
int number;
} set;
int cmp( const void *p, const void *q ) {
return ((set*)q)->number - ((set*)p)->number;
}
int main(){
int i,j;
long k=0;
int N,M;
scanf("%d %d",&N,&M);
set A[N+M];
for(i=0;i<N;i++){
scanf("%d ",&A[i].number);
A[i].mass = 1;
}
for(i=N;i<M+N;i++){
scanf("%d %d",&A[i].mass,&A[i].number);
}
qsort(A,sizeof(A) / sizeof(set),sizeof(set),cmp);
i=0;
while(N > 0){
if(A[i].mass > N){
k += (long)((long)A[i].number*(long)N);
N = 0;
i++;
}
else{
k += (long)((long)A[i].number*(long)A[i].mass);
N -= A[i].mass;
i++;
}
}
printf("%ld\n",k);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328119/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328119/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.set = type { i32, i32 }
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #0 {
entry:
%number = getelementptr inbounds %struct.set, ptr %q, i64 0, i32 1
%0 = load i32, ptr %number, align 4, !tbaa !5
%number1 = getelementptr inbounds %struct.set, ptr %p, i64 0, i32 1
%1 = load i32, ptr %number1, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%N = alloca i32, align 4
%M = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i32, ptr %N, align 4, !tbaa !10
%1 = load i32, ptr %M, align 4, !tbaa !10
%add = add nsw i32 %1, %0
%2 = zext i32 %add to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.set, i64 %2, align 16
%4 = load i32, ptr %N, align 4, !tbaa !10
%cmp62 = icmp sgt i32 %4, 0
br i1 %cmp62, label %for.body, label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body, %entry
%5 = phi i32 [ %4, %entry ], [ %8, %for.body ]
%6 = load i32, ptr %M, align 4, !tbaa !10
%cmp665 = icmp sgt i32 %6, 0
br i1 %cmp665, label %for.body7.preheader, label %for.end17
for.body7.preheader: ; preds = %for.cond4.preheader
%7 = sext i32 %5 to i64
br label %for.body7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.set, ptr %vla, i64 %indvars.iv
%number = getelementptr inbounds %struct.set, ptr %vla, i64 %indvars.iv, i32 1
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %number)
store i32 1, ptr %arrayidx, align 8, !tbaa !11
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %N, align 4, !tbaa !10
%9 = sext i32 %8 to i64
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !12
for.body7: ; preds = %for.body7.preheader, %for.body7
%indvars.iv75 = phi i64 [ %7, %for.body7.preheader ], [ %indvars.iv.next76, %for.body7 ]
%arrayidx9 = getelementptr inbounds %struct.set, ptr %vla, i64 %indvars.iv75
%number13 = getelementptr inbounds %struct.set, ptr %vla, i64 %indvars.iv75, i32 1
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx9, ptr noundef nonnull %number13)
%indvars.iv.next76 = add nsw i64 %indvars.iv75, 1
%10 = load i32, ptr %M, align 4, !tbaa !10
%11 = load i32, ptr %N, align 4, !tbaa !10
%add5 = add nsw i32 %11, %10
%12 = sext i32 %add5 to i64
%cmp6 = icmp slt i64 %indvars.iv.next76, %12
br i1 %cmp6, label %for.body7, label %for.end17, !llvm.loop !14
for.end17: ; preds = %for.body7, %for.cond4.preheader
call void @qsort(ptr noundef nonnull %vla, i64 noundef %2, i64 noundef 8, ptr noundef nonnull @cmp) #6
%N.promoted = load i32, ptr %N, align 4, !tbaa !10
%cmp1868 = icmp sgt i32 %N.promoted, 0
br i1 %cmp1868, label %while.body, label %while.end
while.body: ; preds = %for.end17, %if.end
%indvars.iv78 = phi i64 [ %indvars.iv.next79, %if.end ], [ 0, %for.end17 ]
%k.070 = phi i64 [ %k.1, %if.end ], [ 0, %for.end17 ]
%storemerge6769 = phi i32 [ %sub, %if.end ], [ %N.promoted, %for.end17 ]
%arrayidx20 = getelementptr inbounds %struct.set, ptr %vla, i64 %indvars.iv78
%13 = load i32, ptr %arrayidx20, align 8, !tbaa !11
%cmp22 = icmp sgt i32 %13, %storemerge6769
%number25 = getelementptr inbounds %struct.set, ptr %vla, i64 %indvars.iv78, i32 1
%14 = load i32, ptr %number25, align 4, !tbaa !5
%conv = sext i32 %14 to i64
br i1 %cmp22, label %if.end.thread, label %if.end
if.end.thread: ; preds = %while.body
%conv26 = zext i32 %storemerge6769 to i64
%mul = mul nsw i64 %conv, %conv26
%k.184 = add nsw i64 %mul, %k.070
br label %while.cond.while.end_crit_edge
if.end: ; preds = %while.body
%conv36 = sext i32 %13 to i64
%mul37 = mul nsw i64 %conv, %conv36
%sub = sub nsw i32 %storemerge6769, %13
%indvars.iv.next79 = add nuw i64 %indvars.iv78, 1
%k.1 = add nsw i64 %mul37, %k.070
%cmp18 = icmp sgt i32 %sub, 0
br i1 %cmp18, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !15
while.cond.while.end_crit_edge: ; preds = %if.end, %if.end.thread
%k.187 = phi i64 [ %k.184, %if.end.thread ], [ %k.1, %if.end ]
%storemerge86 = phi i32 [ 0, %if.end.thread ], [ %sub, %if.end ]
store i32 %storemerge86, ptr %N, align 4, !tbaa !10
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %for.end17
%k.0.lcssa = phi i64 [ %k.187, %while.cond.while.end_crit_edge ], [ 0, %for.end17 ]
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %k.0.lcssa)
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 4}
!6 = !{!"", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!6, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
|
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }
void rsorta_u32(void *base, const int count, const int size, const int index){
typedef uint32_t rsort_t;
rsort_t (*a)[size] = (rsort_t(*)[size])base;
rsort_t (*b)[size] = (rsort_t(*)[size])malloc(count*size*sizeof(rsort_t));
int c[0x100];
memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(0<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(0<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(1<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(1<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(2<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(2<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(3<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(3<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
free(b);
}
int a[100000][2];
int main(void){
int n=nextint();
for(int i=0; i<n; i++){
a[i][0]=i;
a[i][1]=nextint();
}
rsorta_u32(a, n, 2, 1);
long sum=0;
int ans=0;
for(int i=0; i<n; i++){
if(a[i][1]<=sum*2){
ans++;
}else{
ans=1;
}
sum+=a[i][1];
}
printf("%d\n", ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328162/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328162/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
@a = dso_local global [100000 x [2 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nounwind uwtable
define dso_local i32 @nextint() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #8
br label %getchar_unlocked.exit
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i = zext i8 %3 to i32
br label %getchar_unlocked.exit
getchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
%cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ]
%sext72 = shl i32 %cond.i, 24
%cmp.not73 = icmp ne i32 %sext72, 754974720
%4 = add i32 %sext72, -956301313
%5 = icmp ult i32 %4, -150994945
%or.cond74 = and i1 %cmp.not73, %5
br i1 %or.cond74, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %getchar_unlocked.exit
%.pre81 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.preheader, %getchar_unlocked.exit51
%6 = phi ptr [ %.pre81, %while.body.preheader ], [ %10, %getchar_unlocked.exit51 ]
%_IO_read_ptr.i42 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 1
%7 = load ptr, ptr %_IO_read_ptr.i42, align 8, !tbaa !9
%_IO_read_end.i43 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 2
%8 = load ptr, ptr %_IO_read_end.i43, align 8, !tbaa !14
%cmp.not.i44 = icmp ult ptr %7, %8
br i1 %cmp.not.i44, label %cond.false.i48, label %cond.true.i45, !prof !15
cond.true.i45: ; preds = %while.body
%call.i46 = tail call i32 @__uflow(ptr noundef nonnull %6) #8
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit51
cond.false.i48: ; preds = %while.body
%incdec.ptr.i49 = getelementptr inbounds i8, ptr %7, i64 1
store ptr %incdec.ptr.i49, ptr %_IO_read_ptr.i42, align 8, !tbaa !9
%9 = load i8, ptr %7, align 1, !tbaa !16
%conv3.i50 = zext i8 %9 to i32
br label %getchar_unlocked.exit51
getchar_unlocked.exit51: ; preds = %cond.true.i45, %cond.false.i48
%10 = phi ptr [ %.pre, %cond.true.i45 ], [ %6, %cond.false.i48 ]
%cond.i47 = phi i32 [ %call.i46, %cond.true.i45 ], [ %conv3.i50, %cond.false.i48 ]
%sext = shl i32 %cond.i47, 24
%cmp.not = icmp ne i32 %sext, 754974720
%11 = add i32 %sext, -956301313
%12 = icmp ult i32 %11, -150994945
%or.cond = and i1 %cmp.not, %12
br i1 %or.cond, label %while.body, label %while.end, !llvm.loop !17
while.end: ; preds = %getchar_unlocked.exit51, %getchar_unlocked.exit
%c.0.in.lcssa = phi i32 [ %cond.i, %getchar_unlocked.exit ], [ %cond.i47, %getchar_unlocked.exit51 ]
%sext.lcssa = phi i32 [ %sext72, %getchar_unlocked.exit ], [ %sext, %getchar_unlocked.exit51 ]
%cmp12 = icmp eq i32 %sext.lcssa, 754974720
br i1 %cmp12, label %if.then, label %if.end
if.then: ; preds = %while.end
%13 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i52 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 1
%14 = load ptr, ptr %_IO_read_ptr.i52, align 8, !tbaa !9
%_IO_read_end.i53 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 2
%15 = load ptr, ptr %_IO_read_end.i53, align 8, !tbaa !14
%cmp.not.i54 = icmp ult ptr %14, %15
br i1 %cmp.not.i54, label %cond.false.i58, label %cond.true.i55, !prof !15
cond.true.i55: ; preds = %if.then
%call.i56 = tail call i32 @__uflow(ptr noundef nonnull %13) #8
br label %if.end
cond.false.i58: ; preds = %if.then
%incdec.ptr.i59 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr.i59, ptr %_IO_read_ptr.i52, align 8, !tbaa !9
%16 = load i8, ptr %14, align 1, !tbaa !16
%conv3.i60 = zext i8 %16 to i32
br label %if.end
if.end: ; preds = %cond.false.i58, %cond.true.i55, %while.end
%c.1.in = phi i32 [ %c.0.in.lcssa, %while.end ], [ %call.i56, %cond.true.i55 ], [ %conv3.i60, %cond.false.i58 ]
%sext4076 = shl i32 %c.1.in, 24
%17 = add i32 %sext4076, -788529153
%18 = icmp ult i32 %17, 184549375
br i1 %18, label %while.body25.preheader, label %while.end29
while.body25.preheader: ; preds = %if.end
%.pre83 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %while.body25
while.body25: ; preds = %while.body25.preheader, %getchar_unlocked.exit71
%19 = phi ptr [ %23, %getchar_unlocked.exit71 ], [ %.pre83, %while.body25.preheader ]
%x.078 = phi i32 [ %sub, %getchar_unlocked.exit71 ], [ 0, %while.body25.preheader ]
%c.2.in77 = phi i32 [ %cond.i67, %getchar_unlocked.exit71 ], [ %c.1.in, %while.body25.preheader ]
%conv17 = and i32 %c.2.in77, 255
%mul = mul i32 %x.078, 10
%add = add nsw i32 %conv17, -48
%sub = add i32 %add, %mul
%_IO_read_ptr.i62 = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 1
%20 = load ptr, ptr %_IO_read_ptr.i62, align 8, !tbaa !9
%_IO_read_end.i63 = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 2
%21 = load ptr, ptr %_IO_read_end.i63, align 8, !tbaa !14
%cmp.not.i64 = icmp ult ptr %20, %21
br i1 %cmp.not.i64, label %cond.false.i68, label %cond.true.i65, !prof !15
cond.true.i65: ; preds = %while.body25
%call.i66 = tail call i32 @__uflow(ptr noundef nonnull %19) #8
%.pre82 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit71
cond.false.i68: ; preds = %while.body25
%incdec.ptr.i69 = getelementptr inbounds i8, ptr %20, i64 1
store ptr %incdec.ptr.i69, ptr %_IO_read_ptr.i62, align 8, !tbaa !9
%22 = load i8, ptr %20, align 1, !tbaa !16
%conv3.i70 = zext i8 %22 to i32
br label %getchar_unlocked.exit71
getchar_unlocked.exit71: ; preds = %cond.true.i65, %cond.false.i68
%23 = phi ptr [ %.pre82, %cond.true.i65 ], [ %19, %cond.false.i68 ]
%cond.i67 = phi i32 [ %call.i66, %cond.true.i65 ], [ %conv3.i70, %cond.false.i68 ]
%sext40 = shl i32 %cond.i67, 24
%24 = add i32 %sext40, -788529153
%25 = icmp ult i32 %24, 184549375
br i1 %25, label %while.body25, label %while.end29, !llvm.loop !19
while.end29: ; preds = %getchar_unlocked.exit71, %if.end
%x.0.lcssa = phi i32 [ 0, %if.end ], [ %sub, %getchar_unlocked.exit71 ]
%sub31 = sub i32 0, %x.0.lcssa
%cond = select i1 %cmp12, i32 %sub31, i32 %x.0.lcssa
ret i32 %cond
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nounwind uwtable
define dso_local i64 @nextlong() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #8
br label %getchar_unlocked.exit
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i = zext i8 %3 to i32
br label %getchar_unlocked.exit
getchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
%cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ]
%sext72 = shl i32 %cond.i, 24
%cmp.not73 = icmp ne i32 %sext72, 754974720
%4 = add i32 %sext72, -956301313
%5 = icmp ult i32 %4, -150994945
%or.cond74 = and i1 %cmp.not73, %5
br i1 %or.cond74, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %getchar_unlocked.exit
%.pre81 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.preheader, %getchar_unlocked.exit51
%6 = phi ptr [ %.pre81, %while.body.preheader ], [ %10, %getchar_unlocked.exit51 ]
%_IO_read_ptr.i42 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 1
%7 = load ptr, ptr %_IO_read_ptr.i42, align 8, !tbaa !9
%_IO_read_end.i43 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 2
%8 = load ptr, ptr %_IO_read_end.i43, align 8, !tbaa !14
%cmp.not.i44 = icmp ult ptr %7, %8
br i1 %cmp.not.i44, label %cond.false.i48, label %cond.true.i45, !prof !15
cond.true.i45: ; preds = %while.body
%call.i46 = tail call i32 @__uflow(ptr noundef nonnull %6) #8
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit51
cond.false.i48: ; preds = %while.body
%incdec.ptr.i49 = getelementptr inbounds i8, ptr %7, i64 1
store ptr %incdec.ptr.i49, ptr %_IO_read_ptr.i42, align 8, !tbaa !9
%9 = load i8, ptr %7, align 1, !tbaa !16
%conv3.i50 = zext i8 %9 to i32
br label %getchar_unlocked.exit51
getchar_unlocked.exit51: ; preds = %cond.true.i45, %cond.false.i48
%10 = phi ptr [ %.pre, %cond.true.i45 ], [ %6, %cond.false.i48 ]
%cond.i47 = phi i32 [ %call.i46, %cond.true.i45 ], [ %conv3.i50, %cond.false.i48 ]
%sext = shl i32 %cond.i47, 24
%cmp.not = icmp ne i32 %sext, 754974720
%11 = add i32 %sext, -956301313
%12 = icmp ult i32 %11, -150994945
%or.cond = and i1 %cmp.not, %12
br i1 %or.cond, label %while.body, label %while.end, !llvm.loop !20
while.end: ; preds = %getchar_unlocked.exit51, %getchar_unlocked.exit
%c.0.in.lcssa = phi i32 [ %cond.i, %getchar_unlocked.exit ], [ %cond.i47, %getchar_unlocked.exit51 ]
%sext.lcssa = phi i32 [ %sext72, %getchar_unlocked.exit ], [ %sext, %getchar_unlocked.exit51 ]
%cmp12.not = icmp eq i32 %sext.lcssa, 754974720
br i1 %cmp12.not, label %if.then, label %if.end
if.then: ; preds = %while.end
%13 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i52 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 1
%14 = load ptr, ptr %_IO_read_ptr.i52, align 8, !tbaa !9
%_IO_read_end.i53 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 2
%15 = load ptr, ptr %_IO_read_end.i53, align 8, !tbaa !14
%cmp.not.i54 = icmp ult ptr %14, %15
br i1 %cmp.not.i54, label %cond.false.i58, label %cond.true.i55, !prof !15
cond.true.i55: ; preds = %if.then
%call.i56 = tail call i32 @__uflow(ptr noundef nonnull %13) #8
br label %if.end
cond.false.i58: ; preds = %if.then
%incdec.ptr.i59 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr.i59, ptr %_IO_read_ptr.i52, align 8, !tbaa !9
%16 = load i8, ptr %14, align 1, !tbaa !16
%conv3.i60 = zext i8 %16 to i32
br label %if.end
if.end: ; preds = %cond.false.i58, %cond.true.i55, %while.end
%c.1.in = phi i32 [ %c.0.in.lcssa, %while.end ], [ %call.i56, %cond.true.i55 ], [ %conv3.i60, %cond.false.i58 ]
%sext3976 = shl i32 %c.1.in, 24
%17 = add i32 %sext3976, -788529153
%18 = icmp ult i32 %17, 184549375
br i1 %18, label %while.body25.preheader, label %while.end29
while.body25.preheader: ; preds = %if.end
%.pre83 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %while.body25
while.body25: ; preds = %while.body25.preheader, %getchar_unlocked.exit71
%19 = phi ptr [ %23, %getchar_unlocked.exit71 ], [ %.pre83, %while.body25.preheader ]
%x.078 = phi i64 [ %sub, %getchar_unlocked.exit71 ], [ 0, %while.body25.preheader ]
%c.2.in77 = phi i32 [ %cond.i67, %getchar_unlocked.exit71 ], [ %c.1.in, %while.body25.preheader ]
%c.2 = zext i32 %c.2.in77 to i64
%mul = mul i64 %x.078, 10
%sext40 = shl i64 %c.2, 56
%conv26 = ashr exact i64 %sext40, 56
%add = add i64 %mul, -48
%sub = add i64 %add, %conv26
%_IO_read_ptr.i62 = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 1
%20 = load ptr, ptr %_IO_read_ptr.i62, align 8, !tbaa !9
%_IO_read_end.i63 = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 2
%21 = load ptr, ptr %_IO_read_end.i63, align 8, !tbaa !14
%cmp.not.i64 = icmp ult ptr %20, %21
br i1 %cmp.not.i64, label %cond.false.i68, label %cond.true.i65, !prof !15
cond.true.i65: ; preds = %while.body25
%call.i66 = tail call i32 @__uflow(ptr noundef nonnull %19) #8
%.pre82 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit71
cond.false.i68: ; preds = %while.body25
%incdec.ptr.i69 = getelementptr inbounds i8, ptr %20, i64 1
store ptr %incdec.ptr.i69, ptr %_IO_read_ptr.i62, align 8, !tbaa !9
%22 = load i8, ptr %20, align 1, !tbaa !16
%conv3.i70 = zext i8 %22 to i32
br label %getchar_unlocked.exit71
getchar_unlocked.exit71: ; preds = %cond.true.i65, %cond.false.i68
%23 = phi ptr [ %.pre82, %cond.true.i65 ], [ %19, %cond.false.i68 ]
%cond.i67 = phi i32 [ %call.i66, %cond.true.i65 ], [ %conv3.i70, %cond.false.i68 ]
%sext39 = shl i32 %cond.i67, 24
%24 = add i32 %sext39, -788529153
%25 = icmp ult i32 %24, 184549375
br i1 %25, label %while.body25, label %while.end29, !llvm.loop !21
while.end29: ; preds = %getchar_unlocked.exit71, %if.end
%x.0.lcssa = phi i64 [ 0, %if.end ], [ %sub, %getchar_unlocked.exit71 ]
%sub30 = sub i64 0, %x.0.lcssa
%cond = select i1 %cmp12.not, i64 %sub30, i64 %x.0.lcssa
ret i64 %cond
}
; Function Attrs: nounwind uwtable
define dso_local i32 @nextstr(ptr nocapture noundef writeonly %s) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #8
br label %while.cond.preheader
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i = zext i8 %3 to i32
br label %while.cond.preheader
while.cond.preheader: ; preds = %cond.true.i, %cond.false.i
%c.0.in.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ]
br label %while.cond
while.cond: ; preds = %while.cond.backedge, %while.cond.preheader
%c.0.in = phi i32 [ %c.0.in.ph, %while.cond.preheader ], [ %c.0.in.be, %while.cond.backedge ]
%sext = shl i32 %c.0.in, 24
switch i32 %sext, label %while.cond8 [
i32 536870912, label %while.body
i32 167772160, label %while.body
]
while.body: ; preds = %while.cond, %while.cond
%4 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i26 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i26, align 8, !tbaa !9
%_IO_read_end.i27 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i27, align 8, !tbaa !14
%cmp.not.i28 = icmp ult ptr %5, %6
br i1 %cmp.not.i28, label %cond.false.i32, label %cond.true.i29, !prof !15
cond.true.i29: ; preds = %while.body
%call.i30 = tail call i32 @__uflow(ptr noundef nonnull %4) #8
br label %while.cond.backedge
while.cond.backedge: ; preds = %cond.true.i29, %cond.false.i32
%c.0.in.be = phi i32 [ %call.i30, %cond.true.i29 ], [ %conv3.i34, %cond.false.i32 ]
br label %while.cond, !llvm.loop !22
cond.false.i32: ; preds = %while.body
%incdec.ptr.i33 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i33, ptr %_IO_read_ptr.i26, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i34 = zext i8 %7 to i32
br label %while.cond.backedge
while.cond8: ; preds = %while.cond, %while.cond8.backedge
%s.addr.0 = phi ptr [ %incdec.ptr, %while.cond8.backedge ], [ %s, %while.cond ]
%c.1.in = phi i32 [ %c.1.in.be, %while.cond8.backedge ], [ %c.0.in, %while.cond ]
%len.0 = phi i32 [ %inc, %while.cond8.backedge ], [ 0, %while.cond ]
%sext25 = shl i32 %c.1.in, 24
switch i32 %sext25, label %while.body15 [
i32 536870912, label %while.end18
i32 167772160, label %while.end18
]
while.body15: ; preds = %while.cond8
%c.1 = trunc i32 %c.1.in to i8
%incdec.ptr = getelementptr inbounds i8, ptr %s.addr.0, i64 1
store i8 %c.1, ptr %s.addr.0, align 1, !tbaa !16
%inc = add i32 %len.0, 1
%8 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i36 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 1
%9 = load ptr, ptr %_IO_read_ptr.i36, align 8, !tbaa !9
%_IO_read_end.i37 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 2
%10 = load ptr, ptr %_IO_read_end.i37, align 8, !tbaa !14
%cmp.not.i38 = icmp ult ptr %9, %10
br i1 %cmp.not.i38, label %cond.false.i42, label %cond.true.i39, !prof !15
cond.true.i39: ; preds = %while.body15
%call.i40 = tail call i32 @__uflow(ptr noundef nonnull %8) #8
br label %while.cond8.backedge
while.cond8.backedge: ; preds = %cond.true.i39, %cond.false.i42
%c.1.in.be = phi i32 [ %call.i40, %cond.true.i39 ], [ %conv3.i44, %cond.false.i42 ]
br label %while.cond8, !llvm.loop !23
cond.false.i42: ; preds = %while.body15
%incdec.ptr.i43 = getelementptr inbounds i8, ptr %9, i64 1
store ptr %incdec.ptr.i43, ptr %_IO_read_ptr.i36, align 8, !tbaa !9
%11 = load i8, ptr %9, align 1, !tbaa !16
%conv3.i44 = zext i8 %11 to i32
br label %while.cond8.backedge
while.end18: ; preds = %while.cond8, %while.cond8
store i8 0, ptr %s.addr.0, align 1, !tbaa !16
ret i32 %len.0
}
; Function Attrs: nounwind uwtable
define dso_local void @rsorta_u32(ptr nocapture noundef %base, i32 noundef %count, i32 noundef %size, i32 noundef %index) local_unnamed_addr #0 {
entry:
%c = alloca [256 x i32], align 16
%0 = zext i32 %size to i64
%mul = mul nsw i32 %size, %count
%conv = sext i32 %mul to i64
%mul1 = shl nsw i64 %conv, 2
%call = tail call noalias ptr @malloc(i64 noundef %mul1) #9
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %c) #8
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %c, i8 0, i64 1024, i1 false)
%cmp365 = icmp sgt i32 %count, 0
br i1 %cmp365, label %for.body.lr.ph, label %for.body13.preheader
for.body13.preheader: ; preds = %for.cond9.preheader.loopexit, %entry
%.ph493 = phi i32 [ 0, %entry ], [ %.pre.pre, %for.cond9.preheader.loopexit ]
br label %for.body13
for.body.lr.ph: ; preds = %entry
%idxprom3 = sext i32 %index to i64
%invariant.gep = getelementptr i32, ptr %base, i64 %idxprom3
%wide.trip.count = zext i32 %count to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %count, 1
br i1 %1, label %for.cond9.preheader.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.cond9.preheader.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%indvars.iv.unr = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader.loopexit, label %for.body.epil
for.body.epil: ; preds = %for.cond9.preheader.loopexit.unr-lcssa
%2 = mul nuw nsw i64 %indvars.iv.unr, %0
%gep.epil = getelementptr i32, ptr %invariant.gep, i64 %2
%3 = load i32, ptr %gep.epil, align 4, !tbaa !24
%and.epil = and i32 %3, 255
%idxprom5.epil = zext i32 %and.epil to i64
%arrayidx6.epil = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom5.epil
%4 = load i32, ptr %arrayidx6.epil, align 4, !tbaa !24
%inc.epil = add nsw i32 %4, 1
store i32 %inc.epil, ptr %arrayidx6.epil, align 4, !tbaa !24
br label %for.cond9.preheader.loopexit
for.cond9.preheader.loopexit: ; preds = %for.cond9.preheader.loopexit.unr-lcssa, %for.body.epil
%.pre.pre = load i32, ptr %c, align 16, !tbaa !24
br label %for.body13.preheader
for.body: ; preds = %for.body, %for.body.lr.ph.new
%indvars.iv = phi i64 [ 0, %for.body.lr.ph.new ], [ %indvars.iv.next.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%5 = mul nuw nsw i64 %indvars.iv, %0
%gep = getelementptr i32, ptr %invariant.gep, i64 %5
%6 = load i32, ptr %gep, align 4, !tbaa !24
%and = and i32 %6, 255
%idxprom5 = zext i32 %and to i64
%arrayidx6 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom5
%7 = load i32, ptr %arrayidx6, align 4, !tbaa !24
%inc = add nsw i32 %7, 1
store i32 %inc, ptr %arrayidx6, align 4, !tbaa !24
%indvars.iv.next = or i64 %indvars.iv, 1
%8 = mul nuw nsw i64 %indvars.iv.next, %0
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %8
%9 = load i32, ptr %gep.1, align 4, !tbaa !24
%and.1 = and i32 %9, 255
%idxprom5.1 = zext i32 %and.1 to i64
%arrayidx6.1 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom5.1
%10 = load i32, ptr %arrayidx6.1, align 4, !tbaa !24
%inc.1 = add nsw i32 %10, 1
store i32 %inc.1, ptr %arrayidx6.1, align 4, !tbaa !24
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond9.preheader.loopexit.unr-lcssa, label %for.body, !llvm.loop !25
for.cond.cleanup12: ; preds = %for.body13
%sub22 = add i32 %count, -1
br i1 %cmp365, label %for.body27.lr.ph, label %for.cond.cleanup26.thread
for.cond.cleanup26.thread: ; preds = %for.cond.cleanup12
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %c, i8 0, i64 1024, i1 false)
br label %for.body79.preheader
for.body27.lr.ph: ; preds = %for.cond.cleanup12
%idxprom30 = sext i32 %index to i64
%cmp37368 = icmp sgt i32 %size, 0
%11 = zext i32 %sub22 to i64
%12 = mul nuw i64 %0, %11
%13 = shl i64 %12, 2
%14 = mul nsw i64 %0, -4
%15 = shl nuw nsw i64 %0, 2
%wide.trip.count411 = zext i32 %count to i64
%invariant.gep483 = getelementptr i32, ptr %base, i64 %idxprom30
%16 = getelementptr i8, ptr %base, i64 %13
br label %for.body27
for.body13: ; preds = %for.body13, %for.body13.preheader
%17 = phi i32 [ %.ph493, %for.body13.preheader ], [ %add.4, %for.body13 ]
%indvars.iv400 = phi i64 [ 1, %for.body13.preheader ], [ %indvars.iv.next401.4, %for.body13 ]
%arrayidx17 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv400
%18 = load i32, ptr %arrayidx17, align 4, !tbaa !24
%add = add nsw i32 %18, %17
store i32 %add, ptr %arrayidx17, align 4, !tbaa !24
%indvars.iv.next401 = add nuw nsw i64 %indvars.iv400, 1
%arrayidx17.1 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next401
%19 = load i32, ptr %arrayidx17.1, align 4, !tbaa !24
%add.1 = add nsw i32 %19, %add
store i32 %add.1, ptr %arrayidx17.1, align 4, !tbaa !24
%indvars.iv.next401.1 = add nuw nsw i64 %indvars.iv400, 2
%arrayidx17.2 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next401.1
%20 = load i32, ptr %arrayidx17.2, align 4, !tbaa !24
%add.2 = add nsw i32 %20, %add.1
store i32 %add.2, ptr %arrayidx17.2, align 4, !tbaa !24
%indvars.iv.next401.2 = add nuw nsw i64 %indvars.iv400, 3
%arrayidx17.3 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next401.2
%21 = load i32, ptr %arrayidx17.3, align 4, !tbaa !24
%add.3 = add nsw i32 %21, %add.2
store i32 %add.3, ptr %arrayidx17.3, align 4, !tbaa !24
%indvars.iv.next401.3 = add nuw nsw i64 %indvars.iv400, 4
%arrayidx17.4 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next401.3
%22 = load i32, ptr %arrayidx17.4, align 4, !tbaa !24
%add.4 = add nsw i32 %22, %add.3
store i32 %add.4, ptr %arrayidx17.4, align 4, !tbaa !24
%indvars.iv.next401.4 = add nuw nsw i64 %indvars.iv400, 5
%exitcond404.not.4 = icmp eq i64 %indvars.iv.next401.4, 256
br i1 %exitcond404.not.4, label %for.cond.cleanup12, label %for.body13, !llvm.loop !26
for.cond.cleanup26: ; preds = %for.cond.cleanup39
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %c, i8 0, i64 1024, i1 false)
br i1 %cmp365, label %for.body61.lr.ph, label %for.body79.preheader
for.body79.preheader: ; preds = %for.cond.cleanup26.thread, %for.cond75.preheader.loopexit, %for.cond.cleanup26
%.ph492 = phi i32 [ 0, %for.cond.cleanup26.thread ], [ 0, %for.cond.cleanup26 ], [ %.pre476.pre, %for.cond75.preheader.loopexit ]
br label %for.body79
for.body61.lr.ph: ; preds = %for.cond.cleanup26
%idxprom64 = sext i32 %index to i64
%invariant.gep374 = getelementptr i32, ptr %call, i64 %idxprom64
%xtraiter494 = and i64 %wide.trip.count411, 1
%23 = icmp eq i32 %count, 1
br i1 %23, label %for.cond75.preheader.loopexit.unr-lcssa, label %for.body61.lr.ph.new
for.body61.lr.ph.new: ; preds = %for.body61.lr.ph
%unroll_iter496 = and i64 %wide.trip.count411, 4294967294
br label %for.body61
for.body27: ; preds = %for.body27.lr.ph, %for.cond.cleanup39
%indvars.iv408 = phi i64 [ %11, %for.body27.lr.ph ], [ %indvars.iv.next409, %for.cond.cleanup39 ]
%indvar = phi i64 [ 0, %for.body27.lr.ph ], [ %indvar.next, %for.cond.cleanup39 ]
%24 = mul nuw nsw i64 %indvars.iv408, %0
%gep484 = getelementptr i32, ptr %invariant.gep483, i64 %24
%25 = load i32, ptr %gep484, align 4, !tbaa !24
%and33 = and i32 %25, 255
%idxprom34 = zext i32 %and33 to i64
%arrayidx35 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom34
%26 = load i32, ptr %arrayidx35, align 4, !tbaa !24
%dec = add nsw i32 %26, -1
store i32 %dec, ptr %arrayidx35, align 4, !tbaa !24
br i1 %cmp37368, label %for.body40.lr.ph, label %for.cond.cleanup39
for.body40.lr.ph: ; preds = %for.body27
%27 = mul i64 %14, %indvar
%scevgep = getelementptr i8, ptr %16, i64 %27
%idxprom45 = sext i32 %dec to i64
%28 = mul nsw i64 %idxprom45, %0
%arrayidx46 = getelementptr inbounds i32, ptr %call, i64 %28
tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %arrayidx46, ptr align 4 %scevgep, i64 %15, i1 false), !tbaa !24
br label %for.cond.cleanup39
for.cond.cleanup39: ; preds = %for.body40.lr.ph, %for.body27
%indvars.iv.next409 = add nsw i64 %indvars.iv408, -1
%indvar.next = add nuw nsw i64 %indvar, 1
%exitcond412.not = icmp eq i64 %indvar.next, %wide.trip.count411
br i1 %exitcond412.not, label %for.cond.cleanup26, label %for.body27, !llvm.loop !27
for.cond75.preheader.loopexit.unr-lcssa: ; preds = %for.body61, %for.body61.lr.ph
%indvars.iv413.unr = phi i64 [ 0, %for.body61.lr.ph ], [ %indvars.iv.next414.1, %for.body61 ]
%lcmp.mod495.not = icmp eq i64 %xtraiter494, 0
br i1 %lcmp.mod495.not, label %for.cond75.preheader.loopexit, label %for.body61.epil
for.body61.epil: ; preds = %for.cond75.preheader.loopexit.unr-lcssa
%29 = mul nuw nsw i64 %indvars.iv413.unr, %0
%gep375.epil = getelementptr i32, ptr %invariant.gep374, i64 %29
%30 = load i32, ptr %gep375.epil, align 4, !tbaa !24
%shr66.epil = lshr i32 %30, 8
%and67.epil = and i32 %shr66.epil, 255
%idxprom68.epil = zext i32 %and67.epil to i64
%arrayidx69.epil = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom68.epil
%31 = load i32, ptr %arrayidx69.epil, align 4, !tbaa !24
%inc70.epil = add nsw i32 %31, 1
store i32 %inc70.epil, ptr %arrayidx69.epil, align 4, !tbaa !24
br label %for.cond75.preheader.loopexit
for.cond75.preheader.loopexit: ; preds = %for.cond75.preheader.loopexit.unr-lcssa, %for.body61.epil
%.pre476.pre = load i32, ptr %c, align 16, !tbaa !24
br label %for.body79.preheader
for.body61: ; preds = %for.body61, %for.body61.lr.ph.new
%indvars.iv413 = phi i64 [ 0, %for.body61.lr.ph.new ], [ %indvars.iv.next414.1, %for.body61 ]
%niter497 = phi i64 [ 0, %for.body61.lr.ph.new ], [ %niter497.next.1, %for.body61 ]
%32 = mul nuw nsw i64 %indvars.iv413, %0
%gep375 = getelementptr i32, ptr %invariant.gep374, i64 %32
%33 = load i32, ptr %gep375, align 4, !tbaa !24
%shr66 = lshr i32 %33, 8
%and67 = and i32 %shr66, 255
%idxprom68 = zext i32 %and67 to i64
%arrayidx69 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom68
%34 = load i32, ptr %arrayidx69, align 4, !tbaa !24
%inc70 = add nsw i32 %34, 1
store i32 %inc70, ptr %arrayidx69, align 4, !tbaa !24
%indvars.iv.next414 = or i64 %indvars.iv413, 1
%35 = mul nuw nsw i64 %indvars.iv.next414, %0
%gep375.1 = getelementptr i32, ptr %invariant.gep374, i64 %35
%36 = load i32, ptr %gep375.1, align 4, !tbaa !24
%shr66.1 = lshr i32 %36, 8
%and67.1 = and i32 %shr66.1, 255
%idxprom68.1 = zext i32 %and67.1 to i64
%arrayidx69.1 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom68.1
%37 = load i32, ptr %arrayidx69.1, align 4, !tbaa !24
%inc70.1 = add nsw i32 %37, 1
store i32 %inc70.1, ptr %arrayidx69.1, align 4, !tbaa !24
%indvars.iv.next414.1 = add nuw nsw i64 %indvars.iv413, 2
%niter497.next.1 = add i64 %niter497, 2
%niter497.ncmp.1 = icmp eq i64 %niter497.next.1, %unroll_iter496
br i1 %niter497.ncmp.1, label %for.cond75.preheader.loopexit.unr-lcssa, label %for.body61, !llvm.loop !28
for.cond91.preheader: ; preds = %for.body79
br i1 %cmp365, label %for.body95.lr.ph, label %for.cond.cleanup94.thread
for.cond.cleanup94.thread: ; preds = %for.cond91.preheader
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %c, i8 0, i64 1024, i1 false)
br label %for.body151.preheader
for.body95.lr.ph: ; preds = %for.cond91.preheader
%idxprom99 = sext i32 %index to i64
%cmp108377 = icmp sgt i32 %size, 0
%38 = zext i32 %sub22 to i64
%39 = mul nuw i64 %0, %38
%40 = shl i64 %39, 2
%41 = mul nsw i64 %0, -4
%42 = shl nuw nsw i64 %0, 2
%wide.trip.count432 = zext i32 %count to i64
%invariant.gep485 = getelementptr i32, ptr %call, i64 %idxprom99
%43 = getelementptr i8, ptr %call, i64 %40
br label %for.body95
for.body79: ; preds = %for.body79, %for.body79.preheader
%44 = phi i32 [ %.ph492, %for.body79.preheader ], [ %add85.4, %for.body79 ]
%indvars.iv418 = phi i64 [ 1, %for.body79.preheader ], [ %indvars.iv.next419.4, %for.body79 ]
%arrayidx84 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv418
%45 = load i32, ptr %arrayidx84, align 4, !tbaa !24
%add85 = add nsw i32 %45, %44
store i32 %add85, ptr %arrayidx84, align 4, !tbaa !24
%indvars.iv.next419 = add nuw nsw i64 %indvars.iv418, 1
%arrayidx84.1 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next419
%46 = load i32, ptr %arrayidx84.1, align 4, !tbaa !24
%add85.1 = add nsw i32 %46, %add85
store i32 %add85.1, ptr %arrayidx84.1, align 4, !tbaa !24
%indvars.iv.next419.1 = add nuw nsw i64 %indvars.iv418, 2
%arrayidx84.2 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next419.1
%47 = load i32, ptr %arrayidx84.2, align 4, !tbaa !24
%add85.2 = add nsw i32 %47, %add85.1
store i32 %add85.2, ptr %arrayidx84.2, align 4, !tbaa !24
%indvars.iv.next419.2 = add nuw nsw i64 %indvars.iv418, 3
%arrayidx84.3 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next419.2
%48 = load i32, ptr %arrayidx84.3, align 4, !tbaa !24
%add85.3 = add nsw i32 %48, %add85.2
store i32 %add85.3, ptr %arrayidx84.3, align 4, !tbaa !24
%indvars.iv.next419.3 = add nuw nsw i64 %indvars.iv418, 4
%arrayidx84.4 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next419.3
%49 = load i32, ptr %arrayidx84.4, align 4, !tbaa !24
%add85.4 = add nsw i32 %49, %add85.3
store i32 %add85.4, ptr %arrayidx84.4, align 4, !tbaa !24
%indvars.iv.next419.4 = add nuw nsw i64 %indvars.iv418, 5
%exitcond422.not.4 = icmp eq i64 %indvars.iv.next419.4, 256
br i1 %exitcond422.not.4, label %for.cond91.preheader, label %for.body79, !llvm.loop !29
for.cond.cleanup94: ; preds = %for.cond.cleanup110
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %c, i8 0, i64 1024, i1 false)
br i1 %cmp365, label %for.body133.lr.ph, label %for.body151.preheader
for.body151.preheader: ; preds = %for.cond.cleanup94.thread, %for.cond147.preheader.loopexit, %for.cond.cleanup94
%.ph491 = phi i32 [ 0, %for.cond.cleanup94.thread ], [ 0, %for.cond.cleanup94 ], [ %.pre477.pre, %for.cond147.preheader.loopexit ]
br label %for.body151
for.body133.lr.ph: ; preds = %for.cond.cleanup94
%idxprom136 = sext i32 %index to i64
%invariant.gep383 = getelementptr i32, ptr %base, i64 %idxprom136
%xtraiter498 = and i64 %wide.trip.count432, 1
%50 = icmp eq i32 %count, 1
br i1 %50, label %for.cond147.preheader.loopexit.unr-lcssa, label %for.body133.lr.ph.new
for.body133.lr.ph.new: ; preds = %for.body133.lr.ph
%unroll_iter500 = and i64 %wide.trip.count432, 4294967294
br label %for.body133
for.body95: ; preds = %for.body95.lr.ph, %for.cond.cleanup110
%indvars.iv429 = phi i64 [ %38, %for.body95.lr.ph ], [ %indvars.iv.next430, %for.cond.cleanup110 ]
%indvar423 = phi i64 [ 0, %for.body95.lr.ph ], [ %indvar.next424, %for.cond.cleanup110 ]
%51 = mul nuw nsw i64 %indvars.iv429, %0
%gep486 = getelementptr i32, ptr %invariant.gep485, i64 %51
%52 = load i32, ptr %gep486, align 4, !tbaa !24
%shr101 = lshr i32 %52, 8
%and102 = and i32 %shr101, 255
%idxprom103 = zext i32 %and102 to i64
%arrayidx104 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom103
%53 = load i32, ptr %arrayidx104, align 4, !tbaa !24
%dec105 = add nsw i32 %53, -1
store i32 %dec105, ptr %arrayidx104, align 4, !tbaa !24
br i1 %cmp108377, label %for.body111.lr.ph, label %for.cond.cleanup110
for.body111.lr.ph: ; preds = %for.body95
%54 = mul i64 %41, %indvar423
%scevgep425 = getelementptr i8, ptr %43, i64 %54
%idxprom116 = sext i32 %dec105 to i64
%55 = mul nsw i64 %idxprom116, %0
%arrayidx117 = getelementptr inbounds i32, ptr %base, i64 %55
tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %arrayidx117, ptr align 4 %scevgep425, i64 %42, i1 false), !tbaa !24
br label %for.cond.cleanup110
for.cond.cleanup110: ; preds = %for.body111.lr.ph, %for.body95
%indvars.iv.next430 = add nsw i64 %indvars.iv429, -1
%indvar.next424 = add nuw nsw i64 %indvar423, 1
%exitcond433.not = icmp eq i64 %indvar.next424, %wide.trip.count432
br i1 %exitcond433.not, label %for.cond.cleanup94, label %for.body95, !llvm.loop !30
for.cond147.preheader.loopexit.unr-lcssa: ; preds = %for.body133, %for.body133.lr.ph
%indvars.iv434.unr = phi i64 [ 0, %for.body133.lr.ph ], [ %indvars.iv.next435.1, %for.body133 ]
%lcmp.mod499.not = icmp eq i64 %xtraiter498, 0
br i1 %lcmp.mod499.not, label %for.cond147.preheader.loopexit, label %for.body133.epil
for.body133.epil: ; preds = %for.cond147.preheader.loopexit.unr-lcssa
%56 = mul nuw nsw i64 %indvars.iv434.unr, %0
%gep384.epil = getelementptr i32, ptr %invariant.gep383, i64 %56
%57 = load i32, ptr %gep384.epil, align 4, !tbaa !24
%shr138.epil = lshr i32 %57, 16
%and139.epil = and i32 %shr138.epil, 255
%idxprom140.epil = zext i32 %and139.epil to i64
%arrayidx141.epil = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom140.epil
%58 = load i32, ptr %arrayidx141.epil, align 4, !tbaa !24
%inc142.epil = add nsw i32 %58, 1
store i32 %inc142.epil, ptr %arrayidx141.epil, align 4, !tbaa !24
br label %for.cond147.preheader.loopexit
for.cond147.preheader.loopexit: ; preds = %for.cond147.preheader.loopexit.unr-lcssa, %for.body133.epil
%.pre477.pre = load i32, ptr %c, align 16, !tbaa !24
br label %for.body151.preheader
for.body133: ; preds = %for.body133, %for.body133.lr.ph.new
%indvars.iv434 = phi i64 [ 0, %for.body133.lr.ph.new ], [ %indvars.iv.next435.1, %for.body133 ]
%niter501 = phi i64 [ 0, %for.body133.lr.ph.new ], [ %niter501.next.1, %for.body133 ]
%59 = mul nuw nsw i64 %indvars.iv434, %0
%gep384 = getelementptr i32, ptr %invariant.gep383, i64 %59
%60 = load i32, ptr %gep384, align 4, !tbaa !24
%shr138 = lshr i32 %60, 16
%and139 = and i32 %shr138, 255
%idxprom140 = zext i32 %and139 to i64
%arrayidx141 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom140
%61 = load i32, ptr %arrayidx141, align 4, !tbaa !24
%inc142 = add nsw i32 %61, 1
store i32 %inc142, ptr %arrayidx141, align 4, !tbaa !24
%indvars.iv.next435 = or i64 %indvars.iv434, 1
%62 = mul nuw nsw i64 %indvars.iv.next435, %0
%gep384.1 = getelementptr i32, ptr %invariant.gep383, i64 %62
%63 = load i32, ptr %gep384.1, align 4, !tbaa !24
%shr138.1 = lshr i32 %63, 16
%and139.1 = and i32 %shr138.1, 255
%idxprom140.1 = zext i32 %and139.1 to i64
%arrayidx141.1 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom140.1
%64 = load i32, ptr %arrayidx141.1, align 4, !tbaa !24
%inc142.1 = add nsw i32 %64, 1
store i32 %inc142.1, ptr %arrayidx141.1, align 4, !tbaa !24
%indvars.iv.next435.1 = add nuw nsw i64 %indvars.iv434, 2
%niter501.next.1 = add i64 %niter501, 2
%niter501.ncmp.1 = icmp eq i64 %niter501.next.1, %unroll_iter500
br i1 %niter501.ncmp.1, label %for.cond147.preheader.loopexit.unr-lcssa, label %for.body133, !llvm.loop !31
for.cond163.preheader: ; preds = %for.body151
br i1 %cmp365, label %for.body167.lr.ph, label %for.cond.cleanup166.thread
for.cond.cleanup166.thread: ; preds = %for.cond163.preheader
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %c, i8 0, i64 1024, i1 false)
br label %for.body223.preheader
for.body167.lr.ph: ; preds = %for.cond163.preheader
%idxprom171 = sext i32 %index to i64
%cmp180386 = icmp sgt i32 %size, 0
%65 = zext i32 %sub22 to i64
%66 = mul nuw i64 %0, %65
%67 = shl i64 %66, 2
%68 = mul nsw i64 %0, -4
%69 = shl nuw nsw i64 %0, 2
%wide.trip.count453 = zext i32 %count to i64
%invariant.gep487 = getelementptr i32, ptr %base, i64 %idxprom171
%70 = getelementptr i8, ptr %base, i64 %67
br label %for.body167
for.body151: ; preds = %for.body151, %for.body151.preheader
%71 = phi i32 [ %.ph491, %for.body151.preheader ], [ %add157.4, %for.body151 ]
%indvars.iv439 = phi i64 [ 1, %for.body151.preheader ], [ %indvars.iv.next440.4, %for.body151 ]
%arrayidx156 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv439
%72 = load i32, ptr %arrayidx156, align 4, !tbaa !24
%add157 = add nsw i32 %72, %71
store i32 %add157, ptr %arrayidx156, align 4, !tbaa !24
%indvars.iv.next440 = add nuw nsw i64 %indvars.iv439, 1
%arrayidx156.1 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next440
%73 = load i32, ptr %arrayidx156.1, align 4, !tbaa !24
%add157.1 = add nsw i32 %73, %add157
store i32 %add157.1, ptr %arrayidx156.1, align 4, !tbaa !24
%indvars.iv.next440.1 = add nuw nsw i64 %indvars.iv439, 2
%arrayidx156.2 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next440.1
%74 = load i32, ptr %arrayidx156.2, align 4, !tbaa !24
%add157.2 = add nsw i32 %74, %add157.1
store i32 %add157.2, ptr %arrayidx156.2, align 4, !tbaa !24
%indvars.iv.next440.2 = add nuw nsw i64 %indvars.iv439, 3
%arrayidx156.3 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next440.2
%75 = load i32, ptr %arrayidx156.3, align 4, !tbaa !24
%add157.3 = add nsw i32 %75, %add157.2
store i32 %add157.3, ptr %arrayidx156.3, align 4, !tbaa !24
%indvars.iv.next440.3 = add nuw nsw i64 %indvars.iv439, 4
%arrayidx156.4 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next440.3
%76 = load i32, ptr %arrayidx156.4, align 4, !tbaa !24
%add157.4 = add nsw i32 %76, %add157.3
store i32 %add157.4, ptr %arrayidx156.4, align 4, !tbaa !24
%indvars.iv.next440.4 = add nuw nsw i64 %indvars.iv439, 5
%exitcond443.not.4 = icmp eq i64 %indvars.iv.next440.4, 256
br i1 %exitcond443.not.4, label %for.cond163.preheader, label %for.body151, !llvm.loop !32
for.cond.cleanup166: ; preds = %for.cond.cleanup182
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %c, i8 0, i64 1024, i1 false)
br i1 %cmp365, label %for.body205.lr.ph, label %for.body223.preheader
for.body223.preheader: ; preds = %for.cond.cleanup166.thread, %for.cond219.preheader.loopexit, %for.cond.cleanup166
%.ph = phi i32 [ 0, %for.cond.cleanup166.thread ], [ 0, %for.cond.cleanup166 ], [ %.pre478.pre, %for.cond219.preheader.loopexit ]
br label %for.body223
for.body205.lr.ph: ; preds = %for.cond.cleanup166
%idxprom208 = sext i32 %index to i64
%invariant.gep392 = getelementptr i32, ptr %call, i64 %idxprom208
%xtraiter502 = and i64 %wide.trip.count453, 1
%77 = icmp eq i32 %count, 1
br i1 %77, label %for.cond219.preheader.loopexit.unr-lcssa, label %for.body205.lr.ph.new
for.body205.lr.ph.new: ; preds = %for.body205.lr.ph
%unroll_iter504 = and i64 %wide.trip.count453, 4294967294
br label %for.body205
for.body167: ; preds = %for.body167.lr.ph, %for.cond.cleanup182
%indvars.iv450 = phi i64 [ %65, %for.body167.lr.ph ], [ %indvars.iv.next451, %for.cond.cleanup182 ]
%indvar444 = phi i64 [ 0, %for.body167.lr.ph ], [ %indvar.next445, %for.cond.cleanup182 ]
%78 = mul nuw nsw i64 %indvars.iv450, %0
%gep488 = getelementptr i32, ptr %invariant.gep487, i64 %78
%79 = load i32, ptr %gep488, align 4, !tbaa !24
%shr173 = lshr i32 %79, 16
%and174 = and i32 %shr173, 255
%idxprom175 = zext i32 %and174 to i64
%arrayidx176 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom175
%80 = load i32, ptr %arrayidx176, align 4, !tbaa !24
%dec177 = add nsw i32 %80, -1
store i32 %dec177, ptr %arrayidx176, align 4, !tbaa !24
br i1 %cmp180386, label %for.body183.lr.ph, label %for.cond.cleanup182
for.body183.lr.ph: ; preds = %for.body167
%81 = mul i64 %68, %indvar444
%scevgep446 = getelementptr i8, ptr %70, i64 %81
%idxprom188 = sext i32 %dec177 to i64
%82 = mul nsw i64 %idxprom188, %0
%arrayidx189 = getelementptr inbounds i32, ptr %call, i64 %82
tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %arrayidx189, ptr align 4 %scevgep446, i64 %69, i1 false), !tbaa !24
br label %for.cond.cleanup182
for.cond.cleanup182: ; preds = %for.body183.lr.ph, %for.body167
%indvars.iv.next451 = add nsw i64 %indvars.iv450, -1
%indvar.next445 = add nuw nsw i64 %indvar444, 1
%exitcond454.not = icmp eq i64 %indvar.next445, %wide.trip.count453
br i1 %exitcond454.not, label %for.cond.cleanup166, label %for.body167, !llvm.loop !33
for.cond219.preheader.loopexit.unr-lcssa: ; preds = %for.body205, %for.body205.lr.ph
%indvars.iv455.unr = phi i64 [ 0, %for.body205.lr.ph ], [ %indvars.iv.next456.1, %for.body205 ]
%lcmp.mod503.not = icmp eq i64 %xtraiter502, 0
br i1 %lcmp.mod503.not, label %for.cond219.preheader.loopexit, label %for.body205.epil
for.body205.epil: ; preds = %for.cond219.preheader.loopexit.unr-lcssa
%83 = mul nuw nsw i64 %indvars.iv455.unr, %0
%gep393.epil = getelementptr i32, ptr %invariant.gep392, i64 %83
%84 = load i32, ptr %gep393.epil, align 4, !tbaa !24
%shr210.epil = lshr i32 %84, 24
%idxprom212.epil = zext i32 %shr210.epil to i64
%arrayidx213.epil = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom212.epil
%85 = load i32, ptr %arrayidx213.epil, align 4, !tbaa !24
%inc214.epil = add nsw i32 %85, 1
store i32 %inc214.epil, ptr %arrayidx213.epil, align 4, !tbaa !24
br label %for.cond219.preheader.loopexit
for.cond219.preheader.loopexit: ; preds = %for.cond219.preheader.loopexit.unr-lcssa, %for.body205.epil
%.pre478.pre = load i32, ptr %c, align 16, !tbaa !24
br label %for.body223.preheader
for.body205: ; preds = %for.body205, %for.body205.lr.ph.new
%indvars.iv455 = phi i64 [ 0, %for.body205.lr.ph.new ], [ %indvars.iv.next456.1, %for.body205 ]
%niter505 = phi i64 [ 0, %for.body205.lr.ph.new ], [ %niter505.next.1, %for.body205 ]
%86 = mul nuw nsw i64 %indvars.iv455, %0
%gep393 = getelementptr i32, ptr %invariant.gep392, i64 %86
%87 = load i32, ptr %gep393, align 4, !tbaa !24
%shr210 = lshr i32 %87, 24
%idxprom212 = zext i32 %shr210 to i64
%arrayidx213 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom212
%88 = load i32, ptr %arrayidx213, align 4, !tbaa !24
%inc214 = add nsw i32 %88, 1
store i32 %inc214, ptr %arrayidx213, align 4, !tbaa !24
%indvars.iv.next456 = or i64 %indvars.iv455, 1
%89 = mul nuw nsw i64 %indvars.iv.next456, %0
%gep393.1 = getelementptr i32, ptr %invariant.gep392, i64 %89
%90 = load i32, ptr %gep393.1, align 4, !tbaa !24
%shr210.1 = lshr i32 %90, 24
%idxprom212.1 = zext i32 %shr210.1 to i64
%arrayidx213.1 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom212.1
%91 = load i32, ptr %arrayidx213.1, align 4, !tbaa !24
%inc214.1 = add nsw i32 %91, 1
store i32 %inc214.1, ptr %arrayidx213.1, align 4, !tbaa !24
%indvars.iv.next456.1 = add nuw nsw i64 %indvars.iv455, 2
%niter505.next.1 = add i64 %niter505, 2
%niter505.ncmp.1 = icmp eq i64 %niter505.next.1, %unroll_iter504
br i1 %niter505.ncmp.1, label %for.cond219.preheader.loopexit.unr-lcssa, label %for.body205, !llvm.loop !34
for.cond235.preheader: ; preds = %for.body223
br i1 %cmp365, label %for.body239.lr.ph, label %for.cond.cleanup238
for.body239.lr.ph: ; preds = %for.cond235.preheader
%idxprom243 = sext i32 %index to i64
%cmp252395 = icmp sgt i32 %size, 0
%92 = zext i32 %sub22 to i64
%93 = mul nuw i64 %0, %92
%94 = shl i64 %93, 2
%95 = mul nsw i64 %0, -4
%96 = shl nuw nsw i64 %0, 2
%wide.trip.count474 = zext i32 %count to i64
%invariant.gep489 = getelementptr i32, ptr %call, i64 %idxprom243
%97 = getelementptr i8, ptr %call, i64 %94
br label %for.body239
for.body223: ; preds = %for.body223, %for.body223.preheader
%98 = phi i32 [ %.ph, %for.body223.preheader ], [ %add229.4, %for.body223 ]
%indvars.iv460 = phi i64 [ 1, %for.body223.preheader ], [ %indvars.iv.next461.4, %for.body223 ]
%arrayidx228 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv460
%99 = load i32, ptr %arrayidx228, align 4, !tbaa !24
%add229 = add nsw i32 %99, %98
store i32 %add229, ptr %arrayidx228, align 4, !tbaa !24
%indvars.iv.next461 = add nuw nsw i64 %indvars.iv460, 1
%arrayidx228.1 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next461
%100 = load i32, ptr %arrayidx228.1, align 4, !tbaa !24
%add229.1 = add nsw i32 %100, %add229
store i32 %add229.1, ptr %arrayidx228.1, align 4, !tbaa !24
%indvars.iv.next461.1 = add nuw nsw i64 %indvars.iv460, 2
%arrayidx228.2 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next461.1
%101 = load i32, ptr %arrayidx228.2, align 4, !tbaa !24
%add229.2 = add nsw i32 %101, %add229.1
store i32 %add229.2, ptr %arrayidx228.2, align 4, !tbaa !24
%indvars.iv.next461.2 = add nuw nsw i64 %indvars.iv460, 3
%arrayidx228.3 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next461.2
%102 = load i32, ptr %arrayidx228.3, align 4, !tbaa !24
%add229.3 = add nsw i32 %102, %add229.2
store i32 %add229.3, ptr %arrayidx228.3, align 4, !tbaa !24
%indvars.iv.next461.3 = add nuw nsw i64 %indvars.iv460, 4
%arrayidx228.4 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %indvars.iv.next461.3
%103 = load i32, ptr %arrayidx228.4, align 4, !tbaa !24
%add229.4 = add nsw i32 %103, %add229.3
store i32 %add229.4, ptr %arrayidx228.4, align 4, !tbaa !24
%indvars.iv.next461.4 = add nuw nsw i64 %indvars.iv460, 5
%exitcond464.not.4 = icmp eq i64 %indvars.iv.next461.4, 256
br i1 %exitcond464.not.4, label %for.cond235.preheader, label %for.body223, !llvm.loop !35
for.cond.cleanup238: ; preds = %for.cond.cleanup254, %for.cond235.preheader
tail call void @free(ptr noundef %call) #8
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %c) #8
ret void
for.body239: ; preds = %for.body239.lr.ph, %for.cond.cleanup254
%indvars.iv471 = phi i64 [ %92, %for.body239.lr.ph ], [ %indvars.iv.next472, %for.cond.cleanup254 ]
%indvar465 = phi i64 [ 0, %for.body239.lr.ph ], [ %indvar.next466, %for.cond.cleanup254 ]
%104 = mul nuw nsw i64 %indvars.iv471, %0
%gep490 = getelementptr i32, ptr %invariant.gep489, i64 %104
%105 = load i32, ptr %gep490, align 4, !tbaa !24
%shr245 = lshr i32 %105, 24
%idxprom247 = zext i32 %shr245 to i64
%arrayidx248 = getelementptr inbounds [256 x i32], ptr %c, i64 0, i64 %idxprom247
%106 = load i32, ptr %arrayidx248, align 4, !tbaa !24
%dec249 = add nsw i32 %106, -1
store i32 %dec249, ptr %arrayidx248, align 4, !tbaa !24
br i1 %cmp252395, label %for.body255.lr.ph, label %for.cond.cleanup254
for.body255.lr.ph: ; preds = %for.body239
%107 = mul i64 %95, %indvar465
%scevgep467 = getelementptr i8, ptr %97, i64 %107
%idxprom260 = sext i32 %dec249 to i64
%108 = mul nsw i64 %idxprom260, %0
%arrayidx261 = getelementptr inbounds i32, ptr %base, i64 %108
tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %arrayidx261, ptr align 4 %scevgep467, i64 %96, i1 false), !tbaa !24
br label %for.cond.cleanup254
for.cond.cleanup254: ; preds = %for.body255.lr.ph, %for.body239
%indvars.iv.next472 = add nsw i64 %indvars.iv471, -1
%indvar.next466 = add nuw nsw i64 %indvar465, 1
%exitcond475.not = icmp eq i64 %indvar.next466, %wide.trip.count474
br i1 %exitcond475.not, label %for.cond.cleanup238, label %for.body239, !llvm.loop !36
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 @nextint()
%cmp36 = icmp sgt i32 %call, 0
br i1 %cmp36, label %for.body.preheader, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
tail call void @rsorta_u32(ptr noundef nonnull @a, i32 noundef %call, i32 noundef 2, i32 noundef 1)
br label %for.cond.cleanup9
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %call to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body
tail call void @rsorta_u32(ptr noundef nonnull @a, i32 noundef %call, i32 noundef 2, i32 noundef 1)
br i1 %cmp36, label %for.body10.preheader, label %for.cond.cleanup9
for.body10.preheader: ; preds = %for.cond.cleanup
%xtraiter = and i64 %wide.trip.count, 1
%0 = icmp eq i32 %call, 1
br i1 %0, label %for.cond.cleanup9.loopexit.unr-lcssa, label %for.body10.preheader.new
for.body10.preheader.new: ; preds = %for.body10.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body10
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds [100000 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv
%1 = trunc i64 %indvars.iv to i32
store i32 %1, ptr %arrayidx, align 8, !tbaa !24
%call2 = tail call i32 @nextint()
%arrayidx5 = getelementptr inbounds [100000 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv, i64 1
store i32 %call2, ptr %arrayidx5, align 4, !tbaa !24
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !37
for.cond.cleanup9.loopexit.unr-lcssa.loopexit: ; preds = %for.body10
%2 = shl nsw i64 %add.1, 1
%3 = add nsw i32 %ans.1.1, 1
br label %for.cond.cleanup9.loopexit.unr-lcssa
for.cond.cleanup9.loopexit.unr-lcssa: ; preds = %for.cond.cleanup9.loopexit.unr-lcssa.loopexit, %for.body10.preheader
%ans.1.lcssa.ph = phi i32 [ undef, %for.body10.preheader ], [ %ans.1.1, %for.cond.cleanup9.loopexit.unr-lcssa.loopexit ]
%indvars.iv43.unr = phi i64 [ 0, %for.body10.preheader ], [ %indvars.iv.next44.1, %for.cond.cleanup9.loopexit.unr-lcssa.loopexit ]
%ans.040.unr = phi i32 [ 1, %for.body10.preheader ], [ %3, %for.cond.cleanup9.loopexit.unr-lcssa.loopexit ]
%sum.039.unr = phi i64 [ 0, %for.body10.preheader ], [ %2, %for.cond.cleanup9.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup9, label %for.body10.epil
for.body10.epil: ; preds = %for.cond.cleanup9.loopexit.unr-lcssa
%arrayidx13.epil = getelementptr inbounds [100000 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv43.unr, i64 1
%4 = load i32, ptr %arrayidx13.epil, align 4, !tbaa !24
%conv.epil = sext i32 %4 to i64
%cmp14.not.epil = icmp slt i64 %sum.039.unr, %conv.epil
%ans.1.epil = select i1 %cmp14.not.epil, i32 1, i32 %ans.040.unr
br label %for.cond.cleanup9
for.cond.cleanup9: ; preds = %for.body10.epil, %for.cond.cleanup9.loopexit.unr-lcssa, %for.cond.cleanup.thread, %for.cond.cleanup
%ans.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ 0, %for.cond.cleanup.thread ], [ %ans.1.lcssa.ph, %for.cond.cleanup9.loopexit.unr-lcssa ], [ %ans.1.epil, %for.body10.epil ]
%call24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %ans.0.lcssa)
ret i32 0
for.body10: ; preds = %for.body10, %for.body10.preheader.new
%indvars.iv43 = phi i64 [ 0, %for.body10.preheader.new ], [ %indvars.iv.next44.1, %for.body10 ]
%ans.040 = phi i32 [ 0, %for.body10.preheader.new ], [ %ans.1.1, %for.body10 ]
%sum.039 = phi i64 [ 0, %for.body10.preheader.new ], [ %add.1, %for.body10 ]
%niter = phi i64 [ 0, %for.body10.preheader.new ], [ %niter.next.1, %for.body10 ]
%arrayidx13 = getelementptr inbounds [100000 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv43, i64 1
%5 = load i32, ptr %arrayidx13, align 4, !tbaa !24
%conv = sext i32 %5 to i64
%mul = shl nsw i64 %sum.039, 1
%cmp14.not = icmp slt i64 %mul, %conv
%6 = add nsw i32 %ans.040, 2
%add = add nsw i64 %sum.039, %conv
%indvars.iv.next44 = or i64 %indvars.iv43, 1
%arrayidx13.1 = getelementptr inbounds [100000 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv.next44, i64 1
%7 = load i32, ptr %arrayidx13.1, align 4, !tbaa !24
%conv.1 = sext i32 %7 to i64
%mul.1 = shl nsw i64 %add, 1
%cmp14.not.1 = icmp slt i64 %mul.1, %conv.1
%inc16.1 = select i1 %cmp14.not, i32 2, i32 %6
%ans.1.1 = select i1 %cmp14.not.1, i32 1, i32 %inc16.1
%add.1 = add nsw i64 %add, %conv.1
%indvars.iv.next44.1 = add nuw nsw i64 %indvars.iv43, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup9.loopexit.unr-lcssa.loopexit, label %for.body10, !llvm.loop !38
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
declare i32 @__uflow(ptr noundef) local_unnamed_addr #6
; 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) #7
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 = { 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #6 = { "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 #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind }
attributes #9 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_IO_FILE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !12, i64 120, !13, i64 128, !7, i64 130, !7, i64 131, !6, i64 136, !12, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !12, i64 184, !11, i64 192, !7, i64 196}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !6, i64 16}
!15 = !{!"branch_weights", i32 2000, i32 1}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}
!23 = distinct !{!23, !18}
!24 = !{!11, !11, i64 0}
!25 = distinct !{!25, !18}
!26 = distinct !{!26, !18}
!27 = distinct !{!27, !18}
!28 = distinct !{!28, !18}
!29 = distinct !{!29, !18}
!30 = distinct !{!30, !18}
!31 = distinct !{!31, !18}
!32 = distinct !{!32, !18}
!33 = distinct !{!33, !18}
!34 = distinct !{!34, !18}
!35 = distinct !{!35, !18}
!36 = distinct !{!36, !18}
!37 = distinct !{!37, !18}
!38 = distinct !{!38, !18}
|
#include<stdio.h>
int main()
{
int n, i;
char exp[8] = "I hate";
char exp2[8] = "I love";
scanf("%d", &n);
for(i=0; i<n; i++) {
if(i%2) printf(exp2);
else printf(exp);
if(i==n-1) {
printf(" it");
break;
}
else printf(" that ");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_32822/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_32822/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@__const.main.exp = private unnamed_addr constant [8 x i8] c"I hate\00\00", align 1
@__const.main.exp2 = private unnamed_addr constant [8 x i8] c"I love\00\00", align 1
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" it\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c" that \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp13 = icmp sgt i32 %0, 0
br i1 %cmp13, label %for.body, label %for.end
for.body: ; preds = %entry, %if.else7
%i.014 = phi i32 [ %inc, %if.else7 ], [ 0, %entry ]
%rem = and i32 %i.014, 1
%tobool.not = icmp eq i32 %rem, 0
%__const.main.exp.__const.main.exp2 = select i1 %tobool.not, ptr @__const.main.exp, ptr @__const.main.exp2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %__const.main.exp.__const.main.exp2)
%1 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%cmp4 = icmp eq i32 %i.014, %sub
br i1 %cmp4, label %if.then5, label %if.else7
if.then5: ; preds = %for.body
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %for.end
if.else7: ; preds = %for.body
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
%inc = add nuw nsw i32 %i.014, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %if.else7, %entry, %if.then5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int a,b;
scanf("%d%d",&a,&b);
if(a>=13) printf("%d\n",b);
else if(a>=6) printf("%d\n",b/2);
else printf("0\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328263/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328263/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 12
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%1 = load i32, ptr %b, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
br label %if.end7
if.else: ; preds = %entry
%cmp2 = icmp sgt i32 %0, 5
br i1 %cmp2, label %if.then3, label %if.else5
if.then3: ; preds = %if.else
%2 = load i32, ptr %b, align 4, !tbaa !5
%div = sdiv i32 %2, 2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
br label %if.end7
if.else5: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end7
if.end7: ; preds = %if.then3, %if.else5, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int A,B;
scanf("%d %d",&A,&B);
if(A>=13)
{
printf("%d\n",B);
}
else if(A<13 && A>5)
{
B=B*0.5;
printf("%d\n",B);
}
else
printf("0\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328306/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328306/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4
%cmp = icmp sgt i32 %0, 12
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%1 = load i32, ptr %B, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
br label %if.end9
if.else: ; preds = %entry
%cmp3 = icmp sgt i32 %0, 5
br i1 %cmp3, label %if.then4, label %if.else7
if.then4: ; preds = %if.else
%2 = load i32, ptr %B, align 4, !tbaa !5
%conv = sitofp i32 %2 to double
%mul = fmul double %conv, 5.000000e-01
%conv5 = fptosi double %mul to i32
store i32 %conv5, ptr %B, align 4, !tbaa !5
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv5)
br label %if.end9
if.else7: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end9
if.end9: ; preds = %if.then4, %if.else7, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
//Date:07-08-16
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<float.h>
#include<math.h>
#include<ctype.h>
#include<limits.h>
#include<time.h>
#define ll unsigned long long
#define For(i,n) for(i=0;i<n;i++)
#define rep(i ,a ,b) for(i=a;i<=b;i++)
#define mset(a ,value) memset(a ,value ,sizeof(a))
#define s(a) scanf("%d" ,&a);
#define ls(a) scanf("%ld" ,&a)
#define reg(i) register int i
#define MAX 35001
#define infinite INT_MAX
int min(int a,int b){ return (a<b?a:b); }
int max(int a,int b){ return (a>b?a:b); }
int main(){
char *A = "I hate that";
char *B = "I love that";
char *C = "I hate it";
char *D = "I love it";
int n ,i;
s(n);
rep(i ,1 ,n-1)
if(i%2!=0) printf("%s " ,A);
else printf("%s " ,B);
if(n%2==0) printf("%s" ,D);
else printf("%s" ,C);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_32835/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_32835/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"I hate that\00", align 1
@.str.1 = private unnamed_addr constant [12 x i8] c"I love that\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"I hate it\00", align 1
@.str.3 = private unnamed_addr constant [10 x i8] c"I love it\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.5 = private unnamed_addr constant [4 x i8] c"%s \00", align 1
@.str.6 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not13 = icmp sgt i32 %0, 1
br i1 %cmp.not.not13, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.014 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%rem = and i32 %i.014, 1
%cmp1.not = icmp eq i32 %rem, 0
%.str.1..str = select i1 %cmp1.not, ptr @.str.1, ptr @.str
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, ptr noundef nonnull %.str.1..str)
%inc = add nuw nsw i32 %i.014, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %inc, %1
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%2 = and i32 %.lcssa, 1
%cmp5 = icmp eq i32 %2, 0
%.str.3..str.2 = select i1 %cmp5, ptr @.str.3, ptr @.str.2
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, ptr noundef nonnull %.str.3..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int a,b;
scanf("%d %d",&a,&b);
if(a>=0&&a<=100&&b%2==0&&b>=2&&b<=1000)
{
if(a>=6&&a<=12)
{
printf("%d",b/2);
}
else if(a<6)
{
printf("0");
}
else
{
printf("%d",b);
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328393/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328393/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4
%or.cond = icmp ult i32 %0, 101
br i1 %or.cond, label %land.lhs.true2, label %if.end19
land.lhs.true2: ; preds = %entry
%1 = load i32, ptr %b, align 4
%2 = and i32 %1, 1
%cmp3 = icmp eq i32 %2, 0
%3 = add i32 %1, -2
%4 = icmp ult i32 %3, 999
%or.cond21 = and i1 %cmp3, %4
br i1 %or.cond21, label %if.then, label %if.end19
if.then: ; preds = %land.lhs.true2
%5 = add nsw i32 %0, -6
%or.cond22 = icmp ult i32 %5, 7
br i1 %or.cond22, label %if.then11, label %if.else
if.then11: ; preds = %if.then
%div24 = lshr i32 %1, 1
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div24)
br label %if.end19
if.else: ; preds = %if.then
%cmp13 = icmp ult i32 %0, 6
br i1 %cmp13, label %if.then14, label %if.else16
if.then14: ; preds = %if.else
%putchar = call i32 @putchar(i32 48)
br label %if.end19
if.else16: ; preds = %if.else
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
br label %if.end19
if.end19: ; preds = %if.then11, %if.else16, %if.then14, %land.lhs.true2, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(void){
int A,B;
scanf("%d %d",&A,&B);
if(A>= 13){
printf("%d\n",B);
}else if(A>=6){
printf("%d\n",B/2);
}else{
printf("0\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328436/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328436/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 12
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%1 = load i32, ptr %B, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
br label %if.end7
if.else: ; preds = %entry
%cmp2 = icmp sgt i32 %0, 5
br i1 %cmp2, label %if.then3, label %if.else5
if.then3: ; preds = %if.else
%2 = load i32, ptr %B, align 4, !tbaa !5
%div = sdiv i32 %2, 2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
br label %if.end7
if.else5: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end7
if.end7: ; preds = %if.then3, %if.else5, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int a,b;
scanf("%d%d", &a,&b);
if(b%2==0)
{
if(a>=13)
printf("%d\n", b );
else if(a<=12&&a>=6)
printf("%d", b/2);
else
printf("0");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328487/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328487/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = and i32 %0, 1
%cmp = icmp eq i32 %1, 0
br i1 %cmp, label %if.then, label %if.end11
if.then: ; preds = %entry
%2 = load i32, ptr %a, align 4
%cmp1 = icmp sgt i32 %2, 12
br i1 %cmp1, label %if.then2, label %if.else
if.then2: ; preds = %if.then
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
br label %if.end11
if.else: ; preds = %if.then
%cmp5 = icmp sgt i32 %2, 5
br i1 %cmp5, label %if.then6, label %if.else8
if.then6: ; preds = %if.else
%div = sdiv i32 %0, 2
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %div)
br label %if.end11
if.else8: ; preds = %if.else
%putchar = call i32 @putchar(i32 48)
br label %if.end11
if.end11: ; preds = %if.then2, %if.else8, %if.then6, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main() {
int i, n, tmp, total;
scanf("%d", &n);
total = 0;
for (i = 0; i < n; ++i) {
--total;
scanf("%d", &tmp);
total += tmp;
printf("%d\n", !(total % 2) + 1);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_32853/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_32853/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%tmp = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tmp) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %0, 0
br i1 %cmp7, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%total.09 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%dec = add nsw i32 %total.09, -1
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tmp)
%1 = load i32, ptr %tmp, align 4, !tbaa !5
%add = add nsw i32 %dec, %1
%2 = and i32 %add, 1
%add2 = sub nuw nsw i32 2, %2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add2)
%inc = add nuw nsw i32 %i.08, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tmp) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int main (){
int n =0, a=0;
scanf("%d %d", &n,&a);
if (n<=5) printf("0");
else if (n<=12) printf("%d",a/2);
else printf("%d",a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328588/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328588/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
store i32 0, ptr %n, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
store i32 0, ptr %a, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 6
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%putchar = call i32 @putchar(i32 48)
br label %if.end7
if.else: ; preds = %entry
%cmp2 = icmp ult i32 %0, 13
%1 = load i32, ptr %a, align 4, !tbaa !5
br i1 %cmp2, label %if.then3, label %if.else5
if.then3: ; preds = %if.else
%div = sdiv i32 %1, 2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %div)
br label %if.end7
if.else5: ; preds = %if.else
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %1)
br label %if.end7
if.end7: ; preds = %if.then3, %if.else5, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int a, b;
scanf("%d%d", &a, &b);
if (a <= 5)
printf("%d\n", 0);
else if (a >= 6 && a <= 12)
printf("%d\n", b/2);
else
printf("%d\n", b);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328630/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328630/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4
%cmp = icmp slt i32 %0, 6
br i1 %cmp, label %if.end8, label %if.else
if.else: ; preds = %entry
%cmp3 = icmp ult i32 %0, 13
%1 = load i32, ptr %b, align 4, !tbaa !5
br i1 %cmp3, label %if.then4, label %if.end8
if.then4: ; preds = %if.else
%div = sdiv i32 %1, 2
br label %if.end8
if.end8: ; preds = %if.else, %entry, %if.then4
%div.sink = phi i32 [ %div, %if.then4 ], [ 0, %entry ], [ %1, %if.else ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int A,B;
scanf("%d%d",&A,&B);
if (A >= 13) {
printf("%d\n", B);
}
else if (6 <= A && A <= 12) {
printf("%d\n", B/2);
}
else {
printf("0\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328674/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328674/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4
%cmp = icmp sgt i32 %0, 12
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%1 = load i32, ptr %B, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
br label %if.end8
if.else: ; preds = %entry
%cmp2 = icmp sgt i32 %0, 5
br i1 %cmp2, label %if.then4, label %if.else6
if.then4: ; preds = %if.else
%2 = load i32, ptr %B, align 4, !tbaa !5
%div = sdiv i32 %2, 2
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
br label %if.end8
if.else6: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end8
if.end8: ; preds = %if.then4, %if.else6, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
// AOJ 2161 Defend the Bases
// 2018.3.9 bal4u
#include <stdio.h>
#include <string.h>
#include <math.h>
#define MAX 210
int hi[MAX], to[MAX][MAX];
char seen[MAX];
int match[MAX];
int bpm(int u);
int bipartiteMatching(int m, int n, int V)
{
int u, max;
memset(match, -1, V*sizeof(int));
max = 0;
for (u = 0; u < m; u++) {
memset(seen, 0, V);
if (bpm(u)) max++;
}
return max;
}
int bpm(int u)
{
int i, v;
for (i = 0; i < hi[u]; i++) {
v = to[u][i];
if (seen[v]) continue;
seen[v] = 1;
if (match[v] < 0 || bpm(match[v])) {
match[u] = v, match[v] = u;
return 1;
}
}
return 0;
}
//#define getchar_unlocked() getchar()
int in()
{
int n = 0;
int c = getchar_unlocked();
do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
while (c >= '0');
return n;
}
#define LIM 75
#define EPS 1e-8
typedef struct { int from, to; double d; } EDGE;
EDGE edge[10010], *tail;
typedef struct { int x, y, v; } TROOP;
TROOP troop[102];
typedef struct { int x, y; } BASE;
BASE base[102];
int N, M, V;
double dist(int t, int b) { return hypot(troop[t].x-base[b].x, troop[t].y-base[b].y); }
int check(double md)
{
EDGE *e;
memset(hi, 0, V << 2);
for (e = edge; e < tail; e++) {
if (e->d < md+EPS) to[e->from][hi[e->from]++] = e->to;
}
return bipartiteMatching(N, M, V) == M;
}
int main()
{
int i, j, lim;
double lb, ub, md;
EDGE *e;
while (N = in()) {
M = in(), V = N+M;
for (i = 0; i < N; i++) troop[i].x = in(), troop[i].y = in(), troop[i].v = in();
for (i = 0; i < M; i++) base[i].x = in(), base[i].y = in();
e = edge; for (i = 0; i < N; i++) for (j = 0; j < M; j++) {
e->from = i, e->to = N+j, e->d = dist(i, j) / troop[i].v, e++;
}
tail = e;
lb = 0, ub = 15000;
lim = LIM; while (lim--) {
md = 0.5*(lb+ub);
if (check(md)) ub = md; else lb = md;
}
printf("%.20lf\n", ub);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328724/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328724/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.TROOP = type { i32, i32, i32 }
%struct.BASE = type { i32, i32 }
%struct.EDGE = type { i32, i32, double }
%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
@match = dso_local local_unnamed_addr global [210 x i32] zeroinitializer, align 16
@seen = dso_local local_unnamed_addr global [210 x i8] zeroinitializer, align 16
@hi = dso_local local_unnamed_addr global [210 x i32] zeroinitializer, align 16
@to = dso_local local_unnamed_addr global [210 x [210 x i32]] zeroinitializer, align 16
@troop = dso_local local_unnamed_addr global [102 x %struct.TROOP] zeroinitializer, align 16
@base = dso_local local_unnamed_addr global [102 x %struct.BASE] zeroinitializer, align 16
@V = dso_local local_unnamed_addr global i32 0, align 4
@edge = dso_local global [10010 x %struct.EDGE] zeroinitializer, align 16
@tail = dso_local local_unnamed_addr global ptr null, align 8
@N = dso_local local_unnamed_addr global i32 0, align 4
@M = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [8 x i8] c"%.20lf\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @bipartiteMatching(i32 noundef %m, i32 noundef %n, i32 noundef %V) local_unnamed_addr #0 {
entry:
%conv = sext i32 %V to i64
%mul = shl nsw i64 %conv, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @match, i8 -1, i64 %mul, i1 false)
%cmp8 = icmp sgt i32 %m, 0
br i1 %cmp8, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%max.010 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%u.09 = phi i32 [ %inc3, %for.body ], [ 0, %entry ]
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @seen, i8 0, i64 %conv, i1 false)
%call = tail call i32 @bpm(i32 noundef %u.09), !range !5
%spec.select = add nuw nsw i32 %call, %max.010
%inc3 = add nuw nsw i32 %u.09, 1
%exitcond.not = icmp eq i32 %inc3, %m
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !6
for.end: ; preds = %for.body, %entry
%max.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
ret i32 %max.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @bpm(i32 noundef %u) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [210 x i32], ptr @hi, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !8
%cmp33 = icmp sgt i32 %0, 0
br i1 %cmp33, label %for.body, label %cleanup
for.body: ; preds = %entry, %for.inc
%1 = phi i32 [ %5, %for.inc ], [ %0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx4 = getelementptr inbounds [210 x [210 x i32]], ptr @to, i64 0, i64 %idxprom, i64 %indvars.iv
%2 = load i32, ptr %arrayidx4, align 4, !tbaa !8
%idxprom5 = sext i32 %2 to i64
%arrayidx6 = getelementptr inbounds [210 x i8], ptr @seen, i64 0, i64 %idxprom5
%3 = load i8, ptr %arrayidx6, align 1, !tbaa !12
%tobool.not = icmp eq i8 %3, 0
br i1 %tobool.not, label %if.end, label %for.inc
if.end: ; preds = %for.body
store i8 1, ptr %arrayidx6, align 1, !tbaa !12
%arrayidx10 = getelementptr inbounds [210 x i32], ptr @match, i64 0, i64 %idxprom5
%4 = load i32, ptr %arrayidx10, align 4, !tbaa !8
%cmp11 = icmp slt i32 %4, 0
br i1 %cmp11, label %if.then15, label %lor.lhs.false
lor.lhs.false: ; preds = %if.end
%call = tail call i32 @bpm(i32 noundef %4), !range !5
%tobool14.not = icmp eq i32 %call, 0
br i1 %tobool14.not, label %lor.lhs.false.for.inc_crit_edge, label %if.then15
lor.lhs.false.for.inc_crit_edge: ; preds = %lor.lhs.false
%.pre = load i32, ptr %arrayidx, align 4, !tbaa !8
br label %for.inc
if.then15: ; preds = %lor.lhs.false, %if.end
%arrayidx17 = getelementptr inbounds [210 x i32], ptr @match, i64 0, i64 %idxprom
store i32 %2, ptr %arrayidx17, align 4, !tbaa !8
store i32 %u, ptr %arrayidx10, align 4, !tbaa !8
br label %cleanup
for.inc: ; preds = %lor.lhs.false.for.inc_crit_edge, %for.body
%5 = phi i32 [ %.pre, %lor.lhs.false.for.inc_crit_edge ], [ %1, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %cleanup, !llvm.loop !13
cleanup: ; preds = %for.inc, %entry, %if.then15
%retval.0 = phi i32 [ 1, %if.then15 ], [ 0, %entry ], [ 0, %for.inc ]
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #3 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !14
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !16
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !20
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !21
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #7
%.pre17.pre = load ptr, ptr @stdin, align 8, !tbaa !14
br label %do.body.preheader
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !16
%3 = load i8, ptr %1, align 1, !tbaa !12
%conv3.i = zext i8 %3 to i32
br label %do.body.preheader
do.body.preheader: ; preds = %cond.true.i, %cond.false.i
%.ph = phi ptr [ %0, %cond.false.i ], [ %.pre17.pre, %cond.true.i ]
%c.0.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ]
br label %do.body
do.body: ; preds = %do.body.preheader, %getchar_unlocked.exit16
%4 = phi ptr [ %8, %getchar_unlocked.exit16 ], [ %.ph, %do.body.preheader ]
%n.0 = phi i32 [ %add2, %getchar_unlocked.exit16 ], [ 0, %do.body.preheader ]
%c.0 = phi i32 [ %cond.i12, %getchar_unlocked.exit16 ], [ %c.0.ph, %do.body.preheader ]
%add = mul i32 %n.0, 10
%and = and i32 %c.0, 15
%add2 = add nsw i32 %and, %add
%_IO_read_ptr.i7 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i7, align 8, !tbaa !16
%_IO_read_end.i8 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i8, align 8, !tbaa !20
%cmp.not.i9 = icmp ult ptr %5, %6
br i1 %cmp.not.i9, label %cond.false.i13, label %cond.true.i10, !prof !21
cond.true.i10: ; preds = %do.body
%call.i11 = tail call i32 @__uflow(ptr noundef nonnull %4) #7
%.pre = load ptr, ptr @stdin, align 8, !tbaa !14
br label %getchar_unlocked.exit16
cond.false.i13: ; preds = %do.body
%incdec.ptr.i14 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i14, ptr %_IO_read_ptr.i7, align 8, !tbaa !16
%7 = load i8, ptr %5, align 1, !tbaa !12
%conv3.i15 = zext i8 %7 to i32
br label %getchar_unlocked.exit16
getchar_unlocked.exit16: ; preds = %cond.true.i10, %cond.false.i13
%8 = phi ptr [ %.pre, %cond.true.i10 ], [ %4, %cond.false.i13 ]
%cond.i12 = phi i32 [ %call.i11, %cond.true.i10 ], [ %conv3.i15, %cond.false.i13 ]
%cmp = icmp sgt i32 %cond.i12, 47
br i1 %cmp, label %do.body, label %do.end, !llvm.loop !22
do.end: ; preds = %getchar_unlocked.exit16
ret i32 %add2
}
; Function Attrs: nounwind uwtable
define dso_local double @dist(i32 noundef %t, i32 noundef %b) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %t to i64
%arrayidx = getelementptr inbounds [102 x %struct.TROOP], ptr @troop, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !23
%idxprom1 = sext i32 %b to i64
%arrayidx2 = getelementptr inbounds [102 x %struct.BASE], ptr @base, i64 0, i64 %idxprom1
%1 = load i32, ptr %arrayidx2, align 8, !tbaa !25
%sub = sub nsw i32 %0, %1
%conv = sitofp i32 %sub to double
%y = getelementptr inbounds [102 x %struct.TROOP], ptr @troop, i64 0, i64 %idxprom, i32 1
%2 = load i32, ptr %y, align 4, !tbaa !27
%y8 = getelementptr inbounds [102 x %struct.BASE], ptr @base, i64 0, i64 %idxprom1, i32 1
%3 = load i32, ptr %y8, align 4, !tbaa !28
%sub9 = sub nsw i32 %2, %3
%conv10 = sitofp i32 %sub9 to double
%call = tail call double @hypot(double noundef %conv, double noundef %conv10) #7
ret double %call
}
; Function Attrs: nounwind
declare double @hypot(double noundef, double noundef) local_unnamed_addr #4
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @check(double noundef %md) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @V, align 4, !tbaa !8
%shl = shl i32 %0, 2
%conv = sext i32 %shl to i64
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @hi, i8 0, i64 %conv, i1 false)
%1 = load ptr, ptr @tail, align 8, !tbaa !14
%cmp16 = icmp ugt ptr %1, @edge
br i1 %cmp16, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%add = fadd double %md, 1.000000e-08
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%e.017 = phi ptr [ @edge, %for.body.lr.ph ], [ %incdec.ptr, %for.inc ]
%d = getelementptr inbounds %struct.EDGE, ptr %e.017, i64 0, i32 2
%2 = load double, ptr %d, align 8, !tbaa !29
%cmp2 = fcmp olt double %2, %add
br i1 %cmp2, label %if.then, label %for.inc
if.then: ; preds = %for.body
%to = getelementptr inbounds %struct.EDGE, ptr %e.017, i64 0, i32 1
%3 = load i32, ptr %to, align 4, !tbaa !32
%4 = load i32, ptr %e.017, align 8, !tbaa !33
%idxprom = sext i32 %4 to i64
%arrayidx6 = getelementptr inbounds [210 x i32], ptr @hi, i64 0, i64 %idxprom
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !8
%inc = add nsw i32 %5, 1
store i32 %inc, ptr %arrayidx6, align 4, !tbaa !8
%idxprom7 = sext i32 %5 to i64
%arrayidx8 = getelementptr inbounds [210 x [210 x i32]], ptr @to, i64 0, i64 %idxprom, i64 %idxprom7
store i32 %3, ptr %arrayidx8, align 4, !tbaa !8
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%incdec.ptr = getelementptr inbounds %struct.EDGE, ptr %e.017, i64 1
%cmp = icmp ult ptr %incdec.ptr, %1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !34
for.end: ; preds = %for.inc, %entry
%6 = load i32, ptr @N, align 4, !tbaa !8
%conv.i = sext i32 %0 to i64
%mul.i = shl nsw i64 %conv.i, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @match, i8 -1, i64 %mul.i, i1 false)
%cmp8.i = icmp sgt i32 %6, 0
br i1 %cmp8.i, label %for.body.i, label %bipartiteMatching.exit
for.body.i: ; preds = %for.end, %for.body.i
%max.010.i = phi i32 [ %spec.select.i, %for.body.i ], [ 0, %for.end ]
%u.09.i = phi i32 [ %inc3.i, %for.body.i ], [ 0, %for.end ]
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @seen, i8 0, i64 %conv.i, i1 false)
%call.i = tail call i32 @bpm(i32 noundef %u.09.i), !range !5
%spec.select.i = add nuw nsw i32 %call.i, %max.010.i
%inc3.i = add nuw nsw i32 %u.09.i, 1
%exitcond.not.i = icmp eq i32 %inc3.i, %6
br i1 %exitcond.not.i, label %bipartiteMatching.exit, label %for.body.i, !llvm.loop !6
bipartiteMatching.exit: ; preds = %for.body.i, %for.end
%max.0.lcssa.i = phi i32 [ 0, %for.end ], [ %spec.select.i, %for.body.i ]
%7 = load i32, ptr @M, align 4, !tbaa !8
%cmp9 = icmp eq i32 %max.0.lcssa.i, %7
%conv10 = zext i1 %cmp9 to i32
ret i32 %conv10
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
br label %while.cond
while.cond: ; preds = %while.end, %entry
%0 = load ptr, ptr @stdin, align 8, !tbaa !14
%_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !16
%_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !20
%cmp.not.i.i = icmp ult ptr %1, %2
br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !21
cond.true.i.i: ; preds = %while.cond
%call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #7
%.pre17.pre.i = load ptr, ptr @stdin, align 8, !tbaa !14
br label %do.body.i.preheader
cond.false.i.i: ; preds = %while.cond
%incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !16
%3 = load i8, ptr %1, align 1, !tbaa !12
%conv3.i.i = zext i8 %3 to i32
br label %do.body.i.preheader
do.body.i.preheader: ; preds = %cond.false.i.i, %cond.true.i.i
%.ph327 = phi ptr [ %0, %cond.false.i.i ], [ %.pre17.pre.i, %cond.true.i.i ]
%c.0.i.ph = phi i32 [ %conv3.i.i, %cond.false.i.i ], [ %call.i.i, %cond.true.i.i ]
br label %do.body.i
do.body.i: ; preds = %do.body.i.preheader, %getchar_unlocked.exit16.i
%4 = phi ptr [ %8, %getchar_unlocked.exit16.i ], [ %.ph327, %do.body.i.preheader ]
%n.0.i = phi i32 [ %add2.i, %getchar_unlocked.exit16.i ], [ 0, %do.body.i.preheader ]
%c.0.i = phi i32 [ %cond.i12.i, %getchar_unlocked.exit16.i ], [ %c.0.i.ph, %do.body.i.preheader ]
%add.i = mul i32 %n.0.i, 10
%and.i = and i32 %c.0.i, 15
%add2.i = add nsw i32 %and.i, %add.i
%_IO_read_ptr.i7.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i7.i, align 8, !tbaa !16
%_IO_read_end.i8.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i8.i, align 8, !tbaa !20
%cmp.not.i9.i = icmp ult ptr %5, %6
br i1 %cmp.not.i9.i, label %cond.false.i13.i, label %cond.true.i10.i, !prof !21
cond.true.i10.i: ; preds = %do.body.i
%call.i11.i = tail call i32 @__uflow(ptr noundef nonnull %4) #7
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !14
br label %getchar_unlocked.exit16.i
cond.false.i13.i: ; preds = %do.body.i
%incdec.ptr.i14.i = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i14.i, ptr %_IO_read_ptr.i7.i, align 8, !tbaa !16
%7 = load i8, ptr %5, align 1, !tbaa !12
%conv3.i15.i = zext i8 %7 to i32
br label %getchar_unlocked.exit16.i
getchar_unlocked.exit16.i: ; preds = %cond.false.i13.i, %cond.true.i10.i
%8 = phi ptr [ %.pre.i, %cond.true.i10.i ], [ %4, %cond.false.i13.i ]
%cond.i12.i = phi i32 [ %call.i11.i, %cond.true.i10.i ], [ %conv3.i15.i, %cond.false.i13.i ]
%cmp.i = icmp sgt i32 %cond.i12.i, 47
br i1 %cmp.i, label %do.body.i, label %in.exit, !llvm.loop !22
in.exit: ; preds = %getchar_unlocked.exit16.i
store i32 %add2.i, ptr @N, align 4, !tbaa !8
%tobool.not = icmp eq i32 %add2.i, 0
br i1 %tobool.not, label %while.end47, label %while.body
while.body: ; preds = %in.exit
%_IO_read_ptr.i.i71 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 1
%9 = load ptr, ptr %_IO_read_ptr.i.i71, align 8, !tbaa !16
%_IO_read_end.i.i72 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 2
%10 = load ptr, ptr %_IO_read_end.i.i72, align 8, !tbaa !20
%cmp.not.i.i73 = icmp ult ptr %9, %10
br i1 %cmp.not.i.i73, label %cond.false.i.i98, label %cond.true.i.i74, !prof !21
cond.true.i.i74: ; preds = %while.body
%call.i.i75 = tail call i32 @__uflow(ptr noundef nonnull %8) #7
%.pre17.pre.i76 = load ptr, ptr @stdin, align 8, !tbaa !14
br label %do.body.i80.preheader
cond.false.i.i98: ; preds = %while.body
%incdec.ptr.i.i99 = getelementptr inbounds i8, ptr %9, i64 1
store ptr %incdec.ptr.i.i99, ptr %_IO_read_ptr.i.i71, align 8, !tbaa !16
%11 = load i8, ptr %9, align 1, !tbaa !12
%conv3.i.i100 = zext i8 %11 to i32
br label %do.body.i80.preheader
do.body.i80.preheader: ; preds = %cond.false.i.i98, %cond.true.i.i74
%.ph326 = phi ptr [ %8, %cond.false.i.i98 ], [ %.pre17.pre.i76, %cond.true.i.i74 ]
%c.0.i82.ph = phi i32 [ %conv3.i.i100, %cond.false.i.i98 ], [ %call.i.i75, %cond.true.i.i74 ]
br label %do.body.i80
do.body.i80: ; preds = %do.body.i80.preheader, %getchar_unlocked.exit16.i92
%12 = phi ptr [ %16, %getchar_unlocked.exit16.i92 ], [ %.ph326, %do.body.i80.preheader ]
%n.0.i81 = phi i32 [ %add2.i85, %getchar_unlocked.exit16.i92 ], [ 0, %do.body.i80.preheader ]
%c.0.i82 = phi i32 [ %cond.i12.i93, %getchar_unlocked.exit16.i92 ], [ %c.0.i82.ph, %do.body.i80.preheader ]
%add.i83 = mul i32 %n.0.i81, 10
%and.i84 = and i32 %c.0.i82, 15
%add2.i85 = add nsw i32 %and.i84, %add.i83
%_IO_read_ptr.i7.i86 = getelementptr inbounds %struct._IO_FILE, ptr %12, i64 0, i32 1
%13 = load ptr, ptr %_IO_read_ptr.i7.i86, align 8, !tbaa !16
%_IO_read_end.i8.i87 = getelementptr inbounds %struct._IO_FILE, ptr %12, i64 0, i32 2
%14 = load ptr, ptr %_IO_read_end.i8.i87, align 8, !tbaa !20
%cmp.not.i9.i88 = icmp ult ptr %13, %14
br i1 %cmp.not.i9.i88, label %cond.false.i13.i95, label %cond.true.i10.i89, !prof !21
cond.true.i10.i89: ; preds = %do.body.i80
%call.i11.i90 = tail call i32 @__uflow(ptr noundef nonnull %12) #7
%.pre.i91 = load ptr, ptr @stdin, align 8, !tbaa !14
br label %getchar_unlocked.exit16.i92
cond.false.i13.i95: ; preds = %do.body.i80
%incdec.ptr.i14.i96 = getelementptr inbounds i8, ptr %13, i64 1
store ptr %incdec.ptr.i14.i96, ptr %_IO_read_ptr.i7.i86, align 8, !tbaa !16
%15 = load i8, ptr %13, align 1, !tbaa !12
%conv3.i15.i97 = zext i8 %15 to i32
br label %getchar_unlocked.exit16.i92
getchar_unlocked.exit16.i92: ; preds = %cond.false.i13.i95, %cond.true.i10.i89
%16 = phi ptr [ %.pre.i91, %cond.true.i10.i89 ], [ %12, %cond.false.i13.i95 ]
%cond.i12.i93 = phi i32 [ %call.i11.i90, %cond.true.i10.i89 ], [ %conv3.i15.i97, %cond.false.i13.i95 ]
%cmp.i94 = icmp sgt i32 %cond.i12.i93, 47
br i1 %cmp.i94, label %do.body.i80, label %in.exit101, !llvm.loop !22
in.exit101: ; preds = %getchar_unlocked.exit16.i92
store i32 %add2.i85, ptr @M, align 4, !tbaa !8
%17 = load i32, ptr @N, align 4, !tbaa !8
%add = add nsw i32 %17, %add2.i85
store i32 %add, ptr @V, align 4, !tbaa !8
%cmp263 = icmp sgt i32 %17, 0
br i1 %cmp263, label %for.body, label %for.cond9.preheader
for.cond9.preheader.loopexit: ; preds = %in.exit194
%.pre = load i32, ptr @M, align 4, !tbaa !8
br label %for.cond9.preheader
for.cond9.preheader: ; preds = %for.cond9.preheader.loopexit, %in.exit101
%18 = phi i32 [ %53, %for.cond9.preheader.loopexit ], [ %17, %in.exit101 ]
%19 = phi ptr [ %51, %for.cond9.preheader.loopexit ], [ %16, %in.exit101 ]
%20 = phi i32 [ %.pre, %for.cond9.preheader.loopexit ], [ %add2.i85, %in.exit101 ]
%cmp10265 = icmp sgt i32 %20, 0
br i1 %cmp10265, label %for.body11, label %for.cond23.preheader
for.body: ; preds = %in.exit101, %in.exit194
%21 = phi ptr [ %51, %in.exit194 ], [ %16, %in.exit101 ]
%22 = phi ptr [ %52, %in.exit194 ], [ %16, %in.exit101 ]
%indvars.iv = phi i64 [ %indvars.iv.next, %in.exit194 ], [ 0, %in.exit101 ]
%_IO_read_ptr.i.i102 = getelementptr inbounds %struct._IO_FILE, ptr %22, i64 0, i32 1
%23 = load ptr, ptr %_IO_read_ptr.i.i102, align 8, !tbaa !16
%_IO_read_end.i.i103 = getelementptr inbounds %struct._IO_FILE, ptr %22, i64 0, i32 2
%24 = load ptr, ptr %_IO_read_end.i.i103, align 8, !tbaa !20
%cmp.not.i.i104 = icmp ult ptr %23, %24
br i1 %cmp.not.i.i104, label %cond.false.i.i129, label %cond.true.i.i105, !prof !21
cond.true.i.i105: ; preds = %for.body
%call.i.i106 = tail call i32 @__uflow(ptr noundef nonnull %22) #7
%.pre17.pre.i107 = load ptr, ptr @stdin, align 8, !tbaa !14
br label %do.body.i111.preheader
cond.false.i.i129: ; preds = %for.body
%incdec.ptr.i.i130 = getelementptr inbounds i8, ptr %23, i64 1
store ptr %incdec.ptr.i.i130, ptr %_IO_read_ptr.i.i102, align 8, !tbaa !16
%25 = load i8, ptr %23, align 1, !tbaa !12
%conv3.i.i131 = zext i8 %25 to i32
br label %do.body.i111.preheader
do.body.i111.preheader: ; preds = %cond.false.i.i129, %cond.true.i.i105
%.ph324 = phi ptr [ %21, %cond.false.i.i129 ], [ %.pre17.pre.i107, %cond.true.i.i105 ]
%.ph325 = phi ptr [ %22, %cond.false.i.i129 ], [ %.pre17.pre.i107, %cond.true.i.i105 ]
%c.0.i113.ph = phi i32 [ %conv3.i.i131, %cond.false.i.i129 ], [ %call.i.i106, %cond.true.i.i105 ]
br label %do.body.i111
do.body.i111: ; preds = %do.body.i111.preheader, %getchar_unlocked.exit16.i123
%26 = phi ptr [ %31, %getchar_unlocked.exit16.i123 ], [ %.ph324, %do.body.i111.preheader ]
%27 = phi ptr [ %32, %getchar_unlocked.exit16.i123 ], [ %.ph325, %do.body.i111.preheader ]
%n.0.i112 = phi i32 [ %add2.i116, %getchar_unlocked.exit16.i123 ], [ 0, %do.body.i111.preheader ]
%c.0.i113 = phi i32 [ %cond.i12.i124, %getchar_unlocked.exit16.i123 ], [ %c.0.i113.ph, %do.body.i111.preheader ]
%add.i114 = mul i32 %n.0.i112, 10
%and.i115 = and i32 %c.0.i113, 15
%add2.i116 = add nsw i32 %and.i115, %add.i114
%_IO_read_ptr.i7.i117 = getelementptr inbounds %struct._IO_FILE, ptr %27, i64 0, i32 1
%28 = load ptr, ptr %_IO_read_ptr.i7.i117, align 8, !tbaa !16
%_IO_read_end.i8.i118 = getelementptr inbounds %struct._IO_FILE, ptr %27, i64 0, i32 2
%29 = load ptr, ptr %_IO_read_end.i8.i118, align 8, !tbaa !20
%cmp.not.i9.i119 = icmp ult ptr %28, %29
br i1 %cmp.not.i9.i119, label %cond.false.i13.i126, label %cond.true.i10.i120, !prof !21
cond.true.i10.i120: ; preds = %do.body.i111
%call.i11.i121 = tail call i32 @__uflow(ptr noundef nonnull %27) #7
%.pre.i122 = load ptr, ptr @stdin, align 8, !tbaa !14
br label %getchar_unlocked.exit16.i123
cond.false.i13.i126: ; preds = %do.body.i111
%incdec.ptr.i14.i127 = getelementptr inbounds i8, ptr %28, i64 1
store ptr %incdec.ptr.i14.i127, ptr %_IO_read_ptr.i7.i117, align 8, !tbaa !16
%30 = load i8, ptr %28, align 1, !tbaa !12
%conv3.i15.i128 = zext i8 %30 to i32
br label %getchar_unlocked.exit16.i123
getchar_unlocked.exit16.i123: ; preds = %cond.false.i13.i126, %cond.true.i10.i120
%31 = phi ptr [ %.pre.i122, %cond.true.i10.i120 ], [ %26, %cond.false.i13.i126 ]
%32 = phi ptr [ %.pre.i122, %cond.true.i10.i120 ], [ %27, %cond.false.i13.i126 ]
%cond.i12.i124 = phi i32 [ %call.i11.i121, %cond.true.i10.i120 ], [ %conv3.i15.i128, %cond.false.i13.i126 ]
%cmp.i125 = icmp sgt i32 %cond.i12.i124, 47
br i1 %cmp.i125, label %do.body.i111, label %in.exit132, !llvm.loop !22
in.exit132: ; preds = %getchar_unlocked.exit16.i123
%arrayidx = getelementptr inbounds [102 x %struct.TROOP], ptr @troop, i64 0, i64 %indvars.iv
store i32 %add2.i116, ptr %arrayidx, align 4, !tbaa !23
%_IO_read_ptr.i.i133 = getelementptr inbounds %struct._IO_FILE, ptr %32, i64 0, i32 1
%33 = load ptr, ptr %_IO_read_ptr.i.i133, align 8, !tbaa !16
%_IO_read_end.i.i134 = getelementptr inbounds %struct._IO_FILE, ptr %32, i64 0, i32 2
%34 = load ptr, ptr %_IO_read_end.i.i134, align 8, !tbaa !20
%cmp.not.i.i135 = icmp ult ptr %33, %34
br i1 %cmp.not.i.i135, label %cond.false.i.i160, label %cond.true.i.i136, !prof !21
cond.true.i.i136: ; preds = %in.exit132
%call.i.i137 = tail call i32 @__uflow(ptr noundef nonnull %32) #7
%.pre17.pre.i138 = load ptr, ptr @stdin, align 8, !tbaa !14
br label %do.body.i142.preheader
cond.false.i.i160: ; preds = %in.exit132
%incdec.ptr.i.i161 = getelementptr inbounds i8, ptr %33, i64 1
store ptr %incdec.ptr.i.i161, ptr %_IO_read_ptr.i.i133, align 8, !tbaa !16
%35 = load i8, ptr %33, align 1, !tbaa !12
%conv3.i.i162 = zext i8 %35 to i32
br label %do.body.i142.preheader
do.body.i142.preheader: ; preds = %cond.false.i.i160, %cond.true.i.i136
%.ph322 = phi ptr [ %31, %cond.false.i.i160 ], [ %.pre17.pre.i138, %cond.true.i.i136 ]
%.ph323 = phi ptr [ %32, %cond.false.i.i160 ], [ %.pre17.pre.i138, %cond.true.i.i136 ]
%c.0.i144.ph = phi i32 [ %conv3.i.i162, %cond.false.i.i160 ], [ %call.i.i137, %cond.true.i.i136 ]
br label %do.body.i142
do.body.i142: ; preds = %do.body.i142.preheader, %getchar_unlocked.exit16.i154
%36 = phi ptr [ %41, %getchar_unlocked.exit16.i154 ], [ %.ph322, %do.body.i142.preheader ]
%37 = phi ptr [ %42, %getchar_unlocked.exit16.i154 ], [ %.ph323, %do.body.i142.preheader ]
%n.0.i143 = phi i32 [ %add2.i147, %getchar_unlocked.exit16.i154 ], [ 0, %do.body.i142.preheader ]
%c.0.i144 = phi i32 [ %cond.i12.i155, %getchar_unlocked.exit16.i154 ], [ %c.0.i144.ph, %do.body.i142.preheader ]
%add.i145 = mul i32 %n.0.i143, 10
%and.i146 = and i32 %c.0.i144, 15
%add2.i147 = add nsw i32 %and.i146, %add.i145
%_IO_read_ptr.i7.i148 = getelementptr inbounds %struct._IO_FILE, ptr %37, i64 0, i32 1
%38 = load ptr, ptr %_IO_read_ptr.i7.i148, align 8, !tbaa !16
%_IO_read_end.i8.i149 = getelementptr inbounds %struct._IO_FILE, ptr %37, i64 0, i32 2
%39 = load ptr, ptr %_IO_read_end.i8.i149, align 8, !tbaa !20
%cmp.not.i9.i150 = icmp ult ptr %38, %39
br i1 %cmp.not.i9.i150, label %cond.false.i13.i157, label %cond.true.i10.i151, !prof !21
cond.true.i10.i151: ; preds = %do.body.i142
%call.i11.i152 = tail call i32 @__uflow(ptr noundef nonnull %37) #7
%.pre.i153 = load ptr, ptr @stdin, align 8, !tbaa !14
br label %getchar_unlocked.exit16.i154
cond.false.i13.i157: ; preds = %do.body.i142
%incdec.ptr.i14.i158 = getelementptr inbounds i8, ptr %38, i64 1
store ptr %incdec.ptr.i14.i158, ptr %_IO_read_ptr.i7.i148, align 8, !tbaa !16
%40 = load i8, ptr %38, align 1, !tbaa !12
%conv3.i15.i159 = zext i8 %40 to i32
br label %getchar_unlocked.exit16.i154
getchar_unlocked.exit16.i154: ; preds = %cond.false.i13.i157, %cond.true.i10.i151
%41 = phi ptr [ %.pre.i153, %cond.true.i10.i151 ], [ %36, %cond.false.i13.i157 ]
%42 = phi ptr [ %.pre.i153, %cond.true.i10.i151 ], [ %37, %cond.false.i13.i157 ]
%cond.i12.i155 = phi i32 [ %call.i11.i152, %cond.true.i10.i151 ], [ %conv3.i15.i159, %cond.false.i13.i157 ]
%cmp.i156 = icmp sgt i32 %cond.i12.i155, 47
br i1 %cmp.i156, label %do.body.i142, label %in.exit163, !llvm.loop !22
in.exit163: ; preds = %getchar_unlocked.exit16.i154
%y = getelementptr inbounds [102 x %struct.TROOP], ptr @troop, i64 0, i64 %indvars.iv, i32 1
store i32 %add2.i147, ptr %y, align 4, !tbaa !27
%_IO_read_ptr.i.i164 = getelementptr inbounds %struct._IO_FILE, ptr %41, i64 0, i32 1
%43 = load ptr, ptr %_IO_read_ptr.i.i164, align 8, !tbaa !16
%_IO_read_end.i.i165 = getelementptr inbounds %struct._IO_FILE, ptr %41, i64 0, i32 2
%44 = load ptr, ptr %_IO_read_end.i.i165, align 8, !tbaa !20
%cmp.not.i.i166 = icmp ult ptr %43, %44
br i1 %cmp.not.i.i166, label %cond.false.i.i191, label %cond.true.i.i167, !prof !21
cond.true.i.i167: ; preds = %in.exit163
%call.i.i168 = tail call i32 @__uflow(ptr noundef nonnull %41) #7
%.pre17.pre.i169 = load ptr, ptr @stdin, align 8, !tbaa !14
br label %do.body.i173.preheader
cond.false.i.i191: ; preds = %in.exit163
%incdec.ptr.i.i192 = getelementptr inbounds i8, ptr %43, i64 1
store ptr %incdec.ptr.i.i192, ptr %_IO_read_ptr.i.i164, align 8, !tbaa !16
%45 = load i8, ptr %43, align 1, !tbaa !12
%conv3.i.i193 = zext i8 %45 to i32
br label %do.body.i173.preheader
do.body.i173.preheader: ; preds = %cond.false.i.i191, %cond.true.i.i167
%.ph321 = phi ptr [ %41, %cond.false.i.i191 ], [ %.pre17.pre.i169, %cond.true.i.i167 ]
%c.0.i175.ph = phi i32 [ %conv3.i.i193, %cond.false.i.i191 ], [ %call.i.i168, %cond.true.i.i167 ]
br label %do.body.i173
do.body.i173: ; preds = %do.body.i173.preheader, %getchar_unlocked.exit16.i185
%46 = phi ptr [ %51, %getchar_unlocked.exit16.i185 ], [ %.ph321, %do.body.i173.preheader ]
%47 = phi ptr [ %52, %getchar_unlocked.exit16.i185 ], [ %.ph321, %do.body.i173.preheader ]
%n.0.i174 = phi i32 [ %add2.i178, %getchar_unlocked.exit16.i185 ], [ 0, %do.body.i173.preheader ]
%c.0.i175 = phi i32 [ %cond.i12.i186, %getchar_unlocked.exit16.i185 ], [ %c.0.i175.ph, %do.body.i173.preheader ]
%add.i176 = mul i32 %n.0.i174, 10
%and.i177 = and i32 %c.0.i175, 15
%add2.i178 = add nsw i32 %and.i177, %add.i176
%_IO_read_ptr.i7.i179 = getelementptr inbounds %struct._IO_FILE, ptr %47, i64 0, i32 1
%48 = load ptr, ptr %_IO_read_ptr.i7.i179, align 8, !tbaa !16
%_IO_read_end.i8.i180 = getelementptr inbounds %struct._IO_FILE, ptr %47, i64 0, i32 2
%49 = load ptr, ptr %_IO_read_end.i8.i180, align 8, !tbaa !20
%cmp.not.i9.i181 = icmp ult ptr %48, %49
br i1 %cmp.not.i9.i181, label %cond.false.i13.i188, label %cond.true.i10.i182, !prof !21
cond.true.i10.i182: ; preds = %do.body.i173
%call.i11.i183 = tail call i32 @__uflow(ptr noundef nonnull %47) #7
%.pre.i184 = load ptr, ptr @stdin, align 8, !tbaa !14
br label %getchar_unlocked.exit16.i185
cond.false.i13.i188: ; preds = %do.body.i173
%incdec.ptr.i14.i189 = getelementptr inbounds i8, ptr %48, i64 1
store ptr %incdec.ptr.i14.i189, ptr %_IO_read_ptr.i7.i179, align 8, !tbaa !16
%50 = load i8, ptr %48, align 1, !tbaa !12
%conv3.i15.i190 = zext i8 %50 to i32
br label %getchar_unlocked.exit16.i185
getchar_unlocked.exit16.i185: ; preds = %cond.false.i13.i188, %cond.true.i10.i182
%51 = phi ptr [ %.pre.i184, %cond.true.i10.i182 ], [ %46, %cond.false.i13.i188 ]
%52 = phi ptr [ %.pre.i184, %cond.true.i10.i182 ], [ %47, %cond.false.i13.i188 ]
%cond.i12.i186 = phi i32 [ %call.i11.i183, %cond.true.i10.i182 ], [ %conv3.i15.i190, %cond.false.i13.i188 ]
%cmp.i187 = icmp sgt i32 %cond.i12.i186, 47
br i1 %cmp.i187, label %do.body.i173, label %in.exit194, !llvm.loop !22
in.exit194: ; preds = %getchar_unlocked.exit16.i185
%v = getelementptr inbounds [102 x %struct.TROOP], ptr @troop, i64 0, i64 %indvars.iv, i32 2
store i32 %add2.i178, ptr %v, align 4, !tbaa !35
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%53 = load i32, ptr @N, align 4, !tbaa !8
%54 = sext i32 %53 to i64
%cmp = icmp slt i64 %indvars.iv.next, %54
br i1 %cmp, label %for.body, label %for.cond9.preheader.loopexit, !llvm.loop !36
for.cond23.preheader.loopexit: ; preds = %in.exit256
%.pre288 = load i32, ptr @N, align 4, !tbaa !8
br label %for.cond23.preheader
for.cond23.preheader: ; preds = %for.cond23.preheader.loopexit, %for.cond9.preheader
%55 = phi i32 [ %80, %for.cond23.preheader.loopexit ], [ %20, %for.cond9.preheader ]
%56 = phi i32 [ %.pre288, %for.cond23.preheader.loopexit ], [ %18, %for.cond9.preheader ]
%cmp24270 = icmp sgt i32 %56, 0
%57 = icmp sgt i32 %55, 0
%or.cond = and i1 %cmp24270, %57
br i1 %or.cond, label %for.cond26.preheader, label %for.end39
for.body11: ; preds = %for.cond9.preheader, %in.exit256
%58 = phi ptr [ %78, %in.exit256 ], [ %19, %for.cond9.preheader ]
%59 = phi ptr [ %79, %in.exit256 ], [ %19, %for.cond9.preheader ]
%indvars.iv279 = phi i64 [ %indvars.iv.next280, %in.exit256 ], [ 0, %for.cond9.preheader ]
%_IO_read_ptr.i.i195 = getelementptr inbounds %struct._IO_FILE, ptr %59, i64 0, i32 1
%60 = load ptr, ptr %_IO_read_ptr.i.i195, align 8, !tbaa !16
%_IO_read_end.i.i196 = getelementptr inbounds %struct._IO_FILE, ptr %59, i64 0, i32 2
%61 = load ptr, ptr %_IO_read_end.i.i196, align 8, !tbaa !20
%cmp.not.i.i197 = icmp ult ptr %60, %61
br i1 %cmp.not.i.i197, label %cond.false.i.i222, label %cond.true.i.i198, !prof !21
cond.true.i.i198: ; preds = %for.body11
%call.i.i199 = tail call i32 @__uflow(ptr noundef nonnull %59) #7
%.pre17.pre.i200 = load ptr, ptr @stdin, align 8, !tbaa !14
br label %do.body.i204.preheader
cond.false.i.i222: ; preds = %for.body11
%incdec.ptr.i.i223 = getelementptr inbounds i8, ptr %60, i64 1
store ptr %incdec.ptr.i.i223, ptr %_IO_read_ptr.i.i195, align 8, !tbaa !16
%62 = load i8, ptr %60, align 1, !tbaa !12
%conv3.i.i224 = zext i8 %62 to i32
br label %do.body.i204.preheader
do.body.i204.preheader: ; preds = %cond.false.i.i222, %cond.true.i.i198
%.ph318 = phi ptr [ %58, %cond.false.i.i222 ], [ %.pre17.pre.i200, %cond.true.i.i198 ]
%.ph319 = phi ptr [ %59, %cond.false.i.i222 ], [ %.pre17.pre.i200, %cond.true.i.i198 ]
%c.0.i206.ph = phi i32 [ %conv3.i.i224, %cond.false.i.i222 ], [ %call.i.i199, %cond.true.i.i198 ]
br label %do.body.i204
do.body.i204: ; preds = %do.body.i204.preheader, %getchar_unlocked.exit16.i216
%63 = phi ptr [ %68, %getchar_unlocked.exit16.i216 ], [ %.ph318, %do.body.i204.preheader ]
%64 = phi ptr [ %69, %getchar_unlocked.exit16.i216 ], [ %.ph319, %do.body.i204.preheader ]
%n.0.i205 = phi i32 [ %add2.i209, %getchar_unlocked.exit16.i216 ], [ 0, %do.body.i204.preheader ]
%c.0.i206 = phi i32 [ %cond.i12.i217, %getchar_unlocked.exit16.i216 ], [ %c.0.i206.ph, %do.body.i204.preheader ]
%add.i207 = mul i32 %n.0.i205, 10
%and.i208 = and i32 %c.0.i206, 15
%add2.i209 = add nsw i32 %and.i208, %add.i207
%_IO_read_ptr.i7.i210 = getelementptr inbounds %struct._IO_FILE, ptr %64, i64 0, i32 1
%65 = load ptr, ptr %_IO_read_ptr.i7.i210, align 8, !tbaa !16
%_IO_read_end.i8.i211 = getelementptr inbounds %struct._IO_FILE, ptr %64, i64 0, i32 2
%66 = load ptr, ptr %_IO_read_end.i8.i211, align 8, !tbaa !20
%cmp.not.i9.i212 = icmp ult ptr %65, %66
br i1 %cmp.not.i9.i212, label %cond.false.i13.i219, label %cond.true.i10.i213, !prof !21
cond.true.i10.i213: ; preds = %do.body.i204
%call.i11.i214 = tail call i32 @__uflow(ptr noundef nonnull %64) #7
%.pre.i215 = load ptr, ptr @stdin, align 8, !tbaa !14
br label %getchar_unlocked.exit16.i216
cond.false.i13.i219: ; preds = %do.body.i204
%incdec.ptr.i14.i220 = getelementptr inbounds i8, ptr %65, i64 1
store ptr %incdec.ptr.i14.i220, ptr %_IO_read_ptr.i7.i210, align 8, !tbaa !16
%67 = load i8, ptr %65, align 1, !tbaa !12
%conv3.i15.i221 = zext i8 %67 to i32
br label %getchar_unlocked.exit16.i216
getchar_unlocked.exit16.i216: ; preds = %cond.false.i13.i219, %cond.true.i10.i213
%68 = phi ptr [ %.pre.i215, %cond.true.i10.i213 ], [ %63, %cond.false.i13.i219 ]
%69 = phi ptr [ %.pre.i215, %cond.true.i10.i213 ], [ %64, %cond.false.i13.i219 ]
%cond.i12.i217 = phi i32 [ %call.i11.i214, %cond.true.i10.i213 ], [ %conv3.i15.i221, %cond.false.i13.i219 ]
%cmp.i218 = icmp sgt i32 %cond.i12.i217, 47
br i1 %cmp.i218, label %do.body.i204, label %in.exit225, !llvm.loop !22
in.exit225: ; preds = %getchar_unlocked.exit16.i216
%arrayidx14 = getelementptr inbounds [102 x %struct.BASE], ptr @base, i64 0, i64 %indvars.iv279
store i32 %add2.i209, ptr %arrayidx14, align 8, !tbaa !25
%_IO_read_ptr.i.i226 = getelementptr inbounds %struct._IO_FILE, ptr %68, i64 0, i32 1
%70 = load ptr, ptr %_IO_read_ptr.i.i226, align 8, !tbaa !16
%_IO_read_end.i.i227 = getelementptr inbounds %struct._IO_FILE, ptr %68, i64 0, i32 2
%71 = load ptr, ptr %_IO_read_end.i.i227, align 8, !tbaa !20
%cmp.not.i.i228 = icmp ult ptr %70, %71
br i1 %cmp.not.i.i228, label %cond.false.i.i253, label %cond.true.i.i229, !prof !21
cond.true.i.i229: ; preds = %in.exit225
%call.i.i230 = tail call i32 @__uflow(ptr noundef nonnull %68) #7
%.pre17.pre.i231 = load ptr, ptr @stdin, align 8, !tbaa !14
br label %do.body.i235.preheader
cond.false.i.i253: ; preds = %in.exit225
%incdec.ptr.i.i254 = getelementptr inbounds i8, ptr %70, i64 1
store ptr %incdec.ptr.i.i254, ptr %_IO_read_ptr.i.i226, align 8, !tbaa !16
%72 = load i8, ptr %70, align 1, !tbaa !12
%conv3.i.i255 = zext i8 %72 to i32
br label %do.body.i235.preheader
do.body.i235.preheader: ; preds = %cond.false.i.i253, %cond.true.i.i229
%.ph317 = phi ptr [ %68, %cond.false.i.i253 ], [ %.pre17.pre.i231, %cond.true.i.i229 ]
%c.0.i237.ph = phi i32 [ %conv3.i.i255, %cond.false.i.i253 ], [ %call.i.i230, %cond.true.i.i229 ]
br label %do.body.i235
do.body.i235: ; preds = %do.body.i235.preheader, %getchar_unlocked.exit16.i247
%73 = phi ptr [ %78, %getchar_unlocked.exit16.i247 ], [ %.ph317, %do.body.i235.preheader ]
%74 = phi ptr [ %79, %getchar_unlocked.exit16.i247 ], [ %.ph317, %do.body.i235.preheader ]
%n.0.i236 = phi i32 [ %add2.i240, %getchar_unlocked.exit16.i247 ], [ 0, %do.body.i235.preheader ]
%c.0.i237 = phi i32 [ %cond.i12.i248, %getchar_unlocked.exit16.i247 ], [ %c.0.i237.ph, %do.body.i235.preheader ]
%add.i238 = mul i32 %n.0.i236, 10
%and.i239 = and i32 %c.0.i237, 15
%add2.i240 = add nsw i32 %and.i239, %add.i238
%_IO_read_ptr.i7.i241 = getelementptr inbounds %struct._IO_FILE, ptr %74, i64 0, i32 1
%75 = load ptr, ptr %_IO_read_ptr.i7.i241, align 8, !tbaa !16
%_IO_read_end.i8.i242 = getelementptr inbounds %struct._IO_FILE, ptr %74, i64 0, i32 2
%76 = load ptr, ptr %_IO_read_end.i8.i242, align 8, !tbaa !20
%cmp.not.i9.i243 = icmp ult ptr %75, %76
br i1 %cmp.not.i9.i243, label %cond.false.i13.i250, label %cond.true.i10.i244, !prof !21
cond.true.i10.i244: ; preds = %do.body.i235
%call.i11.i245 = tail call i32 @__uflow(ptr noundef nonnull %74) #7
%.pre.i246 = load ptr, ptr @stdin, align 8, !tbaa !14
br label %getchar_unlocked.exit16.i247
cond.false.i13.i250: ; preds = %do.body.i235
%incdec.ptr.i14.i251 = getelementptr inbounds i8, ptr %75, i64 1
store ptr %incdec.ptr.i14.i251, ptr %_IO_read_ptr.i7.i241, align 8, !tbaa !16
%77 = load i8, ptr %75, align 1, !tbaa !12
%conv3.i15.i252 = zext i8 %77 to i32
br label %getchar_unlocked.exit16.i247
getchar_unlocked.exit16.i247: ; preds = %cond.false.i13.i250, %cond.true.i10.i244
%78 = phi ptr [ %.pre.i246, %cond.true.i10.i244 ], [ %73, %cond.false.i13.i250 ]
%79 = phi ptr [ %.pre.i246, %cond.true.i10.i244 ], [ %74, %cond.false.i13.i250 ]
%cond.i12.i248 = phi i32 [ %call.i11.i245, %cond.true.i10.i244 ], [ %conv3.i15.i252, %cond.false.i13.i250 ]
%cmp.i249 = icmp sgt i32 %cond.i12.i248, 47
br i1 %cmp.i249, label %do.body.i235, label %in.exit256, !llvm.loop !22
in.exit256: ; preds = %getchar_unlocked.exit16.i247
%y19 = getelementptr inbounds [102 x %struct.BASE], ptr @base, i64 0, i64 %indvars.iv279, i32 1
store i32 %add2.i240, ptr %y19, align 4, !tbaa !28
%indvars.iv.next280 = add nuw nsw i64 %indvars.iv279, 1
%80 = load i32, ptr @M, align 4, !tbaa !8
%81 = sext i32 %80 to i64
%cmp10 = icmp slt i64 %indvars.iv.next280, %81
br i1 %cmp10, label %for.body11, label %for.cond23.preheader.loopexit, !llvm.loop !37
for.cond26.preheader: ; preds = %for.cond23.preheader, %for.inc37
%82 = phi i32 [ %94, %for.inc37 ], [ %56, %for.cond23.preheader ]
%83 = phi i32 [ %95, %for.inc37 ], [ %55, %for.cond23.preheader ]
%indvars.iv285 = phi i64 [ %indvars.iv.next286, %for.inc37 ], [ 0, %for.cond23.preheader ]
%e.0272 = phi ptr [ %e.1.lcssa, %for.inc37 ], [ @edge, %for.cond23.preheader ]
%cmp27267 = icmp sgt i32 %83, 0
br i1 %cmp27267, label %for.body28.lr.ph, label %for.inc37
for.body28.lr.ph: ; preds = %for.cond26.preheader
%arrayidx.i = getelementptr inbounds [102 x %struct.TROOP], ptr @troop, i64 0, i64 %indvars.iv285
%y.i = getelementptr inbounds [102 x %struct.TROOP], ptr @troop, i64 0, i64 %indvars.iv285, i32 1
%v33 = getelementptr inbounds [102 x %struct.TROOP], ptr @troop, i64 0, i64 %indvars.iv285, i32 2
%84 = trunc i64 %indvars.iv285 to i32
br label %for.body28
for.body28: ; preds = %for.body28.lr.ph, %for.body28
%indvars.iv282 = phi i64 [ 0, %for.body28.lr.ph ], [ %indvars.iv.next283, %for.body28 ]
%e.1269 = phi ptr [ %e.0272, %for.body28.lr.ph ], [ %incdec.ptr, %for.body28 ]
store i32 %84, ptr %e.1269, align 8, !tbaa !33
%85 = load i32, ptr @N, align 4, !tbaa !8
%86 = trunc i64 %indvars.iv282 to i32
%add29 = add nsw i32 %85, %86
%to = getelementptr inbounds %struct.EDGE, ptr %e.1269, i64 0, i32 1
store i32 %add29, ptr %to, align 4, !tbaa !32
%87 = load i32, ptr %arrayidx.i, align 4, !tbaa !23
%arrayidx2.i = getelementptr inbounds [102 x %struct.BASE], ptr @base, i64 0, i64 %indvars.iv282
%88 = load i32, ptr %arrayidx2.i, align 8, !tbaa !25
%sub.i = sub nsw i32 %87, %88
%conv.i = sitofp i32 %sub.i to double
%89 = load i32, ptr %y.i, align 4, !tbaa !27
%y8.i = getelementptr inbounds [102 x %struct.BASE], ptr @base, i64 0, i64 %indvars.iv282, i32 1
%90 = load i32, ptr %y8.i, align 4, !tbaa !28
%sub9.i = sub nsw i32 %89, %90
%conv10.i = sitofp i32 %sub9.i to double
%call.i = tail call double @hypot(double noundef %conv.i, double noundef %conv10.i) #7
%91 = load i32, ptr %v33, align 4, !tbaa !35
%conv = sitofp i32 %91 to double
%div = fdiv double %call.i, %conv
%d = getelementptr inbounds %struct.EDGE, ptr %e.1269, i64 0, i32 2
store double %div, ptr %d, align 8, !tbaa !29
%incdec.ptr = getelementptr inbounds %struct.EDGE, ptr %e.1269, i64 1
%indvars.iv.next283 = add nuw nsw i64 %indvars.iv282, 1
%92 = load i32, ptr @M, align 4, !tbaa !8
%93 = sext i32 %92 to i64
%cmp27 = icmp slt i64 %indvars.iv.next283, %93
br i1 %cmp27, label %for.body28, label %for.inc37.loopexit, !llvm.loop !38
for.inc37.loopexit: ; preds = %for.body28
%.pre289 = load i32, ptr @N, align 4, !tbaa !8
br label %for.inc37
for.inc37: ; preds = %for.inc37.loopexit, %for.cond26.preheader
%94 = phi i32 [ %82, %for.cond26.preheader ], [ %.pre289, %for.inc37.loopexit ]
%95 = phi i32 [ %83, %for.cond26.preheader ], [ %92, %for.inc37.loopexit ]
%e.1.lcssa = phi ptr [ %e.0272, %for.cond26.preheader ], [ %incdec.ptr, %for.inc37.loopexit ]
%indvars.iv.next286 = add nuw nsw i64 %indvars.iv285, 1
%96 = sext i32 %94 to i64
%cmp24 = icmp slt i64 %indvars.iv.next286, %96
br i1 %cmp24, label %for.cond26.preheader, label %for.end39, !llvm.loop !39
for.end39: ; preds = %for.inc37, %for.cond23.preheader
%97 = phi i32 [ %55, %for.cond23.preheader ], [ %95, %for.inc37 ]
%e.0.lcssa = phi ptr [ @edge, %for.cond23.preheader ], [ %e.1.lcssa, %for.inc37 ]
store ptr %e.0.lcssa, ptr @tail, align 8, !tbaa !14
br label %while.body42
while.body42: ; preds = %for.end39, %check.exit
%98 = phi i32 [ %97, %for.end39 ], [ %106, %check.exit ]
%dec276 = phi i32 [ 74, %for.end39 ], [ %dec, %check.exit ]
%ub.0275 = phi double [ 1.500000e+04, %for.end39 ], [ %ub.0.mul, %check.exit ]
%lb.0274 = phi double [ 0.000000e+00, %for.end39 ], [ %mul.lb.0, %check.exit ]
%add43 = fadd double %lb.0274, %ub.0275
%mul = fmul double %add43, 5.000000e-01
%99 = load i32, ptr @V, align 4, !tbaa !8
%shl.i = shl i32 %99, 2
%conv.i257 = sext i32 %shl.i to i64
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @hi, i8 0, i64 %conv.i257, i1 false)
%100 = load ptr, ptr @tail, align 8, !tbaa !14
%cmp16.i = icmp ugt ptr %100, @edge
br i1 %cmp16.i, label %for.body.lr.ph.i, label %for.end.i
for.body.lr.ph.i: ; preds = %while.body42
%add.i260 = fadd double %mul, 1.000000e-08
br label %for.body.i
for.body.i: ; preds = %for.inc.i, %for.body.lr.ph.i
%e.017.i = phi ptr [ @edge, %for.body.lr.ph.i ], [ %incdec.ptr.i, %for.inc.i ]
%d.i = getelementptr inbounds %struct.EDGE, ptr %e.017.i, i64 0, i32 2
%101 = load double, ptr %d.i, align 8, !tbaa !29
%cmp2.i = fcmp olt double %101, %add.i260
br i1 %cmp2.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body.i
%to.i = getelementptr inbounds %struct.EDGE, ptr %e.017.i, i64 0, i32 1
%102 = load i32, ptr %to.i, align 4, !tbaa !32
%103 = load i32, ptr %e.017.i, align 8, !tbaa !33
%idxprom.i262 = sext i32 %103 to i64
%arrayidx6.i = getelementptr inbounds [210 x i32], ptr @hi, i64 0, i64 %idxprom.i262
%104 = load i32, ptr %arrayidx6.i, align 4, !tbaa !8
%inc.i = add nsw i32 %104, 1
store i32 %inc.i, ptr %arrayidx6.i, align 4, !tbaa !8
%idxprom7.i = sext i32 %104 to i64
%arrayidx8.i = getelementptr inbounds [210 x [210 x i32]], ptr @to, i64 0, i64 %idxprom.i262, i64 %idxprom7.i
store i32 %102, ptr %arrayidx8.i, align 4, !tbaa !8
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body.i
%incdec.ptr.i = getelementptr inbounds %struct.EDGE, ptr %e.017.i, i64 1
%cmp.i261 = icmp ult ptr %incdec.ptr.i, %100
br i1 %cmp.i261, label %for.body.i, label %for.end.i, !llvm.loop !34
for.end.i: ; preds = %for.inc.i, %while.body42
%105 = load i32, ptr @N, align 4, !tbaa !8
%conv.i.i = sext i32 %99 to i64
%mul.i.i = shl nsw i64 %conv.i.i, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @match, i8 -1, i64 %mul.i.i, i1 false)
%cmp8.i.i = icmp sgt i32 %105, 0
br i1 %cmp8.i.i, label %for.body.i.i, label %check.exit
for.body.i.i: ; preds = %for.end.i, %for.body.i.i
%max.010.i.i = phi i32 [ %spec.select.i.i, %for.body.i.i ], [ 0, %for.end.i ]
%u.09.i.i = phi i32 [ %inc3.i.i, %for.body.i.i ], [ 0, %for.end.i ]
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @seen, i8 0, i64 %conv.i.i, i1 false)
%call.i.i259 = tail call i32 @bpm(i32 noundef %u.09.i.i), !range !5
%spec.select.i.i = add nuw nsw i32 %call.i.i259, %max.010.i.i
%inc3.i.i = add nuw nsw i32 %u.09.i.i, 1
%exitcond.not.i.i = icmp eq i32 %inc3.i.i, %105
br i1 %exitcond.not.i.i, label %check.exit.loopexit, label %for.body.i.i, !llvm.loop !6
check.exit.loopexit: ; preds = %for.body.i.i
%.pre290 = load i32, ptr @M, align 4, !tbaa !8
br label %check.exit
check.exit: ; preds = %check.exit.loopexit, %for.end.i
%106 = phi i32 [ %98, %for.end.i ], [ %.pre290, %check.exit.loopexit ]
%max.0.lcssa.i.i = phi i32 [ 0, %for.end.i ], [ %spec.select.i.i, %check.exit.loopexit ]
%cmp9.i.not = icmp eq i32 %max.0.lcssa.i.i, %106
%mul.lb.0 = select i1 %cmp9.i.not, double %lb.0274, double %mul
%ub.0.mul = select i1 %cmp9.i.not, double %mul, double %ub.0275
%dec = add nsw i32 %dec276, -1
%tobool41.not = icmp eq i32 %dec276, 0
br i1 %tobool41.not, label %while.end, label %while.body42, !llvm.loop !41
while.end: ; preds = %check.exit
%call46 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %ub.0.mul)
br label %while.cond, !llvm.loop !42
while.end47: ; preds = %in.exit
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
declare i32 @__uflow(ptr noundef) local_unnamed_addr #6
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) 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 nounwind willreturn memory(argmem: write) }
attributes #2 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 #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 "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 = { 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 #6 = { "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 #7 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{i32 0, i32 2}
!6 = distinct !{!6, !7}
!7 = !{!"llvm.loop.mustprogress"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!10, !10, i64 0}
!13 = distinct !{!13, !7}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !10, i64 0}
!16 = !{!17, !15, i64 8}
!17 = !{!"_IO_FILE", !9, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !15, i64 48, !15, i64 56, !15, i64 64, !15, i64 72, !15, i64 80, !15, i64 88, !15, i64 96, !15, i64 104, !9, i64 112, !9, i64 116, !18, i64 120, !19, i64 128, !10, i64 130, !10, i64 131, !15, i64 136, !18, i64 144, !15, i64 152, !15, i64 160, !15, i64 168, !15, i64 176, !18, i64 184, !9, i64 192, !10, i64 196}
!18 = !{!"long", !10, i64 0}
!19 = !{!"short", !10, i64 0}
!20 = !{!17, !15, i64 16}
!21 = !{!"branch_weights", i32 2000, i32 1}
!22 = distinct !{!22, !7}
!23 = !{!24, !9, i64 0}
!24 = !{!"", !9, i64 0, !9, i64 4, !9, i64 8}
!25 = !{!26, !9, i64 0}
!26 = !{!"", !9, i64 0, !9, i64 4}
!27 = !{!24, !9, i64 4}
!28 = !{!26, !9, i64 4}
!29 = !{!30, !31, i64 8}
!30 = !{!"", !9, i64 0, !9, i64 4, !31, i64 8}
!31 = !{!"double", !10, i64 0}
!32 = !{!30, !9, i64 4}
!33 = !{!30, !9, i64 0}
!34 = distinct !{!34, !7}
!35 = !{!24, !9, i64 8}
!36 = distinct !{!36, !7}
!37 = distinct !{!37, !7}
!38 = distinct !{!38, !7}
!39 = distinct !{!39, !7, !40}
!40 = !{!"llvm.loop.unswitch.partial.disable"}
!41 = distinct !{!41, !7}
!42 = distinct !{!42, !7}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define DB double
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define rep(i,n) FOR(i,0,n)
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000001
#define NUM 200010
void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;}
void YN(int a){if(a==1)printf("Yes\n");if(a==0)printf("No\n");}
LL lpow(LL a,LL n){LL ans=pow(a,n)*10;if(ans%10<5)return ans/10;return ans/10+1;}
LL dup(LL a,LL d){if(a%d==0)return a/d;else return a/d+1;}
LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int lcmpr(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return -1;if(*(LL*)a<*(LL*)b)return 1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int ccmpr(const void* a,const void* b){return *(char*)b-*(char*)a;}
int scmp(const void* a,const void* b){return strcmp((char*)a,(char*)b);}
int scmpr(const void* a,const void* b){return strcmp((char*)b,(char*)a);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(&m,&d);x-=k*y;swap(&x,&y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}
int main(){
LL N,i,a=1,ans=0;
scanf("%lld",&N);
char S[N][11];
rep(i,N)scanf("%s",S[i]);
qsort(S,N,sizeof(S[0]),scmp);
rep(i,N-1){
if(strcmp(S[i],S[i+1])==0)a++;
else ans=MAX(ans,a),a=1;
}
ans=MAX(ans,a);
a=1;
rep(i,N-1){
if(strcmp(S[i],S[i+1])==0)a++;
else{
if(a==ans)printf("%s\n",S[i]);
a=1;
}
}
if(a==ans)printf("%s\n",S[N-1]);
//printf("%lld\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328782/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328782/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@fact = dso_local local_unnamed_addr global [200010 x i64] zeroinitializer, align 16
@finv = dso_local local_unnamed_addr global [200010 x i64] zeroinitializer, align 16
@inv = dso_local local_unnamed_addr global [200010 x i64] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.5 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
store i64 %1, ptr %a, align 8, !tbaa !5
store i64 %0, ptr %b, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @YN(i32 noundef %a) local_unnamed_addr #2 {
entry:
switch i32 %a, label %if.end4 [
i32 1, label %if.end4.sink.split
i32 0, label %if.then2
]
if.then2: ; preds = %entry
br label %if.end4.sink.split
if.end4.sink.split: ; preds = %entry, %if.then2
%str.sink = phi ptr [ @str.5, %if.then2 ], [ @str, %entry ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
br label %if.end4
if.end4: ; preds = %if.end4.sink.split, %entry
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local i64 @lpow(i64 noundef %a, i64 noundef %n) local_unnamed_addr #3 {
entry:
%conv = sitofp i64 %a to double
%conv1 = sitofp i64 %n to double
%call = tail call double @pow(double noundef %conv, double noundef %conv1) #18
%mul = fmul double %call, 1.000000e+01
%conv2 = fptosi double %mul to i64
%rem = srem i64 %conv2, 10
%cmp = icmp sgt i64 %rem, 4
%div = sdiv i64 %conv2, 10
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @dup(i64 noundef %a, i64 noundef %d) local_unnamed_addr #5 {
entry:
%rem = srem i64 %a, %d
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %a, %d
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @GCD(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
%cond5 = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
br label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.019 = phi i64 [ %cond, %entry ], [ %b.addr.018, %while.body ]
%b.addr.018 = phi i64 [ %cond5, %entry ], [ %rem, %while.body ]
%rem = srem i64 %a.addr.019, %b.addr.018
%cmp6.not = icmp eq i64 %rem, 0
br i1 %cmp6.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body
ret i64 %b.addr.018
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @LCM(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%cond.i = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
%cond5.i = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
br label %while.body.i
while.body.i: ; preds = %while.body.i, %entry
%a.addr.019.i = phi i64 [ %cond.i, %entry ], [ %b.addr.018.i, %while.body.i ]
%b.addr.018.i = phi i64 [ %cond5.i, %entry ], [ %rem.i, %while.body.i ]
%rem.i = srem i64 %a.addr.019.i, %b.addr.018.i
%cmp6.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp6.not.i, label %GCD.exit, label %while.body.i, !llvm.loop !9
GCD.exit: ; preds = %while.body.i
%mul = mul nsw i64 %b, %a
%div = sdiv i64 %mul, %b.addr.018.i
ret i64 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @lcmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #7 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp slt i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @lcmpr(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #7 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp slt i64 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ccmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #7 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !11
%conv = sext i8 %0 to i32
%1 = load i8, ptr %b, align 1, !tbaa !11
%conv1 = sext i8 %1 to i32
%sub = sub nsw i32 %conv, %conv1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ccmpr(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #7 {
entry:
%0 = load i8, ptr %b, align 1, !tbaa !11
%conv = sext i8 %0 to i32
%1 = load i8, ptr %a, align 1, !tbaa !11
%conv1 = sext i8 %1 to i32
%sub = sub nsw i32 %conv, %conv1
ret i32 %sub
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @scmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #8 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #19
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #9
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @scmpr(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #8 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #19
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @mod(i64 noundef %a, i64 noundef %m) local_unnamed_addr #5 {
entry:
%cmp = icmp slt i64 %a, 0
%rem = srem i64 %a, %m
%add = select i1 %cmp, i64 %m, i64 0
%retval.0 = add nsw i64 %rem, %add
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @DIV(i64 noundef %a, i64 noundef %d) local_unnamed_addr #10 {
entry:
br label %while.body
while.body: ; preds = %entry, %while.body
%y.018 = phi i64 [ 0, %entry ], [ %sub2, %while.body ]
%x.017 = phi i64 [ 1, %entry ], [ %y.018, %while.body ]
%m.016 = phi i64 [ 1000000007, %entry ], [ %sub.recomposed, %while.body ]
%d.addr.015 = phi i64 [ %d, %entry ], [ %m.016, %while.body ]
%div = sdiv i64 %d.addr.015, %m.016
%mul = mul nsw i64 %div, %m.016
%sub.recomposed = srem i64 %d.addr.015, %m.016
%mul1 = mul nsw i64 %div, %y.018
%sub2 = sub nsw i64 %x.017, %mul1
%tobool.not = icmp eq i64 %sub.recomposed, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %while.body
%cmp.i = icmp slt i64 %y.018, 0
%rem.i = srem i64 %y.018, 1000000007
%add.i = select i1 %cmp.i, i64 1000000007, i64 0
%retval.0.i = add nsw i64 %add.i, %rem.i
%mul3 = mul nsw i64 %retval.0.i, %a
%cmp.i6 = icmp slt i64 %mul3, 0
%rem.i7 = srem i64 %mul3, 1000000007
%add.i8 = select i1 %cmp.i6, i64 1000000007, i64 0
%retval.0.i9 = add nsw i64 %add.i8, %rem.i7
ret i64 %retval.0.i9
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @FAC(i64 noundef %a) local_unnamed_addr #10 {
entry:
%cmp.not7 = icmp slt i64 %a, 1
br i1 %cmp.not7, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %a, 1
%0 = icmp eq i64 %a, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %a, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%ans.09 = phi i64 [ 1, %for.body.preheader.new ], [ %ans.1.1, %for.body ]
%i.08 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%mul = mul nsw i64 %ans.09, %i.08
%cmp1 = icmp sgt i64 %mul, 1000000007
%rem = urem i64 %mul, 1000000007
%ans.1 = select i1 %cmp1, i64 %rem, i64 %mul
%inc = add nuw i64 %i.08, 1
%mul.1 = mul nsw i64 %ans.1, %inc
%cmp1.1 = icmp sgt i64 %mul.1, 1000000007
%rem.1 = urem i64 %mul.1, 1000000007
%ans.1.1 = select i1 %cmp1.1, i64 %rem.1, i64 %mul.1
%inc.1 = add nuw i64 %i.08, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !13
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%ans.1.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %ans.1.1, %for.body ]
%ans.09.unr = phi i64 [ 1, %for.body.preheader ], [ %ans.1.1, %for.body ]
%i.08.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%mul.epil = mul nsw i64 %ans.09.unr, %i.08.unr
%cmp1.epil = icmp sgt i64 %mul.epil, 1000000007
%rem.epil = urem i64 %mul.epil, 1000000007
%ans.1.epil = select i1 %cmp1.epil, i64 %rem.epil, i64 %mul.epil
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %ans.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %ans.1.epil, %for.body.epil ]
ret i64 %ans.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @POW(i64 noundef %a, i64 noundef %n) local_unnamed_addr #10 {
entry:
%cmp8 = icmp sgt i64 %n, 0
br i1 %cmp8, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end
%ans.011 = phi i64 [ %ans.1, %if.end ], [ 1, %entry ]
%n.addr.010 = phi i64 [ %shr, %if.end ], [ %n, %entry ]
%a.addr.09 = phi i64 [ %rem2, %if.end ], [ %a, %entry ]
%and = and i64 %n.addr.010, 1
%tobool.not = icmp eq i64 %and, 0
br i1 %tobool.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul nsw i64 %ans.011, %a.addr.09
%rem = srem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%ans.1 = phi i64 [ %rem, %if.then ], [ %ans.011, %while.body ]
%mul1 = mul nsw i64 %a.addr.09, %a.addr.09
%rem2 = urem i64 %mul1, 1000000007
%shr = lshr i64 %n.addr.010, 1
%cmp.not = icmp ult i64 %n.addr.010, 2
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %if.end, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %ans.1, %if.end ]
ret i64 %ans.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @comi() local_unnamed_addr #11 {
entry:
store i64 1, ptr getelementptr inbounds ([200010 x i64], ptr @fact, i64 0, i64 1), align 8, !tbaa !5
store i64 1, ptr @fact, align 16, !tbaa !5
store i64 1, ptr getelementptr inbounds ([200010 x i64], ptr @finv, i64 0, i64 1), align 8, !tbaa !5
store i64 1, ptr @finv, align 16, !tbaa !5
store i64 1, ptr getelementptr inbounds ([200010 x i64], ptr @inv, i64 0, i64 1), align 8, !tbaa !5
br label %for.body
for.body: ; preds = %entry, %for.body
%0 = phi i64 [ 1, %entry ], [ %rem12, %for.body ]
%1 = phi i64 [ 1, %entry ], [ %rem, %for.body ]
%i.026 = phi i64 [ 2, %entry ], [ %inc, %for.body ]
%mul = mul nsw i64 %1, %i.026
%rem = srem i64 %mul, 1000000007
%arrayidx1 = getelementptr inbounds [200010 x i64], ptr @fact, i64 0, i64 %i.026
store i64 %rem, ptr %arrayidx1, align 8, !tbaa !5
%rem2.rhs.trunc = trunc i64 %i.026 to i32
%rem224 = urem i32 1000000007, %rem2.rhs.trunc
%rem2.zext = zext i32 %rem224 to i64
%arrayidx3 = getelementptr inbounds [200010 x i64], ptr @inv, i64 0, i64 %rem2.zext
%2 = load i64, ptr %arrayidx3, align 8, !tbaa !5
%div25 = udiv i32 1000000007, %rem2.rhs.trunc
%div.zext = zext i32 %div25 to i64
%mul4 = mul nsw i64 %2, %div.zext
%rem5 = srem i64 %mul4, 1000000007
%sub6 = sub nsw i64 1000000007, %rem5
%arrayidx7 = getelementptr inbounds [200010 x i64], ptr @inv, i64 0, i64 %i.026
store i64 %sub6, ptr %arrayidx7, align 8, !tbaa !5
%mul11 = mul nuw nsw i64 %sub6, %0
%rem12 = urem i64 %mul11, 1000000007
%arrayidx13 = getelementptr inbounds [200010 x i64], ptr @finv, i64 0, i64 %i.026
store i64 %rem12, ptr %arrayidx13, align 8, !tbaa !5
%inc = add nuw nsw i64 %i.026, 1
%exitcond.not = icmp eq i64 %inc, 200010
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !15
for.end: ; preds = %for.body
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @com(i64 noundef %n, i64 noundef %k) local_unnamed_addr #12 {
entry:
%cmp = icmp slt i64 %n, %k
%0 = or i64 %k, %n
%1 = icmp slt i64 %0, 0
%or.cond8 = or i1 %cmp, %1
br i1 %or.cond8, label %return, label %if.end
if.end: ; preds = %entry
%arrayidx = getelementptr inbounds [200010 x i64], ptr @fact, i64 0, i64 %n
%2 = load i64, ptr %arrayidx, align 8, !tbaa !5
%arrayidx4 = getelementptr inbounds [200010 x i64], ptr @finv, i64 0, i64 %k
%3 = load i64, ptr %arrayidx4, align 8, !tbaa !5
%sub = sub nsw i64 %n, %k
%arrayidx5 = getelementptr inbounds [200010 x i64], ptr @finv, i64 0, i64 %sub
%4 = load i64, ptr %arrayidx5, align 8, !tbaa !5
%mul = mul nsw i64 %4, %3
%rem = srem i64 %mul, 1000000007
%mul6 = mul nsw i64 %rem, %2
%rem7 = srem i64 %mul6, 1000000007
br label %return
return: ; preds = %entry, %if.end
%retval.0 = phi i64 [ %rem7, %if.end ], [ 0, %entry ]
ret i64 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%N = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #18
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !5
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca [11 x i8], i64 %0, align 16
%2 = load i64, ptr %N, align 8, !tbaa !5
%cmp76 = icmp sgt i64 %2, 0
br i1 %cmp76, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.077 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [11 x i8], ptr %vla, i64 %i.077
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.077, 1
%3 = load i64, ptr %N, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !16
for.end: ; preds = %for.body, %entry
%.lcssa = phi i64 [ %2, %entry ], [ %3, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %.lcssa, i64 noundef 11, ptr noundef nonnull @scmp) #18
%4 = load i64, ptr %N, align 8, !tbaa !5
%sub = add i64 %4, -1
%cmp378 = icmp sgt i64 %4, 1
br i1 %cmp378, label %for.body4, label %if.then46
for.body4: ; preds = %for.end, %for.body4
%i.181 = phi i64 [ %add, %for.body4 ], [ 0, %for.end ]
%ans.080 = phi i64 [ %ans.1, %for.body4 ], [ 0, %for.end ]
%a.079 = phi i64 [ %a.1, %for.body4 ], [ 1, %for.end ]
%arrayidx5 = getelementptr inbounds [11 x i8], ptr %vla, i64 %i.181
%add = add nuw nsw i64 %i.181, 1
%arrayidx7 = getelementptr inbounds [11 x i8], ptr %vla, i64 %add
%call9 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx5, ptr noundef nonnull dereferenceable(1) %arrayidx7) #19
%cmp10 = icmp eq i32 %call9, 0
%inc11 = add nsw i64 %a.079, 1
%cond = call i64 @llvm.smax.i64(i64 %ans.080, i64 %a.079)
%a.1 = select i1 %cmp10, i64 %inc11, i64 1
%ans.1 = select i1 %cmp10, i64 %ans.080, i64 %cond
%exitcond.not = icmp eq i64 %add, %sub
br i1 %exitcond.not, label %for.end15, label %for.body4, !llvm.loop !17
for.end15: ; preds = %for.body4
%cond20 = call i64 @llvm.smax.i64(i64 %ans.1, i64 %a.1)
br i1 %cmp378, label %for.body24, label %for.end44
for.body24: ; preds = %for.end15, %for.inc42
%5 = phi i64 [ %6, %for.inc42 ], [ %4, %for.end15 ]
%i.287 = phi i64 [ %add27, %for.inc42 ], [ 0, %for.end15 ]
%a.286 = phi i64 [ %a.3, %for.inc42 ], [ 1, %for.end15 ]
%arrayidx25 = getelementptr inbounds [11 x i8], ptr %vla, i64 %i.287
%add27 = add nuw nsw i64 %i.287, 1
%arrayidx28 = getelementptr inbounds [11 x i8], ptr %vla, i64 %add27
%call30 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx25, ptr noundef nonnull dereferenceable(1) %arrayidx28) #19
%cmp31 = icmp eq i32 %call30, 0
br i1 %cmp31, label %if.then32, label %if.else34
if.then32: ; preds = %for.body24
%inc33 = add nsw i64 %a.286, 1
br label %for.inc42
if.else34: ; preds = %for.body24
%cmp35 = icmp eq i64 %a.286, %cond20
br i1 %cmp35, label %if.then36, label %for.inc42
if.then36: ; preds = %if.else34
%puts75 = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx25)
%.pre = load i64, ptr %N, align 8, !tbaa !5
br label %for.inc42
for.inc42: ; preds = %if.else34, %if.then36, %if.then32
%6 = phi i64 [ %5, %if.then32 ], [ %.pre, %if.then36 ], [ %5, %if.else34 ]
%a.3 = phi i64 [ %inc33, %if.then32 ], [ 1, %if.then36 ], [ 1, %if.else34 ]
%sub22 = add nsw i64 %6, -1
%cmp23 = icmp slt i64 %add27, %sub22
br i1 %cmp23, label %for.body24, label %for.end44, !llvm.loop !18
for.end44: ; preds = %for.inc42, %for.end15
%a.2.lcssa = phi i64 [ 1, %for.end15 ], [ %a.3, %for.inc42 ]
%sub22.lcssa = phi i64 [ %sub, %for.end15 ], [ %sub22, %for.inc42 ]
%cmp45 = icmp eq i64 %a.2.lcssa, %cond20
br i1 %cmp45, label %if.then46, label %if.end51
if.then46: ; preds = %for.end, %for.end44
%sub22.lcssa100 = phi i64 [ %sub22.lcssa, %for.end44 ], [ %sub, %for.end ]
%arrayidx48 = getelementptr inbounds [11 x i8], ptr %vla, i64 %sub22.lcssa100
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx48)
br label %if.end51
if.end51: ; preds = %if.then46, %for.end44
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #18
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #13
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #14
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #15
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #14
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #17
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #17
attributes #0 = { mustprogress nofree norecurse nosync 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress nofree nounwind willreturn memory(write) 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 = { mustprogress nofree nounwind willreturn memory(write) "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 nofree norecurse nosync nounwind willreturn memory(none) 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 #6 = { nofree nosync nounwind memory(none) 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 #7 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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 #8 = { mustprogress nofree nounwind willreturn memory(argmem: read) 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 #9 = { 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 #10 = { nofree norecurse nosync nounwind memory(none) 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 #11 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 #12 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) 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 #13 = { 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 #14 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #15 = { 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 #16 = { nofree nounwind }
attributes #17 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #18 = { nounwind }
attributes #19 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
|
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<limits.h>
#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int
int cmpAscStrings(const void* a, const void* b){
return strcmp(*(char**)a, *(char**)b);
}
void initStrArray(char** p, int n, int len){
for(int i=0; i<n; i++){
*(p + i) = (char*)malloc(sizeof(char) * (len + 1));
}
}
int main(){
int n;
scanf("%d", &n);
char* w[n];
initStrArray(w, n, 11);
rep(i, 0, n){
scanf("%s", w[i]);
}
qsort(w, n, sizeof(char*), cmpAscStrings);
int len = 0, buf = 1;
rep(i, 1, n){
if(strcmp(w[i-1], w[i]) == 0){
buf++;
}else{
buf = 1;
}
if(len < buf){
len = buf;
}
}
if(len < buf){
len = buf;
}
int x = 0;
while(x < n){
int cnt = 0;
int y = x;
rep(i, x, n){
y = i;
if(strcmp(w[x], w[i]) == 0){
cnt++;
}else{
y--;
break;
}
}
if(y-x+1 == len){
printf("%s\n", w[x]);
}
x = y + 1;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328825/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328825/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @cmpAscStrings(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load ptr, ptr %a, align 8, !tbaa !5
%1 = load ptr, ptr %b, align 8, !tbaa !5
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #11
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: nofree nounwind memory(argmem: write, inaccessiblemem: readwrite) uwtable
define dso_local void @initStrArray(ptr nocapture noundef writeonly %p, i32 noundef %n, i32 noundef %len) local_unnamed_addr #2 {
entry:
%cmp3 = icmp sgt i32 %n, 0
br i1 %cmp3, label %for.body.lr.ph, label %for.cond.cleanup
for.body.lr.ph: ; preds = %entry
%add = add nsw i32 %len, 1
%conv = sext i32 %add to i64
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret void
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call = tail call noalias ptr @malloc(i64 noundef %conv) #12
%add.ptr = getelementptr inbounds ptr, ptr %p, i64 %indvars.iv
store ptr %call, ptr %add.ptr, align 8, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; 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
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #13
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca ptr, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !11
%cmp3.i = icmp sgt i32 %3, 0
br i1 %cmp3.i, label %for.body.lr.ph.i, label %initStrArray.exit.for.cond.cleanup_crit_edge
for.body.lr.ph.i: ; preds = %entry
%wide.trip.count.i = zext i32 %3 to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.lr.ph.i
%indvars.iv.i = phi i64 [ 0, %for.body.lr.ph.i ], [ %indvars.iv.next.i, %for.body.i ]
%call.i = call noalias dereferenceable_or_null(12) ptr @malloc(i64 noundef 12) #12
%add.ptr.i = getelementptr inbounds ptr, ptr %vla, i64 %indvars.iv.i
store ptr %call.i, ptr %add.ptr.i, align 8, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %initStrArray.exit, label %for.body.i, !llvm.loop !9
initStrArray.exit: ; preds = %for.body.i
br i1 %cmp3.i, label %for.body, label %initStrArray.exit.for.cond.cleanup_crit_edge
initStrArray.exit.for.cond.cleanup_crit_edge: ; preds = %entry, %initStrArray.exit
%.pre108 = sext i32 %3 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %initStrArray.exit.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre108, %initStrArray.exit.for.cond.cleanup_crit_edge ], [ %7, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @cmpAscStrings) #13
%4 = load i32, ptr %n, align 4, !tbaa !11
%cmp488 = icmp sgt i32 %4, 1
br i1 %cmp488, label %for.body7.preheader, label %for.cond.cleanup6
for.body7.preheader: ; preds = %for.cond.cleanup
%wide.trip.count = zext i32 %4 to i64
%.pre = load ptr, ptr %vla, align 16, !tbaa !5
br label %for.body7
for.body: ; preds = %initStrArray.exit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %initStrArray.exit ]
%arrayidx = getelementptr inbounds ptr, ptr %vla, i64 %indvars.iv
%5 = load ptr, ptr %arrayidx, align 8, !tbaa !5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %5)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !11
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.cond.cleanup6: ; preds = %for.body7, %for.cond.cleanup
%len.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %len.1, %for.body7 ]
%buf.0.lcssa = phi i32 [ 1, %for.cond.cleanup ], [ %buf.1, %for.body7 ]
%spec.select = call i32 @llvm.smax.i32(i32 %len.0.lcssa, i32 %buf.0.lcssa)
%cmp2795 = icmp sgt i32 %4, 0
br i1 %cmp2795, label %for.cond30.preheader, label %while.end
for.body7: ; preds = %for.body7.preheader, %for.body7
%8 = phi ptr [ %.pre, %for.body7.preheader ], [ %9, %for.body7 ]
%indvars.iv100 = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next101, %for.body7 ]
%buf.090 = phi i32 [ 1, %for.body7.preheader ], [ %buf.1, %for.body7 ]
%len.089 = phi i32 [ 0, %for.body7.preheader ], [ %len.1, %for.body7 ]
%arrayidx11 = getelementptr inbounds ptr, ptr %vla, i64 %indvars.iv100
%9 = load ptr, ptr %arrayidx11, align 8, !tbaa !5
%call12 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) %9) #11
%cmp13 = icmp eq i32 %call12, 0
%inc15 = add nsw i32 %buf.090, 1
%buf.1 = select i1 %cmp13, i32 %inc15, i32 1
%len.1 = call i32 @llvm.smax.i32(i32 %len.089, i32 %buf.1)
%indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
%exitcond.not = icmp eq i64 %indvars.iv.next101, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup6, label %for.body7, !llvm.loop !14
for.cond30.preheader: ; preds = %for.cond.cleanup6, %if.end56
%10 = phi i32 [ %16, %if.end56 ], [ %4, %for.cond.cleanup6 ]
%x.096 = phi i32 [ %add57, %if.end56 ], [ 0, %for.cond.cleanup6 ]
%idxprom35 = sext i32 %x.096 to i64
%arrayidx36 = getelementptr inbounds ptr, ptr %vla, i64 %idxprom35
%11 = load ptr, ptr %arrayidx36, align 8, !tbaa !5
%12 = sext i32 %10 to i64
br label %for.body34
for.body34: ; preds = %for.cond30.preheader, %if.then42
%indvars.iv104 = phi i64 [ %idxprom35, %for.cond30.preheader ], [ %indvars.iv.next105, %if.then42 ]
%arrayidx38 = getelementptr inbounds ptr, ptr %vla, i64 %indvars.iv104
%13 = load ptr, ptr %arrayidx38, align 8, !tbaa !5
%call39 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %11, ptr noundef nonnull dereferenceable(1) %13) #11
%cmp40 = icmp eq i32 %call39, 0
br i1 %cmp40, label %if.then42, label %if.else44
if.then42: ; preds = %for.body34
%indvars.iv.next105 = add nsw i64 %indvars.iv104, 1
%cmp31 = icmp slt i64 %indvars.iv.next105, %12
br i1 %cmp31, label %for.body34, label %cleanup.loopexit, !llvm.loop !15
if.else44: ; preds = %for.body34
%14 = trunc i64 %indvars.iv104 to i32
%dec = add nsw i32 %14, -1
br label %cleanup
cleanup.loopexit: ; preds = %if.then42
%15 = trunc i64 %indvars.iv104 to i32
br label %cleanup
cleanup: ; preds = %cleanup.loopexit, %if.else44
%y.1 = phi i32 [ %dec, %if.else44 ], [ %15, %cleanup.loopexit ]
%reass.sub = sub i32 %y.1, %x.096
%add = add i32 %reass.sub, 1
%cmp50 = icmp eq i32 %add, %spec.select
br i1 %cmp50, label %if.then52, label %if.end56
if.then52: ; preds = %cleanup
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %11)
%.pre107 = load i32, ptr %n, align 4, !tbaa !11
br label %if.end56
if.end56: ; preds = %if.then52, %cleanup
%16 = phi i32 [ %.pre107, %if.then52 ], [ %10, %cleanup ]
%add57 = add nsw i32 %y.1, 1
%cmp27 = icmp slt i32 %add57, %16
br i1 %cmp27, label %for.cond30.preheader, label %while.end, !llvm.loop !16
while.end: ; preds = %if.end56, %for.cond.cleanup6
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #13
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #7
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #8
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #7
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #10
attributes #0 = { mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) 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 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 #2 = { nofree nounwind memory(argmem: write, inaccessiblemem: 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #6 = { 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 #7 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #8 = { 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 #9 = { nofree nounwind }
attributes #10 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { nounwind allocsize(0) }
attributes #13 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define MOD 1000000007
typedef long long ll;
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
int compareInt(const void* a, const void* b)
{
int aNum = *(int*)a;
int bNum = *(int*)b;
return aNum - bNum;
}
/*
最頻値を求める
引数
array: 対象の配列
size: array の要素数
戻り値
最頻値
*/
int get_mode(const int* array, size_t size)
{
assert(array != NULL);
assert(size > 0);
// [!] 配列が昇順にソートされていることを前提にしている
int mode; // これまでに調べた中での最頻値
int count_max = 0; // これまでに調べた登場回数の中で最大のもの
for (size_t i = 0; i < size; ) {
int value = array[i];
int count = 1;
// ソートされているのだから、
// 同じ値があるとすれば、後続に連続して並んでいるはず。
// その回数をカウントする。
for (i = i + 1; i < size; ++i) {
if (value == array[i]) {
++count;
}
else {
// 違う値が登場したら終わり
break;
}
};
// これまでの最大の登場回数よりも多かったら、更新する
if (count_max < count) {
count_max = count;
mode = value;
}
}
return count_max;
}
int main(){
int n;
scanf("%d", &n);
int a[n * 3];
rep(i, n) scanf("%d", &a[i]);
rep(i, n) a[n + i] = a[i] + 1;
rep(i, n) a[n * 2 + i] = a[i] - 1;
qsort(a, SIZE_OF_ARRAY(a), sizeof(int), compareInt);
int t = get_mode(a, SIZE_OF_ARRAY(a));
printf("%d", t);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328883/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328883/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [14 x i8] c"array != NULL\00", align 1
@.str.1 = private unnamed_addr constant [63 x i8] c"/data/TheStack_IR/OJ_Samples/Collated/C/Source_328883/source.c\00", align 1
@__PRETTY_FUNCTION__.get_mode = private unnamed_addr constant [34 x i8] c"int get_mode(const int *, size_t)\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"size > 0\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compareInt(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nounwind uwtable
define dso_local i32 @get_mode(ptr noundef readonly %array, i64 noundef %size) local_unnamed_addr #2 {
entry:
%cmp.not = icmp eq ptr %array, null
br i1 %cmp.not, label %if.else, label %if.end
if.else: ; preds = %entry
tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 31, ptr noundef nonnull @__PRETTY_FUNCTION__.get_mode) #8
unreachable
if.end: ; preds = %entry
%cmp1.not = icmp eq i64 %size, 0
br i1 %cmp1.not, label %if.else3, label %for.body.preheader
for.body.preheader: ; preds = %if.end
%0 = trunc i64 %size to i32
br label %for.body
if.else3: ; preds = %if.end
tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 32, ptr noundef nonnull @__PRETTY_FUNCTION__.get_mode) #8
unreachable
for.cond.cleanup: ; preds = %for.end, %for.end.thread
%spec.select45 = phi i32 [ %spec.select43, %for.end.thread ], [ %spec.select, %for.end ]
ret i32 %spec.select45
for.body: ; preds = %for.body.preheader, %for.end
%count_max.040 = phi i32 [ %spec.select, %for.end ], [ 0, %for.body.preheader ]
%i.039 = phi i64 [ %i.1.lcssa, %for.end ], [ 0, %for.body.preheader ]
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %i.039
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%i.132 = add nuw i64 %i.039, 1
%cmp733 = icmp ult i64 %i.132, %size
br i1 %cmp733, label %for.body8, label %for.end
for.body8: ; preds = %for.body, %if.then11
%i.135 = phi i64 [ %i.1, %if.then11 ], [ %i.132, %for.body ]
%count.034 = phi i32 [ %inc, %if.then11 ], [ 1, %for.body ]
%arrayidx9 = getelementptr inbounds i32, ptr %array, i64 %i.135
%2 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %1, %2
br i1 %cmp10, label %if.then11, label %for.end
if.then11: ; preds = %for.body8
%inc = add nuw nsw i32 %count.034, 1
%i.1 = add i64 %i.135, 1
%exitcond.not = icmp eq i64 %i.1, %size
br i1 %exitcond.not, label %for.end.thread, label %for.body8, !llvm.loop !9
for.end.thread: ; preds = %if.then11
%3 = trunc i64 %i.039 to i32
%4 = sub i32 %0, %3
%spec.select43 = tail call i32 @llvm.smax.i32(i32 %count_max.040, i32 %4)
br label %for.cond.cleanup
for.end: ; preds = %for.body8, %for.body
%count.0.lcssa = phi i32 [ 1, %for.body ], [ %count.034, %for.body8 ]
%i.1.lcssa = phi i64 [ %i.132, %for.body ], [ %i.135, %for.body8 ]
%spec.select = tail call i32 @llvm.smax.i32(i32 %count_max.040, i32 %count.0.lcssa)
%cmp5 = icmp ult i64 %i.1.lcssa, %size
br i1 %cmp5, label %for.body, label %for.cond.cleanup, !llvm.loop !11
}
; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%mul = mul nsw i32 %0, 3
%1 = zext i32 %mul to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp45 = icmp sgt i32 %3, 0
br i1 %cmp45, label %for.body, label %for.cond.cleanup18
for.cond3.preheader: ; preds = %for.body
%cmp447 = icmp sgt i32 %12, 0
br i1 %cmp447, label %for.body6.preheader, label %for.cond.cleanup18
for.body6.preheader: ; preds = %for.cond3.preheader
%4 = zext i32 %12 to i64
%wide.trip.count = zext i32 %12 to i64
%invariant.gep = getelementptr i32, ptr %vla, i64 %4
%min.iters.check = icmp ult i32 %12, 8
br i1 %min.iters.check, label %for.body6.preheader102, label %vector.ph
vector.ph: ; preds = %for.body6.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%5 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load83 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = add nsw <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%8 = add nsw <4 x i32> %wide.load83, <i32 1, i32 1, i32 1, i32 1>
%9 = getelementptr i32, ptr %invariant.gep, i64 %index
store <4 x i32> %7, ptr %9, align 4, !tbaa !5
%10 = getelementptr i32, ptr %9, i64 4
store <4 x i32> %8, ptr %10, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond16.preheader, label %for.body6.preheader102
for.body6.preheader102: ; preds = %for.body6.preheader, %middle.block
%indvars.iv57.ph = phi i64 [ 0, %for.body6.preheader ], [ %n.vec, %middle.block ]
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp = icmp slt i64 %indvars.iv.next, %13
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !15
for.cond16.preheader: ; preds = %for.body6, %middle.block
br i1 %cmp447, label %for.body19.lr.ph, label %for.cond.cleanup18
for.body19.lr.ph: ; preds = %for.cond16.preheader
%mul22 = shl nuw nsw i32 %12, 1
%14 = zext i32 %mul22 to i64
%wide.trip.count65 = zext i32 %12 to i64
%invariant.gep77 = getelementptr i32, ptr %vla, i64 %14
%min.iters.check87 = icmp ult i32 %12, 8
br i1 %min.iters.check87, label %for.body19.preheader, label %vector.ph88
vector.ph88: ; preds = %for.body19.lr.ph
%n.vec90 = and i64 %wide.trip.count, 4294967288
br label %vector.body93
vector.body93: ; preds = %vector.body93, %vector.ph88
%index94 = phi i64 [ 0, %vector.ph88 ], [ %index.next97, %vector.body93 ]
%15 = getelementptr inbounds i32, ptr %vla, i64 %index94
%wide.load95 = load <4 x i32>, ptr %15, align 16, !tbaa !5
%16 = getelementptr inbounds i32, ptr %15, i64 4
%wide.load96 = load <4 x i32>, ptr %16, align 16, !tbaa !5
%17 = add nsw <4 x i32> %wide.load95, <i32 -1, i32 -1, i32 -1, i32 -1>
%18 = add nsw <4 x i32> %wide.load96, <i32 -1, i32 -1, i32 -1, i32 -1>
%19 = getelementptr i32, ptr %invariant.gep77, i64 %index94
store <4 x i32> %17, ptr %19, align 8, !tbaa !5
%20 = getelementptr i32, ptr %19, i64 4
store <4 x i32> %18, ptr %20, align 8, !tbaa !5
%index.next97 = add nuw i64 %index94, 8
%21 = icmp eq i64 %index.next97, %n.vec90
br i1 %21, label %middle.block85, label %vector.body93, !llvm.loop !16
middle.block85: ; preds = %vector.body93
%cmp.n92 = icmp eq i64 %n.vec90, %wide.trip.count
br i1 %cmp.n92, label %for.cond.cleanup18, label %for.body19.preheader
for.body19.preheader: ; preds = %for.body19.lr.ph, %middle.block85
%indvars.iv61.ph = phi i64 [ 0, %for.body19.lr.ph ], [ %n.vec90, %middle.block85 ]
%22 = xor i64 %indvars.iv61.ph, -1
%23 = add nsw i64 %22, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body19.prol.loopexit, label %for.body19.prol
for.body19.prol: ; preds = %for.body19.preheader, %for.body19.prol
%indvars.iv61.prol = phi i64 [ %indvars.iv.next62.prol, %for.body19.prol ], [ %indvars.iv61.ph, %for.body19.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body19.prol ], [ 0, %for.body19.preheader ]
%arrayidx21.prol = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv61.prol
%24 = load i32, ptr %arrayidx21.prol, align 4, !tbaa !5
%sub.prol = add nsw i32 %24, -1
%gep78.prol = getelementptr i32, ptr %invariant.gep77, i64 %indvars.iv61.prol
store i32 %sub.prol, ptr %gep78.prol, align 4, !tbaa !5
%indvars.iv.next62.prol = add nuw nsw i64 %indvars.iv61.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body19.prol.loopexit, label %for.body19.prol, !llvm.loop !17
for.body19.prol.loopexit: ; preds = %for.body19.prol, %for.body19.preheader
%indvars.iv61.unr = phi i64 [ %indvars.iv61.ph, %for.body19.preheader ], [ %indvars.iv.next62.prol, %for.body19.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.cond.cleanup18, label %for.body19
for.body6: ; preds = %for.body6.preheader102, %for.body6
%indvars.iv57 = phi i64 [ %indvars.iv.next58, %for.body6 ], [ %indvars.iv57.ph, %for.body6.preheader102 ]
%arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv57
%26 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%add = add nsw i32 %26, 1
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv57
store i32 %add, ptr %gep, align 4, !tbaa !5
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%exitcond.not = icmp eq i64 %indvars.iv.next58, %wide.trip.count
br i1 %exitcond.not, label %for.cond16.preheader, label %for.body6, !llvm.loop !19
for.cond.cleanup18: ; preds = %for.body19.prol.loopexit, %for.body19, %middle.block85, %entry, %for.cond3.preheader, %for.cond16.preheader
call void @qsort(ptr noundef nonnull %vla, i64 noundef %1, i64 noundef 4, ptr noundef nonnull @compareInt) #9
%cmp1.not.i = icmp eq i32 %0, 0
br i1 %cmp1.not.i, label %if.else3.i, label %for.body.i
if.else3.i: ; preds = %for.cond.cleanup18
call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 32, ptr noundef nonnull @__PRETTY_FUNCTION__.get_mode) #8
unreachable
for.body.i: ; preds = %for.cond.cleanup18, %for.end.i
%count_max.040.i = phi i32 [ %spec.select.i, %for.end.i ], [ 0, %for.cond.cleanup18 ]
%i.039.i = phi i64 [ %i.1.lcssa.i, %for.end.i ], [ 0, %for.cond.cleanup18 ]
%arrayidx.i = getelementptr inbounds i32, ptr %vla, i64 %i.039.i
%27 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%i.132.i = add nuw i64 %i.039.i, 1
%cmp733.i = icmp ult i64 %i.132.i, %1
br i1 %cmp733.i, label %for.body8.i, label %for.end.i
for.body8.i: ; preds = %for.body.i, %if.then11.i
%i.135.i = phi i64 [ %i.1.i, %if.then11.i ], [ %i.132.i, %for.body.i ]
%count.034.i = phi i32 [ %inc.i, %if.then11.i ], [ 1, %for.body.i ]
%arrayidx9.i = getelementptr inbounds i32, ptr %vla, i64 %i.135.i
%28 = load i32, ptr %arrayidx9.i, align 4, !tbaa !5
%cmp10.i = icmp eq i32 %27, %28
br i1 %cmp10.i, label %if.then11.i, label %for.end.i
if.then11.i: ; preds = %for.body8.i
%inc.i = add nuw nsw i32 %count.034.i, 1
%i.1.i = add i64 %i.135.i, 1
%exitcond.not.i = icmp eq i64 %i.1.i, %1
br i1 %exitcond.not.i, label %for.end.thread.i, label %for.body8.i, !llvm.loop !9
for.end.thread.i: ; preds = %if.then11.i
%29 = trunc i64 %i.039.i to i32
%30 = sub i32 %mul, %29
%spec.select43.i = call i32 @llvm.smax.i32(i32 %count_max.040.i, i32 %30)
br label %get_mode.exit
for.end.i: ; preds = %for.body8.i, %for.body.i
%count.0.lcssa.i = phi i32 [ 1, %for.body.i ], [ %count.034.i, %for.body8.i ]
%i.1.lcssa.i = phi i64 [ %i.132.i, %for.body.i ], [ %i.135.i, %for.body8.i ]
%spec.select.i = call i32 @llvm.smax.i32(i32 %count_max.040.i, i32 %count.0.lcssa.i)
%cmp5.i = icmp ult i64 %i.1.lcssa.i, %1
br i1 %cmp5.i, label %for.body.i, label %get_mode.exit, !llvm.loop !11
get_mode.exit: ; preds = %for.end.i, %for.end.thread.i
%spec.select45.i = phi i32 [ %spec.select43.i, %for.end.thread.i ], [ %spec.select.i, %for.end.i ]
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %spec.select45.i)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
for.body19: ; preds = %for.body19.prol.loopexit, %for.body19
%indvars.iv61 = phi i64 [ %indvars.iv.next62.3, %for.body19 ], [ %indvars.iv61.unr, %for.body19.prol.loopexit ]
%arrayidx21 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv61
%31 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%sub = add nsw i32 %31, -1
%gep78 = getelementptr i32, ptr %invariant.gep77, i64 %indvars.iv61
store i32 %sub, ptr %gep78, align 4, !tbaa !5
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%arrayidx21.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next62
%32 = load i32, ptr %arrayidx21.1, align 4, !tbaa !5
%sub.1 = add nsw i32 %32, -1
%gep78.1 = getelementptr i32, ptr %invariant.gep77, i64 %indvars.iv.next62
store i32 %sub.1, ptr %gep78.1, align 4, !tbaa !5
%indvars.iv.next62.1 = add nuw nsw i64 %indvars.iv61, 2
%arrayidx21.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next62.1
%33 = load i32, ptr %arrayidx21.2, align 4, !tbaa !5
%sub.2 = add nsw i32 %33, -1
%gep78.2 = getelementptr i32, ptr %invariant.gep77, i64 %indvars.iv.next62.1
store i32 %sub.2, ptr %gep78.2, align 4, !tbaa !5
%indvars.iv.next62.2 = add nuw nsw i64 %indvars.iv61, 3
%arrayidx21.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next62.2
%34 = load i32, ptr %arrayidx21.3, align 4, !tbaa !5
%sub.3 = add nsw i32 %34, -1
%gep78.3 = getelementptr i32, ptr %invariant.gep77, i64 %indvars.iv.next62.2
store i32 %sub.3, ptr %gep78.3, align 4, !tbaa !5
%indvars.iv.next62.3 = add nuw nsw i64 %indvars.iv61, 4
%exitcond66.not.3 = icmp eq i64 %indvars.iv.next62.3, %wide.trip.count65
br i1 %exitcond66.not.3, label %for.cond.cleanup18, label %for.body19, !llvm.loop !20
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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 = { 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 #3 = { noreturn 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 = { 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 #5 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { noreturn nounwind }
attributes #9 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !13, !14}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !10, !14, !13}
!20 = distinct !{!20, !10, !13}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
int main(void){
int n;
scanf("%d",&n);
int a[n],max=3;
for (int i=0; i<n; i++){
scanf("%d",&a[i]);
if (a[i]>max){
max=a[i]+1;
}
}
int count[max];
for (int i=0; i<max; i++){
count[i]=0;
}
for(int i=0; i<n; i++){
count[a[i]]++;
}
int tmp=0;
for (int i=1; i<max-1; i++){
if(count[i-1]+count[i]+count[i+1]>tmp){
tmp=count[i-1]+count[i]+count[i+1];
}
}
printf("%d\n",tmp);
return 0 ;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_328926/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_328926/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp83 = icmp sgt i32 %3, 0
br i1 %cmp83, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
%vla7112120 = alloca [3 x i32], align 16
br label %for.body12.preheader
for.cond.cleanup: ; preds = %for.body
%4 = zext i32 %spec.select to i64
%vla7 = alloca i32, i64 %4, align 16
%cmp1087 = icmp sgt i32 %spec.select, 0
br i1 %cmp1087, label %for.body12.preheader, label %for.cond19.preheader
for.body12.preheader: ; preds = %for.cond.cleanup.thread, %for.cond.cleanup
%vla7119 = phi ptr [ %vla7112120, %for.cond.cleanup.thread ], [ %vla7, %for.cond.cleanup ]
%5 = phi i64 [ 3, %for.cond.cleanup.thread ], [ %4, %for.cond.cleanup ]
%.lcssa117 = phi i32 [ %3, %for.cond.cleanup.thread ], [ %8, %for.cond.cleanup ]
%max.0.lcssa115 = phi i32 [ 3, %for.cond.cleanup.thread ], [ %spec.select, %for.cond.cleanup ]
%6 = shl nuw nsw i64 %5, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla7119, i8 0, i64 %6, i1 false), !tbaa !5
br label %for.cond19.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%max.084 = phi i32 [ %spec.select, %for.body ], [ 3, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%7 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %7, %max.084
%add = add nsw i32 %7, 1
%spec.select = select i1 %cmp4, i32 %add, i32 %max.084
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond19.preheader: ; preds = %for.body12.preheader, %for.cond.cleanup
%vla7118 = phi ptr [ %vla7119, %for.body12.preheader ], [ %vla7, %for.cond.cleanup ]
%.lcssa116 = phi i32 [ %.lcssa117, %for.body12.preheader ], [ %8, %for.cond.cleanup ]
%max.0.lcssa114 = phi i32 [ %max.0.lcssa115, %for.body12.preheader ], [ %spec.select, %for.cond.cleanup ]
%cmp2089 = icmp sgt i32 %.lcssa116, 0
br i1 %cmp2089, label %for.body22.preheader, label %for.cond32.preheader
for.body22.preheader: ; preds = %for.cond19.preheader
%wide.trip.count = zext i32 %.lcssa116 to i64
%xtraiter = and i64 %wide.trip.count, 3
%10 = icmp ult i32 %.lcssa116, 4
br i1 %10, label %for.cond32.preheader.loopexit.unr-lcssa, label %for.body22.preheader.new
for.body22.preheader.new: ; preds = %for.body22.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body22
for.cond32.preheader.loopexit.unr-lcssa: ; preds = %for.body22, %for.body22.preheader
%indvars.iv100.unr = phi i64 [ 0, %for.body22.preheader ], [ %indvars.iv.next101.3, %for.body22 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond32.preheader, label %for.body22.epil
for.body22.epil: ; preds = %for.cond32.preheader.loopexit.unr-lcssa, %for.body22.epil
%indvars.iv100.epil = phi i64 [ %indvars.iv.next101.epil, %for.body22.epil ], [ %indvars.iv100.unr, %for.cond32.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body22.epil ], [ 0, %for.cond32.preheader.loopexit.unr-lcssa ]
%arrayidx24.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv100.epil
%11 = load i32, ptr %arrayidx24.epil, align 4, !tbaa !5
%idxprom25.epil = sext i32 %11 to i64
%arrayidx26.epil = getelementptr inbounds i32, ptr %vla7118, i64 %idxprom25.epil
%12 = load i32, ptr %arrayidx26.epil, align 4, !tbaa !5
%inc27.epil = add nsw i32 %12, 1
store i32 %inc27.epil, ptr %arrayidx26.epil, align 4, !tbaa !5
%indvars.iv.next101.epil = add nuw nsw i64 %indvars.iv100.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond32.preheader, label %for.body22.epil, !llvm.loop !11
for.cond32.preheader: ; preds = %for.cond32.preheader.loopexit.unr-lcssa, %for.body22.epil, %for.cond19.preheader
%cmp3391 = icmp sgt i32 %max.0.lcssa114, 2
br i1 %cmp3391, label %for.body35.preheader, label %for.cond.cleanup34
for.body35.preheader: ; preds = %for.cond32.preheader
%sub = add nsw i32 %max.0.lcssa114, -1
%wide.trip.count107 = zext i32 %sub to i64
%13 = load <2 x i32>, ptr %vla7118, align 4, !tbaa !5
%14 = add nsw i64 %wide.trip.count107, -1
%min.iters.check = icmp ult i64 %14, 8
br i1 %min.iters.check, label %for.body35.preheader128, label %vector.ph
vector.ph: ; preds = %for.body35.preheader
%n.vec = and i64 %14, -8
%ind.end = or i64 %n.vec, 1
%15 = shufflevector <2 x i32> %13, <2 x i32> poison, <4 x i32> <i32 poison, i32 poison, i32 poison, i32 1>
%16 = shufflevector <2 x i32> %13, <2 x i32> poison, <4 x i32> <i32 poison, i32 poison, i32 poison, i32 0>
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <4 x i32> [ %15, %vector.ph ], [ %wide.load124, %vector.body ]
%vector.recur122 = phi <4 x i32> [ %16, %vector.ph ], [ %21, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %28, %vector.body ]
%vec.phi123 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %29, %vector.body ]
%17 = or i64 %index, 2
%18 = getelementptr inbounds i32, ptr %vla7118, i64 %17
%wide.load = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds i32, ptr %18, i64 4
%wide.load124 = load <4 x i32>, ptr %19, align 4, !tbaa !5
%20 = shufflevector <4 x i32> %vector.recur, <4 x i32> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%21 = shufflevector <4 x i32> %wide.load, <4 x i32> %wide.load124, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%22 = shufflevector <4 x i32> %vector.recur122, <4 x i32> %20, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%23 = shufflevector <4 x i32> %20, <4 x i32> %21, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%24 = add nsw <4 x i32> %20, %22
%25 = add nsw <4 x i32> %21, %23
%26 = add nsw <4 x i32> %24, %wide.load
%27 = add nsw <4 x i32> %25, %wide.load124
%28 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %26, <4 x i32> %vec.phi)
%29 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %27, <4 x i32> %vec.phi123)
%index.next = add nuw i64 %index, 8
%30 = icmp eq i64 %index.next, %n.vec
br i1 %30, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %28, <4 x i32> %29)
%31 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %14, %n.vec
%32 = shufflevector <4 x i32> %wide.load124, <4 x i32> poison, <2 x i32> <i32 2, i32 3>
br i1 %cmp.n, label %for.cond.cleanup34, label %for.body35.preheader128
for.body35.preheader128: ; preds = %for.body35.preheader, %middle.block
%indvars.iv103.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %for.body35.preheader ]
%tmp.092.ph = phi i32 [ %31, %middle.block ], [ 0, %for.body35.preheader ]
%.ph = phi <2 x i32> [ %32, %middle.block ], [ %13, %for.body35.preheader ]
br label %for.body35
for.body22: ; preds = %for.body22, %for.body22.preheader.new
%indvars.iv100 = phi i64 [ 0, %for.body22.preheader.new ], [ %indvars.iv.next101.3, %for.body22 ]
%niter = phi i64 [ 0, %for.body22.preheader.new ], [ %niter.next.3, %for.body22 ]
%arrayidx24 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv100
%33 = load i32, ptr %arrayidx24, align 16, !tbaa !5
%idxprom25 = sext i32 %33 to i64
%arrayidx26 = getelementptr inbounds i32, ptr %vla7118, i64 %idxprom25
%34 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%inc27 = add nsw i32 %34, 1
store i32 %inc27, ptr %arrayidx26, align 4, !tbaa !5
%indvars.iv.next101 = or i64 %indvars.iv100, 1
%arrayidx24.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next101
%35 = load i32, ptr %arrayidx24.1, align 4, !tbaa !5
%idxprom25.1 = sext i32 %35 to i64
%arrayidx26.1 = getelementptr inbounds i32, ptr %vla7118, i64 %idxprom25.1
%36 = load i32, ptr %arrayidx26.1, align 4, !tbaa !5
%inc27.1 = add nsw i32 %36, 1
store i32 %inc27.1, ptr %arrayidx26.1, align 4, !tbaa !5
%indvars.iv.next101.1 = or i64 %indvars.iv100, 2
%arrayidx24.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next101.1
%37 = load i32, ptr %arrayidx24.2, align 8, !tbaa !5
%idxprom25.2 = sext i32 %37 to i64
%arrayidx26.2 = getelementptr inbounds i32, ptr %vla7118, i64 %idxprom25.2
%38 = load i32, ptr %arrayidx26.2, align 4, !tbaa !5
%inc27.2 = add nsw i32 %38, 1
store i32 %inc27.2, ptr %arrayidx26.2, align 4, !tbaa !5
%indvars.iv.next101.2 = or i64 %indvars.iv100, 3
%arrayidx24.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next101.2
%39 = load i32, ptr %arrayidx24.3, align 4, !tbaa !5
%idxprom25.3 = sext i32 %39 to i64
%arrayidx26.3 = getelementptr inbounds i32, ptr %vla7118, i64 %idxprom25.3
%40 = load i32, ptr %arrayidx26.3, align 4, !tbaa !5
%inc27.3 = add nsw i32 %40, 1
store i32 %inc27.3, ptr %arrayidx26.3, align 4, !tbaa !5
%indvars.iv.next101.3 = add nuw nsw i64 %indvars.iv100, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond32.preheader.loopexit.unr-lcssa, label %for.body22, !llvm.loop !16
for.cond.cleanup34: ; preds = %for.body35, %middle.block, %for.cond32.preheader
%tmp.0.lcssa = phi i32 [ 0, %for.cond32.preheader ], [ %31, %middle.block ], [ %spec.select82, %for.body35 ]
%call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %tmp.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
for.body35: ; preds = %for.body35.preheader128, %for.body35
%indvars.iv103 = phi i64 [ %indvars.iv.next104, %for.body35 ], [ %indvars.iv103.ph, %for.body35.preheader128 ]
%tmp.092 = phi i32 [ %spec.select82, %for.body35 ], [ %tmp.092.ph, %for.body35.preheader128 ]
%41 = phi <2 x i32> [ %45, %for.body35 ], [ %.ph, %for.body35.preheader128 ]
%shift = shufflevector <2 x i32> %41, <2 x i32> poison, <2 x i32> <i32 1, i32 poison>
%42 = add nsw <2 x i32> %shift, %41
%add41 = extractelement <2 x i32> %42, i64 0
%indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
%arrayidx44 = getelementptr inbounds i32, ptr %vla7118, i64 %indvars.iv.next104
%43 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%add45 = add nsw i32 %add41, %43
%spec.select82 = call i32 @llvm.smax.i32(i32 %add45, i32 %tmp.092)
%exitcond108.not = icmp eq i64 %indvars.iv.next104, %wide.trip.count107
%44 = shufflevector <2 x i32> %41, <2 x i32> poison, <2 x i32> <i32 1, i32 poison>
%45 = insertelement <2 x i32> %44, i32 %43, i64 1
br i1 %exitcond108.not, label %for.cond.cleanup34, label %for.body35, !llvm.loop !17
}
; 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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; 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 speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #4
attributes #0 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !15, !14}
|
#include <stdio.h>
int main()
{
int n, i;
scanf("%d", &n);
i = 0;
while(n != 1)
{
if(!i)
{
printf("I hate that ");
i = 1;
}
else
{
printf("I love that ");
i = 0;
}
n--;
}
if(!i)
printf("I hate it");
else
printf("I love it");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_32897/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_32897/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"I hate that \00", align 1
@.str.2 = private unnamed_addr constant [13 x i8] c"I love that \00", align 1
@.str.3 = private unnamed_addr constant [10 x i8] c"I hate it\00", align 1
@.str.4 = private unnamed_addr constant [10 x i8] c"I love it\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%.pr = load i32, ptr %n, align 4, !tbaa !5
%cmp.not10 = icmp eq i32 %.pr, 1
br i1 %cmp.not10, label %if.end8, label %while.body
while.body: ; preds = %entry, %while.body
%i.011 = phi i32 [ %., %while.body ], [ 0, %entry ]
%tobool.not.not = icmp eq i32 %i.011, 0
%.str.2..str.1 = select i1 %tobool.not.not, ptr @.str.1, ptr @.str.2
%. = xor i32 %i.011, 1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
%0 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%cmp.not = icmp eq i32 %dec, 1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body
%spec.select = select i1 %tobool.not.not, ptr @.str.4, ptr @.str.3
br label %if.end8
if.end8: ; preds = %while.end, %entry
%.str.4.sink = phi ptr [ @.str.3, %entry ], [ %spec.select, %while.end ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int main(){
int i,j,n,count;
char a[21],b[21];
scanf("%s",b);
scanf("%d",&n);
for(i=0,count=0;i<n;i++){
scanf("%s",a);
for(j=0;j<10;j++) {
a[j+10]=a[j];
}
a[j+10]='\0';
if(strstr(a,b)!=0) count++; }
printf("%d\n",count);
scanf("%d",&i);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329048/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329048/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%i = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca [21 x i8], align 16
%b = alloca [21 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 21, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 21, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
store i32 0, ptr %i, align 4, !tbaa !5
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %0, 0
br i1 %cmp28, label %for.body.preheader, label %for.end19
for.body.preheader: ; preds = %entry
%arrayidx8 = getelementptr inbounds [21 x i8], ptr %a, i64 0, i64 10
%arrayidx.8 = getelementptr inbounds [21 x i8], ptr %a, i64 0, i64 8
%arrayidx8.8 = getelementptr inbounds [21 x i8], ptr %a, i64 0, i64 18
%arrayidx.9 = getelementptr inbounds [21 x i8], ptr %a, i64 0, i64 9
%arrayidx8.9 = getelementptr inbounds [21 x i8], ptr %a, i64 0, i64 19
%arrayidx11 = getelementptr inbounds [21 x i8], ptr %a, i64 0, i64 20
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%1 = phi i32 [ %inc18, %for.body ], [ 0, %for.body.preheader ]
%count.029 = phi i32 [ %spec.select, %for.body ], [ 0, %for.body.preheader ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%2 = load <8 x i8>, ptr %a, align 16, !tbaa !9
store <8 x i8> %2, ptr %arrayidx8, align 2, !tbaa !9
%3 = load i8, ptr %arrayidx.8, align 8, !tbaa !9
store i8 %3, ptr %arrayidx8.8, align 2, !tbaa !9
%4 = load i8, ptr %arrayidx.9, align 1, !tbaa !9
store i8 %4, ptr %arrayidx8.9, align 1, !tbaa !9
store i8 0, ptr %arrayidx11, align 4, !tbaa !9
%call14 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #5
%cmp15.not = icmp ne ptr %call14, null
%inc16 = zext i1 %cmp15.not to i32
%spec.select = add nuw nsw i32 %count.029, %inc16
%inc18 = add nuw nsw i32 %1, 1
store i32 %inc18, ptr %i, align 4, !tbaa !5
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc18, %5
br i1 %cmp, label %for.body, label %for.end19, !llvm.loop !10
for.end19: ; preds = %for.body, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa)
%call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %i)
call void @llvm.lifetime.end.p0(i64 21, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 21, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int a, b, c, S, M, L, t;
S = M = L = 0;
while(1){
scanf("%d %d %d", &a, &b, &c);
if(c<a){t=c;c=a;a=t;}
if(c<b){t=c;c=b;b=t;}
if(!(a+b>c && b+c>a && c+a>b))break;
t=c*c-a*a-b*b;
if(t<0)S++;if(t==0)M++;if(t>0)L++;
}
printf("%d %d %d %d\n", S+M+L, M, S, L);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329105/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329105/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%d %d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
br label %while.cond
while.cond: ; preds = %if.end11, %entry
%S.0 = phi i32 [ 0, %entry ], [ %spec.select, %if.end11 ]
%M.0 = phi i32 [ 0, %entry ], [ %M.1, %if.end11 ]
%L.0 = phi i32 [ 0, %entry ], [ %L.1, %if.end11 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %c, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %while.cond
store i32 %1, ptr %c, align 4, !tbaa !5
store i32 %0, ptr %a, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %while.cond
%2 = phi i32 [ %0, %if.then ], [ %1, %while.cond ]
%3 = phi i32 [ %1, %if.then ], [ %0, %while.cond ]
%4 = load i32, ptr %b, align 4, !tbaa !5
%cmp1 = icmp slt i32 %3, %4
br i1 %cmp1, label %if.then2, label %if.end3
if.then2: ; preds = %if.end
store i32 %4, ptr %c, align 4, !tbaa !5
store i32 %3, ptr %b, align 4, !tbaa !5
br label %if.end3
if.end3: ; preds = %if.then2, %if.end
%5 = phi i32 [ %4, %if.then2 ], [ %3, %if.end ]
%6 = phi i32 [ %3, %if.then2 ], [ %4, %if.end ]
%add = add nsw i32 %6, %2
%cmp4 = icmp sgt i32 %add, %5
%add5 = add nsw i32 %5, %6
%cmp6 = icmp sgt i32 %add5, %2
%or.cond = select i1 %cmp4, i1 %cmp6, i1 false
%add8 = add nsw i32 %5, %2
%cmp9 = icmp sgt i32 %add8, %6
%or.cond47 = select i1 %or.cond, i1 %cmp9, i1 false
br i1 %or.cond47, label %if.end11, label %while.end
if.end11: ; preds = %if.end3
%sub46 = sub nsw i32 %5, %2
%sub = mul nsw i32 %add8, %sub46
%mul13 = mul nsw i32 %6, %6
%sub14 = sub nsw i32 %sub, %mul13
%7 = lshr i32 %sub14, 31
%spec.select = add i32 %7, %S.0
%cmp18 = icmp eq i32 %sub, %mul13
%inc20 = zext i1 %cmp18 to i32
%M.1 = add nuw nsw i32 %M.0, %inc20
%cmp22 = icmp sgt i32 %sub14, 0
%inc24 = zext i1 %cmp22 to i32
%L.1 = add nuw nsw i32 %L.0, %inc24
br label %while.cond
while.end: ; preds = %if.end3
%add26 = add nsw i32 %M.0, %S.0
%add27 = add nsw i32 %add26, %L.0
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add27, i32 noundef %M.0, i32 noundef %S.0, i32 noundef %L.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int n;
scanf("%d",&n);
int x=1;
while((x+1)*(x+2)/2<=n)x++;
int rest=n-x*(x+1)/2;
for(int i=x;i>=1;i--)printf("%d\n",i+(rest-->0));
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329149/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329149/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%x.0 = phi i32 [ 1, %entry ], [ %add, %while.cond ]
%add = add nuw nsw i32 %x.0, 1
%add1 = add nuw nsw i32 %x.0, 2
%mul = mul nsw i32 %add, %add1
%div17 = lshr i32 %mul, 1
%cmp.not = icmp sgt i32 %div17, %0
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !9
while.end: ; preds = %while.cond
%mul3 = mul nsw i32 %add, %x.0
%div418 = lshr i32 %mul3, 1
%sub = sub nsw i32 %0, %div418
br label %for.body
for.cond.cleanup: ; preds = %for.body
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
for.body: ; preds = %while.end, %for.body
%i.020 = phi i32 [ %x.0, %while.end ], [ %dec9, %for.body ]
%rest.019 = phi i32 [ %sub, %while.end ], [ %dec, %for.body ]
%dec = add nsw i32 %rest.019, -1
%cmp6 = icmp sgt i32 %rest.019, 0
%conv = zext i1 %cmp6 to i32
%add7 = add nuw nsw i32 %i.020, %conv
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add7)
%dec9 = add nsw i32 %i.020, -1
%cmp5 = icmp sgt i32 %i.020, 1
br i1 %cmp5, label %for.body, label %for.cond.cleanup, !llvm.loop !11
}
; 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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int tanri(double r,int y,int mon,int ts)
{
int i,last;
last=0;
for(i=0;i<y;i++){
last=last+mon*r;
mon=mon-ts;
}
last=last+mon;
return (last);
}
int fukuri(double r,int y,int mon,int ts)
{
int i,last;
last=0;
for(i=0;i<y;i++){
last=mon+mon*r-ts;
mon=last;
}
return (mon);
}
int remain(int n,int mon,int y)
{
int re[n],x,ts,max,j;
double r;
max=0;
for(j=0;j<n;j++){
scanf("%d %lf %d",&x,&r,&ts);
/* printf("x=%d r=%f ts=%d\n", x,r,ts);*/
if(x==0){
re[j]=tanri(r,y,mon,ts);
/* printf("tanrire[%d]=%d\n", j,re[j]);*/
}
else{
re[j]=fukuri(r,y,mon,ts);
/* printf("fukurire[%d]=%d\n", j,re[j]);*/
}
if(re[j]>max){
max=re[j];
}
}
return(max);
}
int main(void)
{
int n,m,y,mon,i,x,ts,max=0;
double r;
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d %d %d",&mon,&y,&n);
max=remain(n,mon,y);
printf("%d\n",max);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329192/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329192/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"%d %lf %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @tanri(double noundef %r, i32 noundef %y, i32 noundef %mon, i32 noundef %ts) local_unnamed_addr #0 {
entry:
%cmp8 = icmp sgt i32 %y, 0
br i1 %cmp8, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = mul i32 %ts, %y
%xtraiter = and i32 %y, 1
%1 = icmp eq i32 %y, 1
br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i32 %y, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%last.011 = phi i32 [ 0, %for.body.preheader.new ], [ %conv2.1, %for.body ]
%mon.addr.09 = phi i32 [ %mon, %for.body.preheader.new ], [ %sub.1, %for.body ]
%niter = phi i32 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%conv = sitofp i32 %last.011 to double
%conv1 = sitofp i32 %mon.addr.09 to double
%2 = tail call double @llvm.fmuladd.f64(double %conv1, double %r, double %conv)
%conv2 = fptosi double %2 to i32
%sub = sub nsw i32 %mon.addr.09, %ts
%conv.1 = sitofp i32 %conv2 to double
%conv1.1 = sitofp i32 %sub to double
%3 = tail call double @llvm.fmuladd.f64(double %conv1.1, double %r, double %conv.1)
%conv2.1 = fptosi double %3 to i32
%sub.1 = sub nsw i32 %sub, %ts
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa.loopexit, label %for.body, !llvm.loop !5
for.end.loopexit.unr-lcssa.loopexit: ; preds = %for.body
%4 = sitofp i32 %conv2.1 to double
br label %for.end.loopexit.unr-lcssa
for.end.loopexit.unr-lcssa: ; preds = %for.end.loopexit.unr-lcssa.loopexit, %for.body.preheader
%conv2.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %conv2.1, %for.end.loopexit.unr-lcssa.loopexit ]
%last.011.unr = phi double [ 0.000000e+00, %for.body.preheader ], [ %4, %for.end.loopexit.unr-lcssa.loopexit ]
%mon.addr.09.unr = phi i32 [ %mon, %for.body.preheader ], [ %sub.1, %for.end.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
%conv1.epil = sitofp i32 %mon.addr.09.unr to double
%5 = tail call double @llvm.fmuladd.f64(double %conv1.epil, double %r, double %last.011.unr)
%conv2.epil = fptosi double %5 to i32
%conv2.lcssa = select i1 %lcmp.mod.not, i32 %conv2.lcssa.ph, i32 %conv2.epil
%6 = sub i32 %mon, %0
br label %for.end
for.end: ; preds = %for.end.loopexit.unr-lcssa, %entry
%mon.addr.0.lcssa = phi i32 [ %mon, %entry ], [ %6, %for.end.loopexit.unr-lcssa ]
%last.0.lcssa = phi i32 [ 0, %entry ], [ %conv2.lcssa, %for.end.loopexit.unr-lcssa ]
%add = add nsw i32 %last.0.lcssa, %mon.addr.0.lcssa
ret i32 %add
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @fukuri(double noundef %r, i32 noundef %y, i32 noundef %mon, i32 noundef %ts) local_unnamed_addr #0 {
entry:
%cmp7 = icmp sgt i32 %y, 0
br i1 %cmp7, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%conv2 = sitofp i32 %ts to double
%xtraiter = and i32 %y, 3
%0 = icmp ult i32 %y, 4
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %y, -4
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%mon.addr.08 = phi i32 [ %mon, %for.body.lr.ph.new ], [ %conv3.3, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.body ]
%conv = sitofp i32 %mon.addr.08 to double
%1 = tail call double @llvm.fmuladd.f64(double %conv, double %r, double %conv)
%sub = fsub double %1, %conv2
%conv3 = fptosi double %sub to i32
%conv.1 = sitofp i32 %conv3 to double
%2 = tail call double @llvm.fmuladd.f64(double %conv.1, double %r, double %conv.1)
%sub.1 = fsub double %2, %conv2
%conv3.1 = fptosi double %sub.1 to i32
%conv.2 = sitofp i32 %conv3.1 to double
%3 = tail call double @llvm.fmuladd.f64(double %conv.2, double %r, double %conv.2)
%sub.2 = fsub double %3, %conv2
%conv3.2 = fptosi double %sub.2 to i32
%conv.3 = sitofp i32 %conv3.2 to double
%4 = tail call double @llvm.fmuladd.f64(double %conv.3, double %r, double %conv.3)
%sub.3 = fsub double %4, %conv2
%conv3.3 = fptosi double %sub.3 to i32
%niter.next.3 = add i32 %niter, 4
%niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%conv3.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %conv3.3, %for.body ]
%mon.addr.08.unr = phi i32 [ %mon, %for.body.lr.ph ], [ %conv3.3, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%mon.addr.08.epil = phi i32 [ %conv3.epil, %for.body.epil ], [ %mon.addr.08.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%conv.epil = sitofp i32 %mon.addr.08.epil to double
%5 = tail call double @llvm.fmuladd.f64(double %conv.epil, double %r, double %conv.epil)
%sub.epil = fsub double %5, %conv2
%conv3.epil = fptosi double %sub.epil to i32
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !8
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%mon.addr.0.lcssa = phi i32 [ %mon, %entry ], [ %conv3.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %conv3.epil, %for.body.epil ]
ret i32 %mon.addr.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @remain(i32 noundef %n, i32 noundef %mon, i32 noundef %y) local_unnamed_addr #3 {
entry:
%x = alloca i32, align 4
%ts = alloca i32, align 4
%r = alloca double, align 8
%0 = zext i32 %n to i64
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ts) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #6
%cmp29 = icmp sgt i32 %n, 0
br i1 %cmp29, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%cmp8.i = icmp sgt i32 %y, 0
br i1 %cmp8.i, label %for.body.us.us.preheader, label %for.body
for.body.us.us.preheader: ; preds = %for.body.lr.ph
%xtraiter = and i32 %y, 3
%1 = icmp ult i32 %y, 4
%unroll_iter = and i32 %y, -4
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
%xtraiter77 = and i32 %y, 1
%2 = icmp eq i32 %y, 1
%unroll_iter81 = and i32 %y, -2
%lcmp.mod79.not = icmp eq i32 %xtraiter77, 0
br label %for.body.us.us
for.body.us.us: ; preds = %for.body.us.us.preheader, %if.end.us.us
%indvars.iv68 = phi i64 [ %indvars.iv.next69, %if.end.us.us ], [ 0, %for.body.us.us.preheader ]
%max.030.us.us = phi i32 [ %spec.select.us.us, %if.end.us.us ], [ 0, %for.body.us.us.preheader ]
%call.us.us = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %r, ptr noundef nonnull %ts)
%3 = load i32, ptr %x, align 4, !tbaa !10
%cmp1.us.us = icmp eq i32 %3, 0
%4 = load double, ptr %r, align 8, !tbaa !14
%5 = load i32, ptr %ts, align 4, !tbaa !10
br i1 %cmp1.us.us, label %for.body.i.us.us.preheader, label %if.else.us.us
for.body.i.us.us.preheader: ; preds = %for.body.us.us
br i1 %2, label %for.end.loopexit.i.us.us.unr-lcssa, label %for.body.i.us.us
if.else.us.us: ; preds = %for.body.us.us
%conv2.i23.us.us = sitofp i32 %5 to double
br i1 %1, label %if.end.us.us.loopexit.unr-lcssa, label %for.body.i24.us.us
for.body.i24.us.us: ; preds = %if.else.us.us, %for.body.i24.us.us
%mon.addr.08.i.us.us = phi i32 [ %conv3.i.us.us.3, %for.body.i24.us.us ], [ %mon, %if.else.us.us ]
%niter = phi i32 [ %niter.next.3, %for.body.i24.us.us ], [ 0, %if.else.us.us ]
%conv.i25.us.us = sitofp i32 %mon.addr.08.i.us.us to double
%6 = call double @llvm.fmuladd.f64(double %conv.i25.us.us, double %4, double %conv.i25.us.us)
%sub.i26.us.us = fsub double %6, %conv2.i23.us.us
%conv3.i.us.us = fptosi double %sub.i26.us.us to i32
%conv.i25.us.us.1 = sitofp i32 %conv3.i.us.us to double
%7 = call double @llvm.fmuladd.f64(double %conv.i25.us.us.1, double %4, double %conv.i25.us.us.1)
%sub.i26.us.us.1 = fsub double %7, %conv2.i23.us.us
%conv3.i.us.us.1 = fptosi double %sub.i26.us.us.1 to i32
%conv.i25.us.us.2 = sitofp i32 %conv3.i.us.us.1 to double
%8 = call double @llvm.fmuladd.f64(double %conv.i25.us.us.2, double %4, double %conv.i25.us.us.2)
%sub.i26.us.us.2 = fsub double %8, %conv2.i23.us.us
%conv3.i.us.us.2 = fptosi double %sub.i26.us.us.2 to i32
%conv.i25.us.us.3 = sitofp i32 %conv3.i.us.us.2 to double
%9 = call double @llvm.fmuladd.f64(double %conv.i25.us.us.3, double %4, double %conv.i25.us.us.3)
%sub.i26.us.us.3 = fsub double %9, %conv2.i23.us.us
%conv3.i.us.us.3 = fptosi double %sub.i26.us.us.3 to i32
%niter.next.3 = add i32 %niter, 4
%niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %if.end.us.us.loopexit.unr-lcssa, label %for.body.i24.us.us, !llvm.loop !7
for.body.i.us.us: ; preds = %for.body.i.us.us.preheader, %for.body.i.us.us
%last.011.i.us.us = phi i32 [ %conv2.i.us.us.1, %for.body.i.us.us ], [ 0, %for.body.i.us.us.preheader ]
%mon.addr.09.i.us.us = phi i32 [ %sub.i.us.us.1, %for.body.i.us.us ], [ %mon, %for.body.i.us.us.preheader ]
%niter82 = phi i32 [ %niter82.next.1, %for.body.i.us.us ], [ 0, %for.body.i.us.us.preheader ]
%conv.i.us.us = sitofp i32 %last.011.i.us.us to double
%conv1.i.us.us = sitofp i32 %mon.addr.09.i.us.us to double
%10 = call double @llvm.fmuladd.f64(double %conv1.i.us.us, double %4, double %conv.i.us.us)
%conv2.i.us.us = fptosi double %10 to i32
%sub.i.us.us = sub nsw i32 %mon.addr.09.i.us.us, %5
%conv.i.us.us.1 = sitofp i32 %conv2.i.us.us to double
%conv1.i.us.us.1 = sitofp i32 %sub.i.us.us to double
%11 = call double @llvm.fmuladd.f64(double %conv1.i.us.us.1, double %4, double %conv.i.us.us.1)
%conv2.i.us.us.1 = fptosi double %11 to i32
%sub.i.us.us.1 = sub nsw i32 %sub.i.us.us, %5
%niter82.next.1 = add i32 %niter82, 2
%niter82.ncmp.1 = icmp eq i32 %niter82.next.1, %unroll_iter81
br i1 %niter82.ncmp.1, label %for.end.loopexit.i.us.us.unr-lcssa, label %for.body.i.us.us, !llvm.loop !5
for.end.loopexit.i.us.us.unr-lcssa: ; preds = %for.body.i.us.us, %for.body.i.us.us.preheader
%conv2.i.us.us.lcssa.ph = phi i32 [ undef, %for.body.i.us.us.preheader ], [ %conv2.i.us.us.1, %for.body.i.us.us ]
%last.011.i.us.us.unr = phi i32 [ 0, %for.body.i.us.us.preheader ], [ %conv2.i.us.us.1, %for.body.i.us.us ]
%mon.addr.09.i.us.us.unr = phi i32 [ %mon, %for.body.i.us.us.preheader ], [ %sub.i.us.us.1, %for.body.i.us.us ]
br i1 %lcmp.mod79.not, label %for.end.loopexit.i.us.us, label %for.body.i.us.us.epil
for.body.i.us.us.epil: ; preds = %for.end.loopexit.i.us.us.unr-lcssa
%conv.i.us.us.epil = sitofp i32 %last.011.i.us.us.unr to double
%conv1.i.us.us.epil = sitofp i32 %mon.addr.09.i.us.us.unr to double
%12 = call double @llvm.fmuladd.f64(double %conv1.i.us.us.epil, double %4, double %conv.i.us.us.epil)
%conv2.i.us.us.epil = fptosi double %12 to i32
br label %for.end.loopexit.i.us.us
for.end.loopexit.i.us.us: ; preds = %for.end.loopexit.i.us.us.unr-lcssa, %for.body.i.us.us.epil
%conv2.i.us.us.lcssa = phi i32 [ %conv2.i.us.us.lcssa.ph, %for.end.loopexit.i.us.us.unr-lcssa ], [ %conv2.i.us.us.epil, %for.body.i.us.us.epil ]
%13 = mul i32 %5, %y
%14 = sub i32 %mon, %13
%add.i.us.us = add nsw i32 %14, %conv2.i.us.us.lcssa
br label %if.end.us.us
if.end.us.us.loopexit.unr-lcssa: ; preds = %for.body.i24.us.us, %if.else.us.us
%conv3.i.us.us.lcssa.ph = phi i32 [ undef, %if.else.us.us ], [ %conv3.i.us.us.3, %for.body.i24.us.us ]
%mon.addr.08.i.us.us.unr = phi i32 [ %mon, %if.else.us.us ], [ %conv3.i.us.us.3, %for.body.i24.us.us ]
br i1 %lcmp.mod.not, label %if.end.us.us, label %for.body.i24.us.us.epil
for.body.i24.us.us.epil: ; preds = %if.end.us.us.loopexit.unr-lcssa, %for.body.i24.us.us.epil
%mon.addr.08.i.us.us.epil = phi i32 [ %conv3.i.us.us.epil, %for.body.i24.us.us.epil ], [ %mon.addr.08.i.us.us.unr, %if.end.us.us.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.i24.us.us.epil ], [ 0, %if.end.us.us.loopexit.unr-lcssa ]
%conv.i25.us.us.epil = sitofp i32 %mon.addr.08.i.us.us.epil to double
%15 = call double @llvm.fmuladd.f64(double %conv.i25.us.us.epil, double %4, double %conv.i25.us.us.epil)
%sub.i26.us.us.epil = fsub double %15, %conv2.i23.us.us
%conv3.i.us.us.epil = fptosi double %sub.i26.us.us.epil to i32
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %if.end.us.us, label %for.body.i24.us.us.epil, !llvm.loop !16
if.end.us.us: ; preds = %if.end.us.us.loopexit.unr-lcssa, %for.body.i24.us.us.epil, %for.end.loopexit.i.us.us
%16 = phi i32 [ %add.i.us.us, %for.end.loopexit.i.us.us ], [ %conv3.i.us.us.lcssa.ph, %if.end.us.us.loopexit.unr-lcssa ], [ %conv3.i.us.us.epil, %for.body.i24.us.us.epil ]
%spec.select.us.us = call i32 @llvm.smax.i32(i32 %16, i32 %max.030.us.us)
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%exitcond72.not = icmp eq i64 %indvars.iv.next69, %0
br i1 %exitcond72.not, label %for.end, label %for.body.us.us, !llvm.loop !17
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.lr.ph ]
%max.030 = phi i32 [ %spec.select, %for.body ], [ 0, %for.body.lr.ph ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %r, ptr noundef nonnull %ts)
%spec.select = call i32 @llvm.smax.i32(i32 %mon, i32 %max.030)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !17
for.end: ; preds = %for.body, %if.end.us.us, %entry
%max.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select.us.us, %if.end.us.us ], [ %spec.select, %for.body ]
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ts) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6
ret i32 %max.0.lcssa
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%y = alloca i32, align 4
%mon = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %mon) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !10
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %mon, ptr noundef nonnull %y, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !10
%2 = load i32, ptr %mon, align 4, !tbaa !10
%3 = load i32, ptr %y, align 4, !tbaa !10
%call2 = call i32 @remain(i32 noundef %1, i32 noundef %2, i32 noundef %3), !range !18
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %call2)
%inc = add nuw nsw i32 %i.06, 1
%4 = load i32, ptr %m, align 4, !tbaa !10
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %mon) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
attributes #0 = { nofree nosync nounwind memory(none) 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.unroll.disable"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C/C++ TBAA"}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !12, i64 0}
!16 = distinct !{!16, !9}
!17 = distinct !{!17, !6}
!18 = !{i32 0, i32 -2147483648}
!19 = distinct !{!19, !6}
|
#include<stdio.h>
int main (){
long long int r;
scanf("%lld", &r);
long long int a1[r];
long long int a2 = 1;
long long int max = 1000000000000000000;
long long int hasil ;
for(int j=0;j<r;j++){
scanf("%lld", &a1[j]);
}
for(int h=0;h<r;h++){
if(a1[h]==0){
printf("0\n");
return 0;
}
}
for(int i=0;i<r;i++){
if(a1[i]<=max/a2){
a2*= a1[i];
}else{
printf("-1\n");
return 0;
}
}
printf("%lld\n", a2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329242/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329242/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%r = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r)
%0 = load i64, ptr %r, align 8, !tbaa !5
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %0, align 16
%2 = load i64, ptr %r, align 8, !tbaa !5
%cmp56 = icmp sgt i64 %2, 0
br i1 %cmp56, label %for.body, label %for.end36
for.cond3.preheader: ; preds = %for.body
%cmp5.not59 = icmp sgt i64 %3, 0
br i1 %cmp5.not59, label %for.body8, label %for.end36
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i64, ptr %r, align 8, !tbaa !5
%cmp = icmp sgt i64 %3, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond3: ; preds = %for.body8
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%exitcond.not = icmp eq i64 %indvars.iv.next70, %3
br i1 %exitcond.not, label %for.cond17.preheader, label %for.body8, !llvm.loop !11
for.cond17.preheader: ; preds = %for.cond3
br i1 %cmp5.not59, label %for.body22, label %for.end36
for.body8: ; preds = %for.cond3.preheader, %for.cond3
%indvars.iv69 = phi i64 [ %indvars.iv.next70, %for.cond3 ], [ 0, %for.cond3.preheader ]
%arrayidx10 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv69
%4 = load i64, ptr %arrayidx10, align 8, !tbaa !5
%cmp11 = icmp eq i64 %4, 0
br i1 %cmp11, label %if.then, label %for.cond3
if.then: ; preds = %for.body8
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup38
for.body22: ; preds = %for.cond17.preheader, %if.then27
%indvars.iv72 = phi i64 [ %indvars.iv.next73, %if.then27 ], [ 0, %for.cond17.preheader ]
%a2.063 = phi i64 [ %mul, %if.then27 ], [ 1, %for.cond17.preheader ]
%arrayidx24 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv72
%5 = load i64, ptr %arrayidx24, align 8, !tbaa !5
%div = sdiv i64 1000000000000000000, %a2.063
%cmp25.not = icmp sgt i64 %5, %div
br i1 %cmp25.not, label %if.else, label %if.then27
if.then27: ; preds = %for.body22
%mul = mul nsw i64 %5, %a2.063
%indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
%exitcond75.not = icmp eq i64 %indvars.iv.next73, %3
br i1 %exitcond75.not, label %for.end36, label %for.body22, !llvm.loop !12
if.else: ; preds = %for.body22
%puts54 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %cleanup38
for.end36: ; preds = %if.then27, %entry, %for.cond3.preheader, %for.cond17.preheader
%a2.0.lcssa = phi i64 [ 1, %for.cond17.preheader ], [ 1, %for.cond3.preheader ], [ 1, %entry ], [ %mul, %if.then27 ]
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %a2.0.lcssa)
br label %cleanup38
cleanup38: ; preds = %if.else, %if.then, %for.end36
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void){
int N;
long long a[100010];
int i;
long long s=1;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%lld",&a[i]);
}
int zero=0;
for(i=0;i<N;i++){
if(a[i]==0){
zero=zero+1;
}
if(zero>0){
printf("0\n");
return 0;
}
}
for(i=0;i<N;i++){
if(a[i]<=1000000000000000000/s){
s=s*a[i];
}
else{
printf("-1\n");
return 0;
}
}
printf("%lld",s);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329286/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329286/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
@str.4 = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%a = alloca [100010 x i64], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 800080, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp48 = icmp sgt i32 %0, 0
br i1 %cmp48, label %for.body, label %for.end28
for.cond2.preheader: ; preds = %for.body
%cmp350 = icmp sgt i32 %1, 0
br i1 %cmp350, label %for.body4.preheader, label %for.end28
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %1 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond2: ; preds = %for.body4
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%exitcond.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count
br i1 %exitcond.not, label %for.cond15.preheader, label %for.body4, !llvm.loop !11
for.cond15.preheader: ; preds = %for.cond2
br i1 %cmp350, label %for.body17.preheader, label %for.end28
for.body17.preheader: ; preds = %for.cond15.preheader
%wide.trip.count64 = zext i32 %1 to i64
br label %for.body17
for.body4: ; preds = %for.body4.preheader, %for.cond2
%indvars.iv58 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next59, %for.cond2 ]
%arrayidx6 = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %indvars.iv58
%3 = load i64, ptr %arrayidx6, align 8, !tbaa !12
%cmp7 = icmp eq i64 %3, 0
br i1 %cmp7, label %if.then9, label %for.cond2
if.then9: ; preds = %for.body4
%puts46 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %cleanup
for.body17: ; preds = %for.body17.preheader, %if.then21
%indvars.iv61 = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next62, %if.then21 ]
%s.054 = phi i64 [ 1, %for.body17.preheader ], [ %mul, %if.then21 ]
%arrayidx19 = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %indvars.iv61
%4 = load i64, ptr %arrayidx19, align 8, !tbaa !12
%div = sdiv i64 1000000000000000000, %s.054
%cmp20.not = icmp sgt i64 %4, %div
br i1 %cmp20.not, label %if.else, label %if.then21
if.then21: ; preds = %for.body17
%mul = mul nsw i64 %4, %s.054
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%exitcond65.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count64
br i1 %exitcond65.not, label %for.end28, label %for.body17, !llvm.loop !14
if.else: ; preds = %for.body17
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
for.end28: ; preds = %if.then21, %entry, %for.cond2.preheader, %for.cond15.preheader
%s.0.lcssa = phi i64 [ 1, %for.cond15.preheader ], [ 1, %for.cond2.preheader ], [ 1, %entry ], [ %mul, %if.then21 ]
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %s.0.lcssa)
br label %cleanup
cleanup: ; preds = %for.end28, %if.else, %if.then9
call void @llvm.lifetime.end.p0(i64 800080, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
long long a [100010];
int main (){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%lld",&a[i]);
int zero =0;
for(int i=0;i<n;i++)if(a[i]==0) zero ++;
if(zero >0){
// a[i] contains 0
printf("0\n");
return 0;
}
long long prod =1;
for(int i=0;i<n;i++){
if(a[i ] <=1000000000000000000/ prod ){
// This condition is equivalent to prod*a[i] <=10ˆ18
prod *=a[i];
}else{
printf("-1\n");
return 0;
}
}
printf("%lld\n",prod );
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329329/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329329/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@a = dso_local global [100010 x i64] zeroinitializer, align 16
@.str.4 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
@str.5 = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp51 = icmp sgt i32 %0, 0
br i1 %cmp51, label %for.body, label %for.end33
for.cond3.preheader: ; preds = %for.body
%cmp453 = icmp sgt i32 %11, 0
br i1 %cmp453, label %for.body6.preheader, label %for.end33
for.body6.preheader: ; preds = %for.cond3.preheader
%wide.trip.count = zext i32 %11 to i64
%min.iters.check = icmp ult i32 %11, 4
br i1 %min.iters.check, label %for.body6.preheader84, label %vector.ph
vector.ph: ; preds = %for.body6.preheader
%n.vec = and i64 %wide.trip.count, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi82 = phi <2 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%1 = getelementptr inbounds [100010 x i64], ptr @a, i64 0, i64 %index
%wide.load = load <2 x i64>, ptr %1, align 16, !tbaa !9
%2 = getelementptr inbounds i64, ptr %1, i64 2
%wide.load83 = load <2 x i64>, ptr %2, align 16, !tbaa !9
%3 = icmp eq <2 x i64> %wide.load, zeroinitializer
%4 = icmp eq <2 x i64> %wide.load83, zeroinitializer
%5 = zext <2 x i1> %3 to <2 x i32>
%6 = zext <2 x i1> %4 to <2 x i32>
%7 = add <2 x i32> %vec.phi, %5
%8 = add <2 x i32> %vec.phi82, %6
%index.next = add nuw i64 %index, 4
%9 = icmp eq i64 %index.next, %n.vec
br i1 %9, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i32> %8, %7
%10 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup5, label %for.body6.preheader84
for.body6.preheader84: ; preds = %for.body6.preheader, %middle.block
%indvars.iv63.ph = phi i64 [ 0, %for.body6.preheader ], [ %n.vec, %middle.block ]
%zero.054.ph = phi i32 [ 0, %for.body6.preheader ], [ %10, %middle.block ]
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100010 x i64], ptr @a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp = icmp slt i64 %indvars.iv.next, %12
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !15
for.cond.cleanup5: ; preds = %for.body6, %middle.block
%spec.select.lcssa = phi i32 [ %10, %middle.block ], [ %spec.select, %for.body6 ]
%.not = icmp eq i32 %spec.select.lcssa, 0
br i1 %.not, label %for.cond19.preheader, label %if.then15
for.cond19.preheader: ; preds = %for.cond.cleanup5
br i1 %cmp453, label %for.body22.preheader, label %for.end33
for.body22.preheader: ; preds = %for.cond19.preheader
%wide.trip.count69 = zext i32 %11 to i64
br label %for.body22
for.body6: ; preds = %for.body6.preheader84, %for.body6
%indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.body6 ], [ %indvars.iv63.ph, %for.body6.preheader84 ]
%zero.054 = phi i32 [ %spec.select, %for.body6 ], [ %zero.054.ph, %for.body6.preheader84 ]
%arrayidx8 = getelementptr inbounds [100010 x i64], ptr @a, i64 0, i64 %indvars.iv63
%13 = load i64, ptr %arrayidx8, align 8, !tbaa !9
%cmp9 = icmp eq i64 %13, 0
%inc10 = zext i1 %cmp9 to i32
%spec.select = add nuw nsw i32 %zero.054, %inc10
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%exitcond.not = icmp eq i64 %indvars.iv.next64, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !16
if.then15: ; preds = %for.cond.cleanup5
%puts49 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %cleanup36
for.body22: ; preds = %for.body22.preheader, %if.then26
%indvars.iv66 = phi i64 [ 0, %for.body22.preheader ], [ %indvars.iv.next67, %if.then26 ]
%prod.058 = phi i64 [ 1, %for.body22.preheader ], [ %mul, %if.then26 ]
%arrayidx24 = getelementptr inbounds [100010 x i64], ptr @a, i64 0, i64 %indvars.iv66
%14 = load i64, ptr %arrayidx24, align 8, !tbaa !9
%div = sdiv i64 1000000000000000000, %prod.058
%cmp25.not = icmp sgt i64 %14, %div
br i1 %cmp25.not, label %if.else, label %if.then26
if.then26: ; preds = %for.body22
%mul = mul nsw i64 %14, %prod.058
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond70.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count69
br i1 %exitcond70.not, label %for.end33, label %for.body22, !llvm.loop !17
if.else: ; preds = %for.body22
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup36
for.end33: ; preds = %if.then26, %for.cond3.preheader, %entry, %for.cond19.preheader
%prod.0.lcssa = phi i64 [ 1, %for.cond19.preheader ], [ 1, %entry ], [ 1, %for.cond3.preheader ], [ %mul, %if.then26 ]
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %prod.0.lcssa)
br label %cleanup36
cleanup36: ; preds = %if.else, %for.end33, %if.then15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v2i32(<2 x i32>) #4
attributes #0 = { 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 #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 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!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 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12, !14, !13}
!17 = distinct !{!17, !12}
|
#include <stdio.h>
long long a [100010];
int main (){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%lld",&a[i]);
int zero =0;
for(int i=0;i<n;i++)if(a[i]==0) zero ++;
if(zero >0){
// a[i] contains 0
printf("0\n");
return 0;
}
long long prod =1;
for(int i=0;i<n;i++){
if(a[i ] <=1000000000000000000/ prod ){
// This condition is equivalent to
prod *=a[i];
}else{
printf("-1\n");
return 0;
}
}
printf("%lld\n",prod );
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329372/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329372/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@a = dso_local global [100010 x i64] zeroinitializer, align 16
@.str.4 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
@str.5 = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp51 = icmp sgt i32 %0, 0
br i1 %cmp51, label %for.body, label %for.end33
for.cond3.preheader: ; preds = %for.body
%cmp453 = icmp sgt i32 %11, 0
br i1 %cmp453, label %for.body6.preheader, label %for.end33
for.body6.preheader: ; preds = %for.cond3.preheader
%wide.trip.count = zext i32 %11 to i64
%min.iters.check = icmp ult i32 %11, 4
br i1 %min.iters.check, label %for.body6.preheader84, label %vector.ph
vector.ph: ; preds = %for.body6.preheader
%n.vec = and i64 %wide.trip.count, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi82 = phi <2 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%1 = getelementptr inbounds [100010 x i64], ptr @a, i64 0, i64 %index
%wide.load = load <2 x i64>, ptr %1, align 16, !tbaa !9
%2 = getelementptr inbounds i64, ptr %1, i64 2
%wide.load83 = load <2 x i64>, ptr %2, align 16, !tbaa !9
%3 = icmp eq <2 x i64> %wide.load, zeroinitializer
%4 = icmp eq <2 x i64> %wide.load83, zeroinitializer
%5 = zext <2 x i1> %3 to <2 x i32>
%6 = zext <2 x i1> %4 to <2 x i32>
%7 = add <2 x i32> %vec.phi, %5
%8 = add <2 x i32> %vec.phi82, %6
%index.next = add nuw i64 %index, 4
%9 = icmp eq i64 %index.next, %n.vec
br i1 %9, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i32> %8, %7
%10 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup5, label %for.body6.preheader84
for.body6.preheader84: ; preds = %for.body6.preheader, %middle.block
%indvars.iv63.ph = phi i64 [ 0, %for.body6.preheader ], [ %n.vec, %middle.block ]
%zero.054.ph = phi i32 [ 0, %for.body6.preheader ], [ %10, %middle.block ]
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100010 x i64], ptr @a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp = icmp slt i64 %indvars.iv.next, %12
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !15
for.cond.cleanup5: ; preds = %for.body6, %middle.block
%spec.select.lcssa = phi i32 [ %10, %middle.block ], [ %spec.select, %for.body6 ]
%.not = icmp eq i32 %spec.select.lcssa, 0
br i1 %.not, label %for.cond19.preheader, label %if.then15
for.cond19.preheader: ; preds = %for.cond.cleanup5
br i1 %cmp453, label %for.body22.preheader, label %for.end33
for.body22.preheader: ; preds = %for.cond19.preheader
%wide.trip.count69 = zext i32 %11 to i64
br label %for.body22
for.body6: ; preds = %for.body6.preheader84, %for.body6
%indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.body6 ], [ %indvars.iv63.ph, %for.body6.preheader84 ]
%zero.054 = phi i32 [ %spec.select, %for.body6 ], [ %zero.054.ph, %for.body6.preheader84 ]
%arrayidx8 = getelementptr inbounds [100010 x i64], ptr @a, i64 0, i64 %indvars.iv63
%13 = load i64, ptr %arrayidx8, align 8, !tbaa !9
%cmp9 = icmp eq i64 %13, 0
%inc10 = zext i1 %cmp9 to i32
%spec.select = add nuw nsw i32 %zero.054, %inc10
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%exitcond.not = icmp eq i64 %indvars.iv.next64, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !16
if.then15: ; preds = %for.cond.cleanup5
%puts49 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %cleanup36
for.body22: ; preds = %for.body22.preheader, %if.then26
%indvars.iv66 = phi i64 [ 0, %for.body22.preheader ], [ %indvars.iv.next67, %if.then26 ]
%prod.058 = phi i64 [ 1, %for.body22.preheader ], [ %mul, %if.then26 ]
%arrayidx24 = getelementptr inbounds [100010 x i64], ptr @a, i64 0, i64 %indvars.iv66
%14 = load i64, ptr %arrayidx24, align 8, !tbaa !9
%div = sdiv i64 1000000000000000000, %prod.058
%cmp25.not = icmp sgt i64 %14, %div
br i1 %cmp25.not, label %if.else, label %if.then26
if.then26: ; preds = %for.body22
%mul = mul nsw i64 %14, %prod.058
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond70.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count69
br i1 %exitcond70.not, label %for.end33, label %for.body22, !llvm.loop !17
if.else: ; preds = %for.body22
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup36
for.end33: ; preds = %if.then26, %for.cond3.preheader, %entry, %for.cond19.preheader
%prod.0.lcssa = phi i64 [ 1, %for.cond19.preheader ], [ 1, %entry ], [ 1, %for.cond3.preheader ], [ %mul, %if.then26 ]
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %prod.0.lcssa)
br label %cleanup36
cleanup36: ; preds = %if.else, %for.end33, %if.then15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v2i32(<2 x i32>) #4
attributes #0 = { 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 #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 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!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 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12, !14, !13}
!17 = distinct !{!17, !12}
|
#include<stdio.h>
int main()
{
int n;
scanf("%d", &n);
long long a, ans=1;
for(int i=0; i<n; i++)
{
scanf("%lld", &a);
if(a==0)
{
ans=0;
break;
}
if(a>1000000000000000000/ans)
ans=-1;
if(ans!=-1)
ans*=a;
}
printf("%lld\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329422/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329422/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %cleanup
for.body: ; preds = %entry, %if.end
%i.020 = phi i32 [ %inc, %if.end ], [ 0, %entry ]
%ans.019 = phi i64 [ %spec.select, %if.end ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%1 = load i64, ptr %a, align 8, !tbaa !9
%cmp2 = icmp eq i64 %1, 0
br i1 %cmp2, label %cleanup, label %if.end
if.end: ; preds = %for.body
%div = sdiv i64 1000000000000000000, %ans.019
%cmp3 = icmp sgt i64 %1, %div
%cmp6.not17 = icmp eq i64 %ans.019, -1
%cmp6.not = or i1 %cmp6.not17, %cmp3
%mul = mul nsw i64 %1, %ans.019
%spec.select = select i1 %cmp6.not, i64 -1, i64 %mul
%inc = add nuw nsw i32 %i.020, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %cleanup, !llvm.loop !11
cleanup: ; preds = %if.end, %for.body, %entry
%ans.2 = phi i64 [ 1, %entry ], [ 0, %for.body ], [ %spec.select, %if.end ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.2)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!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 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#define N 100000
int main()
{
int a;
unsigned long long z = 1;
scanf("%d", &a);
unsigned long long s[N];
unsigned long long n = 0;
int count = 0;
int flag = 0;
for (int i = 0; i < a; i++)
{
scanf("%lld", &s[i]);
if(s[i]==0){
flag = 1;
break;
}
if (s[i] > 1000000000000000000){
flag = 2;
}
n = s[i];
for (int j = 0; j < 18; j++)
{
break;
n = s[i] / 10;
if (n > 10)
count++;
}
}
if (flag == 1){
printf("0");
}
else if (flag == 2 || count>=18){
printf("-1");
}
else{
for (int i = 0; i < a; i++)
{
if (1000000000000000000/s[i]<z){
flag = 3;
break;
}
if (s[i] * z > 1000000000000000000)
{
printf("-1");
flag = 3;
break;
}
else
z = s[i] * z;
}
if(flag==3)
printf("-1");
if(flag==0){
printf("%lld", z);
}
}
printf("\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329480/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329480/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%s = alloca [100000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %s) #4
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp84 = icmp sgt i32 %0, 0
br i1 %cmp84, label %for.body, label %if.then57
for.body: ; preds = %entry, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %entry ]
%flag.085 = phi i32 [ %spec.select, %if.end ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i64], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%1 = load i64, ptr %arrayidx, align 8, !tbaa !9
%cmp4 = icmp eq i64 %1, 0
br i1 %cmp4, label %if.then21, label %if.end
if.end: ; preds = %for.body
%cmp7 = icmp ugt i64 %1, 1000000000000000000
%spec.select = select i1 %cmp7, i32 2, i32 %flag.085
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %cleanup18, !llvm.loop !11
cleanup18: ; preds = %if.end
switch i32 %spec.select, label %for.cond29.preheader [
i32 1, label %if.then21
i32 2, label %if.then25
]
for.cond29.preheader: ; preds = %cleanup18
%cmp3087 = icmp sgt i32 %2, 0
br i1 %cmp3087, label %for.body32.preheader, label %cleanup50
for.body32.preheader: ; preds = %for.cond29.preheader
%wide.trip.count = zext i32 %2 to i64
br label %for.body32
if.then21: ; preds = %for.body, %cleanup18
%putchar = call i32 @putchar(i32 48)
br label %if.end61
if.then25: ; preds = %cleanup18
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
br label %if.end61
for.cond29: ; preds = %if.end37
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%exitcond.not = icmp eq i64 %indvars.iv.next94, %wide.trip.count
br i1 %exitcond.not, label %cleanup50, label %for.body32, !llvm.loop !13
for.body32: ; preds = %for.body32.preheader, %for.cond29
%indvars.iv93 = phi i64 [ 0, %for.body32.preheader ], [ %indvars.iv.next94, %for.cond29 ]
%z.088 = phi i64 [ 1, %for.body32.preheader ], [ %mul, %for.cond29 ]
%arrayidx34 = getelementptr inbounds [100000 x i64], ptr %s, i64 0, i64 %indvars.iv93
%4 = load i64, ptr %arrayidx34, align 8, !tbaa !9
%div = udiv i64 1000000000000000000, %4
%cmp35 = icmp ult i64 %div, %z.088
br i1 %cmp35, label %if.then53, label %if.end37
if.end37: ; preds = %for.body32
%mul = mul i64 %4, %z.088
%cmp40 = icmp ugt i64 %mul, 1000000000000000000
br i1 %cmp40, label %if.then41, label %for.cond29
if.then41: ; preds = %if.end37
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
br label %if.then53
cleanup50: ; preds = %for.cond29, %for.cond29.preheader
%z.0.lcssa = phi i64 [ 1, %for.cond29.preheader ], [ %mul, %for.cond29 ]
%cond = icmp eq i32 %flag.085, 0
br i1 %cond, label %if.then57, label %if.end61
if.then53: ; preds = %for.body32, %if.then41
%call54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
br label %if.end61
if.then57: ; preds = %cleanup50, %entry
%z.0.lcssa103 = phi i64 [ %z.0.lcssa, %cleanup50 ], [ 1, %entry ]
%call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %z.0.lcssa103)
br label %if.end61
if.end61: ; preds = %cleanup50, %if.then53, %if.then25, %if.then57, %if.then21
%putchar78 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!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 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include<stdio.h>
#include<stdlib.h>
#define MAX 200000
#define INF 2000000000
int compare_int(const void *a,const void *b){
return *(int*)a-*(int*)b;
}
int main(){
int n,m;
int a[MAX+1];
int b[MAX+1];
int j=0,k=0;
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
a[n]=INF;
qsort(a,n,sizeof(int),compare_int);
scanf("%d",&m);
for(int i=0;i<m;i++)
scanf("%d",&b[i]);
b[m]=INF;
qsort(b,m,sizeof(int),compare_int);
for(int i=0;i<n+m;i++){
if(a[j]==INF && b[k]==INF)break;
if(a[j] < b[k])
printf("%d\n",a[j++]);
else if(a[j] > b[k])
printf("%d\n",b[k++]);
else if(a[j]==b[k]){
printf("%d\n",a[j]);
int temp=a[j];
while(a[j]==temp)j++;
while(b[k]==temp)k++;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329523/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329523/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca [200001 x i32], align 16
%b = alloca [200001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 800004, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 800004, ptr nonnull %b) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp119 = icmp sgt i32 %0, 0
br i1 %cmp119, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre141 = sext i32 %0 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%idxprom2.pre-phi = phi i64 [ %.pre141, %entry.for.cond.cleanup_crit_edge ], [ %3, %for.body ]
%arrayidx3 = getelementptr inbounds [200001 x i32], ptr %a, i64 0, i64 %idxprom2.pre-phi
store i32 2000000000, ptr %arrayidx3, align 4, !tbaa !5
call void @qsort(ptr noundef nonnull %a, i64 noundef %idxprom2.pre-phi, i64 noundef 4, ptr noundef nonnull @compare_int) #5
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%1 = load i32, ptr %m, align 4, !tbaa !5
%cmp7121 = icmp sgt i32 %1, 0
br i1 %cmp7121, label %for.body10, label %for.cond.cleanup.for.cond.cleanup9_crit_edge
for.cond.cleanup.for.cond.cleanup9_crit_edge: ; preds = %for.cond.cleanup
%.pre142 = sext i32 %1 to i64
br label %for.cond.cleanup9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200001 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond.cleanup9: ; preds = %for.body10, %for.cond.cleanup.for.cond.cleanup9_crit_edge
%idxprom17.pre-phi = phi i64 [ %.pre142, %for.cond.cleanup.for.cond.cleanup9_crit_edge ], [ %7, %for.body10 ]
%arrayidx18 = getelementptr inbounds [200001 x i32], ptr %b, i64 0, i64 %idxprom17.pre-phi
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
call void @qsort(ptr noundef nonnull %b, i64 noundef %idxprom17.pre-phi, i64 noundef 4, ptr noundef nonnull @compare_int) #5
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %m, align 4, !tbaa !5
%add124 = add nsw i32 %5, %4
%cmp23125 = icmp sgt i32 %add124, 0
br i1 %cmp23125, label %for.body26, label %cleanup
for.body10: ; preds = %for.cond.cleanup, %for.body10
%indvars.iv132 = phi i64 [ %indvars.iv.next133, %for.body10 ], [ 0, %for.cond.cleanup ]
%arrayidx12 = getelementptr inbounds [200001 x i32], ptr %b, i64 0, i64 %indvars.iv132
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx12)
%indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
%6 = load i32, ptr %m, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp7 = icmp slt i64 %indvars.iv.next133, %7
br i1 %cmp7, label %for.body10, label %for.cond.cleanup9, !llvm.loop !11
for.body26: ; preds = %for.cond.cleanup9, %for.inc86
%i21.0128 = phi i32 [ %inc87, %for.inc86 ], [ 0, %for.cond.cleanup9 ]
%k.0127 = phi i32 [ %k.2, %for.inc86 ], [ 0, %for.cond.cleanup9 ]
%j.0126 = phi i32 [ %j.2, %for.inc86 ], [ 0, %for.cond.cleanup9 ]
%idxprom27 = sext i32 %j.0126 to i64
%arrayidx28 = getelementptr inbounds [200001 x i32], ptr %a, i64 0, i64 %idxprom27
%8 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%cmp29 = icmp eq i32 %8, 2000000000
%idxprom31 = sext i32 %k.0127 to i64
%arrayidx32 = getelementptr inbounds [200001 x i32], ptr %b, i64 0, i64 %idxprom31
%9 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%cmp33 = icmp eq i32 %9, 2000000000
%or.cond = select i1 %cmp29, i1 %cmp33, i1 false
br i1 %or.cond, label %cleanup, label %if.end
if.end: ; preds = %for.body26
%cmp39 = icmp slt i32 %8, %9
br i1 %cmp39, label %if.then41, label %if.else
if.then41: ; preds = %if.end
%inc42 = add nsw i32 %j.0126, 1
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
br label %for.inc86
if.else: ; preds = %if.end
%cmp50 = icmp sgt i32 %8, %9
br i1 %cmp50, label %if.then52, label %if.else57
if.then52: ; preds = %if.else
%inc53 = add nsw i32 %k.0127, 1
%call56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
br label %for.inc86
if.else57: ; preds = %if.else
%cmp62 = icmp eq i32 %8, %9
br i1 %cmp62, label %if.then64, label %for.inc86
if.then64: ; preds = %if.else57
%call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
%10 = load i32, ptr %arrayidx28, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %if.then64
%indvars.iv135 = phi i64 [ %indvars.iv.next136, %while.cond ], [ %idxprom27, %if.then64 ]
%arrayidx71 = getelementptr inbounds [200001 x i32], ptr %a, i64 0, i64 %indvars.iv135
%11 = load i32, ptr %arrayidx71, align 4, !tbaa !5
%cmp72 = icmp eq i32 %11, %10
%indvars.iv.next136 = add i64 %indvars.iv135, 1
br i1 %cmp72, label %while.cond, label %while.cond75, !llvm.loop !12
while.cond75: ; preds = %while.cond, %while.cond75
%indvars.iv138 = phi i64 [ %indvars.iv.next139, %while.cond75 ], [ %idxprom31, %while.cond ]
%arrayidx77 = getelementptr inbounds [200001 x i32], ptr %b, i64 0, i64 %indvars.iv138
%12 = load i32, ptr %arrayidx77, align 4, !tbaa !5
%cmp78 = icmp eq i32 %12, %10
%indvars.iv.next139 = add i64 %indvars.iv138, 1
br i1 %cmp78, label %while.cond75, label %for.inc86.loopexit, !llvm.loop !13
for.inc86.loopexit: ; preds = %while.cond75
%13 = trunc i64 %indvars.iv135 to i32
%14 = trunc i64 %indvars.iv138 to i32
br label %for.inc86
for.inc86: ; preds = %for.inc86.loopexit, %if.then41, %if.else57, %if.then52
%j.2 = phi i32 [ %inc42, %if.then41 ], [ %j.0126, %if.then52 ], [ %j.0126, %if.else57 ], [ %13, %for.inc86.loopexit ]
%k.2 = phi i32 [ %k.0127, %if.then41 ], [ %inc53, %if.then52 ], [ %k.0127, %if.else57 ], [ %14, %for.inc86.loopexit ]
%inc87 = add nuw nsw i32 %i21.0128, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%16 = load i32, ptr %m, align 4, !tbaa !5
%add = add nsw i32 %16, %15
%cmp23 = icmp slt i32 %inc87, %add
br i1 %cmp23, label %for.body26, label %cleanup, !llvm.loop !14
cleanup: ; preds = %for.inc86, %for.body26, %for.cond.cleanup9
call void @llvm.lifetime.end.p0(i64 800004, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 800004, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main()
{
int n, i, count = 0, real_count = 0;
long long int data, prev = 0;
scanf("%d", &n);
for(i = 0; i<n; i++)
{
scanf("%d", &data);
if(data <= prev)
count++;
if(count > real_count)
real_count = count;
if(data > prev)
count = 0;
prev = data;
}
printf("%d\n", real_count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329574/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329574/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%data = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %data) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %0, 0
br i1 %cmp16, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%prev.020 = phi i64 [ %1, %for.body ], [ 0, %entry ]
%real_count.019 = phi i32 [ %real_count.1, %for.body ], [ 0, %entry ]
%count.018 = phi i32 [ %count.2, %for.body ], [ 0, %entry ]
%i.017 = phi i32 [ %inc9, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data)
%1 = load i64, ptr %data, align 8, !tbaa !9
%cmp2.not = icmp sle i64 %1, %prev.020
%inc = zext i1 %cmp2.not to i32
%spec.select = add nsw i32 %count.018, %inc
%real_count.1 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %real_count.019)
%count.2 = select i1 %cmp2.not, i32 %spec.select, i32 0
%inc9 = add nuw nsw i32 %i.017, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc9, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%real_count.0.lcssa = phi i32 [ 0, %entry ], [ %real_count.1, %for.body ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %real_count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %data) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!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 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int n,i,max=0,count=0;
int h[100000];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&h[i]);
}
for(i=0;i<n-1;i++){
if(h[i]<h[i+1]){
if(max<count){
max=count;
}
count=0;
} else {
count++;
}
}
if(max<count){
max=count;
}
printf("%d",max);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329617/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329617/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%h = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %h) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp34 = icmp sgt i32 %0, 0
br i1 %cmp34, label %for.body, label %for.end16
for.cond2.preheader: ; preds = %for.body
%cmp336 = icmp sgt i32 %2, 1
br i1 %cmp336, label %for.body4.preheader, label %for.end16
for.body4.preheader: ; preds = %for.cond2.preheader
%sub = add nsw i32 %2, -1
%wide.trip.count = zext i32 %sub to i64
%.pre = load i32, ptr %h, align 16, !tbaa !5
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %sub, 1
br i1 %1, label %for.end16.loopexit.unr-lcssa, label %for.body4.preheader.new
for.body4.preheader.new: ; preds = %for.body4.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4, %for.body4.preheader.new
%4 = phi i32 [ %.pre, %for.body4.preheader.new ], [ %6, %for.body4 ]
%indvars.iv44 = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next45.1, %for.body4 ]
%count.039 = phi i32 [ 0, %for.body4.preheader.new ], [ %count.1.1, %for.body4 ]
%max.038 = phi i32 [ 0, %for.body4.preheader.new ], [ %max.2.1, %for.body4 ]
%niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.1, %for.body4 ]
%indvars.iv.next45 = or i64 %indvars.iv44, 1
%arrayidx8 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv.next45
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9 = icmp slt i32 %4, %5
%spec.select = call i32 @llvm.smax.i32(i32 %max.038, i32 %count.039)
%inc12 = add nsw i32 %count.039, 1
%max.2 = select i1 %cmp9, i32 %spec.select, i32 %max.038
%count.1 = select i1 %cmp9, i32 0, i32 %inc12
%indvars.iv.next45.1 = add nuw nsw i64 %indvars.iv44, 2
%arrayidx8.1 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv.next45.1
%6 = load i32, ptr %arrayidx8.1, align 8, !tbaa !5
%cmp9.1 = icmp slt i32 %5, %6
%spec.select.1 = call i32 @llvm.smax.i32(i32 %max.2, i32 %count.1)
%inc12.1 = add nsw i32 %count.1, 1
%max.2.1 = select i1 %cmp9.1, i32 %spec.select.1, i32 %max.2
%count.1.1 = select i1 %cmp9.1, i32 0, i32 %inc12.1
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end16.loopexit.unr-lcssa.loopexit, label %for.body4, !llvm.loop !11
for.end16.loopexit.unr-lcssa.loopexit: ; preds = %for.body4
%7 = add nuw nsw i64 %indvars.iv44, 3
br label %for.end16.loopexit.unr-lcssa
for.end16.loopexit.unr-lcssa: ; preds = %for.end16.loopexit.unr-lcssa.loopexit, %for.body4.preheader
%max.2.lcssa.ph = phi i32 [ undef, %for.body4.preheader ], [ %max.2.1, %for.end16.loopexit.unr-lcssa.loopexit ]
%count.1.lcssa.ph = phi i32 [ undef, %for.body4.preheader ], [ %count.1.1, %for.end16.loopexit.unr-lcssa.loopexit ]
%.unr = phi i32 [ %.pre, %for.body4.preheader ], [ %6, %for.end16.loopexit.unr-lcssa.loopexit ]
%indvars.iv44.unr = phi i64 [ 1, %for.body4.preheader ], [ %7, %for.end16.loopexit.unr-lcssa.loopexit ]
%count.039.unr = phi i32 [ 0, %for.body4.preheader ], [ %count.1.1, %for.end16.loopexit.unr-lcssa.loopexit ]
%max.038.unr = phi i32 [ 0, %for.body4.preheader ], [ %max.2.1, %for.end16.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end16, label %for.body4.epil
for.body4.epil: ; preds = %for.end16.loopexit.unr-lcssa
%arrayidx8.epil = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv44.unr
%8 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5
%cmp9.epil = icmp slt i32 %.unr, %8
%spec.select.epil = call i32 @llvm.smax.i32(i32 %max.038.unr, i32 %count.039.unr)
%inc12.epil = add nsw i32 %count.039.unr, 1
%max.2.epil = select i1 %cmp9.epil, i32 %spec.select.epil, i32 %max.038.unr
%count.1.epil = select i1 %cmp9.epil, i32 0, i32 %inc12.epil
br label %for.end16
for.end16: ; preds = %for.body4.epil, %for.end16.loopexit.unr-lcssa, %entry, %for.cond2.preheader
%max.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %max.2.lcssa.ph, %for.end16.loopexit.unr-lcssa ], [ %max.2.epil, %for.body4.epil ]
%count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %count.1.lcssa.ph, %for.end16.loopexit.unr-lcssa ], [ %count.1.epil, %for.body4.epil ]
%spec.select33 = call i32 @llvm.smax.i32(i32 %max.0.lcssa, i32 %count.0.lcssa)
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %spec.select33)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void)
{
int n,h[100000],p=0,max=0,i,j;
scanf("%d", &n);
for(i=0; i<n; i++)
scanf("%d", &h[i]);
for(i=1; i<n; i++)
{
if(h[i-1]>=h[i])
p++;
if(h[i-1]<h[i]||i==n-1)
{
if(max<p)
max=p;
p=0;
}
}
printf("%d\n", max);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329660/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329660/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%h = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %h) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp41 = icmp sgt i32 %0, 0
br i1 %cmp41, label %for.body, label %for.end26
for.cond2.preheader: ; preds = %for.body
%cmp343 = icmp sgt i32 %4, 1
br i1 %cmp343, label %for.body4.lr.ph, label %for.end26
for.body4.lr.ph: ; preds = %for.cond2.preheader
%sub17 = add nsw i32 %4, -1
%1 = zext i32 %sub17 to i64
%wide.trip.count = zext i32 %4 to i64
%.pre = load i32, ptr %h, align 16, !tbaa !5
%2 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %2, 1
%3 = icmp eq i32 %4, 2
br i1 %3, label %for.end26.loopexit.unr-lcssa, label %for.body4.lr.ph.new
for.body4.lr.ph.new: ; preds = %for.body4.lr.ph
%unroll_iter = and i64 %2, -2
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4, %for.body4.lr.ph.new
%6 = phi i32 [ %.pre, %for.body4.lr.ph.new ], [ %8, %for.body4 ]
%indvars.iv50 = phi i64 [ 1, %for.body4.lr.ph.new ], [ %indvars.iv.next51.1, %for.body4 ]
%p.046 = phi i32 [ 0, %for.body4.lr.ph.new ], [ %p.2.1, %for.body4 ]
%max.044 = phi i32 [ 0, %for.body4.lr.ph.new ], [ %max.2.1, %for.body4 ]
%niter = phi i64 [ 0, %for.body4.lr.ph.new ], [ %niter.next.1, %for.body4 ]
%arrayidx8 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv50
%7 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not = icmp slt i32 %6, %7
%inc10 = add nsw i32 %p.046, 1
%spec.select = select i1 %cmp9.not, i32 %p.046, i32 %inc10
%cmp18 = icmp eq i64 %indvars.iv50, %1
%or.cond = select i1 %cmp9.not, i1 true, i1 %cmp18
%spec.select40 = call i32 @llvm.smax.i32(i32 %max.044, i32 %spec.select)
%max.2 = select i1 %or.cond, i32 %spec.select40, i32 %max.044
%p.2 = select i1 %or.cond, i32 0, i32 %inc10
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%arrayidx8.1 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv.next51
%8 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5
%cmp9.not.1 = icmp slt i32 %7, %8
%inc10.1 = add nsw i32 %p.2, 1
%spec.select.1 = select i1 %cmp9.not.1, i32 %p.2, i32 %inc10.1
%cmp18.1 = icmp eq i64 %indvars.iv.next51, %1
%or.cond.1 = select i1 %cmp9.not.1, i1 true, i1 %cmp18.1
%spec.select40.1 = call i32 @llvm.smax.i32(i32 %max.2, i32 %spec.select.1)
%max.2.1 = select i1 %or.cond.1, i32 %spec.select40.1, i32 %max.2
%p.2.1 = select i1 %or.cond.1, i32 0, i32 %inc10.1
%indvars.iv.next51.1 = add nuw nsw i64 %indvars.iv50, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end26.loopexit.unr-lcssa, label %for.body4, !llvm.loop !11
for.end26.loopexit.unr-lcssa: ; preds = %for.body4, %for.body4.lr.ph
%max.2.lcssa.ph = phi i32 [ undef, %for.body4.lr.ph ], [ %max.2.1, %for.body4 ]
%.unr = phi i32 [ %.pre, %for.body4.lr.ph ], [ %8, %for.body4 ]
%indvars.iv50.unr = phi i64 [ 1, %for.body4.lr.ph ], [ %indvars.iv.next51.1, %for.body4 ]
%p.046.unr = phi i32 [ 0, %for.body4.lr.ph ], [ %p.2.1, %for.body4 ]
%max.044.unr = phi i32 [ 0, %for.body4.lr.ph ], [ %max.2.1, %for.body4 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end26, label %for.body4.epil
for.body4.epil: ; preds = %for.end26.loopexit.unr-lcssa
%arrayidx8.epil = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv50.unr
%9 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5
%cmp9.not.epil = icmp slt i32 %.unr, %9
%not.cmp9.not.epil = xor i1 %cmp9.not.epil, true
%inc10.epil = zext i1 %not.cmp9.not.epil to i32
%spec.select.epil = add nsw i32 %p.046.unr, %inc10.epil
%cmp18.epil = icmp eq i64 %indvars.iv50.unr, %1
%or.cond.epil = select i1 %cmp9.not.epil, i1 true, i1 %cmp18.epil
%spec.select40.epil = call i32 @llvm.smax.i32(i32 %max.044.unr, i32 %spec.select.epil)
%max.2.epil = select i1 %or.cond.epil, i32 %spec.select40.epil, i32 %max.044.unr
br label %for.end26
for.end26: ; preds = %for.body4.epil, %for.end26.loopexit.unr-lcssa, %entry, %for.cond2.preheader
%max.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %max.2.lcssa.ph, %for.end26.loopexit.unr-lcssa ], [ %max.2.epil, %for.body4.epil ]
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#define N 100000
int main() {
static int hh[N];
int n, i, cnt, max;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &hh[i]);
max = cnt = 0;
for (i = n - 2; i >= 0; i--) {
if (hh[i] >= hh[i + 1])
cnt++;
else
cnt = 0;
if (max < cnt)
max = cnt;
}
printf("%d\n", max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329703/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329703/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@main.hh = internal global [100000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %0, 0
br i1 %cmp26, label %for.body, label %for.end15
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp328 = icmp sgt i32 %1, 1
br i1 %cmp328, label %for.body4.preheader, label %for.end15
for.body4.preheader: ; preds = %for.end
%sub = add i32 %1, -2
%3 = zext i32 %sub to i64
%4 = add nuw nsw i64 %3, 1
%xtraiter = and i64 %4, 1
%5 = icmp eq i32 %sub, 0
br i1 %5, label %for.end15.loopexit.unr-lcssa, label %for.body4.preheader.new
for.body4.preheader.new: ; preds = %for.body4.preheader
%unroll_iter = and i64 %4, 8589934590
br label %for.body4
for.body4: ; preds = %for.body4, %for.body4.preheader.new
%indvars.iv35 = phi i64 [ %3, %for.body4.preheader.new ], [ %indvars.iv.next36.1, %for.body4 ]
%max.031 = phi i32 [ 0, %for.body4.preheader.new ], [ %max.1.1, %for.body4 ]
%cnt.030 = phi i32 [ 0, %for.body4.preheader.new ], [ %cnt.1.1, %for.body4 ]
%niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.1, %for.body4 ]
%arrayidx6 = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %indvars.iv35
%6 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%7 = add nuw nsw i64 %indvars.iv35, 1
%arrayidx8 = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %7
%8 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not = icmp slt i32 %6, %8
%inc10 = add nsw i32 %cnt.030, 1
%cnt.1 = select i1 %cmp9.not, i32 0, i32 %inc10
%max.1 = call i32 @llvm.smax.i32(i32 %max.031, i32 %cnt.1)
%indvars.iv.next36 = add nsw i64 %indvars.iv35, -1
%arrayidx6.1 = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %indvars.iv.next36
%9 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5
%arrayidx8.1 = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %indvars.iv35
%10 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5
%cmp9.not.1 = icmp slt i32 %9, %10
%inc10.1 = add nsw i32 %cnt.1, 1
%cnt.1.1 = select i1 %cmp9.not.1, i32 0, i32 %inc10.1
%max.1.1 = call i32 @llvm.smax.i32(i32 %max.1, i32 %cnt.1.1)
%indvars.iv.next36.1 = add nsw i64 %indvars.iv35, -2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end15.loopexit.unr-lcssa.loopexit, label %for.body4, !llvm.loop !11
for.end15.loopexit.unr-lcssa.loopexit: ; preds = %for.body4
%11 = add nsw i32 %cnt.1.1, 1
br label %for.end15.loopexit.unr-lcssa
for.end15.loopexit.unr-lcssa: ; preds = %for.end15.loopexit.unr-lcssa.loopexit, %for.body4.preheader
%max.1.lcssa.ph = phi i32 [ undef, %for.body4.preheader ], [ %max.1.1, %for.end15.loopexit.unr-lcssa.loopexit ]
%indvars.iv35.unr = phi i64 [ %3, %for.body4.preheader ], [ %indvars.iv.next36.1, %for.end15.loopexit.unr-lcssa.loopexit ]
%max.031.unr = phi i32 [ 0, %for.body4.preheader ], [ %max.1.1, %for.end15.loopexit.unr-lcssa.loopexit ]
%cnt.030.unr = phi i32 [ 1, %for.body4.preheader ], [ %11, %for.end15.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end15, label %for.body4.epil
for.body4.epil: ; preds = %for.end15.loopexit.unr-lcssa
%arrayidx6.epil = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %indvars.iv35.unr
%12 = load i32, ptr %arrayidx6.epil, align 4, !tbaa !5
%13 = add nuw nsw i64 %indvars.iv35.unr, 1
%arrayidx8.epil = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %13
%14 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5
%cmp9.not.epil = icmp slt i32 %12, %14
%cnt.1.epil = select i1 %cmp9.not.epil, i32 0, i32 %cnt.030.unr
%max.1.epil = call i32 @llvm.smax.i32(i32 %max.031.unr, i32 %cnt.1.epil)
br label %for.end15
for.end15: ; preds = %for.body4.epil, %for.end15.loopexit.unr-lcssa, %entry, %for.end
%max.0.lcssa = phi i32 [ 0, %for.end ], [ 0, %entry ], [ %max.1.lcssa.ph, %for.end15.loopexit.unr-lcssa ], [ %max.1.epil, %for.body4.epil ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(){
int n;
if(scanf("%d",&n)==1){}
int h[n];int i;
for(i=0;i<n;i++){
if(scanf("%d",&h[i])==1){}
}
int max=0;int tmp=0;
for(i=0;i<n-1;i++){
if(h[i]>=h[i+1]){
tmp++;
if(max<tmp){
max=tmp;
}
}else{
tmp=0;
}
}
printf("%d",max);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329747/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329747/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp133 = icmp sgt i32 %3, 0
br i1 %cmp133, label %for.body, label %for.end22
for.cond6.preheader: ; preds = %for.body
%cmp735 = icmp sgt i32 %5, 1
br i1 %cmp735, label %for.body8.preheader, label %for.end22
for.body8.preheader: ; preds = %for.cond6.preheader
%sub = add nsw i32 %5, -1
%wide.trip.count = zext i32 %sub to i64
%.pre = load i32, ptr %vla, align 16, !tbaa !5
%xtraiter = and i64 %wide.trip.count, 1
%4 = icmp eq i32 %sub, 1
br i1 %4, label %for.end22.loopexit.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp1, label %for.body, label %for.cond6.preheader, !llvm.loop !9
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%7 = phi i32 [ %.pre, %for.body8.preheader.new ], [ %10, %for.body8 ]
%indvars.iv42 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next43.1, %for.body8 ]
%tmp.038 = phi i32 [ 0, %for.body8.preheader.new ], [ %tmp.1.1, %for.body8 ]
%max.037 = phi i32 [ 0, %for.body8.preheader.new ], [ %max.1.1, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.1, %for.body8 ]
%indvars.iv.next43 = or i64 %indvars.iv42, 1
%arrayidx12 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next43
%8 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13.not = icmp slt i32 %7, %8
%inc15 = add nsw i32 %tmp.038, 1
%cmp16.not = icmp sgt i32 %max.037, %tmp.038
%9 = select i1 %cmp13.not, i1 true, i1 %cmp16.not
%max.1 = select i1 %9, i32 %max.037, i32 %inc15
%tmp.1 = select i1 %cmp13.not, i32 0, i32 %inc15
%indvars.iv.next43.1 = add nuw nsw i64 %indvars.iv42, 2
%arrayidx12.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next43.1
%10 = load i32, ptr %arrayidx12.1, align 8, !tbaa !5
%cmp13.not.1 = icmp slt i32 %8, %10
%inc15.1 = add nsw i32 %tmp.1, 1
%cmp16.not.1 = icmp sgt i32 %max.1, %tmp.1
%11 = select i1 %cmp13.not.1, i1 true, i1 %cmp16.not.1
%max.1.1 = select i1 %11, i32 %max.1, i32 %inc15.1
%tmp.1.1 = select i1 %cmp13.not.1, i32 0, i32 %inc15.1
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end22.loopexit.unr-lcssa.loopexit, label %for.body8, !llvm.loop !11
for.end22.loopexit.unr-lcssa.loopexit: ; preds = %for.body8
%12 = add nuw nsw i64 %indvars.iv42, 3
br label %for.end22.loopexit.unr-lcssa
for.end22.loopexit.unr-lcssa: ; preds = %for.end22.loopexit.unr-lcssa.loopexit, %for.body8.preheader
%max.1.lcssa.ph = phi i32 [ undef, %for.body8.preheader ], [ %max.1.1, %for.end22.loopexit.unr-lcssa.loopexit ]
%.unr = phi i32 [ %.pre, %for.body8.preheader ], [ %10, %for.end22.loopexit.unr-lcssa.loopexit ]
%indvars.iv42.unr = phi i64 [ 1, %for.body8.preheader ], [ %12, %for.end22.loopexit.unr-lcssa.loopexit ]
%tmp.038.unr = phi i32 [ 0, %for.body8.preheader ], [ %tmp.1.1, %for.end22.loopexit.unr-lcssa.loopexit ]
%max.037.unr = phi i32 [ 0, %for.body8.preheader ], [ %max.1.1, %for.end22.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end22, label %for.body8.epil
for.body8.epil: ; preds = %for.end22.loopexit.unr-lcssa
%arrayidx12.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv42.unr
%13 = load i32, ptr %arrayidx12.epil, align 4, !tbaa !5
%cmp13.not.epil = icmp slt i32 %.unr, %13
%inc15.epil = add nsw i32 %tmp.038.unr, 1
%cmp16.not.epil = icmp sgt i32 %max.037.unr, %tmp.038.unr
%14 = select i1 %cmp13.not.epil, i1 true, i1 %cmp16.not.epil
%max.1.epil = select i1 %14, i32 %max.037.unr, i32 %inc15.epil
br label %for.end22
for.end22: ; preds = %for.body8.epil, %for.end22.loopexit.unr-lcssa, %entry, %for.cond6.preheader
%max.0.lcssa = phi i32 [ 0, %for.cond6.preheader ], [ 0, %entry ], [ %max.1.lcssa.ph, %for.end22.loopexit.unr-lcssa ], [ %max.1.epil, %for.body8.epil ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %max.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#define MAX 1000000007
int main(void){
// Your code here!
long int step[100001];
long int N;
long int i;
long int max,tmp;
scanf("%ld",&N);
max = 0;
tmp = 0;
for(i=1;N>=i;i++){
scanf("%ld",&step[i]);
if(i!=1){
if(step[i-1]>=step[i]){
tmp++;
}
else{
tmp = 0;
}
if(tmp>=max) max = tmp;
}
}
printf("%ld\n",max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329790/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329790/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%step = alloca [100001 x i64], align 16
%N = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %step) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !5
%cmp.not21 = icmp slt i64 %0, 1
br i1 %cmp.not21, label %for.end, label %for.inc.peel
for.inc.peel: ; preds = %entry
%arrayidx.peel = getelementptr inbounds [100001 x i64], ptr %step, i64 0, i64 1
%call1.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.peel)
%1 = load i64, ptr %N, align 8, !tbaa !5
%cmp.not.not.peel = icmp sgt i64 %1, 1
br i1 %cmp.not.not.peel, label %for.inc, label %for.end
for.inc: ; preds = %for.inc.peel, %for.inc
%tmp.024 = phi i64 [ %tmp.1, %for.inc ], [ 0, %for.inc.peel ]
%max.023 = phi i64 [ %spec.select, %for.inc ], [ 0, %for.inc.peel ]
%i.022 = phi i64 [ %inc11, %for.inc ], [ 2, %for.inc.peel ]
%arrayidx = getelementptr inbounds [100001 x i64], ptr %step, i64 0, i64 %i.022
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%sub = add nsw i64 %i.022, -1
%arrayidx3 = getelementptr inbounds [100001 x i64], ptr %step, i64 0, i64 %sub
%2 = load i64, ptr %arrayidx3, align 8, !tbaa !5
%3 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp5.not = icmp slt i64 %2, %3
%inc = add nsw i64 %tmp.024, 1
%tmp.1 = select i1 %cmp5.not, i64 0, i64 %inc
%spec.select = call i64 @llvm.smax.i64(i64 %tmp.1, i64 %max.023)
%inc11 = add nuw nsw i64 %i.022, 1
%4 = load i64, ptr %N, align 8, !tbaa !5
%cmp.not.not = icmp sgt i64 %4, %i.022
br i1 %cmp.not.not, label %for.inc, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.inc.peel, %entry
%max.0.lcssa = phi i64 [ 0, %entry ], [ 0, %for.inc.peel ], [ %spec.select, %for.inc ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %max.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %step) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #3
attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
|
// AOJ 3129 Contest T-shirts
// 2020.1.16 bal4u
#include <stdio.h>
#define gc() getchar_unlocked()
int in() { // 非負整数の入力
int n = 0, c = gc();
do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
return n;
}
#define MIN(a,b) ((a)<=(b)?(a):(b))
int main()
{
int M, N, a0;
M = in(), N = in();
if (M == 2) {
a0 = 1;
int s1 = 0, s2 = 0;
while (N--) {
int a = in();
if (a == a0) ++s1; else ++s2;
a0 = 3 - a0;
}
printf("%d\n", MIN(s1, s2));
} else {
a0 = 0;
int s = 0, f = 0;
while (N--) {
int a = in();
if (!f) {
if (a == a0) ++s, f = 1;
} else f = 0;
a0 = a;
}
printf("%d\n", s);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329833/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329833/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #4
%.pre13.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.preheader
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i = zext i8 %3 to i32
br label %do.body.preheader
do.body.preheader: ; preds = %cond.true.i, %cond.false.i
%.ph = phi ptr [ %0, %cond.false.i ], [ %.pre13.pre, %cond.true.i ]
%c.0.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ]
br label %do.body
do.body: ; preds = %do.body.preheader, %getchar_unlocked.exit12
%4 = phi ptr [ %8, %getchar_unlocked.exit12 ], [ %.ph, %do.body.preheader ]
%n.0 = phi i32 [ %add, %getchar_unlocked.exit12 ], [ 0, %do.body.preheader ]
%c.0 = phi i32 [ %cond.i8, %getchar_unlocked.exit12 ], [ %c.0.ph, %do.body.preheader ]
%mul = mul nsw i32 %n.0, 10
%and = and i32 %c.0, 15
%add = add nsw i32 %and, %mul
%_IO_read_ptr.i3 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i3, align 8, !tbaa !9
%_IO_read_end.i4 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i4, align 8, !tbaa !14
%cmp.not.i5 = icmp ult ptr %5, %6
br i1 %cmp.not.i5, label %cond.false.i9, label %cond.true.i6, !prof !15
cond.true.i6: ; preds = %do.body
%call.i7 = tail call i32 @__uflow(ptr noundef nonnull %4) #4
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit12
cond.false.i9: ; preds = %do.body
%incdec.ptr.i10 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i10, ptr %_IO_read_ptr.i3, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i11 = zext i8 %7 to i32
br label %getchar_unlocked.exit12
getchar_unlocked.exit12: ; preds = %cond.true.i6, %cond.false.i9
%8 = phi ptr [ %.pre, %cond.true.i6 ], [ %4, %cond.false.i9 ]
%cond.i8 = phi i32 [ %call.i7, %cond.true.i6 ], [ %conv3.i11, %cond.false.i9 ]
%cmp = icmp sgt i32 %cond.i8, 47
br i1 %cmp, label %do.body, label %do.end, !llvm.loop !17
do.end: ; preds = %getchar_unlocked.exit12
ret i32 %add
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !14
%cmp.not.i.i = icmp ult ptr %1, %2
br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !15
cond.true.i.i: ; preds = %entry
%call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #4
%.pre13.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i.preheader
cond.false.i.i: ; preds = %entry
%incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i.i = zext i8 %3 to i32
br label %do.body.i.preheader
do.body.i.preheader: ; preds = %cond.false.i.i, %cond.true.i.i
%.ph156 = phi ptr [ %0, %cond.false.i.i ], [ %.pre13.pre.i, %cond.true.i.i ]
%c.0.i.ph = phi i32 [ %conv3.i.i, %cond.false.i.i ], [ %call.i.i, %cond.true.i.i ]
br label %do.body.i
do.body.i: ; preds = %do.body.i.preheader, %getchar_unlocked.exit12.i
%4 = phi ptr [ %8, %getchar_unlocked.exit12.i ], [ %.ph156, %do.body.i.preheader ]
%n.0.i = phi i32 [ %add.i, %getchar_unlocked.exit12.i ], [ 0, %do.body.i.preheader ]
%c.0.i = phi i32 [ %cond.i8.i, %getchar_unlocked.exit12.i ], [ %c.0.i.ph, %do.body.i.preheader ]
%mul.i = mul nsw i32 %n.0.i, 10
%and.i = and i32 %c.0.i, 15
%add.i = add nsw i32 %and.i, %mul.i
%_IO_read_ptr.i3.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i3.i, align 8, !tbaa !9
%_IO_read_end.i4.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i4.i, align 8, !tbaa !14
%cmp.not.i5.i = icmp ult ptr %5, %6
br i1 %cmp.not.i5.i, label %cond.false.i9.i, label %cond.true.i6.i, !prof !15
cond.true.i6.i: ; preds = %do.body.i
%call.i7.i = tail call i32 @__uflow(ptr noundef nonnull %4) #4
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit12.i
cond.false.i9.i: ; preds = %do.body.i
%incdec.ptr.i10.i = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i10.i, ptr %_IO_read_ptr.i3.i, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i11.i = zext i8 %7 to i32
br label %getchar_unlocked.exit12.i
getchar_unlocked.exit12.i: ; preds = %cond.false.i9.i, %cond.true.i6.i
%8 = phi ptr [ %.pre.i, %cond.true.i6.i ], [ %4, %cond.false.i9.i ]
%cond.i8.i = phi i32 [ %call.i7.i, %cond.true.i6.i ], [ %conv3.i11.i, %cond.false.i9.i ]
%cmp.i = icmp sgt i32 %cond.i8.i, 47
br i1 %cmp.i, label %do.body.i, label %in.exit, !llvm.loop !17
in.exit: ; preds = %getchar_unlocked.exit12.i
%_IO_read_ptr.i.i36 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 1
%9 = load ptr, ptr %_IO_read_ptr.i.i36, align 8, !tbaa !9
%_IO_read_end.i.i37 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 2
%10 = load ptr, ptr %_IO_read_end.i.i37, align 8, !tbaa !14
%cmp.not.i.i38 = icmp ult ptr %9, %10
br i1 %cmp.not.i.i38, label %cond.false.i.i63, label %cond.true.i.i39, !prof !15
cond.true.i.i39: ; preds = %in.exit
%call.i.i40 = tail call i32 @__uflow(ptr noundef nonnull %8) #4
%.pre13.pre.i41 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i45.preheader
cond.false.i.i63: ; preds = %in.exit
%incdec.ptr.i.i64 = getelementptr inbounds i8, ptr %9, i64 1
store ptr %incdec.ptr.i.i64, ptr %_IO_read_ptr.i.i36, align 8, !tbaa !9
%11 = load i8, ptr %9, align 1, !tbaa !16
%conv3.i.i65 = zext i8 %11 to i32
br label %do.body.i45.preheader
do.body.i45.preheader: ; preds = %cond.false.i.i63, %cond.true.i.i39
%.ph154 = phi ptr [ %8, %cond.false.i.i63 ], [ %.pre13.pre.i41, %cond.true.i.i39 ]
%c.0.i47.ph = phi i32 [ %conv3.i.i65, %cond.false.i.i63 ], [ %call.i.i40, %cond.true.i.i39 ]
br label %do.body.i45
do.body.i45: ; preds = %do.body.i45.preheader, %getchar_unlocked.exit12.i57
%12 = phi ptr [ %16, %getchar_unlocked.exit12.i57 ], [ %.ph154, %do.body.i45.preheader ]
%n.0.i46 = phi i32 [ %add.i50, %getchar_unlocked.exit12.i57 ], [ 0, %do.body.i45.preheader ]
%c.0.i47 = phi i32 [ %cond.i8.i58, %getchar_unlocked.exit12.i57 ], [ %c.0.i47.ph, %do.body.i45.preheader ]
%mul.i48 = mul nsw i32 %n.0.i46, 10
%and.i49 = and i32 %c.0.i47, 15
%add.i50 = add nsw i32 %and.i49, %mul.i48
%_IO_read_ptr.i3.i51 = getelementptr inbounds %struct._IO_FILE, ptr %12, i64 0, i32 1
%13 = load ptr, ptr %_IO_read_ptr.i3.i51, align 8, !tbaa !9
%_IO_read_end.i4.i52 = getelementptr inbounds %struct._IO_FILE, ptr %12, i64 0, i32 2
%14 = load ptr, ptr %_IO_read_end.i4.i52, align 8, !tbaa !14
%cmp.not.i5.i53 = icmp ult ptr %13, %14
br i1 %cmp.not.i5.i53, label %cond.false.i9.i60, label %cond.true.i6.i54, !prof !15
cond.true.i6.i54: ; preds = %do.body.i45
%call.i7.i55 = tail call i32 @__uflow(ptr noundef nonnull %12) #4
%.pre.i56 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit12.i57
cond.false.i9.i60: ; preds = %do.body.i45
%incdec.ptr.i10.i61 = getelementptr inbounds i8, ptr %13, i64 1
store ptr %incdec.ptr.i10.i61, ptr %_IO_read_ptr.i3.i51, align 8, !tbaa !9
%15 = load i8, ptr %13, align 1, !tbaa !16
%conv3.i11.i62 = zext i8 %15 to i32
br label %getchar_unlocked.exit12.i57
getchar_unlocked.exit12.i57: ; preds = %cond.false.i9.i60, %cond.true.i6.i54
%16 = phi ptr [ %.pre.i56, %cond.true.i6.i54 ], [ %12, %cond.false.i9.i60 ]
%cond.i8.i58 = phi i32 [ %call.i7.i55, %cond.true.i6.i54 ], [ %conv3.i11.i62, %cond.false.i9.i60 ]
%cmp.i59 = icmp sgt i32 %cond.i8.i58, 47
br i1 %cmp.i59, label %do.body.i45, label %in.exit66, !llvm.loop !17
in.exit66: ; preds = %getchar_unlocked.exit12.i57
%cmp = icmp eq i32 %add.i, 2
%tobool.not137 = icmp eq i32 %add.i50, 0
br i1 %cmp, label %while.cond.preheader, label %while.cond9.preheader
while.cond9.preheader: ; preds = %in.exit66
br i1 %tobool.not137, label %if.end25, label %while.body12
while.cond.preheader: ; preds = %in.exit66
br i1 %tobool.not137, label %while.end, label %while.body
while.body: ; preds = %while.cond.preheader, %in.exit97
%17 = phi ptr [ %26, %in.exit97 ], [ %16, %while.cond.preheader ]
%dec141.in = phi i32 [ %dec141, %in.exit97 ], [ %add.i50, %while.cond.preheader ]
%a0.0140 = phi i32 [ %sub, %in.exit97 ], [ 1, %while.cond.preheader ]
%s2.0139 = phi i32 [ %s2.1, %in.exit97 ], [ 0, %while.cond.preheader ]
%s1.0138 = phi i32 [ %s1.1, %in.exit97 ], [ 0, %while.cond.preheader ]
%dec141 = add nsw i32 %dec141.in, -1
%_IO_read_ptr.i.i67 = getelementptr inbounds %struct._IO_FILE, ptr %17, i64 0, i32 1
%18 = load ptr, ptr %_IO_read_ptr.i.i67, align 8, !tbaa !9
%_IO_read_end.i.i68 = getelementptr inbounds %struct._IO_FILE, ptr %17, i64 0, i32 2
%19 = load ptr, ptr %_IO_read_end.i.i68, align 8, !tbaa !14
%cmp.not.i.i69 = icmp ult ptr %18, %19
br i1 %cmp.not.i.i69, label %cond.false.i.i94, label %cond.true.i.i70, !prof !15
cond.true.i.i70: ; preds = %while.body
%call.i.i71 = tail call i32 @__uflow(ptr noundef nonnull %17) #4
%.pre13.pre.i72 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i76.preheader
cond.false.i.i94: ; preds = %while.body
%incdec.ptr.i.i95 = getelementptr inbounds i8, ptr %18, i64 1
store ptr %incdec.ptr.i.i95, ptr %_IO_read_ptr.i.i67, align 8, !tbaa !9
%20 = load i8, ptr %18, align 1, !tbaa !16
%conv3.i.i96 = zext i8 %20 to i32
br label %do.body.i76.preheader
do.body.i76.preheader: ; preds = %cond.false.i.i94, %cond.true.i.i70
%.ph150 = phi ptr [ %17, %cond.false.i.i94 ], [ %.pre13.pre.i72, %cond.true.i.i70 ]
%c.0.i78.ph = phi i32 [ %conv3.i.i96, %cond.false.i.i94 ], [ %call.i.i71, %cond.true.i.i70 ]
br label %do.body.i76
do.body.i76: ; preds = %do.body.i76.preheader, %getchar_unlocked.exit12.i88
%21 = phi ptr [ %26, %getchar_unlocked.exit12.i88 ], [ %.ph150, %do.body.i76.preheader ]
%22 = phi ptr [ %27, %getchar_unlocked.exit12.i88 ], [ %.ph150, %do.body.i76.preheader ]
%n.0.i77 = phi i32 [ %add.i81, %getchar_unlocked.exit12.i88 ], [ 0, %do.body.i76.preheader ]
%c.0.i78 = phi i32 [ %cond.i8.i89, %getchar_unlocked.exit12.i88 ], [ %c.0.i78.ph, %do.body.i76.preheader ]
%mul.i79 = mul nsw i32 %n.0.i77, 10
%and.i80 = and i32 %c.0.i78, 15
%add.i81 = add nsw i32 %and.i80, %mul.i79
%_IO_read_ptr.i3.i82 = getelementptr inbounds %struct._IO_FILE, ptr %22, i64 0, i32 1
%23 = load ptr, ptr %_IO_read_ptr.i3.i82, align 8, !tbaa !9
%_IO_read_end.i4.i83 = getelementptr inbounds %struct._IO_FILE, ptr %22, i64 0, i32 2
%24 = load ptr, ptr %_IO_read_end.i4.i83, align 8, !tbaa !14
%cmp.not.i5.i84 = icmp ult ptr %23, %24
br i1 %cmp.not.i5.i84, label %cond.false.i9.i91, label %cond.true.i6.i85, !prof !15
cond.true.i6.i85: ; preds = %do.body.i76
%call.i7.i86 = tail call i32 @__uflow(ptr noundef nonnull %22) #4
%.pre.i87 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit12.i88
cond.false.i9.i91: ; preds = %do.body.i76
%incdec.ptr.i10.i92 = getelementptr inbounds i8, ptr %23, i64 1
store ptr %incdec.ptr.i10.i92, ptr %_IO_read_ptr.i3.i82, align 8, !tbaa !9
%25 = load i8, ptr %23, align 1, !tbaa !16
%conv3.i11.i93 = zext i8 %25 to i32
br label %getchar_unlocked.exit12.i88
getchar_unlocked.exit12.i88: ; preds = %cond.false.i9.i91, %cond.true.i6.i85
%26 = phi ptr [ %.pre.i87, %cond.true.i6.i85 ], [ %21, %cond.false.i9.i91 ]
%27 = phi ptr [ %.pre.i87, %cond.true.i6.i85 ], [ %22, %cond.false.i9.i91 ]
%cond.i8.i89 = phi i32 [ %call.i7.i86, %cond.true.i6.i85 ], [ %conv3.i11.i93, %cond.false.i9.i91 ]
%cmp.i90 = icmp sgt i32 %cond.i8.i89, 47
br i1 %cmp.i90, label %do.body.i76, label %in.exit97, !llvm.loop !17
in.exit97: ; preds = %getchar_unlocked.exit12.i88
%cmp3 = icmp eq i32 %add.i81, %a0.0140
%inc = zext i1 %cmp3 to i32
%s1.1 = add nuw nsw i32 %s1.0138, %inc
%not.cmp3 = xor i1 %cmp3, true
%inc5 = zext i1 %not.cmp3 to i32
%s2.1 = add nuw nsw i32 %s2.0139, %inc5
%sub = sub nuw nsw i32 3, %a0.0140
%tobool.not = icmp eq i32 %dec141, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !19
while.end: ; preds = %in.exit97, %while.cond.preheader
%s1.0.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %s1.1, %in.exit97 ]
%s2.0.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %s2.1, %in.exit97 ]
%cond = tail call i32 @llvm.smin.i32(i32 %s1.0.lcssa, i32 %s2.0.lcssa)
br label %if.end25
while.body12: ; preds = %while.cond9.preheader, %in.exit128
%28 = phi ptr [ %37, %in.exit128 ], [ %16, %while.cond9.preheader ]
%dec10135.in = phi i32 [ %dec10135, %in.exit128 ], [ %add.i50, %while.cond9.preheader ]
%f.0134 = phi i32 [ %spec.select, %in.exit128 ], [ 0, %while.cond9.preheader ]
%s.0133 = phi i32 [ %s.1, %in.exit128 ], [ 0, %while.cond9.preheader ]
%a0.1132 = phi i32 [ %add.i112, %in.exit128 ], [ 0, %while.cond9.preheader ]
%dec10135 = add nsw i32 %dec10135.in, -1
%_IO_read_ptr.i.i98 = getelementptr inbounds %struct._IO_FILE, ptr %28, i64 0, i32 1
%29 = load ptr, ptr %_IO_read_ptr.i.i98, align 8, !tbaa !9
%_IO_read_end.i.i99 = getelementptr inbounds %struct._IO_FILE, ptr %28, i64 0, i32 2
%30 = load ptr, ptr %_IO_read_end.i.i99, align 8, !tbaa !14
%cmp.not.i.i100 = icmp ult ptr %29, %30
br i1 %cmp.not.i.i100, label %cond.false.i.i125, label %cond.true.i.i101, !prof !15
cond.true.i.i101: ; preds = %while.body12
%call.i.i102 = tail call i32 @__uflow(ptr noundef nonnull %28) #4
%.pre13.pre.i103 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i107.preheader
cond.false.i.i125: ; preds = %while.body12
%incdec.ptr.i.i126 = getelementptr inbounds i8, ptr %29, i64 1
store ptr %incdec.ptr.i.i126, ptr %_IO_read_ptr.i.i98, align 8, !tbaa !9
%31 = load i8, ptr %29, align 1, !tbaa !16
%conv3.i.i127 = zext i8 %31 to i32
br label %do.body.i107.preheader
do.body.i107.preheader: ; preds = %cond.false.i.i125, %cond.true.i.i101
%.ph152 = phi ptr [ %28, %cond.false.i.i125 ], [ %.pre13.pre.i103, %cond.true.i.i101 ]
%c.0.i109.ph = phi i32 [ %conv3.i.i127, %cond.false.i.i125 ], [ %call.i.i102, %cond.true.i.i101 ]
br label %do.body.i107
do.body.i107: ; preds = %do.body.i107.preheader, %getchar_unlocked.exit12.i119
%32 = phi ptr [ %37, %getchar_unlocked.exit12.i119 ], [ %.ph152, %do.body.i107.preheader ]
%33 = phi ptr [ %38, %getchar_unlocked.exit12.i119 ], [ %.ph152, %do.body.i107.preheader ]
%n.0.i108 = phi i32 [ %add.i112, %getchar_unlocked.exit12.i119 ], [ 0, %do.body.i107.preheader ]
%c.0.i109 = phi i32 [ %cond.i8.i120, %getchar_unlocked.exit12.i119 ], [ %c.0.i109.ph, %do.body.i107.preheader ]
%mul.i110 = mul nsw i32 %n.0.i108, 10
%and.i111 = and i32 %c.0.i109, 15
%add.i112 = add nsw i32 %and.i111, %mul.i110
%_IO_read_ptr.i3.i113 = getelementptr inbounds %struct._IO_FILE, ptr %33, i64 0, i32 1
%34 = load ptr, ptr %_IO_read_ptr.i3.i113, align 8, !tbaa !9
%_IO_read_end.i4.i114 = getelementptr inbounds %struct._IO_FILE, ptr %33, i64 0, i32 2
%35 = load ptr, ptr %_IO_read_end.i4.i114, align 8, !tbaa !14
%cmp.not.i5.i115 = icmp ult ptr %34, %35
br i1 %cmp.not.i5.i115, label %cond.false.i9.i122, label %cond.true.i6.i116, !prof !15
cond.true.i6.i116: ; preds = %do.body.i107
%call.i7.i117 = tail call i32 @__uflow(ptr noundef nonnull %33) #4
%.pre.i118 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit12.i119
cond.false.i9.i122: ; preds = %do.body.i107
%incdec.ptr.i10.i123 = getelementptr inbounds i8, ptr %34, i64 1
store ptr %incdec.ptr.i10.i123, ptr %_IO_read_ptr.i3.i113, align 8, !tbaa !9
%36 = load i8, ptr %34, align 1, !tbaa !16
%conv3.i11.i124 = zext i8 %36 to i32
br label %getchar_unlocked.exit12.i119
getchar_unlocked.exit12.i119: ; preds = %cond.false.i9.i122, %cond.true.i6.i116
%37 = phi ptr [ %.pre.i118, %cond.true.i6.i116 ], [ %32, %cond.false.i9.i122 ]
%38 = phi ptr [ %.pre.i118, %cond.true.i6.i116 ], [ %33, %cond.false.i9.i122 ]
%cond.i8.i120 = phi i32 [ %call.i7.i117, %cond.true.i6.i116 ], [ %conv3.i11.i124, %cond.false.i9.i122 ]
%cmp.i121 = icmp sgt i32 %cond.i8.i120, 47
br i1 %cmp.i121, label %do.body.i107, label %in.exit128, !llvm.loop !17
in.exit128: ; preds = %getchar_unlocked.exit12.i119
%tobool15.not = icmp eq i32 %f.0134, 0
%cmp17 = icmp eq i32 %add.i112, %a0.1132
%narrow = select i1 %tobool15.not, i1 %cmp17, i1 false
%spec.select = zext i1 %narrow to i32
%s.1 = add nuw nsw i32 %s.0133, %spec.select
%tobool11.not = icmp eq i32 %dec10135, 0
br i1 %tobool11.not, label %if.end25, label %while.body12, !llvm.loop !20
if.end25: ; preds = %in.exit128, %while.cond9.preheader, %while.end
%s.0.lcssa.sink = phi i32 [ %cond, %while.end ], [ 0, %while.cond9.preheader ], [ %s.1, %in.exit128 ]
%call24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %s.0.lcssa.sink)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
declare i32 @__uflow(ptr noundef) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_IO_FILE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !12, i64 120, !13, i64 128, !7, i64 130, !7, i64 131, !6, i64 136, !12, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !12, i64 184, !11, i64 192, !7, i64 196}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !6, i64 16}
!15 = !{!"branch_weights", i32 2000, i32 1}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}
|
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main(void) {
long long int n, k, i;
long long int num = 0;
scanf("%lld %lld", &n, &k);
for (i = k; i < n + 2; i++) {
num = num + (i * (n - i + 1) + 1);
}
printf("%lld",num%(1000000007));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329877/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329877/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i64, ptr %k, align 8, !tbaa !5
%1 = load i64, ptr %n, align 8, !tbaa !5
%add = add nsw i64 %1, 2
%cmp9 = icmp slt i64 %0, %add
br i1 %cmp9, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%2 = sub i64 %1, %0
%3 = mul i64 %0, %2
%4 = add i64 %1, %3
%5 = add i64 %4, 1
%6 = add i64 %1, 1
%7 = sub i64 %6, %0
%8 = mul i64 %5, %7
%9 = add i64 %1, -2
%10 = shl i64 %0, 1
%11 = sub i64 %9, %10
%12 = zext i64 %7 to i65
%13 = zext i64 %2 to i65
%14 = mul i65 %12, %13
%15 = lshr i65 %14, 1
%16 = trunc i65 %15 to i64
%17 = mul i64 %11, %16
%18 = add i64 %8, %17
%19 = xor i64 %0, -1
%20 = add i64 %1, %19
%21 = zext i64 %20 to i65
%22 = mul i65 %21, %12
%23 = mul i65 %22, %13
%24 = lshr i65 %23, 1
%25 = trunc i65 %24 to i64
%.neg = mul i64 %25, -6148914691236517206
%26 = add i64 %18, 1
%27 = add i64 %.neg, %26
%28 = srem i64 %27, 1000000007
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%num.0.lcssa = phi i64 [ 0, %entry ], [ %28, %for.body.preheader ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %num.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define rep(i,l,n) for(int (i)=(l);(i)<(n);(i)++)
#define min(a,b) (a)<(b)?(a):(b)
#define max(a,b) (a)>(b)?(a):(b)
#define abs(a) (a)>0?(a):-(a)
#define llong long long
#define P (1000000007)
llong mpow(llong a,llong b){
llong ans = 1;
while(b){
if(b&1) ans = ans*a%P;
b = b>>1; a = a*a%P;
}
return ans;
}
int main(){
llong N,K; scanf("%lld %lld",&N,&K);
llong a = K-N-2;
llong b = ((2*K*K%P)-(K*(N+2))%P-(N*N+N+6)%P)%P;
if( a<0 ) a+=P;
if( b<0 ) b+=P;
llong ans = ((a*b)%P*mpow(6,1000000005))%P;
printf("%lld",ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329927/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329927/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @mpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%tobool.not9 = icmp eq i64 %b, 0
br i1 %tobool.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%ans.012 = phi i64 [ %ans.1, %if.end ], [ 1, %entry ]
%b.addr.011 = phi i64 [ %shr, %if.end ], [ %b, %entry ]
%a.addr.010 = phi i64 [ %rem3, %if.end ], [ %a, %entry ]
%and = and i64 %b.addr.011, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul nsw i64 %ans.012, %a.addr.010
%rem = srem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%ans.1 = phi i64 [ %rem, %if.then ], [ %ans.012, %while.body ]
%shr = ashr i64 %b.addr.011, 1
%mul2 = mul nsw i64 %a.addr.010, %a.addr.010
%rem3 = urem i64 %mul2, 1000000007
%tobool.not = icmp ult i64 %b.addr.011, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %if.end, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %ans.1, %if.end ]
ret i64 %ans.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%N = alloca i64, align 8
%K = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i64, ptr %K, align 8, !tbaa !7
%1 = load i64, ptr %N, align 8, !tbaa !7
br label %while.body.i
while.body.i: ; preds = %if.end.i, %entry
%ans.012.i = phi i64 [ %ans.1.i, %if.end.i ], [ 1, %entry ]
%b.addr.011.i = phi i64 [ %shr.i, %if.end.i ], [ 1000000005, %entry ]
%a.addr.010.i = phi i64 [ %rem3.i, %if.end.i ], [ 6, %entry ]
%and.i = and i64 %b.addr.011.i, 1
%tobool1.not.i = icmp eq i64 %and.i, 0
br i1 %tobool1.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %while.body.i
%mul.i = mul nsw i64 %a.addr.010.i, %ans.012.i
%rem.i = srem i64 %mul.i, 1000000007
br label %if.end.i
if.end.i: ; preds = %if.then.i, %while.body.i
%ans.1.i = phi i64 [ %rem.i, %if.then.i ], [ %ans.012.i, %while.body.i ]
%shr.i = lshr i64 %b.addr.011.i, 1
%mul2.i = mul nuw nsw i64 %a.addr.010.i, %a.addr.010.i
%rem3.i = urem i64 %mul2.i, 1000000007
%tobool.not.i = icmp ult i64 %b.addr.011.i, 2
br i1 %tobool.not.i, label %mpow.exit, label %while.body.i, !llvm.loop !5
mpow.exit: ; preds = %if.end.i
%sub = sub nsw i64 %0, %1
%cmp = icmp slt i64 %sub, 2
%spec.select.v = select i1 %cmp, i64 1000000005, i64 -2
%spec.select = add nsw i64 %spec.select.v, %sub
%mul = shl nsw i64 %0, 1
%mul2 = mul nsw i64 %mul, %0
%rem = srem i64 %mul2, 1000000007
%add = add nsw i64 %1, 2
%mul3 = mul nsw i64 %add, %0
%rem4 = srem i64 %mul3, 1000000007
%2 = add i64 %1, 1
%add7 = mul i64 %2, %1
%add8 = add nsw i64 %add7, 6
%rem9 = srem i64 %add8, 1000000007
%3 = add nsw i64 %rem4, %rem9
%sub10 = sub nsw i64 %rem, %3
%rem11 = srem i64 %sub10, 1000000007
%cmp13 = icmp slt i64 %rem11, 0
%add15 = add nsw i64 %rem11, 1000000007
%b.0 = select i1 %cmp13, i64 %add15, i64 %rem11
%mul17 = mul nsw i64 %b.0, %spec.select
%rem18 = srem i64 %mul17, 1000000007
%mul20 = mul nsw i64 %ans.1.i, %rem18
%rem21 = srem i64 %mul20, 1000000007
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %rem21)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) 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 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 #3 = { 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"long long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<limits.h>
#define MM 1000000007
#define ll unsigned long long
int main(){
ll all=0,i,n,k;
scanf("%llu%llu",&n,&k);
for(i=k;i<=n+1;++i){
unsigned int temp=i*(n-i+1)%MM;
all%=MM;
all=all+temp+1;
}
printf("%llu",all%MM);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_329978/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_329978/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%llu%llu\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%llu\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i64, ptr %k, align 8, !tbaa !5
%1 = load i64, ptr %n, align 8, !tbaa !5
%add = add i64 %1, 1
%cmp.not13 = icmp ugt i64 %0, %add
br i1 %cmp.not13, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%all.015 = phi i64 [ %add5.frozen, %for.body ], [ 0, %entry ]
%i.014 = phi i64 [ %inc, %for.body ], [ %0, %entry ]
%reass.sub = sub i64 %1, %i.014
%add1 = add i64 %reass.sub, 1
%mul = mul i64 %add1, %i.014
%rem = urem i64 %mul, 1000000007
%rem2 = urem i64 %all.015, 1000000007
%add4 = add nuw nsw i64 %rem2, 1
%add5 = add nuw nsw i64 %add4, %rem
%add5.frozen = freeze i64 %add5
%inc = add i64 %i.014, 1
%cmp.not = icmp ugt i64 %inc, %add
br i1 %cmp.not, label %for.end.loopexit, label %for.body, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%.urem = add i64 %add5.frozen, -1000000007
%.cmp = icmp ult i64 %add5.frozen, 1000000007
%2 = select i1 %.cmp, i64 %add5.frozen, i64 %.urem
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%all.0.lcssa = phi i64 [ 0, %entry ], [ %2, %for.end.loopexit ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %all.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
char s[3][100];
scanf("%s%s%s", s[0],s[1],s[2]);
printf("A%cC", s[1][0]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330019/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330019/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%s%s%s\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"A%cC\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [3 x [100 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 300, ptr nonnull %s) #3
%arrayidx1 = getelementptr inbounds [3 x [100 x i8]], ptr %s, i64 0, i64 1
%arrayidx3 = getelementptr inbounds [3 x [100 x i8]], ptr %s, i64 0, i64 2
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx3)
%0 = load i8, ptr %arrayidx1, align 4, !tbaa !5
%conv = sext i8 %0 to i32
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv)
call void @llvm.lifetime.end.p0(i64 300, ptr nonnull %s) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
char a[100], b[100], c[100];
scanf("%s %s %s", a, b, c);
printf("%c%c%c\n",a[0],b[0],c[0]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330062/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330062/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%s %s %s\00", align 1
@.str.1 = private unnamed_addr constant [8 x i8] c"%c%c%c\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [100 x i8], align 16
%b = alloca [100 x i8], align 16
%c = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i8, ptr %a, align 16, !tbaa !5
%conv = sext i8 %0 to i32
%1 = load i8, ptr %b, align 16, !tbaa !5
%conv4 = sext i8 %1 to i32
%2 = load i8, ptr %c, align 16, !tbaa !5
%conv6 = sext i8 %2 to i32
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %conv4, i32 noundef %conv6)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %a) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int a[8],b[8],s[100];
scanf("%s %s %s",a,s,b);
printf("A%cC\n",s[0]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330105/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330105/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%s %s %s\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"A%cC\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [8 x i32], align 16
%b = alloca [8 x i32], align 16
%s = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %s, ptr noundef nonnull %b)
%0 = load i32, ptr %s, align 16, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %a) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
char a[100],s[100],c[100];
scanf("%s %s %s",a,s,c);
printf("A%cC\n",s[0]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330149/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330149/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%s %s %s\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"A%cC\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [100 x i8], align 16
%s = alloca [100 x i8], align 16
%c = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %s, ptr noundef nonnull %c)
%0 = load i8, ptr %s, align 16, !tbaa !5
%conv = sext i8 %0 to i32
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %a) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
char s[3][110];
for(int i=0;i<3;i++)
scanf("%s",s[i]);
printf("A%cC\n",s[1][0]);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330192/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330192/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"A%cC\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [3 x [110 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 330, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%arrayidx.1 = getelementptr inbounds [3 x [110 x i8]], ptr %s, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%arrayidx.2 = getelementptr inbounds [3 x [110 x i8]], ptr %s, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%0 = load i8, ptr %arrayidx.1, align 2, !tbaa !5
%conv = sext i8 %0 to i32
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv)
call void @llvm.lifetime.end.p0(i64 330, ptr nonnull %s) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
char s[110],a[110],b[110];
scanf("%s%s%s",a,s,b);
printf("A%cC\n",s[0]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330235/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330235/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%s%s%s\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"A%cC\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [110 x i8], align 16
%a = alloca [110 x i8], align 16
%b = alloca [110 x i8], align 16
call void @llvm.lifetime.start.p0(i64 110, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 110, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 110, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %s, ptr noundef nonnull %b)
%0 = load i8, ptr %s, align 16, !tbaa !5
%conv = sext i8 %0 to i32
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv)
call void @llvm.lifetime.end.p0(i64 110, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 110, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 110, ptr nonnull %s) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int x,a,b;
int jaraka,jarakb;
scanf("%d %d %d",&x,&a,&b);
jaraka = x-a;
jarakb= x-b;
if(jaraka<0){
jaraka*= -1;
}
if(jarakb<0){
jarakb*= -1;
}
if(jaraka>jarakb){
printf("B\n");
}
else{
printf("A\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330286/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330286/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"A\00", align 1
@str.3 = private unnamed_addr constant [2 x i8] c"B\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %b, align 4, !tbaa !5
%sub1 = sub nsw i32 %0, %2
%spec.select = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%jarakb.0 = call i32 @llvm.abs.i32(i32 %sub1, i1 true)
%cmp6 = icmp ugt i32 %spec.select, %jarakb.0
%str.3.str = select i1 %cmp6, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
attributes #0 = { 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 #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 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int a,b,c,n,m;
scanf("%d%d%d",&a,&b,&c);
if(a-b<0) n=b-a;
else n=a-b;
if(a-c<0) m=c-a;
else m=a-c;
if(n>m) printf("B\n");
else printf("A\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330336/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330336/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"A\00", align 1
@str.3 = private unnamed_addr constant [2 x i8] c"B\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%n.0 = call i32 @llvm.abs.i32(i32 %sub, i1 false)
%2 = load i32, ptr %c, align 4, !tbaa !5
%sub3 = sub nsw i32 %0, %2
%m.0 = call i32 @llvm.abs.i32(i32 %sub3, i1 false)
%cmp10 = icmp sgt i32 %n.0, %m.0
%str.3.str = select i1 %cmp10, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
attributes #0 = { 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 #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 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main()
{
int t,i;
char a[102],b[102],c[102],ch1,ch2,ch3;
scanf("%d",&t);
while(t--)
{
scanf("%s",a);
getchar();
scanf("%s",b);
getchar();
scanf("%s",c);
getchar();
for(i=0;i<strlen(c);i++)
{
if((a[i]==b[i]&&a[i]==c[i])||a[i]==c[i]||b[i]==c[i])
continue;
else break;
}
if(i==strlen(c)) printf("YES\n");
else printf("NO\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_33038/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_33038/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%a = alloca [102 x i8], align 16
%b = alloca [102 x i8], align 16
%c = alloca [102 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.start.p0(i64 102, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 102, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 102, ptr nonnull %c) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec71 = add nsw i32 %0, -1
store i32 %dec71, ptr %t, align 4, !tbaa !5
%tobool.not72 = icmp eq i32 %0, 0
br i1 %tobool.not72, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%1 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i = call i32 @getc(ptr noundef %1)
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b)
%2 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i63 = call i32 @getc(ptr noundef %2)
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c)
%3 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i64 = call i32 @getc(ptr noundef %3)
%call10 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %c) #6
%cmp65.not = icmp eq i64 %call10, 0
br i1 %cmp65.not, label %if.end, label %for.body
for.body: ; preds = %while.body, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %while.body ]
%arrayidx = getelementptr inbounds [102 x i8], ptr %a, i64 0, i64 %indvars.iv
%4 = load i8, ptr %arrayidx, align 1, !tbaa !11
%arrayidx14 = getelementptr inbounds [102 x i8], ptr %b, i64 0, i64 %indvars.iv
%5 = load i8, ptr %arrayidx14, align 1, !tbaa !11
%cmp16 = icmp eq i8 %4, %5
%arrayidx22 = getelementptr inbounds [102 x i8], ptr %c, i64 0, i64 %indvars.iv
%6 = load i8, ptr %arrayidx22, align 1, !tbaa !11
%cmp24 = icmp eq i8 %4, %6
%or.cond77 = select i1 %cmp16, i1 %cmp24, i1 false
br i1 %or.cond77, label %for.inc, label %lor.lhs.false
lor.lhs.false: ; preds = %for.body
%cmp32 = icmp eq i8 %4, %6
%cmp41 = icmp eq i8 %5, %6
%or.cond = or i1 %cmp32, %cmp41
br i1 %or.cond, label %for.inc, label %for.end
for.inc: ; preds = %for.body, %lor.lhs.false
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %call10
br i1 %exitcond.not, label %if.end, label %for.body, !llvm.loop !12
for.end: ; preds = %lor.lhs.false
%cmp46 = icmp eq i64 %call10, %indvars.iv
%spec.select = select i1 %cmp46, ptr @str.4, ptr @str
br label %if.end
if.end: ; preds = %for.inc, %for.end, %while.body
%str.sink = phi ptr [ @str.4, %while.body ], [ %spec.select, %for.end ], [ @str.4, %for.inc ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%7 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %7, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %7, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 102, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 102, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 102, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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 @__isoc99_scanf(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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { 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 #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 = { 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 = { nofree nounwind }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!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}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
|
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if (abs(a-b)>abs(a-c))
{
printf("B\n");
}
else{
printf("A\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330437/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330437/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"A\00", align 1
@str.3 = private unnamed_addr constant [2 x i8] c"B\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%3 = load i32, ptr %c, align 4, !tbaa !5
%sub1 = sub nsw i32 %0, %3
%4 = call i32 @llvm.abs.i32(i32 %sub1, i1 true)
%cmp = icmp ugt i32 %2, %4
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nofree nounwind }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int x,a,b;
scanf("%d%d%d",&x,&a,&b);
int A,B;
A=abs(x-a);
B=abs(x-b);
//printf("%d %d\n",A,B);
if(A<=B)
{
printf("A\n");
}
else
{
printf("B\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330488/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330488/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"B\00", align 1
@str.3 = private unnamed_addr constant [2 x i8] c"A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%3 = load i32, ptr %b, align 4, !tbaa !5
%sub1 = sub nsw i32 %0, %3
%4 = call i32 @llvm.abs.i32(i32 %sub1, i1 true)
%cmp.not = icmp ugt i32 %2, %4
%str.str.3 = select i1 %cmp.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nofree nounwind }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(void)
{
int t;
scanf("%d",&t);
while(t--)
{ int i=0;
int n=0;
char a[101];
char b[101];
char c[101];
scanf("%s",a);
while(a[i]!='\0')
{
n++;
i++;
}
scanf("%s",b);
scanf("%s",c);
int flag=1;
for(i=0;i<n;i++)
{
if( a[i]==b[i]&&a[i]!=c[i])
{
flag=0;
break;
}
if( a[i]!=b[i]&&b[i]!=c[i]&&c[i]!=a[i])
{
flag=0;
break;
}
}
if(flag==1)
printf("YES\n");
else
printf("NO\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_33056/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_33056/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%a = alloca [101 x i8], align 16
%b = alloca [101 x i8], align 16
%c = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec84 = add nsw i32 %0, -1
store i32 %dec84, ptr %t, align 4, !tbaa !5
%tobool.not85 = icmp eq i32 %0, 0
br i1 %tobool.not85, label %while.end63, label %while.body
while.body: ; preds = %entry, %if.end62
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %c) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%1 = load i8, ptr %a, align 16, !tbaa !9
%cmp.not79 = icmp eq i8 %1, 0
br i1 %cmp.not79, label %while.end, label %while.body4
while.body4: ; preds = %while.body, %while.body4
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body4 ], [ 0, %while.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [101 x i8], ptr %a, i64 0, i64 %indvars.iv.next
%2 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp.not = icmp eq i8 %2, 0
br i1 %cmp.not, label %while.end.loopexit, label %while.body4, !llvm.loop !10
while.end.loopexit: ; preds = %while.body4
%indvars = trunc i64 %indvars.iv.next to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %while.body
%n.0.lcssa = phi i32 [ 0, %while.body ], [ %indvars, %while.end.loopexit ]
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b)
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c)
%cmp10.not82.not = icmp eq i32 %n.0.lcssa, 0
br i1 %cmp10.not82.not, label %if.end62, label %for.body.preheader
for.body.preheader: ; preds = %while.end
%wide.trip.count = zext i32 %n.0.lcssa to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv89 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next90, %for.inc ]
%arrayidx13 = getelementptr inbounds [101 x i8], ptr %a, i64 0, i64 %indvars.iv89
%3 = load i8, ptr %arrayidx13, align 1, !tbaa !9
%arrayidx16 = getelementptr inbounds [101 x i8], ptr %b, i64 0, i64 %indvars.iv89
%4 = load i8, ptr %arrayidx16, align 1, !tbaa !9
%cmp18 = icmp eq i8 %3, %4
%arrayidx24 = getelementptr inbounds [101 x i8], ptr %c, i64 0, i64 %indvars.iv89
%5 = load i8, ptr %arrayidx24, align 1, !tbaa !9
br i1 %cmp18, label %land.lhs.true, label %land.lhs.true36
land.lhs.true: ; preds = %for.body
%cmp26.not = icmp eq i8 %3, %5
br i1 %cmp26.not, label %for.inc, label %if.end62
land.lhs.true36: ; preds = %for.body
%cmp43.not = icmp eq i8 %4, %5
%cmp52.not = icmp eq i8 %5, %3
%or.cond = or i1 %cmp43.not, %cmp52.not
br i1 %or.cond, label %for.inc, label %if.end62
for.inc: ; preds = %land.lhs.true, %land.lhs.true36
%indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
%exitcond.not = icmp eq i64 %indvars.iv.next90, %wide.trip.count
br i1 %exitcond.not, label %if.end62, label %for.body, !llvm.loop !12
if.end62: ; preds = %land.lhs.true36, %land.lhs.true, %for.inc, %while.end
%str.sink = phi ptr [ @str.4, %while.end ], [ @str.4, %for.inc ], [ @str, %land.lhs.true ], [ @str, %land.lhs.true36 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %a) #4
%6 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %6, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %6, 0
br i1 %tobool.not, label %while.end63, label %while.body, !llvm.loop !13
while.end63: ; preds = %if.end62, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
#include<assert.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
#define charsize 100005 //10^5+5
#define PI 3.141592653589793238
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}
void cin(ll *n){ scanf("%lld",&(*n)); }
void cin2(ll *a, ll *b){ scanf("%lld%lld",&(*a),&(*b)); }
void cin3(ll *a, ll *b, ll *c){ scanf("%lld%lld%lld",&(*a),&(*b),&(*c)); }
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
double POW_d(double a, double b){double c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod_MOD1(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}
ll mod_p(ll n ,ll p){n+= n<0?((-n)/p+1)*p:0; return n%=p;}
ll change_into_num(char s[] , ll len, ll p){ return !p ? 0 : POW(10,p-1)*(s[len-p]-'0') + change_into_num(s,len,p-1); }
void lr_lower( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }
void lr_upper( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }
int cmp_lower( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a>=b ? 1 : 0 ) : ( a>b ? 1 : 0 ) ; }
int cmp_upper( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a<=b ? 1 : 0 ) : ( a<b ? 1 : 0 ) ; }
// return smallest p which meets a[p]==val :1 >=:2 >:3
ll lower_bound( ll a[], int l, int r, ll val , int type ){ while(r-l>1) lr_lower(&l,&r,a[ (l+r)/2 ],val,type); return cmp_lower(a[l],val,type) ? l : cmp_lower(a[r],val,type) ? r : -1; }
// return biggest p which meets a[p]==val :1 <=:2 <:3
ll upper_bound( ll a[], int l, int r, ll val , int type ){ while(r-l>1) lr_upper(&l,&r,a[ (l+r)/2 ],val,type); return cmp_upper(a[r],val,type) ? r : cmp_upper(a[l],val,type) ? l : -1; }
// count i which meets ai==x
ll count(ll a[], int l, int r, ll x){ int p = lower_bound(a,l,r,x,1); return p==-1 ? 0 : upper_bound(a,p,r,x,1)-p+1; }
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
int cmp_string( const void * a , const void * b ) { return strcmp( (char *)a , (char *)b ); } // qsort((void*)s,n,sizeof(s[0]),int_sort );
int cmp_char(const void * a, const void * b) { return *(char *)a - *(char *)b;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
void sort_string(int n,int size,char s[][size]){ qsort( (void*)s , n , sizeof(s[0]) , cmp_string ); }
void sort_char(char *s){ qsort( (void *)s , strlen(s) , sizeof(char) , cmp_char ); }
ll unique_string(ll n ,ll size, char s[][size]){ ll ans=1; rep(i,1,n) if( strcmp(s[i],s[i-1]) ) ans++; return ans; }
ll unique_num(ll n , ll a[]){ ll ans=1; rep(i,1,n) if( a[i]!=a[i-1] ) ans++; return ans; }
typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}
int main(void){
// fgets(s,sizeof(s),stdin);
// char ;
ll n;
ll ans=0;
cin(&n);
// scanf("%s",);
ll a[2*n],sum[2*n+1];
sum[0]=0;
rep(i,0,n){
cin(&a[i]);
a[i+n]=a[i];
sum[i+1]=sum[i]+a[i];
}
rep(i,0,n){
sum[n+1+i]=sum[n+i]+a[i];
}
ll mark=sum[n]/3;
ll head=0,tail=0,siz=a[0];
// rep(i,0,n+1) printf("%lld ",sum[i]);
// PN;
while(head<=n-1){
if(siz+a[tail+1]>mark){
if(!siz){
head++; tail++; continue;
}
siz-=a[head++];
goto NEXT;
continue;
}
siz+=a[++tail];
NEXT:;
// if(siz==16907){PN;PN;PN; }
ll piv = lower_bound(sum,0,2*n, sum[tail+1]+siz , 2 );
// printf("%lld ",head);
// printf("%lld ",siz);
// printf("%lld ",piv);
// PN;
if(piv==-1){
if(head+1!=n){
siz-=a[head++];
if(!siz) continue;
goto NEXT;
}else{
break;
}
}
ll b,c;
b=sum[piv]-sum[tail+1];
c=sum[n]-b-siz;
// printf("%lld %lld %lld\n",siz,b,c);
// printf("%lld %lld %lld\n",siz,head,tail);
if(b>=siz&&c>=siz){
ans=max2(ans,siz);
}else{
if(head+1!=n){
siz-=a[head++];
goto NEXT;
}else break;
}
// printf("%lld\n",ans);
}
printf("%lld\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330602/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330602/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@.str.2 = private unnamed_addr constant [13 x i8] c"%lld%lld%lld\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
store i64 %1, ptr %b, align 8, !tbaa !5
store i64 %0, ptr %a, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @cin(ptr noundef %n) local_unnamed_addr #2 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %n)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @cin2(ptr noundef %a, ptr noundef %b) local_unnamed_addr #2 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %a, ptr noundef %b)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @cin3(ptr noundef %a, ptr noundef %b, ptr noundef %c) local_unnamed_addr #2 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef %a, ptr noundef %b, ptr noundef %c)
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #4 {
entry:
%cmp.not = icmp sgt i64 %a, %b
%cmp1.not = icmp sgt i64 %a, %c
%or.cond = or i1 %cmp.not, %cmp1.not
%cond = tail call i64 @llvm.smin.i64(i64 %b, i64 %c)
%cond6 = select i1 %or.cond, i64 %cond, i64 %a
ret i64 %cond6
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #4 {
entry:
%cmp.not = icmp slt i64 %a, %b
%cmp1.not = icmp slt i64 %a, %c
%or.cond = or i1 %cmp.not, %cmp1.not
%cond = tail call i64 @llvm.smax.i64(i64 %b, i64 %c)
%cond6 = select i1 %or.cond, i64 %cond, i64 %a
ret i64 %cond6
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @minn(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #5 {
entry:
%cmp5 = icmp sgt i64 %n, 0
br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader10, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 1152921504606846976, i64 1152921504606846976>, %vector.ph ], [ %2, %vector.body ]
%vec.phi8 = phi <2 x i64> [ <i64 1152921504606846976, i64 1152921504606846976>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %a, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load9 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%3 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi8, <2 x i64> %wide.load9)
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %2, <2 x i64> %3)
%5 = tail call i64 @llvm.vector.reduce.smin.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader10
for.body.preheader10: ; preds = %for.body.preheader, %middle.block
%i.07.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.06.ph = phi i64 [ 1152921504606846976, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.0.lcssa = phi i64 [ 1152921504606846976, %entry ], [ %5, %middle.block ], [ %cond.i, %for.body ]
ret i64 %b.0.lcssa
for.body: ; preds = %for.body.preheader10, %for.body
%i.07 = phi i64 [ %inc, %for.body ], [ %i.07.ph, %for.body.preheader10 ]
%b.06 = phi i64 [ %cond.i, %for.body ], [ %b.06.ph, %for.body.preheader10 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.07
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smin.i64(i64 %b.06, i64 %6)
%inc = add nuw nsw i64 %i.07, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !13
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @maxn(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #5 {
entry:
%cmp5 = icmp sgt i64 %n, 0
br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader10, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 -1152921504606846976, i64 -1152921504606846976>, %vector.ph ], [ %2, %vector.body ]
%vec.phi8 = phi <2 x i64> [ <i64 -1152921504606846976, i64 -1152921504606846976>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %a, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load9 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%3 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi8, <2 x i64> %wide.load9)
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %2, <2 x i64> %3)
%5 = tail call i64 @llvm.vector.reduce.smax.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader10
for.body.preheader10: ; preds = %for.body.preheader, %middle.block
%i.07.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.06.ph = phi i64 [ -1152921504606846976, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.0.lcssa = phi i64 [ -1152921504606846976, %entry ], [ %5, %middle.block ], [ %cond.i, %for.body ]
ret i64 %b.0.lcssa
for.body: ; preds = %for.body.preheader10, %for.body
%i.07 = phi i64 [ %inc, %for.body ], [ %i.07.ph, %for.body.preheader10 ]
%b.06 = phi i64 [ %cond.i, %for.body ], [ %b.06.ph, %for.body.preheader10 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.07
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smax.i64(i64 %b.06, i64 %6)
%inc = add nuw nsw i64 %i.07, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !15
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @ABS(i64 noundef %a) local_unnamed_addr #4 {
entry:
%cond = tail call i64 @llvm.abs.i64(i64 %a, i1 true)
ret i64 %cond
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @POW(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%cmp3 = icmp sgt i64 %b, 0
br i1 %cmp3, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%c.04.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%c.04.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %c.04.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %c.04.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !16
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%c.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %c.0.lcssa
for.body: ; preds = %for.body, %for.body.preheader.new
%c.04 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %c.04, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !18
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local double @POW_d(double noundef %a, double noundef %b) local_unnamed_addr #6 {
entry:
%cmp4 = fcmp ogt double %b, 0.000000e+00
br i1 %cmp4, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%c.0.lcssa = phi double [ 1.000000e+00, %entry ], [ %mul, %for.body ]
ret double %c.0.lcssa
for.body: ; preds = %entry, %for.body
%i.06 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%c.05 = phi double [ %mul, %for.body ], [ 1.000000e+00, %entry ]
%mul = fmul double %c.05, %a
%inc = add nuw nsw i64 %i.06, 1
%conv = sitofp i64 %inc to double
%cmp = fcmp olt double %conv, %b
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !19
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %cond.end, label %cond.true
cond.true: ; preds = %entry, %cond.true
%b.tr6 = phi i64 [ %rem, %cond.true ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %cond.true ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %cond.end, label %cond.true
cond.end: ; preds = %cond.true, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %cond.true ]
ret i64 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%tobool.not4.i = icmp eq i64 %b, 0
br i1 %tobool.not4.i, label %gcd.exit, label %cond.true.i
cond.true.i: ; preds = %entry, %cond.true.i
%b.tr6.i = phi i64 [ %rem.i, %cond.true.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %cond.true.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %cond.true.i
gcd.exit: ; preds = %cond.true.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %cond.true.i ]
%div = sdiv i64 %a, %a.tr.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @mod_MOD1(i64 noundef %n) local_unnamed_addr #7 {
entry:
%cmp = icmp slt i64 %n, 0
br i1 %cmp, label %cond.true, label %cond.end
cond.true: ; preds = %entry
%n.nonneg = sub i64 0, %n
%0 = urem i64 %n.nonneg, 1000000007
%1 = add nsw i64 %0, %n
%mul = sub i64 1000000007, %1
br label %cond.end
cond.end: ; preds = %entry, %cond.true
%cond = phi i64 [ %mul, %cond.true ], [ 0, %entry ]
%add1 = add nsw i64 %cond, %n
%rem = srem i64 %add1, 1000000007
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @mod_p(i64 noundef %n, i64 noundef %p) local_unnamed_addr #7 {
entry:
%cmp = icmp slt i64 %n, 0
br i1 %cmp, label %cond.true, label %cond.end
cond.true: ; preds = %entry
%div7 = sdiv i64 %n, %p
%add = sub i64 1, %div7
%mul = mul nsw i64 %add, %p
br label %cond.end
cond.end: ; preds = %entry, %cond.true
%cond = phi i64 [ %mul, %cond.true ], [ 0, %entry ]
%add1 = add nsw i64 %cond, %n
%rem = srem i64 %add1, %p
ret i64 %rem
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @change_into_num(ptr nocapture noundef readonly %s, i64 noundef %len, i64 noundef %p) local_unnamed_addr #8 {
entry:
%tobool.not11 = icmp eq i64 %p, 0
br i1 %tobool.not11, label %cond.end, label %cond.false.preheader
cond.false.preheader: ; preds = %entry
%0 = add i64 %p, -2
br label %cond.false
cond.false: ; preds = %cond.false.preheader, %POW.exit
%indvar = phi i64 [ 0, %cond.false.preheader ], [ %indvar.next, %POW.exit ]
%p.tr13 = phi i64 [ %p, %cond.false.preheader ], [ %sub, %POW.exit ]
%accumulator.tr12 = phi i64 [ 0, %cond.false.preheader ], [ %add, %POW.exit ]
%1 = xor i64 %indvar, -1
%2 = add i64 %1, %p
%sub = add nsw i64 %p.tr13, -1
%cmp3.i = icmp sgt i64 %p.tr13, 1
br i1 %cmp3.i, label %for.body.i.preheader, label %POW.exit
for.body.i.preheader: ; preds = %cond.false
%3 = sub i64 %0, %indvar
%xtraiter = and i64 %2, 7
%4 = icmp ult i64 %3, 7
br i1 %4, label %POW.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %2, -8
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%c.04.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %mul.i.7, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.7, %for.body.i ]
%mul.i.7 = mul i64 %c.04.i, 100000000
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %POW.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !18
POW.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%mul.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %mul.i.7, %for.body.i ]
%c.04.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %mul.i.7, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %POW.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %POW.exit.loopexit.unr-lcssa, %for.body.i.epil
%c.04.i.epil = phi i64 [ %mul.i.epil, %for.body.i.epil ], [ %c.04.i.unr, %POW.exit.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %POW.exit.loopexit.unr-lcssa ]
%mul.i.epil = mul nsw i64 %c.04.i.epil, 10
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %POW.exit, label %for.body.i.epil, !llvm.loop !20
POW.exit: ; preds = %POW.exit.loopexit.unr-lcssa, %for.body.i.epil, %cond.false
%c.0.lcssa.i = phi i64 [ 1, %cond.false ], [ %mul.i.lcssa.ph, %POW.exit.loopexit.unr-lcssa ], [ %mul.i.epil, %for.body.i.epil ]
%sub1 = sub nsw i64 %len, %p.tr13
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %sub1
%5 = load i8, ptr %arrayidx, align 1, !tbaa !21
%conv = sext i8 %5 to i64
%sub2 = add nsw i64 %conv, -48
%mul = mul nsw i64 %sub2, %c.0.lcssa.i
%add = add nsw i64 %mul, %accumulator.tr12
%tobool.not = icmp eq i64 %sub, 0
%indvar.next = add i64 %indvar, 1
br i1 %tobool.not, label %cond.end, label %cond.false
cond.end: ; preds = %POW.exit, %entry
%accumulator.tr.lcssa = phi i64 [ 0, %entry ], [ %add, %POW.exit ]
ret i64 %accumulator.tr.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @lr_lower(ptr nocapture noundef %l, ptr nocapture noundef %r, i64 noundef %am, i64 noundef %val, i32 noundef %type) local_unnamed_addr #9 {
entry:
%cmp = icmp slt i32 %type, 3
%0 = load i32, ptr %l, align 4, !tbaa !22
%1 = load i32, ptr %r, align 4, !tbaa !22
%add = add nsw i32 %1, %0
%div = sdiv i32 %add, 2
%cmp1 = icmp slt i64 %am, %val
%l.r = select i1 %cmp1, ptr %l, ptr %r
%cmp6.not = icmp sgt i64 %am, %val
%r.l = select i1 %cmp6.not, ptr %r, ptr %l
%l.sink = select i1 %cmp, ptr %l.r, ptr %r.l
store i32 %div, ptr %l.sink, align 4, !tbaa !22
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @lr_upper(ptr nocapture noundef %l, ptr nocapture noundef %r, i64 noundef %am, i64 noundef %val, i32 noundef %type) local_unnamed_addr #9 {
entry:
%cmp = icmp slt i32 %type, 3
%0 = load i32, ptr %l, align 4, !tbaa !22
%1 = load i32, ptr %r, align 4, !tbaa !22
%add3 = add nsw i32 %1, %0
%div4 = sdiv i32 %add3, 2
%cmp1.not = icmp sgt i64 %am, %val
%r.l = select i1 %cmp1.not, ptr %r, ptr %l
%cmp6 = icmp slt i64 %am, %val
%l.r = select i1 %cmp6, ptr %l, ptr %r
%l.sink = select i1 %cmp, ptr %r.l, ptr %l.r
store i32 %div4, ptr %l.sink, align 4, !tbaa !22
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @cmp_lower(i64 noundef %a, i64 noundef %b, i32 noundef %type) local_unnamed_addr #7 {
entry:
switch i32 %type, label %cond.false6 [
i32 1, label %cond.true
i32 2, label %cond.true3
]
cond.true: ; preds = %entry
%cmp1 = icmp eq i64 %a, %b
br label %cond.end10
cond.true3: ; preds = %entry
%cmp4.not = icmp sge i64 %a, %b
br label %cond.end10
cond.false6: ; preds = %entry
%cmp7 = icmp sgt i64 %a, %b
br label %cond.end10
cond.end10: ; preds = %cond.true3, %cond.false6, %cond.true
%cond11.in = phi i1 [ %cmp1, %cond.true ], [ %cmp4.not, %cond.true3 ], [ %cmp7, %cond.false6 ]
%cond11 = zext i1 %cond11.in to i32
ret i32 %cond11
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @cmp_upper(i64 noundef %a, i64 noundef %b, i32 noundef %type) local_unnamed_addr #7 {
entry:
switch i32 %type, label %cond.false6 [
i32 1, label %cond.true
i32 2, label %cond.true3
]
cond.true: ; preds = %entry
%cmp1 = icmp eq i64 %a, %b
br label %cond.end10
cond.true3: ; preds = %entry
%cmp4.not = icmp sle i64 %a, %b
br label %cond.end10
cond.false6: ; preds = %entry
%cmp7 = icmp slt i64 %a, %b
br label %cond.end10
cond.end10: ; preds = %cond.true3, %cond.false6, %cond.true
%cond11.in = phi i1 [ %cmp1, %cond.true ], [ %cmp4.not, %cond.true3 ], [ %cmp7, %cond.false6 ]
%cond11 = zext i1 %cond11.in to i32
ret i32 %cond11
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @lower_bound(ptr nocapture noundef readonly %a, i32 noundef %l, i32 noundef %r, i64 noundef %val, i32 noundef %type) local_unnamed_addr #8 {
entry:
%sub34 = sub nsw i32 %r, %l
%cmp35 = icmp sgt i32 %sub34, 1
br i1 %cmp35, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%cmp.i = icmp slt i32 %type, 3
br i1 %cmp.i, label %while.body.us, label %while.body
while.body.us: ; preds = %while.body.lr.ph, %while.body.us
%l.addr.0 = phi i32 [ %spec.select, %while.body.us ], [ %l, %while.body.lr.ph ]
%r.addr.0 = phi i32 [ %spec.select51, %while.body.us ], [ %r, %while.body.lr.ph ]
%add.us = add nsw i32 %l.addr.0, %r.addr.0
%div.us = sdiv i32 %add.us, 2
%idxprom.us = sext i32 %div.us to i64
%arrayidx.us = getelementptr inbounds i64, ptr %a, i64 %idxprom.us
%0 = load i64, ptr %arrayidx.us, align 8, !tbaa !5
%cmp1.i.us = icmp slt i64 %0, %val
%spec.select = select i1 %cmp1.i.us, i32 %div.us, i32 %l.addr.0
%spec.select51 = select i1 %cmp1.i.us, i32 %r.addr.0, i32 %div.us
%sub.us = sub nsw i32 %spec.select51, %spec.select
%cmp.us = icmp sgt i32 %sub.us, 1
br i1 %cmp.us, label %while.body.us, label %while.end, !llvm.loop !24
while.body: ; preds = %while.body.lr.ph, %while.body
%l.addr.2 = phi i32 [ %spec.select52, %while.body ], [ %l, %while.body.lr.ph ]
%r.addr.2 = phi i32 [ %spec.select53, %while.body ], [ %r, %while.body.lr.ph ]
%add = add nsw i32 %l.addr.2, %r.addr.2
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %idxprom
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp6.not.i = icmp sgt i64 %1, %val
%spec.select52 = select i1 %cmp6.not.i, i32 %l.addr.2, i32 %div
%spec.select53 = select i1 %cmp6.not.i, i32 %div, i32 %r.addr.2
%sub = sub nsw i32 %spec.select53, %spec.select52
%cmp = icmp sgt i32 %sub, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !24
while.end: ; preds = %while.body, %while.body.us, %entry
%r.addr.0..lcssa = phi i32 [ %r, %entry ], [ %spec.select51, %while.body.us ], [ %spec.select53, %while.body ]
%l.addr.0..lcssa = phi i32 [ %l, %entry ], [ %spec.select, %while.body.us ], [ %spec.select52, %while.body ]
%idxprom1 = sext i32 %l.addr.0..lcssa to i64
%arrayidx2 = getelementptr inbounds i64, ptr %a, i64 %idxprom1
%2 = load i64, ptr %arrayidx2, align 8, !tbaa !5
switch i32 %type, label %cmp_lower.exit [
i32 1, label %cond.true.i
i32 2, label %cond.true3.i
]
cond.true.i: ; preds = %while.end
%cmp1.i17 = icmp eq i64 %2, %val
br i1 %cmp1.i17, label %cond.end9, label %cond.false.thread
cond.false.thread: ; preds = %cond.true.i
%idxprom345 = sext i32 %r.addr.0..lcssa to i64
%arrayidx446 = getelementptr inbounds i64, ptr %a, i64 %idxprom345
%3 = load i64, ptr %arrayidx446, align 8, !tbaa !5
%cmp1.i23 = icmp eq i64 %3, %val
br label %cmp_lower.exit26
cond.true3.i: ; preds = %while.end
%cmp4.not.i.not = icmp slt i64 %2, %val
br i1 %cmp4.not.i.not, label %cond.false.thread47, label %cond.end9
cond.false.thread47: ; preds = %cond.true3.i
%idxprom348 = sext i32 %r.addr.0..lcssa to i64
%arrayidx449 = getelementptr inbounds i64, ptr %a, i64 %idxprom348
%4 = load i64, ptr %arrayidx449, align 8, !tbaa !5
%cmp4.not.i19 = icmp sge i64 %4, %val
br label %cmp_lower.exit26
cmp_lower.exit: ; preds = %while.end
%cmp7.i = icmp sgt i64 %2, %val
br i1 %cmp7.i, label %cond.end9, label %cond.false
cond.false: ; preds = %cmp_lower.exit
%idxprom3 = sext i32 %r.addr.0..lcssa to i64
%arrayidx4 = getelementptr inbounds i64, ptr %a, i64 %idxprom3
%5 = load i64, ptr %arrayidx4, align 8, !tbaa !5
%cmp7.i25 = icmp sgt i64 %5, %val
br label %cmp_lower.exit26
cmp_lower.exit26: ; preds = %cond.false.thread, %cond.false.thread47, %cond.false
%cond11.in.i20 = phi i1 [ %cmp1.i23, %cond.false.thread ], [ %cmp4.not.i19, %cond.false.thread47 ], [ %cmp7.i25, %cond.false ]
%6 = sext i32 %r.addr.0..lcssa to i64
%.pre = select i1 %cond11.in.i20, i64 %6, i64 -1
br label %cond.end9
cond.end9: ; preds = %cond.true3.i, %cond.true.i, %cmp_lower.exit, %cmp_lower.exit26
%conv.pre-phi = phi i64 [ %idxprom1, %cmp_lower.exit ], [ %.pre, %cmp_lower.exit26 ], [ %idxprom1, %cond.true.i ], [ %idxprom1, %cond.true3.i ]
ret i64 %conv.pre-phi
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @upper_bound(ptr nocapture noundef readonly %a, i32 noundef %l, i32 noundef %r, i64 noundef %val, i32 noundef %type) local_unnamed_addr #8 {
entry:
%sub33 = sub nsw i32 %r, %l
%cmp34 = icmp sgt i32 %sub33, 1
br i1 %cmp34, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%cmp.i = icmp slt i32 %type, 3
br i1 %cmp.i, label %while.body.us, label %while.body
while.body.us: ; preds = %while.body.lr.ph, %while.body.us
%l.addr.0 = phi i32 [ %spec.select, %while.body.us ], [ %l, %while.body.lr.ph ]
%r.addr.0 = phi i32 [ %spec.select50, %while.body.us ], [ %r, %while.body.lr.ph ]
%add.us = add nsw i32 %l.addr.0, %r.addr.0
%div.us = sdiv i32 %add.us, 2
%idxprom.us = sext i32 %div.us to i64
%arrayidx.us = getelementptr inbounds i64, ptr %a, i64 %idxprom.us
%0 = load i64, ptr %arrayidx.us, align 8, !tbaa !5
%cmp1.not.i.us = icmp sgt i64 %0, %val
%spec.select = select i1 %cmp1.not.i.us, i32 %l.addr.0, i32 %div.us
%spec.select50 = select i1 %cmp1.not.i.us, i32 %div.us, i32 %r.addr.0
%sub.us = sub nsw i32 %spec.select50, %spec.select
%cmp.us = icmp sgt i32 %sub.us, 1
br i1 %cmp.us, label %while.body.us, label %while.end, !llvm.loop !25
while.body: ; preds = %while.body.lr.ph, %while.body
%l.addr.2 = phi i32 [ %spec.select51, %while.body ], [ %l, %while.body.lr.ph ]
%r.addr.2 = phi i32 [ %spec.select52, %while.body ], [ %r, %while.body.lr.ph ]
%add = add nsw i32 %l.addr.2, %r.addr.2
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %idxprom
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp6.i = icmp slt i64 %1, %val
%spec.select51 = select i1 %cmp6.i, i32 %div, i32 %l.addr.2
%spec.select52 = select i1 %cmp6.i, i32 %r.addr.2, i32 %div
%sub = sub nsw i32 %spec.select52, %spec.select51
%cmp = icmp sgt i32 %sub, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !25
while.end: ; preds = %while.body, %while.body.us, %entry
%r.addr.0..lcssa = phi i32 [ %r, %entry ], [ %spec.select50, %while.body.us ], [ %spec.select52, %while.body ]
%l.addr.0..lcssa = phi i32 [ %l, %entry ], [ %spec.select, %while.body.us ], [ %spec.select51, %while.body ]
%idxprom1 = sext i32 %r.addr.0..lcssa to i64
%arrayidx2 = getelementptr inbounds i64, ptr %a, i64 %idxprom1
%2 = load i64, ptr %arrayidx2, align 8, !tbaa !5
switch i32 %type, label %cmp_upper.exit [
i32 1, label %cond.true.i
i32 2, label %cond.true3.i
]
cond.true.i: ; preds = %while.end
%cmp1.i = icmp eq i64 %2, %val
br i1 %cmp1.i, label %cond.end9, label %cond.false.thread
cond.false.thread: ; preds = %cond.true.i
%idxprom344 = sext i32 %l.addr.0..lcssa to i64
%arrayidx445 = getelementptr inbounds i64, ptr %a, i64 %idxprom344
%3 = load i64, ptr %arrayidx445, align 8, !tbaa !5
%cmp1.i22 = icmp eq i64 %3, %val
br label %cmp_upper.exit25
cond.true3.i: ; preds = %while.end
%cmp4.not.i.not = icmp sgt i64 %2, %val
br i1 %cmp4.not.i.not, label %cond.false.thread46, label %cond.end9
cond.false.thread46: ; preds = %cond.true3.i
%idxprom347 = sext i32 %l.addr.0..lcssa to i64
%arrayidx448 = getelementptr inbounds i64, ptr %a, i64 %idxprom347
%4 = load i64, ptr %arrayidx448, align 8, !tbaa !5
%cmp4.not.i18 = icmp sle i64 %4, %val
br label %cmp_upper.exit25
cmp_upper.exit: ; preds = %while.end
%cmp7.i = icmp slt i64 %2, %val
br i1 %cmp7.i, label %cond.end9, label %cond.false
cond.false: ; preds = %cmp_upper.exit
%idxprom3 = sext i32 %l.addr.0..lcssa to i64
%arrayidx4 = getelementptr inbounds i64, ptr %a, i64 %idxprom3
%5 = load i64, ptr %arrayidx4, align 8, !tbaa !5
%cmp7.i24 = icmp slt i64 %5, %val
br label %cmp_upper.exit25
cmp_upper.exit25: ; preds = %cond.false.thread, %cond.false.thread46, %cond.false
%cond11.in.i19 = phi i1 [ %cmp1.i22, %cond.false.thread ], [ %cmp4.not.i18, %cond.false.thread46 ], [ %cmp7.i24, %cond.false ]
%6 = sext i32 %l.addr.0..lcssa to i64
%.pre = select i1 %cond11.in.i19, i64 %6, i64 -1
br label %cond.end9
cond.end9: ; preds = %cond.true3.i, %cond.true.i, %cmp_upper.exit, %cmp_upper.exit25
%conv.pre-phi = phi i64 [ %idxprom1, %cmp_upper.exit ], [ %.pre, %cmp_upper.exit25 ], [ %idxprom1, %cond.true.i ], [ %idxprom1, %cond.true3.i ]
ret i64 %conv.pre-phi
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @count(ptr nocapture noundef readonly %a, i32 noundef %l, i32 noundef %r, i64 noundef %x) local_unnamed_addr #8 {
entry:
%sub34.i = sub nsw i32 %r, %l
%cmp35.i = icmp sgt i32 %sub34.i, 1
br i1 %cmp35.i, label %while.body.us.i, label %while.end.i
while.body.us.i: ; preds = %entry, %while.body.us.i
%l.addr.0.i = phi i32 [ %spec.select.i, %while.body.us.i ], [ %l, %entry ]
%r.addr.0.i = phi i32 [ %spec.select51.i, %while.body.us.i ], [ %r, %entry ]
%add.us.i = add nsw i32 %r.addr.0.i, %l.addr.0.i
%div.us.i = sdiv i32 %add.us.i, 2
%idxprom.us.i = sext i32 %div.us.i to i64
%arrayidx.us.i = getelementptr inbounds i64, ptr %a, i64 %idxprom.us.i
%0 = load i64, ptr %arrayidx.us.i, align 8, !tbaa !5
%cmp1.i.us.i = icmp slt i64 %0, %x
%spec.select.i = select i1 %cmp1.i.us.i, i32 %div.us.i, i32 %l.addr.0.i
%spec.select51.i = select i1 %cmp1.i.us.i, i32 %r.addr.0.i, i32 %div.us.i
%sub.us.i = sub nsw i32 %spec.select51.i, %spec.select.i
%cmp.us.i = icmp sgt i32 %sub.us.i, 1
br i1 %cmp.us.i, label %while.body.us.i, label %while.end.i, !llvm.loop !24
while.end.i: ; preds = %while.body.us.i, %entry
%r.addr.0..lcssa.i = phi i32 [ %r, %entry ], [ %spec.select51.i, %while.body.us.i ]
%l.addr.0..lcssa.i = phi i32 [ %l, %entry ], [ %spec.select.i, %while.body.us.i ]
%idxprom1.i = sext i32 %l.addr.0..lcssa.i to i64
%arrayidx2.i = getelementptr inbounds i64, ptr %a, i64 %idxprom1.i
%1 = load i64, ptr %arrayidx2.i, align 8, !tbaa !5
%cmp1.i17.i = icmp eq i64 %1, %x
br i1 %cmp1.i17.i, label %lower_bound.exit, label %cond.false.thread.i
cond.false.thread.i: ; preds = %while.end.i
%idxprom345.i = sext i32 %r.addr.0..lcssa.i to i64
%arrayidx446.i = getelementptr inbounds i64, ptr %a, i64 %idxprom345.i
%2 = load i64, ptr %arrayidx446.i, align 8, !tbaa !5
%cmp1.i23.i = icmp eq i64 %2, %x
%.pre.i = select i1 %cmp1.i23.i, i64 %idxprom345.i, i64 -1
br label %lower_bound.exit
lower_bound.exit: ; preds = %while.end.i, %cond.false.thread.i
%conv.pre-phi.i = phi i64 [ %.pre.i, %cond.false.thread.i ], [ %idxprom1.i, %while.end.i ]
%conv = trunc i64 %conv.pre-phi.i to i32
%cmp = icmp eq i32 %conv, -1
br i1 %cmp, label %cond.end, label %cond.false
cond.false: ; preds = %lower_bound.exit
%sub33.i = sub nsw i32 %r, %conv
%cmp34.i = icmp sgt i32 %sub33.i, 1
br i1 %cmp34.i, label %while.body.us.i18, label %while.end.i9
while.body.us.i18: ; preds = %cond.false, %while.body.us.i18
%l.addr.0.i19 = phi i32 [ %spec.select.i25, %while.body.us.i18 ], [ %conv, %cond.false ]
%r.addr.0.i20 = phi i32 [ %spec.select50.i, %while.body.us.i18 ], [ %r, %cond.false ]
%add.us.i21 = add nsw i32 %r.addr.0.i20, %l.addr.0.i19
%div.us.i22 = sdiv i32 %add.us.i21, 2
%idxprom.us.i23 = sext i32 %div.us.i22 to i64
%arrayidx.us.i24 = getelementptr inbounds i64, ptr %a, i64 %idxprom.us.i23
%3 = load i64, ptr %arrayidx.us.i24, align 8, !tbaa !5
%cmp1.not.i.us.i = icmp sgt i64 %3, %x
%spec.select.i25 = select i1 %cmp1.not.i.us.i, i32 %l.addr.0.i19, i32 %div.us.i22
%spec.select50.i = select i1 %cmp1.not.i.us.i, i32 %div.us.i22, i32 %r.addr.0.i20
%sub.us.i26 = sub nsw i32 %spec.select50.i, %spec.select.i25
%cmp.us.i27 = icmp sgt i32 %sub.us.i26, 1
br i1 %cmp.us.i27, label %while.body.us.i18, label %while.end.i9, !llvm.loop !25
while.end.i9: ; preds = %while.body.us.i18, %cond.false
%r.addr.0..lcssa.i10 = phi i32 [ %r, %cond.false ], [ %spec.select50.i, %while.body.us.i18 ]
%l.addr.0..lcssa.i11 = phi i32 [ %conv, %cond.false ], [ %spec.select.i25, %while.body.us.i18 ]
%idxprom1.i12 = sext i32 %r.addr.0..lcssa.i10 to i64
%arrayidx2.i13 = getelementptr inbounds i64, ptr %a, i64 %idxprom1.i12
%4 = load i64, ptr %arrayidx2.i13, align 8, !tbaa !5
%cmp1.i.i = icmp eq i64 %4, %x
br i1 %cmp1.i.i, label %upper_bound.exit, label %cond.false.thread.i14
cond.false.thread.i14: ; preds = %while.end.i9
%idxprom344.i = sext i32 %l.addr.0..lcssa.i11 to i64
%arrayidx445.i = getelementptr inbounds i64, ptr %a, i64 %idxprom344.i
%5 = load i64, ptr %arrayidx445.i, align 8, !tbaa !5
%cmp1.i22.i = icmp eq i64 %5, %x
%.pre.i15 = select i1 %cmp1.i22.i, i64 %idxprom344.i, i64 -1
br label %upper_bound.exit
upper_bound.exit: ; preds = %while.end.i9, %cond.false.thread.i14
%conv.pre-phi.i16 = phi i64 [ %.pre.i15, %cond.false.thread.i14 ], [ %idxprom1.i12, %while.end.i9 ]
%reass.sub = sub nsw i64 %conv.pre-phi.i16, %conv.pre-phi.i
%add = add nsw i64 %reass.sub, 1
br label %cond.end
cond.end: ; preds = %lower_bound.exit, %upper_bound.exit
%cond = phi i64 [ %add, %upper_bound.exit ], [ 0, %lower_bound.exit ]
ret i64 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #10 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = zext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 -1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #10 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = sext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_string(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #11 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #17
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #12
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_char(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #10 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !21
%conv = sext i8 %0 to i32
%1 = load i8, ptr %b, align 1, !tbaa !21
%conv1 = sext i8 %1 to i32
%sub = sub nsw i32 %conv, %conv1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #18
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #13
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @downll) #18
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sort_string(i32 noundef %n, i32 noundef %size, ptr noundef %s) local_unnamed_addr #2 {
entry:
%0 = zext i32 %size to i64
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %s, i64 noundef %conv, i64 noundef %0, ptr noundef nonnull @cmp_string) #18
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sort_char(ptr noundef %s) local_unnamed_addr #2 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #17
tail call void @qsort(ptr noundef %s, i64 noundef %call, i64 noundef 1, ptr noundef nonnull @cmp_char) #18
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #12
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @unique_string(i64 noundef %n, i64 noundef %size, ptr nocapture noundef readonly %s) local_unnamed_addr #14 {
entry:
%cmp8 = icmp sgt i64 %n, 1
br i1 %cmp8, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %spec.select, %for.body ]
ret i64 %ans.0.lcssa
for.body: ; preds = %entry, %for.body
%i.010 = phi i64 [ %inc2, %for.body ], [ 1, %entry ]
%ans.09 = phi i64 [ %spec.select, %for.body ], [ 1, %entry ]
%0 = mul nsw i64 %i.010, %size
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %0
%sub = add nsw i64 %i.010, -1
%1 = mul nsw i64 %sub, %size
%arrayidx1 = getelementptr inbounds i8, ptr %s, i64 %1
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %arrayidx1) #17
%tobool.not = icmp ne i32 %call, 0
%inc = zext i1 %tobool.not to i64
%spec.select = add nuw nsw i64 %ans.09, %inc
%inc2 = add nuw nsw i64 %i.010, 1
%exitcond.not = icmp eq i64 %inc2, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !26
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @unique_num(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #8 {
entry:
%cmp9 = icmp sgt i64 %n, 1
br i1 %cmp9, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = add i64 %n, -1
%min.iters.check = icmp ult i64 %n, 5
br i1 %min.iters.check, label %for.body.preheader16, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %0, -4
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 1, i64 0>, %vector.ph ], [ %9, %vector.body ]
%vec.phi12 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds i64, ptr %a, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = getelementptr inbounds i64, ptr %1, i64 2
%wide.load13 = load <2 x i64>, ptr %2, align 8, !tbaa !5
%3 = getelementptr i64, ptr %1, i64 -1
%wide.load14 = load <2 x i64>, ptr %3, align 8, !tbaa !5
%4 = getelementptr i64, ptr %1, i64 1
%wide.load15 = load <2 x i64>, ptr %4, align 8, !tbaa !5
%5 = icmp ne <2 x i64> %wide.load, %wide.load14
%6 = icmp ne <2 x i64> %wide.load13, %wide.load15
%7 = zext <2 x i1> %5 to <2 x i64>
%8 = zext <2 x i1> %6 to <2 x i64>
%9 = add <2 x i64> %vec.phi, %7
%10 = add <2 x i64> %vec.phi12, %8
%index.next = add nuw i64 %index, 4
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !27
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %10, %9
%12 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %0, %n.vec
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader16
for.body.preheader16: ; preds = %for.body.preheader, %middle.block
%i.011.ph = phi i64 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
%ans.010.ph = phi i64 [ 1, %for.body.preheader ], [ %12, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %12, %middle.block ], [ %spec.select, %for.body ]
ret i64 %ans.0.lcssa
for.body: ; preds = %for.body.preheader16, %for.body
%i.011 = phi i64 [ %inc3, %for.body ], [ %i.011.ph, %for.body.preheader16 ]
%ans.010 = phi i64 [ %spec.select, %for.body ], [ %ans.010.ph, %for.body.preheader16 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.011
%13 = load i64, ptr %arrayidx, align 8, !tbaa !5
%arrayidx1 = getelementptr i64, ptr %arrayidx, i64 -1
%14 = load i64, ptr %arrayidx1, align 8, !tbaa !5
%cmp2.not = icmp ne i64 %13, %14
%inc = zext i1 %cmp2.not to i64
%spec.select = add nuw nsw i64 %ans.010, %inc
%inc3 = add nuw nsw i64 %i.011, 1
%exitcond.not = icmp eq i64 %inc3, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !28
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp1(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #10 {
entry:
%0 = load i64, ptr %p, align 8, !tbaa !29
%1 = load i64, ptr %q, align 8, !tbaa !29
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp2(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #10 {
entry:
%0 = load i64, ptr %q, align 8, !tbaa !29
%1 = load i64, ptr %p, align 8, !tbaa !29
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @strsortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 16, ptr noundef nonnull @cmp1) #18
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @strsortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 16, ptr noundef nonnull @cmp2) #18
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #18
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%mul = shl nsw i64 %0, 1
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %mul, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%mul1 = shl nsw i64 %2, 1
%add = or i64 %mul1, 1
%vla2 = alloca i64, i64 %add, align 16
store i64 0, ptr %vla2, align 16, !tbaa !5
%cmp132 = icmp sgt i64 %2, 0
br i1 %cmp132, label %for.body, label %for.cond13.preheader
for.cond13.preheader: ; preds = %for.body, %entry
%.lcssa = phi i64 [ %2, %entry ], [ %8, %for.body ]
%.lcssa.fr = freeze i64 %.lcssa
%cmp14134 = icmp sgt i64 %.lcssa.fr, 0
br i1 %cmp14134, label %for.body16.lr.ph, label %while.end
for.body16.lr.ph: ; preds = %for.cond13.preheader
%3 = getelementptr i64, ptr %vla2, i64 %.lcssa.fr
%4 = getelementptr i64, ptr %3, i64 1
%load_initial = load i64, ptr %3, align 8
%xtraiter = and i64 %.lcssa.fr, 3
%5 = icmp ult i64 %.lcssa.fr, 4
br i1 %5, label %for.cond.cleanup15.unr-lcssa, label %for.body16.lr.ph.new
for.body16.lr.ph.new: ; preds = %for.body16.lr.ph
%unroll_iter = and i64 %.lcssa.fr, -4
br label %for.body16
for.body: ; preds = %entry, %for.body
%6 = phi i64 [ %add9, %for.body ], [ 0, %entry ]
%i.0133 = phi i64 [ %add10, %for.body ], [ 0, %entry ]
%arrayidx3 = getelementptr inbounds i64, ptr %vla, i64 %i.0133
%call.i121 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3)
%7 = load i64, ptr %arrayidx3, align 8, !tbaa !5
%8 = load i64, ptr %n, align 8, !tbaa !5
%arrayidx6 = getelementptr i64, ptr %arrayidx3, i64 %8
store i64 %7, ptr %arrayidx6, align 8, !tbaa !5
%9 = load i64, ptr %arrayidx3, align 8, !tbaa !5
%add9 = add nsw i64 %9, %6
%add10 = add nuw nsw i64 %i.0133, 1
%arrayidx11 = getelementptr inbounds i64, ptr %vla2, i64 %add10
store i64 %add9, ptr %arrayidx11, align 8, !tbaa !5
%cmp = icmp slt i64 %add10, %8
br i1 %cmp, label %for.body, label %for.cond13.preheader, !llvm.loop !31
for.cond.cleanup15.unr-lcssa: ; preds = %for.body16, %for.body16.lr.ph
%store_forwarded.unr = phi i64 [ %load_initial, %for.body16.lr.ph ], [ %add20.3, %for.body16 ]
%i12.0135.unr = phi i64 [ 0, %for.body16.lr.ph ], [ %inc25.3, %for.body16 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup15, label %for.body16.epil
for.body16.epil: ; preds = %for.cond.cleanup15.unr-lcssa, %for.body16.epil
%store_forwarded.epil = phi i64 [ %add20.epil, %for.body16.epil ], [ %store_forwarded.unr, %for.cond.cleanup15.unr-lcssa ]
%i12.0135.epil = phi i64 [ %inc25.epil, %for.body16.epil ], [ %i12.0135.unr, %for.cond.cleanup15.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body16.epil ], [ 0, %for.cond.cleanup15.unr-lcssa ]
%arrayidx19.epil = getelementptr inbounds i64, ptr %vla, i64 %i12.0135.epil
%10 = load i64, ptr %arrayidx19.epil, align 8, !tbaa !5
%add20.epil = add nsw i64 %10, %store_forwarded.epil
%arrayidx23.epil = getelementptr i64, ptr %4, i64 %i12.0135.epil
store i64 %add20.epil, ptr %arrayidx23.epil, align 8, !tbaa !5
%inc25.epil = add nuw nsw i64 %i12.0135.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup15, label %for.body16.epil, !llvm.loop !32
for.cond.cleanup15: ; preds = %for.body16.epil, %for.cond.cleanup15.unr-lcssa
%arrayidx27 = getelementptr inbounds i64, ptr %vla2, i64 %.lcssa.fr
%11 = load i64, ptr %arrayidx27, align 8, !tbaa !5
%div = sdiv i64 %11, 3
%invariant.gep = getelementptr i64, ptr %vla2, i64 1
br i1 %cmp14134, label %while.body.lr.ph.lr.ph, label %while.end
while.body.lr.ph.lr.ph: ; preds = %for.cond.cleanup15
%12 = load i64, ptr %vla, align 16, !tbaa !5
%.tr = trunc i64 %.lcssa.fr to i32
%conv = shl i32 %.tr, 1
%cmp35.i = icmp sgt i32 %conv, 1
%idxprom348.i = sext i32 %conv to i64
%arrayidx449.i = getelementptr inbounds i64, ptr %vla2, i64 %idxprom348.i
br i1 %cmp35.i, label %while.body.lr.ph.us, label %while.body.lr.ph
while.body.lr.ph.us: ; preds = %while.body.lr.ph.lr.ph, %if.then73.split.us.split.us.us
%ans.0.ph155.us = phi i64 [ %cond.i.us, %if.then73.split.us.split.us.us ], [ 0, %while.body.lr.ph.lr.ph ]
%siz.0.ph154.us = phi i64 [ %siz.1.us.us.us, %if.then73.split.us.split.us.us ], [ %12, %while.body.lr.ph.lr.ph ]
%tail.0.ph153.us = phi i64 [ %tail.1.ph.us.us, %if.then73.split.us.split.us.us ], [ 0, %while.body.lr.ph.lr.ph ]
%head.0.ph152.us = phi i64 [ %head.1.us.us.us, %if.then73.split.us.split.us.us ], [ 0, %while.body.lr.ph.lr.ph ]
br label %while.body.us.us
while.body.us.us: ; preds = %while.cond.backedge.us.us, %while.body.lr.ph.us
%siz.0143.us.us = phi i64 [ %siz.0.ph154.us, %while.body.lr.ph.us ], [ 0, %while.cond.backedge.us.us ]
%tail.0142.us.us = phi i64 [ %tail.0.ph153.us, %while.body.lr.ph.us ], [ %tail.0.be.us.us, %while.cond.backedge.us.us ]
%head.0141.us.us = phi i64 [ %head.0.ph152.us, %while.body.lr.ph.us ], [ %head.0.be.us.us, %while.cond.backedge.us.us ]
%add30.us.us = add nsw i64 %tail.0142.us.us, 1
%arrayidx31.us.us = getelementptr inbounds i64, ptr %vla, i64 %add30.us.us
%13 = load i64, ptr %arrayidx31.us.us, align 8, !tbaa !5
%add32.us.us = add nsw i64 %13, %siz.0143.us.us
%cmp33.us.us = icmp sgt i64 %add32.us.us, %div
br i1 %cmp33.us.us, label %if.then.us.us, label %NEXT.preheader.us.us
if.then.us.us: ; preds = %while.body.us.us
%tobool.not.us.us = icmp eq i64 %siz.0143.us.us, 0
%inc35.us.us = add nsw i64 %head.0141.us.us, 1
br i1 %tobool.not.us.us, label %while.cond.backedge.us.us, label %if.end.us.us
if.end.us.us: ; preds = %if.then.us.us
%arrayidx38.us.us = getelementptr inbounds i64, ptr %vla, i64 %head.0141.us.us
%14 = load i64, ptr %arrayidx38.us.us, align 8, !tbaa !5
%sub39.us.us = sub nsw i64 %siz.0143.us.us, %14
br label %NEXT.preheader.us.us
NEXT.preheader.us.us: ; preds = %if.end.us.us, %while.body.us.us
%head.1.ph.us.us = phi i64 [ %head.0141.us.us, %while.body.us.us ], [ %inc35.us.us, %if.end.us.us ]
%tail.1.ph.us.us = phi i64 [ %add30.us.us, %while.body.us.us ], [ %tail.0142.us.us, %if.end.us.us ]
%siz.1.ph.us.us = phi i64 [ %add32.us.us, %while.body.us.us ], [ %sub39.us.us, %if.end.us.us ]
%gep.us.us = getelementptr i64, ptr %invariant.gep, i64 %tail.1.ph.us.us
%15 = load i64, ptr %gep.us.us, align 8, !tbaa !5
br label %NEXT.us.us.us
while.cond.backedge.us.us: ; preds = %if.then54.us.us.us, %if.then.us.us
%head.0.be.us.us = phi i64 [ %inc35.us.us, %if.then.us.us ], [ %add51.us.us.us, %if.then54.us.us.us ]
%tail.0.be.us.us = phi i64 [ %add30.us.us, %if.then.us.us ], [ %tail.1.ph.us.us, %if.then54.us.us.us ]
%cmp29.not.not.us.us = icmp slt i64 %head.0.be.us.us, %.lcssa.fr
br i1 %cmp29.not.not.us.us, label %while.body.us.us, label %while.end, !llvm.loop !33
NEXT.us.us.us: ; preds = %NEXT.us.us.us.backedge, %NEXT.preheader.us.us
%head.1.us.us.us = phi i64 [ %head.1.ph.us.us, %NEXT.preheader.us.us ], [ %head.1.us.us.us.be, %NEXT.us.us.us.backedge ]
%siz.1.us.us.us = phi i64 [ %siz.1.ph.us.us, %NEXT.preheader.us.us ], [ %siz.1.us.us.us.be, %NEXT.us.us.us.backedge ]
%add47.us.us.us = add nsw i64 %15, %siz.1.us.us.us
br label %while.body.us.i.us.us.us
while.body.us.i.us.us.us: ; preds = %while.body.us.i.us.us.us, %NEXT.us.us.us
%l.addr.0.i.us.us.us = phi i32 [ %spec.select.i.us.us.us, %while.body.us.i.us.us.us ], [ 0, %NEXT.us.us.us ]
%r.addr.0.i.us.us.us = phi i32 [ %spec.select51.i.us.us.us, %while.body.us.i.us.us.us ], [ %conv, %NEXT.us.us.us ]
%add.us.i.us.us.us = add nsw i32 %r.addr.0.i.us.us.us, %l.addr.0.i.us.us.us
%div.us.i.us.us.us = sdiv i32 %add.us.i.us.us.us, 2
%idxprom.us.i.us.us.us = sext i32 %div.us.i.us.us.us to i64
%arrayidx.us.i.us.us.us = getelementptr inbounds i64, ptr %vla2, i64 %idxprom.us.i.us.us.us
%16 = load i64, ptr %arrayidx.us.i.us.us.us, align 8, !tbaa !5
%cmp1.i.us.i.us.us.us = icmp slt i64 %16, %add47.us.us.us
%spec.select.i.us.us.us = select i1 %cmp1.i.us.i.us.us.us, i32 %div.us.i.us.us.us, i32 %l.addr.0.i.us.us.us
%spec.select51.i.us.us.us = select i1 %cmp1.i.us.i.us.us.us, i32 %r.addr.0.i.us.us.us, i32 %div.us.i.us.us.us
%sub.us.i.us.us.us = sub nsw i32 %spec.select51.i.us.us.us, %spec.select.i.us.us.us
%cmp.us.i.us.us.us = icmp sgt i32 %sub.us.i.us.us.us, 1
br i1 %cmp.us.i.us.us.us, label %while.body.us.i.us.us.us, label %while.end.i.loopexit.us.us.us, !llvm.loop !24
cond.false.thread47.i.us.us.us: ; preds = %while.end.i.loopexit.us.us.us
%idxprom348.i.us.us.us = sext i32 %spec.select51.i.us.us.us to i64
%arrayidx449.i.us.us.us = getelementptr inbounds i64, ptr %vla2, i64 %idxprom348.i.us.us.us
%17 = load i64, ptr %arrayidx449.i.us.us.us, align 8, !tbaa !5
%cmp4.not.i19.i.not.us.us.us = icmp slt i64 %17, %add47.us.us.us
br i1 %cmp4.not.i19.i.not.us.us.us, label %if.then50.us.us.us, label %lower_bound.exit.us.us.us
lower_bound.exit.us.us.us: ; preds = %while.end.i.loopexit.us.us.us, %cond.false.thread47.i.us.us.us
%18 = phi i64 [ %22, %while.end.i.loopexit.us.us.us ], [ %17, %cond.false.thread47.i.us.us.us ]
%conv.pre-phi.i.us.us.us = phi i64 [ %idxprom1.i.us.us.us, %while.end.i.loopexit.us.us.us ], [ %idxprom348.i.us.us.us, %cond.false.thread47.i.us.us.us ]
%cmp48.us.us.us = icmp eq i64 %conv.pre-phi.i.us.us.us, -1
br i1 %cmp48.us.us.us, label %if.then50.us.us.us, label %if.end61.us.us.us
if.end61.us.us.us: ; preds = %lower_bound.exit.us.us.us
%sub65.us.us.us = sub nsw i64 %18, %15
%cmp69.not.us.us.us = icmp slt i64 %sub65.us.us.us, %siz.1.us.us.us
br i1 %cmp69.not.us.us.us, label %if.else75.us.us.us, label %land.lhs.true.us.us.us
land.lhs.true.us.us.us: ; preds = %if.end61.us.us.us
%19 = add i64 %siz.1.us.us.us, %sub65.us.us.us
%sub68.us.us.us = sub i64 %11, %19
%cmp71.not.us.us.us = icmp slt i64 %sub68.us.us.us, %siz.1.us.us.us
br i1 %cmp71.not.us.us.us, label %if.else75.us.us.us, label %if.then73.split.us.split.us.us
if.else75.us.us.us: ; preds = %land.lhs.true.us.us.us, %if.end61.us.us.us
%add76.us.us.us = add nsw i64 %head.1.us.us.us, 1
%cmp77.not.us.us.us = icmp eq i64 %add76.us.us.us, %.lcssa.fr
br i1 %cmp77.not.us.us.us, label %while.end, label %if.then79.us.us.us
if.then79.us.us.us: ; preds = %if.else75.us.us.us
%arrayidx81.us.us.us = getelementptr inbounds i64, ptr %vla, i64 %head.1.us.us.us
%20 = load i64, ptr %arrayidx81.us.us.us, align 8, !tbaa !5
%sub82.us.us.us = sub nsw i64 %siz.1.us.us.us, %20
br label %NEXT.us.us.us.backedge
if.then50.us.us.us: ; preds = %lower_bound.exit.us.us.us, %cond.false.thread47.i.us.us.us
%add51.us.us.us = add nsw i64 %head.1.us.us.us, 1
%cmp52.not.us.us.us = icmp eq i64 %add51.us.us.us, %.lcssa.fr
br i1 %cmp52.not.us.us.us, label %while.end, label %if.then54.us.us.us
if.then54.us.us.us: ; preds = %if.then50.us.us.us
%arrayidx56.us.us.us = getelementptr inbounds i64, ptr %vla, i64 %head.1.us.us.us
%21 = load i64, ptr %arrayidx56.us.us.us, align 8, !tbaa !5
%sub57.us.us.us = sub nsw i64 %siz.1.us.us.us, %21
%tobool58.not.us.us.us = icmp eq i64 %sub57.us.us.us, 0
br i1 %tobool58.not.us.us.us, label %while.cond.backedge.us.us, label %NEXT.us.us.us.backedge
NEXT.us.us.us.backedge: ; preds = %if.then54.us.us.us, %if.then79.us.us.us
%head.1.us.us.us.be = phi i64 [ %add51.us.us.us, %if.then54.us.us.us ], [ %add76.us.us.us, %if.then79.us.us.us ]
%siz.1.us.us.us.be = phi i64 [ %sub57.us.us.us, %if.then54.us.us.us ], [ %sub82.us.us.us, %if.then79.us.us.us ]
br label %NEXT.us.us.us, !llvm.loop !33
while.end.i.loopexit.us.us.us: ; preds = %while.body.us.i.us.us.us
%idxprom1.i.us.us.us = sext i32 %spec.select.i.us.us.us to i64
%arrayidx2.i.us.us.us = getelementptr inbounds i64, ptr %vla2, i64 %idxprom1.i.us.us.us
%22 = load i64, ptr %arrayidx2.i.us.us.us, align 8, !tbaa !5
%cmp4.not.i.not.i.us.us.us = icmp slt i64 %22, %add47.us.us.us
br i1 %cmp4.not.i.not.i.us.us.us, label %cond.false.thread47.i.us.us.us, label %lower_bound.exit.us.us.us
if.then73.split.us.split.us.us: ; preds = %land.lhs.true.us.us.us
%cond.i.us = call i64 @llvm.smax.i64(i64 %ans.0.ph155.us, i64 %siz.1.us.us.us)
%cmp29.not.not140.us = icmp slt i64 %head.1.us.us.us, %.lcssa.fr
br i1 %cmp29.not.not140.us, label %while.body.lr.ph.us, label %while.end, !llvm.loop !33
for.body16: ; preds = %for.body16, %for.body16.lr.ph.new
%store_forwarded = phi i64 [ %load_initial, %for.body16.lr.ph.new ], [ %add20.3, %for.body16 ]
%i12.0135 = phi i64 [ 0, %for.body16.lr.ph.new ], [ %inc25.3, %for.body16 ]
%niter = phi i64 [ 0, %for.body16.lr.ph.new ], [ %niter.next.3, %for.body16 ]
%arrayidx19 = getelementptr inbounds i64, ptr %vla, i64 %i12.0135
%23 = load i64, ptr %arrayidx19, align 16, !tbaa !5
%add20 = add nsw i64 %23, %store_forwarded
%arrayidx23 = getelementptr i64, ptr %4, i64 %i12.0135
store i64 %add20, ptr %arrayidx23, align 8, !tbaa !5
%inc25 = or i64 %i12.0135, 1
%arrayidx19.1 = getelementptr inbounds i64, ptr %vla, i64 %inc25
%24 = load i64, ptr %arrayidx19.1, align 8, !tbaa !5
%add20.1 = add nsw i64 %24, %add20
%arrayidx23.1 = getelementptr i64, ptr %4, i64 %inc25
store i64 %add20.1, ptr %arrayidx23.1, align 8, !tbaa !5
%inc25.1 = or i64 %i12.0135, 2
%arrayidx19.2 = getelementptr inbounds i64, ptr %vla, i64 %inc25.1
%25 = load i64, ptr %arrayidx19.2, align 16, !tbaa !5
%add20.2 = add nsw i64 %25, %add20.1
%arrayidx23.2 = getelementptr i64, ptr %4, i64 %inc25.1
store i64 %add20.2, ptr %arrayidx23.2, align 8, !tbaa !5
%inc25.2 = or i64 %i12.0135, 3
%arrayidx19.3 = getelementptr inbounds i64, ptr %vla, i64 %inc25.2
%26 = load i64, ptr %arrayidx19.3, align 8, !tbaa !5
%add20.3 = add nsw i64 %26, %add20.2
%arrayidx23.3 = getelementptr i64, ptr %4, i64 %inc25.2
store i64 %add20.3, ptr %arrayidx23.3, align 8, !tbaa !5
%inc25.3 = add nuw nsw i64 %i12.0135, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond.cleanup15.unr-lcssa, label %for.body16, !llvm.loop !34
while.body: ; preds = %while.body.lr.ph, %while.cond.backedge
%siz.0143 = phi i64 [ %siz.0.ph154, %while.body.lr.ph ], [ 0, %while.cond.backedge ]
%tail.0142 = phi i64 [ %tail.0.ph153, %while.body.lr.ph ], [ %tail.0.be, %while.cond.backedge ]
%head.0141 = phi i64 [ %head.0.ph152, %while.body.lr.ph ], [ %head.0.be, %while.cond.backedge ]
%add30 = add nsw i64 %tail.0142, 1
%arrayidx31 = getelementptr inbounds i64, ptr %vla, i64 %add30
%27 = load i64, ptr %arrayidx31, align 8, !tbaa !5
%add32 = add nsw i64 %27, %siz.0143
%cmp33 = icmp sgt i64 %add32, %div
br i1 %cmp33, label %if.then, label %NEXT.preheader
if.then: ; preds = %while.body
%tobool.not = icmp eq i64 %siz.0143, 0
%inc35 = add nsw i64 %head.0141, 1
br i1 %tobool.not, label %while.cond.backedge, label %if.end
while.cond.backedge: ; preds = %if.then54, %if.then
%head.0.be = phi i64 [ %inc35, %if.then ], [ %add51, %if.then54 ]
%tail.0.be = phi i64 [ %add30, %if.then ], [ %tail.1.ph, %if.then54 ]
%cmp29.not.not = icmp slt i64 %head.0.be, %.lcssa.fr
br i1 %cmp29.not.not, label %while.body, label %while.end, !llvm.loop !33
if.end: ; preds = %if.then
%arrayidx38 = getelementptr inbounds i64, ptr %vla, i64 %head.0141
%28 = load i64, ptr %arrayidx38, align 8, !tbaa !5
%sub39 = sub nsw i64 %siz.0143, %28
br label %NEXT.preheader
NEXT.preheader: ; preds = %if.end, %while.body
%head.1.ph = phi i64 [ %head.0141, %while.body ], [ %inc35, %if.end ]
%tail.1.ph = phi i64 [ %add30, %while.body ], [ %tail.0142, %if.end ]
%siz.1.ph = phi i64 [ %add32, %while.body ], [ %sub39, %if.end ]
%gep = getelementptr i64, ptr %invariant.gep, i64 %tail.1.ph
%29 = load i64, ptr %gep, align 8, !tbaa !5
%30 = load i64, ptr %vla2, align 16, !tbaa !5
br label %NEXT
NEXT: ; preds = %NEXT.backedge, %NEXT.preheader
%head.1 = phi i64 [ %head.1.ph, %NEXT.preheader ], [ %head.1.be, %NEXT.backedge ]
%siz.1 = phi i64 [ %siz.1.ph, %NEXT.preheader ], [ %siz.1.be, %NEXT.backedge ]
%add47 = add nsw i64 %29, %siz.1
%cmp4.not.i.not.i = icmp slt i64 %30, %add47
br i1 %cmp4.not.i.not.i, label %cond.false.thread47.i, label %lower_bound.exit
cond.false.thread47.i: ; preds = %NEXT
%31 = load i64, ptr %arrayidx449.i, align 16, !tbaa !5
%cmp4.not.i19.i.not = icmp slt i64 %31, %add47
br i1 %cmp4.not.i19.i.not, label %if.then50, label %lower_bound.exit
lower_bound.exit: ; preds = %NEXT, %cond.false.thread47.i
%32 = phi i64 [ %31, %cond.false.thread47.i ], [ %30, %NEXT ]
%sub65 = sub nsw i64 %32, %29
%cmp69.not = icmp slt i64 %sub65, %siz.1
br i1 %cmp69.not, label %if.else75, label %land.lhs.true
if.then50: ; preds = %cond.false.thread47.i
%add51 = add nsw i64 %head.1, 1
%cmp52.not = icmp eq i64 %add51, %.lcssa.fr
br i1 %cmp52.not, label %while.end, label %if.then54
if.then54: ; preds = %if.then50
%arrayidx56 = getelementptr inbounds i64, ptr %vla, i64 %head.1
%33 = load i64, ptr %arrayidx56, align 8, !tbaa !5
%sub57 = sub nsw i64 %siz.1, %33
%tobool58.not = icmp eq i64 %sub57, 0
br i1 %tobool58.not, label %while.cond.backedge, label %NEXT.backedge
land.lhs.true: ; preds = %lower_bound.exit
%34 = add i64 %siz.1, %sub65
%sub68 = sub i64 %11, %34
%cmp71.not = icmp slt i64 %sub68, %siz.1
br i1 %cmp71.not, label %if.else75, label %if.then73.split
if.then73.split: ; preds = %land.lhs.true
%cond.i = call i64 @llvm.smax.i64(i64 %ans.0.ph155, i64 %siz.1)
%cmp29.not.not140 = icmp slt i64 %head.1, %.lcssa.fr
br i1 %cmp29.not.not140, label %while.body.lr.ph, label %while.end, !llvm.loop !33
while.body.lr.ph: ; preds = %while.body.lr.ph.lr.ph, %if.then73.split
%ans.0.ph155 = phi i64 [ %cond.i, %if.then73.split ], [ 0, %while.body.lr.ph.lr.ph ]
%siz.0.ph154 = phi i64 [ %siz.1, %if.then73.split ], [ %12, %while.body.lr.ph.lr.ph ]
%tail.0.ph153 = phi i64 [ %tail.1.ph, %if.then73.split ], [ 0, %while.body.lr.ph.lr.ph ]
%head.0.ph152 = phi i64 [ %head.1, %if.then73.split ], [ 0, %while.body.lr.ph.lr.ph ]
br label %while.body
if.else75: ; preds = %land.lhs.true, %lower_bound.exit
%add76 = add nsw i64 %head.1, 1
%cmp77.not = icmp eq i64 %add76, %.lcssa.fr
br i1 %cmp77.not, label %while.end, label %if.then79
if.then79: ; preds = %if.else75
%arrayidx81 = getelementptr inbounds i64, ptr %vla, i64 %head.1
%35 = load i64, ptr %arrayidx81, align 8, !tbaa !5
%sub82 = sub nsw i64 %siz.1, %35
br label %NEXT.backedge
NEXT.backedge: ; preds = %if.then79, %if.then54
%head.1.be = phi i64 [ %add51, %if.then54 ], [ %add76, %if.then79 ]
%siz.1.be = phi i64 [ %sub57, %if.then54 ], [ %sub82, %if.then79 ]
br label %NEXT, !llvm.loop !33
while.end: ; preds = %if.then73.split, %while.cond.backedge, %if.then50, %if.else75, %if.then73.split.us.split.us.us, %while.cond.backedge.us.us, %if.else75.us.us.us, %if.then50.us.us.us, %for.cond13.preheader, %for.cond.cleanup15
%ans.0.ph131 = phi i64 [ 0, %for.cond.cleanup15 ], [ 0, %for.cond13.preheader ], [ %ans.0.ph155.us, %if.then50.us.us.us ], [ %ans.0.ph155.us, %if.else75.us.us.us ], [ %ans.0.ph155.us, %while.cond.backedge.us.us ], [ %cond.i.us, %if.then73.split.us.split.us.us ], [ %ans.0.ph155, %if.else75 ], [ %ans.0.ph155, %if.then50 ], [ %ans.0.ph155, %while.cond.backedge ], [ %cond.i, %if.then73.split ]
%call85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %ans.0.ph131)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #18
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #15
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smin.v2i64(<2 x i64>, <2 x i64>) #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smin.v2i64(<2 x i64>) #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x i64>) #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smax.v2i64(<2 x i64>) #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #16
attributes #0 = { mustprogress nofree norecurse nosync 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 #5 = { nofree nosync nounwind memory(argmem: read) 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 #6 = { nofree norecurse nosync nounwind memory(none) 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 #7 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) 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 #8 = { nofree norecurse nosync nounwind memory(argmem: read) 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 #9 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) 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 #10 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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 #11 = { mustprogress nofree nounwind willreturn memory(argmem: read) 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 #12 = { 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 #13 = { 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 #14 = { nofree nounwind memory(argmem: read) 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 #15 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #16 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #17 = { nounwind willreturn memory(read) }
attributes #18 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !17}
!21 = !{!7, !7, i64 0}
!22 = !{!23, !23, i64 0}
!23 = !{!"int", !7, i64 0}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10, !11, !12}
!28 = distinct !{!28, !10, !12, !11}
!29 = !{!30, !6, i64 0}
!30 = !{!"", !6, i64 0, !6, i64 8}
!31 = distinct !{!31, !10}
!32 = distinct !{!32, !17}
!33 = distinct !{!33, !10}
!34 = distinct !{!34, !10}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main() {
int x, y;
scanf("%d%d", &x, &y);
printf("%d", x + (y / 2));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330646/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330646/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%div = sdiv i32 %1, 2
%add = add nsw i32 %div, %0
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int i,j,k,n,q,z=0,y=0;
scanf("%d",&q);
int b[q];
for(i=0;i<q;i++)
{
b[i]=0;
}
for(j=0;j<q;j++)
{
scanf("%d",&n);
int a[n+1];
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
if(a[i]==1)
k=i;
}
z=0;i=k+1;
if(i==n+1)
i=1;
while(i!=k)
{
if(i!=1)
{
if((a[i]-a[i-1])!=1)
{
z=1;
break;
}
}
else if((a[1]-a[n])!=1)
{
z=1;
break;
}
i++;
if(i==n+1)
i=1;
}
i=k-1;
if(z==1)
{
z=0;
if(i==0)
i=n;
while(i!=k)
{
if(i!=n)
{
if((a[i+1]-a[i])!=-1)
{
z=1;
break;
}
}
else if((a[1]-a[n])!=-1)
{
z=1;
break;
}
i--;
if(i==0)
i=n;
}
}
if(z==0)
b[j]=1;
}
for(i=0;i<q;i++)
{
if(b[i]==1)
printf("YES\n");
else
printf("NO\n");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_33069/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_33069/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%0 = load i32, ptr %q, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp140 = icmp sgt i32 %3, 0
br i1 %cmp140, label %for.body3.preheader, label %for.end103
for.body3.preheader: ; preds = %entry
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla, i8 0, i64 %5, i1 false), !tbaa !5
br label %for.body3
for.cond90.preheader: ; preds = %if.end86
%6 = icmp sgt i32 %23, 0
br i1 %6, label %for.body92, label %for.end103
for.body3: ; preds = %for.body3.preheader, %if.end86
%indvars.iv160 = phi i64 [ 0, %for.body3.preheader ], [ %indvars.iv.next161, %if.end86 ]
%k.0151 = phi i32 [ undef, %for.body3.preheader ], [ %k.1.lcssa, %if.end86 ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%7 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %7, 1
%8 = zext i32 %add to i64
%9 = call ptr @llvm.stacksave.p0()
%vla6 = alloca i32, i64 %8, align 16
%10 = load i32, ptr %n, align 4
%cmp8.not142 = icmp slt i32 %10, 1
br i1 %cmp8.not142, label %for.end18, label %for.body9
for.body9: ; preds = %for.body3, %for.body9
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body9 ], [ 1, %for.body3 ]
%k.1143 = phi i32 [ %spec.select, %for.body9 ], [ %k.0151, %for.body3 ]
%arrayidx11 = getelementptr inbounds i32, ptr %vla6, i64 %indvars.iv
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx11)
%11 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp15 = icmp eq i32 %11, 1
%12 = trunc i64 %indvars.iv to i32
%spec.select = select i1 %cmp15, i32 %12, i32 %k.1143
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%13 = load i32, ptr %n, align 4
%14 = sext i32 %13 to i64
%cmp8.not.not = icmp slt i64 %indvars.iv, %14
br i1 %cmp8.not.not, label %for.body9, label %for.end18, !llvm.loop !9
for.end18: ; preds = %for.body9, %for.body3
%k.1.lcssa = phi i32 [ %k.0151, %for.body3 ], [ %spec.select, %for.body9 ]
%.lcssa = phi i32 [ %10, %for.body3 ], [ %13, %for.body9 ]
%add19 = add nsw i32 %k.1.lcssa, 1
%cmp21 = icmp eq i32 %k.1.lcssa, %.lcssa
%spec.store.select = select i1 %cmp21, i32 1, i32 %add19
%cmp24.not.not146 = icmp eq i32 %spec.store.select, %k.1.lcssa
br i1 %cmp24.not.not146, label %if.then83.critedge, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end18
%arrayidx35 = getelementptr inbounds i32, ptr %vla6, i64 1
%idxprom36 = sext i32 %.lcssa to i64
%arrayidx37 = getelementptr inbounds i32, ptr %vla6, i64 %idxprom36
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end42
%i.2147 = phi i32 [ %spec.store.select, %while.body.lr.ph ], [ %spec.store.select104, %if.end42 ]
%cmp25.not = icmp eq i32 %i.2147, 1
br i1 %cmp25.not, label %if.else, label %if.then26
if.then26: ; preds = %while.body
%idxprom27 = sext i32 %i.2147 to i64
%arrayidx28 = getelementptr inbounds i32, ptr %vla6, i64 %idxprom27
%15 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%sub = add nsw i32 %i.2147, -1
%idxprom29 = sext i32 %sub to i64
%arrayidx30 = getelementptr inbounds i32, ptr %vla6, i64 %idxprom29
%16 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%sub31 = sub nsw i32 %15, %16
%cmp32.not = icmp eq i32 %sub31, 1
br i1 %cmp32.not, label %if.end42, label %if.then50
if.else: ; preds = %while.body
%17 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%18 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%sub38 = sub nsw i32 %17, %18
%cmp39.not = icmp eq i32 %sub38, 1
br i1 %cmp39.not, label %if.end42, label %if.then50
if.end42: ; preds = %if.else, %if.then26
%inc43 = add nsw i32 %i.2147, 1
%cmp45 = icmp eq i32 %i.2147, %.lcssa
%spec.store.select104 = select i1 %cmp45, i32 1, i32 %inc43
%cmp24.not.not = icmp eq i32 %spec.store.select104, %k.1.lcssa
br i1 %cmp24.not.not, label %if.then83.critedge, label %while.body, !llvm.loop !11
if.then50: ; preds = %if.then26, %if.else
%sub48 = add nsw i32 %k.1.lcssa, -1
%cmp51 = icmp eq i32 %sub48, 0
%spec.select137 = select i1 %cmp51, i32 %.lcssa, i32 %sub48
%cmp55.not148 = icmp eq i32 %spec.select137, %k.1.lcssa
br i1 %cmp55.not148, label %if.then83.critedge, label %while.body56
while.body56: ; preds = %if.then50, %if.end76
%i.4149 = phi i32 [ %spec.select138, %if.end76 ], [ %spec.select137, %if.then50 ]
%cmp57.not = icmp eq i32 %i.4149, %.lcssa
br i1 %cmp57.not, label %if.else68, label %if.then58
if.then58: ; preds = %while.body56
%add59 = add nsw i32 %i.4149, 1
%idxprom60 = sext i32 %add59 to i64
%arrayidx61 = getelementptr inbounds i32, ptr %vla6, i64 %idxprom60
%19 = load i32, ptr %arrayidx61, align 4, !tbaa !5
%idxprom62 = sext i32 %i.4149 to i64
%arrayidx63 = getelementptr inbounds i32, ptr %vla6, i64 %idxprom62
%20 = load i32, ptr %arrayidx63, align 4, !tbaa !5
%sub64 = sub nsw i32 %19, %20
%cmp65.not = icmp eq i32 %sub64, -1
br i1 %cmp65.not, label %if.end76, label %if.end86
if.else68: ; preds = %while.body56
%21 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%22 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%sub72 = sub nsw i32 %21, %22
%cmp73.not = icmp eq i32 %sub72, -1
br i1 %cmp73.not, label %if.end76, label %if.end86
if.end76: ; preds = %if.else68, %if.then58
%dec = add nsw i32 %i.4149, -1
%cmp77 = icmp eq i32 %dec, 0
%spec.select138 = select i1 %cmp77, i32 %.lcssa, i32 %dec
%cmp55.not = icmp eq i32 %spec.select138, %k.1.lcssa
br i1 %cmp55.not, label %if.then83.critedge, label %while.body56, !llvm.loop !12
if.then83.critedge: ; preds = %if.end42, %if.end76, %for.end18, %if.then50
%arrayidx85 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv160
store i32 1, ptr %arrayidx85, align 4, !tbaa !5
br label %if.end86
if.end86: ; preds = %if.then58, %if.else68, %if.then83.critedge
call void @llvm.stackrestore.p0(ptr %9)
%indvars.iv.next161 = add nuw nsw i64 %indvars.iv160, 1
%23 = load i32, ptr %q, align 4, !tbaa !5
%24 = sext i32 %23 to i64
%cmp2 = icmp slt i64 %indvars.iv.next161, %24
br i1 %cmp2, label %for.body3, label %for.cond90.preheader, !llvm.loop !13
for.body92: ; preds = %for.cond90.preheader, %for.body92
%indvars.iv163 = phi i64 [ %indvars.iv.next164, %for.body92 ], [ 0, %for.cond90.preheader ]
%arrayidx94 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv163
%25 = load i32, ptr %arrayidx94, align 4, !tbaa !5
%cmp95 = icmp eq i32 %25, 1
%str.3.str = select i1 %cmp95, ptr @str.3, ptr @str
%puts136 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
%indvars.iv.next164 = add nuw nsw i64 %indvars.iv163, 1
%26 = load i32, ptr %q, align 4, !tbaa !5
%27 = sext i32 %26 to i64
%cmp91 = icmp slt i64 %indvars.iv.next164, %27
br i1 %cmp91, label %for.body92, label %for.end103, !llvm.loop !14
for.end103: ; preds = %for.body92, %entry, %for.cond90.preheader
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main()
{
int a,b,x,y;
scanf("%d%d", &a,&b);
x=(b/2);
y=(a+x);
printf("%d\n", y);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330732/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330732/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %b, align 4, !tbaa !5
%div = sdiv i32 %0, 2
%1 = load i32, ptr %a, align 4, !tbaa !5
%add = add nsw i32 %1, %div
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int x,y;
scanf("%d %d" ,&x,&y);
printf("%d",x + y/2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330783/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330783/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%div = sdiv i32 %1, 2
%add = add nsw i32 %div, %0
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main(void) {
int x, y;
if(scanf("%d %d", &x, &y) == 1);
printf("%d", y / 2 + x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330826/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330826/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %y, align 4, !tbaa !5
%div = sdiv i32 %0, 2
%1 = load i32, ptr %x, align 4, !tbaa !5
%add = add nsw i32 %div, %1
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
// your code goes here
int a,b,x;
scanf("%d%d%d",&a,&b,&x);
int res[a+b];
int l = a+b;
if(a>b){
res[0] = 0;
a--;
}else{
res[0] = 1;
b--;
}
int i=0;
if(x%2 == 0){
for(i=0;i<x-1;i++){
if(res[i] == 0){
res[i+1] = 1;
b--;
}else{
res[i+1] = 0;
a--;
}
}
if(res[i] == 1){
while(b>0){
res[i+1] = 1;
i++;
b--;
}
while(a>0){
res[i+1] = 0;
i++;
a--;
}
}else{
while(a>0){
res[i+1] = 0;
i++;
a--;
}
while(b>0){
res[i+1] = 1;
i++;
b--;
}
}
}else{
for(i=0;i<x-1;i++){
if(res[i] == 0){
res[i+1] = 1;
b--;
}else{
res[i+1] = 0;
a--;
}
}
if(res[i] == 1){
while(b>0){
res[i+1] = 1;
i++;
b--;
}
while(a>0){
res[i+1] = 0;
i++;
a--;
}
}else{
while(a>0){
res[i+1] = 0;
i++;
a--;
}
while(b>0){
res[i+1] = 1;
i++;
b--;
}
}
}
for(int j=0;j<l;j++){
printf("%d",res[j]);
}
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_33092/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_33092/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %x)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = zext i32 %add to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %2, align 16
%4 = load i32, ptr %a, align 4, !tbaa !5
%5 = load i32, ptr %b, align 4, !tbaa !5
%add1 = add i32 %5, %4
%cmp = icmp sgt i32 %4, %5
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %a, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %entry
%dec3 = add nsw i32 %5, -1
store i32 %dec3, ptr %b, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%b.promoted194 = phi i32 [ %5, %if.then ], [ %dec3, %if.else ]
%a.promoted191 = phi i32 [ %dec, %if.then ], [ %4, %if.else ]
%.sink = phi i32 [ 0, %if.then ], [ 1, %if.else ]
store i32 %.sink, ptr %vla, align 16
%6 = load i32, ptr %x, align 4, !tbaa !5
%7 = and i32 %6, 1
%cmp4 = icmp eq i32 %7, 0
%sub = add i32 %6, -1
%cmp6197 = icmp sgt i32 %6, 1
br i1 %cmp4, label %for.cond.preheader, label %for.cond60.preheader
for.cond60.preheader: ; preds = %if.end
br i1 %cmp6197, label %for.body63.preheader, label %for.end80
for.body63.preheader: ; preds = %for.cond60.preheader
%wide.trip.count = zext i32 %sub to i64
br label %for.body63
for.cond.preheader: ; preds = %if.end
br i1 %cmp6197, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count235 = zext i32 %sub to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv230 = phi i64 [ 0, %for.body.preheader ], [ %9, %for.inc ]
%dec18193199 = phi i32 [ %a.promoted191, %for.body.preheader ], [ %dec18192, %for.inc ]
%dec13196198 = phi i32 [ %b.promoted194, %for.body.preheader ], [ %dec13195, %for.inc ]
%arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv230
%8 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8 = icmp eq i32 %8, 0
%9 = add nuw nsw i64 %indvars.iv230, 1
%arrayidx12 = getelementptr inbounds i32, ptr %vla, i64 %9
br i1 %cmp8, label %if.then9, label %if.else14
if.then9: ; preds = %for.body
store i32 1, ptr %arrayidx12, align 4, !tbaa !5
%dec13 = add nsw i32 %dec13196198, -1
store i32 %dec13, ptr %b, align 4, !tbaa !5
br label %for.inc
if.else14: ; preds = %for.body
store i32 0, ptr %arrayidx12, align 4, !tbaa !5
%dec18 = add nsw i32 %dec18193199, -1
store i32 %dec18, ptr %a, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then9, %if.else14
%dec13195 = phi i32 [ %dec13, %if.then9 ], [ %dec13196198, %if.else14 ]
%dec18192 = phi i32 [ %dec18193199, %if.then9 ], [ %dec18, %if.else14 ]
%exitcond236.not = icmp eq i64 %9, %wide.trip.count235
br i1 %exitcond236.not, label %for.end.loopexit, label %for.body, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc
%arrayidx21.phi.trans.insert = getelementptr inbounds i32, ptr %vla, i64 %wide.trip.count235
%.pre260 = load i32, ptr %arrayidx21.phi.trans.insert, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.cond.preheader, %for.end.loopexit
%.pr = phi i32 [ %dec13195, %for.end.loopexit ], [ %b.promoted194, %for.cond.preheader ]
%.pr163 = phi i32 [ %dec18192, %for.end.loopexit ], [ %a.promoted191, %for.cond.preheader ]
%10 = phi i32 [ %.pre260, %for.end.loopexit ], [ %.sink, %for.cond.preheader ]
%i.0.lcssa = phi i32 [ %sub, %for.end.loopexit ], [ 0, %for.cond.preheader ]
%idxprom20 = zext i32 %i.0.lcssa to i64
%cmp22 = icmp eq i32 %10, 1
br i1 %cmp22, label %while.condthread-pre-split, label %while.cond40thread-pre-split
while.condthread-pre-split: ; preds = %for.end
%cmp24207 = icmp sgt i32 %.pr, 0
br i1 %cmp24207, label %while.body.preheader, label %while.cond30thread-pre-split
while.body.preheader: ; preds = %while.condthread-pre-split
%11 = zext i32 %.pr to i64
%min.iters.check299 = icmp ult i32 %.pr, 8
br i1 %min.iters.check299, label %while.body.preheader313, label %vector.ph300
vector.ph300: ; preds = %while.body.preheader
%n.vec302 = and i64 %11, 4294967288
%ind.end303 = add nuw nsw i64 %n.vec302, %idxprom20
%.cast305 = trunc i64 %n.vec302 to i32
%ind.end306 = sub i32 %.pr, %.cast305
%invariant.gep328 = getelementptr i32, ptr %vla, i64 %idxprom20
br label %vector.body309
vector.body309: ; preds = %vector.body309, %vector.ph300
%index310 = phi i64 [ 0, %vector.ph300 ], [ %index.next312, %vector.body309 ]
%gep329 = getelementptr i32, ptr %invariant.gep328, i64 %index310
%12 = getelementptr i32, ptr %gep329, i64 1
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %12, align 4, !tbaa !5
%13 = getelementptr i32, ptr %gep329, i64 5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %13, align 4, !tbaa !5
%index.next312 = add nuw i64 %index310, 8
%14 = icmp eq i64 %index.next312, %n.vec302
br i1 %14, label %middle.block297, label %vector.body309, !llvm.loop !11
middle.block297: ; preds = %vector.body309
%cmp.n308 = icmp eq i64 %n.vec302, %11
br i1 %cmp.n308, label %while.cond.while.cond30thread-pre-split_crit_edge, label %while.body.preheader313
while.body.preheader313: ; preds = %while.body.preheader, %middle.block297
%indvars.iv244.ph = phi i64 [ %idxprom20, %while.body.preheader ], [ %ind.end303, %middle.block297 ]
%.ph = phi i32 [ %.pr, %while.body.preheader ], [ %ind.end306, %middle.block297 ]
br label %while.body
while.body: ; preds = %while.body.preheader313, %while.body
%indvars.iv244 = phi i64 [ %indvars.iv.next245, %while.body ], [ %indvars.iv244.ph, %while.body.preheader313 ]
%15 = phi i32 [ %dec29, %while.body ], [ %.ph, %while.body.preheader313 ]
%indvars.iv.next245 = add nuw nsw i64 %indvars.iv244, 1
%arrayidx27 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next245
store i32 1, ptr %arrayidx27, align 4, !tbaa !5
%dec29 = add nsw i32 %15, -1
%cmp24 = icmp ugt i32 %15, 1
br i1 %cmp24, label %while.body, label %while.cond.while.cond30thread-pre-split_crit_edge, !llvm.loop !14
while.cond.while.cond30thread-pre-split_crit_edge: ; preds = %while.body, %middle.block297
%indvars.iv.next245.lcssa = phi i64 [ %ind.end303, %middle.block297 ], [ %indvars.iv.next245, %while.body ]
%16 = trunc i64 %indvars.iv.next245.lcssa to i32
store i32 0, ptr %b, align 4, !tbaa !5
br label %while.cond30thread-pre-split
while.cond30thread-pre-split: ; preds = %while.cond.while.cond30thread-pre-split_crit_edge, %while.condthread-pre-split
%i.1.lcssa = phi i32 [ %16, %while.cond.while.cond30thread-pre-split_crit_edge ], [ %i.0.lcssa, %while.condthread-pre-split ]
%cmp31210 = icmp sgt i32 %.pr163, 0
br i1 %cmp31210, label %while.body32.preheader, label %if.end123
while.body32.preheader: ; preds = %while.cond30thread-pre-split
%17 = zext i32 %i.1.lcssa to i64
%18 = shl nuw nsw i64 %17, 2
%19 = getelementptr i8, ptr %vla, i64 %18
%scevgep247 = getelementptr i8, ptr %19, i64 4
%20 = zext i32 %.pr163 to i64
%21 = shl nuw nsw i64 %20, 2
call void @llvm.memset.p0.i64(ptr align 4 %scevgep247, i8 0, i64 %21, i1 false), !tbaa !5
store i32 0, ptr %a, align 4, !tbaa !5
br label %if.end123
while.cond40thread-pre-split: ; preds = %for.end
%cmp41202 = icmp sgt i32 %.pr163, 0
br i1 %cmp41202, label %while.body42.preheader, label %while.cond49thread-pre-split
while.body42.preheader: ; preds = %while.cond40thread-pre-split
%22 = shl nuw nsw i64 %idxprom20, 2
%23 = getelementptr i8, ptr %vla, i64 %22
%scevgep237 = getelementptr i8, ptr %23, i64 4
%24 = zext i32 %.pr163 to i64
%25 = shl nuw nsw i64 %24, 2
call void @llvm.memset.p0.i64(ptr align 4 %scevgep237, i8 0, i64 %25, i1 false), !tbaa !5
%26 = add i32 %i.0.lcssa, %.pr163
store i32 0, ptr %a, align 4, !tbaa !5
br label %while.cond49thread-pre-split
while.cond49thread-pre-split: ; preds = %while.body42.preheader, %while.cond40thread-pre-split
%i.3.lcssa = phi i32 [ %26, %while.body42.preheader ], [ %i.0.lcssa, %while.cond40thread-pre-split ]
%cmp50205 = icmp sgt i32 %.pr, 0
br i1 %cmp50205, label %while.body51.preheader, label %if.end123
while.body51.preheader: ; preds = %while.cond49thread-pre-split
%27 = zext i32 %i.3.lcssa to i64
%28 = zext i32 %.pr to i64
%min.iters.check283 = icmp ult i32 %.pr, 8
br i1 %min.iters.check283, label %while.body51.preheader315, label %vector.ph284
vector.ph284: ; preds = %while.body51.preheader
%n.vec286 = and i64 %28, 4294967288
%ind.end287 = add nuw nsw i64 %n.vec286, %27
%.cast289 = trunc i64 %n.vec286 to i32
%ind.end290 = sub i32 %.pr, %.cast289
%invariant.gep326 = getelementptr i32, ptr %vla, i64 %27
br label %vector.body293
vector.body293: ; preds = %vector.body293, %vector.ph284
%index294 = phi i64 [ 0, %vector.ph284 ], [ %index.next296, %vector.body293 ]
%gep327 = getelementptr i32, ptr %invariant.gep326, i64 %index294
%29 = getelementptr i32, ptr %gep327, i64 1
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %29, align 4, !tbaa !5
%30 = getelementptr i32, ptr %gep327, i64 5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %30, align 4, !tbaa !5
%index.next296 = add nuw i64 %index294, 8
%31 = icmp eq i64 %index.next296, %n.vec286
br i1 %31, label %middle.block281, label %vector.body293, !llvm.loop !15
middle.block281: ; preds = %vector.body293
%cmp.n292 = icmp eq i64 %n.vec286, %28
br i1 %cmp.n292, label %while.cond49.if.end123.loopexit170_crit_edge, label %while.body51.preheader315
while.body51.preheader315: ; preds = %while.body51.preheader, %middle.block281
%indvars.iv241.ph = phi i64 [ %27, %while.body51.preheader ], [ %ind.end287, %middle.block281 ]
%.ph316 = phi i32 [ %.pr, %while.body51.preheader ], [ %ind.end290, %middle.block281 ]
br label %while.body51
while.body51: ; preds = %while.body51.preheader315, %while.body51
%indvars.iv241 = phi i64 [ %indvars.iv.next242, %while.body51 ], [ %indvars.iv241.ph, %while.body51.preheader315 ]
%32 = phi i32 [ %dec56, %while.body51 ], [ %.ph316, %while.body51.preheader315 ]
%indvars.iv.next242 = add nuw nsw i64 %indvars.iv241, 1
%arrayidx54 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next242
store i32 1, ptr %arrayidx54, align 4, !tbaa !5
%dec56 = add nsw i32 %32, -1
%cmp50 = icmp ugt i32 %32, 1
br i1 %cmp50, label %while.body51, label %while.cond49.if.end123.loopexit170_crit_edge, !llvm.loop !16
for.body63: ; preds = %for.body63.preheader, %for.inc78
%indvars.iv = phi i64 [ 0, %for.body63.preheader ], [ %34, %for.inc78 ]
%dec76174179 = phi i32 [ %a.promoted191, %for.body63.preheader ], [ %dec76173, %for.inc78 ]
%dec71176178 = phi i32 [ %b.promoted194, %for.body63.preheader ], [ %dec71175, %for.inc78 ]
%arrayidx65 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%33 = load i32, ptr %arrayidx65, align 4, !tbaa !5
%cmp66 = icmp eq i32 %33, 0
%34 = add nuw nsw i64 %indvars.iv, 1
%arrayidx70 = getelementptr inbounds i32, ptr %vla, i64 %34
br i1 %cmp66, label %if.then67, label %if.else72
if.then67: ; preds = %for.body63
store i32 1, ptr %arrayidx70, align 4, !tbaa !5
%dec71 = add nsw i32 %dec71176178, -1
store i32 %dec71, ptr %b, align 4, !tbaa !5
br label %for.inc78
if.else72: ; preds = %for.body63
store i32 0, ptr %arrayidx70, align 4, !tbaa !5
%dec76 = add nsw i32 %dec76174179, -1
store i32 %dec76, ptr %a, align 4, !tbaa !5
br label %for.inc78
for.inc78: ; preds = %if.then67, %if.else72
%dec71175 = phi i32 [ %dec71, %if.then67 ], [ %dec71176178, %if.else72 ]
%dec76173 = phi i32 [ %dec76174179, %if.then67 ], [ %dec76, %if.else72 ]
%exitcond.not = icmp eq i64 %34, %wide.trip.count
br i1 %exitcond.not, label %for.end80.loopexit, label %for.body63, !llvm.loop !17
for.end80.loopexit: ; preds = %for.inc78
%arrayidx82.phi.trans.insert = getelementptr inbounds i32, ptr %vla, i64 %wide.trip.count
%.pre = load i32, ptr %arrayidx82.phi.trans.insert, align 4, !tbaa !5
br label %for.end80
for.end80: ; preds = %for.cond60.preheader, %for.end80.loopexit
%.pr166 = phi i32 [ %dec71175, %for.end80.loopexit ], [ %b.promoted194, %for.cond60.preheader ]
%.pr167 = phi i32 [ %dec76173, %for.end80.loopexit ], [ %a.promoted191, %for.cond60.preheader ]
%35 = phi i32 [ %.pre, %for.end80.loopexit ], [ %.sink, %for.cond60.preheader ]
%i.5.lcssa = phi i32 [ %sub, %for.end80.loopexit ], [ 0, %for.cond60.preheader ]
%idxprom81 = zext i32 %i.5.lcssa to i64
%cmp83 = icmp eq i32 %35, 1
br i1 %cmp83, label %while.cond85thread-pre-split, label %while.cond104thread-pre-split
while.cond85thread-pre-split: ; preds = %for.end80
%cmp86186 = icmp sgt i32 %.pr166, 0
br i1 %cmp86186, label %while.body87.preheader, label %while.cond94thread-pre-split
while.body87.preheader: ; preds = %while.cond85thread-pre-split
%36 = zext i32 %.pr166 to i64
%min.iters.check267 = icmp ult i32 %.pr166, 8
br i1 %min.iters.check267, label %while.body87.preheader317, label %vector.ph268
vector.ph268: ; preds = %while.body87.preheader
%n.vec270 = and i64 %36, 4294967288
%ind.end271 = add nuw nsw i64 %n.vec270, %idxprom81
%.cast273 = trunc i64 %n.vec270 to i32
%ind.end274 = sub i32 %.pr166, %.cast273
%invariant.gep324 = getelementptr i32, ptr %vla, i64 %idxprom81
br label %vector.body277
vector.body277: ; preds = %vector.body277, %vector.ph268
%index278 = phi i64 [ 0, %vector.ph268 ], [ %index.next280, %vector.body277 ]
%gep325 = getelementptr i32, ptr %invariant.gep324, i64 %index278
%37 = getelementptr i32, ptr %gep325, i64 1
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %37, align 4, !tbaa !5
%38 = getelementptr i32, ptr %gep325, i64 5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %38, align 4, !tbaa !5
%index.next280 = add nuw i64 %index278, 8
%39 = icmp eq i64 %index.next280, %n.vec270
br i1 %39, label %middle.block265, label %vector.body277, !llvm.loop !18
middle.block265: ; preds = %vector.body277
%cmp.n276 = icmp eq i64 %n.vec270, %36
br i1 %cmp.n276, label %while.cond85.while.cond94thread-pre-split_crit_edge, label %while.body87.preheader317
while.body87.preheader317: ; preds = %while.body87.preheader, %middle.block265
%indvars.iv223.ph = phi i64 [ %idxprom81, %while.body87.preheader ], [ %ind.end271, %middle.block265 ]
%.ph318 = phi i32 [ %.pr166, %while.body87.preheader ], [ %ind.end274, %middle.block265 ]
br label %while.body87
while.body87: ; preds = %while.body87.preheader317, %while.body87
%indvars.iv223 = phi i64 [ %indvars.iv.next224, %while.body87 ], [ %indvars.iv223.ph, %while.body87.preheader317 ]
%40 = phi i32 [ %dec92, %while.body87 ], [ %.ph318, %while.body87.preheader317 ]
%indvars.iv.next224 = add nuw nsw i64 %indvars.iv223, 1
%arrayidx90 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next224
store i32 1, ptr %arrayidx90, align 4, !tbaa !5
%dec92 = add nsw i32 %40, -1
%cmp86 = icmp ugt i32 %40, 1
br i1 %cmp86, label %while.body87, label %while.cond85.while.cond94thread-pre-split_crit_edge, !llvm.loop !19
while.cond85.while.cond94thread-pre-split_crit_edge: ; preds = %while.body87, %middle.block265
%indvars.iv.next224.lcssa = phi i64 [ %ind.end271, %middle.block265 ], [ %indvars.iv.next224, %while.body87 ]
%41 = trunc i64 %indvars.iv.next224.lcssa to i32
store i32 0, ptr %b, align 4, !tbaa !5
br label %while.cond94thread-pre-split
while.cond94thread-pre-split: ; preds = %while.cond85.while.cond94thread-pre-split_crit_edge, %while.cond85thread-pre-split
%i.6.lcssa = phi i32 [ %41, %while.cond85.while.cond94thread-pre-split_crit_edge ], [ %i.5.lcssa, %while.cond85thread-pre-split ]
%cmp95189 = icmp sgt i32 %.pr167, 0
br i1 %cmp95189, label %while.body96.preheader, label %if.end123
while.body96.preheader: ; preds = %while.cond94thread-pre-split
%42 = zext i32 %i.6.lcssa to i64
%43 = shl nuw nsw i64 %42, 2
%44 = getelementptr i8, ptr %vla, i64 %43
%scevgep226 = getelementptr i8, ptr %44, i64 4
%45 = zext i32 %.pr167 to i64
%46 = shl nuw nsw i64 %45, 2
call void @llvm.memset.p0.i64(ptr align 4 %scevgep226, i8 0, i64 %46, i1 false), !tbaa !5
store i32 0, ptr %a, align 4, !tbaa !5
br label %if.end123
while.cond104thread-pre-split: ; preds = %for.end80
%cmp105181 = icmp sgt i32 %.pr167, 0
br i1 %cmp105181, label %while.body106.preheader, label %while.cond113thread-pre-split
while.body106.preheader: ; preds = %while.cond104thread-pre-split
%47 = shl nuw nsw i64 %idxprom81, 2
%48 = getelementptr i8, ptr %vla, i64 %47
%scevgep = getelementptr i8, ptr %48, i64 4
%49 = zext i32 %.pr167 to i64
%50 = shl nuw nsw i64 %49, 2
call void @llvm.memset.p0.i64(ptr align 4 %scevgep, i8 0, i64 %50, i1 false), !tbaa !5
%51 = add i32 %i.5.lcssa, %.pr167
store i32 0, ptr %a, align 4, !tbaa !5
br label %while.cond113thread-pre-split
while.cond113thread-pre-split: ; preds = %while.body106.preheader, %while.cond104thread-pre-split
%i.8.lcssa = phi i32 [ %51, %while.body106.preheader ], [ %i.5.lcssa, %while.cond104thread-pre-split ]
%cmp114184 = icmp sgt i32 %.pr166, 0
br i1 %cmp114184, label %while.body115.preheader, label %if.end123
while.body115.preheader: ; preds = %while.cond113thread-pre-split
%52 = zext i32 %i.8.lcssa to i64
%53 = zext i32 %.pr166 to i64
%min.iters.check = icmp ult i32 %.pr166, 8
br i1 %min.iters.check, label %while.body115.preheader320, label %vector.ph
vector.ph: ; preds = %while.body115.preheader
%n.vec = and i64 %53, 4294967288
%ind.end = add nuw nsw i64 %n.vec, %52
%.cast = trunc i64 %n.vec to i32
%ind.end263 = sub i32 %.pr166, %.cast
%invariant.gep = getelementptr i32, ptr %vla, i64 %52
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %index
%54 = getelementptr i32, ptr %gep, i64 1
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %54, align 4, !tbaa !5
%55 = getelementptr i32, ptr %gep, i64 5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %55, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%56 = icmp eq i64 %index.next, %n.vec
br i1 %56, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %53
br i1 %cmp.n, label %while.cond113.if.end123.loopexit172_crit_edge, label %while.body115.preheader320
while.body115.preheader320: ; preds = %while.body115.preheader, %middle.block
%indvars.iv220.ph = phi i64 [ %52, %while.body115.preheader ], [ %ind.end, %middle.block ]
%.ph321 = phi i32 [ %.pr166, %while.body115.preheader ], [ %ind.end263, %middle.block ]
br label %while.body115
while.body115: ; preds = %while.body115.preheader320, %while.body115
%indvars.iv220 = phi i64 [ %indvars.iv.next221, %while.body115 ], [ %indvars.iv220.ph, %while.body115.preheader320 ]
%57 = phi i32 [ %dec120, %while.body115 ], [ %.ph321, %while.body115.preheader320 ]
%indvars.iv.next221 = add nuw nsw i64 %indvars.iv220, 1
%arrayidx118 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next221
store i32 1, ptr %arrayidx118, align 4, !tbaa !5
%dec120 = add nsw i32 %57, -1
%cmp114 = icmp ugt i32 %57, 1
br i1 %cmp114, label %while.body115, label %while.cond113.if.end123.loopexit172_crit_edge, !llvm.loop !21
while.cond49.if.end123.loopexit170_crit_edge: ; preds = %while.body51, %middle.block281
store i32 0, ptr %b, align 4, !tbaa !5
br label %if.end123
while.cond113.if.end123.loopexit172_crit_edge: ; preds = %while.body115, %middle.block
store i32 0, ptr %b, align 4, !tbaa !5
br label %if.end123
if.end123: ; preds = %while.cond113thread-pre-split, %while.cond113.if.end123.loopexit172_crit_edge, %while.cond94thread-pre-split, %while.body96.preheader, %while.cond49thread-pre-split, %while.cond49.if.end123.loopexit170_crit_edge, %while.cond30thread-pre-split, %while.body32.preheader
%cmp125212 = icmp sgt i32 %add1, 0
br i1 %cmp125212, label %for.body126.preheader, label %for.cond.cleanup
for.body126.preheader: ; preds = %if.end123
%wide.trip.count254 = zext i32 %add1 to i64
br label %for.body126
for.cond.cleanup: ; preds = %for.body126, %if.end123
%putchar = call i32 @putchar(i32 10)
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6
ret i32 0
for.body126: ; preds = %for.body126.preheader, %for.body126
%indvars.iv251 = phi i64 [ 0, %for.body126.preheader ], [ %indvars.iv.next252, %for.body126 ]
%arrayidx128 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv251
%58 = load i32, ptr %arrayidx128, align 4, !tbaa !5
%call129 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %58)
%indvars.iv.next252 = add nuw nsw i64 %indvars.iv251, 1
%exitcond255.not = icmp eq i64 %indvars.iv.next252, %wide.trip.count254
br i1 %exitcond255.not, label %for.cond.cleanup, label %for.body126, !llvm.loop !22
}
; 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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10, !12, !13}
!16 = distinct !{!16, !10, !13, !12}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !12, !13}
!19 = distinct !{!19, !10, !13, !12}
!20 = distinct !{!20, !10, !12, !13}
!21 = distinct !{!21, !10, !13, !12}
!22 = distinct !{!22, !10}
|
#include<stdio.h>
int main()
{
int a,b;
scanf("%d%d",&a,&b);
printf("%d",a+b/2);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_330970/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_330970/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%div = sdiv i32 %1, 2
%add = add nsw i32 %div, %0
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main (){
int a,b,c;
scanf ("%d%d",&a,&b);
c=a+(b/2);
printf ("%d",c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_331012/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_331012/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%div = sdiv i32 %1, 2
%add = add nsw i32 %div, %0
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int x, y;
scanf("%d %d", &x, &y);
printf("%d\n", x + y / 2);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_331056/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_331056/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%div = sdiv i32 %1, 2
%add = add nsw i32 %div, %0
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int min(int x,int y)
{
if(x>y)
return y;
return x;
}
int reach[101][101];
int graph[101][101];
long long int transitiveClosure(int x)
{
long long sum =0;
int i, j, k;
for (i = 1; i <= x; i++)
for (j = 1; j <=x; j++)
reach[i][j] = graph[i][j];
for (k = 1; k <= x; k++) {
for (i = 1; i <= x; i++) {
for (j = 1; j <= x; j++){
int mi = min(reach[i][k],reach[k][j]);
reach[i][j] = reach[i][j] += mi;
reach[i][k] -= mi;
reach[k][j] -= mi;
}
}
}
for(i=1;i<=x;i++)
for(j=1;j<=x;j++)
sum += reach[i][j];
return sum;
}
int main()
{
int as,af,i,j,a,b,c;
scanf("%d %d",&as,&af);
for( j=1;j<=af;j++)
{
scanf("%d %d %d",&a,&b,&c);
graph[a][b] = c;
}
printf("%I64d\n",transitiveClosure(as));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_3311/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_3311/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@graph = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
@reach = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%I64d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%y.x = tail call i32 @llvm.smin.i32(i32 %x, i32 %y)
ret i32 %y.x
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @transitiveClosure(i32 noundef %x) local_unnamed_addr #1 {
entry:
%cmp.not113 = icmp slt i32 %x, 1
br i1 %cmp.not113, label %for.end72, label %for.cond1.preheader.preheader
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %x to i64
%1 = shl nuw nsw i64 %0, 2
%xtraiter = and i64 %0, 1
%2 = icmp eq i32 %x, 1
br i1 %2, label %for.cond13.preheader.unr-lcssa, label %for.cond1.preheader.preheader.new
for.cond1.preheader.preheader.new: ; preds = %for.cond1.preheader.preheader
%unroll_iter = and i64 %0, 4294967294
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader, %for.cond1.preheader.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.preheader.new ], [ %indvar.next.1, %for.cond1.preheader ]
%niter = phi i64 [ 0, %for.cond1.preheader.preheader.new ], [ %niter.next.1, %for.cond1.preheader ]
%3 = mul nuw nsw i64 %indvar, 404
%4 = add nuw nsw i64 %3, 408
%scevgep = getelementptr i8, ptr @reach, i64 %4
%scevgep128 = getelementptr i8, ptr @graph, i64 %4
tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %scevgep, ptr align 8 %scevgep128, i64 %1, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 404
%6 = add nuw i64 %5, 812
%scevgep.1 = getelementptr i8, ptr @reach, i64 %6
%scevgep128.1 = getelementptr i8, ptr @graph, i64 %6
tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %scevgep.1, ptr align 4 %scevgep128.1, i64 %1, i1 false), !tbaa !5
%indvar.next.1 = add nuw nsw i64 %indvar, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond13.preheader.unr-lcssa.loopexit, label %for.cond1.preheader, !llvm.loop !9
for.cond13.preheader.unr-lcssa.loopexit: ; preds = %for.cond1.preheader
%7 = mul nuw nsw i64 %indvar.next.1, 404
%8 = add nuw nsw i64 %7, 408
br label %for.cond13.preheader.unr-lcssa
for.cond13.preheader.unr-lcssa: ; preds = %for.cond13.preheader.unr-lcssa.loopexit, %for.cond1.preheader.preheader
%indvar.unr = phi i64 [ 408, %for.cond1.preheader.preheader ], [ %8, %for.cond13.preheader.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond13.preheader, label %for.cond1.preheader.epil
for.cond1.preheader.epil: ; preds = %for.cond13.preheader.unr-lcssa
%scevgep.epil = getelementptr i8, ptr @reach, i64 %indvar.unr
%scevgep128.epil = getelementptr i8, ptr @graph, i64 %indvar.unr
tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %scevgep.epil, ptr align 4 %scevgep128.epil, i64 %1, i1 false), !tbaa !5
br label %for.cond13.preheader
for.cond13.preheader: ; preds = %for.cond13.preheader.unr-lcssa, %for.cond1.preheader.epil
br i1 %cmp.not113, label %for.end72, label %for.cond16.preheader.preheader
for.cond16.preheader.preheader: ; preds = %for.cond13.preheader
%9 = add nuw i32 %x, 1
%wide.trip.count141 = zext i32 %9 to i64
br label %for.cond16.preheader
for.cond16.preheader: ; preds = %for.cond16.preheader.preheader, %for.cond16.for.inc53_crit_edge.split
%indvars.iv138 = phi i64 [ 1, %for.cond16.preheader.preheader ], [ %indvars.iv.next139, %for.cond16.for.inc53_crit_edge.split ]
br label %for.cond19.preheader
for.cond56.preheader: ; preds = %for.cond16.for.inc53_crit_edge.split
br i1 %cmp.not113, label %for.end72, label %for.cond59.preheader.preheader
for.cond59.preheader.preheader: ; preds = %for.cond56.preheader
%10 = add nuw i32 %x, 1
%wide.trip.count151 = zext i32 %10 to i64
%11 = add nsw i64 %wide.trip.count141, -1
%min.iters.check = icmp ult i32 %x, 4
%n.vec = and i64 %11, -4
%ind.end = or i64 %n.vec, 1
%cmp.n = icmp eq i64 %11, %n.vec
br label %for.cond59.preheader
for.cond19.preheader: ; preds = %for.cond16.preheader, %for.cond19.for.inc50_crit_edge
%indvars.iv133 = phi i64 [ 1, %for.cond16.preheader ], [ %indvars.iv.next134, %for.cond19.for.inc50_crit_edge ]
%arrayidx25 = getelementptr inbounds [101 x [101 x i32]], ptr @reach, i64 0, i64 %indvars.iv133, i64 %indvars.iv138
br label %for.body21
for.body21: ; preds = %for.cond19.preheader, %for.body21
%indvars.iv = phi i64 [ 1, %for.cond19.preheader ], [ %indvars.iv.next, %for.body21 ]
%12 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%arrayidx29 = getelementptr inbounds [101 x [101 x i32]], ptr @reach, i64 0, i64 %indvars.iv138, i64 %indvars.iv
%13 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%y.x.i = tail call i32 @llvm.smin.i32(i32 %12, i32 %13)
%arrayidx33 = getelementptr inbounds [101 x [101 x i32]], ptr @reach, i64 0, i64 %indvars.iv133, i64 %indvars.iv
%14 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%add = add nsw i32 %14, %y.x.i
store i32 %add, ptr %arrayidx33, align 4, !tbaa !5
%15 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%sub = sub nsw i32 %15, %y.x.i
store i32 %sub, ptr %arrayidx25, align 4, !tbaa !5
%16 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%sub46 = sub nsw i32 %16, %y.x.i
store i32 %sub46, ptr %arrayidx29, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond132.not = icmp eq i64 %indvars.iv.next, %wide.trip.count141
br i1 %exitcond132.not, label %for.cond19.for.inc50_crit_edge, label %for.body21, !llvm.loop !11
for.cond19.for.inc50_crit_edge: ; preds = %for.body21
%indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
%exitcond137.not = icmp eq i64 %indvars.iv.next134, %wide.trip.count141
br i1 %exitcond137.not, label %for.cond16.for.inc53_crit_edge.split, label %for.cond19.preheader, !llvm.loop !12
for.cond16.for.inc53_crit_edge.split: ; preds = %for.cond19.for.inc50_crit_edge
%indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
%exitcond142.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count141
br i1 %exitcond142.not, label %for.cond56.preheader, label %for.cond16.preheader, !llvm.loop !13
for.cond59.preheader: ; preds = %for.cond59.preheader.preheader, %for.cond59.for.inc70_crit_edge
%indvars.iv148 = phi i64 [ 1, %for.cond59.preheader.preheader ], [ %indvars.iv.next149, %for.cond59.for.inc70_crit_edge ]
%sum.0126 = phi i64 [ 0, %for.cond59.preheader.preheader ], [ %add66.lcssa, %for.cond59.for.inc70_crit_edge ]
br i1 %min.iters.check, label %for.body61.preheader, label %vector.ph
vector.ph: ; preds = %for.cond59.preheader
%17 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %sum.0126, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ %17, %vector.ph ], [ %22, %vector.body ]
%vec.phi153 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %23, %vector.body ]
%offset.idx = or i64 %index, 1
%18 = getelementptr inbounds [101 x [101 x i32]], ptr @reach, i64 0, i64 %indvars.iv148, i64 %offset.idx
%wide.load = load <2 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds i32, ptr %18, i64 2
%wide.load154 = load <2 x i32>, ptr %19, align 4, !tbaa !5
%20 = sext <2 x i32> %wide.load to <2 x i64>
%21 = sext <2 x i32> %wide.load154 to <2 x i64>
%22 = add <2 x i64> %vec.phi, %20
%23 = add <2 x i64> %vec.phi153, %21
%index.next = add nuw i64 %index, 4
%24 = icmp eq i64 %index.next, %n.vec
br i1 %24, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %23, %22
%25 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
br i1 %cmp.n, label %for.cond59.for.inc70_crit_edge, label %for.body61.preheader
for.body61.preheader: ; preds = %for.cond59.preheader, %middle.block
%indvars.iv143.ph = phi i64 [ 1, %for.cond59.preheader ], [ %ind.end, %middle.block ]
%sum.1123.ph = phi i64 [ %sum.0126, %for.cond59.preheader ], [ %25, %middle.block ]
br label %for.body61
for.body61: ; preds = %for.body61.preheader, %for.body61
%indvars.iv143 = phi i64 [ %indvars.iv.next144, %for.body61 ], [ %indvars.iv143.ph, %for.body61.preheader ]
%sum.1123 = phi i64 [ %add66, %for.body61 ], [ %sum.1123.ph, %for.body61.preheader ]
%arrayidx65 = getelementptr inbounds [101 x [101 x i32]], ptr @reach, i64 0, i64 %indvars.iv148, i64 %indvars.iv143
%26 = load i32, ptr %arrayidx65, align 4, !tbaa !5
%conv = sext i32 %26 to i64
%add66 = add nsw i64 %sum.1123, %conv
%indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
%exitcond147.not = icmp eq i64 %indvars.iv.next144, %wide.trip.count151
br i1 %exitcond147.not, label %for.cond59.for.inc70_crit_edge, label %for.body61, !llvm.loop !17
for.cond59.for.inc70_crit_edge: ; preds = %for.body61, %middle.block
%add66.lcssa = phi i64 [ %25, %middle.block ], [ %add66, %for.body61 ]
%indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
%exitcond152.not = icmp eq i64 %indvars.iv.next149, %wide.trip.count151
br i1 %exitcond152.not, label %for.end72, label %for.cond59.preheader, !llvm.loop !18
for.end72: ; preds = %for.cond59.for.inc70_crit_edge, %entry, %for.cond13.preheader, %for.cond56.preheader
%sum.0.lcssa = phi i64 [ 0, %for.cond56.preheader ], [ 0, %for.cond13.preheader ], [ 0, %entry ], [ %add66.lcssa, %for.cond59.for.inc70_crit_edge ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%as = alloca i32, align 4
%af = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %as) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %af) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %as, ptr noundef nonnull %af)
%0 = load i32, ptr %af, align 4, !tbaa !5
%cmp.not7 = icmp slt i32 %0, 1
br i1 %cmp.not7, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%j.08 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%1 = load i32, ptr %c, align 4, !tbaa !5
%2 = load i32, ptr %a, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%3 = load i32, ptr %b, align 4, !tbaa !5
%idxprom2 = sext i32 %3 to i64
%arrayidx3 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %idxprom, i64 %idxprom2
store i32 %1, ptr %arrayidx3, align 4, !tbaa !5
%inc = add nuw nsw i32 %j.08, 1
%4 = load i32, ptr %af, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %j.08, %4
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.body, %entry
%5 = load i32, ptr %as, align 4, !tbaa !5
%cmp.not113.i = icmp slt i32 %5, 1
br i1 %cmp.not113.i, label %transitiveClosure.exit, label %for.cond1.preheader.preheader.i
for.cond1.preheader.preheader.i: ; preds = %for.end
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%xtraiter = and i64 %6, 1
%8 = icmp eq i32 %5, 1
br i1 %8, label %for.cond16.preheader.preheader.i.unr-lcssa, label %for.cond1.preheader.preheader.i.new
for.cond1.preheader.preheader.i.new: ; preds = %for.cond1.preheader.preheader.i
%unroll_iter = and i64 %6, 4294967294
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.cond1.preheader.i, %for.cond1.preheader.preheader.i.new
%indvar.i = phi i64 [ 0, %for.cond1.preheader.preheader.i.new ], [ %indvar.next.i.1, %for.cond1.preheader.i ]
%niter = phi i64 [ 0, %for.cond1.preheader.preheader.i.new ], [ %niter.next.1, %for.cond1.preheader.i ]
%9 = mul nuw nsw i64 %indvar.i, 404
%10 = add nuw nsw i64 %9, 408
%scevgep.i = getelementptr i8, ptr @reach, i64 %10
%scevgep128.i = getelementptr i8, ptr @graph, i64 %10
call void @llvm.memcpy.p0.p0.i64(ptr align 8 %scevgep.i, ptr align 8 %scevgep128.i, i64 %7, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar.i, 404
%12 = add nuw i64 %11, 812
%scevgep.i.1 = getelementptr i8, ptr @reach, i64 %12
%scevgep128.i.1 = getelementptr i8, ptr @graph, i64 %12
call void @llvm.memcpy.p0.p0.i64(ptr align 4 %scevgep.i.1, ptr align 4 %scevgep128.i.1, i64 %7, i1 false), !tbaa !5
%indvar.next.i.1 = add nuw nsw i64 %indvar.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond16.preheader.preheader.i.unr-lcssa.loopexit, label %for.cond1.preheader.i, !llvm.loop !9
for.cond16.preheader.preheader.i.unr-lcssa.loopexit: ; preds = %for.cond1.preheader.i
%13 = mul nuw nsw i64 %indvar.next.i.1, 404
%14 = add nuw nsw i64 %13, 408
br label %for.cond16.preheader.preheader.i.unr-lcssa
for.cond16.preheader.preheader.i.unr-lcssa: ; preds = %for.cond16.preheader.preheader.i.unr-lcssa.loopexit, %for.cond1.preheader.preheader.i
%indvar.i.unr = phi i64 [ 408, %for.cond1.preheader.preheader.i ], [ %14, %for.cond16.preheader.preheader.i.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond16.preheader.preheader.i, label %for.cond1.preheader.i.epil
for.cond1.preheader.i.epil: ; preds = %for.cond16.preheader.preheader.i.unr-lcssa
%scevgep.i.epil = getelementptr i8, ptr @reach, i64 %indvar.i.unr
%scevgep128.i.epil = getelementptr i8, ptr @graph, i64 %indvar.i.unr
call void @llvm.memcpy.p0.p0.i64(ptr align 4 %scevgep.i.epil, ptr align 4 %scevgep128.i.epil, i64 %7, i1 false), !tbaa !5
br label %for.cond16.preheader.preheader.i
for.cond16.preheader.preheader.i: ; preds = %for.cond16.preheader.preheader.i.unr-lcssa, %for.cond1.preheader.i.epil
%15 = add nuw i32 %5, 1
%wide.trip.count141.i = zext i32 %15 to i64
br label %for.cond16.preheader.i
for.cond16.preheader.i: ; preds = %for.cond16.for.inc53_crit_edge.split.i, %for.cond16.preheader.preheader.i
%indvars.iv138.i = phi i64 [ 1, %for.cond16.preheader.preheader.i ], [ %indvars.iv.next139.i, %for.cond16.for.inc53_crit_edge.split.i ]
br label %for.cond19.preheader.i
for.cond19.preheader.i: ; preds = %for.cond19.for.inc50_crit_edge.i, %for.cond16.preheader.i
%indvars.iv133.i = phi i64 [ 1, %for.cond16.preheader.i ], [ %indvars.iv.next134.i, %for.cond19.for.inc50_crit_edge.i ]
%arrayidx25.i = getelementptr inbounds [101 x [101 x i32]], ptr @reach, i64 0, i64 %indvars.iv133.i, i64 %indvars.iv138.i
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.cond19.preheader.i
%indvars.iv.i = phi i64 [ 1, %for.cond19.preheader.i ], [ %indvars.iv.next.i, %for.body21.i ]
%16 = load i32, ptr %arrayidx25.i, align 4, !tbaa !5
%arrayidx29.i = getelementptr inbounds [101 x [101 x i32]], ptr @reach, i64 0, i64 %indvars.iv138.i, i64 %indvars.iv.i
%17 = load i32, ptr %arrayidx29.i, align 4, !tbaa !5
%y.x.i.i = call i32 @llvm.smin.i32(i32 %16, i32 %17)
%arrayidx33.i = getelementptr inbounds [101 x [101 x i32]], ptr @reach, i64 0, i64 %indvars.iv133.i, i64 %indvars.iv.i
%18 = load i32, ptr %arrayidx33.i, align 4, !tbaa !5
%add.i = add nsw i32 %18, %y.x.i.i
store i32 %add.i, ptr %arrayidx33.i, align 4, !tbaa !5
%19 = load i32, ptr %arrayidx25.i, align 4, !tbaa !5
%sub.i = sub nsw i32 %19, %y.x.i.i
store i32 %sub.i, ptr %arrayidx25.i, align 4, !tbaa !5
%20 = load i32, ptr %arrayidx29.i, align 4, !tbaa !5
%sub46.i = sub nsw i32 %20, %y.x.i.i
store i32 %sub46.i, ptr %arrayidx29.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond132.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count141.i
br i1 %exitcond132.not.i, label %for.cond19.for.inc50_crit_edge.i, label %for.body21.i, !llvm.loop !11
for.cond19.for.inc50_crit_edge.i: ; preds = %for.body21.i
%indvars.iv.next134.i = add nuw nsw i64 %indvars.iv133.i, 1
%exitcond137.not.i = icmp eq i64 %indvars.iv.next134.i, %wide.trip.count141.i
br i1 %exitcond137.not.i, label %for.cond16.for.inc53_crit_edge.split.i, label %for.cond19.preheader.i, !llvm.loop !12
for.cond16.for.inc53_crit_edge.split.i: ; preds = %for.cond19.for.inc50_crit_edge.i
%indvars.iv.next139.i = add nuw nsw i64 %indvars.iv138.i, 1
%exitcond142.not.i = icmp eq i64 %indvars.iv.next139.i, %wide.trip.count141.i
br i1 %exitcond142.not.i, label %for.cond59.preheader.i.preheader, label %for.cond16.preheader.i, !llvm.loop !13
for.cond59.preheader.i.preheader: ; preds = %for.cond16.for.inc53_crit_edge.split.i
%21 = add nsw i64 %wide.trip.count141.i, -1
%min.iters.check = icmp ult i32 %5, 4
%n.vec = and i64 %21, -4
%ind.end = or i64 %n.vec, 1
%cmp.n = icmp eq i64 %21, %n.vec
br label %for.cond59.preheader.i
for.cond59.preheader.i: ; preds = %for.cond59.preheader.i.preheader, %for.cond59.for.inc70_crit_edge.i
%indvars.iv148.i = phi i64 [ %indvars.iv.next149.i, %for.cond59.for.inc70_crit_edge.i ], [ 1, %for.cond59.preheader.i.preheader ]
%sum.0126.i = phi i64 [ %add66.i.lcssa, %for.cond59.for.inc70_crit_edge.i ], [ 0, %for.cond59.preheader.i.preheader ]
br i1 %min.iters.check, label %for.body61.i.preheader, label %vector.ph
vector.ph: ; preds = %for.cond59.preheader.i
%22 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %sum.0126.i, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ %22, %vector.ph ], [ %27, %vector.body ]
%vec.phi9 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %28, %vector.body ]
%offset.idx = or i64 %index, 1
%23 = getelementptr inbounds [101 x [101 x i32]], ptr @reach, i64 0, i64 %indvars.iv148.i, i64 %offset.idx
%wide.load = load <2 x i32>, ptr %23, align 4, !tbaa !5
%24 = getelementptr inbounds i32, ptr %23, i64 2
%wide.load10 = load <2 x i32>, ptr %24, align 4, !tbaa !5
%25 = sext <2 x i32> %wide.load to <2 x i64>
%26 = sext <2 x i32> %wide.load10 to <2 x i64>
%27 = add <2 x i64> %vec.phi, %25
%28 = add <2 x i64> %vec.phi9, %26
%index.next = add nuw i64 %index, 4
%29 = icmp eq i64 %index.next, %n.vec
br i1 %29, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %28, %27
%30 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
br i1 %cmp.n, label %for.cond59.for.inc70_crit_edge.i, label %for.body61.i.preheader
for.body61.i.preheader: ; preds = %for.cond59.preheader.i, %middle.block
%indvars.iv143.i.ph = phi i64 [ 1, %for.cond59.preheader.i ], [ %ind.end, %middle.block ]
%sum.1123.i.ph = phi i64 [ %sum.0126.i, %for.cond59.preheader.i ], [ %30, %middle.block ]
br label %for.body61.i
for.body61.i: ; preds = %for.body61.i.preheader, %for.body61.i
%indvars.iv143.i = phi i64 [ %indvars.iv.next144.i, %for.body61.i ], [ %indvars.iv143.i.ph, %for.body61.i.preheader ]
%sum.1123.i = phi i64 [ %add66.i, %for.body61.i ], [ %sum.1123.i.ph, %for.body61.i.preheader ]
%arrayidx65.i = getelementptr inbounds [101 x [101 x i32]], ptr @reach, i64 0, i64 %indvars.iv148.i, i64 %indvars.iv143.i
%31 = load i32, ptr %arrayidx65.i, align 4, !tbaa !5
%conv.i = sext i32 %31 to i64
%add66.i = add nsw i64 %sum.1123.i, %conv.i
%indvars.iv.next144.i = add nuw nsw i64 %indvars.iv143.i, 1
%exitcond147.not.i = icmp eq i64 %indvars.iv.next144.i, %wide.trip.count141.i
br i1 %exitcond147.not.i, label %for.cond59.for.inc70_crit_edge.i, label %for.body61.i, !llvm.loop !21
for.cond59.for.inc70_crit_edge.i: ; preds = %for.body61.i, %middle.block
%add66.i.lcssa = phi i64 [ %30, %middle.block ], [ %add66.i, %for.body61.i ]
%indvars.iv.next149.i = add nuw nsw i64 %indvars.iv148.i, 1
%exitcond152.not.i = icmp eq i64 %indvars.iv.next149.i, %wide.trip.count141.i
br i1 %exitcond152.not.i, label %transitiveClosure.exit, label %for.cond59.preheader.i, !llvm.loop !18
transitiveClosure.exit: ; preds = %for.cond59.for.inc70_crit_edge.i, %for.end
%sum.0.lcssa.i = phi i64 [ 0, %for.end ], [ %add66.i.lcssa, %for.cond59.for.inc70_crit_edge.i ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sum.0.lcssa.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %af) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %as) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
; 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) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10, !16, !15}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !15, !16}
!21 = distinct !{!21, !10, !16, !15}
|
#include<stdio.h>
int main()
{
int N;
scanf("%d", &N);
int freq[100]={0};
for(int t=0; t<N; ++t)
{
int temp;
scanf("%d", &temp);
++freq[temp-1];
}
int maxFreq=0;
for(int y=0; y<100; ++y)
if(freq[y]>maxFreq)
maxFreq = freq[y];
printf("%d\n", maxFreq);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_33115/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_33115/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%freq = alloca [100 x i32], align 16
%temp = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %freq) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %freq, i8 0, i64 400, i1 false)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %vector.body
vector.body: ; preds = %entry, %for.body
%wide.load = load <4 x i32>, ptr %freq, align 16, !tbaa !5
%1 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 4
%wide.load.1 = load <4 x i32>, ptr %1, align 16, !tbaa !5
%2 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %wide.load.1)
%3 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 8
%wide.load.2 = load <4 x i32>, ptr %3, align 16, !tbaa !5
%4 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %2, <4 x i32> %wide.load.2)
%5 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 12
%wide.load.3 = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %4, <4 x i32> %wide.load.3)
%7 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 16
%wide.load.4 = load <4 x i32>, ptr %7, align 16, !tbaa !5
%8 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %6, <4 x i32> %wide.load.4)
%9 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 20
%wide.load.5 = load <4 x i32>, ptr %9, align 16, !tbaa !5
%10 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %8, <4 x i32> %wide.load.5)
%11 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 24
%wide.load.6 = load <4 x i32>, ptr %11, align 16, !tbaa !5
%12 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %10, <4 x i32> %wide.load.6)
%13 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 28
%wide.load.7 = load <4 x i32>, ptr %13, align 16, !tbaa !5
%14 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %12, <4 x i32> %wide.load.7)
%15 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 32
%wide.load.8 = load <4 x i32>, ptr %15, align 16, !tbaa !5
%16 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %14, <4 x i32> %wide.load.8)
%17 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 36
%wide.load.9 = load <4 x i32>, ptr %17, align 16, !tbaa !5
%18 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %16, <4 x i32> %wide.load.9)
%19 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 40
%wide.load.10 = load <4 x i32>, ptr %19, align 16, !tbaa !5
%20 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %18, <4 x i32> %wide.load.10)
%21 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 44
%wide.load.11 = load <4 x i32>, ptr %21, align 16, !tbaa !5
%22 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %20, <4 x i32> %wide.load.11)
%23 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 48
%wide.load.12 = load <4 x i32>, ptr %23, align 16, !tbaa !5
%24 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %22, <4 x i32> %wide.load.12)
%25 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 52
%wide.load.13 = load <4 x i32>, ptr %25, align 16, !tbaa !5
%26 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %24, <4 x i32> %wide.load.13)
%27 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 56
%wide.load.14 = load <4 x i32>, ptr %27, align 16, !tbaa !5
%28 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %26, <4 x i32> %wide.load.14)
%29 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 60
%wide.load.15 = load <4 x i32>, ptr %29, align 16, !tbaa !5
%30 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %28, <4 x i32> %wide.load.15)
%31 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 64
%wide.load.16 = load <4 x i32>, ptr %31, align 16, !tbaa !5
%32 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %30, <4 x i32> %wide.load.16)
%33 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 68
%wide.load.17 = load <4 x i32>, ptr %33, align 16, !tbaa !5
%34 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %32, <4 x i32> %wide.load.17)
%35 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 72
%wide.load.18 = load <4 x i32>, ptr %35, align 16, !tbaa !5
%36 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %34, <4 x i32> %wide.load.18)
%37 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 76
%wide.load.19 = load <4 x i32>, ptr %37, align 16, !tbaa !5
%38 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %36, <4 x i32> %wide.load.19)
%39 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 80
%wide.load.20 = load <4 x i32>, ptr %39, align 16, !tbaa !5
%40 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %38, <4 x i32> %wide.load.20)
%41 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 84
%wide.load.21 = load <4 x i32>, ptr %41, align 16, !tbaa !5
%42 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %40, <4 x i32> %wide.load.21)
%43 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 88
%wide.load.22 = load <4 x i32>, ptr %43, align 16, !tbaa !5
%44 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %42, <4 x i32> %wide.load.22)
%45 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 92
%wide.load.23 = load <4 x i32>, ptr %45, align 16, !tbaa !5
%46 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %44, <4 x i32> %wide.load.23)
%47 = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 96
%wide.load.24 = load <4 x i32>, ptr %47, align 16, !tbaa !5
%48 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %46, <4 x i32> %wide.load.24)
%49 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %48, <4 x i32> zeroinitializer)
%50 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %49)
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %50)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %freq) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
for.body: ; preds = %entry, %for.body
%t.022 = phi i32 [ %inc2, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %temp) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %temp)
%51 = load i32, ptr %temp, align 4, !tbaa !5
%sub = add nsw i32 %51, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr %freq, i64 0, i64 %idxprom
%52 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %52, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %temp) #5
%inc2 = add nuw nsw i32 %t.022, 1
%53 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc2, %53
br i1 %cmp, label %for.body, label %vector.body, !llvm.loop !9
}
; 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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #4
attributes #0 = { 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main(void){
char s[102]={0};
char p[102]={0};
int i,j,k,flag,slen,plen,count;
count = -100;
fgets(s,sizeof(s),stdin);
fgets(p,sizeof(p),stdin);
slen=strlen(s)-1;
plen=strlen(p)-1;
for(i=0;i<slen;i++){
if(p[0] == s[i]){
count = 0;
for(j=1;j<plen;j++){
if(p[j]==s[(i+j)%slen]) count++;
else break;
}
if(count == plen-1){
puts("Yes");
break;}
}
}
if(count != plen-1) puts("No");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_331193/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_331193/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [102 x i8], align 16
%p = alloca [102 x i8], align 16
call void @llvm.lifetime.start.p0(i64 102, ptr nonnull %s) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(102) %s, i8 0, i64 102, i1 false)
call void @llvm.lifetime.start.p0(i64 102, ptr nonnull %p) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(102) %p, i8 0, i64 102, i1 false)
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %s, i32 noundef 102, ptr noundef %0)
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call2 = call ptr @fgets(ptr noundef nonnull %p, i32 noundef 102, ptr noundef %1)
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%2 = trunc i64 %call4 to i32
%conv = add i32 %2, -1
%call6 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %p) #6
%call6.fr = freeze i64 %call6
%3 = trunc i64 %call6.fr to i32
%cmp61 = icmp sgt i32 %conv, 0
br i1 %cmp61, label %for.body.lr.ph, label %entry.for.end38_crit_edge
entry.for.end38_crit_edge: ; preds = %entry
%.pre = add i32 %3, -2
br label %for.end38
for.body.lr.ph: ; preds = %entry
%conv8 = add i32 %3, -1
%4 = load i8, ptr %p, align 16, !tbaa !9
%cmp1657 = icmp sgt i32 %conv8, 1
%sub29 = add i32 %3, -2
br i1 %cmp1657, label %for.body.us.preheader, label %for.body.lr.ph.split
for.body.us.preheader: ; preds = %for.body.lr.ph
%wide.trip.count99 = zext i32 %conv to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.inc36.us
%indvars.iv96 = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next97, %for.inc36.us ]
%count.064.us = phi i32 [ -100, %for.body.us.preheader ], [ %count.2.us, %for.inc36.us ]
%arrayidx11.us = getelementptr inbounds [102 x i8], ptr %s, i64 0, i64 %indvars.iv96
%5 = load i8, ptr %arrayidx11.us, align 1, !tbaa !9
%cmp13.us = icmp eq i8 %4, %5
br i1 %cmp13.us, label %for.body18.us, label %for.inc36.us
for.body18.us: ; preds = %for.body.us, %if.then27.us
%indvars.iv91 = phi i64 [ %indvars.iv.next92, %if.then27.us ], [ 1, %for.body.us ]
%count.159.us = phi i32 [ %inc.us, %if.then27.us ], [ 0, %for.body.us ]
%arrayidx20.us = getelementptr inbounds [102 x i8], ptr %p, i64 0, i64 %indvars.iv91
%6 = load i8, ptr %arrayidx20.us, align 1, !tbaa !9
%7 = add nuw nsw i64 %indvars.iv91, %indvars.iv96
%8 = trunc i64 %7 to i32
%rem.us = srem i32 %8, %conv
%idxprom22.us = zext i32 %rem.us to i64
%arrayidx23.us = getelementptr inbounds [102 x i8], ptr %s, i64 0, i64 %idxprom22.us
%9 = load i8, ptr %arrayidx23.us, align 1, !tbaa !9
%cmp25.us = icmp eq i8 %6, %9
br i1 %cmp25.us, label %if.then27.us, label %for.end.us
for.end.us: ; preds = %for.body18.us
%cmp30.us = icmp eq i32 %count.159.us, %sub29
br i1 %cmp30.us, label %if.then32, label %for.inc36.us
for.inc36.us: ; preds = %for.end.us, %for.body.us
%count.2.us = phi i32 [ %count.159.us, %for.end.us ], [ %count.064.us, %for.body.us ]
%indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
%exitcond100.not = icmp eq i64 %indvars.iv.next97, %wide.trip.count99
br i1 %exitcond100.not, label %for.end38, label %for.body.us, !llvm.loop !10
if.then27.us: ; preds = %for.body18.us
%inc.us = add nuw nsw i32 %count.159.us, 1
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%exitcond95.not = icmp eq i32 %inc.us, %sub29
br i1 %exitcond95.not, label %if.then32, label %for.body18.us, !llvm.loop !12
for.body.lr.ph.split: ; preds = %for.body.lr.ph
%cmp30 = icmp eq i32 %sub29, 0
%wide.trip.count89 = zext i32 %conv to i64
br i1 %cmp30, label %for.body.us67, label %for.body.preheader
for.body.preheader: ; preds = %for.body.lr.ph.split
%min.iters.check = icmp ult i32 %conv, 8
br i1 %min.iters.check, label %for.body.preheader122, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count89, 4294967288
%broadcast.splatinsert = insertelement <4 x i8> poison, i8 %4, i64 0
%broadcast.splat = shufflevector <4 x i8> %broadcast.splatinsert, <4 x i8> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 -100, i32 -100, i32 -100, i32 -100>, %vector.ph ], [ %14, %vector.body ]
%vec.phi114 = phi <4 x i32> [ <i32 -100, i32 -100, i32 -100, i32 -100>, %vector.ph ], [ %15, %vector.body ]
%10 = getelementptr inbounds [102 x i8], ptr %s, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %10, align 8, !tbaa !9
%11 = getelementptr inbounds i8, ptr %10, i64 4
%wide.load115 = load <4 x i8>, ptr %11, align 4, !tbaa !9
%12 = icmp eq <4 x i8> %broadcast.splat, %wide.load
%13 = icmp eq <4 x i8> %broadcast.splat, %wide.load115
%14 = select <4 x i1> %12, <4 x i32> zeroinitializer, <4 x i32> %vec.phi
%15 = select <4 x i1> %13, <4 x i32> zeroinitializer, <4 x i32> %vec.phi114
%index.next = add nuw i64 %index, 8
%16 = icmp eq i64 %index.next, %n.vec
br i1 %16, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%rdx.select.cmp.not = icmp ne <4 x i32> %14, <i32 -100, i32 -100, i32 -100, i32 -100>
%rdx.select.cmp116118 = icmp ne <4 x i32> %15, <i32 -100, i32 -100, i32 -100, i32 -100>
%rdx.select.cmp116 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp116118
%17 = bitcast <4 x i1> %rdx.select.cmp116 to i4
%.not = icmp eq i4 %17, 0
%rdx.select117 = select i1 %.not, i32 -100, i32 0
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count89
br i1 %cmp.n, label %for.end38, label %for.body.preheader122
for.body.preheader122: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%count.064.ph = phi i32 [ -100, %for.body.preheader ], [ %rdx.select117, %middle.block ]
br label %for.body
for.body.us67: ; preds = %for.body.lr.ph.split, %for.inc36.us73
%indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.inc36.us73 ], [ 0, %for.body.lr.ph.split ]
%arrayidx11.us71 = getelementptr inbounds [102 x i8], ptr %s, i64 0, i64 %indvars.iv86
%18 = load i8, ptr %arrayidx11.us71, align 1, !tbaa !9
%cmp13.us72 = icmp eq i8 %4, %18
br i1 %cmp13.us72, label %if.then32, label %for.inc36.us73
for.inc36.us73: ; preds = %for.body.us67
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%exitcond90.not = icmp eq i64 %indvars.iv.next87, %wide.trip.count89
br i1 %exitcond90.not, label %if.then42, label %for.body.us67, !llvm.loop !10
for.body: ; preds = %for.body.preheader122, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader122 ]
%count.064 = phi i32 [ %spec.select, %for.body ], [ %count.064.ph, %for.body.preheader122 ]
%arrayidx11 = getelementptr inbounds [102 x i8], ptr %s, i64 0, i64 %indvars.iv
%19 = load i8, ptr %arrayidx11, align 1, !tbaa !9
%cmp13 = icmp eq i8 %4, %19
%spec.select = select i1 %cmp13, i32 0, i32 %count.064
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count89
br i1 %exitcond.not, label %for.end38, label %for.body, !llvm.loop !16
if.then32: ; preds = %for.body.us67, %for.end.us, %if.then27.us
%.us-phi = phi i32 [ %sub29, %if.then27.us ], [ %sub29, %for.end.us ], [ 0, %for.body.us67 ]
%call33 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str)
br label %for.end38
for.end38: ; preds = %for.body, %for.inc36.us, %middle.block, %entry.for.end38_crit_edge, %if.then32
%sub39.pre-phi = phi i32 [ %.pre, %entry.for.end38_crit_edge ], [ %sub29, %if.then32 ], [ %sub29, %middle.block ], [ %sub29, %for.inc36.us ], [ %sub29, %for.body ]
%count.3 = phi i32 [ -100, %entry.for.end38_crit_edge ], [ %.us-phi, %if.then32 ], [ %rdx.select117, %middle.block ], [ %count.2.us, %for.inc36.us ], [ %spec.select, %for.body ]
%cmp40.not = icmp eq i32 %count.3, %sub39.pre-phi
br i1 %cmp40.not, label %if.end44, label %if.then42
if.then42: ; preds = %for.inc36.us73, %for.end38
%call43 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end44
if.end44: ; preds = %if.then42, %for.end38
call void @llvm.lifetime.end.p0(i64 102, ptr nonnull %p) #5
call void @llvm.lifetime.end.p0(i64 102, ptr nonnull %s) #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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #4 = { 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !11, !15, !14}
|
#include<stdio.h>
#include<string.h>
int
main(int argc, char *argv[])
{
char s[100], p[100];
char ring[200];
int i = 0;
scanf("%s\n%s", s, p);
strcpy(ring, s);
strcpy((char *)(ring + strlen(s)), s);
while (i < strlen(s)) {
if (!strncmp((char *)(ring + i++), p, strlen(p))) {
printf("Yes\n");
return 0;
}
}
printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_331243/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_331243/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%s\0A%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%s = alloca [100 x i8], align 16
%p = alloca [100 x i8], align 16
%ring = alloca [200 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #6
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %p) #6
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %ring) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %p)
%call4 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %ring, ptr noundef nonnull dereferenceable(1) %s) #6
%call7 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #7
%add.ptr = getelementptr inbounds i8, ptr %ring, i64 %call7
%call9 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %add.ptr, ptr noundef nonnull dereferenceable(1) %s) #6
br label %while.cond
while.cond: ; preds = %while.body, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%exitcond.not = icmp eq i64 %indvars.iv, %call7
br i1 %exitcond.not, label %cleanup, label %while.body
while.body: ; preds = %while.cond
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%add.ptr14 = getelementptr inbounds i8, ptr %ring, i64 %indvars.iv
%call17 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %p) #7
%call18 = call i32 @strncmp(ptr noundef nonnull %add.ptr14, ptr noundef nonnull %p, i64 noundef %call17) #7
%tobool.not = icmp eq i32 %call18, 0
br i1 %tobool.not, label %cleanup, label %while.cond, !llvm.loop !5
cleanup: ; preds = %while.cond, %while.body
%str.sink = phi ptr [ @str.3, %while.body ], [ @str, %while.cond ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %ring) #6
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %p) #6
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #6
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { 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 #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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 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 #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int main(){
char s[100];
char p[100];
char a[200];
scanf("%s",s);
scanf("%s",p);
strcpy(a,s);
strcat(a,s);
if(strstr(a,p))
printf("Yes\n");
else
printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_331344/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_331344/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100 x i8], align 16
%p = alloca [100 x i8], align 16
%a = alloca [200 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #6
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %p) #6
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %a) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%call5 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %s) #6
%call8 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %s) #6
%call11 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %p) #7
%tobool.not = icmp eq ptr %call11, null
%str.str.3 = select i1 %tobool.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %p) #6
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #6
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { 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 #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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 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 #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
#include<string.h>
int main(){
char s1[100];
char s2[100];
char s3[100];
int len;
int flag=0;
char tmp;
int i;
char *p;
scanf("%s",s1);
strcpy(s3,s1);
len=strlen(s3);
scanf("%s",s2);
while(1){ // ????????????????????°??¶????????¢
tmp=s3[0];
for(i=1;i<len;i++){
s3[i-1]=s3[i];
}
s3[len-1]=tmp;
if((p=strstr(s3,s2))!=NULL){
flag=1;
break;
}
else if(strcmp(s1,s3)==0){
break;
}
}
if(flag==1){
printf("Yes\n");
}
else{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_331388/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_331388/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s1 = alloca [100 x i8], align 16
%s2 = alloca [100 x i8], align 16
%s3 = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s1) #7
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s2) #7
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s3) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1)
%call3 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %s3, ptr noundef nonnull dereferenceable(1) %s1) #7
%call5 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s3) #8
%conv = trunc i64 %call5 to i32
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s2)
%cmp39 = icmp sgt i32 %conv, 1
%sub12 = shl i64 %call5, 32
%sext = add i64 %sub12, -4294967296
%idxprom13 = ashr exact i64 %sext, 32
%arrayidx14 = getelementptr inbounds [100 x i8], ptr %s3, i64 0, i64 %idxprom13
br i1 %cmp39, label %while.cond.us.preheader, label %while.cond
while.cond.us.preheader: ; preds = %entry
%scevgep = getelementptr inbounds i8, ptr %s3, i64 1
%0 = add i64 %call5, 4294967295
%1 = and i64 %0, 4294967295
br label %while.cond.us
while.cond.us: ; preds = %while.cond.us.preheader, %if.else.us
%2 = load i8, ptr %s3, align 16, !tbaa !5
call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 %s3, ptr nonnull align 1 %scevgep, i64 %1, i1 false), !tbaa !5
store i8 %2, ptr %arrayidx14, align 1, !tbaa !5
%call17.us = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %s3, ptr noundef nonnull dereferenceable(1) %s2) #8
%cmp18.not.not.us = icmp eq ptr %call17.us, null
br i1 %cmp18.not.not.us, label %if.else.us, label %if.end33
if.else.us: ; preds = %while.cond.us
%call22.us = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %s1, ptr noundef nonnull dereferenceable(1) %s3) #8
%cmp23.us = icmp eq i32 %call22.us, 0
br i1 %cmp23.us, label %if.end33, label %while.cond.us
while.cond: ; preds = %entry, %if.else
%3 = load i8, ptr %s3, align 16, !tbaa !5
store i8 %3, ptr %arrayidx14, align 1, !tbaa !5
%call17 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %s3, ptr noundef nonnull dereferenceable(1) %s2) #8
%cmp18.not.not = icmp eq ptr %call17, null
br i1 %cmp18.not.not, label %if.else, label %if.end33
if.else: ; preds = %while.cond
%call22 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %s1, ptr noundef nonnull dereferenceable(1) %s3) #8
%cmp23 = icmp eq i32 %call22, 0
br i1 %cmp23, label %if.end33, label %while.cond
if.end33: ; preds = %if.else, %while.cond, %if.else.us, %while.cond.us
%str.sink = phi ptr [ @str.3, %while.cond.us ], [ @str, %if.else.us ], [ @str.3, %while.cond ], [ @str, %if.else ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s3) #7
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s2) #7
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s1) #7
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #6
attributes #0 = { 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 #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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 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 #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
attributes #8 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
char served[200];
char pick[100];
int i=0;
int j=0;
int k,l,cnt=0;
scanf("%s",served);
scanf("%s",pick);
while(1){
if(served[i++]=='\0') break;
}
while(1){
if(pick[j++]=='\0') break;
}
for(k=i-1; k<=2*i-3; k++){
served[k]=served[k-i+1];
}
for(l=0; l<=2*i-j; l++){
if(served[l] == pick[cnt]){
while(1){
if(served[l+cnt]==pick[cnt]) cnt++;
else break;
}
if(cnt == j-1)break;
else cnt=0;
}
}
if(cnt) printf("Yes\n");
else printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_331438/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_331438/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%served = alloca [200 x i8], align 16
%pick = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %served) #4
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %pick) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %served)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %pick)
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv101 = phi i32 [ %indvars.iv.next102, %while.cond ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 0
%indvars.iv.next102 = add i32 %indvars.iv101, 2
br i1 %cmp, label %while.cond4.preheader, label %while.cond
while.cond4.preheader: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
br label %while.cond4
while.cond4: ; preds = %while.cond4.preheader, %while.cond4
%indvars.iv94 = phi i64 [ 0, %while.cond4.preheader ], [ %indvars.iv.next95, %while.cond4 ]
%indvars.iv.next95 = add nuw i64 %indvars.iv94, 1
%arrayidx8 = getelementptr inbounds [100 x i8], ptr %pick, i64 0, i64 %indvars.iv94
%2 = load i8, ptr %arrayidx8, align 1, !tbaa !5
%cmp10 = icmp eq i8 %2, 0
br i1 %cmp10, label %for.cond.preheader, label %while.cond4
for.cond.preheader: ; preds = %while.cond4
%3 = trunc i64 %indvars.iv.next to i32
%4 = trunc i64 %indvars.iv94 to i32
%5 = trunc i64 %indvars.iv.next95 to i32
%mul = shl nuw nsw i32 %3, 1
%sub15 = add nsw i32 %mul, -3
%cmp16.not89 = icmp slt i32 %sub15, %1
br i1 %cmp16.not89, label %for.cond24.preheader, label %iter.check
iter.check: ; preds = %for.cond.preheader
%sext = shl i64 %indvars.iv, 32
%6 = ashr exact i64 %sext, 32
%wide.trip.count = zext i32 %indvars.iv101 to i64
%7 = sub i64 %wide.trip.count, %indvars.iv
%min.iters.check = icmp ult i64 %7, 8
%diff.check = icmp ult i64 %sext, 137438953472
%or.cond = or i1 %min.iters.check, %diff.check
br i1 %or.cond, label %for.body.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %iter.check
%min.iters.check112 = icmp ult i64 %7, 32
br i1 %min.iters.check112, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i64 %7, -32
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = add i64 %indvars.iv, %index
%8 = sub nuw nsw i64 %offset.idx, %6
%9 = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %8
%wide.load = load <16 x i8>, ptr %9, align 1, !tbaa !5
%10 = getelementptr inbounds i8, ptr %9, i64 16
%wide.load113 = load <16 x i8>, ptr %10, align 1, !tbaa !5
%11 = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %offset.idx
store <16 x i8> %wide.load, ptr %11, align 1, !tbaa !5
%12 = getelementptr inbounds i8, ptr %11, i64 16
store <16 x i8> %wide.load113, ptr %12, align 1, !tbaa !5
%index.next = add nuw i64 %index, 32
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %7, %n.vec
br i1 %cmp.n, label %for.cond24.preheader, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%ind.end116 = add i64 %indvars.iv, %n.vec
%n.vec.remaining = and i64 %7, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
br i1 %min.epilog.iters.check, label %for.body.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%n.vec115 = and i64 %7, -8
%ind.end = add i64 %indvars.iv, %n.vec115
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index118 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next121, %vec.epilog.vector.body ]
%offset.idx119 = add i64 %indvars.iv, %index118
%14 = sub nuw nsw i64 %offset.idx119, %6
%15 = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %14
%wide.load120 = load <8 x i8>, ptr %15, align 1, !tbaa !5
%16 = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %offset.idx119
store <8 x i8> %wide.load120, ptr %16, align 1, !tbaa !5
%index.next121 = add nuw i64 %index118, 8
%17 = icmp eq i64 %index.next121, %n.vec115
br i1 %17, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !12
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n117 = icmp eq i64 %7, %n.vec115
br i1 %cmp.n117, label %for.cond24.preheader, label %for.body.preheader
for.body.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv97.ph = phi i64 [ %indvars.iv, %iter.check ], [ %ind.end116, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ]
%18 = sub i64 %wide.trip.count, %indvars.iv97.ph
%19 = xor i64 %indvars.iv97.ph, -1
%20 = add i64 %19, %wide.trip.count
%xtraiter = and i64 %18, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader, %for.body.prol
%indvars.iv97.prol = phi i64 [ %indvars.iv.next98.prol, %for.body.prol ], [ %indvars.iv97.ph, %for.body.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader ]
%21 = sub nuw nsw i64 %indvars.iv97.prol, %6
%arrayidx20.prol = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %21
%22 = load i8, ptr %arrayidx20.prol, align 1, !tbaa !5
%arrayidx22.prol = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %indvars.iv97.prol
store i8 %22, ptr %arrayidx22.prol, align 1, !tbaa !5
%indvars.iv.next98.prol = add nuw i64 %indvars.iv97.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader
%indvars.iv97.unr = phi i64 [ %indvars.iv97.ph, %for.body.preheader ], [ %indvars.iv.next98.prol, %for.body.prol ]
%23 = icmp ult i64 %20, 3
br i1 %23, label %for.cond24.preheader, label %for.body
for.cond24.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %vec.epilog.middle.block, %for.cond.preheader
%sub26 = sub nsw i32 %mul, %5
%cmp27.not91 = icmp slt i32 %sub26, 0
br i1 %cmp27.not91, label %if.else66, label %for.body29.lr.ph
for.body29.lr.ph: ; preds = %for.cond24.preheader
%24 = load i8, ptr %pick, align 16, !tbaa !5
%25 = zext i32 %sub26 to i64
br label %for.body29
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv97 = phi i64 [ %indvars.iv.next98.3, %for.body ], [ %indvars.iv97.unr, %for.body.prol.loopexit ]
%26 = sub nuw nsw i64 %indvars.iv97, %6
%arrayidx20 = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %26
%27 = load i8, ptr %arrayidx20, align 1, !tbaa !5
%arrayidx22 = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %indvars.iv97
store i8 %27, ptr %arrayidx22, align 1, !tbaa !5
%indvars.iv.next98 = add nuw i64 %indvars.iv97, 1
%28 = sub nuw nsw i64 %indvars.iv.next98, %6
%arrayidx20.1 = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %28
%29 = load i8, ptr %arrayidx20.1, align 1, !tbaa !5
%arrayidx22.1 = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %indvars.iv.next98
store i8 %29, ptr %arrayidx22.1, align 1, !tbaa !5
%indvars.iv.next98.1 = add nuw i64 %indvars.iv97, 2
%30 = sub nuw nsw i64 %indvars.iv.next98.1, %6
%arrayidx20.2 = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %30
%31 = load i8, ptr %arrayidx20.2, align 1, !tbaa !5
%arrayidx22.2 = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %indvars.iv.next98.1
store i8 %31, ptr %arrayidx22.2, align 1, !tbaa !5
%indvars.iv.next98.2 = add nuw i64 %indvars.iv97, 3
%32 = sub nuw nsw i64 %indvars.iv.next98.2, %6
%arrayidx20.3 = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %32
%33 = load i8, ptr %arrayidx20.3, align 1, !tbaa !5
%arrayidx22.3 = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %indvars.iv.next98.2
store i8 %33, ptr %arrayidx22.3, align 1, !tbaa !5
%indvars.iv.next98.3 = add nuw i64 %indvars.iv97, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next98.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond24.preheader, label %for.body, !llvm.loop !15
for.body29: ; preds = %for.body29.lr.ph, %for.inc61
%indvars.iv107 = phi i64 [ 0, %for.body29.lr.ph ], [ %indvars.iv.next108, %for.inc61 ]
%arrayidx31 = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %indvars.iv107
%34 = load i8, ptr %arrayidx31, align 1, !tbaa !5
%cmp36 = icmp eq i8 %34, %24
br i1 %cmp36, label %while.cond39, label %for.inc61
while.cond39: ; preds = %for.body29, %while.cond39
%indvars.iv103 = phi i64 [ %indvars.iv.next104, %while.cond39 ], [ 0, %for.body29 ]
%35 = add nuw nsw i64 %indvars.iv103, %indvars.iv107
%arrayidx43 = getelementptr inbounds [200 x i8], ptr %served, i64 0, i64 %35
%36 = load i8, ptr %arrayidx43, align 1, !tbaa !5
%arrayidx46 = getelementptr inbounds [100 x i8], ptr %pick, i64 0, i64 %indvars.iv103
%37 = load i8, ptr %arrayidx46, align 1, !tbaa !5
%cmp48 = icmp eq i8 %36, %37
%indvars.iv.next104 = add nuw i64 %indvars.iv103, 1
br i1 %cmp48, label %while.cond39, label %while.end53
while.end53: ; preds = %while.cond39
%38 = trunc i64 %indvars.iv103 to i32
%cmp55 = icmp eq i32 %38, %4
br i1 %cmp55, label %for.end63, label %for.inc61
for.inc61: ; preds = %while.end53, %for.body29
%indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
%cmp27.not.not = icmp ult i64 %indvars.iv107, %25
br i1 %cmp27.not.not, label %for.body29, label %if.else66, !llvm.loop !16
for.end63: ; preds = %while.end53
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %if.else66, label %if.end68
if.else66: ; preds = %for.inc61, %for.cond24.preheader, %for.end63
br label %if.end68
if.end68: ; preds = %for.end63, %if.else66
%str.sink = phi ptr [ @str, %if.else66 ], [ @str.3, %for.end63 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %pick) #4
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %served) #4
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { 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 #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 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !10, !11}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !9, !10}
!16 = distinct !{!16, !9}
|
#include <stdio.h>
#include <string.h>
int main(void){
char s_cat[200]={},s[100], p[100];
scanf("%s",s);
scanf("%s",p);
strcat(s_cat,s);
strcat(s_cat,s);
if ((strstr(s_cat, p)) != NULL) {
printf("Yes\n");
} else {
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_331481/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_331481/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s_cat = alloca [200 x i8], align 16
%s = alloca [100 x i8], align 16
%p = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %s_cat) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) %s_cat, i8 0, i64 200, i1 false)
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #7
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %p) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%call5 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %s_cat, ptr noundef nonnull dereferenceable(1) %s) #7
%call8 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %s_cat, ptr noundef nonnull dereferenceable(1) %s) #7
%call11 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %s_cat, ptr noundef nonnull dereferenceable(1) %p) #8
%cmp.not = icmp eq ptr %call11, null
%str.str.3 = select i1 %cmp.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %p) #7
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #7
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %s_cat) #7
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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 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 #6 = { nofree nounwind }
attributes #7 = { nounwind }
attributes #8 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
#include <string.h>
int main(int argc, const char * argv[]) {
char p[120], s[120], ss[250];
scanf("%s %s", s, p);
strcpy(ss, s);
strcat(ss, s);
if (strstr(ss, p)) puts("Yes");
else puts("No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_331524/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_331524/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%p = alloca [120 x i8], align 16
%s = alloca [120 x i8], align 16
%ss = alloca [250 x i8], align 16
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %p) #5
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 250, ptr nonnull %ss) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %p)
%call4 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %ss, ptr noundef nonnull dereferenceable(1) %s) #5
%call7 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %ss, ptr noundef nonnull dereferenceable(1) %s) #5
%call10 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %ss, ptr noundef nonnull dereferenceable(1) %p) #6
%tobool.not = icmp eq ptr %call10, null
%.str.2..str.1 = select i1 %tobool.not, ptr @.str.2, ptr @.str.1
%call12 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
call void @llvm.lifetime.end.p0(i64 250, ptr nonnull %ss) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %p) #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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) 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 = { 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 #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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
#include<string.h>
int main(void){
char s[1000],p[1000],cp[1000];
scanf("%s %s",s,p);
strcpy(cp,s);
strcat(s,cp);
if(strstr(s,p)==NULL)printf("No\n");
else printf("Yes\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_331568/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_331568/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [1000 x i8], align 16
%p = alloca [1000 x i8], align 16
%cp = alloca [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %s) #6
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %p) #6
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %cp) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %p)
%call4 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %cp, ptr noundef nonnull dereferenceable(1) %s) #6
%call7 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(1) %cp) #6
%call10 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(1) %p) #7
%cmp = icmp eq ptr %call10, null
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %cp) #6
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %p) #6
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %s) #6
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { 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 #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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 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 #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
#include<string.h>//文字列の長さを知りたい
int main(void){
int i=0;
char S1[100]={},S2[100]={},P[100]={};
scanf("%s",S2);
strcpy(S1,S2);//文字列S1に文字列S2をコピー
strcat(S1,S2);//文字列S1に文字列2を連結(リング上の文字から単語を探すため)
scanf("%s",P);
if(strstr(S1,P)==NULL) printf("No\n");
else printf("Yes\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_331610/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_331610/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S1 = alloca [100 x i8], align 16
%S2 = alloca [100 x i8], align 16
%P = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %S1) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(100) %S1, i8 0, i64 100, i1 false)
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %S2) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(100) %S2, i8 0, i64 100, i1 false)
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %P) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(100) %P, i8 0, i64 100, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S2)
%call3 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %S1, ptr noundef nonnull dereferenceable(1) %S2) #7
%call6 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %S1, ptr noundef nonnull dereferenceable(1) %S2) #7
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %P)
%call11 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %S1, ptr noundef nonnull dereferenceable(1) %P) #8
%cmp = icmp eq ptr %call11, null
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %P) #7
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %S2) #7
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %S1) #7
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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 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 #6 = { nofree nounwind }
attributes #7 = { nounwind }
attributes #8 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
#include<string.h>
int main(void)
{
char p[200],s[100],a[100];
scanf("%s",p);
scanf("%s",s);
strcpy(a,p);
strcat(p,a);
if(strstr(p,s) == NULL)
printf("No\n");
else
printf("Yes\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_331654/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_331654/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%p = alloca [200 x i8], align 16
%s = alloca [100 x i8], align 16
%a = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %p) #6
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #6
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %a) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call5 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %p) #6
%call8 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %p, ptr noundef nonnull dereferenceable(1) %a) #6
%call11 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %p, ptr noundef nonnull dereferenceable(1) %s) #7
%cmp = icmp eq ptr %call11, null
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #6
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %p) #6
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { 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 #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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 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 #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
#include<string.h>
int main(){
char p[202],s[101],a[101];
scanf("%s%s",p,s);
strcpy(a,p);
if(strstr(strcat(p,a),s)==NULL){
printf("No\n");
return 0;
}
printf("Yes\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_331704/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_331704/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%p = alloca [202 x i8], align 16
%s = alloca [101 x i8], align 16
%a = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 202, ptr nonnull %p) #6
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #6
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %a) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p, ptr noundef nonnull %s)
%call4 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %p) #6
%call7 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %p, ptr noundef nonnull dereferenceable(1) %a) #6
%call9 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %p, ptr noundef nonnull dereferenceable(1) %s) #7
%cmp = icmp eq ptr %call9, null
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #6
call void @llvm.lifetime.end.p0(i64 202, ptr nonnull %p) #6
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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { 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 #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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 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 #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|