Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
#define MOD 1000000007
int main()
{ int n;
scanf("%d",&n);
int cnt[1001]={0};
for(int i=n;i>0;i--){
int cpy=i;
for(int j=2;j<=i;j++){
while(cpy%j==0&&cpy>0){
cpy/=j;
cnt[j]++;
}
}
if(cpy>1){
cnt[cpy]++;
printf("cnt%dincre\n",cpy);
}
}
/*for(int i=2;i<=n;i++){
printf("cnt[%d]=%d\n",i,cnt[i]);
}*/
long long ans=1;
for(int i=2;i<=n;i++){
ans*=(cnt[i]+1);
ans%=MOD;
}
printf("%lld",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139921/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139921/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 [12 x i8] c"cnt%dincre\0A\00", align 1
@.str.2 = 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 i32, align 4
%cnt = alloca [1001 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 4004, ptr nonnull %cnt) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4004) %cnt, i8 0, i64 4004, i1 false)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp52 = icmp sgt i32 %0, 0
br i1 %cmp52, label %for.cond1.preheader.preheader, label %for.cond.cleanup18
for.cond1.preheader.preheader: ; preds = %entry
%1 = add nuw i32 %0, 1
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %if.end
%indvars.iv59 = phi i32 [ %1, %for.cond1.preheader.preheader ], [ %indvars.iv.next60, %if.end ]
%i.053 = phi i32 [ %0, %for.cond1.preheader.preheader ], [ %dec, %if.end ]
%cmp2.not48 = icmp ult i32 %i.053, 2
br i1 %cmp2.not48, label %for.cond16.preheader, label %while.cond.preheader.preheader
while.cond.preheader.preheader: ; preds = %for.cond1.preheader
%wide.trip.count = zext i32 %indvars.iv59 to i64
br label %while.cond.preheader
for.cond16.preheader: ; preds = %for.cond1.preheader, %if.end
%.pre = load i32, ptr %n, align 4, !tbaa !5
%cmp17.not54 = icmp slt i32 %.pre, 2
br i1 %cmp17.not54, label %for.cond.cleanup18, label %for.body19.preheader
for.body19.preheader: ; preds = %for.cond16.preheader
%2 = add nuw i32 %.pre, 1
%wide.trip.count64 = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count64, 1
%3 = icmp eq i32 %2, 3
br i1 %3, label %for.cond.cleanup18.loopexit.unr-lcssa, label %for.body19.preheader.new
for.body19.preheader.new: ; preds = %for.body19.preheader
%4 = and i64 %wide.trip.count64, 4294967294
%5 = add nsw i64 %4, -4
br label %for.body19
while.cond.preheader: ; preds = %while.cond.preheader.preheader, %for.inc
%indvars.iv = phi i64 [ 2, %while.cond.preheader.preheader ], [ %indvars.iv.next, %for.inc ]
%cpy.049 = phi i32 [ %i.053, %while.cond.preheader.preheader ], [ %cpy.1.lcssa, %for.inc ]
%6 = trunc i64 %indvars.iv to i32
%rem43 = srem i32 %cpy.049, %6
%cmp544 = icmp eq i32 %rem43, 0
%cmp645 = icmp sgt i32 %cpy.049, 0
%7 = and i1 %cmp645, %cmp544
br i1 %7, label %while.body.lr.ph, label %for.inc
while.body.lr.ph: ; preds = %while.cond.preheader
%arrayidx = getelementptr inbounds [1001 x i32], ptr %cnt, i64 0, i64 %indvars.iv
%arrayidx.promoted = load i32, ptr %arrayidx, align 4, !tbaa !5
br label %while.body
for.cond.cleanup3: ; preds = %for.inc
%cmp8 = icmp sgt i32 %cpy.1.lcssa, 1
br i1 %cmp8, label %if.then, label %if.end
while.body: ; preds = %while.body.lr.ph, %while.body
%inc47 = phi i32 [ %arrayidx.promoted, %while.body.lr.ph ], [ %inc, %while.body ]
%cpy.146 = phi i32 [ %cpy.049, %while.body.lr.ph ], [ %div, %while.body ]
%div = sdiv i32 %cpy.146, %6
%inc = add nsw i32 %inc47, 1
%rem = srem i32 %div, %6
%cmp5 = icmp eq i32 %rem, 0
%cmp6 = icmp sgt i32 %div, 0
%8 = and i1 %cmp6, %cmp5
br i1 %8, label %while.body, label %while.cond.for.inc_crit_edge, !llvm.loop !9
while.cond.for.inc_crit_edge: ; preds = %while.body
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %while.cond.for.inc_crit_edge, %while.cond.preheader
%cpy.1.lcssa = phi i32 [ %div, %while.cond.for.inc_crit_edge ], [ %cpy.049, %while.cond.preheader ]
%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.cleanup3, label %while.cond.preheader, !llvm.loop !11
if.then: ; preds = %for.cond.cleanup3
%idxprom9 = zext i32 %cpy.1.lcssa to i64
%arrayidx10 = getelementptr inbounds [1001 x i32], ptr %cnt, i64 0, i64 %idxprom9
%9 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%inc11 = add nsw i32 %9, 1
store i32 %inc11, ptr %arrayidx10, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cpy.1.lcssa)
br label %if.end
if.end: ; preds = %if.then, %for.cond.cleanup3
%dec = add nsw i32 %i.053, -1
%cmp = icmp sgt i32 %i.053, 1
%indvars.iv.next60 = add i32 %indvars.iv59, -1
br i1 %cmp, label %for.cond1.preheader, label %for.cond16.preheader, !llvm.loop !12
for.cond.cleanup18.loopexit.unr-lcssa: ; preds = %for.body19, %for.body19.preheader
%rem22.lcssa.ph = phi i64 [ undef, %for.body19.preheader ], [ %rem22.1, %for.body19 ]
%indvars.iv61.unr = phi i64 [ 2, %for.body19.preheader ], [ %indvars.iv.next62.1, %for.body19 ]
%ans.055.unr = phi i64 [ 1, %for.body19.preheader ], [ %rem22.1, %for.body19 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup18, label %for.body19.epil
for.body19.epil: ; preds = %for.cond.cleanup18.loopexit.unr-lcssa
%arrayidx21.epil = getelementptr inbounds [1001 x i32], ptr %cnt, i64 0, i64 %indvars.iv61.unr
%10 = load i32, ptr %arrayidx21.epil, align 4, !tbaa !5
%add.epil = add nsw i32 %10, 1
%conv.epil = sext i32 %add.epil to i64
%mul.epil = mul nsw i64 %ans.055.unr, %conv.epil
%rem22.epil = srem i64 %mul.epil, 1000000007
br label %for.cond.cleanup18
for.cond.cleanup18: ; preds = %for.body19.epil, %for.cond.cleanup18.loopexit.unr-lcssa, %entry, %for.cond16.preheader
%ans.0.lcssa = phi i64 [ 1, %for.cond16.preheader ], [ 1, %entry ], [ %rem22.lcssa.ph, %for.cond.cleanup18.loopexit.unr-lcssa ], [ %rem22.epil, %for.body19.epil ]
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %cnt) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body19: ; preds = %for.body19, %for.body19.preheader.new
%indvars.iv61 = phi i64 [ 2, %for.body19.preheader.new ], [ %indvars.iv.next62.1, %for.body19 ]
%ans.055 = phi i64 [ 1, %for.body19.preheader.new ], [ %rem22.1, %for.body19 ]
%niter = phi i64 [ 0, %for.body19.preheader.new ], [ %niter.next.1, %for.body19 ]
%arrayidx21 = getelementptr inbounds [1001 x i32], ptr %cnt, i64 0, i64 %indvars.iv61
%11 = load i32, ptr %arrayidx21, align 8, !tbaa !5
%add = add nsw i32 %11, 1
%conv = sext i32 %add to i64
%mul = mul nsw i64 %ans.055, %conv
%rem22 = srem i64 %mul, 1000000007
%indvars.iv.next62 = or i64 %indvars.iv61, 1
%arrayidx21.1 = getelementptr inbounds [1001 x i32], ptr %cnt, i64 0, i64 %indvars.iv.next62
%12 = load i32, ptr %arrayidx21.1, align 4, !tbaa !5
%add.1 = add nsw i32 %12, 1
%conv.1 = sext i32 %add.1 to i64
%mul.1 = mul nsw i64 %rem22, %conv.1
%rem22.1 = srem i64 %mul.1, 1000000007
%indvars.iv.next62.1 = add nuw nsw i64 %indvars.iv61, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter, %5
br i1 %niter.ncmp.1, label %for.cond.cleanup18.loopexit.unr-lcssa, label %for.body19, !llvm.loop !13
}
; 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
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 = { 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}
|
#include<stdio.h>
int main(void){
char top;
int turn, score = 0;
scanf("%c", &top);
for(turn = 0; top != '\n'; turn++){
if(turn % 2 == 0) score--;
if(top == 'g') score++;
scanf("%c", &top);
}
printf("%ld\n", score);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139972/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139972/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"%c\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:
%top = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %top) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %top)
%0 = load i8, ptr %top, align 1, !tbaa !5
%cmp.not15 = icmp eq i8 %0, 10
br i1 %cmp.not15, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%1 = phi i8 [ %2, %for.body ], [ %0, %entry ]
%score.017 = phi i32 [ %score.2, %for.body ], [ 0, %entry ]
%turn.016 = phi i32 [ %inc10, %for.body ], [ 0, %entry ]
%rem = and i32 %turn.016, 1
%cmp5 = icmp ne i8 %1, 103
%sext = sext i1 %cmp5 to i32
%score.2.v = add i32 %score.017, %rem
%score.2 = add i32 %score.2.v, %sext
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %top)
%inc10 = add nuw nsw i32 %turn.016, 1
%2 = load i8, ptr %top, align 1, !tbaa !5
%cmp.not = icmp eq i8 %2, 10
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.body, %entry
%score.0.lcssa = phi i32 [ 0, %entry ], [ %score.2, %for.body ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %score.0.lcssa)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %top) #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"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int N;
long long A;
long long sum;
long long min;
int i;
int zero_count;
int minus_count;
scanf("%d", &N);
zero_count = 0;
minus_count = 0;
sum = 0;
min = 1000000000; /* 10^9 */
for(i = 0; i < N; i++) {
scanf("%lld", &A);
if(A == 0) {
zero_count += 1;
} else if(A < 0) {
minus_count += 1;
A *= -1;
sum += A;
if(A < min) {
min = A;
}
} else {
sum += A;
if(A < min) {
min = A;
}
}
}
// 負の数が奇数 -> 一番絶対値が小さい数字を負の数にした場合の合計
// 負の数が偶数 もしくは、 0が1個でもあれば -> 全て正の数にできる
if(zero_count >= 1 || (minus_count%2) == 0) {
printf("%lld\n", sum);
} else {
printf("%lld\n", sum - (min*2));
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140013/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140013/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) #4
call void @llvm.lifetime.start.p0(i64 8, 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
%cmp33 = icmp sgt i32 %0, 0
br i1 %cmp33, label %for.body, label %if.end23
for.body: ; preds = %entry, %for.inc
%minus_count.038 = phi i32 [ %minus_count.1, %for.inc ], [ 0, %entry ]
%zero_count.037 = phi i32 [ %zero_count.1, %for.inc ], [ 0, %entry ]
%i.036 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%min.035 = phi i64 [ %min.1, %for.inc ], [ 1000000000, %entry ]
%sum.034 = phi i64 [ %sum.1, %for.inc ], [ 0, %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 %if.then, label %if.else
if.then: ; preds = %for.body
%add = add nsw i32 %zero_count.037, 1
br label %for.inc
if.else: ; preds = %for.body
%cmp3 = icmp slt i64 %1, 0
br i1 %cmp3, label %if.then4, label %if.else9
if.then4: ; preds = %if.else
%add5 = add nsw i32 %minus_count.038, 1
%mul = sub nsw i64 0, %1
store i64 %mul, ptr %A, align 8, !tbaa !9
%add6 = sub i64 %sum.034, %1
%spec.select = call i64 @llvm.smin.i64(i64 %min.035, i64 %mul)
br label %for.inc
if.else9: ; preds = %if.else
%add10 = add nsw i64 %1, %sum.034
%spec.select32 = call i64 @llvm.smin.i64(i64 %1, i64 %min.035)
br label %for.inc
for.inc: ; preds = %if.else9, %if.then4, %if.then
%sum.1 = phi i64 [ %sum.034, %if.then ], [ %add6, %if.then4 ], [ %add10, %if.else9 ]
%min.1 = phi i64 [ %min.035, %if.then ], [ %spec.select, %if.then4 ], [ %spec.select32, %if.else9 ]
%zero_count.1 = phi i32 [ %add, %if.then ], [ %zero_count.037, %if.then4 ], [ %zero_count.037, %if.else9 ]
%minus_count.1 = phi i32 [ %minus_count.038, %if.then ], [ %add5, %if.then4 ], [ %minus_count.038, %if.else9 ]
%inc = add nuw nsw i32 %i.036, 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 !11
for.end: ; preds = %for.inc
%3 = icmp sgt i32 %zero_count.1, 0
%4 = and i32 %minus_count.1, 1
%5 = icmp eq i32 %4, 0
%6 = select i1 %3, i1 true, i1 %5
br i1 %6, label %if.end23, label %if.else20
if.else20: ; preds = %for.end
%7 = shl nsw i64 %min.1, 1
%sub = sub nsw i64 %sum.1, %7
br label %if.end23
if.end23: ; preds = %for.end, %entry, %if.else20
%sub.sink = phi i64 [ %sub, %if.else20 ], [ %sum.1, %for.end ], [ 0, %entry ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sub.sink)
call void @llvm.lifetime.end.p0(i64 8, 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.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 = !{!"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"}
|
#define ll long long
#define MOD 1000000007
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
typedef struct data {
int a;
int b;
} data;
FILE *in, *ans;
int tno;
int out(const char *s) {
#ifdef TEST
char buf[8192];
fgets(buf, sizeof(buf), ans);
if (strcmp(buf, s)) {
printf("err\n");
}
#else
printf(s);
#endif
return 0;
}
int outi(int i) {
char s[128];
sprintf(s, "%d\n", i);
out(s);
return 0;
}
int outll(ll l) {
char s[128];
sprintf(s, "%lld\n", l);
out(s);
return 0;
}
int geti() {
int i;
fscanf(in, "%d", &i);
return i;
}
ll getll() {
ll l;
fscanf(in, "%lld", &l);
return l;
}
int getstr(char *s) {
fscanf(in, "%s", s);
return 0;
}
int getgcd(int v1, int v2) {
int w;
if (v1 < v2) {
w = v1;
v1 = v2;
v2 = w;
}
while (v2 > 0) {
w = v1 % v2;
v1 = v2;
v2 = w;
}
return v1;
}
int i;
int n;
int fnc() {
n = geti();
int icnt = 0;
int zcnt = 0;
ll sum = 0;
int min = INT_MAX;
for (i = 0; i < n; i++) {
int v = geti();
if (v < 0) {
icnt++;
}
else if (v == 0) {
zcnt++;
}
v = abs(v);
sum += v;
if (min > v) {
min = v;
}
}
if (icnt % 2 == 1) {
if (zcnt == 0) {
sum -= min * 2;
}
}
outll(sum);
return 0;
}
int main() {
#ifdef TEST
for (tno = TEST_SNO; tno <= TEST_ENO; tno++) {
char str[128];
sprintf(str, "test%d.txt", tno);
in = fopen(str, "r");
sprintf(str, "ans%d.txt", tno);
ans = fopen(str, "r");
fnc();
fclose(in);
fclose(ans);
}
printf("end\n");
#else
in = stdin;
fnc();
#endif
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140064/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140064/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"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@in = dso_local local_unnamed_addr global ptr null, align 8
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@n = dso_local local_unnamed_addr global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@stdin = external local_unnamed_addr global ptr, align 8
@ans = dso_local local_unnamed_addr global ptr null, align 8
@tno = dso_local local_unnamed_addr global i32 0, align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @out(ptr nocapture noundef readonly %s) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %s)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @outi(i32 noundef %i) local_unnamed_addr #0 {
entry:
%s = alloca [128 x i8], align 16
call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %s) #8
%call = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i) #8
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %s)
call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %s) #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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; 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 @outll(i64 noundef %l) local_unnamed_addr #0 {
entry:
%s = alloca [128 x i8], align 16
call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %s) #8
%call = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %l) #8
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %s)
call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %s) #8
ret i32 0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @geti() local_unnamed_addr #3 {
entry:
%i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #8
%0 = load ptr, ptr @in, align 8, !tbaa !5
%call = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str.2, ptr noundef nonnull %i) #8
%1 = load i32, ptr %i, align 4, !tbaa !9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #8
ret i32 %1
}
declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #4
; Function Attrs: nounwind uwtable
define dso_local i64 @getll() local_unnamed_addr #3 {
entry:
%l = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %l) #8
%0 = load ptr, ptr @in, align 8, !tbaa !5
%call = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str.3, ptr noundef nonnull %l) #8
%1 = load i64, ptr %l, align 8, !tbaa !11
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %l) #8
ret i64 %1
}
; Function Attrs: nounwind uwtable
define dso_local i32 @getstr(ptr noundef %s) local_unnamed_addr #3 {
entry:
%0 = load ptr, ptr @in, align 8, !tbaa !5
%call = tail call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str.4, ptr noundef %s) #8
ret i32 0
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @getgcd(i32 noundef %v1, i32 noundef %v2) local_unnamed_addr #5 {
entry:
%spec.select = tail call i32 @llvm.smax.i32(i32 %v1, i32 %v2)
%spec.select10 = tail call i32 @llvm.smin.i32(i32 %v1, i32 %v2)
%cmp111 = icmp sgt i32 %spec.select10, 0
br i1 %cmp111, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%v2.addr.113 = phi i32 [ %rem, %while.body ], [ %spec.select10, %entry ]
%v1.addr.112 = phi i32 [ %v2.addr.113, %while.body ], [ %spec.select, %entry ]
%rem = srem i32 %v1.addr.112, %v2.addr.113
%cmp1 = icmp sgt i32 %rem, 0
br i1 %cmp1, label %while.body, label %while.end, !llvm.loop !13
while.end: ; preds = %while.body, %entry
%v1.addr.1.lcssa = phi i32 [ %spec.select, %entry ], [ %v2.addr.113, %while.body ]
ret i32 %v1.addr.1.lcssa
}
; Function Attrs: nounwind uwtable
define dso_local i32 @fnc() local_unnamed_addr #3 {
entry:
%s.i = alloca [128 x i8], align 16
%i.i33 = alloca i32, align 4
%i.i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i) #8
%0 = load ptr, ptr @in, align 8, !tbaa !5
%call.i = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str.2, ptr noundef nonnull %i.i) #8
%1 = load i32, ptr %i.i, align 4, !tbaa !9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i) #8
store i32 %1, ptr @n, align 4, !tbaa !9
store i32 0, ptr @i, align 4, !tbaa !9
%cmp36 = icmp sgt i32 %1, 0
br i1 %cmp36, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%min.040 = phi i32 [ %spec.select32, %for.body ], [ 2147483647, %entry ]
%sum.039 = phi i64 [ %add, %for.body ], [ 0, %entry ]
%zcnt.038 = phi i32 [ %zcnt.1, %for.body ], [ 0, %entry ]
%icnt.037 = phi i32 [ %icnt.1, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i33) #8
%2 = load ptr, ptr @in, align 8, !tbaa !5
%call.i34 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %2, ptr noundef nonnull @.str.2, ptr noundef nonnull %i.i33) #8
%3 = load i32, ptr %i.i33, align 4, !tbaa !9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i33) #8
%cmp3 = icmp eq i32 %3, 0
%.lobit = lshr i32 %3, 31
%icnt.1 = add nuw nsw i32 %.lobit, %icnt.037
%spec.select = zext i1 %cmp3 to i32
%zcnt.1 = add nuw nsw i32 %zcnt.038, %spec.select
%4 = call i32 @llvm.abs.i32(i32 %3, i1 true)
%conv = zext i32 %4 to i64
%add = add nuw nsw i64 %sum.039, %conv
%spec.select32 = call i32 @llvm.smin.i32(i32 %min.040, i32 %4)
%5 = load i32, ptr @i, align 4, !tbaa !9
%inc11 = add nsw i32 %5, 1
store i32 %inc11, ptr @i, align 4, !tbaa !9
%6 = load i32, ptr @n, align 4, !tbaa !9
%cmp = icmp slt i32 %inc11, %6
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !15
for.end.loopexit: ; preds = %for.body
%7 = and i32 %icnt.1, 1
%8 = icmp ne i32 %7, 0
%9 = icmp eq i32 %zcnt.1, 0
%10 = select i1 %8, i1 %9, i1 false
%11 = shl nuw nsw i32 %spec.select32, 1
%12 = zext i32 %11 to i64
%13 = select i1 %10, i64 %12, i64 0
%14 = sub nsw i64 %add, %13
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%sum.1 = phi i64 [ 0, %entry ], [ %14, %for.end.loopexit ]
call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %s.i) #8
%call.i35 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %s.i, ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sum.1) #8
%call.i.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %s.i)
call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %s.i) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
store ptr %0, ptr @in, align 8, !tbaa !5
%call = tail call i32 @fnc()
ret i32 0
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #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 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "no-trapping-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(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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
|
#include<stdio.h>
void quick(long *,int,int);
int main(){
long X=0,Y=0,ans=0;
int N;
scanf("%d",&N);
long A[N];
for (int i = 0; i < N; i++)
{
scanf("%ld",&A[i]);
}
quick(A,0,N-1);
for (int i = N-1; i > 0; i--)
{
if (A[i]==A[i-1])
{
int j=0;
while (A[i]==A[i-1]){i--;j++;}
if (j>2&&X==0)
{
ans=A[i]*A[i];
break;
}else{
if (X>0)
{
Y=A[i];
ans=X*Y;
break;
}else{
X=A[i];
}
}
}
}
printf("%ld",ans);
return 0;
}
void quick(long a[],int left,int right)
{
int s,t,i,j;
if (left<right){
s=a[left];
i=left; j=right+1;
while (1){
while (a[++i]<s);
while (a[--j]>s);
if (i>=j) break;
t=a[i]; a[i]=a[j]; a[j]=t;
}
a[left]=a[j]; a[j]=s;
quick(a,left,j-1);
quick(a,j+1,right);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140107/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140107/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"%ld\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
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp71 = icmp sgt i32 %3, 0
br i1 %cmp71, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
%sub85 = add nsw i32 %3, -1
call void @quick(ptr noundef nonnull %vla, i32 noundef 0, i32 noundef %sub85)
br label %cleanup40
for.cond.cleanup: ; preds = %for.body
%sub = add nsw i32 %4, -1
call void @quick(ptr noundef nonnull %vla, i32 noundef 0, i32 noundef %sub)
%cmp573 = icmp sgt i32 %4, 1
br i1 %cmp573, label %for.body7, label %cleanup40
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
%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
%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.cond.cleanup, !llvm.loop !9
for.body7: ; preds = %for.cond.cleanup, %for.inc38
%i2.0.in75 = phi i32 [ %i2.2, %for.inc38 ], [ %4, %for.cond.cleanup ]
%X.074 = phi i64 [ %X.2, %for.inc38 ], [ 0, %for.cond.cleanup ]
%i2.0 = add nsw i32 %i2.0.in75, -1
%idxprom8 = zext i32 %i2.0 to i64
%arrayidx9 = getelementptr inbounds i64, ptr %vla, i64 %idxprom8
%6 = load i64, ptr %arrayidx9, align 8, !tbaa !11
%sub10 = add nsw i32 %i2.0.in75, -2
%idxprom11 = zext i32 %sub10 to i64
%arrayidx12 = getelementptr inbounds i64, ptr %vla, i64 %idxprom11
%7 = load i64, ptr %arrayidx12, align 8, !tbaa !11
%cmp13 = icmp eq i64 %6, %7
br i1 %cmp13, label %while.cond.preheader, label %for.inc38
while.cond.preheader: ; preds = %for.body7
%8 = zext i32 %i2.0.in75 to i64
%9 = add nsw i64 %8, -1
%arrayidx15.phi.trans.insert = getelementptr inbounds i64, ptr %vla, i64 %9
%.pre = load i64, ptr %arrayidx15.phi.trans.insert, align 8, !tbaa !11
br label %while.cond
while.cond: ; preds = %while.cond.preheader, %while.cond
%indvars.iv81 = phi i64 [ %9, %while.cond.preheader ], [ %indvars.iv.next82, %while.cond ]
%j.0 = phi i32 [ 0, %while.cond.preheader ], [ %inc20, %while.cond ]
%indvars.iv.next82 = add i64 %indvars.iv81, -1
%arrayidx18 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv.next82
%10 = load i64, ptr %arrayidx18, align 8, !tbaa !11
%cmp19 = icmp eq i64 %.pre, %10
%inc20 = add nuw nsw i32 %j.0, 1
br i1 %cmp19, label %while.cond, label %while.end, !llvm.loop !13
while.end: ; preds = %while.cond
%cmp21 = icmp ugt i32 %j.0, 2
%cmp22 = icmp eq i64 %X.074, 0
%or.cond = select i1 %cmp21, i1 %cmp22, i1 false
br i1 %or.cond, label %if.then23, label %if.else
if.then23: ; preds = %while.end
%mul = mul nsw i64 %.pre, %.pre
br label %cleanup40
if.else: ; preds = %while.end
%11 = trunc i64 %indvars.iv81 to i32
%cmp28 = icmp sgt i64 %X.074, 0
br i1 %cmp28, label %if.then29, label %for.inc38
if.then29: ; preds = %if.else
%mul32 = mul nsw i64 %.pre, %X.074
br label %cleanup40
for.inc38: ; preds = %if.else, %for.body7
%X.2 = phi i64 [ %X.074, %for.body7 ], [ %.pre, %if.else ]
%i2.2 = phi i32 [ %i2.0, %for.body7 ], [ %11, %if.else ]
%cmp5 = icmp sgt i32 %i2.2, 1
br i1 %cmp5, label %for.body7, label %cleanup40, !llvm.loop !14
cleanup40: ; preds = %for.inc38, %for.cond.cleanup.thread, %for.cond.cleanup, %if.then29, %if.then23
%ans.3 = phi i64 [ %mul32, %if.then29 ], [ %mul, %if.then23 ], [ 0, %for.cond.cleanup ], [ 0, %for.cond.cleanup.thread ], [ 0, %for.inc38 ]
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.3)
call void @llvm.stackrestore.p0(ptr %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) #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 nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @quick(ptr nocapture noundef %a, i32 noundef %left, i32 noundef %right) local_unnamed_addr #4 {
entry:
%cmp70 = icmp slt i32 %left, %right
br i1 %cmp70, label %if.then.lr.ph, label %if.end38
if.then.lr.ph: ; preds = %entry
%add = add nsw i32 %right, 1
br label %if.then
if.then: ; preds = %if.then.lr.ph, %while.end29
%left.tr71 = phi i32 [ %left, %if.then.lr.ph ], [ %7, %while.end29 ]
%idxprom = sext i32 %left.tr71 to i64
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %idxprom
%0 = load i64, ptr %arrayidx, align 8, !tbaa !11
%sext = shl i64 %0, 32
%conv4 = ashr exact i64 %sext, 32
br label %while.cond
while.cond: ; preds = %if.end, %if.then
%i.0 = phi i32 [ %left.tr71, %if.then ], [ %3, %if.end ]
%j.0 = phi i32 [ %add, %if.then ], [ %6, %if.end ]
%1 = sext i32 %i.0 to i64
br label %while.cond1
while.cond1: ; preds = %while.cond1, %while.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond1 ], [ %1, %while.cond ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%arrayidx3 = getelementptr inbounds i64, ptr %a, i64 %indvars.iv.next
%2 = load i64, ptr %arrayidx3, align 8, !tbaa !11
%cmp5 = icmp slt i64 %2, %conv4
br i1 %cmp5, label %while.cond1, label %while.cond8.preheader, !llvm.loop !15
while.cond8.preheader: ; preds = %while.cond1
%arrayidx3.le = getelementptr inbounds i64, ptr %a, i64 %indvars.iv.next
%3 = trunc i64 %indvars.iv.next to i32
%4 = sext i32 %j.0 to i64
br label %while.cond8
while.cond8: ; preds = %while.cond8.preheader, %while.cond8
%indvars.iv74 = phi i64 [ %4, %while.cond8.preheader ], [ %indvars.iv.next75, %while.cond8 ]
%indvars.iv.next75 = add i64 %indvars.iv74, -1
%arrayidx10 = getelementptr inbounds i64, ptr %a, i64 %indvars.iv.next75
%5 = load i64, ptr %arrayidx10, align 8, !tbaa !11
%cmp12 = icmp sgt i64 %5, %conv4
br i1 %cmp12, label %while.cond8, label %while.end15, !llvm.loop !16
while.end15: ; preds = %while.cond8
%arrayidx10.le = getelementptr inbounds i64, ptr %a, i64 %indvars.iv.next75
%6 = trunc i64 %indvars.iv.next75 to i32
%cmp16.not = icmp slt i32 %3, %6
br i1 %cmp16.not, label %if.end, label %while.end29
if.end: ; preds = %while.end15
store i64 %5, ptr %arrayidx3.le, align 8, !tbaa !11
%sext68 = shl i64 %2, 32
%conv26 = ashr exact i64 %sext68, 32
store i64 %conv26, ptr %arrayidx10.le, align 8, !tbaa !11
br label %while.cond
while.end29: ; preds = %while.end15
%7 = trunc i64 %indvars.iv74 to i32
store i64 %5, ptr %arrayidx, align 8, !tbaa !11
store i64 %conv4, ptr %arrayidx10.le, align 8, !tbaa !11
%sub = add nsw i32 %7, -2
tail call void @quick(ptr noundef nonnull %a, i32 noundef %left.tr71, i32 noundef %sub)
%cmp = icmp slt i32 %7, %right
br i1 %cmp, label %if.then, label %if.end38
if.end38: ; preds = %while.end29, %entry
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
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 = { nofree nosync nounwind 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 #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 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i, W, H, N, x[101], y[101], a[101];
scanf("%d %d %d", &W, &H, &N);
for (i = 1; i <= N; i++) scanf("%d %d %d", &(x[i]), &(y[i]), &(a[i]));
int left = 0, right = W, bottom = 0, top = H;
for (i = 1; i <= N; i++) {
switch (a[i]) {
case 1:
if (x[i] > left) left = x[i];
break;
case 2:
if (x[i] < right) right = x[i];
break;
case 3:
if (y[i] > bottom) bottom = y[i];
break;
case 4:
if (y[i] < top) top = y[i];
}
}
int area = (right - left > 0 && top - bottom > 0)? (right - left) * (top - bottom): 0;
printf("%d\n", area);
fflush(stdout);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140158/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140158/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 [4 x i8] c"%d\0A\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%W = alloca i32, align 4
%H = alloca i32, align 4
%N = alloca i32, align 4
%x = alloca [101 x i32], align 16
%y = alloca [101 x i32], align 16
%a = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %y) #4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %W, ptr noundef nonnull %H, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not80 = icmp slt i32 %0, 1
br i1 %cmp.not80, label %for.end.thread, label %for.body
for.end.thread: ; preds = %entry
%1 = load i32, ptr %W, align 4, !tbaa !5
%2 = load i32, ptr %H, align 4, !tbaa !5
br label %for.end42
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [101 x i32], ptr %x, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [101 x i32], ptr %y, i64 0, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx4)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %4
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%5 = load i32, ptr %W, align 4, !tbaa !5
%6 = load i32, ptr %H, align 4, !tbaa !5
%cmp7.not82 = icmp slt i32 %3, 1
br i1 %cmp7.not82, label %for.end42, label %for.body8.preheader
for.body8.preheader: ; preds = %for.end
%7 = add nuw i32 %3, 1
%wide.trip.count = zext i32 %7 to i64
br label %for.body8
for.body8: ; preds = %for.body8.preheader, %for.inc40
%indvars.iv94 = phi i64 [ 1, %for.body8.preheader ], [ %indvars.iv.next95, %for.inc40 ]
%top.086 = phi i32 [ %6, %for.body8.preheader ], [ %top.1, %for.inc40 ]
%bottom.085 = phi i32 [ 0, %for.body8.preheader ], [ %bottom.1, %for.inc40 ]
%right.084 = phi i32 [ %5, %for.body8.preheader ], [ %right.1, %for.inc40 ]
%left.083 = phi i32 [ 0, %for.body8.preheader ], [ %left.1, %for.inc40 ]
%arrayidx10 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv94
%8 = load i32, ptr %arrayidx10, align 4, !tbaa !5
switch i32 %8, label %for.inc40 [
i32 1, label %sw.bb
i32 2, label %sw.bb16
i32 3, label %sw.bb24
i32 4, label %sw.bb32
]
sw.bb: ; preds = %for.body8
%arrayidx12 = getelementptr inbounds [101 x i32], ptr %x, i64 0, i64 %indvars.iv94
%9 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %9, i32 %left.083)
br label %for.inc40
sw.bb16: ; preds = %for.body8
%arrayidx18 = getelementptr inbounds [101 x i32], ptr %x, i64 0, i64 %indvars.iv94
%10 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%spec.select76 = call i32 @llvm.smin.i32(i32 %10, i32 %right.084)
br label %for.inc40
sw.bb24: ; preds = %for.body8
%arrayidx26 = getelementptr inbounds [101 x i32], ptr %y, i64 0, i64 %indvars.iv94
%11 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%spec.select77 = call i32 @llvm.smax.i32(i32 %11, i32 %bottom.085)
br label %for.inc40
sw.bb32: ; preds = %for.body8
%arrayidx34 = getelementptr inbounds [101 x i32], ptr %y, i64 0, i64 %indvars.iv94
%12 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%spec.select78 = call i32 @llvm.smin.i32(i32 %12, i32 %top.086)
br label %for.inc40
for.inc40: ; preds = %sw.bb32, %sw.bb24, %sw.bb16, %sw.bb, %for.body8
%left.1 = phi i32 [ %left.083, %for.body8 ], [ %spec.select, %sw.bb ], [ %left.083, %sw.bb16 ], [ %left.083, %sw.bb24 ], [ %left.083, %sw.bb32 ]
%right.1 = phi i32 [ %right.084, %for.body8 ], [ %right.084, %sw.bb ], [ %spec.select76, %sw.bb16 ], [ %right.084, %sw.bb24 ], [ %right.084, %sw.bb32 ]
%bottom.1 = phi i32 [ %bottom.085, %for.body8 ], [ %bottom.085, %sw.bb ], [ %bottom.085, %sw.bb16 ], [ %spec.select77, %sw.bb24 ], [ %bottom.085, %sw.bb32 ]
%top.1 = phi i32 [ %top.086, %for.body8 ], [ %top.086, %sw.bb ], [ %top.086, %sw.bb16 ], [ %top.086, %sw.bb24 ], [ %spec.select78, %sw.bb32 ]
%indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
%exitcond.not = icmp eq i64 %indvars.iv.next95, %wide.trip.count
br i1 %exitcond.not, label %for.end42, label %for.body8, !llvm.loop !11
for.end42: ; preds = %for.inc40, %for.end.thread, %for.end
%left.0.lcssa = phi i32 [ 0, %for.end ], [ 0, %for.end.thread ], [ %left.1, %for.inc40 ]
%right.0.lcssa = phi i32 [ %5, %for.end ], [ %1, %for.end.thread ], [ %right.1, %for.inc40 ]
%bottom.0.lcssa = phi i32 [ 0, %for.end ], [ 0, %for.end.thread ], [ %bottom.1, %for.inc40 ]
%top.0.lcssa = phi i32 [ %6, %for.end ], [ %2, %for.end.thread ], [ %top.1, %for.inc40 ]
%sub = sub nsw i32 %right.0.lcssa, %left.0.lcssa
%cmp43 = icmp sgt i32 %sub, 0
%sub44 = sub nsw i32 %top.0.lcssa, %bottom.0.lcssa
%cmp45 = icmp sgt i32 %sub44, 0
%mul = mul nsw i32 %sub44, %sub
%13 = select i1 %cmp43, i1 %cmp45, i1 false
%cond = select i1 %13, i32 %mul, i32 0
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cond)
%14 = load ptr, ptr @stdout, align 8, !tbaa !12
%call49 = call i32 @fflush(ptr noundef %14)
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #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: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
; 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}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
|
#include <stdio.h>
int main() {
int i, j, k, height, width, number_n, point_x, point_y, flag, count = 0;
scanf("%d %d %d", &width, &height, &number_n);
int picture[height][width];
for(i = 0; i < height; i++) {
for(j = 0; j < width; j++) {
picture[i][j] = 1;
}
}
for(i = 0; i < number_n; i++) {
scanf("%d %d %d", &point_x, &point_y, &flag);
if(flag == 1) {
for(j = 0; j < height; j++) {
for(k = 0; k < point_x; k++) {
picture[j][k] = 0;
}
}
} else if(flag == 2) {
for(j = 0; j < height; j++) {
for(k = point_x; k < width; k++) {
picture[j][k] = 0;
}
}
} else if(flag == 3) {
for(j = 0; j < point_y; j++) {
for(k = 0; k < width; k++) {
picture[j][k] = 0;
}
}
} else if(flag == 4) {
for(j = point_y; j < height; j++) {
for(k = 0; k < width; k++) {
picture[j][k] = 0;
}
}
}
}
for(i = 0; i < height; i++) {
for(j = 0; j < width; j++) {
count += picture[i][j];
}
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140200/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140200/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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%height = alloca i32, align 4
%width = alloca i32, align 4
%number_n = alloca i32, align 4
%point_x = alloca i32, align 4
%point_y = alloca i32, align 4
%flag = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %height) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %width) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %number_n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %point_x) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %point_y) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %flag) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %width, ptr noundef nonnull %height, ptr noundef nonnull %number_n)
%0 = load i32, ptr %height, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = load i32, ptr %width, align 4, !tbaa !5
%3 = zext i32 %2 to i64
%4 = call ptr @llvm.stacksave.p0()
%5 = mul nuw i64 %3, %1
%vla = alloca i32, i64 %5, align 16
%6 = load i32, ptr %height, align 4, !tbaa !5
%cmp150 = icmp sgt i32 %6, 0
br i1 %cmp150, label %for.cond1.preheader.lr.ph, label %for.cond9.preheader
for.cond1.preheader.lr.ph: ; preds = %entry
%7 = load i32, ptr %width, align 4, !tbaa !5
%cmp2148 = icmp sgt i32 %7, 0
br i1 %cmp2148, label %for.cond1.preheader.us.preheader, label %for.cond9.preheader
for.cond1.preheader.us.preheader: ; preds = %for.cond1.preheader.lr.ph
%wide.trip.count190 = zext i32 %6 to i64
%wide.trip.count = zext i32 %7 to i64
%min.iters.check = icmp ult i32 %7, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us
%indvars.iv187 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next188, %for.cond1.for.inc6_crit_edge.us ]
%8 = mul nuw nsw i64 %indvars.iv187, %3
%arrayidx.us = getelementptr inbounds i32, ptr %vla, i64 %8
br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body
vector.body: ; preds = %for.cond1.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ]
%9 = getelementptr inbounds i32, ptr %arrayidx.us, i64 %index
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 4, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, 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 !9
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader
for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body3.us
for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ]
%arrayidx5.us = getelementptr inbounds i32, ptr %arrayidx.us, i64 %indvars.iv
store i32 1, ptr %arrayidx5.us, 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.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !13
for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block
%indvars.iv.next188 = add nuw nsw i64 %indvars.iv187, 1
%exitcond191.not = icmp eq i64 %indvars.iv.next188, %wide.trip.count190
br i1 %exitcond191.not, label %for.cond9.preheader, label %for.cond1.preheader.us, !llvm.loop !14
for.cond9.preheader: ; preds = %for.cond1.for.inc6_crit_edge.us, %for.cond1.preheader.lr.ph, %entry
%12 = load i32, ptr %number_n, align 4, !tbaa !5
%cmp10168 = icmp sgt i32 %12, 0
br i1 %cmp10168, label %for.body11.preheader, label %for.cond92.preheader
for.body11.preheader: ; preds = %for.cond9.preheader
%13 = shl nuw nsw i64 %3, 2
br label %for.body11
for.cond92.preheader.loopexit: ; preds = %for.inc89
%.pre = load i32, ptr %height, align 4, !tbaa !5
br label %for.cond92.preheader
for.cond92.preheader: ; preds = %for.cond92.preheader.loopexit, %for.cond9.preheader
%14 = phi i32 [ %.pre, %for.cond92.preheader.loopexit ], [ %6, %for.cond9.preheader ]
%cmp93173 = icmp sgt i32 %14, 0
br i1 %cmp93173, label %for.cond95.preheader.lr.ph, label %for.end107
for.cond95.preheader.lr.ph: ; preds = %for.cond92.preheader
%15 = load i32, ptr %width, align 4, !tbaa !5
%cmp96170 = icmp sgt i32 %15, 0
br i1 %cmp96170, label %for.cond95.preheader.us.preheader, label %for.end107
for.cond95.preheader.us.preheader: ; preds = %for.cond95.preheader.lr.ph
%wide.trip.count231 = zext i32 %14 to i64
%wide.trip.count226 = zext i32 %15 to i64
%min.iters.check241 = icmp ult i32 %15, 8
%n.vec244 = and i64 %wide.trip.count226, 4294967288
%cmp.n246 = icmp eq i64 %n.vec244, %wide.trip.count226
br label %for.cond95.preheader.us
for.cond95.preheader.us: ; preds = %for.cond95.preheader.us.preheader, %for.cond95.for.inc105_crit_edge.us
%indvars.iv228 = phi i64 [ 0, %for.cond95.preheader.us.preheader ], [ %indvars.iv.next229, %for.cond95.for.inc105_crit_edge.us ]
%count.0174.us = phi i32 [ 0, %for.cond95.preheader.us.preheader ], [ %add.us.lcssa, %for.cond95.for.inc105_crit_edge.us ]
%16 = mul nuw nsw i64 %indvars.iv228, %3
%arrayidx99.us = getelementptr inbounds i32, ptr %vla, i64 %16
br i1 %min.iters.check241, label %for.body97.us.preheader, label %vector.ph242
vector.ph242: ; preds = %for.cond95.preheader.us
%17 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.0174.us, i64 0
br label %vector.body247
vector.body247: ; preds = %vector.body247, %vector.ph242
%index248 = phi i64 [ 0, %vector.ph242 ], [ %index.next251, %vector.body247 ]
%vec.phi = phi <4 x i32> [ %17, %vector.ph242 ], [ %20, %vector.body247 ]
%vec.phi249 = phi <4 x i32> [ zeroinitializer, %vector.ph242 ], [ %21, %vector.body247 ]
%18 = getelementptr inbounds i32, ptr %arrayidx99.us, i64 %index248
%wide.load = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds i32, ptr %18, i64 4
%wide.load250 = load <4 x i32>, ptr %19, align 4, !tbaa !5
%20 = add <4 x i32> %wide.load, %vec.phi
%21 = add <4 x i32> %wide.load250, %vec.phi249
%index.next251 = add nuw i64 %index248, 8
%22 = icmp eq i64 %index.next251, %n.vec244
br i1 %22, label %middle.block239, label %vector.body247, !llvm.loop !15
middle.block239: ; preds = %vector.body247
%bin.rdx = add <4 x i32> %21, %20
%23 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n246, label %for.cond95.for.inc105_crit_edge.us, label %for.body97.us.preheader
for.body97.us.preheader: ; preds = %for.cond95.preheader.us, %middle.block239
%indvars.iv223.ph = phi i64 [ 0, %for.cond95.preheader.us ], [ %n.vec244, %middle.block239 ]
%count.1171.us.ph = phi i32 [ %count.0174.us, %for.cond95.preheader.us ], [ %23, %middle.block239 ]
br label %for.body97.us
for.body97.us: ; preds = %for.body97.us.preheader, %for.body97.us
%indvars.iv223 = phi i64 [ %indvars.iv.next224, %for.body97.us ], [ %indvars.iv223.ph, %for.body97.us.preheader ]
%count.1171.us = phi i32 [ %add.us, %for.body97.us ], [ %count.1171.us.ph, %for.body97.us.preheader ]
%arrayidx101.us = getelementptr inbounds i32, ptr %arrayidx99.us, i64 %indvars.iv223
%24 = load i32, ptr %arrayidx101.us, align 4, !tbaa !5
%add.us = add nsw i32 %24, %count.1171.us
%indvars.iv.next224 = add nuw nsw i64 %indvars.iv223, 1
%exitcond227.not = icmp eq i64 %indvars.iv.next224, %wide.trip.count226
br i1 %exitcond227.not, label %for.cond95.for.inc105_crit_edge.us, label %for.body97.us, !llvm.loop !16
for.cond95.for.inc105_crit_edge.us: ; preds = %for.body97.us, %middle.block239
%add.us.lcssa = phi i32 [ %23, %middle.block239 ], [ %add.us, %for.body97.us ]
%indvars.iv.next229 = add nuw nsw i64 %indvars.iv228, 1
%exitcond232.not = icmp eq i64 %indvars.iv.next229, %wide.trip.count231
br i1 %exitcond232.not, label %for.end107, label %for.cond95.preheader.us, !llvm.loop !17
for.body11: ; preds = %for.body11.preheader, %for.inc89
%i.1169 = phi i32 [ %inc90, %for.inc89 ], [ 0, %for.body11.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %point_x, ptr noundef nonnull %point_y, ptr noundef nonnull %flag)
%25 = load i32, ptr %flag, align 4, !tbaa !5
switch i32 %25, label %for.inc89 [
i32 1, label %for.cond14.preheader
i32 2, label %for.cond32.preheader
i32 3, label %for.cond51.preheader
i32 4, label %if.then69
]
for.cond51.preheader: ; preds = %for.body11
%26 = load i32, ptr %point_y, align 4, !tbaa !5
%cmp52158 = icmp sgt i32 %26, 0
br i1 %cmp52158, label %for.cond54.preheader.lr.ph, label %for.inc89
for.cond54.preheader.lr.ph: ; preds = %for.cond51.preheader
%27 = load i32, ptr %width, align 4, !tbaa !5
%cmp55156 = icmp sgt i32 %27, 0
br i1 %cmp55156, label %for.cond54.preheader.us.preheader, label %for.inc89
for.cond54.preheader.us.preheader: ; preds = %for.cond54.preheader.lr.ph
%28 = zext i32 %27 to i64
%29 = shl nuw nsw i64 %28, 2
%wide.trip.count203 = zext i32 %26 to i64
%xtraiter257 = and i64 %wide.trip.count203, 7
%30 = icmp ult i32 %26, 8
br i1 %30, label %for.inc89.loopexit255.unr-lcssa, label %for.cond54.preheader.us.preheader.new
for.cond54.preheader.us.preheader.new: ; preds = %for.cond54.preheader.us.preheader
%unroll_iter260 = and i64 %wide.trip.count203, 4294967288
br label %for.cond54.preheader.us
for.cond54.preheader.us: ; preds = %for.cond54.preheader.us, %for.cond54.preheader.us.preheader.new
%indvar196 = phi i64 [ 0, %for.cond54.preheader.us.preheader.new ], [ %indvar.next197.7, %for.cond54.preheader.us ]
%niter261 = phi i64 [ 0, %for.cond54.preheader.us.preheader.new ], [ %niter261.next.7, %for.cond54.preheader.us ]
%31 = mul nuw nsw i64 %13, %indvar196
%scevgep198 = getelementptr i8, ptr %vla, i64 %31
call void @llvm.memset.p0.i64(ptr align 16 %scevgep198, i8 0, i64 %29, i1 false), !tbaa !5
%indvar.next197 = or i64 %indvar196, 1
%32 = mul nuw nsw i64 %13, %indvar.next197
%scevgep198.1 = getelementptr i8, ptr %vla, i64 %32
call void @llvm.memset.p0.i64(ptr align 4 %scevgep198.1, i8 0, i64 %29, i1 false), !tbaa !5
%indvar.next197.1 = or i64 %indvar196, 2
%33 = mul nuw nsw i64 %13, %indvar.next197.1
%scevgep198.2 = getelementptr i8, ptr %vla, i64 %33
call void @llvm.memset.p0.i64(ptr align 8 %scevgep198.2, i8 0, i64 %29, i1 false), !tbaa !5
%indvar.next197.2 = or i64 %indvar196, 3
%34 = mul nuw nsw i64 %13, %indvar.next197.2
%scevgep198.3 = getelementptr i8, ptr %vla, i64 %34
call void @llvm.memset.p0.i64(ptr align 4 %scevgep198.3, i8 0, i64 %29, i1 false), !tbaa !5
%indvar.next197.3 = or i64 %indvar196, 4
%35 = mul nuw nsw i64 %13, %indvar.next197.3
%scevgep198.4 = getelementptr i8, ptr %vla, i64 %35
call void @llvm.memset.p0.i64(ptr align 16 %scevgep198.4, i8 0, i64 %29, i1 false), !tbaa !5
%indvar.next197.4 = or i64 %indvar196, 5
%36 = mul nuw nsw i64 %13, %indvar.next197.4
%scevgep198.5 = getelementptr i8, ptr %vla, i64 %36
call void @llvm.memset.p0.i64(ptr align 4 %scevgep198.5, i8 0, i64 %29, i1 false), !tbaa !5
%indvar.next197.5 = or i64 %indvar196, 6
%37 = mul nuw nsw i64 %13, %indvar.next197.5
%scevgep198.6 = getelementptr i8, ptr %vla, i64 %37
call void @llvm.memset.p0.i64(ptr align 8 %scevgep198.6, i8 0, i64 %29, i1 false), !tbaa !5
%indvar.next197.6 = or i64 %indvar196, 7
%38 = mul nuw nsw i64 %13, %indvar.next197.6
%scevgep198.7 = getelementptr i8, ptr %vla, i64 %38
call void @llvm.memset.p0.i64(ptr align 4 %scevgep198.7, i8 0, i64 %29, i1 false), !tbaa !5
%indvar.next197.7 = add nuw nsw i64 %indvar196, 8
%niter261.next.7 = add i64 %niter261, 8
%niter261.ncmp.7 = icmp eq i64 %niter261.next.7, %unroll_iter260
br i1 %niter261.ncmp.7, label %for.inc89.loopexit255.unr-lcssa, label %for.cond54.preheader.us, !llvm.loop !18
for.cond32.preheader: ; preds = %for.body11
%39 = load i32, ptr %height, align 4, !tbaa !5
%cmp33162 = icmp sgt i32 %39, 0
br i1 %cmp33162, label %for.body34.lr.ph, label %for.inc89
for.body34.lr.ph: ; preds = %for.cond32.preheader
%40 = load i32, ptr %point_x, align 4, !tbaa !5
%41 = load i32, ptr %width, align 4, !tbaa !5
%cmp36160 = icmp slt i32 %40, %41
br i1 %cmp36160, label %for.body34.us.preheader, label %for.inc89
for.body34.us.preheader: ; preds = %for.body34.lr.ph
%42 = sext i32 %40 to i64
%43 = shl nsw i64 %42, 2
%44 = xor i32 %40, -1
%45 = add i32 %41, %44
%46 = zext i32 %45 to i64
%47 = shl nuw nsw i64 %46, 2
%48 = add nuw nsw i64 %47, 4
%wide.trip.count212 = zext i32 %39 to i64
%49 = getelementptr i8, ptr %vla, i64 %43
%xtraiter262 = and i64 %wide.trip.count212, 7
%50 = icmp ult i32 %39, 8
br i1 %50, label %for.inc89.loopexit254.unr-lcssa, label %for.body34.us.preheader.new
for.body34.us.preheader.new: ; preds = %for.body34.us.preheader
%unroll_iter265 = and i64 %wide.trip.count212, 4294967288
br label %for.body34.us
for.body34.us: ; preds = %for.body34.us, %for.body34.us.preheader.new
%indvar205 = phi i64 [ 0, %for.body34.us.preheader.new ], [ %indvar.next206.7, %for.body34.us ]
%niter266 = phi i64 [ 0, %for.body34.us.preheader.new ], [ %niter266.next.7, %for.body34.us ]
%51 = mul nuw nsw i64 %13, %indvar205
%scevgep207 = getelementptr i8, ptr %49, i64 %51
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep207, i8 0, i64 %48, i1 false), !tbaa !5
%indvar.next206 = or i64 %indvar205, 1
%52 = mul nuw nsw i64 %13, %indvar.next206
%scevgep207.1 = getelementptr i8, ptr %49, i64 %52
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep207.1, i8 0, i64 %48, i1 false), !tbaa !5
%indvar.next206.1 = or i64 %indvar205, 2
%53 = mul nuw nsw i64 %13, %indvar.next206.1
%scevgep207.2 = getelementptr i8, ptr %49, i64 %53
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep207.2, i8 0, i64 %48, i1 false), !tbaa !5
%indvar.next206.2 = or i64 %indvar205, 3
%54 = mul nuw nsw i64 %13, %indvar.next206.2
%scevgep207.3 = getelementptr i8, ptr %49, i64 %54
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep207.3, i8 0, i64 %48, i1 false), !tbaa !5
%indvar.next206.3 = or i64 %indvar205, 4
%55 = mul nuw nsw i64 %13, %indvar.next206.3
%scevgep207.4 = getelementptr i8, ptr %49, i64 %55
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep207.4, i8 0, i64 %48, i1 false), !tbaa !5
%indvar.next206.4 = or i64 %indvar205, 5
%56 = mul nuw nsw i64 %13, %indvar.next206.4
%scevgep207.5 = getelementptr i8, ptr %49, i64 %56
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep207.5, i8 0, i64 %48, i1 false), !tbaa !5
%indvar.next206.5 = or i64 %indvar205, 6
%57 = mul nuw nsw i64 %13, %indvar.next206.5
%scevgep207.6 = getelementptr i8, ptr %49, i64 %57
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep207.6, i8 0, i64 %48, i1 false), !tbaa !5
%indvar.next206.6 = or i64 %indvar205, 7
%58 = mul nuw nsw i64 %13, %indvar.next206.6
%scevgep207.7 = getelementptr i8, ptr %49, i64 %58
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep207.7, i8 0, i64 %48, i1 false), !tbaa !5
%indvar.next206.7 = add nuw nsw i64 %indvar205, 8
%niter266.next.7 = add i64 %niter266, 8
%niter266.ncmp.7 = icmp eq i64 %niter266.next.7, %unroll_iter265
br i1 %niter266.ncmp.7, label %for.inc89.loopexit254.unr-lcssa, label %for.body34.us, !llvm.loop !19
for.cond14.preheader: ; preds = %for.body11
%59 = load i32, ptr %height, align 4, !tbaa !5
%cmp15166 = icmp sgt i32 %59, 0
br i1 %cmp15166, label %for.cond17.preheader.lr.ph, label %for.inc89
for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader
%60 = load i32, ptr %point_x, align 4, !tbaa !5
%cmp18164 = icmp sgt i32 %60, 0
br i1 %cmp18164, label %for.cond17.preheader.us.preheader, label %for.inc89
for.cond17.preheader.us.preheader: ; preds = %for.cond17.preheader.lr.ph
%61 = zext i32 %60 to i64
%62 = shl nuw nsw i64 %61, 2
%wide.trip.count221 = zext i32 %59 to i64
%xtraiter267 = and i64 %wide.trip.count221, 7
%63 = icmp ult i32 %59, 8
br i1 %63, label %for.inc89.loopexit.unr-lcssa, label %for.cond17.preheader.us.preheader.new
for.cond17.preheader.us.preheader.new: ; preds = %for.cond17.preheader.us.preheader
%unroll_iter270 = and i64 %wide.trip.count221, 4294967288
br label %for.cond17.preheader.us
for.cond17.preheader.us: ; preds = %for.cond17.preheader.us, %for.cond17.preheader.us.preheader.new
%indvar214 = phi i64 [ 0, %for.cond17.preheader.us.preheader.new ], [ %indvar.next215.7, %for.cond17.preheader.us ]
%niter271 = phi i64 [ 0, %for.cond17.preheader.us.preheader.new ], [ %niter271.next.7, %for.cond17.preheader.us ]
%64 = mul nuw nsw i64 %13, %indvar214
%scevgep216 = getelementptr i8, ptr %vla, i64 %64
call void @llvm.memset.p0.i64(ptr align 16 %scevgep216, i8 0, i64 %62, i1 false), !tbaa !5
%indvar.next215 = or i64 %indvar214, 1
%65 = mul nuw nsw i64 %13, %indvar.next215
%scevgep216.1 = getelementptr i8, ptr %vla, i64 %65
call void @llvm.memset.p0.i64(ptr align 4 %scevgep216.1, i8 0, i64 %62, i1 false), !tbaa !5
%indvar.next215.1 = or i64 %indvar214, 2
%66 = mul nuw nsw i64 %13, %indvar.next215.1
%scevgep216.2 = getelementptr i8, ptr %vla, i64 %66
call void @llvm.memset.p0.i64(ptr align 8 %scevgep216.2, i8 0, i64 %62, i1 false), !tbaa !5
%indvar.next215.2 = or i64 %indvar214, 3
%67 = mul nuw nsw i64 %13, %indvar.next215.2
%scevgep216.3 = getelementptr i8, ptr %vla, i64 %67
call void @llvm.memset.p0.i64(ptr align 4 %scevgep216.3, i8 0, i64 %62, i1 false), !tbaa !5
%indvar.next215.3 = or i64 %indvar214, 4
%68 = mul nuw nsw i64 %13, %indvar.next215.3
%scevgep216.4 = getelementptr i8, ptr %vla, i64 %68
call void @llvm.memset.p0.i64(ptr align 16 %scevgep216.4, i8 0, i64 %62, i1 false), !tbaa !5
%indvar.next215.4 = or i64 %indvar214, 5
%69 = mul nuw nsw i64 %13, %indvar.next215.4
%scevgep216.5 = getelementptr i8, ptr %vla, i64 %69
call void @llvm.memset.p0.i64(ptr align 4 %scevgep216.5, i8 0, i64 %62, i1 false), !tbaa !5
%indvar.next215.5 = or i64 %indvar214, 6
%70 = mul nuw nsw i64 %13, %indvar.next215.5
%scevgep216.6 = getelementptr i8, ptr %vla, i64 %70
call void @llvm.memset.p0.i64(ptr align 8 %scevgep216.6, i8 0, i64 %62, i1 false), !tbaa !5
%indvar.next215.6 = or i64 %indvar214, 7
%71 = mul nuw nsw i64 %13, %indvar.next215.6
%scevgep216.7 = getelementptr i8, ptr %vla, i64 %71
call void @llvm.memset.p0.i64(ptr align 4 %scevgep216.7, i8 0, i64 %62, i1 false), !tbaa !5
%indvar.next215.7 = add nuw nsw i64 %indvar214, 8
%niter271.next.7 = add i64 %niter271, 8
%niter271.ncmp.7 = icmp eq i64 %niter271.next.7, %unroll_iter270
br i1 %niter271.ncmp.7, label %for.inc89.loopexit.unr-lcssa, label %for.cond17.preheader.us, !llvm.loop !20
if.then69: ; preds = %for.body11
%72 = load i32, ptr %point_y, align 4, !tbaa !5
%73 = load i32, ptr %height, align 4, !tbaa !5
%cmp71154 = icmp slt i32 %72, %73
br i1 %cmp71154, label %for.cond73.preheader.lr.ph, label %for.inc89
for.cond73.preheader.lr.ph: ; preds = %if.then69
%74 = load i32, ptr %width, align 4, !tbaa !5
%cmp74152 = icmp sgt i32 %74, 0
br i1 %cmp74152, label %for.cond73.preheader.us.preheader, label %for.inc89
for.cond73.preheader.us.preheader: ; preds = %for.cond73.preheader.lr.ph
%75 = sext i32 %72 to i64
%76 = zext i32 %74 to i64
%77 = shl nuw nsw i64 %76, 2
%78 = sub i32 %73, %72
%79 = xor i32 %72, -1
%80 = add i32 %73, %79
%xtraiter = and i32 %78, 3
%81 = icmp ult i32 %80, 3
br i1 %81, label %for.inc89.loopexit256.unr-lcssa, label %for.cond73.preheader.us.preheader.new
for.cond73.preheader.us.preheader.new: ; preds = %for.cond73.preheader.us.preheader
%unroll_iter = and i32 %78, -4
br label %for.cond73.preheader.us
for.cond73.preheader.us: ; preds = %for.cond73.preheader.us, %for.cond73.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond73.preheader.us.preheader.new ], [ %indvar.next.3, %for.cond73.preheader.us ]
%niter = phi i32 [ 0, %for.cond73.preheader.us.preheader.new ], [ %niter.next.3, %for.cond73.preheader.us ]
%82 = add i64 %indvar, %75
%83 = mul i64 %13, %82
%scevgep = getelementptr i8, ptr %vla, i64 %83
call void @llvm.memset.p0.i64(ptr align 4 %scevgep, i8 0, i64 %77, i1 false), !tbaa !5
%indvar.next = or i64 %indvar, 1
%84 = add i64 %indvar.next, %75
%85 = mul i64 %13, %84
%scevgep.1 = getelementptr i8, ptr %vla, i64 %85
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.1, i8 0, i64 %77, i1 false), !tbaa !5
%indvar.next.1 = or i64 %indvar, 2
%86 = add i64 %indvar.next.1, %75
%87 = mul i64 %13, %86
%scevgep.2 = getelementptr i8, ptr %vla, i64 %87
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.2, i8 0, i64 %77, i1 false), !tbaa !5
%indvar.next.2 = or i64 %indvar, 3
%88 = add i64 %indvar.next.2, %75
%89 = mul i64 %13, %88
%scevgep.3 = getelementptr i8, ptr %vla, i64 %89
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.3, i8 0, i64 %77, i1 false), !tbaa !5
%indvar.next.3 = add nuw nsw i64 %indvar, 4
%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.inc89.loopexit256.unr-lcssa, label %for.cond73.preheader.us, !llvm.loop !21
for.inc89.loopexit.unr-lcssa: ; preds = %for.cond17.preheader.us, %for.cond17.preheader.us.preheader
%indvar214.unr = phi i64 [ 0, %for.cond17.preheader.us.preheader ], [ %indvar.next215.7, %for.cond17.preheader.us ]
%lcmp.mod269.not = icmp eq i64 %xtraiter267, 0
br i1 %lcmp.mod269.not, label %for.inc89, label %for.cond17.preheader.us.epil
for.cond17.preheader.us.epil: ; preds = %for.inc89.loopexit.unr-lcssa, %for.cond17.preheader.us.epil
%indvar214.epil = phi i64 [ %indvar.next215.epil, %for.cond17.preheader.us.epil ], [ %indvar214.unr, %for.inc89.loopexit.unr-lcssa ]
%epil.iter268 = phi i64 [ %epil.iter268.next, %for.cond17.preheader.us.epil ], [ 0, %for.inc89.loopexit.unr-lcssa ]
%90 = mul nuw nsw i64 %13, %indvar214.epil
%scevgep216.epil = getelementptr i8, ptr %vla, i64 %90
call void @llvm.memset.p0.i64(ptr align 4 %scevgep216.epil, i8 0, i64 %62, i1 false), !tbaa !5
%indvar.next215.epil = add nuw nsw i64 %indvar214.epil, 1
%epil.iter268.next = add i64 %epil.iter268, 1
%epil.iter268.cmp.not = icmp eq i64 %epil.iter268.next, %xtraiter267
br i1 %epil.iter268.cmp.not, label %for.inc89, label %for.cond17.preheader.us.epil, !llvm.loop !22
for.inc89.loopexit254.unr-lcssa: ; preds = %for.body34.us, %for.body34.us.preheader
%indvar205.unr = phi i64 [ 0, %for.body34.us.preheader ], [ %indvar.next206.7, %for.body34.us ]
%lcmp.mod264.not = icmp eq i64 %xtraiter262, 0
br i1 %lcmp.mod264.not, label %for.inc89, label %for.body34.us.epil
for.body34.us.epil: ; preds = %for.inc89.loopexit254.unr-lcssa, %for.body34.us.epil
%indvar205.epil = phi i64 [ %indvar.next206.epil, %for.body34.us.epil ], [ %indvar205.unr, %for.inc89.loopexit254.unr-lcssa ]
%epil.iter263 = phi i64 [ %epil.iter263.next, %for.body34.us.epil ], [ 0, %for.inc89.loopexit254.unr-lcssa ]
%91 = mul nuw nsw i64 %13, %indvar205.epil
%scevgep207.epil = getelementptr i8, ptr %49, i64 %91
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep207.epil, i8 0, i64 %48, i1 false), !tbaa !5
%indvar.next206.epil = add nuw nsw i64 %indvar205.epil, 1
%epil.iter263.next = add i64 %epil.iter263, 1
%epil.iter263.cmp.not = icmp eq i64 %epil.iter263.next, %xtraiter262
br i1 %epil.iter263.cmp.not, label %for.inc89, label %for.body34.us.epil, !llvm.loop !24
for.inc89.loopexit255.unr-lcssa: ; preds = %for.cond54.preheader.us, %for.cond54.preheader.us.preheader
%indvar196.unr = phi i64 [ 0, %for.cond54.preheader.us.preheader ], [ %indvar.next197.7, %for.cond54.preheader.us ]
%lcmp.mod259.not = icmp eq i64 %xtraiter257, 0
br i1 %lcmp.mod259.not, label %for.inc89, label %for.cond54.preheader.us.epil
for.cond54.preheader.us.epil: ; preds = %for.inc89.loopexit255.unr-lcssa, %for.cond54.preheader.us.epil
%indvar196.epil = phi i64 [ %indvar.next197.epil, %for.cond54.preheader.us.epil ], [ %indvar196.unr, %for.inc89.loopexit255.unr-lcssa ]
%epil.iter258 = phi i64 [ %epil.iter258.next, %for.cond54.preheader.us.epil ], [ 0, %for.inc89.loopexit255.unr-lcssa ]
%92 = mul nuw nsw i64 %13, %indvar196.epil
%scevgep198.epil = getelementptr i8, ptr %vla, i64 %92
call void @llvm.memset.p0.i64(ptr align 4 %scevgep198.epil, i8 0, i64 %29, i1 false), !tbaa !5
%indvar.next197.epil = add nuw nsw i64 %indvar196.epil, 1
%epil.iter258.next = add i64 %epil.iter258, 1
%epil.iter258.cmp.not = icmp eq i64 %epil.iter258.next, %xtraiter257
br i1 %epil.iter258.cmp.not, label %for.inc89, label %for.cond54.preheader.us.epil, !llvm.loop !25
for.inc89.loopexit256.unr-lcssa: ; preds = %for.cond73.preheader.us, %for.cond73.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond73.preheader.us.preheader ], [ %indvar.next.3, %for.cond73.preheader.us ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc89, label %for.cond73.preheader.us.epil
for.cond73.preheader.us.epil: ; preds = %for.inc89.loopexit256.unr-lcssa, %for.cond73.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond73.preheader.us.epil ], [ %indvar.unr, %for.inc89.loopexit256.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.cond73.preheader.us.epil ], [ 0, %for.inc89.loopexit256.unr-lcssa ]
%93 = add i64 %indvar.epil, %75
%94 = mul i64 %13, %93
%scevgep.epil = getelementptr i8, ptr %vla, i64 %94
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.epil, i8 0, i64 %77, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
%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.inc89, label %for.cond73.preheader.us.epil, !llvm.loop !26
for.inc89: ; preds = %for.inc89.loopexit256.unr-lcssa, %for.cond73.preheader.us.epil, %for.inc89.loopexit255.unr-lcssa, %for.cond54.preheader.us.epil, %for.inc89.loopexit254.unr-lcssa, %for.body34.us.epil, %for.inc89.loopexit.unr-lcssa, %for.cond17.preheader.us.epil, %for.cond73.preheader.lr.ph, %for.cond17.preheader.lr.ph, %for.body34.lr.ph, %for.cond54.preheader.lr.ph, %if.then69, %for.cond51.preheader, %for.cond32.preheader, %for.cond14.preheader, %for.body11
%inc90 = add nuw nsw i32 %i.1169, 1
%95 = load i32, ptr %number_n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc90, %95
br i1 %cmp10, label %for.body11, label %for.cond92.preheader.loopexit, !llvm.loop !27
for.end107: ; preds = %for.cond95.for.inc105_crit_edge.us, %for.cond95.preheader.lr.ph, %for.cond92.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond92.preheader ], [ 0, %for.cond95.preheader.lr.ph ], [ %add.us.lcssa, %for.cond95.for.inc105_crit_edge.us ]
%call108 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.stackrestore.p0(ptr %4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %flag) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %point_y) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %point_x) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %number_n) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %width) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %height) #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: 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: 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!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, !11, !12}
!16 = distinct !{!16, !10, !12, !11}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.unroll.disable"}
!24 = distinct !{!24, !23}
!25 = distinct !{!25, !23}
!26 = distinct !{!26, !23}
!27 = distinct !{!27, !10}
|
#include<stdio.h>
int main(void)
{
int w,h,n,x,y,a,s[2],t[2],i,ans=0;
scanf("%d %d %d",&w,&h,&n);
s[0]=0; s[1]=w;
t[0]=0; t[1]=h;
for(i=0;i<n;i++)
{
scanf("%d %d %d",&x,&y,&a);
if(a == 1 && s[0] < x)
{
s[0] = x;
}
else if(a == 2 && s[1] > x)
{
s[1] = x;
}
else if(a == 3 && t[0] < y)
{
t[0] = y;
}
else if(a == 4 && t[1] > y)
{
t[1] = y;
}
}
if(s[0] > s[1] || t[0] > t[1])
{
ans = 0;
}
else
{
ans = (s[1]-s[0]) * (t[1]-t[0]);
}
printf("%d\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140244/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140244/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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%w = alloca i32, align 4
%h = alloca i32, align 4
%n = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
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 %w, ptr noundef nonnull %h, ptr noundef nonnull %n)
%0 = load i32, ptr %w, align 4, !tbaa !5
%1 = load i32, ptr %h, align 4, !tbaa !5
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp62 = icmp sgt i32 %2, 0
br i1 %cmp62, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.067 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%t.sroa.0.066 = phi i32 [ %t.sroa.0.1, %for.inc ], [ 0, %entry ]
%t.sroa.7.065 = phi i32 [ %t.sroa.7.1, %for.inc ], [ %1, %entry ]
%s.sroa.0.064 = phi i32 [ %s.sroa.0.1, %for.inc ], [ 0, %entry ]
%s.sroa.7.063 = phi i32 [ %s.sroa.7.1, %for.inc ], [ %0, %entry ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %a)
%3 = load i32, ptr %a, align 4, !tbaa !5
%cmp5 = icmp eq i32 %3, 1
%4 = load i32, ptr %x, align 4
%cmp7 = icmp slt i32 %s.sroa.0.064, %4
%or.cond59 = select i1 %cmp5, i1 %cmp7, i1 false
br i1 %or.cond59, label %for.inc, label %if.else
if.else: ; preds = %for.body
%cmp9 = icmp eq i32 %3, 2
%cmp12 = icmp sgt i32 %s.sroa.7.063, %4
%or.cond60 = select i1 %cmp9, i1 %cmp12, i1 false
br i1 %or.cond60, label %for.inc, label %if.else15
if.else15: ; preds = %if.else
%cmp16 = icmp eq i32 %3, 3
%5 = load i32, ptr %y, align 4
%cmp19 = icmp slt i32 %t.sroa.0.066, %5
%or.cond61 = select i1 %cmp16, i1 %cmp19, i1 false
br i1 %or.cond61, label %for.inc, label %if.else22
if.else22: ; preds = %if.else15
%cmp23 = icmp eq i32 %3, 4
br i1 %cmp23, label %land.lhs.true24, label %for.inc
land.lhs.true24: ; preds = %if.else22
%spec.select = call i32 @llvm.smin.i32(i32 %t.sroa.7.065, i32 %5)
br label %for.inc
for.inc: ; preds = %land.lhs.true24, %if.else15, %if.else, %for.body, %if.else22
%s.sroa.7.1 = phi i32 [ %s.sroa.7.063, %if.else22 ], [ %s.sroa.7.063, %land.lhs.true24 ], [ %s.sroa.7.063, %for.body ], [ %4, %if.else ], [ %s.sroa.7.063, %if.else15 ]
%s.sroa.0.1 = phi i32 [ %s.sroa.0.064, %if.else22 ], [ %s.sroa.0.064, %land.lhs.true24 ], [ %4, %for.body ], [ %s.sroa.0.064, %if.else ], [ %s.sroa.0.064, %if.else15 ]
%t.sroa.7.1 = phi i32 [ %t.sroa.7.065, %if.else22 ], [ %spec.select, %land.lhs.true24 ], [ %t.sroa.7.065, %for.body ], [ %t.sroa.7.065, %if.else ], [ %t.sroa.7.065, %if.else15 ]
%t.sroa.0.1 = phi i32 [ %t.sroa.0.066, %if.else22 ], [ %t.sroa.0.066, %land.lhs.true24 ], [ %t.sroa.0.066, %for.body ], [ %t.sroa.0.066, %if.else ], [ %5, %if.else15 ]
%inc = add nuw nsw i32 %i.067, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%s.sroa.7.0.lcssa = phi i32 [ %0, %entry ], [ %s.sroa.7.1, %for.inc ]
%s.sroa.0.0.lcssa = phi i32 [ 0, %entry ], [ %s.sroa.0.1, %for.inc ]
%t.sroa.7.0.lcssa = phi i32 [ %1, %entry ], [ %t.sroa.7.1, %for.inc ]
%t.sroa.0.0.lcssa = phi i32 [ 0, %entry ], [ %t.sroa.0.1, %for.inc ]
%cmp34 = icmp sgt i32 %s.sroa.0.0.lcssa, %s.sroa.7.0.lcssa
%cmp37 = icmp sgt i32 %t.sroa.0.0.lcssa, %t.sroa.7.0.lcssa
%or.cond = select i1 %cmp34, i1 true, i1 %cmp37
%sub = sub nsw i32 %s.sroa.7.0.lcssa, %s.sroa.0.0.lcssa
%sub44 = sub nsw i32 %t.sroa.7.0.lcssa, %t.sroa.0.0.lcssa
%mul = mul nsw i32 %sub44, %sub
%ans.0 = select i1 %or.cond, i32 0, i32 %mul
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #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.smin.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"}
|
#include <stdio.h>
int main(){
int i;
int w, h, n;
scanf("%d %d %d", &w, &h, &n);
int xl = 0, yl = 0, xh = w, yh = h;
for(i = 0; i < n; i++){
int a;
scanf("%d %d %d", &w, &h, &a);
switch(a){
case 1:
if(xl<w){
xl = w;
}
break;
case 2:
if(xh>w){
xh = w;
}
break;
case 3:
if(yl<h){
yl = h;
}
break;
case 4:
if(yh>h){
yh = h;
}
break;
default:
return 1;
}
}
if(xl>xh||yl>yh){
printf("%d", 0);
}
else{
printf("%d", (xh-xl)*(yh-yl));
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140288/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140288/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 [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%w = alloca i32, align 4
%h = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #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 %w, ptr noundef nonnull %h, ptr noundef nonnull %n)
%0 = load i32, ptr %w, align 4, !tbaa !5
%1 = load i32, ptr %h, align 4, !tbaa !5
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp60 = icmp sgt i32 %2, 0
br i1 %cmp60, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%yh.065 = phi i32 [ %yh.2.ph, %for.inc ], [ %1, %entry ]
%xh.064 = phi i32 [ %xh.2.ph, %for.inc ], [ %0, %entry ]
%yl.063 = phi i32 [ %yl.2.ph, %for.inc ], [ 0, %entry ]
%xl.062 = phi i32 [ %xl.2.ph, %for.inc ], [ 0, %entry ]
%i.061 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h, ptr noundef nonnull %a)
%3 = load i32, ptr %a, align 4, !tbaa !5
switch i32 %3, label %cleanup [
i32 1, label %sw.bb
i32 2, label %sw.bb3
i32 3, label %sw.bb7
i32 4, label %sw.bb11
]
sw.bb: ; preds = %for.body
%4 = load i32, ptr %w, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %xl.062, i32 %4)
br label %for.inc
sw.bb3: ; preds = %for.body
%5 = load i32, ptr %w, align 4, !tbaa !5
%spec.select42 = call i32 @llvm.smin.i32(i32 %xh.064, i32 %5)
br label %for.inc
sw.bb7: ; preds = %for.body
%6 = load i32, ptr %h, align 4, !tbaa !5
%spec.select43 = call i32 @llvm.smax.i32(i32 %yl.063, i32 %6)
br label %for.inc
sw.bb11: ; preds = %for.body
%7 = load i32, ptr %h, align 4, !tbaa !5
%spec.select44 = call i32 @llvm.smin.i32(i32 %yh.065, i32 %7)
br label %for.inc
cleanup: ; preds = %for.body
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
br label %cleanup22
for.inc: ; preds = %sw.bb11, %sw.bb7, %sw.bb3, %sw.bb
%xl.2.ph = phi i32 [ %xl.062, %sw.bb11 ], [ %xl.062, %sw.bb7 ], [ %xl.062, %sw.bb3 ], [ %spec.select, %sw.bb ]
%yl.2.ph = phi i32 [ %yl.063, %sw.bb11 ], [ %spec.select43, %sw.bb7 ], [ %yl.063, %sw.bb3 ], [ %yl.063, %sw.bb ]
%xh.2.ph = phi i32 [ %xh.064, %sw.bb11 ], [ %xh.064, %sw.bb7 ], [ %spec.select42, %sw.bb3 ], [ %xh.064, %sw.bb ]
%yh.2.ph = phi i32 [ %spec.select44, %sw.bb11 ], [ %yh.065, %sw.bb7 ], [ %yh.065, %sw.bb3 ], [ %yh.065, %sw.bb ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
%inc = add nuw nsw i32 %i.061, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %8
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%xl.0.lcssa = phi i32 [ 0, %entry ], [ %xl.2.ph, %for.inc ]
%yl.0.lcssa = phi i32 [ 0, %entry ], [ %yl.2.ph, %for.inc ]
%xh.0.lcssa = phi i32 [ %0, %entry ], [ %xh.2.ph, %for.inc ]
%yh.0.lcssa = phi i32 [ %1, %entry ], [ %yh.2.ph, %for.inc ]
%cmp15 = icmp sgt i32 %xl.0.lcssa, %xh.0.lcssa
%cmp16 = icmp sgt i32 %yl.0.lcssa, %yh.0.lcssa
%or.cond = select i1 %cmp15, i1 true, i1 %cmp16
br i1 %or.cond, label %if.then17, label %if.else
if.then17: ; preds = %for.end
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 0)
br label %cleanup22
if.else: ; preds = %for.end
%sub = sub nsw i32 %xh.0.lcssa, %xl.0.lcssa
%sub19 = sub nsw i32 %yh.0.lcssa, %yl.0.lcssa
%mul = mul nsw i32 %sub19, %sub
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
br label %cleanup22
cleanup22: ; preds = %cleanup, %if.then17, %if.else
%retval.2 = phi i32 [ 1, %cleanup ], [ 0, %if.else ], [ 0, %if.then17 ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
ret i32 %retval.2
}
; 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 nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
; 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"}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.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 INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
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;}
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;}
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;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
typedef struct{
ll a;
ll b;
ll c;
ll d;
}frequent;
int cmp( const void *p, const void *q ) {
if( ((frequent*)p)->a == ((frequent*)q)->a ) return ((frequent*)p)->b - ((frequent*)q)->b;
return ((frequent*)p)->a - ((frequent*)q)->a;
}
int cmp1( const void *p, const void *q ) {
// if( ((frequent*)p)->a == ((frequent*)q)->a ) return ((frequent*)p)->b - ((frequent*)q)->b;
return ((frequent*)p)->c - ((frequent*)q)->c;
}
int main(void){
// char ;
ll n,m;
scanf("%lld%lld",&n,&m);
frequent x[m];
rep(i,0,m){
scanf("%lld%lld",&x[i].a,&x[i].b);
x[i].c=i;
}
qsort(x,m,sizeof(frequent),cmp);
ll y=1;
x[0].d=1;
rep(i,1,m){
if(x[i].a==x[i-1].a){
y++;
}else{
y=1;
}
x[i].d=y;
}
qsort(x,m,sizeof(frequent),cmp1);
rep(i,0,m){
printf("%06lld%06lld\n",x[i].a,x[i].d);
}
// printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140330/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140330/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.frequent = type { i64, i64, i64, i64 }
@.str = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [14 x i8] c"%06lld%06lld\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: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
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 #2 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; 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 #3 {
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 #3 {
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 #2 {
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 #4 {
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 i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
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 #4 {
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(argmem: read) uwtable
define dso_local i32 @upll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 {
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) #5 {
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: nofree nounwind uwtable
define dso_local void @sortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #6 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #11
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #6 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @downll) #11
ret void
}
; 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) #5 {
entry:
%0 = load i64, ptr %p, align 8, !tbaa !19
%1 = load i64, ptr %q, align 8, !tbaa !19
%cmp = icmp eq i64 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%b = getelementptr inbounds %struct.frequent, ptr %p, i64 0, i32 1
%2 = load i64, ptr %b, align 8, !tbaa !21
%b2 = getelementptr inbounds %struct.frequent, ptr %q, i64 0, i32 1
%3 = load i64, ptr %b2, align 8, !tbaa !21
%sub = sub nsw i64 %2, %3
br label %return
if.end: ; preds = %entry
%sub5 = sub nsw i64 %0, %1
br label %return
return: ; preds = %if.end, %if.then
%retval.0.in = phi i64 [ %sub, %if.then ], [ %sub5, %if.end ]
%retval.0 = trunc i64 %retval.0.in to i32
ret i32 %retval.0
}
; 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) #5 {
entry:
%c = getelementptr inbounds %struct.frequent, ptr %p, i64 0, i32 2
%0 = load i64, ptr %c, align 8, !tbaa !22
%c1 = getelementptr inbounds %struct.frequent, ptr %q, i64 0, i32 2
%1 = load i64, ptr %c1, align 8, !tbaa !22
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #6 {
entry:
%n = alloca i64, align 8
%m = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #11
%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 !5
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.frequent, i64 %0, align 16
%2 = load i64, ptr %m, align 8, !tbaa !5
%cmp49 = icmp sgt i64 %2, 0
br i1 %cmp49, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa48 = phi i64 [ %2, %entry ], [ %6, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %.lcssa48, i64 noundef 32, ptr noundef nonnull @cmp) #11
%d = getelementptr inbounds %struct.frequent, ptr %vla, i64 0, i32 3
store i64 1, ptr %d, align 8, !tbaa !23
%3 = load i64, ptr %m, align 8, !tbaa !5
%cmp751 = icmp sgt i64 %3, 1
br i1 %cmp751, label %for.body9.preheader, label %for.cond.cleanup8
for.body9.preheader: ; preds = %for.cond.cleanup
%4 = add i64 %3, -1
%xtraiter = and i64 %4, 1
%5 = icmp eq i64 %3, 2
br i1 %5, label %for.cond.cleanup8.loopexit.unr-lcssa, label %for.body9.preheader.new
for.body9.preheader.new: ; preds = %for.body9.preheader
%unroll_iter = and i64 %4, -2
br label %for.body9
for.body: ; preds = %entry, %for.body
%i.050 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.frequent, ptr %vla, i64 %i.050
%b = getelementptr inbounds %struct.frequent, ptr %vla, i64 %i.050, i32 1
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %b)
%c = getelementptr inbounds %struct.frequent, ptr %vla, i64 %i.050, i32 2
store i64 %i.050, ptr %c, align 16, !tbaa !22
%inc = add nuw nsw i64 %i.050, 1
%6 = load i64, ptr %m, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %6
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !24
for.cond.cleanup8.loopexit.unr-lcssa.loopexit: ; preds = %for.body9
%7 = add nsw i64 %y.1.1, 1
br label %for.cond.cleanup8.loopexit.unr-lcssa
for.cond.cleanup8.loopexit.unr-lcssa: ; preds = %for.cond.cleanup8.loopexit.unr-lcssa.loopexit, %for.body9.preheader
%i5.053.unr = phi i64 [ 1, %for.body9.preheader ], [ %inc19.1, %for.cond.cleanup8.loopexit.unr-lcssa.loopexit ]
%y.052.unr = phi i64 [ 2, %for.body9.preheader ], [ %7, %for.cond.cleanup8.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup8, label %for.body9.epil
for.body9.epil: ; preds = %for.cond.cleanup8.loopexit.unr-lcssa
%arrayidx10.epil = getelementptr inbounds %struct.frequent, ptr %vla, i64 %i5.053.unr
%8 = load i64, ptr %arrayidx10.epil, align 16, !tbaa !19
%arrayidx12.epil = getelementptr %struct.frequent, ptr %arrayidx10.epil, i64 -1
%9 = load i64, ptr %arrayidx12.epil, align 16, !tbaa !19
%cmp14.epil = icmp eq i64 %8, %9
%y.1.epil = select i1 %cmp14.epil, i64 %y.052.unr, i64 1
%d17.epil = getelementptr inbounds %struct.frequent, ptr %vla, i64 %i5.053.unr, i32 3
store i64 %y.1.epil, ptr %d17.epil, align 8, !tbaa !23
br label %for.cond.cleanup8
for.cond.cleanup8: ; preds = %for.body9.epil, %for.cond.cleanup8.loopexit.unr-lcssa, %for.cond.cleanup
call void @qsort(ptr noundef nonnull %vla, i64 noundef %3, i64 noundef 32, ptr noundef nonnull @cmp1) #11
%10 = load i64, ptr %m, align 8, !tbaa !5
%cmp2355 = icmp sgt i64 %10, 0
br i1 %cmp2355, label %for.body25, label %for.cond.cleanup24
for.body9: ; preds = %for.body9, %for.body9.preheader.new
%i5.053 = phi i64 [ 1, %for.body9.preheader.new ], [ %inc19.1, %for.body9 ]
%y.052 = phi i64 [ 1, %for.body9.preheader.new ], [ %y.1.1, %for.body9 ]
%niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.1, %for.body9 ]
%arrayidx10 = getelementptr inbounds %struct.frequent, ptr %vla, i64 %i5.053
%11 = load i64, ptr %arrayidx10, align 16, !tbaa !19
%arrayidx12 = getelementptr %struct.frequent, ptr %arrayidx10, i64 -1
%12 = load i64, ptr %arrayidx12, align 16, !tbaa !19
%cmp14 = icmp eq i64 %11, %12
%inc15 = add nsw i64 %y.052, 1
%y.1 = select i1 %cmp14, i64 %inc15, i64 1
%d17 = getelementptr inbounds %struct.frequent, ptr %vla, i64 %i5.053, i32 3
store i64 %y.1, ptr %d17, align 8, !tbaa !23
%inc19 = add nuw nsw i64 %i5.053, 1
%arrayidx10.1 = getelementptr inbounds %struct.frequent, ptr %vla, i64 %inc19
%13 = load i64, ptr %arrayidx10.1, align 16, !tbaa !19
%arrayidx12.1 = getelementptr %struct.frequent, ptr %vla, i64 %i5.053
%14 = load i64, ptr %arrayidx12.1, align 16, !tbaa !19
%cmp14.1 = icmp eq i64 %13, %14
%inc15.1 = add nsw i64 %y.1, 1
%y.1.1 = select i1 %cmp14.1, i64 %inc15.1, i64 1
%d17.1 = getelementptr inbounds %struct.frequent, ptr %vla, i64 %inc19, i32 3
store i64 %y.1.1, ptr %d17.1, align 8, !tbaa !23
%inc19.1 = add nuw nsw i64 %i5.053, 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.cleanup8.loopexit.unr-lcssa.loopexit, label %for.body9, !llvm.loop !25
for.cond.cleanup24: ; preds = %for.body25, %for.cond.cleanup8
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #11
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #11
ret i32 0
for.body25: ; preds = %for.cond.cleanup8, %for.body25
%i21.056 = phi i64 [ %inc32, %for.body25 ], [ 0, %for.cond.cleanup8 ]
%arrayidx26 = getelementptr inbounds %struct.frequent, ptr %vla, i64 %i21.056
%15 = load i64, ptr %arrayidx26, align 16, !tbaa !19
%d29 = getelementptr inbounds %struct.frequent, ptr %vla, i64 %i21.056, i32 3
%16 = load i64, ptr %d29, align 8, !tbaa !23
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %15, i64 noundef %16)
%inc32 = add nuw nsw i64 %i21.056, 1
%17 = load i64, ptr %m, align 8, !tbaa !5
%cmp23 = icmp slt i64 %inc32, %17
br i1 %cmp23, label %for.body25, label %for.cond.cleanup24, !llvm.loop !26
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #9
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smin.v2i64(<2 x i64>, <2 x i64>) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smin.v2i64(<2 x i64>) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x i64>) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smax.v2i64(<2 x i64>) #10
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 = { 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 #3 = { 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 #4 = { 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 #5 = { 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 #6 = { 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 #7 = { 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 #8 = { 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 #9 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #10 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #11 = { 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 = !{!20, !6, i64 0}
!20 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!21 = !{!20, !6, i64 8}
!22 = !{!20, !6, i64 16}
!23 = !{!20, !6, i64 24}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
|
#include <stdio.h>
#include <stdlib.h>
typedef struct{
int p;
int y;
int i;
int n;
} city_t;
int sort1(const void *a, const void *b){
if (((city_t*)a)->p!=((city_t*)b)->p){
return ((city_t*)a)->p-((city_t*)b)->p ;
} else {
return ((city_t*)a)->y-((city_t*)b)->y ;
}
}
int sort2(const void *a, const void *b){
return ((city_t*)a)->i-((city_t*)b)->i ;
}
int main(void){
int n,m;
scanf("%d%d",&n,&m);
city_t city[m];
for (int i=0; i<m; i++){
scanf("%d%d",&city[i].p,&city[i].y);
city[i].i=i;
}
qsort (city,m,sizeof(city_t),sort1);
city[0].n=1;
for (int i=1; i<m; i++){
if (city[i].p==city[i-1].p){
city[i].n=city[i-1].n+1;
} else {
city[i].n=1;
}
}
qsort (city,m,sizeof(city_t),sort2);
for (int i=0; i<m; i++){
if (city[i].p==100000){
printf("100000");
} else if (city[i].p>=10000){
printf("0%d",city[i].p);
} else if (city[i].p>=1000){
printf("00%d",city[i].p);
} else if (city[i].p>=100){
printf("000%d",city[i].p);
} else if (city[i].p>=10){
printf("0000%d",city[i].p);
} else {
printf("00000%d",city[i].p);
}
if (city[i].n==100000){
printf("100000\n");
} else if (city[i].n>=10000){
printf("0%d\n",city[i].n);
} else if (city[i].n>=1000){
printf("00%d\n",city[i].n);
} else if (city[i].n>=100){
printf("000%d\n",city[i].n);
} else if (city[i].n>=10){
printf("0000%d\n",city[i].n);
} else {
printf("00000%d\n",city[i].n);
}
}
return 0 ;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140381/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140381/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.city_t = type { i32, i32, i32, i32 }
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"0%d\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"00%d\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"000%d\00", align 1
@.str.5 = private unnamed_addr constant [7 x i8] c"0000%d\00", align 1
@.str.6 = private unnamed_addr constant [8 x i8] c"00000%d\00", align 1
@.str.8 = private unnamed_addr constant [5 x i8] c"0%d\0A\00", align 1
@.str.9 = private unnamed_addr constant [6 x i8] c"00%d\0A\00", align 1
@.str.10 = private unnamed_addr constant [7 x i8] c"000%d\0A\00", align 1
@.str.11 = private unnamed_addr constant [8 x i8] c"0000%d\0A\00", align 1
@.str.12 = private unnamed_addr constant [9 x i8] c"00000%d\0A\00", align 1
@str = private unnamed_addr constant [7 x i8] c"100000\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sort1(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
%cmp.not = icmp eq i32 %0, %1
br i1 %cmp.not, label %if.else, label %if.then
if.then: ; preds = %entry
%sub = sub nsw i32 %0, %1
br label %return
if.else: ; preds = %entry
%y = getelementptr inbounds %struct.city_t, ptr %a, i64 0, i32 1
%2 = load i32, ptr %y, align 4, !tbaa !10
%y4 = getelementptr inbounds %struct.city_t, ptr %b, i64 0, i32 1
%3 = load i32, ptr %y4, align 4, !tbaa !10
%sub5 = sub nsw i32 %2, %3
br label %return
return: ; preds = %if.else, %if.then
%retval.0 = phi i32 [ %sub, %if.then ], [ %sub5, %if.else ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sort2(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%i = getelementptr inbounds %struct.city_t, ptr %a, i64 0, i32 2
%0 = load i32, ptr %i, align 4, !tbaa !11
%i1 = getelementptr inbounds %struct.city_t, ptr %b, i64 0, i32 2
%1 = load i32, ptr %i1, align 4, !tbaa !11
%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) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !12
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.city_t, i64 %1, align 16
%3 = load i32, ptr %m, align 4, !tbaa !12
%cmp204 = icmp sgt i32 %3, 0
br i1 %cmp204, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre219 = sext i32 %3 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre219, %entry.for.cond.cleanup_crit_edge ], [ %9, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 16, ptr noundef nonnull @sort1) #7
%n8 = getelementptr inbounds %struct.city_t, ptr %vla, i64 0, i32 3
store i32 1, ptr %n8, align 4, !tbaa !13
%4 = load i32, ptr %m, align 4, !tbaa !12
%cmp11206 = icmp sgt i32 %4, 1
br i1 %cmp11206, label %for.body14.preheader, label %for.cond.cleanup13
for.body14.preheader: ; preds = %for.cond.cleanup
%wide.trip.count = zext i32 %4 to i64
%.pre = load i32, ptr %vla, align 16, !tbaa !5
%5 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %5, 1
%6 = icmp eq i32 %4, 2
br i1 %6, label %for.cond.cleanup13.loopexit.unr-lcssa, label %for.body14.preheader.new
for.body14.preheader.new: ; preds = %for.body14.preheader
%unroll_iter = and i64 %5, -2
br label %for.body14
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.city_t, ptr %vla, i64 %indvars.iv
%y = getelementptr inbounds %struct.city_t, ptr %vla, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %y)
%i6 = getelementptr inbounds %struct.city_t, ptr %vla, i64 %indvars.iv, i32 2
%7 = trunc i64 %indvars.iv to i32
store i32 %7, ptr %i6, align 8, !tbaa !11
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %m, align 4, !tbaa !12
%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 !14
for.cond.cleanup13.loopexit.unr-lcssa.loopexit: ; preds = %for.body14
%10 = add nsw i32 %.sink.1, 1
br label %for.cond.cleanup13.loopexit.unr-lcssa
for.cond.cleanup13.loopexit.unr-lcssa: ; preds = %for.cond.cleanup13.loopexit.unr-lcssa.loopexit, %for.body14.preheader
%.unr = phi i32 [ 2, %for.body14.preheader ], [ %10, %for.cond.cleanup13.loopexit.unr-lcssa.loopexit ]
%.unr220 = phi i32 [ %.pre, %for.body14.preheader ], [ %18, %for.cond.cleanup13.loopexit.unr-lcssa.loopexit ]
%indvars.iv212.unr = phi i64 [ 1, %for.body14.preheader ], [ %indvars.iv.next213.1, %for.cond.cleanup13.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup13, label %for.body14.epil
for.body14.epil: ; preds = %for.cond.cleanup13.loopexit.unr-lcssa
%arrayidx16.epil = getelementptr inbounds %struct.city_t, ptr %vla, i64 %indvars.iv212.unr
%11 = load i32, ptr %arrayidx16.epil, align 16, !tbaa !5
%cmp21.epil = icmp eq i32 %11, %.unr220
%.sink.epil = select i1 %cmp21.epil, i32 %.unr, i32 1
%12 = getelementptr inbounds %struct.city_t, ptr %vla, i64 %indvars.iv212.unr, i32 3
store i32 %.sink.epil, ptr %12, align 4
br label %for.cond.cleanup13
for.cond.cleanup13: ; preds = %for.body14.epil, %for.cond.cleanup13.loopexit.unr-lcssa, %for.cond.cleanup
%conv36 = sext i32 %4 to i64
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv36, i64 noundef 16, ptr noundef nonnull @sort2) #7
%13 = load i32, ptr %m, align 4, !tbaa !12
%cmp39209 = icmp sgt i32 %13, 0
br i1 %cmp39209, label %for.body42, label %for.cond.cleanup41
for.body14: ; preds = %for.body14, %for.body14.preheader.new
%14 = phi i32 [ 1, %for.body14.preheader.new ], [ %.sink.1, %for.body14 ]
%15 = phi i32 [ %.pre, %for.body14.preheader.new ], [ %18, %for.body14 ]
%indvars.iv212 = phi i64 [ 1, %for.body14.preheader.new ], [ %indvars.iv.next213.1, %for.body14 ]
%niter = phi i64 [ 0, %for.body14.preheader.new ], [ %niter.next.1, %for.body14 ]
%arrayidx16 = getelementptr inbounds %struct.city_t, ptr %vla, i64 %indvars.iv212
%16 = load i32, ptr %arrayidx16, align 16, !tbaa !5
%cmp21 = icmp eq i32 %16, %15
%add = add nsw i32 %14, 1
%.sink = select i1 %cmp21, i32 %add, i32 1
%17 = getelementptr inbounds %struct.city_t, ptr %vla, i64 %indvars.iv212, i32 3
store i32 %.sink, ptr %17, align 4
%indvars.iv.next213 = add nuw nsw i64 %indvars.iv212, 1
%arrayidx16.1 = getelementptr inbounds %struct.city_t, ptr %vla, i64 %indvars.iv.next213
%18 = load i32, ptr %arrayidx16.1, align 16, !tbaa !5
%cmp21.1 = icmp eq i32 %18, %16
%add.1 = add nsw i32 %.sink, 1
%.sink.1 = select i1 %cmp21.1, i32 %add.1, i32 1
%19 = getelementptr inbounds %struct.city_t, ptr %vla, i64 %indvars.iv.next213, i32 3
store i32 %.sink.1, ptr %19, align 4
%indvars.iv.next213.1 = add nuw nsw i64 %indvars.iv212, 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.cleanup13.loopexit.unr-lcssa.loopexit, label %for.body14, !llvm.loop !16
for.cond.cleanup41: ; preds = %for.inc165, %for.cond.cleanup13
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
for.body42: ; preds = %for.cond.cleanup13, %for.inc165
%indvars.iv216 = phi i64 [ %indvars.iv.next217, %for.inc165 ], [ 0, %for.cond.cleanup13 ]
%arrayidx44 = getelementptr inbounds %struct.city_t, ptr %vla, i64 %indvars.iv216
%20 = load i32, ptr %arrayidx44, align 16, !tbaa !5
%cmp46 = icmp eq i32 %20, 100000
br i1 %cmp46, label %if.then48, label %if.else50
if.then48: ; preds = %for.body42
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @str)
br label %if.end103
if.else50: ; preds = %for.body42
%cmp54 = icmp sgt i32 %20, 9999
br i1 %cmp54, label %if.then56, label %if.else61
if.then56: ; preds = %if.else50
%call60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
br label %if.end103
if.else61: ; preds = %if.else50
%cmp65 = icmp sgt i32 %20, 999
br i1 %cmp65, label %if.then67, label %if.else72
if.then67: ; preds = %if.else61
%call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %20)
br label %if.end103
if.else72: ; preds = %if.else61
%cmp76 = icmp sgt i32 %20, 99
br i1 %cmp76, label %if.then78, label %if.else83
if.then78: ; preds = %if.else72
%call82 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %20)
br label %if.end103
if.else83: ; preds = %if.else72
%cmp87 = icmp sgt i32 %20, 9
br i1 %cmp87, label %if.then89, label %if.else94
if.then89: ; preds = %if.else83
%call93 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %20)
br label %if.end103
if.else94: ; preds = %if.else83
%call98 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %20)
br label %if.end103
if.end103: ; preds = %if.then56, %if.then78, %if.else94, %if.then89, %if.then67, %if.then48
%n106 = getelementptr inbounds %struct.city_t, ptr %vla, i64 %indvars.iv216, i32 3
%21 = load i32, ptr %n106, align 4, !tbaa !13
%cmp107 = icmp eq i32 %21, 100000
br i1 %cmp107, label %if.then109, label %if.else111
if.then109: ; preds = %if.end103
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc165
if.else111: ; preds = %if.end103
%cmp115 = icmp sgt i32 %21, 9999
br i1 %cmp115, label %if.then117, label %if.else122
if.then117: ; preds = %if.else111
%call121 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %21)
br label %for.inc165
if.else122: ; preds = %if.else111
%cmp126 = icmp sgt i32 %21, 999
br i1 %cmp126, label %if.then128, label %if.else133
if.then128: ; preds = %if.else122
%call132 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %21)
br label %for.inc165
if.else133: ; preds = %if.else122
%cmp137 = icmp sgt i32 %21, 99
br i1 %cmp137, label %if.then139, label %if.else144
if.then139: ; preds = %if.else133
%call143 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %21)
br label %for.inc165
if.else144: ; preds = %if.else133
%cmp148 = icmp sgt i32 %21, 9
br i1 %cmp148, label %if.then150, label %if.else155
if.then150: ; preds = %if.else144
%call154 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, i32 noundef %21)
br label %for.inc165
if.else155: ; preds = %if.else144
%call159 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, i32 noundef %21)
br label %for.inc165
for.inc165: ; preds = %if.then109, %if.then128, %if.then150, %if.else155, %if.then139, %if.then117
%indvars.iv.next217 = add nuw nsw i64 %indvars.iv216, 1
%22 = load i32, ptr %m, align 4, !tbaa !12
%23 = sext i32 %22 to i64
%cmp39 = icmp slt i64 %indvars.iv.next217, %23
br i1 %cmp39, label %for.body42, label %for.cond.cleanup41, !llvm.loop !17
}
; 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: 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 #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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
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 = { nofree nounwind }
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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 8}
!12 = !{!7, !7, i64 0}
!13 = !{!6, !7, i64 12}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
|
#include<stdio.h>
int search(int a[], int n, int key){
int i=0;
a[n]=key;
while(a[i] != key) i++;
return i!=n;
}
int main(){
int i,n,a[10000+1],q,key,sum=0;
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&a[i]);
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&key);
if( search(a,n,key)) sum++;
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140424/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140424/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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @search(ptr nocapture noundef %a, i32 noundef %n, i32 noundef %key) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %key
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !9
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
%cmp3 = icmp ne i32 %1, %n
%conv = zext i1 %cmp3 to i32
ret i32 %conv
}
; 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
%a = alloca [10001 x i32], align 16
%q = alloca i32, align 4
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 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
%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 !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp420 = icmp sgt i32 %3, 0
br i1 %cmp420, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %search.exit
%sum.022 = phi i32 [ %spec.select, %search.exit ], [ 0, %for.end ]
%i.121 = phi i32 [ %inc10, %search.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %key, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %a, i64 %idxprom.i
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %for.body5
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %for.body5 ]
%arrayidx2.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %6, %5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %search.exit, label %while.cond.i, !llvm.loop !9
search.exit: ; preds = %while.cond.i
%7 = trunc i64 %indvars.iv.i to i32
%cmp3.i.not = icmp ne i32 %4, %7
%inc8 = zext i1 %cmp3.i.not to i32
%spec.select = add nuw nsw i32 %sum.022, %inc8
%inc10 = add nuw nsw i32 %i.121, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %search.exit, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %search.exit ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, 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(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 = { 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 MAX 10001
#define NOT_FOUND -1
int linearSearch(int *A, int N, int key) {
int i = 0;
A[N] = key;
while(A[i] != key) {
i++;
}
if(i == N) return NOT_FOUND;
return i;
}
int main() {
int n, q, s[MAX], t, i, count = 0;
scanf("%d", &n);
for(i = 0; i < n; i++) {
scanf("%d", &s[i]);
}
scanf("%d", &q);
for(i = 0; i < q; i++) {
scanf("%d", &t);
if(linearSearch(s, n, t) >= 0) count++;
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140468/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140468/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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @linearSearch(ptr nocapture noundef %A, i32 noundef %N, i32 noundef %key) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %N to i64
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %key
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !9
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
%cmp3 = icmp eq i32 %1, %N
%.i.0 = select i1 %cmp3, i32 -1, i32 %1
ret i32 %.i.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 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
%q = alloca i32, align 4
%s = alloca [10001 x i32], align 16
%t = 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 %q) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %s) #4
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 %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 x i32], ptr %s, 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 !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp422 = icmp sgt i32 %3, 0
br i1 %cmp422, label %for.body5, label %for.end12
for.body5: ; preds = %for.end, %linearSearch.exit
%count.024 = phi i32 [ %spec.select, %linearSearch.exit ], [ 0, %for.end ]
%i.123 = phi i32 [ %inc11, %linearSearch.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %t, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %s, i64 %idxprom.i
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %for.body5
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %for.body5 ]
%arrayidx2.i = getelementptr inbounds i32, ptr %s, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %6, %5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %linearSearch.exit, label %while.cond.i, !llvm.loop !9
linearSearch.exit: ; preds = %while.cond.i
%7 = trunc i64 %indvars.iv.i to i32
%cmp3.i = icmp ne i32 %4, %7
%cmp819 = icmp sgt i32 %7, -1
%cmp8 = and i1 %cmp3.i, %cmp819
%inc9 = zext i1 %cmp8 to i32
%spec.select = add nuw nsw i32 %count.024, %inc9
%inc11 = add nuw nsw i32 %i.123, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc11, %8
br i1 %cmp4, label %for.body5, label %for.end12, !llvm.loop !12
for.end12: ; preds = %linearSearch.exit, %for.end
%count.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %linearSearch.exit ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 4, 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(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 = { 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 linearSearch(int);
int S[10000],n;
int main()
{
int i=0,q,T[500],j=0,c=0;
scanf("%d",&n);
while(i < n){
scanf("%d",&S[i]);
i++;
}
scanf("%d",&q);
while(j < q){
scanf("%d",&T[j]);
j++;
}
for(i = 0;i < q;i++){
c += linearSearch(T[i]);
}
printf("%d",c);
printf("\n");
return 0;
}
int linearSearch(int key)
{
int i=0;
S[n] = key;
while(S[i] != key){
i++;
if(i == n) return 0;
}
return 1;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140525/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140525/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
@S = dso_local global [10000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%q = alloca i32, align 4
%T = alloca [500 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %T) #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
%cmp26 = icmp sgt i32 %0, 0
br i1 %cmp26, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv
%call1 = tail 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 %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp428 = icmp sgt i32 %3, 0
br i1 %cmp428, label %while.body5, label %for.end
for.cond.preheader: ; preds = %while.body5
%cmp1130 = icmp sgt i32 %7, 0
br i1 %cmp1130, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %for.cond.preheader
%4 = load i32, ptr @n, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom.i
%5 = zext i32 %4 to i64
%wide.trip.count = zext i32 %7 to i64
%xtraiter = and i64 %wide.trip.count, 1
%6 = icmp eq i32 %7, 1
br i1 %6, 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 i64 %wide.trip.count, 4294967294
br label %for.body
while.body5: ; preds = %while.end, %while.body5
%indvars.iv36 = phi i64 [ %indvars.iv.next37, %while.body5 ], [ 0, %while.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv36
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
%7 = load i32, ptr %q, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp4 = icmp slt i64 %indvars.iv.next37, %8
br i1 %cmp4, label %while.body5, label %for.cond.preheader, !llvm.loop !11
for.body: ; preds = %linearSearch.exit.1, %for.body.lr.ph.new
%indvars.iv39 = phi i64 [ 0, %for.body.lr.ph.new ], [ %indvars.iv.next40.1, %linearSearch.exit.1 ]
%c.032 = phi i32 [ 0, %for.body.lr.ph.new ], [ %add.1, %linearSearch.exit.1 ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %linearSearch.exit.1 ]
%arrayidx13 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv39
%9 = load i32, ptr %arrayidx13, align 8, !tbaa !5
store i32 %9, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.body.i, %for.body
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.body.i ], [ 0, %for.body ]
%arrayidx2.i = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv.i
%10 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %10, %9
br i1 %cmp.not.i, label %linearSearch.exit, label %while.body.i
while.body.i: ; preds = %while.cond.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%cmp3.i = icmp eq i64 %indvars.iv.next.i, %5
br i1 %cmp3.i, label %linearSearch.exit, label %while.cond.i, !llvm.loop !12
linearSearch.exit: ; preds = %while.cond.i, %while.body.i
%retval.0.i = phi i32 [ 0, %while.body.i ], [ 1, %while.cond.i ]
%add = add nuw nsw i32 %retval.0.i, %c.032
%indvars.iv.next40 = or i64 %indvars.iv39, 1
%arrayidx13.1 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv.next40
%11 = load i32, ptr %arrayidx13.1, align 4, !tbaa !5
store i32 %11, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i.1
while.cond.i.1: ; preds = %while.body.i.1, %linearSearch.exit
%indvars.iv.i.1 = phi i64 [ %indvars.iv.next.i.1, %while.body.i.1 ], [ 0, %linearSearch.exit ]
%arrayidx2.i.1 = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv.i.1
%12 = load i32, ptr %arrayidx2.i.1, align 4, !tbaa !5
%cmp.not.i.1 = icmp eq i32 %12, %11
br i1 %cmp.not.i.1, label %linearSearch.exit.1, label %while.body.i.1
while.body.i.1: ; preds = %while.cond.i.1
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i.1, 1
%cmp3.i.1 = icmp eq i64 %indvars.iv.next.i.1, %5
br i1 %cmp3.i.1, label %linearSearch.exit.1, label %while.cond.i.1, !llvm.loop !12
linearSearch.exit.1: ; preds = %while.body.i.1, %while.cond.i.1
%retval.0.i.1 = phi i32 [ 0, %while.body.i.1 ], [ 1, %while.cond.i.1 ]
%add.1 = add nuw nsw i32 %retval.0.i.1, %add
%indvars.iv.next40.1 = add nuw nsw i64 %indvars.iv39, 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 = %linearSearch.exit.1, %for.body.lr.ph
%add.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %add.1, %linearSearch.exit.1 ]
%indvars.iv39.unr = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next40.1, %linearSearch.exit.1 ]
%c.032.unr = phi i32 [ 0, %for.body.lr.ph ], [ %add.1, %linearSearch.exit.1 ]
%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
%arrayidx13.epil = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv39.unr
%13 = load i32, ptr %arrayidx13.epil, align 4, !tbaa !5
store i32 %13, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i.epil
while.cond.i.epil: ; preds = %while.body.i.epil, %for.body.epil
%indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %while.body.i.epil ], [ 0, %for.body.epil ]
%arrayidx2.i.epil = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv.i.epil
%14 = load i32, ptr %arrayidx2.i.epil, align 4, !tbaa !5
%cmp.not.i.epil = icmp eq i32 %14, %13
br i1 %cmp.not.i.epil, label %linearSearch.exit.epil, label %while.body.i.epil
while.body.i.epil: ; preds = %while.cond.i.epil
%indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.epil, 1
%cmp3.i.epil = icmp eq i64 %indvars.iv.next.i.epil, %5
br i1 %cmp3.i.epil, label %linearSearch.exit.epil, label %while.cond.i.epil, !llvm.loop !12
linearSearch.exit.epil: ; preds = %while.body.i.epil, %while.cond.i.epil
%retval.0.i.epil = phi i32 [ 0, %while.body.i.epil ], [ 1, %while.cond.i.epil ]
%add.epil = add nuw nsw i32 %retval.0.i.epil, %c.032.unr
br label %for.end
for.end: ; preds = %linearSearch.exit.epil, %for.end.loopexit.unr-lcssa, %while.end, %for.cond.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ 0, %while.end ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %linearSearch.exit.epil ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %c.0.lcssa)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %T) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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 norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @linearSearch(i32 noundef %key) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
%1 = zext i32 %0 to i64
br label %while.cond
while.cond: ; preds = %while.body, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv
%2 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %2, %key
br i1 %cmp.not, label %cleanup, label %while.body
while.body: ; preds = %while.cond
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%cmp3 = icmp eq i64 %indvars.iv.next, %1
br i1 %cmp3, label %cleanup, label %while.cond, !llvm.loop !12
cleanup: ; preds = %while.cond, %while.body
%retval.0 = phi i32 [ 0, %while.body ], [ 1, %while.cond ]
ret i32 %retval.0
}
; 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 #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 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 = { 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(){
int n,q,i,j,S[10000],T[500],count = 0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&S[i]);
}
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&T[i]);
}
for(j=0;j<q;j++){
i=0;
S[n] = T[j];
while(S[i] != T[j]){
i++;
}
if(i != n){
count++;
}
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140576/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140576/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
%q = alloca i32, align 4
%S = alloca [10000 x i32], align 16
%T = alloca [500 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 %q) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %T) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp43 = icmp sgt i32 %0, 0
br i1 %cmp43, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %S, 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, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp445 = icmp sgt i32 %3, 0
br i1 %cmp445, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1347 = icmp sgt i32 %6, 0
br i1 %cmp1347, label %for.body14.lr.ph, label %for.end29
for.body14.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%idxprom17 = sext i32 %4 to i64
%arrayidx18 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %idxprom17
%wide.trip.count = zext i32 %6 to i64
%xtraiter = and i64 %wide.trip.count, 1
%5 = icmp eq i32 %6, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.body14.lr.ph.new
for.body14.lr.ph.new: ; preds = %for.body14.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body14
for.body5: ; preds = %for.end, %for.body5
%indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv53
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
%6 = load i32, ptr %q, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp4 = icmp slt i64 %indvars.iv.next54, %7
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !11
for.body14: ; preds = %while.end.1, %for.body14.lr.ph.new
%indvars.iv59 = phi i64 [ 0, %for.body14.lr.ph.new ], [ %indvars.iv.next60.1, %while.end.1 ]
%count.049 = phi i32 [ 0, %for.body14.lr.ph.new ], [ %spec.select.1, %while.end.1 ]
%niter = phi i64 [ 0, %for.body14.lr.ph.new ], [ %niter.next.1, %while.end.1 ]
%arrayidx16 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv59
%8 = load i32, ptr %arrayidx16, align 8, !tbaa !5
store i32 %8, ptr %arrayidx18, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %for.body14
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %while.cond ], [ 0, %for.body14 ]
%arrayidx20 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv56
%9 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp23.not = icmp eq i32 %9, %8
%indvars.iv.next57 = add nuw i64 %indvars.iv56, 1
br i1 %cmp23.not, label %while.end, label %while.cond, !llvm.loop !12
while.end: ; preds = %while.cond
%10 = trunc i64 %indvars.iv56 to i32
%cmp25.not = icmp ne i32 %4, %10
%inc26 = zext i1 %cmp25.not to i32
%spec.select = add nuw nsw i32 %count.049, %inc26
%indvars.iv.next60 = or i64 %indvars.iv59, 1
%arrayidx16.1 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv.next60
%11 = load i32, ptr %arrayidx16.1, align 4, !tbaa !5
store i32 %11, ptr %arrayidx18, align 4, !tbaa !5
br label %while.cond.1
while.cond.1: ; preds = %while.cond.1, %while.end
%indvars.iv56.1 = phi i64 [ %indvars.iv.next57.1, %while.cond.1 ], [ 0, %while.end ]
%arrayidx20.1 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv56.1
%12 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5
%cmp23.not.1 = icmp eq i32 %12, %11
%indvars.iv.next57.1 = add nuw i64 %indvars.iv56.1, 1
br i1 %cmp23.not.1, label %while.end.1, label %while.cond.1, !llvm.loop !12
while.end.1: ; preds = %while.cond.1
%13 = trunc i64 %indvars.iv56.1 to i32
%cmp25.not.1 = icmp ne i32 %4, %13
%inc26.1 = zext i1 %cmp25.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc26.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59, 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.end29.loopexit.unr-lcssa, label %for.body14, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %while.end.1, %for.body14.lr.ph
%spec.select.lcssa.ph = phi i32 [ undef, %for.body14.lr.ph ], [ %spec.select.1, %while.end.1 ]
%indvars.iv59.unr = phi i64 [ 0, %for.body14.lr.ph ], [ %indvars.iv.next60.1, %while.end.1 ]
%count.049.unr = phi i32 [ 0, %for.body14.lr.ph ], [ %spec.select.1, %while.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.body14.epil
for.body14.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx16.epil = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv59.unr
%14 = load i32, ptr %arrayidx16.epil, align 4, !tbaa !5
store i32 %14, ptr %arrayidx18, align 4, !tbaa !5
br label %while.cond.epil
while.cond.epil: ; preds = %while.cond.epil, %for.body14.epil
%indvars.iv56.epil = phi i64 [ %indvars.iv.next57.epil, %while.cond.epil ], [ 0, %for.body14.epil ]
%arrayidx20.epil = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv56.epil
%15 = load i32, ptr %arrayidx20.epil, align 4, !tbaa !5
%cmp23.not.epil = icmp eq i32 %15, %14
%indvars.iv.next57.epil = add nuw i64 %indvars.iv56.epil, 1
br i1 %cmp23.not.epil, label %while.end.epil, label %while.cond.epil, !llvm.loop !12
while.end.epil: ; preds = %while.cond.epil
%16 = trunc i64 %indvars.iv56.epil to i32
%cmp25.not.epil = icmp ne i32 %4, %16
%inc26.epil = zext i1 %cmp25.not.epil to i32
%spec.select.epil = add nuw nsw i32 %count.049.unr, %inc26.epil
br label %for.end29
for.end29: ; preds = %while.end.epil, %for.end29.loopexit.unr-lcssa, %for.end, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.end ], [ %spec.select.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %spec.select.epil, %while.end.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int S[10000];
int n;
int linearSearch(int);
int main(){
int count=0;
int T[500];
int q,i;
int re;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&S[i]);
}
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&T[i]);
}
for(i=0;i<q;i++){
count+=linearSearch(T[i]);
}
printf("%d\n",count);
return 0;
}
int linearSearch(int key){
int i;
for(i=0;i<n;i++){
if(S[i]==key){
return 1;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140619/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140619/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
@S = dso_local global [10000 x i32] zeroinitializer, align 16
@.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:
%T = alloca [500 x i32], align 16
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %T) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv
%call1 = tail 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, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %for.body5, label %for.end20
for.cond12.preheader: ; preds = %for.body5
%cmp1335 = icmp sgt i32 %10, 0
br i1 %cmp1335, label %for.body14.lr.ph, label %for.end20
for.body14.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr @n, align 4, !tbaa !5
%cmp4.i = icmp sgt i32 %4, 0
%wide.trip.count.i = zext i32 %4 to i64
br i1 %cmp4.i, label %for.body14.us.preheader, label %for.end20
for.body14.us.preheader: ; preds = %for.body14.lr.ph
%wide.trip.count = zext i32 %10 to i64
%xtraiter = and i64 %wide.trip.count, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end20.loopexit.unr-lcssa, label %for.body14.us.preheader.new
for.body14.us.preheader.new: ; preds = %for.body14.us.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body14.us
for.body14.us: ; preds = %linearSearch.exit.loopexit.us.1, %for.body14.us.preheader.new
%indvars.iv45 = phi i64 [ 0, %for.body14.us.preheader.new ], [ %indvars.iv.next46.1, %linearSearch.exit.loopexit.us.1 ]
%count.037.us = phi i32 [ 0, %for.body14.us.preheader.new ], [ %add.us.1, %linearSearch.exit.loopexit.us.1 ]
%niter = phi i64 [ 0, %for.body14.us.preheader.new ], [ %niter.next.1, %linearSearch.exit.loopexit.us.1 ]
%arrayidx16.us = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv45
%6 = load i32, ptr %arrayidx16.us, align 8, !tbaa !5
br label %for.body.i.us
for.body.i.us: ; preds = %for.cond.i.us, %for.body14.us
%indvars.iv.i.us = phi i64 [ 0, %for.body14.us ], [ %indvars.iv.next.i.us, %for.cond.i.us ]
%arrayidx.i.us = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv.i.us
%7 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%cmp1.i.us = icmp eq i32 %7, %6
br i1 %cmp1.i.us, label %linearSearch.exit.loopexit.us, label %for.cond.i.us
for.cond.i.us: ; preds = %for.body.i.us
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %linearSearch.exit.loopexit.us, label %for.body.i.us, !llvm.loop !11
linearSearch.exit.loopexit.us: ; preds = %for.cond.i.us, %for.body.i.us
%retval.0.i.ph.us = phi i32 [ 1, %for.body.i.us ], [ 0, %for.cond.i.us ]
%add.us = add nuw nsw i32 %retval.0.i.ph.us, %count.037.us
%indvars.iv.next46 = or i64 %indvars.iv45, 1
%arrayidx16.us.1 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv.next46
%8 = load i32, ptr %arrayidx16.us.1, align 4, !tbaa !5
br label %for.body.i.us.1
for.body.i.us.1: ; preds = %for.cond.i.us.1, %linearSearch.exit.loopexit.us
%indvars.iv.i.us.1 = phi i64 [ 0, %linearSearch.exit.loopexit.us ], [ %indvars.iv.next.i.us.1, %for.cond.i.us.1 ]
%arrayidx.i.us.1 = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv.i.us.1
%9 = load i32, ptr %arrayidx.i.us.1, align 4, !tbaa !5
%cmp1.i.us.1 = icmp eq i32 %9, %8
br i1 %cmp1.i.us.1, label %linearSearch.exit.loopexit.us.1, label %for.cond.i.us.1
for.cond.i.us.1: ; preds = %for.body.i.us.1
%indvars.iv.next.i.us.1 = add nuw nsw i64 %indvars.iv.i.us.1, 1
%exitcond.not.i.us.1 = icmp eq i64 %indvars.iv.next.i.us.1, %wide.trip.count.i
br i1 %exitcond.not.i.us.1, label %linearSearch.exit.loopexit.us.1, label %for.body.i.us.1, !llvm.loop !11
linearSearch.exit.loopexit.us.1: ; preds = %for.cond.i.us.1, %for.body.i.us.1
%retval.0.i.ph.us.1 = phi i32 [ 1, %for.body.i.us.1 ], [ 0, %for.cond.i.us.1 ]
%add.us.1 = add nuw nsw i32 %retval.0.i.ph.us.1, %add.us
%indvars.iv.next46.1 = add nuw nsw i64 %indvars.iv45, 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.end20.loopexit.unr-lcssa, label %for.body14.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv42
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%10 = load i32, ptr %q, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next43, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end20.loopexit.unr-lcssa: ; preds = %linearSearch.exit.loopexit.us.1, %for.body14.us.preheader
%add.us.lcssa.ph = phi i32 [ undef, %for.body14.us.preheader ], [ %add.us.1, %linearSearch.exit.loopexit.us.1 ]
%indvars.iv45.unr = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next46.1, %linearSearch.exit.loopexit.us.1 ]
%count.037.us.unr = phi i32 [ 0, %for.body14.us.preheader ], [ %add.us.1, %linearSearch.exit.loopexit.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end20, label %for.body14.us.epil
for.body14.us.epil: ; preds = %for.end20.loopexit.unr-lcssa
%arrayidx16.us.epil = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv45.unr
%12 = load i32, ptr %arrayidx16.us.epil, align 4, !tbaa !5
br label %for.body.i.us.epil
for.body.i.us.epil: ; preds = %for.cond.i.us.epil, %for.body14.us.epil
%indvars.iv.i.us.epil = phi i64 [ 0, %for.body14.us.epil ], [ %indvars.iv.next.i.us.epil, %for.cond.i.us.epil ]
%arrayidx.i.us.epil = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv.i.us.epil
%13 = load i32, ptr %arrayidx.i.us.epil, align 4, !tbaa !5
%cmp1.i.us.epil = icmp eq i32 %13, %12
br i1 %cmp1.i.us.epil, label %linearSearch.exit.loopexit.us.epil, label %for.cond.i.us.epil
for.cond.i.us.epil: ; preds = %for.body.i.us.epil
%indvars.iv.next.i.us.epil = add nuw nsw i64 %indvars.iv.i.us.epil, 1
%exitcond.not.i.us.epil = icmp eq i64 %indvars.iv.next.i.us.epil, %wide.trip.count.i
br i1 %exitcond.not.i.us.epil, label %linearSearch.exit.loopexit.us.epil, label %for.body.i.us.epil, !llvm.loop !11
linearSearch.exit.loopexit.us.epil: ; preds = %for.cond.i.us.epil, %for.body.i.us.epil
%retval.0.i.ph.us.epil = phi i32 [ 1, %for.body.i.us.epil ], [ 0, %for.cond.i.us.epil ]
%add.us.epil = add nuw nsw i32 %retval.0.i.ph.us.epil, %count.037.us.unr
br label %for.end20
for.end20: ; preds = %linearSearch.exit.loopexit.us.epil, %for.end20.loopexit.unr-lcssa, %for.end, %for.body14.lr.ph, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %add.us.lcssa.ph, %for.end20.loopexit.unr-lcssa ], [ %add.us.epil, %linearSearch.exit.loopexit.us.epil ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 2000, 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: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @linearSearch(i32 noundef %key) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %0, 0
br i1 %cmp4, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.cond: ; preds = %for.body
%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 %cleanup, label %for.body, !llvm.loop !11
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %1, %key
br i1 %cmp1, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.0
}
; 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 = { nofree norecurse nosync nounwind 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 #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}
|
#include<stdio.h>
int search(int A[],int n,int key){
int i=0;
A[n]=key;
while(A[i]!=key)i++;
return i != n;
}
int main(){
int i,n,A[10000+1],q,key,sum=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&key);
if(search(A,n,key))sum++;
}
printf("%d\n",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140662/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140662/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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @search(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %key) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %key
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !9
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
%cmp3 = icmp ne i32 %1, %n
%conv = zext i1 %cmp3 to i32
ret i32 %conv
}
; 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
%A = alloca [10001 x i32], align 16
%q = alloca i32, align 4
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 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
%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 !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp420 = icmp sgt i32 %3, 0
br i1 %cmp420, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %search.exit
%sum.022 = phi i32 [ %spec.select, %search.exit ], [ 0, %for.end ]
%i.121 = phi i32 [ %inc10, %search.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %key, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %idxprom.i
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %for.body5
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %for.body5 ]
%arrayidx2.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %6, %5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %search.exit, label %while.cond.i, !llvm.loop !9
search.exit: ; preds = %while.cond.i
%7 = trunc i64 %indvars.iv.i to i32
%cmp3.i.not = icmp ne i32 %4, %7
%inc8 = zext i1 %cmp3.i.not to i32
%spec.select = add nuw nsw i32 %sum.022, %inc8
%inc10 = add nuw nsw i32 %i.121, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %search.exit, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %search.exit ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, 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(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 = { 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 N 10000
#define Q 500
int main(){
int i,j,n,q;
int S[N],T[Q],count=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&S[i]);
}
scanf("%d",&q);
for(j=0;j<q;j++){
scanf("%d",&T[j]);
for(i=0;i<n;i++){
if(S[i]==T[j]){
count++;
break;
}
}
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140705/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140705/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
%q = alloca i32, align 4
%S = alloca [10000 x i32], align 16
%T = alloca [500 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 %q) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %T) #3
%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.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %S, 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, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp438 = icmp sgt i32 %3, 0
br i1 %cmp438, label %for.body5, label %for.end23
for.body5: ; preds = %for.end, %for.inc21
%indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.inc21 ], [ 0, %for.end ]
%count.040 = phi i32 [ %count.1, %for.inc21 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv45
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1036 = icmp sgt i32 %4, 0
br i1 %cmp1036, label %for.body11.lr.ph, label %for.inc21
for.body11.lr.ph: ; preds = %for.body5
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%wide.trip.count = zext i32 %4 to i64
br label %for.body11
for.cond9: ; preds = %for.body11
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%exitcond.not = icmp eq i64 %indvars.iv.next43, %wide.trip.count
br i1 %exitcond.not, label %for.inc21, label %for.body11, !llvm.loop !11
for.body11: ; preds = %for.body11.lr.ph, %for.cond9
%indvars.iv42 = phi i64 [ 0, %for.body11.lr.ph ], [ %indvars.iv.next43, %for.cond9 ]
%arrayidx13 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv42
%6 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp16 = icmp eq i32 %6, %5
br i1 %cmp16, label %if.then, label %for.cond9
if.then: ; preds = %for.body11
%inc17 = add nsw i32 %count.040, 1
br label %for.inc21
for.inc21: ; preds = %for.cond9, %for.body5, %if.then
%count.1 = phi i32 [ %inc17, %if.then ], [ %count.040, %for.body5 ], [ %count.040, %for.cond9 ]
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%7 = load i32, ptr %q, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp4 = icmp slt i64 %indvars.iv.next46, %8
br i1 %cmp4, label %for.body5, label %for.end23, !llvm.loop !12
for.end23: ; preds = %for.inc21, %for.end
%count.0.lcssa = phi i32 [ 0, %for.end ], [ %count.1, %for.inc21 ]
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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>
int search(int A[],int n,int key){
int i = 0;
int a = 0;
A[n] = key;
while(A[i] != key){
i++;
}
if(i != n)
a = 1;
return a;
}
int main(){
int i, n, q, S[10000+1], c , key= 0;
scanf("%d",&n);
for(i = 0;i < n;i++){
scanf("%d ",&S[i]);
}
scanf("%d",&q);
for(i = 0;i < q;i++){
scanf("%d ",&key);
if(search(S, n, key) == 1)
c++;
}
printf("%d\n",c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140756/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140756/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 \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @search(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %key) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %key
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !9
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
%cmp3.not = icmp ne i32 %1, %n
%spec.select = zext i1 %cmp3.not to i32
ret i32 %spec.select
}
; 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
%q = alloca i32, align 4
%S = alloca [10001 x i32], align 16
%key = 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 %q) #5
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %S) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #5
store i32 0, ptr %key, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 x i32], ptr %S, 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.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp421 = icmp sgt i32 %3, 0
call void @llvm.assume(i1 %cmp421)
br label %for.body5
for.body5: ; preds = %for.end, %search.exit
%c.023 = phi i32 [ %spec.select, %search.exit ], [ undef, %for.end ]
%i.122 = phi i32 [ %inc11, %search.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %key)
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %key, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %S, i64 %idxprom.i
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %for.body5
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %for.body5 ]
%arrayidx2.i = getelementptr inbounds i32, ptr %S, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %6, %5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %search.exit, label %while.cond.i, !llvm.loop !9
search.exit: ; preds = %while.cond.i
%7 = trunc i64 %indvars.iv.i to i32
%cmp3.not.i.not = icmp ne i32 %4, %7
%inc9 = zext i1 %cmp3.not.i.not to i32
%spec.select = add nsw i32 %c.023, %inc9
%inc11 = add nuw nsw i32 %i.122, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc11, %8
br i1 %cmp4, label %for.body5, label %for.end12, !llvm.loop !12
for.end12: ; preds = %search.exit
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.select)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #5
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %S) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4
attributes #0 = { nofree norecurse nosync nounwind 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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: 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.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int search(int,int *,int);
int main(){
int n,q;
int s[100001],t[50000];
scanf("%d",&n);
int i;
for (i=0;i<n;i++)
scanf("%d",&s[i]);
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&t[i]);
}
int count = 0;
for(i=0;i<q;i++)
if(search(n,s,t[i])) count++;
printf("%d\n",count);
return 0;
}
int search(int n,int *s,int t){
s[n] = t;
int i=0;
while(s[i]!=t)i++;
return i!=n;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140806/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140806/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
%q = alloca i32, align 4
%s = alloca [100001 x i32], align 16
%t = alloca [50000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp32 = icmp sgt i32 %0, 0
br i1 %cmp32, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100001 x i32], ptr %s, 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, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp434 = icmp sgt i32 %3, 0
br i1 %cmp434, label %for.body5, label %for.end21
for.cond12.preheader: ; preds = %for.body5
%cmp1336 = icmp sgt i32 %6, 0
br i1 %cmp1336, label %for.body14.lr.ph, label %for.end21
for.body14.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %s, i64 %idxprom.i
%wide.trip.count = zext i32 %6 to i64
%xtraiter = and i64 %wide.trip.count, 1
%5 = icmp eq i32 %6, 1
br i1 %5, label %for.end21.loopexit.unr-lcssa, label %for.body14.lr.ph.new
for.body14.lr.ph.new: ; preds = %for.body14.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body14
for.body5: ; preds = %for.end, %for.body5
%indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [50000 x i32], ptr %t, i64 0, i64 %indvars.iv42
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%6 = load i32, ptr %q, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp4 = icmp slt i64 %indvars.iv.next43, %7
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !11
for.body14: ; preds = %search.exit.1, %for.body14.lr.ph.new
%indvars.iv45 = phi i64 [ 0, %for.body14.lr.ph.new ], [ %indvars.iv.next46.1, %search.exit.1 ]
%count.038 = phi i32 [ 0, %for.body14.lr.ph.new ], [ %spec.select.1, %search.exit.1 ]
%niter = phi i64 [ 0, %for.body14.lr.ph.new ], [ %niter.next.1, %search.exit.1 ]
%arrayidx16 = getelementptr inbounds [50000 x i32], ptr %t, i64 0, i64 %indvars.iv45
%8 = load i32, ptr %arrayidx16, align 8, !tbaa !5
store i32 %8, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %for.body14
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %for.body14 ]
%arrayidx2.i = getelementptr inbounds i32, ptr %s, i64 %indvars.iv.i
%9 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %9, %8
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %search.exit, label %while.cond.i, !llvm.loop !12
search.exit: ; preds = %while.cond.i
%10 = trunc i64 %indvars.iv.i to i32
%cmp3.i.not = icmp ne i32 %4, %10
%inc18 = zext i1 %cmp3.i.not to i32
%spec.select = add nuw nsw i32 %count.038, %inc18
%indvars.iv.next46 = or i64 %indvars.iv45, 1
%arrayidx16.1 = getelementptr inbounds [50000 x i32], ptr %t, i64 0, i64 %indvars.iv.next46
%11 = load i32, ptr %arrayidx16.1, align 4, !tbaa !5
store i32 %11, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i.1
while.cond.i.1: ; preds = %while.cond.i.1, %search.exit
%indvars.iv.i.1 = phi i64 [ %indvars.iv.next.i.1, %while.cond.i.1 ], [ 0, %search.exit ]
%arrayidx2.i.1 = getelementptr inbounds i32, ptr %s, i64 %indvars.iv.i.1
%12 = load i32, ptr %arrayidx2.i.1, align 4, !tbaa !5
%cmp.not.i.1 = icmp eq i32 %12, %11
%indvars.iv.next.i.1 = add nuw i64 %indvars.iv.i.1, 1
br i1 %cmp.not.i.1, label %search.exit.1, label %while.cond.i.1, !llvm.loop !12
search.exit.1: ; preds = %while.cond.i.1
%13 = trunc i64 %indvars.iv.i.1 to i32
%cmp3.i.not.1 = icmp ne i32 %4, %13
%inc18.1 = zext i1 %cmp3.i.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc18.1
%indvars.iv.next46.1 = add nuw nsw i64 %indvars.iv45, 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.end21.loopexit.unr-lcssa, label %for.body14, !llvm.loop !13
for.end21.loopexit.unr-lcssa: ; preds = %search.exit.1, %for.body14.lr.ph
%spec.select.lcssa.ph = phi i32 [ undef, %for.body14.lr.ph ], [ %spec.select.1, %search.exit.1 ]
%indvars.iv45.unr = phi i64 [ 0, %for.body14.lr.ph ], [ %indvars.iv.next46.1, %search.exit.1 ]
%count.038.unr = phi i32 [ 0, %for.body14.lr.ph ], [ %spec.select.1, %search.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end21, label %for.body14.epil
for.body14.epil: ; preds = %for.end21.loopexit.unr-lcssa
%arrayidx16.epil = getelementptr inbounds [50000 x i32], ptr %t, i64 0, i64 %indvars.iv45.unr
%14 = load i32, ptr %arrayidx16.epil, align 4, !tbaa !5
store i32 %14, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i.epil
while.cond.i.epil: ; preds = %while.cond.i.epil, %for.body14.epil
%indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %while.cond.i.epil ], [ 0, %for.body14.epil ]
%arrayidx2.i.epil = getelementptr inbounds i32, ptr %s, i64 %indvars.iv.i.epil
%15 = load i32, ptr %arrayidx2.i.epil, align 4, !tbaa !5
%cmp.not.i.epil = icmp eq i32 %15, %14
%indvars.iv.next.i.epil = add nuw i64 %indvars.iv.i.epil, 1
br i1 %cmp.not.i.epil, label %search.exit.epil, label %while.cond.i.epil, !llvm.loop !12
search.exit.epil: ; preds = %while.cond.i.epil
%16 = trunc i64 %indvars.iv.i.epil to i32
%cmp3.i.not.epil = icmp ne i32 %4, %16
%inc18.epil = zext i1 %cmp3.i.not.epil to i32
%spec.select.epil = add nuw nsw i32 %count.038.unr, %inc18.epil
br label %for.end21
for.end21: ; preds = %search.exit.epil, %for.end21.loopexit.unr-lcssa, %for.end, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.end ], [ %spec.select.lcssa.ph, %for.end21.loopexit.unr-lcssa ], [ %spec.select.epil, %search.exit.epil ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @search(i32 noundef %n, ptr nocapture noundef %s, i32 noundef %t) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds i32, ptr %s, i64 %idxprom
store i32 %t, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %s, i64 %indvars.iv
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %t
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !12
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
%cmp3 = icmp ne i32 %1, %n
%conv = zext i1 %cmp3 to i32
ret i32 %conv
}
; 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 = { nofree norecurse nosync nounwind 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 #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}
|
#include<stdio.h>
int fun(int i,int j, int x, int y)
{
if(i==x&&j<y)
return 6;
if(i==x&&j>y)
return 2;
if(y==j&&x<i)
return 4;
if(y==j&&x>i)
return 0;
if(x-i==y-j)
{
if(x<i)
return 3;
else
return 7;
}
if(i+j==x+y)
{
if(x<i)
return 5;
else
return 1;
}
return -1;
}
struct pos{
int x, y;
char ch;
};
typedef struct pos pieces;
int main()
{
int n;char ch1;
int i,pos1,pos2,posx,posy;
pieces pi[8];
scanf("%d",&n);
scanf("%d %d",&pos1,&pos2);
pi[0].x=-1e9;
pi[0].y=pos2;
pi[1].x=-1e9;
pi[1].y=1e9;
pi[2].x=pos1;
pi[2].y=1e9;
pi[3].x=1e9;
pi[3].y=1e9;
pi[4].x=1e9;
pi[4].y=pos2;
pi[5].x=1e9;
pi[5].y=-1e9;
pi[6].x=pos1;
pi[6].y=-1e9;
pi[7].x=-1e9;
pi[7].y=-1e9;
int find=0;
for(i=0;i<n;i++)
{
scanf(" %c",&ch1);
scanf("%d %d",&posx,&posy);
//posx-=pos1;posy-=pos2;
switch(fun(posx,posy,pos1,pos2))
{
case -1:break;
case 0:if(posx>=pi[0].x){pi[0].x=posx;pi[0].ch=ch1;}break;
case 2:if(posy<=pi[2].y){pi[2].y=posy;pi[2].ch=ch1;}break;
case 4:if(posx<=pi[4].x){pi[4].x=posx;pi[4].ch=ch1;}break;
case 6:if(posy>=pi[6].y){pi[6].y=posy;pi[6].ch=ch1;}break;
case 1:if(posx>=pi[1].x){pi[1].x=posx;pi[1].ch=ch1;}break;
case 3:if(posx<=pi[3].x){pi[3].x=posx;pi[3].ch=ch1;}break;
case 5:if(posx<=pi[5].x){pi[5].x=posx;pi[5].ch=ch1;}break;
case 7:if(posx>=pi[7].x){pi[7].x=posx;pi[7].ch=ch1;}break;
}
}
if(pi[0].ch=='Q'||pi[0].ch=='R')
{
find++;
}
else if(pi[2].ch=='Q'||pi[2].ch=='R')
find++;
else if(pi[4].ch=='Q'||pi[4].ch=='R')
find++;
else if(pi[6].ch=='Q'||pi[6].ch=='R')
find++;
else if(pi[1].ch=='Q'||pi[1].ch=='B')
find++;
else if(pi[3].ch=='Q'||pi[3].ch=='B')
find++;
else if(pi[5].ch=='Q'||pi[5].ch=='B')
find++;
else if(pi[7].ch=='Q'||pi[7].ch=='B')
find++;
if(find!=0)
printf("YES");
else
printf("NO");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14085/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14085/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 [4 x i8] c" %c\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @fun(i32 noundef %i, i32 noundef %j, i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %i, %x
%cmp1 = icmp slt i32 %j, %y
%or.cond = and i1 %cmp, %cmp1
br i1 %or.cond, label %return, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i32 %j, %y
%or.cond54 = and i1 %cmp, %cmp4
br i1 %or.cond54, label %return, label %if.end6
if.end6: ; preds = %if.end
%cmp7 = icmp eq i32 %y, %j
%cmp9 = icmp slt i32 %x, %i
%or.cond55 = and i1 %cmp9, %cmp7
br i1 %or.cond55, label %return, label %if.end11
if.end11: ; preds = %if.end6
%cmp14 = icmp sgt i32 %x, %i
%or.cond56 = and i1 %cmp14, %cmp7
br i1 %or.cond56, label %return, label %if.end16
if.end16: ; preds = %if.end11
%sub = sub nsw i32 %x, %i
%sub17 = sub nsw i32 %y, %j
%cmp18 = icmp eq i32 %sub, %sub17
br i1 %cmp18, label %if.then19, label %if.end22
if.then19: ; preds = %if.end16
%. = select i1 %cmp9, i32 3, i32 7
br label %return
if.end22: ; preds = %if.end16
%add = add nsw i32 %j, %i
%add23 = add nsw i32 %y, %x
%cmp24 = icmp eq i32 %add, %add23
%.57 = select i1 %cmp9, i32 5, i32 1
%spec.select = select i1 %cmp24, i32 %.57, i32 -1
br label %return
return: ; preds = %if.end22, %if.then19, %if.end11, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ 6, %entry ], [ 2, %if.end ], [ 4, %if.end6 ], [ 0, %if.end11 ], [ %., %if.then19 ], [ %spec.select, %if.end22 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%ch1 = alloca i8, align 1
%pos1 = alloca i32, align 4
%pos2 = alloca i32, align 4
%posx = alloca i32, align 4
%posy = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %ch1) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %pos1) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %pos2) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %posx) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %posy) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %pos1, ptr noundef nonnull %pos2)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp303 = icmp sgt i32 %0, 0
br i1 %cmp303, label %for.body, label %if.end232
for.body: ; preds = %entry, %for.inc
%pi.sroa.0.0320 = phi i32 [ %pi.sroa.0.1, %for.inc ], [ -1000000000, %entry ]
%i.0319 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%pi.sroa.6.0318 = phi i8 [ %pi.sroa.6.1, %for.inc ], [ undef, %entry ]
%pi.sroa.55.0317 = phi i8 [ %pi.sroa.55.1, %for.inc ], [ undef, %entry ]
%pi.sroa.9249.0316 = phi i32 [ %pi.sroa.9249.1, %for.inc ], [ -1000000000, %entry ]
%pi.sroa.51261.0315 = phi i32 [ %pi.sroa.51261.1, %for.inc ], [ -1000000000, %entry ]
%pi.sroa.13.0314 = phi i8 [ %pi.sroa.13.1, %for.inc ], [ undef, %entry ]
%pi.sroa.48.0313 = phi i8 [ %pi.sroa.48.1, %for.inc ], [ undef, %entry ]
%pi.sroa.45.0312 = phi i32 [ %pi.sroa.45.1, %for.inc ], [ -1000000000, %entry ]
%pi.sroa.17.0311 = phi i32 [ %pi.sroa.17.1, %for.inc ], [ 1000000000, %entry ]
%pi.sroa.20.0310 = phi i8 [ %pi.sroa.20.1, %for.inc ], [ undef, %entry ]
%pi.sroa.41.0309 = phi i8 [ %pi.sroa.41.1, %for.inc ], [ undef, %entry ]
%pi.sroa.23253.0308 = phi i32 [ %pi.sroa.23253.1, %for.inc ], [ 1000000000, %entry ]
%pi.sroa.37257.0307 = phi i32 [ %pi.sroa.37257.1, %for.inc ], [ 1000000000, %entry ]
%pi.sroa.27.0306 = phi i8 [ %pi.sroa.27.1, %for.inc ], [ undef, %entry ]
%pi.sroa.34.0305 = phi i8 [ %pi.sroa.34.1, %for.inc ], [ undef, %entry ]
%pi.sroa.30255.0304 = phi i32 [ %pi.sroa.30255.1, %for.inc ], [ 1000000000, %entry ]
%call31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %ch1)
%call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %posx, ptr noundef nonnull %posy)
%1 = load i32, ptr %posx, align 4, !tbaa !5
%2 = load i32, ptr %posy, align 4, !tbaa !5
%3 = load i32, ptr %pos1, align 4, !tbaa !5
%4 = load i32, ptr %pos2, align 4, !tbaa !5
%cmp.i = icmp eq i32 %1, %3
%cmp1.i = icmp slt i32 %2, %4
%or.cond.i = and i1 %cmp.i, %cmp1.i
br i1 %or.cond.i, label %sw.bb60, label %if.end.i
if.end.i: ; preds = %for.body
%cmp4.i = icmp sgt i32 %2, %4
%or.cond54.i = and i1 %cmp.i, %cmp4.i
br i1 %or.cond54.i, label %sw.bb40, label %if.end6.i
if.end6.i: ; preds = %if.end.i
%cmp7.i = icmp eq i32 %4, %2
%cmp9.i = icmp slt i32 %3, %1
%or.cond55.i = and i1 %cmp9.i, %cmp7.i
br i1 %or.cond55.i, label %sw.bb50, label %if.end11.i
if.end11.i: ; preds = %if.end6.i
%cmp14.i = icmp sgt i32 %3, %1
%or.cond56.i = and i1 %cmp14.i, %cmp7.i
br i1 %or.cond56.i, label %sw.bb, label %if.end16.i
if.end16.i: ; preds = %if.end11.i
%sub.i = sub nsw i32 %3, %1
%sub17.i = sub nsw i32 %4, %2
%cmp18.i = icmp eq i32 %sub.i, %sub17.i
br i1 %cmp18.i, label %if.then19.i, label %if.end22.i
if.then19.i: ; preds = %if.end16.i
%5 = load i8, ptr %ch1, align 1
br i1 %cmp9.i, label %sw.bb80, label %sw.bb100
if.end22.i: ; preds = %if.end16.i
%add.i = add nsw i32 %2, %1
%add23.i = add nsw i32 %4, %3
%cmp24.i = icmp eq i32 %add.i, %add23.i
br i1 %cmp24.i, label %fun.exit, label %for.inc
fun.exit: ; preds = %if.end22.i
%6 = load i8, ptr %ch1, align 1
br i1 %cmp9.i, label %sw.bb90, label %sw.bb70
sw.bb: ; preds = %if.end11.i
%cmp36.not = icmp slt i32 %1, %pi.sroa.0.0320
%7 = load i8, ptr %ch1, align 1
%spec.select = select i1 %cmp36.not, i8 %pi.sroa.6.0318, i8 %7
%spec.select271 = call i32 @llvm.smax.i32(i32 %1, i32 %pi.sroa.0.0320)
br label %for.inc
sw.bb40: ; preds = %if.end.i
%cmp43.not = icmp sgt i32 %2, %pi.sroa.17.0311
%8 = load i8, ptr %ch1, align 1
%spec.select272 = select i1 %cmp43.not, i8 %pi.sroa.20.0310, i8 %8
%spec.select273 = call i32 @llvm.smin.i32(i32 %2, i32 %pi.sroa.17.0311)
br label %for.inc
sw.bb50: ; preds = %if.end6.i
%cmp53.not = icmp sgt i32 %1, %pi.sroa.30255.0304
%9 = load i8, ptr %ch1, align 1
%spec.select274 = call i32 @llvm.smin.i32(i32 %1, i32 %pi.sroa.30255.0304)
%spec.select275 = select i1 %cmp53.not, i8 %pi.sroa.34.0305, i8 %9
br label %for.inc
sw.bb60: ; preds = %for.body
%cmp63.not = icmp slt i32 %2, %pi.sroa.45.0312
%10 = load i8, ptr %ch1, align 1
%spec.select276 = call i32 @llvm.smax.i32(i32 %2, i32 %pi.sroa.45.0312)
%spec.select277 = select i1 %cmp63.not, i8 %pi.sroa.48.0313, i8 %10
br label %for.inc
sw.bb70: ; preds = %fun.exit
%cmp73.not = icmp slt i32 %1, %pi.sroa.9249.0316
%spec.select278 = select i1 %cmp73.not, i8 %pi.sroa.13.0314, i8 %6
%spec.select279 = call i32 @llvm.smax.i32(i32 %1, i32 %pi.sroa.9249.0316)
br label %for.inc
sw.bb80: ; preds = %if.then19.i
%cmp83.not = icmp sgt i32 %1, %pi.sroa.23253.0308
%spec.select280 = select i1 %cmp83.not, i8 %pi.sroa.27.0306, i8 %5
%spec.select281 = call i32 @llvm.smin.i32(i32 %1, i32 %pi.sroa.23253.0308)
br label %for.inc
sw.bb90: ; preds = %fun.exit
%cmp93.not = icmp sgt i32 %1, %pi.sroa.37257.0307
%spec.select282 = call i32 @llvm.smin.i32(i32 %1, i32 %pi.sroa.37257.0307)
%spec.select283 = select i1 %cmp93.not, i8 %pi.sroa.41.0309, i8 %6
br label %for.inc
sw.bb100: ; preds = %if.then19.i
%cmp103.not = icmp slt i32 %1, %pi.sroa.51261.0315
%spec.select284 = call i32 @llvm.smax.i32(i32 %1, i32 %pi.sroa.51261.0315)
%spec.select285 = select i1 %cmp103.not, i8 %pi.sroa.55.0317, i8 %5
br label %for.inc
for.inc: ; preds = %if.end22.i, %sw.bb100, %sw.bb90, %sw.bb80, %sw.bb70, %sw.bb60, %sw.bb50, %sw.bb40, %sw.bb
%pi.sroa.30255.1 = phi i32 [ %pi.sroa.30255.0304, %sw.bb ], [ %pi.sroa.30255.0304, %sw.bb40 ], [ %spec.select274, %sw.bb50 ], [ %pi.sroa.30255.0304, %sw.bb60 ], [ %pi.sroa.30255.0304, %sw.bb70 ], [ %pi.sroa.30255.0304, %sw.bb80 ], [ %pi.sroa.30255.0304, %sw.bb90 ], [ %pi.sroa.30255.0304, %sw.bb100 ], [ %pi.sroa.30255.0304, %if.end22.i ]
%pi.sroa.34.1 = phi i8 [ %pi.sroa.34.0305, %sw.bb ], [ %pi.sroa.34.0305, %sw.bb40 ], [ %spec.select275, %sw.bb50 ], [ %pi.sroa.34.0305, %sw.bb60 ], [ %pi.sroa.34.0305, %sw.bb70 ], [ %pi.sroa.34.0305, %sw.bb80 ], [ %pi.sroa.34.0305, %sw.bb90 ], [ %pi.sroa.34.0305, %sw.bb100 ], [ %pi.sroa.34.0305, %if.end22.i ]
%pi.sroa.27.1 = phi i8 [ %pi.sroa.27.0306, %sw.bb ], [ %pi.sroa.27.0306, %sw.bb40 ], [ %pi.sroa.27.0306, %sw.bb50 ], [ %pi.sroa.27.0306, %sw.bb60 ], [ %pi.sroa.27.0306, %sw.bb70 ], [ %spec.select280, %sw.bb80 ], [ %pi.sroa.27.0306, %sw.bb90 ], [ %pi.sroa.27.0306, %sw.bb100 ], [ %pi.sroa.27.0306, %if.end22.i ]
%pi.sroa.37257.1 = phi i32 [ %pi.sroa.37257.0307, %sw.bb ], [ %pi.sroa.37257.0307, %sw.bb40 ], [ %pi.sroa.37257.0307, %sw.bb50 ], [ %pi.sroa.37257.0307, %sw.bb60 ], [ %pi.sroa.37257.0307, %sw.bb70 ], [ %pi.sroa.37257.0307, %sw.bb80 ], [ %spec.select282, %sw.bb90 ], [ %pi.sroa.37257.0307, %sw.bb100 ], [ %pi.sroa.37257.0307, %if.end22.i ]
%pi.sroa.23253.1 = phi i32 [ %pi.sroa.23253.0308, %sw.bb ], [ %pi.sroa.23253.0308, %sw.bb40 ], [ %pi.sroa.23253.0308, %sw.bb50 ], [ %pi.sroa.23253.0308, %sw.bb60 ], [ %pi.sroa.23253.0308, %sw.bb70 ], [ %spec.select281, %sw.bb80 ], [ %pi.sroa.23253.0308, %sw.bb90 ], [ %pi.sroa.23253.0308, %sw.bb100 ], [ %pi.sroa.23253.0308, %if.end22.i ]
%pi.sroa.41.1 = phi i8 [ %pi.sroa.41.0309, %sw.bb ], [ %pi.sroa.41.0309, %sw.bb40 ], [ %pi.sroa.41.0309, %sw.bb50 ], [ %pi.sroa.41.0309, %sw.bb60 ], [ %pi.sroa.41.0309, %sw.bb70 ], [ %pi.sroa.41.0309, %sw.bb80 ], [ %spec.select283, %sw.bb90 ], [ %pi.sroa.41.0309, %sw.bb100 ], [ %pi.sroa.41.0309, %if.end22.i ]
%pi.sroa.20.1 = phi i8 [ %pi.sroa.20.0310, %sw.bb ], [ %spec.select272, %sw.bb40 ], [ %pi.sroa.20.0310, %sw.bb50 ], [ %pi.sroa.20.0310, %sw.bb60 ], [ %pi.sroa.20.0310, %sw.bb70 ], [ %pi.sroa.20.0310, %sw.bb80 ], [ %pi.sroa.20.0310, %sw.bb90 ], [ %pi.sroa.20.0310, %sw.bb100 ], [ %pi.sroa.20.0310, %if.end22.i ]
%pi.sroa.17.1 = phi i32 [ %pi.sroa.17.0311, %sw.bb ], [ %spec.select273, %sw.bb40 ], [ %pi.sroa.17.0311, %sw.bb50 ], [ %pi.sroa.17.0311, %sw.bb60 ], [ %pi.sroa.17.0311, %sw.bb70 ], [ %pi.sroa.17.0311, %sw.bb80 ], [ %pi.sroa.17.0311, %sw.bb90 ], [ %pi.sroa.17.0311, %sw.bb100 ], [ %pi.sroa.17.0311, %if.end22.i ]
%pi.sroa.45.1 = phi i32 [ %pi.sroa.45.0312, %sw.bb ], [ %pi.sroa.45.0312, %sw.bb40 ], [ %pi.sroa.45.0312, %sw.bb50 ], [ %spec.select276, %sw.bb60 ], [ %pi.sroa.45.0312, %sw.bb70 ], [ %pi.sroa.45.0312, %sw.bb80 ], [ %pi.sroa.45.0312, %sw.bb90 ], [ %pi.sroa.45.0312, %sw.bb100 ], [ %pi.sroa.45.0312, %if.end22.i ]
%pi.sroa.48.1 = phi i8 [ %pi.sroa.48.0313, %sw.bb ], [ %pi.sroa.48.0313, %sw.bb40 ], [ %pi.sroa.48.0313, %sw.bb50 ], [ %spec.select277, %sw.bb60 ], [ %pi.sroa.48.0313, %sw.bb70 ], [ %pi.sroa.48.0313, %sw.bb80 ], [ %pi.sroa.48.0313, %sw.bb90 ], [ %pi.sroa.48.0313, %sw.bb100 ], [ %pi.sroa.48.0313, %if.end22.i ]
%pi.sroa.13.1 = phi i8 [ %pi.sroa.13.0314, %sw.bb ], [ %pi.sroa.13.0314, %sw.bb40 ], [ %pi.sroa.13.0314, %sw.bb50 ], [ %pi.sroa.13.0314, %sw.bb60 ], [ %spec.select278, %sw.bb70 ], [ %pi.sroa.13.0314, %sw.bb80 ], [ %pi.sroa.13.0314, %sw.bb90 ], [ %pi.sroa.13.0314, %sw.bb100 ], [ %pi.sroa.13.0314, %if.end22.i ]
%pi.sroa.51261.1 = phi i32 [ %pi.sroa.51261.0315, %sw.bb ], [ %pi.sroa.51261.0315, %sw.bb40 ], [ %pi.sroa.51261.0315, %sw.bb50 ], [ %pi.sroa.51261.0315, %sw.bb60 ], [ %pi.sroa.51261.0315, %sw.bb70 ], [ %pi.sroa.51261.0315, %sw.bb80 ], [ %pi.sroa.51261.0315, %sw.bb90 ], [ %spec.select284, %sw.bb100 ], [ %pi.sroa.51261.0315, %if.end22.i ]
%pi.sroa.9249.1 = phi i32 [ %pi.sroa.9249.0316, %sw.bb ], [ %pi.sroa.9249.0316, %sw.bb40 ], [ %pi.sroa.9249.0316, %sw.bb50 ], [ %pi.sroa.9249.0316, %sw.bb60 ], [ %spec.select279, %sw.bb70 ], [ %pi.sroa.9249.0316, %sw.bb80 ], [ %pi.sroa.9249.0316, %sw.bb90 ], [ %pi.sroa.9249.0316, %sw.bb100 ], [ %pi.sroa.9249.0316, %if.end22.i ]
%pi.sroa.55.1 = phi i8 [ %pi.sroa.55.0317, %sw.bb ], [ %pi.sroa.55.0317, %sw.bb40 ], [ %pi.sroa.55.0317, %sw.bb50 ], [ %pi.sroa.55.0317, %sw.bb60 ], [ %pi.sroa.55.0317, %sw.bb70 ], [ %pi.sroa.55.0317, %sw.bb80 ], [ %pi.sroa.55.0317, %sw.bb90 ], [ %spec.select285, %sw.bb100 ], [ %pi.sroa.55.0317, %if.end22.i ]
%pi.sroa.6.1 = phi i8 [ %spec.select, %sw.bb ], [ %pi.sroa.6.0318, %sw.bb40 ], [ %pi.sroa.6.0318, %sw.bb50 ], [ %pi.sroa.6.0318, %sw.bb60 ], [ %pi.sroa.6.0318, %sw.bb70 ], [ %pi.sroa.6.0318, %sw.bb80 ], [ %pi.sroa.6.0318, %sw.bb90 ], [ %pi.sroa.6.0318, %sw.bb100 ], [ %pi.sroa.6.0318, %if.end22.i ]
%pi.sroa.0.1 = phi i32 [ %spec.select271, %sw.bb ], [ %pi.sroa.0.0320, %sw.bb40 ], [ %pi.sroa.0.0320, %sw.bb50 ], [ %pi.sroa.0.0320, %sw.bb60 ], [ %pi.sroa.0.0320, %sw.bb70 ], [ %pi.sroa.0.0320, %sw.bb80 ], [ %pi.sroa.0.0320, %sw.bb90 ], [ %pi.sroa.0.0320, %sw.bb100 ], [ %pi.sroa.0.0320, %if.end22.i ]
%inc = add nuw nsw i32 %i.0319, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %11
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc
%12 = add i8 %pi.sroa.6.1, -81
%13 = icmp ult i8 %12, 2
%14 = add i8 %pi.sroa.20.1, -81
%15 = icmp ult i8 %14, 2
%16 = select i1 %13, i1 true, i1 %15
%17 = add i8 %pi.sroa.34.1, -81
%18 = icmp ult i8 %17, 2
%19 = select i1 %16, i1 true, i1 %18
%20 = add i8 %pi.sroa.48.1, -81
%21 = icmp ult i8 %20, 2
%22 = select i1 %19, i1 true, i1 %21
br i1 %22, label %if.end232, label %if.else162
if.else162: ; preds = %for.end
switch i8 %pi.sroa.13.1, label %if.else176 [
i8 81, label %if.end232
i8 66, label %if.end232
]
if.else176: ; preds = %if.else162
switch i8 %pi.sroa.27.1, label %if.else190 [
i8 81, label %if.end232
i8 66, label %if.end232
]
if.else190: ; preds = %if.else176
switch i8 %pi.sroa.41.1, label %if.else204 [
i8 81, label %if.end232
i8 66, label %if.end232
]
if.else204: ; preds = %if.else190
%switch.selectcmp.case1 = icmp eq i8 %pi.sroa.55.1, 81
%switch.selectcmp.case2 = icmp eq i8 %pi.sroa.55.1, 66
%switch.selectcmp = or i1 %switch.selectcmp.case1, %switch.selectcmp.case2
%23 = select i1 %switch.selectcmp, ptr @.str.3, ptr @.str.4
br label %if.end232
if.end232: ; preds = %entry, %for.end, %if.else162, %if.else162, %if.else176, %if.else176, %if.else190, %if.else190, %if.else204
%.str.4.sink = phi ptr [ %23, %if.else204 ], [ @.str.3, %if.else190 ], [ @.str.3, %if.else190 ], [ @.str.3, %if.else176 ], [ @.str.3, %if.else176 ], [ @.str.3, %if.else162 ], [ @.str.3, %if.else162 ], [ @.str.3, %for.end ], [ @.str.4, %entry ]
%call231 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %posy) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %posx) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %pos2) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %pos1) #5
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %ch1) #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: 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.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { 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 #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"}
|
/* Codeforces Round #379 (Div. 2). Problem B, by Abreto. */
#include <stdio.h>
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MIN3(a,b,c) (MIN(MIN(a,b),MIN(b,c)))
int main(void)
{
int sum = 0;
int k2 = 0, k3 = 0, k5 = 0, k6 = 0;
int n256 = 0, n32 = 0;
scanf("%d %d %d %d", &k2, &k3, &k5, &k6);
n256 = MIN3(k2, k5, k6);
sum += 256 * n256;
k2 -= n256;
n32 = MIN(k2, k3);
sum += 32 * n32;
printf("%d\n", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14090/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14090/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"%d %d %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:
%k2 = alloca i32, align 4
%k3 = alloca i32, align 4
%k5 = alloca i32, align 4
%k6 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k2) #4
store i32 0, ptr %k2, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k3) #4
store i32 0, ptr %k3, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k5) #4
store i32 0, ptr %k5, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k6) #4
store i32 0, ptr %k6, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k2, ptr noundef nonnull %k3, ptr noundef nonnull %k5, ptr noundef nonnull %k6)
%0 = load i32, ptr %k2, align 4
%1 = load i32, ptr %k5, align 4
%2 = load i32, ptr %k6, align 4
%cond5 = call i32 @llvm.smin.i32(i32 %1, i32 %2)
%cmp6 = icmp slt i32 %0, %cond5
%minmaxop = select i1 %cmp6, i32 %0, i32 %2
%cond20 = call i32 @llvm.smin.i32(i32 %minmaxop, i32 %1)
%mul = shl nsw i32 %cond20, 8
%sub = sub nsw i32 %0, %cond20
store i32 %sub, ptr %k2, align 4, !tbaa !5
%3 = load i32, ptr %k3, align 4
%cond25 = call i32 @llvm.smin.i32(i32 %sub, i32 %3)
%mul26 = shl nsw i32 %cond25, 5
%add27 = add nsw i32 %mul26, %mul
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add27)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k6) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k5) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k3) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k2) #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.smin.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"}
|
#include<stdio.h>
#define N 10000
#define Q 500
int main(){
int i,j,n,q;
int S[N],T[Q],count=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&S[i]);
}
scanf("%d",&q);
for(j=0;j<q;j++){
scanf("%d",&T[j]);
for(i=0;i<n;i++){
if(S[i]==T[j]){
count++;
break;
}
}
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140943/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140943/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
%q = alloca i32, align 4
%S = alloca [10000 x i32], align 16
%T = alloca [500 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 %q) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %T) #3
%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.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %S, 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, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp438 = icmp sgt i32 %3, 0
br i1 %cmp438, label %for.body5, label %for.end23
for.body5: ; preds = %for.end, %for.inc21
%indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.inc21 ], [ 0, %for.end ]
%count.040 = phi i32 [ %count.1, %for.inc21 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv45
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1036 = icmp sgt i32 %4, 0
br i1 %cmp1036, label %for.body11.lr.ph, label %for.inc21
for.body11.lr.ph: ; preds = %for.body5
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%wide.trip.count = zext i32 %4 to i64
br label %for.body11
for.cond9: ; preds = %for.body11
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%exitcond.not = icmp eq i64 %indvars.iv.next43, %wide.trip.count
br i1 %exitcond.not, label %for.inc21, label %for.body11, !llvm.loop !11
for.body11: ; preds = %for.body11.lr.ph, %for.cond9
%indvars.iv42 = phi i64 [ 0, %for.body11.lr.ph ], [ %indvars.iv.next43, %for.cond9 ]
%arrayidx13 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv42
%6 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp16 = icmp eq i32 %6, %5
br i1 %cmp16, label %if.then, label %for.cond9
if.then: ; preds = %for.body11
%inc17 = add nsw i32 %count.040, 1
br label %for.inc21
for.inc21: ; preds = %for.cond9, %for.body5, %if.then
%count.1 = phi i32 [ %inc17, %if.then ], [ %count.040, %for.body5 ], [ %count.040, %for.cond9 ]
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%7 = load i32, ptr %q, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp4 = icmp slt i64 %indvars.iv.next46, %8
br i1 %cmp4, label %for.body5, label %for.end23, !llvm.loop !12
for.end23: ; preds = %for.inc21, %for.end
%count.0.lcssa = phi i32 [ 0, %for.end ], [ %count.1, %for.inc21 ]
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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>
#include<stdlib.h>
#define NMAX 10000
#define QMAX 500
int main(void){
int i,j,n,S[NMAX],q,T[QMAX],C=0;
scanf("%d", &n);
if(n>NMAX) exit(1);
for(i=0;i<n;i++)scanf("%d", &S[i]);
scanf("%d", &q);
if(q>QMAX) exit(1);
for(i=0;i<q;i++)scanf("%d", &T[i]);
for(i=0;i<q;i++){
for(j=0;j<n;j++){
if(S[j]==T[i]){
C++;
break;
}
}
}
printf("%d\n",C);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140987/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140987/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: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%S = alloca [10000 x i32], align 16
%q = alloca i32, align 4
%T = alloca [500 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %T) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 10000
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp148 = icmp sgt i32 %0, 0
br i1 %cmp148, label %for.body, label %for.end
if.then: ; preds = %entry
call void @exit(i32 noundef 1) #5
unreachable
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %S, i64 0, 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
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %3, 500
br i1 %cmp4, label %if.then5, label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.end
%cmp850 = icmp sgt i32 %3, 0
br i1 %cmp850, label %for.body9, label %for.end35
if.then5: ; preds = %for.end
call void @exit(i32 noundef 1) #5
unreachable
for.cond16.preheader: ; preds = %for.body9
%cmp1754 = icmp sgt i32 %10, 0
br i1 %cmp1754, label %for.cond19.preheader.lr.ph, label %for.end35
for.cond19.preheader.lr.ph: ; preds = %for.cond16.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp2052 = icmp sgt i32 %4, 0
br i1 %cmp2052, label %for.cond19.preheader.us.preheader, label %for.end35
for.cond19.preheader.us.preheader: ; preds = %for.cond19.preheader.lr.ph
%wide.trip.count71 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count71, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end35.loopexit.unr-lcssa, label %for.cond19.preheader.us.preheader.new
for.cond19.preheader.us.preheader.new: ; preds = %for.cond19.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count71, 4294967294
br label %for.cond19.preheader.us
for.cond19.preheader.us: ; preds = %for.inc33.us.1, %for.cond19.preheader.us.preheader.new
%indvars.iv68 = phi i64 [ 0, %for.cond19.preheader.us.preheader.new ], [ %indvars.iv.next69.1, %for.inc33.us.1 ]
%C.057.us = phi i32 [ 0, %for.cond19.preheader.us.preheader.new ], [ %C.1.us.1, %for.inc33.us.1 ]
%niter = phi i64 [ 0, %for.cond19.preheader.us.preheader.new ], [ %niter.next.1, %for.inc33.us.1 ]
%arrayidx25.us = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv68
%6 = load i32, ptr %arrayidx25.us, align 8, !tbaa !5
br label %for.body21.us
for.cond19.us: ; preds = %for.body21.us
%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.inc33.us, label %for.body21.us, !llvm.loop !11
for.body21.us: ; preds = %for.cond19.preheader.us, %for.cond19.us
%indvars.iv65 = phi i64 [ 0, %for.cond19.preheader.us ], [ %indvars.iv.next66, %for.cond19.us ]
%arrayidx23.us = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv65
%7 = load i32, ptr %arrayidx23.us, align 4, !tbaa !5
%cmp26.us = icmp eq i32 %7, %6
br i1 %cmp26.us, label %if.then27.us, label %for.cond19.us
if.then27.us: ; preds = %for.body21.us
%inc28.us = add nsw i32 %C.057.us, 1
br label %for.inc33.us
for.inc33.us: ; preds = %for.cond19.us, %if.then27.us
%C.1.us = phi i32 [ %inc28.us, %if.then27.us ], [ %C.057.us, %for.cond19.us ]
%indvars.iv.next69 = or i64 %indvars.iv68, 1
%arrayidx25.us.1 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv.next69
%8 = load i32, ptr %arrayidx25.us.1, align 4, !tbaa !5
br label %for.body21.us.1
for.body21.us.1: ; preds = %for.cond19.us.1, %for.inc33.us
%indvars.iv65.1 = phi i64 [ 0, %for.inc33.us ], [ %indvars.iv.next66.1, %for.cond19.us.1 ]
%arrayidx23.us.1 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv65.1
%9 = load i32, ptr %arrayidx23.us.1, align 4, !tbaa !5
%cmp26.us.1 = icmp eq i32 %9, %8
br i1 %cmp26.us.1, label %if.then27.us.1, label %for.cond19.us.1
for.cond19.us.1: ; preds = %for.body21.us.1
%indvars.iv.next66.1 = add nuw nsw i64 %indvars.iv65.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next66.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc33.us.1, label %for.body21.us.1, !llvm.loop !11
if.then27.us.1: ; preds = %for.body21.us.1
%inc28.us.1 = add nsw i32 %C.1.us, 1
br label %for.inc33.us.1
for.inc33.us.1: ; preds = %for.cond19.us.1, %if.then27.us.1
%C.1.us.1 = phi i32 [ %inc28.us.1, %if.then27.us.1 ], [ %C.1.us, %for.cond19.us.1 ]
%indvars.iv.next69.1 = add nuw nsw i64 %indvars.iv68, 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.end35.loopexit.unr-lcssa, label %for.cond19.preheader.us, !llvm.loop !12
for.body9: ; preds = %for.cond7.preheader, %for.body9
%indvars.iv62 = phi i64 [ %indvars.iv.next63, %for.body9 ], [ 0, %for.cond7.preheader ]
%arrayidx11 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv62
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx11)
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%10 = load i32, ptr %q, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp8 = icmp slt i64 %indvars.iv.next63, %11
br i1 %cmp8, label %for.body9, label %for.cond16.preheader, !llvm.loop !13
for.end35.loopexit.unr-lcssa: ; preds = %for.inc33.us.1, %for.cond19.preheader.us.preheader
%C.1.us.lcssa.ph = phi i32 [ undef, %for.cond19.preheader.us.preheader ], [ %C.1.us.1, %for.inc33.us.1 ]
%indvars.iv68.unr = phi i64 [ 0, %for.cond19.preheader.us.preheader ], [ %indvars.iv.next69.1, %for.inc33.us.1 ]
%C.057.us.unr = phi i32 [ 0, %for.cond19.preheader.us.preheader ], [ %C.1.us.1, %for.inc33.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end35, label %for.cond19.preheader.us.epil
for.cond19.preheader.us.epil: ; preds = %for.end35.loopexit.unr-lcssa
%arrayidx25.us.epil = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv68.unr
%12 = load i32, ptr %arrayidx25.us.epil, align 4, !tbaa !5
br label %for.body21.us.epil
for.body21.us.epil: ; preds = %for.cond19.us.epil, %for.cond19.preheader.us.epil
%indvars.iv65.epil = phi i64 [ 0, %for.cond19.preheader.us.epil ], [ %indvars.iv.next66.epil, %for.cond19.us.epil ]
%arrayidx23.us.epil = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv65.epil
%13 = load i32, ptr %arrayidx23.us.epil, align 4, !tbaa !5
%cmp26.us.epil = icmp eq i32 %13, %12
br i1 %cmp26.us.epil, label %if.then27.us.epil, label %for.cond19.us.epil
for.cond19.us.epil: ; preds = %for.body21.us.epil
%indvars.iv.next66.epil = add nuw nsw i64 %indvars.iv65.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next66.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end35, label %for.body21.us.epil, !llvm.loop !11
if.then27.us.epil: ; preds = %for.body21.us.epil
%inc28.us.epil = add nsw i32 %C.057.us.unr, 1
br label %for.end35
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.cond19.us.epil, %if.then27.us.epil, %for.cond7.preheader, %for.cond19.preheader.lr.ph, %for.cond16.preheader
%C.0.lcssa = phi i32 [ 0, %for.cond16.preheader ], [ 0, %for.cond19.preheader.lr.ph ], [ 0, %for.cond7.preheader ], [ %C.1.us.lcssa.ph, %for.end35.loopexit.unr-lcssa ], [ %inc28.us.epil, %if.then27.us.epil ], [ %C.057.us.unr, %for.cond19.us.epil ]
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %C.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %T) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %S) #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: noreturn nounwind
declare void @exit(i32 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 = { 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}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(void){
int i,j,N,v,S[10000],T[10000],q;
int c =0;
scanf("%d", &N);
for ( i = 0; i < N; i++ ){
scanf("%d", &S[i]);
}
scanf("%d", &q);
for ( i = 0; i < q; i++ ){
scanf("%d", &T[i]);
}
for(i=0;i<q;i++){
for ( j = 0 ; j <N; j++ ) {
if ( T[i] == S[j] ) {
c++;
break;
}
}
}
printf("%d\n",c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141029/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141029/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
%S = alloca [10000 x i32], align 16
%T = alloca [10000 x i32], align 16
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %T) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %S, 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, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp444 = icmp sgt i32 %3, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %10, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp1646 = icmp sgt i32 %4, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%c.051.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %c.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx19.us = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %indvars.iv62
%6 = load i32, ptr %arrayidx19.us, align 8, !tbaa !5
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !11
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx21.us = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv59
%7 = load i32, ptr %arrayidx21.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %6, %7
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %c.051.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%c.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %c.051.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx19.us.1 = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %indvars.iv.next63
%8 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !5
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx21.us.1 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv59.1
%9 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !5
%cmp22.us.1 = icmp eq i32 %8, %9
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %c.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%c.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %c.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 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.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %indvars.iv56
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%10 = load i32, ptr %q, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%c.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %c.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%c.051.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %c.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx19.us.epil = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %indvars.iv62.unr
%12 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !5
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx21.us.epil = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv59.epil
%13 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp eq i32 %12, %13
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %c.051.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %c.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %c.051.us.unr, %for.cond15.us.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %S) #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}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main()
{
int n,i,a=0,d=0;
char c[100005];
scanf("%d",&n);
while(getchar()!='\n');
for(i=0;i<n;i++)
{
scanf("%c",&c[i]);
if(c[i]=='A')
a++;
else
d++;
}
if(a>d)
printf("Anton\n");
else if(d>a)
printf("Danik\n");
else
printf("Friendship\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14108/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14108/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"%c\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@str = private unnamed_addr constant [11 x i8] c"Friendship\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"Danik\00", align 1
@str.6 = private unnamed_addr constant [6 x i8] c"Anton\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%c = alloca [100005 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 100005, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = call i32 @getc(ptr noundef %0)
%cmp.not = icmp eq i32 %call.i, 10
br i1 %cmp.not, label %for.cond.preheader, label %while.cond, !llvm.loop !9
for.cond.preheader: ; preds = %while.cond
%1 = load i32, ptr %n, align 4, !tbaa !11
%cmp232 = icmp sgt i32 %1, 0
br i1 %cmp232, label %for.body, label %if.else19
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%d.035 = phi i32 [ %d.1, %for.body ], [ 0, %for.cond.preheader ]
%a.034 = phi i32 [ %a.1, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [100005 x i8], ptr %c, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%2 = load i8, ptr %arrayidx, align 1, !tbaa !13
%cmp6 = icmp eq i8 %2, 65
%inc = zext i1 %cmp6 to i32
%a.1 = add nuw nsw i32 %a.034, %inc
%not.cmp6 = xor i1 %cmp6, true
%inc8 = zext i1 %not.cmp6 to i32
%d.1 = add nuw nsw i32 %d.035, %inc8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !11
%4 = sext i32 %3 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %for.body
%cmp10 = icmp ugt i32 %a.1, %d.1
br i1 %cmp10, label %if.end22, label %if.else14
if.else14: ; preds = %for.end
%cmp15 = icmp ugt i32 %d.1, %a.1
br i1 %cmp15, label %if.end22, label %if.else19
if.else19: ; preds = %for.cond.preheader, %if.else14
br label %if.end22
if.end22: ; preds = %if.else14, %for.end, %if.else19
%str.5.sink = phi ptr [ @str, %if.else19 ], [ @str.6, %for.end ], [ @str.5, %if.else14 ]
%puts30 = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.sink)
call void @llvm.lifetime.end.p0(i64 100005, ptr nonnull %c) #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 @getc(ptr nocapture noundef) local_unnamed_addr #2
; 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 = !{!"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 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#include<stdlib.h>
//#include<conio.h>
#include<string.h>
#include<ctype.h>
int main()
{
int n,i,A=0,D=0;scanf("%d",&n);char s[100000+5];scanf("%s",&s);n=strlen(s);
for(i=0;i<n;i++)
{
if(s[i]=='A') A++;
else
D++;
}
if(A>D) printf("Anton\n");
else if(D>A) printf("Danik\n");
else
printf("Friendship\n");
//getch();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14113/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14113/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 [11 x i8] c"Friendship\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"Danik\00", align 1
@str.6 = private unnamed_addr constant [6 x i8] c"Anton\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca [100005 x i8], align 16
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)
call void @llvm.lifetime.start.p0(i64 100005, ptr nonnull %s) #6
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #7
%conv = trunc i64 %call2 to i32
store i32 %conv, ptr %n, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %conv, 0
br i1 %cmp30, label %for.body.preheader, label %if.else18
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call2, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count, 8
br i1 %min.iters.check, label %for.body.preheader50, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.mod.vf = and i64 %call2, 7
%n.vec = sub nsw i64 %wide.trip.count, %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.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%vec.phi44 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%vec.phi45 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%vec.phi46 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%0 = getelementptr inbounds [100005 x i8], ptr %s, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %0, align 8, !tbaa !9
%1 = getelementptr inbounds i8, ptr %0, i64 4
%wide.load47 = load <4 x i8>, ptr %1, align 4, !tbaa !9
%2 = icmp eq <4 x i8> %wide.load, <i8 65, i8 65, i8 65, i8 65>
%3 = icmp eq <4 x i8> %wide.load47, <i8 65, i8 65, i8 65, i8 65>
%4 = zext <4 x i1> %2 to <4 x i32>
%5 = zext <4 x i1> %3 to <4 x i32>
%6 = add <4 x i32> %vec.phi45, %4
%7 = add <4 x i32> %vec.phi46, %5
%8 = xor <4 x i1> %2, <i1 true, i1 true, i1 true, i1 true>
%9 = xor <4 x i1> %3, <i1 true, i1 true, i1 true, i1 true>
%10 = zext <4 x i1> %8 to <4 x i32>
%11 = zext <4 x i1> %9 to <4 x i32>
%12 = add <4 x i32> %vec.phi, %10
%13 = add <4 x i32> %vec.phi44, %11
%index.next = add nuw i64 %index, 8
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%bin.rdx48 = add <4 x i32> %7, %6
%15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx48)
%bin.rdx = add <4 x i32> %13, %12
%16 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %for.end, label %for.body.preheader50
for.body.preheader50: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%D.033.ph = phi i32 [ 0, %for.body.preheader ], [ %16, %middle.block ]
%A.032.ph = phi i32 [ 0, %for.body.preheader ], [ %15, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader50, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader50 ]
%D.033 = phi i32 [ %D.1, %for.body ], [ %D.033.ph, %for.body.preheader50 ]
%A.032 = phi i32 [ %A.1, %for.body ], [ %A.032.ph, %for.body.preheader50 ]
%arrayidx = getelementptr inbounds [100005 x i8], ptr %s, i64 0, i64 %indvars.iv
%17 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp5 = icmp eq i8 %17, 65
%inc = zext i1 %cmp5 to i32
%A.1 = add nuw nsw i32 %A.032, %inc
%not.cmp5 = xor i1 %cmp5, true
%inc7 = zext i1 %not.cmp5 to i32
%D.1 = add nuw nsw i32 %D.033, %inc7
%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 !14
for.end: ; preds = %for.body, %middle.block
%A.1.lcssa = phi i32 [ %15, %middle.block ], [ %A.1, %for.body ]
%D.1.lcssa = phi i32 [ %16, %middle.block ], [ %D.1, %for.body ]
%cmp9 = icmp ugt i32 %A.1.lcssa, %D.1.lcssa
br i1 %cmp9, label %if.end21, label %if.else13
if.else13: ; preds = %for.end
%cmp14 = icmp ugt i32 %D.1.lcssa, %A.1.lcssa
br i1 %cmp14, label %if.end21, label %if.else18
if.else18: ; preds = %entry, %if.else13
br label %if.end21
if.end21: ; preds = %if.else13, %for.end, %if.else18
%str.5.sink = phi ptr [ @str, %if.else18 ], [ @str.6, %for.end ], [ @str.5, %if.else13 ]
%puts28 = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.sink)
call void @llvm.lifetime.end.p0(i64 100005, ptr nonnull %s) #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 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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #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: 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!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, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
|
#include<stdio.h>
int search(int A[], int n, int key){
int i = 0;
A[n] = key;
while(A[i] != key) i++;
return i != n;
}
int main(){
int i, n, A[10000 + 1], q, key, sum = 0;
scanf("%d", &n);
for(i = 0 ; i < n ; i++) scanf("%d", &A[i]);
scanf("%d", &q);
for(i = 0 ; i < q ; i++){
scanf("%d", &key);
if(search(A, n, key)) sum++;
}
printf("%d\n", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141173/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141173/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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @search(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %key) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %key
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !9
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
%cmp3 = icmp ne i32 %1, %n
%conv = zext i1 %cmp3 to i32
ret i32 %conv
}
; 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
%A = alloca [10001 x i32], align 16
%q = alloca i32, align 4
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 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
%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 !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp420 = icmp sgt i32 %3, 0
br i1 %cmp420, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %search.exit
%sum.022 = phi i32 [ %spec.select, %search.exit ], [ 0, %for.end ]
%i.121 = phi i32 [ %inc10, %search.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %key, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %idxprom.i
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %for.body5
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %for.body5 ]
%arrayidx2.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %6, %5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %search.exit, label %while.cond.i, !llvm.loop !9
search.exit: ; preds = %while.cond.i
%7 = trunc i64 %indvars.iv.i to i32
%cmp3.i.not = icmp ne i32 %4, %7
%inc8 = zext i1 %cmp3.i.not to i32
%spec.select = add nuw nsw i32 %sum.022, %inc8
%inc10 = add nuw nsw i32 %i.121, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %search.exit, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %search.exit ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, 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(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 = { 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(){
int n,q,i,key,j,k=0;
scanf("%d",&n);
int S[n];
for(i=0;i<n;i++){
scanf("%d",&S[i]);
}
scanf("%d",&q);
int T[q];
for(i=0;i<q;i++){
scanf("%d",&T[i]);
}
for(j=0;j<q;j++){
i=0;
while(1){
if(T[j]==S[i]){
k++;
break;
}
if(i==n){
break;
}
i++;
}
}
printf("%d\n",k);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141216/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141216/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
%q = 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 %q) #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
%cmp41 = icmp sgt i32 %3, 0
br i1 %cmp41, label %for.body, label %for.end
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, 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.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%6 = load i32, ptr %q, align 4, !tbaa !5
%7 = zext i32 %6 to i64
%vla3 = alloca i32, i64 %7, align 16
%cmp543 = icmp sgt i32 %6, 0
br i1 %cmp543, label %for.body6, label %for.end28
for.cond13.preheader: ; preds = %for.body6
%cmp1447 = icmp sgt i32 %11, 0
br i1 %cmp1447, label %while.cond.preheader.lr.ph, label %for.end28
while.cond.preheader.lr.ph: ; preds = %for.cond13.preheader
%8 = load i32, ptr %vla, align 16, !tbaa !5
%9 = load i32, ptr %n, align 4
%10 = zext i32 %9 to i64
%wide.trip.count = zext i32 %11 to i64
br label %while.cond.preheader
for.body6: ; preds = %for.end, %for.body6
%indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.body6 ], [ 0, %for.end ]
%arrayidx8 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv53
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8)
%indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
%11 = load i32, ptr %q, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp5 = icmp slt i64 %indvars.iv.next54, %12
br i1 %cmp5, label %for.body6, label %for.cond13.preheader, !llvm.loop !11
while.cond.preheader: ; preds = %while.cond.preheader.lr.ph, %for.inc26
%indvars.iv59 = phi i64 [ 0, %while.cond.preheader.lr.ph ], [ %indvars.iv.next60, %for.inc26 ]
%k.048 = phi i32 [ 0, %while.cond.preheader.lr.ph ], [ %k.1, %for.inc26 ]
%arrayidx17 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv59
%13 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%cmp2045 = icmp eq i32 %13, %8
br i1 %cmp2045, label %if.then, label %if.end
while.cond: ; preds = %if.end
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%arrayidx19 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next57
%14 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%cmp20 = icmp eq i32 %13, %14
br i1 %cmp20, label %if.then, label %if.end
if.then: ; preds = %while.cond, %while.cond.preheader
%inc21 = add nsw i32 %k.048, 1
br label %for.inc26
if.end: ; preds = %while.cond.preheader, %while.cond
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %while.cond ], [ 0, %while.cond.preheader ]
%cmp22 = icmp eq i64 %indvars.iv56, %10
br i1 %cmp22, label %for.inc26, label %while.cond
for.inc26: ; preds = %if.end, %if.then
%k.1 = phi i32 [ %inc21, %if.then ], [ %k.048, %if.end ]
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.end28, label %while.cond.preheader, !llvm.loop !12
for.end28: ; preds = %for.inc26, %for.end, %for.cond13.preheader
%k.0.lcssa = phi i32 [ 0, %for.cond13.preheader ], [ 0, %for.end ], [ %k.1, %for.inc26 ]
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %k.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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
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
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
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}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
int min(int a, int b) {
return a < b ? a : b;
}
int main() {
int k2, k3, k5, k6;
int count_256, count_32;
scanf("%d %d %d %d\n", &k2, &k3, &k5, &k6);
count_256 = min(min(k5, k6), k2);
count_32 = min(k3, k2 - count_256);
printf("%d\n", 32 * count_32 + 256 * count_256);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14126/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14126/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 [13 x i8] c"%d %d %d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%k2 = alloca i32, align 4
%k3 = alloca i32, align 4
%k5 = alloca i32, align 4
%k6 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k2) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k3) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k5) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k6) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k2, ptr noundef nonnull %k3, ptr noundef nonnull %k5, ptr noundef nonnull %k6)
%0 = load i32, ptr %k5, align 4, !tbaa !5
%1 = load i32, ptr %k6, align 4, !tbaa !5
%cond.i = call i32 @llvm.smin.i32(i32 %0, i32 %1)
%2 = load i32, ptr %k2, align 4, !tbaa !5
%cond.i7 = call i32 @llvm.smin.i32(i32 %cond.i, i32 %2)
%3 = load i32, ptr %k3, align 4, !tbaa !5
%sub = sub nsw i32 %2, %cond.i7
%cond.i8 = call i32 @llvm.smin.i32(i32 %3, i32 %sub)
%mul = shl nsw i32 %cond.i8, 5
%mul4 = shl nsw i32 %cond.i7, 8
%add = add nsw i32 %mul, %mul4
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k6) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k5) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k3) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k2) #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
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"}
|
#include <stdio.h>
int main()
{
int g,w,h=0,i,j;
int A[10000],B[500];
scanf("%d",&g);
for(i=0; i<g; i++){
scanf("%d",&A[i]);
}
scanf("%d",&w);
for(i=0; i<w; i++){
scanf("%d",&B[i]);
}
for(i=0; i<w; i++){
for(j=0; j<g; j++){
if(B[i]==A[j]){
h++;
break;
}
}
}
printf("%d\n",h);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141302/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141302/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:
%g = alloca i32, align 4
%w = alloca i32, align 4
%A = alloca [10000 x i32], align 16
%B = alloca [500 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %g) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %g)
%0 = load i32, ptr %g, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 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
%1 = load i32, ptr %g, 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, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp444 = icmp sgt i32 %3, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %10, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %g, align 4, !tbaa !5
%cmp1646 = icmp sgt i32 %4, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%h.049.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %h.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx19.us = getelementptr inbounds [500 x i32], ptr %B, i64 0, i64 %indvars.iv62
%6 = load i32, ptr %arrayidx19.us, align 8, !tbaa !5
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !11
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx21.us = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv59
%7 = load i32, ptr %arrayidx21.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %6, %7
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %h.049.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%h.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %h.049.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx19.us.1 = getelementptr inbounds [500 x i32], ptr %B, i64 0, i64 %indvars.iv.next63
%8 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !5
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx21.us.1 = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv59.1
%9 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !5
%cmp22.us.1 = icmp eq i32 %8, %9
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %h.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%h.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %h.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 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.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %B, i64 0, i64 %indvars.iv56
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%10 = load i32, ptr %w, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%h.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %h.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%h.049.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %h.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx19.us.epil = getelementptr inbounds [500 x i32], ptr %B, i64 0, i64 %indvars.iv62.unr
%12 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !5
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx21.us.epil = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv59.epil
%13 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp eq i32 %12, %13
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %h.049.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%h.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %h.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %h.049.us.unr, %for.cond15.us.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %h.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %g) #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}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int search(int *S,int t, int n){
int i;
for (i = 0;i < n;i++)
if (S[i] == t) return 1;
return 0;
}
int main(){
int n, q, S[10000], T[500], i, j, c = 0;
scanf("%d", &n);
for (i = 0;i < n;i++) scanf("%d", S + i);
scanf("%d", &q);
for (i = 0;i < q;i++) scanf("%d", T + i);
for (i = 0;i < q;i++)
c += search(S, T[i], n);
printf("%d\n", c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141353/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141353/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 norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @search(ptr nocapture noundef readonly %S, i32 noundef %t, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp4 = icmp sgt i32 %n, 0
br i1 %cmp4, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond: ; preds = %for.body
%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 %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i32, ptr %S, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !7
%cmp1 = icmp eq i32 %0, %t
br i1 %cmp1, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.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 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
%q = alloca i32, align 4
%S = alloca [10000 x i32], align 16
%T = alloca [500 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #4
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %T) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %S, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !7
%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 !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !7
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %for.body5, label %for.end20
for.cond13.preheader: ; preds = %for.body5
%cmp1435 = icmp sgt i32 %10, 0
br i1 %cmp1435, label %for.body15.lr.ph, label %for.end20
for.body15.lr.ph: ; preds = %for.cond13.preheader
%4 = load i32, ptr %n, align 4, !tbaa !7
%cmp4.i = icmp sgt i32 %4, 0
%wide.trip.count.i = zext i32 %4 to i64
br i1 %cmp4.i, label %for.body15.us.preheader, label %for.end20
for.body15.us.preheader: ; preds = %for.body15.lr.ph
%wide.trip.count = zext i32 %10 to i64
%xtraiter = and i64 %wide.trip.count, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end20.loopexit.unr-lcssa, label %for.body15.us.preheader.new
for.body15.us.preheader.new: ; preds = %for.body15.us.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body15.us
for.body15.us: ; preds = %search.exit.loopexit.us.1, %for.body15.us.preheader.new
%indvars.iv45 = phi i64 [ 0, %for.body15.us.preheader.new ], [ %indvars.iv.next46.1, %search.exit.loopexit.us.1 ]
%c.037.us = phi i32 [ 0, %for.body15.us.preheader.new ], [ %add.us.1, %search.exit.loopexit.us.1 ]
%niter = phi i64 [ 0, %for.body15.us.preheader.new ], [ %niter.next.1, %search.exit.loopexit.us.1 ]
%arrayidx.us = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv45
%6 = load i32, ptr %arrayidx.us, align 8, !tbaa !7
br label %for.body.i.us
for.body.i.us: ; preds = %for.cond.i.us, %for.body15.us
%indvars.iv.i.us = phi i64 [ 0, %for.body15.us ], [ %indvars.iv.next.i.us, %for.cond.i.us ]
%arrayidx.i.us = getelementptr inbounds i32, ptr %S, i64 %indvars.iv.i.us
%7 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !7
%cmp1.i.us = icmp eq i32 %7, %6
br i1 %cmp1.i.us, label %search.exit.loopexit.us, label %for.cond.i.us
for.cond.i.us: ; preds = %for.body.i.us
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %search.exit.loopexit.us, label %for.body.i.us, !llvm.loop !5
search.exit.loopexit.us: ; preds = %for.cond.i.us, %for.body.i.us
%retval.0.i.ph.us = phi i32 [ 1, %for.body.i.us ], [ 0, %for.cond.i.us ]
%add.us = add nuw nsw i32 %retval.0.i.ph.us, %c.037.us
%indvars.iv.next46 = or i64 %indvars.iv45, 1
%arrayidx.us.1 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv.next46
%8 = load i32, ptr %arrayidx.us.1, align 4, !tbaa !7
br label %for.body.i.us.1
for.body.i.us.1: ; preds = %for.cond.i.us.1, %search.exit.loopexit.us
%indvars.iv.i.us.1 = phi i64 [ 0, %search.exit.loopexit.us ], [ %indvars.iv.next.i.us.1, %for.cond.i.us.1 ]
%arrayidx.i.us.1 = getelementptr inbounds i32, ptr %S, i64 %indvars.iv.i.us.1
%9 = load i32, ptr %arrayidx.i.us.1, align 4, !tbaa !7
%cmp1.i.us.1 = icmp eq i32 %9, %8
br i1 %cmp1.i.us.1, label %search.exit.loopexit.us.1, label %for.cond.i.us.1
for.cond.i.us.1: ; preds = %for.body.i.us.1
%indvars.iv.next.i.us.1 = add nuw nsw i64 %indvars.iv.i.us.1, 1
%exitcond.not.i.us.1 = icmp eq i64 %indvars.iv.next.i.us.1, %wide.trip.count.i
br i1 %exitcond.not.i.us.1, label %search.exit.loopexit.us.1, label %for.body.i.us.1, !llvm.loop !5
search.exit.loopexit.us.1: ; preds = %for.cond.i.us.1, %for.body.i.us.1
%retval.0.i.ph.us.1 = phi i32 [ 1, %for.body.i.us.1 ], [ 0, %for.cond.i.us.1 ]
%add.us.1 = add nuw nsw i32 %retval.0.i.ph.us.1, %add.us
%indvars.iv.next46.1 = add nuw nsw i64 %indvars.iv45, 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.end20.loopexit.unr-lcssa, label %for.body15.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body5 ], [ 0, %for.end ]
%add.ptr8 = getelementptr inbounds i32, ptr %T, i64 %indvars.iv42
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr8)
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%10 = load i32, ptr %q, align 4, !tbaa !7
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next43, %11
br i1 %cmp4, label %for.body5, label %for.cond13.preheader, !llvm.loop !13
for.end20.loopexit.unr-lcssa: ; preds = %search.exit.loopexit.us.1, %for.body15.us.preheader
%add.us.lcssa.ph = phi i32 [ undef, %for.body15.us.preheader ], [ %add.us.1, %search.exit.loopexit.us.1 ]
%indvars.iv45.unr = phi i64 [ 0, %for.body15.us.preheader ], [ %indvars.iv.next46.1, %search.exit.loopexit.us.1 ]
%c.037.us.unr = phi i32 [ 0, %for.body15.us.preheader ], [ %add.us.1, %search.exit.loopexit.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end20, label %for.body15.us.epil
for.body15.us.epil: ; preds = %for.end20.loopexit.unr-lcssa
%arrayidx.us.epil = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv45.unr
%12 = load i32, ptr %arrayidx.us.epil, align 4, !tbaa !7
br label %for.body.i.us.epil
for.body.i.us.epil: ; preds = %for.cond.i.us.epil, %for.body15.us.epil
%indvars.iv.i.us.epil = phi i64 [ 0, %for.body15.us.epil ], [ %indvars.iv.next.i.us.epil, %for.cond.i.us.epil ]
%arrayidx.i.us.epil = getelementptr inbounds i32, ptr %S, i64 %indvars.iv.i.us.epil
%13 = load i32, ptr %arrayidx.i.us.epil, align 4, !tbaa !7
%cmp1.i.us.epil = icmp eq i32 %13, %12
br i1 %cmp1.i.us.epil, label %search.exit.loopexit.us.epil, label %for.cond.i.us.epil
for.cond.i.us.epil: ; preds = %for.body.i.us.epil
%indvars.iv.next.i.us.epil = add nuw nsw i64 %indvars.iv.i.us.epil, 1
%exitcond.not.i.us.epil = icmp eq i64 %indvars.iv.next.i.us.epil, %wide.trip.count.i
br i1 %exitcond.not.i.us.epil, label %search.exit.loopexit.us.epil, label %for.body.i.us.epil, !llvm.loop !5
search.exit.loopexit.us.epil: ; preds = %for.cond.i.us.epil, %for.body.i.us.epil
%retval.0.i.ph.us.epil = phi i32 [ 1, %for.body.i.us.epil ], [ 0, %for.cond.i.us.epil ]
%add.us.epil = add nuw nsw i32 %retval.0.i.ph.us.epil, %c.037.us.unr
br label %for.end20
for.end20: ; preds = %search.exit.loopexit.us.epil, %for.end20.loopexit.unr-lcssa, %for.end, %for.body15.lr.ph, %for.cond13.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond13.preheader ], [ 0, %for.body15.lr.ph ], [ 0, %for.end ], [ %add.us.lcssa.ph, %for.end20.loopexit.unr-lcssa ], [ %add.us.epil, %search.exit.loopexit.us.epil ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %T) #4
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %S) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 4, 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(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 = { 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 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
int key;
int final = 0;
int n,m;
scanf("%d", &n);
int A[10000];
for (i = 0; i != n; i++)
{
scanf("%d", &A[i]);
}
scanf("%d", &m);
while (m--)
{
scanf("%d", &key);
for (i = 0; i != n; i++)
{
if (A[i] == key)
{
final++;
break;
}
}
}
printf("%d\n", final);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141447/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141447/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:
%key = alloca i32, align 4
%n = alloca i32, align 4
%m = alloca i32, align 4
%A = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #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
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %A) #3
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not21 = icmp eq i32 %0, 0
br i1 %cmp.not21, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 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 i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = zext i32 %1 to i64
%cmp.not = icmp eq i64 %indvars.iv.next, %2
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%3 = load i32, ptr %m, align 4, !tbaa !5
%dec25 = add nsw i32 %3, -1
store i32 %dec25, ptr %m, align 4, !tbaa !5
%tobool.not26 = icmp eq i32 %3, 0
br i1 %tobool.not26, label %while.end, label %while.body
while.body: ; preds = %for.end, %for.end13
%final.027 = phi i32 [ %final.1, %for.end13 ], [ 0, %for.end ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp5.not23 = icmp eq i32 %4, 0
br i1 %cmp5.not23, label %for.end13, label %for.body6.lr.ph
for.body6.lr.ph: ; preds = %while.body
%5 = load i32, ptr %key, align 4, !tbaa !5
%6 = zext i32 %4 to i64
br label %for.body6
for.cond4: ; preds = %for.body6
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%cmp5.not = icmp eq i64 %indvars.iv.next30, %6
br i1 %cmp5.not, label %for.end13, label %for.body6, !llvm.loop !11
for.body6: ; preds = %for.body6.lr.ph, %for.cond4
%indvars.iv29 = phi i64 [ 0, %for.body6.lr.ph ], [ %indvars.iv.next30, %for.cond4 ]
%arrayidx8 = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv29
%7 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9 = icmp eq i32 %7, %5
br i1 %cmp9, label %if.then, label %for.cond4
if.then: ; preds = %for.body6
%inc10 = add nsw i32 %final.027, 1
br label %for.end13
for.end13: ; preds = %for.cond4, %while.body, %if.then
%final.1 = phi i32 [ %inc10, %if.then ], [ %final.027, %while.body ], [ %final.027, %for.cond4 ]
%8 = load i32, ptr %m, align 4, !tbaa !5
%dec = add nsw i32 %8, -1
store i32 %dec, ptr %m, align 4, !tbaa !5
%tobool.not = icmp eq i32 %8, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %for.end13, %for.end
%final.0.lcssa = phi i32 [ 0, %for.end ], [ %final.1, %for.end13 ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %final.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %A) #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
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #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 n, q;
int S[10000];
int T[500];
int count = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++){
scanf("%d", &S[i]);
}
scanf("%d", &q);
for (int i = 0; i < q; i++){
scanf("%d", &T[i]);
for (int k = 0; k < n; k++){
if (S[k] == T[i]){
count += 1;
break;
}
}
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141498/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141498/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
%q = alloca i32, align 4
%S = alloca [10000 x i32], align 16
%T = alloca [500 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 %q) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %T) #3
%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.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%1 = load i32, ptr %q, align 4, !tbaa !5
%cmp545 = icmp sgt i32 %1, 0
br i1 %cmp545, label %for.body7, label %for.cond.cleanup6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %S, 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.cleanup6: ; preds = %cleanup, %for.cond.cleanup
%count.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %count.1, %cleanup ]
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
for.body7: ; preds = %for.cond.cleanup, %cleanup
%indvars.iv52 = phi i64 [ %indvars.iv.next53, %cleanup ], [ 0, %for.cond.cleanup ]
%count.046 = phi i32 [ %count.1, %cleanup ], [ 0, %for.cond.cleanup ]
%arrayidx9 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv52
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx9)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1243 = icmp sgt i32 %4, 0
br i1 %cmp1243, label %for.body14.lr.ph, label %cleanup
for.body14.lr.ph: ; preds = %for.body7
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%wide.trip.count = zext i32 %4 to i64
br label %for.body14
for.cond11: ; preds = %for.body14
%indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
%exitcond.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body14, !llvm.loop !11
for.body14: ; preds = %for.body14.lr.ph, %for.cond11
%indvars.iv49 = phi i64 [ 0, %for.body14.lr.ph ], [ %indvars.iv.next50, %for.cond11 ]
%arrayidx16 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv49
%6 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%cmp19 = icmp eq i32 %6, %5
br i1 %cmp19, label %if.then, label %for.cond11
if.then: ; preds = %for.body14
%add = add nsw i32 %count.046, 1
br label %cleanup
cleanup: ; preds = %for.cond11, %for.body7, %if.then
%count.1 = phi i32 [ %add, %if.then ], [ %count.046, %for.body7 ], [ %count.046, %for.cond11 ]
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%7 = load i32, ptr %q, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp5 = icmp slt i64 %indvars.iv.next53, %8
br i1 %cmp5, label %for.body7, label %for.cond.cleanup6, !llvm.loop !12
}
; 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"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(){
int i,n,q,s[10000+1],t,c=0,k;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&s[i]);
scanf("%d",&q);
for(i=0;i<q;i++)
{
scanf("%d",&t);
s[n]=t;
k=0;
while(s[k]!=t)
{
k++;
}
if(k!=n) c++;
}
printf("%d\n",c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141540/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141540/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
%q = alloca i32, align 4
%s = alloca [10001 x i32], align 16
%t = 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 %q) #3
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%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.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 x i32], ptr %s, 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, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp428 = icmp sgt i32 %3, 0
br i1 %cmp428, label %for.body5, label %for.end17
for.body5: ; preds = %for.end, %while.end
%c.030 = phi i32 [ %spec.select, %while.end ], [ 0, %for.end ]
%i.129 = phi i32 [ %inc16, %while.end ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%4 = load i32, ptr %t, align 4, !tbaa !5
%5 = load i32, ptr %n, align 4, !tbaa !5
%idxprom7 = sext i32 %5 to i64
%arrayidx8 = getelementptr inbounds [10001 x i32], ptr %s, i64 0, i64 %idxprom7
store i32 %4, ptr %arrayidx8, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %for.body5
%indvars.iv32 = phi i64 [ %indvars.iv.next33, %while.cond ], [ 0, %for.body5 ]
%arrayidx10 = getelementptr inbounds [10001 x i32], ptr %s, i64 0, i64 %indvars.iv32
%6 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11.not = icmp eq i32 %6, %4
%indvars.iv.next33 = add nuw i64 %indvars.iv32, 1
br i1 %cmp11.not, label %while.end, label %while.cond, !llvm.loop !11
while.end: ; preds = %while.cond
%7 = trunc i64 %indvars.iv32 to i32
%cmp13.not = icmp ne i32 %5, %7
%inc14 = zext i1 %cmp13.not to i32
%spec.select = add nuw nsw i32 %c.030, %inc14
%inc16 = add nuw nsw i32 %i.129, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc16, %8
br i1 %cmp4, label %for.body5, label %for.end17, !llvm.loop !12
for.end17: ; preds = %while.end, %for.end
%c.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %while.end ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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>
int linerSearch(int ,int* ,int);
int main()
{
int count = 0;
int a,b,c,i;
int t[10010];
scanf("%d",&a);
for(i = 0;i < a;i++ ){
scanf("%d",&t[i]);
}
scanf("%d",&b);
for(i = 0; i < b; i++){
scanf("%d",&c);
count += linerSearch(a,t,c);
}
printf("%d\n",count);
return 0;
}
int linerSearch(int x, int *y, int z)
{
int i;
for(i = 0; i < x; i ++){
if(y[i] == z) return 1;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141584/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141584/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:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%t = alloca [10010 x i32], align 16
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 void @llvm.lifetime.start.p0(i64 40040, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10010 x i32], ptr %t, 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 %a, 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, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%3 = load i32, ptr %b, align 4, !tbaa !5
%cmp419 = icmp sgt i32 %3, 0
br i1 %cmp419, label %for.body5, label %for.end10
for.body5: ; preds = %for.end, %linerSearch.exit
%i.121 = phi i32 [ %inc9, %linerSearch.exit ], [ 0, %for.end ]
%count.020 = phi i32 [ %add, %linerSearch.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%4 = load i32, ptr %a, align 4, !tbaa !5
%5 = load i32, ptr %c, align 4, !tbaa !5
%cmp4.i = icmp sgt i32 %4, 0
br i1 %cmp4.i, label %for.body.preheader.i, label %linerSearch.exit
for.body.preheader.i: ; preds = %for.body5
%wide.trip.count.i = zext i32 %4 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.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 %linerSearch.exit, label %for.body.i, !llvm.loop !11
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.cond.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %t, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %6, %5
br i1 %cmp1.i, label %linerSearch.exit, label %for.cond.i
linerSearch.exit: ; preds = %for.cond.i, %for.body.i, %for.body5
%retval.0.i = phi i32 [ 0, %for.body5 ], [ 1, %for.body.i ], [ 0, %for.cond.i ]
%add = add nuw nsw i32 %retval.0.i, %count.020
%inc9 = add nuw nsw i32 %i.121, 1
%7 = load i32, ptr %b, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc9, %7
br i1 %cmp4, label %for.body5, label %for.end10, !llvm.loop !12
for.end10: ; preds = %linerSearch.exit, %for.end
%count.0.lcssa = phi i32 [ 0, %for.end ], [ %add, %linerSearch.exit ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40040, ptr nonnull %t) #4
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: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @linerSearch(i32 noundef %x, ptr nocapture noundef readonly %y, i32 noundef %z) local_unnamed_addr #3 {
entry:
%cmp4 = icmp sgt i32 %x, 0
br i1 %cmp4, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %x to i64
br label %for.body
for.cond: ; preds = %for.body
%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 %cleanup, label %for.body, !llvm.loop !11
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i32, ptr %y, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, %z
br i1 %cmp1, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.0
}
; 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 = { 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 #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}
|
#include<stdio.h>
int main(){
int i=0,count=0,m,n,j;
scanf("%d",&m);
int S[m];
for(i=0;i<m;i++) scanf("%d",&S[i]);
scanf("%d",&n);
int T[n];
for(i=0;i<n;i++) scanf("%d",&T[i]);
for(j=0;j<n;j++){
i=0;
while (S[i] != T[j]){
i++;
if(i == m) break;
}
if (S[i] == T[j]) count++;
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141627/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141627/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:
%m = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #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 %m)
%0 = load i32, ptr %m, 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 %m, align 4, !tbaa !5
%cmp49 = icmp sgt i32 %3, 0
br i1 %cmp49, label %for.body, label %for.end
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, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %m, 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.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = zext i32 %6 to i64
%vla3 = alloca i32, i64 %7, align 16
%cmp551 = icmp sgt i32 %6, 0
br i1 %cmp551, label %for.body6, label %for.end33
for.cond13.preheader: ; preds = %for.body6
%cmp1453 = icmp sgt i32 %10, 0
br i1 %cmp1453, label %while.cond.preheader.lr.ph, label %for.end33
while.cond.preheader.lr.ph: ; preds = %for.cond13.preheader
%8 = load i32, ptr %m, align 4
%9 = zext i32 %8 to i64
%wide.trip.count = zext i32 %10 to i64
br label %while.cond.preheader
for.body6: ; preds = %for.end, %for.body6
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.body6 ], [ 0, %for.end ]
%arrayidx8 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv58
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8)
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp5 = icmp slt i64 %indvars.iv.next59, %11
br i1 %cmp5, label %for.body6, label %for.cond13.preheader, !llvm.loop !11
while.cond.preheader: ; preds = %while.cond.preheader.lr.ph, %while.end
%indvars.iv64 = phi i64 [ 0, %while.cond.preheader.lr.ph ], [ %indvars.iv.next65, %while.end ]
%count.055 = phi i32 [ 0, %while.cond.preheader.lr.ph ], [ %spec.select, %while.end ]
%arrayidx19 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv64
%12 = load i32, ptr %arrayidx19, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond.preheader, %while.body
%indvars.iv61 = phi i64 [ 0, %while.cond.preheader ], [ %indvars.iv.next62, %while.body ]
%arrayidx17 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv61
%13 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%cmp20.not = icmp eq i32 %13, %12
br i1 %cmp20.not, label %while.end.split.loop.exit69, label %while.body
while.body: ; preds = %while.cond
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%cmp22 = icmp eq i64 %indvars.iv.next62, %9
br i1 %cmp22, label %while.end, label %while.cond, !llvm.loop !12
while.end.split.loop.exit69: ; preds = %while.cond
%14 = trunc i64 %indvars.iv61 to i32
br label %while.end
while.end: ; preds = %while.body, %while.end.split.loop.exit69
%i.3 = phi i32 [ %14, %while.end.split.loop.exit69 ], [ %8, %while.body ]
%idxprom23 = sext i32 %i.3 to i64
%arrayidx24 = getelementptr inbounds i32, ptr %vla, i64 %idxprom23
%15 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%cmp27 = icmp eq i32 %15, %12
%inc29 = zext i1 %cmp27 to i32
%spec.select = add nuw nsw i32 %count.055, %inc29
%indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
%exitcond.not = icmp eq i64 %indvars.iv.next65, %wide.trip.count
br i1 %exitcond.not, label %for.end33, label %while.cond.preheader, !llvm.loop !13
for.end33: ; preds = %while.end, %for.end, %for.cond13.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond13.preheader ], [ 0, %for.end ], [ %spec.select, %while.end ]
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #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
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
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}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#define N 10000
int main(){
int a,b,i,j,x,y,S[N],T[N],count=0;
scanf("%d",&x);
for(i=0;i<x;i++){
scanf("%d",&a);
S[i]=a;
}
scanf("%d",&y);
for(j=0;j<y;j++){
scanf("%d",&b);
T[j]=b;
}
for(j=0;j<y;j++){
for(i=0;i<x;i++){
if(S[i]==T[j]){
count++;
break;
}
}
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141670/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141670/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:
%a = alloca i32, align 4
%b = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%S = alloca [10000 x i32], align 16
%T = alloca [10000 x i32], align 16
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 %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %T) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%arrayidx = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv
store i32 %1, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %x, 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.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %y)
%4 = load i32, ptr %y, align 4, !tbaa !5
%cmp444 = icmp sgt i32 %4, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %12, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%5 = load i32, ptr %x, align 4, !tbaa !5
%cmp1646 = icmp sgt i32 %5, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %12 to i64
%wide.trip.count = zext i32 %5 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%6 = icmp eq i32 %12, 1
br i1 %6, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%count.051.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %count.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx21.us = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %indvars.iv62
%7 = load i32, ptr %arrayidx21.us, align 8, !tbaa !5
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !11
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx19.us = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv59
%8 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %8, %7
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %count.051.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%count.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %count.051.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx21.us.1 = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %indvars.iv.next63
%9 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !5
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx19.us.1 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv59.1
%10 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !5
%cmp22.us.1 = icmp eq i32 %10, %9
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %count.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%count.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %count.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 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.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%11 = load i32, ptr %b, align 4, !tbaa !5
%arrayidx8 = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %indvars.iv56
store i32 %11, ptr %arrayidx8, align 4, !tbaa !5
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%12 = load i32, ptr %y, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %13
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%count.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %count.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%count.051.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %count.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx21.us.epil = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %indvars.iv62.unr
%14 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx19.us.epil = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv59.epil
%15 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp eq i32 %15, %14
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %count.051.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %count.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %count.051.us.unr, %for.cond15.us.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#include<string.h>
#include <stdlib.h>
int main(){
int i,j,s,t,n[10000],q[500],cnt=0;
scanf("%d",&s);
for(i=0;i<s;i++){
scanf("%d",&n[i]);
}
scanf("%d",&t);
for(i=0;i<t;i++){
scanf("%d",&q[i]);
//printf("%d ",q[s]);
}
for(j=0;j<t;j++){
for(i=0;i<s;i++)
if (q[j]== n[i]) {cnt++;//printf("%d %d / %d %d\n",n[i],i,q[j],j);
break;}
}
printf("%d\n",cnt);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141713/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141713/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:
%s = alloca i32, align 4
%t = alloca i32, align 4
%n = alloca [10000 x i32], align 16
%q = alloca [500 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %q) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i32, ptr %s, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %n, 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 %s, 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, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%3 = load i32, ptr %t, align 4, !tbaa !5
%cmp444 = icmp sgt i32 %3, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %10, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %s, align 4, !tbaa !5
%cmp1646 = icmp sgt i32 %4, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%cnt.051.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %cnt.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx19.us = getelementptr inbounds [500 x i32], ptr %q, i64 0, i64 %indvars.iv62
%6 = load i32, ptr %arrayidx19.us, align 8, !tbaa !5
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !11
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx21.us = getelementptr inbounds [10000 x i32], ptr %n, i64 0, i64 %indvars.iv59
%7 = load i32, ptr %arrayidx21.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %6, %7
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %cnt.051.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%cnt.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %cnt.051.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx19.us.1 = getelementptr inbounds [500 x i32], ptr %q, i64 0, i64 %indvars.iv.next63
%8 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !5
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx21.us.1 = getelementptr inbounds [10000 x i32], ptr %n, i64 0, i64 %indvars.iv59.1
%9 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !5
%cmp22.us.1 = icmp eq i32 %8, %9
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %cnt.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%cnt.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %cnt.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 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.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %q, i64 0, i64 %indvars.iv56
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%10 = load i32, ptr %t, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%cnt.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %cnt.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%cnt.051.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %cnt.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx19.us.epil = getelementptr inbounds [500 x i32], ptr %q, i64 0, i64 %indvars.iv62.unr
%12 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !5
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx21.us.epil = getelementptr inbounds [10000 x i32], ptr %n, i64 0, i64 %indvars.iv59.epil
%13 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp eq i32 %12, %13
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %cnt.051.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%cnt.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %cnt.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %cnt.051.us.unr, %for.cond15.us.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 4, 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 = !{!"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}
|
#include<stdio.h>
int search(int A[],int n,int key)
{
int i=0;
A[n]=key;
while(A[i] != key)
{
i++;
}
return i != n;
}
int main()
{
int i,n,A[10000+1],q,key,sum=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&A[i]);
}
scanf("%d",&q);
for(i=0;i<q;i++)
{
scanf("%d",&key);
if(search(A,n,key))sum++;
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141757/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141757/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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @search(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %key) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %key
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !9
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
%cmp3 = icmp ne i32 %1, %n
%conv = zext i1 %cmp3 to i32
ret i32 %conv
}
; 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
%A = alloca [10001 x i32], align 16
%q = alloca i32, align 4
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 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
%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 !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp420 = icmp sgt i32 %3, 0
br i1 %cmp420, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %search.exit
%sum.022 = phi i32 [ %spec.select, %search.exit ], [ 0, %for.end ]
%i.121 = phi i32 [ %inc10, %search.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %key, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %idxprom.i
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %for.body5
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %for.body5 ]
%arrayidx2.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %6, %5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %search.exit, label %while.cond.i, !llvm.loop !9
search.exit: ; preds = %while.cond.i
%7 = trunc i64 %indvars.iv.i to i32
%cmp3.i.not = icmp ne i32 %4, %7
%inc8 = zext i1 %cmp3.i.not to i32
%spec.select = add nuw nsw i32 %sum.022, %inc8
%inc10 = add nuw nsw i32 %i.121, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %search.exit, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %search.exit ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, 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(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 = { 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>
#include<string.h>
int main()
{
char results[100000];
long long int len;
scanf("%lld%s",&len,results);
long long int i,a=0,d=0;
for(i=0;i<len;i++)
{
if(results[i]=='A')
a++;
else
d++;
}
if(a>d)
printf("Anton\n");
else if(a<d)
printf("Danik\n");
else
printf("Friendship\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14180/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14180/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"%lld%s\00", align 1
@str = private unnamed_addr constant [11 x i8] c"Friendship\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"Danik\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"Anton\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%results = alloca [100000 x i8], align 16
%len = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 100000, ptr nonnull %results) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %len) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %len, ptr noundef nonnull %results)
%0 = load i64, ptr %len, align 8, !tbaa !5
%cmp26 = icmp sgt i64 %0, 0
br i1 %cmp26, label %for.body.preheader, label %if.else14
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %0, 4
br i1 %min.iters.check, label %for.body.preheader45, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %0, -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> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%vec.phi39 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%vec.phi40 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi41 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%1 = getelementptr inbounds [100000 x i8], ptr %results, i64 0, i64 %index
%wide.load = load <2 x i8>, ptr %1, align 4, !tbaa !9
%2 = getelementptr inbounds i8, ptr %1, i64 2
%wide.load42 = load <2 x i8>, ptr %2, align 2, !tbaa !9
%3 = icmp eq <2 x i8> %wide.load, <i8 65, i8 65>
%4 = icmp eq <2 x i8> %wide.load42, <i8 65, i8 65>
%5 = zext <2 x i1> %3 to <2 x i64>
%6 = zext <2 x i1> %4 to <2 x i64>
%7 = add <2 x i64> %vec.phi40, %5
%8 = add <2 x i64> %vec.phi41, %6
%9 = xor <2 x i1> %3, <i1 true, i1 true>
%10 = xor <2 x i1> %4, <i1 true, i1 true>
%11 = zext <2 x i1> %9 to <2 x i64>
%12 = zext <2 x i1> %10 to <2 x i64>
%13 = add <2 x i64> %vec.phi, %11
%14 = add <2 x i64> %vec.phi39, %12
%index.next = add nuw i64 %index, 4
%15 = icmp eq i64 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%bin.rdx43 = add <2 x i64> %8, %7
%16 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx43)
%bin.rdx = add <2 x i64> %14, %13
%17 = 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.end, label %for.body.preheader45
for.body.preheader45: ; preds = %for.body.preheader, %middle.block
%d.029.ph = phi i64 [ 0, %for.body.preheader ], [ %17, %middle.block ]
%a.028.ph = phi i64 [ 0, %for.body.preheader ], [ %16, %middle.block ]
%i.027.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader45, %for.body
%d.029 = phi i64 [ %d.1, %for.body ], [ %d.029.ph, %for.body.preheader45 ]
%a.028 = phi i64 [ %a.1, %for.body ], [ %a.028.ph, %for.body.preheader45 ]
%i.027 = phi i64 [ %inc4, %for.body ], [ %i.027.ph, %for.body.preheader45 ]
%arrayidx = getelementptr inbounds [100000 x i8], ptr %results, i64 0, i64 %i.027
%18 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp1 = icmp eq i8 %18, 65
%inc = zext i1 %cmp1 to i64
%a.1 = add nuw nsw i64 %a.028, %inc
%not.cmp1 = xor i1 %cmp1, true
%inc3 = zext i1 %not.cmp1 to i64
%d.1 = add nuw nsw i64 %d.029, %inc3
%inc4 = add nuw nsw i64 %i.027, 1
%exitcond.not = icmp eq i64 %inc4, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !14
for.end: ; preds = %for.body, %middle.block
%a.1.lcssa = phi i64 [ %16, %middle.block ], [ %a.1, %for.body ]
%d.1.lcssa = phi i64 [ %17, %middle.block ], [ %d.1, %for.body ]
%cmp5 = icmp ugt i64 %a.1.lcssa, %d.1.lcssa
br i1 %cmp5, label %if.end17, label %if.else9
if.else9: ; preds = %for.end
%cmp10 = icmp ult i64 %a.1.lcssa, %d.1.lcssa
br i1 %cmp10, label %if.end17, label %if.else14
if.else14: ; preds = %entry, %if.else9
br label %if.end17
if.end17: ; preds = %if.else9, %for.end, %if.else14
%str.4.sink = phi ptr [ @str, %if.else14 ], [ @str.5, %for.end ], [ @str.4, %if.else9 ]
%puts24 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %len) #5
call void @llvm.lifetime.end.p0(i64 100000, ptr nonnull %results) #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 i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
|
#include <stdio.h>
int search(int A[], int n, int key) {
int i = 0; A[n] = key;
while(A[i] != key) i++;
return i != n;
}
int main(void) {
int i, n, A[10000+1], q, key, sum = 0;
scanf("%d",&n);
for(i=0; i<n; i++) scanf("%d", &A[i]);
scanf("%d",&q);
for(i=0; i<q; i++) {
scanf("%d", &key);
if(search(A, n, key))sum++;
}
printf("%d\n", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141843/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141843/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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @search(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %key) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %key
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !9
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
%cmp3 = icmp ne i32 %1, %n
%conv = zext i1 %cmp3 to i32
ret i32 %conv
}
; 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
%A = alloca [10001 x i32], align 16
%q = alloca i32, align 4
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 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
%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 !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp420 = icmp sgt i32 %3, 0
br i1 %cmp420, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %search.exit
%sum.022 = phi i32 [ %spec.select, %search.exit ], [ 0, %for.end ]
%i.121 = phi i32 [ %inc10, %search.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %key, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %idxprom.i
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %for.body5
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %for.body5 ]
%arrayidx2.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %6, %5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %search.exit, label %while.cond.i, !llvm.loop !9
search.exit: ; preds = %while.cond.i
%7 = trunc i64 %indvars.iv.i to i32
%cmp3.i.not = icmp ne i32 %4, %7
%inc8 = zext i1 %cmp3.i.not to i32
%spec.select = add nuw nsw i32 %sum.022, %inc8
%inc10 = add nuw nsw i32 %i.121, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %search.exit, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %search.exit ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, 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(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 = { 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 N 10000
#define Q 10000
int main() {
int S[N];
int T[Q];
int i,j,x,y,count = 0;
scanf("%d",&x);
for(i = 0; i < x; i++) {
scanf("%d",&S[i]);
}
scanf("%d",&y);
for(i = 0; i < y; i++) {
scanf("%d",&T[i]);
}
for(i = 0; i < y; i++) {
for(j = 0; j < x; j++) {
if(S[j] == T[i]) {
count++;
break;
}
}
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141887/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141887/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:
%S = alloca [10000 x i32], align 16
%T = alloca [10000 x i32], align 16
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %T) #3
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)
%0 = load i32, ptr %x, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %S, 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 %x, 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, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %y)
%3 = load i32, ptr %y, align 4, !tbaa !5
%cmp444 = icmp sgt i32 %3, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %10, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %x, align 4, !tbaa !5
%cmp1646 = icmp sgt i32 %4, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%count.051.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %count.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx21.us = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %indvars.iv62
%6 = load i32, ptr %arrayidx21.us, align 8, !tbaa !5
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !11
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx19.us = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv59
%7 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %7, %6
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %count.051.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%count.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %count.051.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx21.us.1 = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %indvars.iv.next63
%8 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !5
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx19.us.1 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv59.1
%9 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !5
%cmp22.us.1 = icmp eq i32 %9, %8
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %count.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%count.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %count.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 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.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %indvars.iv56
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%10 = load i32, ptr %y, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%count.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %count.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%count.051.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %count.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx21.us.epil = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %indvars.iv62.unr
%12 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx19.us.epil = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv59.epil
%13 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp eq i32 %13, %12
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %count.051.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %count.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %count.051.us.unr, %for.cond15.us.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 40000, 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 = !{!"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}
|
#include<stdio.h>
int main()
{
int w,x,y,z,a2,a3,a5,a6,sum=0,sum2=0;
scanf("%d %d %d %d",&w,&x,&y,&z);
a2=w;
a3=x;
a5=y;
a6=z;
if(a2<=a5&&a2<=a6)
{
sum+=a2*256;
a2=0;
}
else if(a5<=a2&&a5<=a6)
{
sum+=a5*256;
a2=a2-a5;
}
else if(a6<=a2&&a6<=a5)
{
sum+=a6*256;
a2=a2-a6;
}
if(a2>a3)sum+=a3*32;
else if(a3>a2) sum+=a2*32;
a2=w;
a3=x;
a5=y;
a6=z;
if(a2<a3){sum2+=a2*32;a2=0;}
else {sum2+=a3*32;a2=a2-a3;}
if(a2<=a5&&a2<=a6)
{
sum2+=a2*256;
a2=0;
}
else if(a5<=a2&&a5<=a6)
{
sum2+=a5*256;
a2=a2-a5;
}
else if(a6<=a2&&a6<=a5)
{
sum2+=a6*256;
a2=a2-a6;
}
if(sum>sum2)printf("%d",sum);
else printf("%d",sum2);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14193/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14193/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"%d %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:
%w = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%0 = load i32, ptr %w, align 4, !tbaa !5
%1 = load i32, ptr %x, align 4, !tbaa !5
%2 = load i32, ptr %y, align 4, !tbaa !5
%3 = load i32, ptr %z, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %2
%cmp1.not = icmp sgt i32 %0, %3
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp1.not
br i1 %or.cond, label %if.else, label %if.then
if.then: ; preds = %entry
%mul = shl nsw i32 %0, 8
br label %if.end17
if.else: ; preds = %entry
%cmp2.not = icmp sgt i32 %2, %0
%cmp4.not = icmp sgt i32 %2, %3
%or.cond135 = select i1 %cmp2.not, i1 true, i1 %cmp4.not
br i1 %or.cond135, label %if.else8, label %if.then5
if.then5: ; preds = %if.else
%mul6 = shl nsw i32 %2, 8
%sub = sub nsw i32 %0, %2
br label %if.end17
if.else8: ; preds = %if.else
%cmp9.not = icmp sgt i32 %3, %0
%cmp11.not = icmp sgt i32 %3, %2
%or.cond136 = or i1 %cmp9.not, %cmp11.not
br i1 %or.cond136, label %if.end17, label %if.then12
if.then12: ; preds = %if.else8
%mul13 = shl nsw i32 %3, 8
%sub15 = sub nsw i32 %0, %3
br label %if.end17
if.end17: ; preds = %if.then5, %if.then12, %if.else8, %if.then
%a2.0 = phi i32 [ 0, %if.then ], [ %sub, %if.then5 ], [ %sub15, %if.then12 ], [ %0, %if.else8 ]
%sum.0 = phi i32 [ %mul, %if.then ], [ %mul6, %if.then5 ], [ %mul13, %if.then12 ], [ 0, %if.else8 ]
%cmp18 = icmp sgt i32 %a2.0, %1
br i1 %cmp18, label %if.then19, label %if.else22
if.then19: ; preds = %if.end17
%mul20 = shl nsw i32 %1, 5
%add21 = add nsw i32 %sum.0, %mul20
br label %if.end28
if.else22: ; preds = %if.end17
%cmp23 = icmp sgt i32 %1, %a2.0
br i1 %cmp23, label %if.then24, label %if.end28
if.then24: ; preds = %if.else22
%mul25 = shl nsw i32 %a2.0, 5
%add26 = add nsw i32 %sum.0, %mul25
br label %if.end28
if.end28: ; preds = %if.else22, %if.then24, %if.then19
%sum.1 = phi i32 [ %add21, %if.then19 ], [ %add26, %if.then24 ], [ %sum.0, %if.else22 ]
%cmp29 = icmp slt i32 %0, %1
%sub36 = sub nsw i32 %0, %1
%a2.1 = select i1 %cmp29, i32 0, i32 %sub36
%sum2.0.in = call i32 @llvm.smin.i32(i32 %0, i32 %1)
%sum2.0 = shl nsw i32 %sum2.0.in, 5
%cmp38.not = icmp sgt i32 %a2.1, %2
%cmp40.not = icmp sgt i32 %a2.1, %3
%or.cond137 = select i1 %cmp38.not, i1 true, i1 %cmp40.not
br i1 %or.cond137, label %if.else44, label %if.then41
if.then41: ; preds = %if.end28
%mul42 = shl nsw i32 %a2.1, 8
%add43 = add nsw i32 %mul42, %sum2.0
br label %if.end62
if.else44: ; preds = %if.end28
%cmp45.not = icmp sgt i32 %2, %a2.1
%cmp47.not = icmp sgt i32 %2, %3
%or.cond138 = select i1 %cmp45.not, i1 true, i1 %cmp47.not
br i1 %or.cond138, label %if.else52, label %if.then48
if.then48: ; preds = %if.else44
%mul49 = shl nsw i32 %2, 8
%add50 = add nsw i32 %sum2.0, %mul49
br label %if.end62
if.else52: ; preds = %if.else44
%cmp53.not = icmp sgt i32 %3, %a2.1
%cmp55.not = icmp sgt i32 %3, %2
%or.cond139 = or i1 %cmp53.not, %cmp55.not
br i1 %or.cond139, label %if.end62, label %if.then56
if.then56: ; preds = %if.else52
%mul57 = shl nsw i32 %3, 8
%add58 = add nsw i32 %mul57, %sum2.0
br label %if.end62
if.end62: ; preds = %if.then48, %if.then56, %if.else52, %if.then41
%sum2.1 = phi i32 [ %add43, %if.then41 ], [ %add50, %if.then48 ], [ %add58, %if.then56 ], [ %sum2.0, %if.else52 ]
%sum.1.sum2.1 = call i32 @llvm.smax.i32(i32 %sum.1, i32 %sum2.1)
%call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.1.sum2.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #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.smin.i32(i32, i32) #3
; 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"}
|
#include <stdio.h>
#define n 10000
#define q 500
int main()
{
int S[n],T[q],C=0,es,et,i,j,k,flag;
scanf("%d",&es);
for(i=0;i<es;i++)
scanf("%d",&S[i]);
scanf("%d",&et);
for(i=0;i<et;i++)
scanf("%d",&T[i]);
for(i=0;i<es;i++)
{
flag=0;
for(j=0;j<et;j++)
{
for(k=0;k<i;k++)
{
if(S[i]==S[k])
{
flag=1;
break;
}
}
if(S[i]==T[j])
{
if(flag==1) break;
C++;
}
}
}
printf("%d",C);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141973/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141973/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:
%S = alloca [10000 x i32], align 16
%T = alloca [500 x i32], align 16
%es = alloca i32, align 4
%et = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #5
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %T) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %es) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %et) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %es)
%0 = load i32, ptr %es, align 4, !tbaa !5
%cmp73 = icmp sgt i32 %0, 0
br i1 %cmp73, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %S, 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 %es, 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, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %et)
%3 = load i32, ptr %et, align 4, !tbaa !5
%cmp475 = icmp sgt i32 %3, 0
br i1 %cmp475, label %for.body5, label %for.cond12.preheader
for.cond12.preheader: ; preds = %for.body5, %for.end
%.lcssa = phi i32 [ %3, %for.end ], [ %21, %for.body5 ]
%4 = load i32, ptr %es, align 4, !tbaa !5
%cmp1388 = icmp sgt i32 %4, 0
%cmp1679 = icmp sgt i32 %.lcssa, 0
%or.cond = and i1 %cmp1388, %cmp1679
br i1 %or.cond, label %for.cond15.preheader.us.preheader, label %for.end45
for.cond15.preheader.us.preheader: ; preds = %for.cond12.preheader
%wide.trip.count131 = zext i32 %4 to i64
%wide.trip.count121 = zext i32 %.lcssa to i64
%wide.trip.count126 = zext i32 %.lcssa to i64
%min.iters.check = icmp ult i32 %.lcssa, 8
%n.vec = and i64 %wide.trip.count121, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count121
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.cond15.preheader.us.preheader, %for.inc43.us
%indvars.iv128 = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next129, %for.inc43.us ]
%C.089.us = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %C.1.lcssa.us, %for.inc43.us ]
%arrayidx3065.us = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv128
%cmp1977.us.not = icmp eq i64 %indvars.iv128, 0
%5 = load i32, ptr %arrayidx3065.us, align 4, !tbaa !5
br i1 %cmp1977.us.not, label %for.cond18.preheader.us99.preheader, label %for.cond18.preheader.us.us
for.cond18.preheader.us99.preheader: ; preds = %for.cond15.preheader.us
br i1 %min.iters.check, label %for.cond18.preheader.us99.preheader139, label %vector.ph
vector.ph: ; preds = %for.cond18.preheader.us99.preheader
%6 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %C.089.us, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %5, 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 ]
%vec.phi = phi <4 x i32> [ %6, %vector.ph ], [ %13, %vector.body ]
%vec.phi137 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%7 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load138 = load <4 x i32>, ptr %8, align 16, !tbaa !5
%9 = icmp eq <4 x i32> %broadcast.splat, %wide.load
%10 = icmp eq <4 x i32> %broadcast.splat, %wide.load138
%11 = zext <4 x i1> %9 to <4 x i32>
%12 = zext <4 x i1> %10 to <4 x i32>
%13 = add <4 x i32> %vec.phi, %11
%14 = add <4 x i32> %vec.phi137, %12
%index.next = add nuw i64 %index, 8
%15 = icmp eq i64 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %14, %13
%16 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.inc43.us, label %for.cond18.preheader.us99.preheader139
for.cond18.preheader.us99.preheader139: ; preds = %for.cond18.preheader.us99.preheader, %middle.block
%indvars.iv123.ph = phi i64 [ 0, %for.cond18.preheader.us99.preheader ], [ %n.vec, %middle.block ]
%C.180.us101.ph = phi i32 [ %C.089.us, %for.cond18.preheader.us99.preheader ], [ %16, %middle.block ]
br label %for.cond18.preheader.us99
for.inc43.us: ; preds = %for.inc40.us.us, %for.end28.thread.us.us, %if.then34.us.us, %for.cond18.preheader.us99, %middle.block
%C.1.lcssa.us = phi i32 [ %16, %middle.block ], [ %C.2.us96, %for.cond18.preheader.us99 ], [ %C.180.us.us, %if.then34.us.us ], [ %C.180.us.us, %for.end28.thread.us.us ], [ %C.2.us.us, %for.inc40.us.us ]
%indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1
%exitcond132.not = icmp eq i64 %indvars.iv.next129, %wide.trip.count131
br i1 %exitcond132.not, label %for.end45, label %for.cond15.preheader.us, !llvm.loop !14
for.cond18.preheader.us99: ; preds = %for.cond18.preheader.us99.preheader139, %for.cond18.preheader.us99
%indvars.iv123 = phi i64 [ %indvars.iv.next124, %for.cond18.preheader.us99 ], [ %indvars.iv123.ph, %for.cond18.preheader.us99.preheader139 ]
%C.180.us101 = phi i32 [ %C.2.us96, %for.cond18.preheader.us99 ], [ %C.180.us101.ph, %for.cond18.preheader.us99.preheader139 ]
%arrayidx32.us103 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv123
%17 = load i32, ptr %arrayidx32.us103, align 4, !tbaa !5
%cmp33.us104 = icmp eq i32 %5, %17
%inc38.us94 = zext i1 %cmp33.us104 to i32
%C.2.us96 = add nsw i32 %C.180.us101, %inc38.us94
%indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
%exitcond127.not = icmp eq i64 %indvars.iv.next124, %wide.trip.count126
br i1 %exitcond127.not, label %for.inc43.us, label %for.cond18.preheader.us99, !llvm.loop !15
for.cond18.preheader.us.us: ; preds = %for.cond15.preheader.us, %for.inc40.us.us
%indvars.iv118 = phi i64 [ %indvars.iv.next119, %for.inc40.us.us ], [ 0, %for.cond15.preheader.us ]
%flag.082.us.us = phi i32 [ %flag.170.us.us, %for.inc40.us.us ], [ 0, %for.cond15.preheader.us ]
%C.180.us.us = phi i32 [ %C.2.us.us, %for.inc40.us.us ], [ %C.089.us, %for.cond15.preheader.us ]
br label %for.body20.us.us
for.cond18.us.us: ; preds = %for.body20.us.us
%indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
%exitcond.not = icmp eq i64 %indvars.iv.next116, %indvars.iv128
br i1 %exitcond.not, label %for.cond18.for.end28_crit_edge.us.us, label %for.body20.us.us, !llvm.loop !16
if.then34.us.us: ; preds = %for.cond18.for.end28_crit_edge.us.us
%cmp35.us.us = icmp eq i32 %flag.082.us.us, 1
br i1 %cmp35.us.us, label %for.inc43.us, label %if.end37.us.us
if.end37.us.us: ; preds = %if.then34.us.us
%inc38.us.us = add nsw i32 %C.180.us.us, 1
br label %for.inc40.us.us
for.body20.us.us: ; preds = %for.cond18.us.us, %for.cond18.preheader.us.us
%indvars.iv115 = phi i64 [ %indvars.iv.next116, %for.cond18.us.us ], [ 0, %for.cond18.preheader.us.us ]
%arrayidx24.us.us = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv115
%18 = load i32, ptr %arrayidx24.us.us, align 4, !tbaa !5
%cmp25.us.us = icmp eq i32 %5, %18
br i1 %cmp25.us.us, label %for.end28.thread.us.us, label %for.cond18.us.us
for.end28.thread.us.us: ; preds = %for.body20.us.us
%arrayidx3267.us.us = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv118
%19 = load i32, ptr %arrayidx3267.us.us, align 4, !tbaa !5
%cmp3368.us.us = icmp eq i32 %5, %19
br i1 %cmp3368.us.us, label %for.inc43.us, label %for.inc40.us.us
for.inc40.us.us: ; preds = %for.cond18.for.end28_crit_edge.us.us, %for.end28.thread.us.us, %if.end37.us.us
%flag.170.us.us = phi i32 [ %flag.082.us.us, %if.end37.us.us ], [ %flag.082.us.us, %for.cond18.for.end28_crit_edge.us.us ], [ 1, %for.end28.thread.us.us ]
%C.2.us.us = phi i32 [ %inc38.us.us, %if.end37.us.us ], [ %C.180.us.us, %for.cond18.for.end28_crit_edge.us.us ], [ %C.180.us.us, %for.end28.thread.us.us ]
%indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
%exitcond122.not = icmp eq i64 %indvars.iv.next119, %wide.trip.count121
br i1 %exitcond122.not, label %for.inc43.us, label %for.cond18.preheader.us.us, !llvm.loop !17
for.cond18.for.end28_crit_edge.us.us: ; preds = %for.cond18.us.us
%arrayidx32.us.us = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv118
%20 = load i32, ptr %arrayidx32.us.us, align 4, !tbaa !5
%cmp33.us.us = icmp eq i32 %5, %20
br i1 %cmp33.us.us, label %if.then34.us.us, label %for.inc40.us.us
for.body5: ; preds = %for.end, %for.body5
%indvars.iv112 = phi i64 [ %indvars.iv.next113, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv112
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
%21 = load i32, ptr %et, align 4, !tbaa !5
%22 = sext i32 %21 to i64
%cmp4 = icmp slt i64 %indvars.iv.next113, %22
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !18
for.end45: ; preds = %for.inc43.us, %for.cond12.preheader
%C.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ %C.1.lcssa.us, %for.inc43.us ]
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %C.0.lcssa)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %et) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %es) #5
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %T) #5
call void @llvm.lifetime.end.p0(i64 40000, 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: 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.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 = { 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 = 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}
!15 = distinct !{!15, !10, !13, !12}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
|
#include<stdio.h>
int main(){
int n,m,i,j,a,cnt=0;
int num[10000];
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&num[i]);
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d",&a);
for(j=0;j<n;j++){
if(a==num[j]){
cnt++;
break;
}
}
}
printf("%d\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142022/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142022/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
%m = alloca i32, align 4
%a = alloca i32, align 4
%num = alloca [10000 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 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %num) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %0, 0
br i1 %cmp28, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %num, 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, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%3 = load i32, ptr %m, align 4, !tbaa !5
%cmp432 = icmp sgt i32 %3, 0
br i1 %cmp432, label %for.body5, label %for.end19
for.body5: ; preds = %for.end, %for.inc17
%cnt.034 = phi i32 [ %cnt.1, %for.inc17 ], [ 0, %for.end ]
%i.133 = phi i32 [ %inc18, %for.inc17 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp830 = icmp sgt i32 %4, 0
br i1 %cmp830, label %for.body9.lr.ph, label %for.inc17
for.body9.lr.ph: ; preds = %for.body5
%5 = load i32, ptr %a, align 4, !tbaa !5
%wide.trip.count = zext i32 %4 to i64
br label %for.body9
for.cond7: ; preds = %for.body9
%indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
%exitcond.not = icmp eq i64 %indvars.iv.next37, %wide.trip.count
br i1 %exitcond.not, label %for.inc17, label %for.body9, !llvm.loop !11
for.body9: ; preds = %for.body9.lr.ph, %for.cond7
%indvars.iv36 = phi i64 [ 0, %for.body9.lr.ph ], [ %indvars.iv.next37, %for.cond7 ]
%arrayidx11 = getelementptr inbounds [10000 x i32], ptr %num, i64 0, i64 %indvars.iv36
%6 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp eq i32 %5, %6
br i1 %cmp12, label %if.then, label %for.cond7
if.then: ; preds = %for.body9
%inc13 = add nsw i32 %cnt.034, 1
br label %for.inc17
for.inc17: ; preds = %for.cond7, %for.body5, %if.then
%cnt.1 = phi i32 [ %inc13, %if.then ], [ %cnt.034, %for.body5 ], [ %cnt.034, %for.cond7 ]
%inc18 = add nuw nsw i32 %i.133, 1
%7 = load i32, ptr %m, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc18, %7
br i1 %cmp4, label %for.body5, label %for.end19, !llvm.loop !12
for.end19: ; preds = %for.inc17, %for.end
%cnt.0.lcssa = phi i32 [ 0, %for.end ], [ %cnt.1, %for.inc17 ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %num) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #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>
int search(int A[], int n, int key) {
int i = 0;
A[n] = key;
while (A[i] != key) i++;
return i != n;
}
int main() {
int i, n, A[10000 + 1], q, key, sum = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) scanf("%d", &A[i]);
scanf("%d", &q);
for (i = 0; i < q; i++) {
scanf("%d", &key);
if (search(A, n, key)) sum++;
}
printf("%d\n", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142066/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142066/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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @search(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %key) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %key
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !9
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
%cmp3 = icmp ne i32 %1, %n
%conv = zext i1 %cmp3 to i32
ret i32 %conv
}
; 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
%A = alloca [10001 x i32], align 16
%q = alloca i32, align 4
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 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
%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 !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp420 = icmp sgt i32 %3, 0
br i1 %cmp420, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %search.exit
%sum.022 = phi i32 [ %spec.select, %search.exit ], [ 0, %for.end ]
%i.121 = phi i32 [ %inc10, %search.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %key, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %idxprom.i
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %for.body5
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %for.body5 ]
%arrayidx2.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %6, %5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %search.exit, label %while.cond.i, !llvm.loop !9
search.exit: ; preds = %while.cond.i
%7 = trunc i64 %indvars.iv.i to i32
%cmp3.i.not = icmp ne i32 %4, %7
%inc8 = zext i1 %cmp3.i.not to i32
%spec.select = add nuw nsw i32 %sum.022, %inc8
%inc10 = add nuw nsw i32 %i.121, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %search.exit, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %search.exit ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, 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(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 = { 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() {
int n, k, h = 1;
scanf("%d %d", &n, &k);
for(int i = 1; i <= n; i++){
if(h <= k){
h *= 2;
}
else{
h += k;
}
}
printf ("%d\n", h);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142109/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142109/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:
%n = alloca i32, align 4
%k = 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 %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not7 = icmp slt i32 %0, 1
br i1 %cmp.not7, label %for.cond.cleanup, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %k, align 4, !tbaa !5
%xtraiter = and i32 %0, 3
%2 = icmp ult i32 %0, 4
br i1 %2, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %0, -4
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%h.1.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %h.1.3, %for.body ]
%h.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %h.1.3, %for.body ]
%lcmp.mod.not = icmp eq i32 %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
%h.08.epil = phi i32 [ %h.1.epil, %for.body.epil ], [ %h.08.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%cmp1.not.epil = icmp sgt i32 %h.08.epil, %1
%mul.epil = shl nsw i32 %h.08.epil, 1
%add.epil = add nsw i32 %1, %h.08.epil
%h.1.epil = select i1 %cmp1.not.epil, i32 %add.epil, i32 %mul.epil
%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.cond.cleanup, label %for.body.epil, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%h.0.lcssa = phi i32 [ 1, %entry ], [ %h.1.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %h.1.epil, %for.body.epil ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %h.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
for.body: ; preds = %for.body, %for.body.lr.ph.new
%h.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %h.1.3, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.body ]
%cmp1.not = icmp sgt i32 %h.08, %1
%mul = shl nsw i32 %h.08, 1
%add = add nsw i32 %1, %h.08
%h.1 = select i1 %cmp1.not, i32 %add, i32 %mul
%cmp1.not.1 = icmp sgt i32 %h.1, %1
%mul.1 = shl nsw i32 %h.1, 1
%add.1 = add nsw i32 %1, %h.1
%h.1.1 = select i1 %cmp1.not.1, i32 %add.1, i32 %mul.1
%cmp1.not.2 = icmp sgt i32 %h.1.1, %1
%mul.2 = shl nsw i32 %h.1.1, 1
%add.2 = add nsw i32 %1, %h.1.1
%h.1.2 = select i1 %cmp1.not.2, i32 %add.2, i32 %mul.2
%cmp1.not.3 = icmp sgt i32 %h.1.2, %1
%mul.3 = shl nsw i32 %h.1.2, 1
%add.3 = add nsw i32 %1, %h.1.2
%h.1.3 = select i1 %cmp1.not.3, i32 %add.3, i32 %mul.3
%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.cond.cleanup.loopexit.unr-lcssa, label %for.body, !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: 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.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>
int main() {
int n, k, ans = 1;
scanf("%d%d", &n, &k);
for (int i=0; i<n; i++) {
if (ans < k)
ans *= 2;
else
ans += k;
}
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142152/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142152/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:
%n = alloca i32, align 4
%k = 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 %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %0, 0
br i1 %cmp7, label %for.body.lr.ph, label %for.cond.cleanup
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %k, align 4, !tbaa !5
%xtraiter = and i32 %0, 3
%2 = icmp ult i32 %0, 4
br i1 %2, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %0, -4
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%ans.1.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %ans.1.3, %for.body ]
%ans.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %ans.1.3, %for.body ]
%lcmp.mod.not = icmp eq i32 %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
%ans.08.epil = phi i32 [ %ans.1.epil, %for.body.epil ], [ %ans.08.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%cmp1.epil = icmp slt i32 %ans.08.epil, %1
%mul.epil = shl nsw i32 %ans.08.epil, 1
%add.epil = add nsw i32 %1, %ans.08.epil
%ans.1.epil = select i1 %cmp1.epil, i32 %mul.epil, i32 %add.epil
%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.cond.cleanup, label %for.body.epil, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%ans.0.lcssa = phi i32 [ 1, %entry ], [ %ans.1.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %ans.1.epil, %for.body.epil ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
for.body: ; preds = %for.body, %for.body.lr.ph.new
%ans.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %ans.1.3, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.body ]
%cmp1 = icmp slt i32 %ans.08, %1
%mul = shl nsw i32 %ans.08, 1
%add = add nsw i32 %1, %ans.08
%ans.1 = select i1 %cmp1, i32 %mul, i32 %add
%cmp1.1 = icmp slt i32 %ans.1, %1
%mul.1 = shl nsw i32 %ans.1, 1
%add.1 = add nsw i32 %1, %ans.1
%ans.1.1 = select i1 %cmp1.1, i32 %mul.1, i32 %add.1
%cmp1.2 = icmp slt i32 %ans.1.1, %1
%mul.2 = shl nsw i32 %ans.1.1, 1
%add.2 = add nsw i32 %1, %ans.1.1
%ans.1.2 = select i1 %cmp1.2, i32 %mul.2, i32 %add.2
%cmp1.3 = icmp slt i32 %ans.1.2, %1
%mul.3 = shl nsw i32 %ans.1.2, 1
%add.3 = add nsw i32 %1, %ans.1.2
%ans.1.3 = select i1 %cmp1.3, i32 %mul.3, i32 %add.3
%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.cond.cleanup.loopexit.unr-lcssa, label %for.body, !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: 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.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
/* define */
#define Yes(X) puts ( (X) ? "Yes" : "No")
#define YES(X) puts ( (X) ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = (a); i < (b) ; i++)
#define REP(i, n) for ( int i = 0; i < (n) ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))
/* const */
const int MOD = 1000000007;
/* alias */
typedef long long ll;
typedef unsigned u;
/* function */
int cmp(const void *a, const void *b) {
return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
return *(int*)b - *(int*)a;
}
int gcd(int a, int b) {
if (b != 0)return gcd(b, a % b);
return a;
}
ll Lgcd(ll a, ll b) {
if (b != 0) return Lgcd(b, a % b);
return a;
}
int lcm(int a, int b) {
return a / gcd(a, b) * b;
}
ll Llcm(ll a, ll b) {
return a / Lgcd(a, b) * b;
}
/* main */
int main() {
int n, k, r = 1;
scanf("%d%d", &n, &k);
REP(i, n) {
if (2 * r < r + k) r *= 2;
else r += k;
}
printf("%d", r);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142196/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142196/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"
@MOD = dso_local local_unnamed_addr constant i32 1000000007, align 4
@.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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #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 nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp2(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%cmp.not4 = icmp eq i32 %b, 0
br i1 %cmp.not4, label %return, label %if.then
if.then: ; preds = %entry, %if.then
%b.tr6 = phi i32 [ %rem, %if.then ], [ %b, %entry ]
%a.tr5 = phi i32 [ %b.tr6, %if.then ], [ %a, %entry ]
%rem = srem i32 %a.tr5, %b.tr6
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %return, label %if.then
return: ; preds = %if.then, %entry
%a.tr.lcssa = phi i32 [ %a, %entry ], [ %b.tr6, %if.then ]
ret i32 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @Lgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%cmp.not4 = icmp eq i64 %b, 0
br i1 %cmp.not4, label %return, label %if.then
if.then: ; preds = %entry, %if.then
%b.tr6 = phi i64 [ %rem, %if.then ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %if.then ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %return, label %if.then
return: ; preds = %if.then, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %if.then ]
ret i64 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%cmp.not4.i = icmp eq i32 %b, 0
br i1 %cmp.not4.i, label %gcd.exit, label %if.then.i
if.then.i: ; preds = %entry, %if.then.i
%b.tr6.i = phi i32 [ %rem.i, %if.then.i ], [ %b, %entry ]
%a.tr5.i = phi i32 [ %b.tr6.i, %if.then.i ], [ %a, %entry ]
%rem.i = srem i32 %a.tr5.i, %b.tr6.i
%cmp.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp.not.i, label %gcd.exit, label %if.then.i
gcd.exit: ; preds = %if.then.i, %entry
%a.tr.lcssa.i = phi i32 [ %a, %entry ], [ %b.tr6.i, %if.then.i ]
%div = sdiv i32 %a, %a.tr.lcssa.i
%mul = mul nsw i32 %div, %b
ret i32 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @Llcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%cmp.not4.i = icmp eq i64 %b, 0
br i1 %cmp.not4.i, label %Lgcd.exit, label %if.then.i
if.then.i: ; preds = %entry, %if.then.i
%b.tr6.i = phi i64 [ %rem.i, %if.then.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %if.then.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%cmp.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not.i, label %Lgcd.exit, label %if.then.i
Lgcd.exit: ; preds = %if.then.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %if.then.i ]
%div = sdiv i64 %a, %a.tr.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%k = 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 %k) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body.lr.ph, label %for.cond.cleanup
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %k, align 4, !tbaa !5
%xtraiter = and i32 %0, 3
%2 = icmp ult i32 %0, 4
br i1 %2, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %0, -4
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%mul.add.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %mul.add.3, %for.body ]
%r.011.unr = phi i32 [ 1, %for.body.lr.ph ], [ %mul.add.3, %for.body ]
%lcmp.mod.not = icmp eq i32 %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
%r.011.epil = phi i32 [ %mul.add.epil, %for.body.epil ], [ %r.011.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%mul.epil = shl nsw i32 %r.011.epil, 1
%add.epil = add nsw i32 %1, %r.011.epil
%mul.add.epil = call i32 @llvm.smin.i32(i32 %mul.epil, i32 %add.epil)
%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.cond.cleanup, label %for.body.epil, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %mul.add.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %mul.add.epil, %for.body.epil ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %r.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.011 = phi i32 [ 1, %for.body.lr.ph.new ], [ %mul.add.3, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.body ]
%mul = shl nsw i32 %r.011, 1
%add = add nsw i32 %1, %r.011
%mul.add = call i32 @llvm.smin.i32(i32 %mul, i32 %add)
%mul.1 = shl nsw i32 %mul.add, 1
%add.1 = add nsw i32 %1, %mul.add
%mul.add.1 = call i32 @llvm.smin.i32(i32 %mul.1, i32 %add.1)
%mul.2 = shl nsw i32 %mul.add.1, 1
%add.2 = add nsw i32 %1, %mul.add.1
%mul.add.2 = call i32 @llvm.smin.i32(i32 %mul.2, i32 %add.2)
%mul.3 = shl nsw i32 %mul.add.2, 1
%add.3 = add nsw i32 %1, %mul.add.2
%mul.add.3 = call i32 @llvm.smin.i32(i32 %mul.3, i32 %add.3)
%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.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; 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
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 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 #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!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"}
|
#include <stdio.h>
int main(void){
int n, k;
scanf("%d %d", &n, &k);
int value = 1;
for(int i = 0; i < n; i++){
value += (value < k)? value : k;
}
printf("%d\n", value);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142239/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142239/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:
%n = 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 %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %0, 0
br i1 %cmp7, label %for.body.lr.ph, label %for.cond.cleanup
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %k, align 4
%xtraiter = and i32 %0, 3
%2 = icmp ult i32 %0, 4
br i1 %2, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %0, -4
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%add.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %add.3, %for.body ]
%value.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %add.3, %for.body ]
%lcmp.mod.not = icmp eq i32 %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
%value.08.epil = phi i32 [ %add.epil, %for.body.epil ], [ %value.08.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%cond.epil = call i32 @llvm.smin.i32(i32 %value.08.epil, i32 %1)
%add.epil = add nsw i32 %cond.epil, %value.08.epil
%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.cond.cleanup, label %for.body.epil, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%value.0.lcssa = phi i32 [ 1, %entry ], [ %add.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %add.epil, %for.body.epil ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %value.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body: ; preds = %for.body, %for.body.lr.ph.new
%value.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %add.3, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.body ]
%cond = call i32 @llvm.smin.i32(i32 %value.08, i32 %1)
%add = add nsw i32 %cond, %value.08
%cond.1 = call i32 @llvm.smin.i32(i32 %add, i32 %1)
%add.1 = add nsw i32 %cond.1, %add
%cond.2 = call i32 @llvm.smin.i32(i32 %add.1, i32 %1)
%add.2 = add nsw i32 %cond.2, %add.1
%cond.3 = call i32 @llvm.smin.i32(i32 %add.2, i32 %1)
%add.3 = add nsw i32 %cond.3, %add.2
%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.cond.cleanup.loopexit.unr-lcssa, label %for.body, !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: 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 i32 @llvm.smin.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.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main()
{
int n,D=0,A=0,i;
scanf("%d",&n);
char string[n];
scanf("%s",string);
for(i=0;i<n;i++)
{
if(string[i]=='D')
D++;
if(string[i]=='A')
A++;
}
//printf("%d%d",D,A);
if(A>D)
printf("Anton");
else if(D>A)
printf("Danik");
else
printf("Friendship");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14229/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14229/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.2 = private unnamed_addr constant [6 x i8] c"Anton\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"Danik\00", align 1
@.str.4 = private unnamed_addr constant [11 x i8] c"Friendship\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
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %1, align 16
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp32 = icmp sgt i32 %3, 0
br i1 %cmp32, label %for.body.preheader, label %if.else21
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %3 to i64
%min.iters.check = icmp ult i32 %3, 8
br i1 %min.iters.check, label %for.body.preheader52, 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 ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%vec.phi46 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%vec.phi47 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %16, %vector.body ]
%vec.phi48 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%4 = getelementptr inbounds i8, ptr %vla, i64 %index
%wide.load = load <4 x i8>, ptr %4, align 8, !tbaa !9
%5 = getelementptr inbounds i8, ptr %4, i64 4
%wide.load49 = load <4 x i8>, ptr %5, align 4, !tbaa !9
%6 = icmp eq <4 x i8> %wide.load, <i8 68, i8 68, i8 68, i8 68>
%7 = icmp eq <4 x i8> %wide.load49, <i8 68, i8 68, i8 68, i8 68>
%8 = zext <4 x i1> %6 to <4 x i32>
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = add <4 x i32> %vec.phi, %8
%11 = add <4 x i32> %vec.phi46, %9
%12 = icmp eq <4 x i8> %wide.load, <i8 65, i8 65, i8 65, i8 65>
%13 = icmp eq <4 x i8> %wide.load49, <i8 65, i8 65, i8 65, i8 65>
%14 = zext <4 x i1> %12 to <4 x i32>
%15 = zext <4 x i1> %13 to <4 x i32>
%16 = add <4 x i32> %vec.phi47, %14
%17 = add <4 x i32> %vec.phi48, %15
%index.next = add nuw i64 %index, 8
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%bin.rdx50 = add <4 x i32> %17, %16
%19 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx50)
%bin.rdx = add <4 x i32> %11, %10
%20 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader52
for.body.preheader52: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%D.035.ph = phi i32 [ 0, %for.body.preheader ], [ %20, %middle.block ]
%A.033.ph = phi i32 [ 0, %for.body.preheader ], [ %19, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader52, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader52 ]
%D.035 = phi i32 [ %spec.select, %for.body ], [ %D.035.ph, %for.body.preheader52 ]
%A.033 = phi i32 [ %A.1, %for.body ], [ %A.033.ph, %for.body.preheader52 ]
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv
%21 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp2 = icmp eq i8 %21, 68
%inc = zext i1 %cmp2 to i32
%spec.select = add nuw nsw i32 %D.035, %inc
%cmp7 = icmp eq i8 %21, 65
%inc10 = zext i1 %cmp7 to i32
%A.1 = add nuw nsw i32 %A.033, %inc10
%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 !14
for.end: ; preds = %for.body, %middle.block
%spec.select.lcssa = phi i32 [ %20, %middle.block ], [ %spec.select, %for.body ]
%A.1.lcssa = phi i32 [ %19, %middle.block ], [ %A.1, %for.body ]
%cmp13 = icmp ugt i32 %A.1.lcssa, %spec.select.lcssa
br i1 %cmp13, label %if.end24, label %if.else
if.else: ; preds = %for.end
%cmp17 = icmp ugt i32 %spec.select.lcssa, %A.1.lcssa
br i1 %cmp17, label %if.end24, label %if.else21
if.else21: ; preds = %entry, %if.else
br label %if.end24
if.end24: ; preds = %if.else, %for.end, %if.else21
%.str.3.sink = phi ptr [ @.str.4, %if.else21 ], [ @.str.2, %for.end ], [ @.str.3, %if.else ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.stackrestore.p0(ptr %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) #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
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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.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 = { 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, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
|
#include<stdio.h>
int main()
{
int k2,k3,k5,k6,sum=0,m=0,n=0;
scanf("%d %d %d %d",&k2,&k3,&k5,&k6);
if(k2<=k5)
m=k2;
else
m=k5;
if(k6<=m)
m=k6;
else
m=m;
sum=m*256;
k2-=m;
if(k2>0 && k3>0)
{
if(k2<=k3)
n=k2;
else
n=k3;
}
sum=sum+n*32;
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14234/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14234/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"%d %d %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:
%k2 = alloca i32, align 4
%k3 = alloca i32, align 4
%k5 = alloca i32, align 4
%k6 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k3) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k5) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k6) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k2, ptr noundef nonnull %k3, ptr noundef nonnull %k5, ptr noundef nonnull %k6)
%0 = load i32, ptr %k2, align 4, !tbaa !5
%1 = load i32, ptr %k5, align 4, !tbaa !5
%. = call i32 @llvm.smin.i32(i32 %0, i32 %1)
%2 = load i32, ptr %k6, align 4, !tbaa !5
%m.1 = call i32 @llvm.smin.i32(i32 %2, i32 %.)
%sub = sub nsw i32 %0, %m.1
store i32 %sub, ptr %k2, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %sub, 0
%3 = load i32, ptr %k3, align 4
%cmp6 = icmp sgt i32 %3, 0
%or.cond = select i1 %cmp5, i1 %cmp6, i1 false
%.sub = call i32 @llvm.smin.i32(i32 %sub, i32 %3)
%4 = shl nsw i32 %.sub, 5
%mul = shl nsw i32 %m.1, 8
%mul13 = select i1 %or.cond, i32 %4, i32 0
%add = add nsw i32 %mul13, %mul
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k6) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k5) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k3) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k2) #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.smin.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"}
|
// AOJ 2978 Undo Swapping
// 2019.9.24 bal4u
#include <stdio.h>
#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in() { // 非負整数の入力
int n = 0, c = gc();
do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
return n;
}
char R[100005], C[100005];
int rel[100005];
int dfs(int r, int n) {
int c = rel[r];
if (c == 0) return n;
rel[r] = 0;
return dfs(c, n+1);
}
int main()
{
int i, N, r, c, ans;
N = in();
i = N; while (i--) {
r = in(), c = in();
if (R[r]) { puts("-1"); return 0; }
R[r] = 1;
if (C[c]) { puts("-1"); return 0; }
C[c] = 1;
if (r != c) rel[r] = c;
}
ans = 0; for (r = 1; r <= N; r++) if (rel[r]) ans += dfs(r, 0)-1;
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142383/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142383/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] }
@rel = dso_local local_unnamed_addr global [100005 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [100005 x i8] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
@C = dso_local local_unnamed_addr global [100005 x i8] zeroinitializer, align 16
@.str.1 = 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: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @dfs(i32 noundef %r, i32 noundef %n) local_unnamed_addr #1 {
entry:
%idxprom6 = sext i32 %r to i64
%arrayidx7 = getelementptr inbounds [100005 x i32], ptr @rel, i64 0, i64 %idxprom6
%0 = load i32, ptr %arrayidx7, align 4, !tbaa !19
%cmp8 = icmp eq i32 %0, 0
br i1 %cmp8, label %cleanup, label %if.end
if.end: ; preds = %entry, %if.end
%1 = phi i32 [ %2, %if.end ], [ %0, %entry ]
%arrayidx10 = phi ptr [ %arrayidx, %if.end ], [ %arrayidx7, %entry ]
%n.tr9 = phi i32 [ %add, %if.end ], [ %n, %entry ]
store i32 0, ptr %arrayidx10, align 4, !tbaa !19
%add = add nsw i32 %n.tr9, 1
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [100005 x i32], ptr @rel, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !19
%cmp = icmp eq i32 %2, 0
br i1 %cmp, label %cleanup, label %if.end
cleanup: ; preds = %if.end, %entry
%n.tr.lcssa = phi i32 [ %n, %entry ], [ %add, %if.end ]
ret i32 %n.tr.lcssa
}
; 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
%.ph126 = 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 ], [ %.ph126, %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 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 %while.cond.preheader, !llvm.loop !17
while.cond.preheader: ; preds = %getchar_unlocked.exit12.i
%tobool.not108 = icmp eq i32 %add.i, 0
br i1 %tobool.not108, label %for.end, label %while.body
for.cond.preheader: ; preds = %if.end18
%cmp19.not110 = icmp slt i32 %add.i, 1
br i1 %cmp19.not110, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%9 = or i32 %mul.i, 1
%10 = and i32 %c.0.i, 15
%11 = add i32 %9, %10
%wide.trip.count = zext i32 %11 to i64
br label %for.body
while.body: ; preds = %while.cond.preheader, %if.end18
%12 = phi ptr [ %32, %if.end18 ], [ %8, %while.cond.preheader ]
%13 = phi ptr [ %33, %if.end18 ], [ %8, %while.cond.preheader ]
%dec109.in = phi i32 [ %dec109, %if.end18 ], [ %add.i, %while.cond.preheader ]
%dec109 = add nsw i32 %dec109.in, -1
%_IO_read_ptr.i.i43 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 1
%14 = load ptr, ptr %_IO_read_ptr.i.i43, align 8, !tbaa !9
%_IO_read_end.i.i44 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 2
%15 = load ptr, ptr %_IO_read_end.i.i44, align 8, !tbaa !14
%cmp.not.i.i45 = icmp ult ptr %14, %15
br i1 %cmp.not.i.i45, label %cond.false.i.i70, label %cond.true.i.i46, !prof !15
cond.true.i.i46: ; preds = %while.body
%call.i.i47 = tail call i32 @__uflow(ptr noundef nonnull %13) #4
%.pre13.pre.i48 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i52.preheader
cond.false.i.i70: ; preds = %while.body
%incdec.ptr.i.i71 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr.i.i71, ptr %_IO_read_ptr.i.i43, align 8, !tbaa !9
%16 = load i8, ptr %14, align 1, !tbaa !16
%conv3.i.i72 = zext i8 %16 to i32
br label %do.body.i52.preheader
do.body.i52.preheader: ; preds = %cond.false.i.i70, %cond.true.i.i46
%.ph122 = phi ptr [ %12, %cond.false.i.i70 ], [ %.pre13.pre.i48, %cond.true.i.i46 ]
%.ph123 = phi ptr [ %13, %cond.false.i.i70 ], [ %.pre13.pre.i48, %cond.true.i.i46 ]
%c.0.i54.ph = phi i32 [ %conv3.i.i72, %cond.false.i.i70 ], [ %call.i.i47, %cond.true.i.i46 ]
br label %do.body.i52
do.body.i52: ; preds = %do.body.i52.preheader, %getchar_unlocked.exit12.i64
%17 = phi ptr [ %22, %getchar_unlocked.exit12.i64 ], [ %.ph122, %do.body.i52.preheader ]
%18 = phi ptr [ %23, %getchar_unlocked.exit12.i64 ], [ %.ph123, %do.body.i52.preheader ]
%n.0.i53 = phi i32 [ %add.i57, %getchar_unlocked.exit12.i64 ], [ 0, %do.body.i52.preheader ]
%c.0.i54 = phi i32 [ %cond.i8.i65, %getchar_unlocked.exit12.i64 ], [ %c.0.i54.ph, %do.body.i52.preheader ]
%mul.i55 = mul nsw i32 %n.0.i53, 10
%and.i56 = and i32 %c.0.i54, 15
%add.i57 = add nsw i32 %and.i56, %mul.i55
%_IO_read_ptr.i3.i58 = getelementptr inbounds %struct._IO_FILE, ptr %18, i64 0, i32 1
%19 = load ptr, ptr %_IO_read_ptr.i3.i58, align 8, !tbaa !9
%_IO_read_end.i4.i59 = getelementptr inbounds %struct._IO_FILE, ptr %18, i64 0, i32 2
%20 = load ptr, ptr %_IO_read_end.i4.i59, align 8, !tbaa !14
%cmp.not.i5.i60 = icmp ult ptr %19, %20
br i1 %cmp.not.i5.i60, label %cond.false.i9.i67, label %cond.true.i6.i61, !prof !15
cond.true.i6.i61: ; preds = %do.body.i52
%call.i7.i62 = tail call i32 @__uflow(ptr noundef nonnull %18) #4
%.pre.i63 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit12.i64
cond.false.i9.i67: ; preds = %do.body.i52
%incdec.ptr.i10.i68 = getelementptr inbounds i8, ptr %19, i64 1
store ptr %incdec.ptr.i10.i68, ptr %_IO_read_ptr.i3.i58, align 8, !tbaa !9
%21 = load i8, ptr %19, align 1, !tbaa !16
%conv3.i11.i69 = zext i8 %21 to i32
br label %getchar_unlocked.exit12.i64
getchar_unlocked.exit12.i64: ; preds = %cond.false.i9.i67, %cond.true.i6.i61
%22 = phi ptr [ %.pre.i63, %cond.true.i6.i61 ], [ %17, %cond.false.i9.i67 ]
%23 = phi ptr [ %.pre.i63, %cond.true.i6.i61 ], [ %18, %cond.false.i9.i67 ]
%cond.i8.i65 = phi i32 [ %call.i7.i62, %cond.true.i6.i61 ], [ %conv3.i11.i69, %cond.false.i9.i67 ]
%cmp.i66 = icmp sgt i32 %cond.i8.i65, 47
br i1 %cmp.i66, label %do.body.i52, label %in.exit73, !llvm.loop !17
in.exit73: ; preds = %getchar_unlocked.exit12.i64
%_IO_read_ptr.i.i74 = getelementptr inbounds %struct._IO_FILE, ptr %22, i64 0, i32 1
%24 = load ptr, ptr %_IO_read_ptr.i.i74, align 8, !tbaa !9
%_IO_read_end.i.i75 = getelementptr inbounds %struct._IO_FILE, ptr %22, i64 0, i32 2
%25 = load ptr, ptr %_IO_read_end.i.i75, align 8, !tbaa !14
%cmp.not.i.i76 = icmp ult ptr %24, %25
br i1 %cmp.not.i.i76, label %cond.false.i.i101, label %cond.true.i.i77, !prof !15
cond.true.i.i77: ; preds = %in.exit73
%call.i.i78 = tail call i32 @__uflow(ptr noundef nonnull %22) #4
%.pre13.pre.i79 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i83.preheader
cond.false.i.i101: ; preds = %in.exit73
%incdec.ptr.i.i102 = getelementptr inbounds i8, ptr %24, i64 1
store ptr %incdec.ptr.i.i102, ptr %_IO_read_ptr.i.i74, align 8, !tbaa !9
%26 = load i8, ptr %24, align 1, !tbaa !16
%conv3.i.i103 = zext i8 %26 to i32
br label %do.body.i83.preheader
do.body.i83.preheader: ; preds = %cond.false.i.i101, %cond.true.i.i77
%.ph121 = phi ptr [ %22, %cond.false.i.i101 ], [ %.pre13.pre.i79, %cond.true.i.i77 ]
%c.0.i85.ph = phi i32 [ %conv3.i.i103, %cond.false.i.i101 ], [ %call.i.i78, %cond.true.i.i77 ]
br label %do.body.i83
do.body.i83: ; preds = %do.body.i83.preheader, %getchar_unlocked.exit12.i95
%27 = phi ptr [ %32, %getchar_unlocked.exit12.i95 ], [ %.ph121, %do.body.i83.preheader ]
%28 = phi ptr [ %33, %getchar_unlocked.exit12.i95 ], [ %.ph121, %do.body.i83.preheader ]
%n.0.i84 = phi i32 [ %add.i88, %getchar_unlocked.exit12.i95 ], [ 0, %do.body.i83.preheader ]
%c.0.i85 = phi i32 [ %cond.i8.i96, %getchar_unlocked.exit12.i95 ], [ %c.0.i85.ph, %do.body.i83.preheader ]
%mul.i86 = mul nsw i32 %n.0.i84, 10
%and.i87 = and i32 %c.0.i85, 15
%add.i88 = add nsw i32 %and.i87, %mul.i86
%_IO_read_ptr.i3.i89 = getelementptr inbounds %struct._IO_FILE, ptr %28, i64 0, i32 1
%29 = load ptr, ptr %_IO_read_ptr.i3.i89, align 8, !tbaa !9
%_IO_read_end.i4.i90 = getelementptr inbounds %struct._IO_FILE, ptr %28, i64 0, i32 2
%30 = load ptr, ptr %_IO_read_end.i4.i90, align 8, !tbaa !14
%cmp.not.i5.i91 = icmp ult ptr %29, %30
br i1 %cmp.not.i5.i91, label %cond.false.i9.i98, label %cond.true.i6.i92, !prof !15
cond.true.i6.i92: ; preds = %do.body.i83
%call.i7.i93 = tail call i32 @__uflow(ptr noundef nonnull %28) #4
%.pre.i94 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit12.i95
cond.false.i9.i98: ; preds = %do.body.i83
%incdec.ptr.i10.i99 = getelementptr inbounds i8, ptr %29, i64 1
store ptr %incdec.ptr.i10.i99, ptr %_IO_read_ptr.i3.i89, align 8, !tbaa !9
%31 = load i8, ptr %29, align 1, !tbaa !16
%conv3.i11.i100 = zext i8 %31 to i32
br label %getchar_unlocked.exit12.i95
getchar_unlocked.exit12.i95: ; preds = %cond.false.i9.i98, %cond.true.i6.i92
%32 = phi ptr [ %.pre.i94, %cond.true.i6.i92 ], [ %27, %cond.false.i9.i98 ]
%33 = phi ptr [ %.pre.i94, %cond.true.i6.i92 ], [ %28, %cond.false.i9.i98 ]
%cond.i8.i96 = phi i32 [ %call.i7.i93, %cond.true.i6.i92 ], [ %conv3.i11.i100, %cond.false.i9.i98 ]
%cmp.i97 = icmp sgt i32 %cond.i8.i96, 47
br i1 %cmp.i97, label %do.body.i83, label %in.exit104, !llvm.loop !17
in.exit104: ; preds = %getchar_unlocked.exit12.i95
%idxprom = sext i32 %add.i57 to i64
%arrayidx = getelementptr inbounds [100005 x i8], ptr @R, i64 0, i64 %idxprom
%34 = load i8, ptr %arrayidx, align 1, !tbaa !16
%tobool3.not = icmp eq i8 %34, 0
br i1 %tobool3.not, label %if.end, label %if.then
if.then: ; preds = %in.exit104
%call4 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str)
br label %cleanup
if.end: ; preds = %in.exit104
store i8 1, ptr %arrayidx, align 1, !tbaa !16
%idxprom7 = sext i32 %add.i88 to i64
%arrayidx8 = getelementptr inbounds [100005 x i8], ptr @C, i64 0, i64 %idxprom7
%35 = load i8, ptr %arrayidx8, align 1, !tbaa !16
%tobool9.not = icmp eq i8 %35, 0
br i1 %tobool9.not, label %if.end12, label %if.then10
if.then10: ; preds = %if.end
%call11 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str)
br label %cleanup
if.end12: ; preds = %if.end
store i8 1, ptr %arrayidx8, align 1, !tbaa !16
%cmp.not = icmp eq i32 %add.i57, %add.i88
br i1 %cmp.not, label %if.end18, label %if.then15
if.then15: ; preds = %if.end12
%arrayidx17 = getelementptr inbounds [100005 x i32], ptr @rel, i64 0, i64 %idxprom
store i32 %add.i88, ptr %arrayidx17, align 4, !tbaa !19
br label %if.end18
if.end18: ; preds = %if.then15, %if.end12
%tobool.not = icmp eq i32 %dec109, 0
br i1 %tobool.not, label %for.cond.preheader, label %while.body, !llvm.loop !20
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%ans.0112 = phi i32 [ 0, %for.body.preheader ], [ %ans.1, %for.inc ]
%arrayidx21 = getelementptr inbounds [100005 x i32], ptr @rel, i64 0, i64 %indvars.iv
%36 = load i32, ptr %arrayidx21, align 4, !tbaa !19
%tobool22.not = icmp eq i32 %36, 0
br i1 %tobool22.not, label %for.inc, label %if.end.i
if.end.i: ; preds = %for.body, %if.end.i
%37 = phi i32 [ %38, %if.end.i ], [ %36, %for.body ]
%arrayidx10.i = phi ptr [ %arrayidx.i, %if.end.i ], [ %arrayidx21, %for.body ]
%n.tr9.i = phi i32 [ %add.i105, %if.end.i ], [ 0, %for.body ]
store i32 0, ptr %arrayidx10.i, align 4, !tbaa !19
%add.i105 = add nuw nsw i32 %n.tr9.i, 1
%idxprom.i = sext i32 %37 to i64
%arrayidx.i = getelementptr inbounds [100005 x i32], ptr @rel, i64 0, i64 %idxprom.i
%38 = load i32, ptr %arrayidx.i, align 4, !tbaa !19
%cmp.i106 = icmp eq i32 %38, 0
br i1 %cmp.i106, label %dfs.exit, label %if.end.i
dfs.exit: ; preds = %if.end.i
%add = add nsw i32 %n.tr9.i, %ans.0112
br label %for.inc
for.inc: ; preds = %for.body, %dfs.exit
%ans.1 = phi i32 [ %add, %dfs.exit ], [ %ans.0112, %for.body ]
%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 !21
for.end: ; preds = %for.inc, %while.cond.preheader, %for.cond.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ 0, %while.cond.preheader ], [ %ans.1, %for.inc ]
%call26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
br label %cleanup
cleanup: ; preds = %for.end, %if.then10, %if.then
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
declare i32 @__uflow(ptr noundef) local_unnamed_addr #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 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 #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = !{!11, !11, i64 0}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !18}
|
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
// 内部定数
#define D_VTX_MAX 50 // 最大座標数
// 内部構造体 - 頂点情報
typedef struct Vtx {
int miX; // 座標Ⅹ
int miY; // 座標Y
} Vtx;
// 内部変数
static Vtx sz1Vtx[D_VTX_MAX]; // 頂点情報
static int siVCnt; // 頂点情報数
static int siNCnt; // 必要頂点数
static long long slMin; // 最小面積
// 内部変数 - テスト用
#ifdef D_TEST
static int siRes;
static FILE *szpFpT, *szpFpA;
#endif
// ソート関数 - X座標昇順
int
fSortFncX(
const void *pzpVal1 // <I> 値1
, const void *pzpVal2 // <I> 値2
)
{
Vtx *lzpVal1 = (Vtx *)pzpVal1;
Vtx *lzpVal2 = (Vtx *)pzpVal2;
// X座標昇順
if (lzpVal1->miX > lzpVal2->miX) {
return(1);
}
else if (lzpVal1->miX < lzpVal2->miX) {
return(-1);
}
return 0;
}
// ソート関数 - int昇順
int
fSortFncI(
const void *pzpVal1 // <I> 値1
, const void *pzpVal2 // <I> 値2
)
{
int *lipVal1 = (int *)pzpVal1;
int *lipVal2 = (int *)pzpVal2;
// 昇順
if (*lipVal1 > *lipVal2) {
return(1);
}
else if (*lipVal1 < *lipVal2) {
return(-1);
}
return 0;
}
// 実行メイン
int
fMain(
int piTNo // <I> テスト番号 1~
)
{
int i, j, k;
char lc1Buf[1024], lc1Out[1024];
// データ初期化
slMin = LLONG_MAX; // 最小面積
// テストファイルオープン
#ifdef D_TEST
sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
szpFpT = fopen(lc1Buf, "r");
sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
szpFpA = fopen(lc1Buf, "r");
siRes = 0;
#endif
// 頂点情報数・必要頂点数取得
#ifdef D_TEST
fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
sscanf(lc1Buf, "%d%d", &siVCnt, &siNCnt);
// 頂点情報取得
for (i = 0; i < siVCnt; i++) {
#ifdef D_TEST
fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
sscanf(lc1Buf, "%d%d", &sz1Vtx[i].miX, &sz1Vtx[i].miY);
}
// X座標でソート
qsort(sz1Vtx, siVCnt, sizeof(Vtx), fSortFncX);
// X座標範囲
for (i = 0; i < siVCnt - siNCnt + 1; i++) {
for (j = i + siNCnt - 1; j < siVCnt; j++) {
// Y座標リスト
int liYCnt = j - i + 1;
int li1Y[D_VTX_MAX];
for (k = 0; k < liYCnt; k++) {
li1Y[k] = sz1Vtx[i + k].miY;
}
// Y座標でソート
qsort(li1Y, liYCnt, sizeof(int), fSortFncI);
// Y座標範囲
for (k = 0; k < liYCnt - siNCnt + 1; k++) {
// 面積
long long llArea = (long long)(sz1Vtx[j].miX - sz1Vtx[i].miX) * (long long)(li1Y[k + siNCnt - 1] - li1Y[k]);
if (slMin > llArea) {
slMin = llArea;
}
}
}
}
// 結果セット
sprintf(lc1Out, "%lld\n", slMin);
// 結果表示
#ifdef D_TEST
fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
if (strcmp(lc1Buf, lc1Out)) {
siRes = -1;
}
#else
printf("%s", lc1Out);
#endif
// テストファイルクローズ
#ifdef D_TEST
fclose(szpFpT);
fclose(szpFpA);
#endif
// テスト結果
#ifdef D_TEST
if (siRes == 0) {
printf("OK %d\n", piTNo);
}
else {
printf("NG %d\n", piTNo);
}
#endif
return 0;
}
int
main()
{
#ifdef D_TEST
int i;
for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
fMain(i);
}
#else
fMain(0);
#endif
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142426/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142426/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.Vtx = type { i32, i32 }
@slMin = internal unnamed_addr global i64 0, align 8
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@siVCnt = internal global i32 0, align 4
@siNCnt = internal global i32 0, align 4
@sz1Vtx = internal global [50 x %struct.Vtx] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @fSortFncX(ptr nocapture noundef readonly %pzpVal1, ptr nocapture noundef readonly %pzpVal2) #0 {
entry:
%0 = load i32, ptr %pzpVal1, align 4, !tbaa !5
%1 = load i32, ptr %pzpVal2, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%cmp4 = icmp slt i32 %0, %1
%. = sext i1 %cmp4 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.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 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(argmem: read) uwtable
define dso_local i32 @fSortFncI(ptr nocapture noundef readonly %pzpVal1, ptr nocapture noundef readonly %pzpVal2) #0 {
entry:
%0 = load i32, ptr %pzpVal1, align 4, !tbaa !10
%1 = load i32, ptr %pzpVal2, align 4, !tbaa !10
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp slt i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @fMain(i32 %piTNo) local_unnamed_addr #2 {
entry:
%lc1Buf = alloca [1024 x i8], align 16
%lc1Out = alloca [1024 x i8], align 16
%li1Y = alloca [50 x i32], align 16
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Buf) #5
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Out) #5
store i64 9223372036854775807, ptr @slMin, align 8, !tbaa !11
%0 = load ptr, ptr @stdin, align 8, !tbaa !13
%call = call ptr @fgets(ptr noundef nonnull %lc1Buf, i32 noundef 1024, ptr noundef %0)
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %lc1Buf, ptr noundef nonnull @.str, ptr noundef nonnull @siVCnt, ptr noundef nonnull @siNCnt) #5
%1 = load i32, ptr @siVCnt, align 4, !tbaa !10
%cmp95 = icmp sgt i32 %1, 0
br i1 %cmp95, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %1 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%2 = load ptr, ptr @stdin, align 8, !tbaa !13
%call4 = call ptr @fgets(ptr noundef nonnull %lc1Buf, i32 noundef 1024, ptr noundef %2)
%arrayidx = getelementptr inbounds [50 x %struct.Vtx], ptr @sz1Vtx, i64 0, i64 %indvars.iv
%miY = getelementptr inbounds [50 x %struct.Vtx], ptr @sz1Vtx, i64 0, i64 %indvars.iv, i32 1
%call8 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %lc1Buf, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %miY) #5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr @siVCnt, align 4, !tbaa !10
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !15
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %4, %for.body ]
call void @qsort(ptr noundef nonnull @sz1Vtx, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @fSortFncX) #5
%5 = load i32, ptr @siVCnt, align 4, !tbaa !10
%6 = load i32, ptr @siNCnt, align 4, !tbaa !10
%cmp10.not107 = icmp slt i32 %5, %6
br i1 %cmp10.not107, label %for.end68, label %for.body12
for.body12: ; preds = %for.end, %for.inc66
%7 = phi i32 [ %47, %for.inc66 ], [ %6, %for.end ]
%8 = phi i32 [ %48, %for.inc66 ], [ %5, %for.end ]
%indvars.iv132 = phi i64 [ %indvars.iv.next133, %for.inc66 ], [ 0, %for.end ]
%indvars.iv125 = phi i32 [ %indvars.iv.next126, %for.inc66 ], [ -1, %for.end ]
%indvars135 = trunc i64 %indvars.iv132 to i32
%add13 = add nsw i32 %indvars135, -1
%sub14 = add i32 %add13, %7
%cmp16104 = icmp slt i32 %sub14, %8
br i1 %cmp16104, label %for.body18.lr.ph, label %for.inc66
for.body18.lr.ph: ; preds = %for.body12
%arrayidx46 = getelementptr inbounds [50 x %struct.Vtx], ptr @sz1Vtx, i64 0, i64 %indvars.iv132
%9 = add i32 %7, %indvars.iv125
%10 = sext i32 %9 to i64
br label %for.body18
for.body18: ; preds = %for.body18.lr.ph, %for.end62
%indvars.iv127 = phi i64 [ %10, %for.body18.lr.ph ], [ %indvars.iv.next128, %for.end62 ]
%indvars.iv121.in = phi i32 [ %7, %for.body18.lr.ph ], [ %indvars.iv121, %for.end62 ]
%indvars.iv115 = phi i32 [ %7, %for.body18.lr.ph ], [ %indvars.iv.next116, %for.end62 ]
%11 = zext i32 %indvars.iv115 to i64
%indvars.iv121 = add i32 %indvars.iv121.in, 1
%indvars131 = trunc i64 %indvars.iv127 to i32
%12 = sub nsw i64 %indvars.iv127, %indvars.iv132
%13 = add nsw i64 %12, 1
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %li1Y) #5
%cmp22.not97 = icmp slt i64 %12, 0
br i1 %cmp22.not97, label %for.end33, label %for.body24.preheader
for.body24.preheader: ; preds = %for.body18
%wide.trip.count = zext i32 %indvars.iv115 to i64
%min.iters.check = icmp ult i32 %indvars.iv115, 9
br i1 %min.iters.check, label %for.body24.preheader142, label %vector.ph
vector.ph: ; preds = %for.body24.preheader
%n.mod.vf = and i64 %11, 7
%14 = icmp eq i64 %n.mod.vf, 0
%15 = select i1 %14, i64 8, i64 %n.mod.vf
%n.vec = sub nsw i64 %11, %15
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%16 = or i64 %index, 4
%17 = add nuw nsw i64 %index, %indvars.iv132
%18 = add nuw nsw i64 %16, %indvars.iv132
%19 = getelementptr inbounds [50 x %struct.Vtx], ptr @sz1Vtx, i64 0, i64 %17, i32 1
%20 = getelementptr inbounds [50 x %struct.Vtx], ptr @sz1Vtx, i64 0, i64 %18, i32 1
%wide.vec = load <8 x i32>, ptr %19, align 4, !tbaa !17
%wide.vec140 = load <8 x i32>, ptr %20, align 4, !tbaa !17
%strided.vec = shufflevector <8 x i32> %wide.vec, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
%strided.vec141 = shufflevector <8 x i32> %wide.vec140, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
%21 = getelementptr inbounds [50 x i32], ptr %li1Y, i64 0, i64 %index
store <4 x i32> %strided.vec, ptr %21, align 16, !tbaa !10
%22 = getelementptr inbounds i32, ptr %21, i64 4
store <4 x i32> %strided.vec141, ptr %22, align 16, !tbaa !10
%index.next = add nuw i64 %index, 8
%23 = icmp eq i64 %index.next, %n.vec
br i1 %23, label %for.body24.preheader142, label %vector.body, !llvm.loop !18
for.body24.preheader142: ; preds = %vector.body, %for.body24.preheader
%indvars.iv111.ph = phi i64 [ 0, %for.body24.preheader ], [ %n.vec, %vector.body ]
br label %for.body24
for.body24: ; preds = %for.body24.preheader142, %for.body24
%indvars.iv111 = phi i64 [ %indvars.iv.next112, %for.body24 ], [ %indvars.iv111.ph, %for.body24.preheader142 ]
%24 = add nuw nsw i64 %indvars.iv111, %indvars.iv132
%miY28 = getelementptr inbounds [50 x %struct.Vtx], ptr @sz1Vtx, i64 0, i64 %24, i32 1
%25 = load i32, ptr %miY28, align 4, !tbaa !17
%arrayidx30 = getelementptr inbounds [50 x i32], ptr %li1Y, i64 0, i64 %indvars.iv111
store i32 %25, ptr %arrayidx30, align 4, !tbaa !10
%indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
%exitcond.not = icmp eq i64 %indvars.iv.next112, %wide.trip.count
br i1 %exitcond.not, label %for.end33, label %for.body24, !llvm.loop !21
for.end33: ; preds = %for.body24, %for.body18
call void @qsort(ptr noundef nonnull %li1Y, i64 noundef %13, i64 noundef 4, ptr noundef nonnull @fSortFncI) #5
%26 = load i32, ptr @siNCnt, align 4, !tbaa !10
%27 = add i32 %indvars131, 1
%28 = add i32 %26, %indvars135
%sub37 = sub i32 %27, %28
%cmp39.not101 = icmp slt i32 %sub37, 0
br i1 %cmp39.not101, label %for.end62, label %for.body41.lr.ph
for.body41.lr.ph: ; preds = %for.end33
%slMin.promoted = load i64, ptr @slMin, align 8, !tbaa !11
%arrayidx43 = getelementptr inbounds [50 x %struct.Vtx], ptr @sz1Vtx, i64 0, i64 %indvars.iv127
%29 = load i32, ptr %arrayidx43, align 8, !tbaa !5
%30 = load i32, ptr %arrayidx46, align 8, !tbaa !5
%sub48 = sub nsw i32 %29, %30
%conv49 = sext i32 %sub48 to i64
%31 = sub i32 %indvars.iv121, %26
%wide.trip.count123 = zext i32 %31 to i64
%xtraiter = and i64 %wide.trip.count123, 1
%32 = icmp eq i32 %31, 1
br i1 %32, label %for.end62.loopexit.unr-lcssa, label %for.body41.lr.ph.new
for.body41.lr.ph.new: ; preds = %for.body41.lr.ph
%unroll_iter = and i64 %wide.trip.count123, 4294967294
br label %for.body41
for.body41: ; preds = %if.end.1, %for.body41.lr.ph.new
%indvars.iv117 = phi i64 [ 0, %for.body41.lr.ph.new ], [ %indvars.iv.next118.1, %if.end.1 ]
%mul100102 = phi i64 [ %slMin.promoted, %for.body41.lr.ph.new ], [ %mul99.1, %if.end.1 ]
%niter = phi i64 [ 0, %for.body41.lr.ph.new ], [ %niter.next.1, %if.end.1 ]
%33 = trunc i64 %indvars.iv117 to i32
%34 = add i32 %33, -1
%sub51 = add i32 %34, %26
%idxprom52 = sext i32 %sub51 to i64
%arrayidx53 = getelementptr inbounds [50 x i32], ptr %li1Y, i64 0, i64 %idxprom52
%35 = load i32, ptr %arrayidx53, align 4, !tbaa !10
%arrayidx55 = getelementptr inbounds [50 x i32], ptr %li1Y, i64 0, i64 %indvars.iv117
%36 = load i32, ptr %arrayidx55, align 8, !tbaa !10
%sub56 = sub nsw i32 %35, %36
%conv57 = sext i32 %sub56 to i64
%mul = mul nsw i64 %conv57, %conv49
%cmp58 = icmp sgt i64 %mul100102, %mul
br i1 %cmp58, label %if.then, label %if.end
if.then: ; preds = %for.body41
store i64 %mul, ptr @slMin, align 8, !tbaa !11
br label %if.end
if.end: ; preds = %if.then, %for.body41
%mul99 = phi i64 [ %mul, %if.then ], [ %mul100102, %for.body41 ]
%indvars.iv.next118 = or i64 %indvars.iv117, 1
%37 = trunc i64 %indvars.iv.next118 to i32
%38 = add nsw i32 %37, -1
%sub51.1 = add i32 %38, %26
%idxprom52.1 = sext i32 %sub51.1 to i64
%arrayidx53.1 = getelementptr inbounds [50 x i32], ptr %li1Y, i64 0, i64 %idxprom52.1
%39 = load i32, ptr %arrayidx53.1, align 4, !tbaa !10
%arrayidx55.1 = getelementptr inbounds [50 x i32], ptr %li1Y, i64 0, i64 %indvars.iv.next118
%40 = load i32, ptr %arrayidx55.1, align 4, !tbaa !10
%sub56.1 = sub nsw i32 %39, %40
%conv57.1 = sext i32 %sub56.1 to i64
%mul.1 = mul nsw i64 %conv57.1, %conv49
%cmp58.1 = icmp sgt i64 %mul99, %mul.1
br i1 %cmp58.1, label %if.then.1, label %if.end.1
if.then.1: ; preds = %if.end
store i64 %mul.1, ptr @slMin, align 8, !tbaa !11
br label %if.end.1
if.end.1: ; preds = %if.then.1, %if.end
%mul99.1 = phi i64 [ %mul.1, %if.then.1 ], [ %mul99, %if.end ]
%indvars.iv.next118.1 = add nuw nsw i64 %indvars.iv117, 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.end62.loopexit.unr-lcssa, label %for.body41, !llvm.loop !22
for.end62.loopexit.unr-lcssa: ; preds = %if.end.1, %for.body41.lr.ph
%indvars.iv117.unr = phi i64 [ 0, %for.body41.lr.ph ], [ %indvars.iv.next118.1, %if.end.1 ]
%mul100102.unr = phi i64 [ %slMin.promoted, %for.body41.lr.ph ], [ %mul99.1, %if.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end62, label %for.body41.epil
for.body41.epil: ; preds = %for.end62.loopexit.unr-lcssa
%41 = trunc i64 %indvars.iv117.unr to i32
%42 = add i32 %41, -1
%sub51.epil = add i32 %42, %26
%idxprom52.epil = sext i32 %sub51.epil to i64
%arrayidx53.epil = getelementptr inbounds [50 x i32], ptr %li1Y, i64 0, i64 %idxprom52.epil
%43 = load i32, ptr %arrayidx53.epil, align 4, !tbaa !10
%arrayidx55.epil = getelementptr inbounds [50 x i32], ptr %li1Y, i64 0, i64 %indvars.iv117.unr
%44 = load i32, ptr %arrayidx55.epil, align 4, !tbaa !10
%sub56.epil = sub nsw i32 %43, %44
%conv57.epil = sext i32 %sub56.epil to i64
%mul.epil = mul nsw i64 %conv57.epil, %conv49
%cmp58.epil = icmp sgt i64 %mul100102.unr, %mul.epil
br i1 %cmp58.epil, label %if.then.epil, label %for.end62
if.then.epil: ; preds = %for.body41.epil
store i64 %mul.epil, ptr @slMin, align 8, !tbaa !11
br label %for.end62
for.end62: ; preds = %for.end62.loopexit.unr-lcssa, %if.then.epil, %for.body41.epil, %for.end33
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %li1Y) #5
%indvars.iv.next128 = add nsw i64 %indvars.iv127, 1
%45 = load i32, ptr @siVCnt, align 4, !tbaa !10
%46 = sext i32 %45 to i64
%cmp16 = icmp slt i64 %indvars.iv.next128, %46
%indvars.iv.next116 = add i32 %indvars.iv115, 1
br i1 %cmp16, label %for.body18, label %for.inc66, !llvm.loop !23
for.inc66: ; preds = %for.end62, %for.body12
%47 = phi i32 [ %7, %for.body12 ], [ %26, %for.end62 ]
%48 = phi i32 [ %8, %for.body12 ], [ %45, %for.end62 ]
%indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
%sub = sub nsw i32 %48, %47
%49 = sext i32 %sub to i64
%cmp10.not.not = icmp slt i64 %indvars.iv132, %49
%indvars.iv.next126 = add nsw i32 %indvars.iv125, 1
br i1 %cmp10.not.not, label %for.body12, label %for.end68, !llvm.loop !24
for.end68: ; preds = %for.inc66, %for.end
%50 = load i64, ptr @slMin, align 8, !tbaa !11
%call70 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %lc1Out, ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %50) #5
%call72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %lc1Out)
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Out) #5
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Buf) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; 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 @sprintf(ptr noalias nocapture noundef writeonly, 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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%call = tail call i32 @fMain(i32 poison)
ret i32 0
}
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 = { 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 = { 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, !7, i64 0}
!6 = !{!"Vtx", !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 = !{!12, !12, i64 0}
!12 = !{!"long long", !8, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !8, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!6, !7, i64 4}
!18 = distinct !{!18, !16, !19, !20}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !16, !20, !19}
!22 = distinct !{!22, !16}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !16}
|
#include<stdio.h>
#include<stdlib.h>
void initBIT(int *b){
const int n=b[0];
for(int i=1;i<=n;i++) b[i]=0;
}
void add(int *bit,int x,int v){
const int n=bit[0];
for(int i=x;i<=n;i+=i&-i) bit[i]+=v;
}
int sum(int *bit,int x){
int res=0;
for(int i=x;i>0;i-=i&-i) res+=bit[i];
return res;
}
void run(void){
int n;
scanf("%d",&n);
int *b=(int *)calloc(n+1,sizeof(int));
int *w=(int *)calloc(n+1,sizeof(int));
int i,j;
for(i=0;i<2*n;i++){
char s[10];
int k;
scanf("%s%d",s,&k);
if(s[0]=='B'){
b[k]=i+1;
} else {
w[k]=i+1;
}
}
int *dp=(int *)calloc(2*(n+1),sizeof(int));
int *bit=(int *)calloc(2*n+1,sizeof(int));
bit[0]=2*n;
dp[0]=0;
for(i=1;i<=n;i++){
add(bit,w[i],1);
dp[i]=dp[i-1]+(i-sum(bit,w[i]));
}
int now=0;
for(i=1;i<=n;i++){
initBIT(bit);
int inv=0;
for(j=1;j<=i;j++){
add(bit,b[j],1);
inv+=j-sum(bit,b[j]);
}
int next=now^(n+1);
dp[next]=inv;
for(j=1;j<=n;j++){
add(bit,w[j],1);
int p=dp[next+j-1]+(i+j-sum(bit,w[j]));
int q=dp[now+j]+(i+j-sum(bit,b[i]));
dp[next+j]=p<q?p:q;
}
now=next;
}
printf("%d\n",dp[now+n]);
return;
}
int main(void){
run();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142499/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142499/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"%s%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @initBIT(ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%cmp.not5 = icmp slt i32 %0, 1
br i1 %cmp.not5, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%scevgep = getelementptr i8, ptr %b, i64 4
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr align 4 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body.preheader, %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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @add(ptr nocapture noundef %bit, i32 noundef %x, i32 noundef %v) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %bit, align 4, !tbaa !5
%cmp.not8 = icmp slt i32 %0, %x
br i1 %cmp.not8, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret void
for.body: ; preds = %entry, %for.body
%i.09 = phi i32 [ %add2, %for.body ], [ %x, %entry ]
%idxprom = sext i32 %i.09 to i64
%arrayidx1 = getelementptr inbounds i32, ptr %bit, i64 %idxprom
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%add = add nsw i32 %1, %v
store i32 %add, ptr %arrayidx1, align 4, !tbaa !5
%sub = sub nsw i32 0, %i.09
%and = and i32 %i.09, %sub
%add2 = add nsw i32 %and, %i.09
%cmp.not = icmp sgt i32 %add2, %0
br i1 %cmp.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @sum(ptr nocapture noundef readonly %bit, i32 noundef %x) local_unnamed_addr #3 {
entry:
%cmp7 = icmp sgt i32 %x, 0
br i1 %cmp7, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%res.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
ret i32 %res.0.lcssa
for.body: ; preds = %entry, %for.body
%i.09 = phi i32 [ %sub1, %for.body ], [ %x, %entry ]
%res.08 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%idxprom = zext i32 %i.09 to i64
%arrayidx = getelementptr inbounds i32, ptr %bit, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %0, %res.08
%sub.not = add nsw i32 %i.09, -1
%sub1 = and i32 %sub.not, %i.09
%cmp.not = icmp eq i32 %sub1, 0
br i1 %cmp.not, label %for.cond.cleanup, label %for.body, !llvm.loop !11
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
%s = alloca [10 x i8], align 1
%k = 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, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%conv = sext i32 %add to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #10
%call4 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #10
%mul227 = shl nsw i32 %0, 1
%cmp228 = icmp sgt i32 %0, 0
br i1 %cmp228, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.0229 = phi i32 [ %add10, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %s) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #9
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s, ptr noundef nonnull %k)
%1 = load i8, ptr %s, align 1, !tbaa !12
%cmp8 = icmp eq i8 %1, 66
%add10 = add nuw nsw i32 %i.0229, 1
%2 = load i32, ptr %k, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%call1.call4 = select i1 %cmp8, ptr %call1, ptr %call4
%arrayidx14 = getelementptr inbounds i32, ptr %call1.call4, i64 %idxprom
store i32 %add10, ptr %arrayidx14, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #9
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %s) #9
%3 = load i32, ptr %n, align 4, !tbaa !5
%mul = shl nsw i32 %3, 1
%cmp = icmp slt i32 %add10, %mul
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %3, %for.body ]
%mul.lcssa = phi i32 [ %mul227, %entry ], [ %mul, %for.body ]
%mul16 = add i32 %mul.lcssa, 2
%conv17 = sext i32 %mul16 to i64
%call18 = call noalias ptr @calloc(i64 noundef %conv17, i64 noundef 4) #10
%add20 = or i32 %mul.lcssa, 1
%conv21 = sext i32 %add20 to i64
%call22 = call noalias ptr @calloc(i64 noundef %conv21, i64 noundef 4) #10
store i32 %mul.lcssa, ptr %call22, align 4, !tbaa !5
%cmp27.not231 = icmp slt i32 %.lcssa, 1
br i1 %cmp27.not231, label %for.end100, label %for.body29.preheader
for.body29.preheader: ; preds = %for.end
%4 = add nuw i32 %.lcssa, 1
%wide.trip.count = zext i32 %4 to i64
br label %for.body29
for.cond44.preheader: ; preds = %sum.exit
br i1 %cmp27.not231, label %for.end100, label %for.body47.lr.ph
for.body47.lr.ph: ; preds = %for.cond44.preheader
%scevgep.i = getelementptr i8, ptr %call22, i64 4
%add62 = add nuw i32 %.lcssa, 1
%wide.trip.count268 = zext i32 %add62 to i64
%invariant.gep = getelementptr i32, ptr %call18, i64 -1
br label %for.body47
for.body29: ; preds = %for.body29.preheader, %sum.exit
%5 = phi i32 [ 0, %for.body29.preheader ], [ %add38, %sum.exit ]
%indvars.iv = phi i64 [ 1, %for.body29.preheader ], [ %indvars.iv.next, %sum.exit ]
%arrayidx31 = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv
%6 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%7 = load i32, ptr %call22, align 4, !tbaa !5
%cmp.not8.i = icmp slt i32 %7, %6
br i1 %cmp.not8.i, label %add.exit, label %for.body.i
for.body.i: ; preds = %for.body29, %for.body.i
%i.09.i = phi i32 [ %add2.i, %for.body.i ], [ %6, %for.body29 ]
%idxprom.i = sext i32 %i.09.i to i64
%arrayidx1.i = getelementptr inbounds i32, ptr %call22, i64 %idxprom.i
%8 = load i32, ptr %arrayidx1.i, align 4, !tbaa !5
%add.i = add nsw i32 %8, 1
store i32 %add.i, ptr %arrayidx1.i, align 4, !tbaa !5
%sub.i = sub nsw i32 0, %i.09.i
%and.i = and i32 %i.09.i, %sub.i
%add2.i = add nsw i32 %and.i, %i.09.i
%cmp.not.i = icmp sgt i32 %add2.i, %7
br i1 %cmp.not.i, label %add.exit, label %for.body.i, !llvm.loop !9
add.exit: ; preds = %for.body.i, %for.body29
%cmp7.i = icmp sgt i32 %6, 0
br i1 %cmp7.i, label %for.body.i164, label %sum.exit
for.body.i164: ; preds = %add.exit, %for.body.i164
%i.09.i165 = phi i32 [ %sub1.i, %for.body.i164 ], [ %6, %add.exit ]
%res.08.i = phi i32 [ %add.i167, %for.body.i164 ], [ 0, %add.exit ]
%idxprom.i166 = zext i32 %i.09.i165 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %call22, i64 %idxprom.i166
%9 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%add.i167 = add nsw i32 %9, %res.08.i
%sub.not.i = add nsw i32 %i.09.i165, -1
%sub1.i = and i32 %sub.not.i, %i.09.i165
%cmp.not.i168 = icmp eq i32 %sub1.i, 0
br i1 %cmp.not.i168, label %sum.exit, label %for.body.i164, !llvm.loop !11
sum.exit: ; preds = %for.body.i164, %add.exit
%res.0.lcssa.i = phi i32 [ 0, %add.exit ], [ %add.i167, %for.body.i164 ]
%10 = trunc i64 %indvars.iv to i32
%sub37 = add i32 %5, %10
%add38 = sub i32 %sub37, %res.0.lcssa.i
%arrayidx40 = getelementptr inbounds i32, ptr %call18, i64 %indvars.iv
store i32 %add38, ptr %arrayidx40, 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.cond44.preheader, label %for.body29, !llvm.loop !14
for.body47: ; preds = %for.body47.lr.ph, %for.cond65.for.end97_crit_edge
%indvars.iv263 = phi i64 [ 1, %for.body47.lr.ph ], [ %indvars.iv.next264, %for.cond65.for.end97_crit_edge ]
%indvars.iv261 = phi i64 [ 2, %for.body47.lr.ph ], [ %indvars.iv.next262, %for.cond65.for.end97_crit_edge ]
%now.0238 = phi i32 [ 0, %for.body47.lr.ph ], [ %xor, %for.cond65.for.end97_crit_edge ]
%11 = load i32, ptr %call22, align 4, !tbaa !5
%cmp.not5.i = icmp slt i32 %11, 1
br i1 %cmp.not5.i, label %for.body51.preheader, label %for.body.preheader.i
for.body.preheader.i: ; preds = %for.body47
%12 = zext i32 %11 to i64
%13 = shl nuw nsw i64 %12, 2
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.i, i8 0, i64 %13, i1 false), !tbaa !5
br label %for.body51.preheader
for.body51.preheader: ; preds = %for.body47, %for.body.preheader.i
br label %for.body51
for.body51: ; preds = %for.body51.preheader, %sum.exit191
%indvars.iv245 = phi i64 [ %indvars.iv.next246, %sum.exit191 ], [ 1, %for.body51.preheader ]
%inv.0233 = phi i32 [ %add58, %sum.exit191 ], [ 0, %for.body51.preheader ]
%arrayidx53 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv245
%14 = load i32, ptr %arrayidx53, align 4, !tbaa !5
%15 = load i32, ptr %call22, align 4, !tbaa !5
%cmp.not8.i169 = icmp slt i32 %15, %14
br i1 %cmp.not8.i169, label %add.exit179, label %for.body.i170
for.body.i170: ; preds = %for.body51, %for.body.i170
%i.09.i171 = phi i32 [ %add2.i177, %for.body.i170 ], [ %14, %for.body51 ]
%idxprom.i172 = sext i32 %i.09.i171 to i64
%arrayidx1.i173 = getelementptr inbounds i32, ptr %call22, i64 %idxprom.i172
%16 = load i32, ptr %arrayidx1.i173, align 4, !tbaa !5
%add.i174 = add nsw i32 %16, 1
store i32 %add.i174, ptr %arrayidx1.i173, align 4, !tbaa !5
%sub.i175 = sub nsw i32 0, %i.09.i171
%and.i176 = and i32 %i.09.i171, %sub.i175
%add2.i177 = add nsw i32 %and.i176, %i.09.i171
%cmp.not.i178 = icmp sgt i32 %add2.i177, %15
br i1 %cmp.not.i178, label %add.exit179, label %for.body.i170, !llvm.loop !9
add.exit179: ; preds = %for.body.i170, %for.body51
%cmp7.i180 = icmp sgt i32 %14, 0
br i1 %cmp7.i180, label %for.body.i182, label %sum.exit191
for.body.i182: ; preds = %add.exit179, %for.body.i182
%i.09.i183 = phi i32 [ %sub1.i189, %for.body.i182 ], [ %14, %add.exit179 ]
%res.08.i184 = phi i32 [ %add.i187, %for.body.i182 ], [ 0, %add.exit179 ]
%idxprom.i185 = zext i32 %i.09.i183 to i64
%arrayidx.i186 = getelementptr inbounds i32, ptr %call22, i64 %idxprom.i185
%17 = load i32, ptr %arrayidx.i186, align 4, !tbaa !5
%add.i187 = add nsw i32 %17, %res.08.i184
%sub.not.i188 = add nsw i32 %i.09.i183, -1
%sub1.i189 = and i32 %sub.not.i188, %i.09.i183
%cmp.not.i190 = icmp eq i32 %sub1.i189, 0
br i1 %cmp.not.i190, label %sum.exit191, label %for.body.i182, !llvm.loop !11
sum.exit191: ; preds = %for.body.i182, %add.exit179
%res.0.lcssa.i181 = phi i32 [ 0, %add.exit179 ], [ %add.i187, %for.body.i182 ]
%18 = trunc i64 %indvars.iv245 to i32
%sub57 = add i32 %inv.0233, %18
%add58 = sub i32 %sub57, %res.0.lcssa.i181
%indvars.iv.next246 = add nuw nsw i64 %indvars.iv245, 1
%exitcond251.not = icmp eq i64 %indvars.iv.next246, %indvars.iv261
br i1 %exitcond251.not, label %for.end61, label %for.body51, !llvm.loop !15
for.end61: ; preds = %sum.exit191
%xor = xor i32 %now.0238, %add62
%idxprom63 = sext i32 %xor to i64
%arrayidx64 = getelementptr inbounds i32, ptr %call18, i64 %idxprom63
store i32 %add58, ptr %arrayidx64, align 4, !tbaa !5
%arrayidx86 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv263
%19 = load i32, ptr %arrayidx86, align 4, !tbaa !5
%cmp7.i215 = icmp sgt i32 %19, 0
%20 = sext i32 %now.0238 to i64
%invariant.gep272 = getelementptr i32, ptr %call18, i64 %20
br label %for.body68
for.body68: ; preds = %for.end61, %sum.exit226
%indvars.iv252 = phi i64 [ 1, %for.end61 ], [ %indvars.iv.next253, %sum.exit226 ]
%arrayidx70 = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv252
%21 = load i32, ptr %arrayidx70, align 4, !tbaa !5
%22 = load i32, ptr %call22, align 4, !tbaa !5
%cmp.not8.i192 = icmp slt i32 %22, %21
br i1 %cmp.not8.i192, label %add.exit202, label %for.body.i193
for.body.i193: ; preds = %for.body68, %for.body.i193
%i.09.i194 = phi i32 [ %add2.i200, %for.body.i193 ], [ %21, %for.body68 ]
%idxprom.i195 = sext i32 %i.09.i194 to i64
%arrayidx1.i196 = getelementptr inbounds i32, ptr %call22, i64 %idxprom.i195
%23 = load i32, ptr %arrayidx1.i196, align 4, !tbaa !5
%add.i197 = add nsw i32 %23, 1
store i32 %add.i197, ptr %arrayidx1.i196, align 4, !tbaa !5
%sub.i198 = sub nsw i32 0, %i.09.i194
%and.i199 = and i32 %i.09.i194, %sub.i198
%add2.i200 = add nsw i32 %and.i199, %i.09.i194
%cmp.not.i201 = icmp sgt i32 %add2.i200, %22
br i1 %cmp.not.i201, label %add.exit202, label %for.body.i193, !llvm.loop !9
add.exit202: ; preds = %for.body.i193, %for.body68
%24 = add nsw i64 %indvars.iv252, %idxprom63
%gep = getelementptr i32, ptr %invariant.gep, i64 %24
%25 = load i32, ptr %gep, align 4, !tbaa !5
%26 = add nuw nsw i64 %indvars.iv252, %indvars.iv263
%cmp7.i203 = icmp sgt i32 %21, 0
br i1 %cmp7.i203, label %for.body.i205, label %sum.exit214
for.body.i205: ; preds = %add.exit202, %for.body.i205
%i.09.i206 = phi i32 [ %sub1.i212, %for.body.i205 ], [ %21, %add.exit202 ]
%res.08.i207 = phi i32 [ %add.i210, %for.body.i205 ], [ 0, %add.exit202 ]
%idxprom.i208 = zext i32 %i.09.i206 to i64
%arrayidx.i209 = getelementptr inbounds i32, ptr %call22, i64 %idxprom.i208
%27 = load i32, ptr %arrayidx.i209, align 4, !tbaa !5
%add.i210 = add nsw i32 %27, %res.08.i207
%sub.not.i211 = add nsw i32 %i.09.i206, -1
%sub1.i212 = and i32 %sub.not.i211, %i.09.i206
%cmp.not.i213 = icmp eq i32 %sub1.i212, 0
br i1 %cmp.not.i213, label %sum.exit214, label %for.body.i205, !llvm.loop !11
sum.exit214: ; preds = %for.body.i205, %add.exit202
%res.0.lcssa.i204 = phi i32 [ 0, %add.exit202 ], [ %add.i210, %for.body.i205 ]
%28 = trunc i64 %26 to i32
%sub79 = add i32 %25, %28
%add80 = sub i32 %sub79, %res.0.lcssa.i204
%gep273 = getelementptr i32, ptr %invariant.gep272, i64 %indvars.iv252
%29 = load i32, ptr %gep273, align 4, !tbaa !5
br i1 %cmp7.i215, label %for.body.i217, label %sum.exit226
for.body.i217: ; preds = %sum.exit214, %for.body.i217
%i.09.i218 = phi i32 [ %sub1.i224, %for.body.i217 ], [ %19, %sum.exit214 ]
%res.08.i219 = phi i32 [ %add.i222, %for.body.i217 ], [ 0, %sum.exit214 ]
%idxprom.i220 = zext i32 %i.09.i218 to i64
%arrayidx.i221 = getelementptr inbounds i32, ptr %call22, i64 %idxprom.i220
%30 = load i32, ptr %arrayidx.i221, align 4, !tbaa !5
%add.i222 = add nsw i32 %30, %res.08.i219
%sub.not.i223 = add nsw i32 %i.09.i218, -1
%sub1.i224 = and i32 %sub.not.i223, %i.09.i218
%cmp.not.i225 = icmp eq i32 %sub1.i224, 0
br i1 %cmp.not.i225, label %sum.exit226, label %for.body.i217, !llvm.loop !11
sum.exit226: ; preds = %for.body.i217, %sum.exit214
%res.0.lcssa.i216 = phi i32 [ 0, %sum.exit214 ], [ %add.i222, %for.body.i217 ]
%sub88 = add i32 %29, %28
%add89 = sub i32 %sub88, %res.0.lcssa.i216
%cond = call i32 @llvm.smin.i32(i32 %add80, i32 %add89)
%arrayidx94 = getelementptr inbounds i32, ptr %call18, i64 %24
store i32 %cond, ptr %arrayidx94, align 4, !tbaa !5
%indvars.iv.next253 = add nuw nsw i64 %indvars.iv252, 1
%exitcond260.not = icmp eq i64 %indvars.iv.next253, %wide.trip.count268
br i1 %exitcond260.not, label %for.cond65.for.end97_crit_edge, label %for.body68, !llvm.loop !16
for.cond65.for.end97_crit_edge: ; preds = %sum.exit226
%indvars.iv.next264 = add nuw nsw i64 %indvars.iv263, 1
%indvars.iv.next262 = add nuw nsw i64 %indvars.iv261, 1
%exitcond269.not = icmp eq i64 %indvars.iv.next264, %wide.trip.count268
br i1 %exitcond269.not, label %for.end100, label %for.body47, !llvm.loop !17
for.end100: ; preds = %for.cond65.for.end97_crit_edge, %for.end, %for.cond44.preheader
%now.0.lcssa = phi i32 [ 0, %for.cond44.preheader ], [ 0, %for.end ], [ %xor, %for.cond65.for.end97_crit_edge ]
%add101 = add nsw i32 %now.0.lcssa, %.lcssa
%idxprom102 = sext i32 %add101 to i64
%arrayidx103 = getelementptr inbounds i32, ptr %call18, i64 %idxprom102
%31 = load i32, ptr %arrayidx103, align 4, !tbaa !5
%call104 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
tail call void @run()
ret i32 0
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8
attributes #0 = { mustprogress nofree 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 norecurse nosync nounwind 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 #3 = { 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 #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 nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { nounwind }
attributes #10 = { nounwind allocsize(0,1) }
!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 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
int main(void)
{
int a[3];
int sum=0;
for(int i=0; i<3; i++){
scanf("%d", &a[i]);
sum += a[i];
}
if(sum>21){
printf("bust");
}else{
printf("win");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142549/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142549/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"bust\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"win\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [3 x i32], align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%arrayidx.1 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%add.1 = add nsw i32 %1, %0
%arrayidx.2 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%2 = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%add.2 = add nsw i32 %2, %add.1
%cmp3 = icmp sgt i32 %add.2, 21
%.str.1..str.2 = select i1 %cmp3, ptr @.str.1, ptr @.str.2
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 12, 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: 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"}
|
#include <stdio.h>
#include <string.h>
#include <memory.h>
int main()
{
int n,i,flag=0;
char s[1010][10];
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%s",s[i]);
for(i=0;i<n;i++)
{if(s[i][0]=='O'&&s[i][1]=='O')
{
flag=1; s[i][0]=s[i][1]='+'; break;
}
if(s[i][3]=='O'&&s[i][4]=='O')
{
flag=1; s[i][3]=s[i][4]='+'; break;
}
}
if(flag)
{printf("YES\n");
for(i=0;i<n;i++) printf("%s\n",s[i]);
}
else printf("NO\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1426/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1426/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.5 = 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
%s = alloca [1010 x [10 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 10100, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp79 = icmp sgt i32 %0, 0
br i1 %cmp79, label %for.body, label %if.else
for.cond2.preheader: ; preds = %for.body
%cmp3.not81 = icmp sgt i32 %1, 0
br i1 %cmp3.not81, label %for.body4.preheader, label %if.else
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 [1010 x [10 x i8]], ptr %s, 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.body4: ; preds = %for.body4.preheader, %for.inc43
%indvars.iv90 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next91, %for.inc43 ]
%arrayidx6 = getelementptr inbounds [1010 x [10 x i8]], ptr %s, i64 0, i64 %indvars.iv90
%3 = load i8, ptr %arrayidx6, align 2, !tbaa !11
%cmp8 = icmp eq i8 %3, 79
br i1 %cmp8, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %for.body4
%arrayidx12 = getelementptr inbounds [1010 x [10 x i8]], ptr %s, i64 0, i64 %indvars.iv90, i64 1
%4 = load i8, ptr %arrayidx12, align 1, !tbaa !11
%cmp14 = icmp eq i8 %4, 79
br i1 %cmp14, label %if.then, label %if.end
if.then: ; preds = %land.lhs.true
store i8 43, ptr %arrayidx12, align 1, !tbaa !11
store i8 43, ptr %arrayidx6, align 2, !tbaa !11
br label %if.then46
if.end: ; preds = %land.lhs.true, %for.body4
%arrayidx24 = getelementptr inbounds [1010 x [10 x i8]], ptr %s, i64 0, i64 %indvars.iv90, i64 3
%5 = load i8, ptr %arrayidx24, align 1, !tbaa !11
%cmp26 = icmp eq i8 %5, 79
br i1 %cmp26, label %land.lhs.true28, label %for.inc43
land.lhs.true28: ; preds = %if.end
%arrayidx31 = getelementptr inbounds [1010 x [10 x i8]], ptr %s, i64 0, i64 %indvars.iv90, i64 4
%6 = load i8, ptr %arrayidx31, align 2, !tbaa !11
%cmp33 = icmp eq i8 %6, 79
br i1 %cmp33, label %if.then35, label %for.inc43
if.then35: ; preds = %land.lhs.true28
store i8 43, ptr %arrayidx31, align 2, !tbaa !11
store i8 43, ptr %arrayidx24, align 1, !tbaa !11
br label %if.then46
for.inc43: ; preds = %if.end, %land.lhs.true28
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%exitcond.not = icmp eq i64 %indvars.iv.next91, %wide.trip.count
br i1 %exitcond.not, label %if.else, label %for.body4, !llvm.loop !12
if.then46: ; preds = %if.then, %if.then35
%puts76 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp4983 = icmp sgt i32 %7, 0
br i1 %cmp4983, label %for.body51, label %if.end60
for.body51: ; preds = %if.then46, %for.body51
%indvars.iv93 = phi i64 [ %indvars.iv.next94, %for.body51 ], [ 0, %if.then46 ]
%arrayidx53 = getelementptr inbounds [1010 x [10 x i8]], ptr %s, i64 0, i64 %indvars.iv93
%puts77 = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx53)
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp49 = icmp slt i64 %indvars.iv.next94, %9
br i1 %cmp49, label %for.body51, label %if.end60, !llvm.loop !13
if.else: ; preds = %for.inc43, %entry, %for.cond2.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end60
if.end60: ; preds = %for.body51, %if.then46, %if.else
call void @llvm.lifetime.end.p0(i64 10100, ptr nonnull %s) #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 @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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int a[4];
scanf("%d %d %d", &a[0], &a[1], &a[2]);
if( a[0] + a[1] + a[2] >= 22 ) puts("bust");
else puts("win");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142642/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142642/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 [5 x i8] c"bust\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"win\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [4 x i32], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %a) #3
%arrayidx1 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 2
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2)
%0 = load i32, ptr %a, align 16, !tbaa !5
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %arrayidx2, align 8, !tbaa !5
%add6 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add6, 21
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call8 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 16, 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 @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 = { 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 A1,A2,A3;
scanf("%d %d %d",&A1,&A2,&A3);
if(A1+A2+A3 >= 22) printf("bust\n");
else if (A1+A2+A3 <=21) printf("win\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142693/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142693/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"win\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"bust\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A1 = alloca i32, align 4
%A2 = alloca i32, align 4
%A3 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A3) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A1, ptr noundef nonnull %A2, ptr noundef nonnull %A3)
%0 = load i32, ptr %A1, align 4, !tbaa !5
%1 = load i32, ptr %A2, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %A3, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add1, 21
%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 %A3) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A1) #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 m,n,o;
scanf("%d%d%d",&m,&n,&o);
if(m+n+o>=22)
printf("bust\n");
else
printf("win\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142743/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142743/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 [4 x i8] c"win\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"bust\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%n = alloca i32, align 4
%o = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %o) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m, ptr noundef nonnull %n, ptr noundef nonnull %o)
%0 = load i32, ptr %m, align 4, !tbaa !5
%1 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %o, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add1, 21
%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 %o) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #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 = 0;
int B = 0;
int C = 0;
int ans = 0;
/* 変数宣言終わり */
/* 入力を受け付ける部分*/
// %dはdecimalの略.つまり,入力を10進数として扱うよという意味.
scanf("%d %d %d", &A, &B, &C);
/* 入力を受け付ける部分終わり*/
/* 何か処理*/
ans = A + B + C;
if(ans >= 22){
/* 真の場合の処理 */
printf("bust");
}else{
/* 偽の場合の処理 */
printf("win");
}
for(int i = 0; i < 10; i++){
// i = 0,1,2,3,4,5,6,7,8,9のとき処理される
}
/* 何か処理終わり*/
/* 出力する部分*/
// printf("%d", ans); // %dの部分にansの値が表示される
/* 出力する部分*/
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142794/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142794/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 [5 x i8] c"bust\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"win\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
store i32 0, ptr %A, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
store i32 0, ptr %B, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #3
store i32 0, ptr %C, align 4, !tbaa !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
%add = add nsw i32 %1, %0
%2 = load i32, ptr %C, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add1, 21
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
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(void){
int a = 0;
int b = 0;
int c = 0;
int tmp = 0;
scanf("%d%d%d",&a,&b,&c);
tmp = a + b + c;
if (tmp >= 22){
printf("bust");
} else {
printf("win");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142851/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142851/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 [5 x i8] c"bust\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"win\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
store i32 0, ptr %a, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
store i32 0, ptr %b, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
store i32 0, ptr %c, align 4, !tbaa !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
%add = add nsw i32 %1, %0
%2 = load i32, ptr %c, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add1, 21
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
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 (void) {
int a1, a2, a3;
scanf("%d %d %d", &a1, &a2, &a3);
if (a1 + a2 + a3 >= 22) {
printf("bust\n");
} else {
printf("win\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142895/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142895/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"win\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"bust\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a1 = alloca i32, align 4
%a2 = alloca i32, align 4
%a3 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a3) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a1, ptr noundef nonnull %a2, ptr noundef nonnull %a3)
%0 = load i32, ptr %a1, align 4, !tbaa !5
%1 = load i32, ptr %a2, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %a3, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add1, 21
%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 %a3) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a1) #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,d;
scanf("%d%d%d", &a, &b, &c);
d = a + b + c;
if (d >= 22)
printf("bust");
else
printf("win");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142938/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142938/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 [5 x i8] c"bust\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"win\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
%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
%add1 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add1, 21
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
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 A1,A2,A3;
scanf("%d" "%d" "%d",&A1,&A2,&A3);
int Z = 0;
Z = A1 + A2 + A3;
if(Z >= 22){
printf("bust");
}else{
printf("win");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142981/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142981/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 [5 x i8] c"bust\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"win\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A1 = alloca i32, align 4
%A2 = alloca i32, align 4
%A3 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A2) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A3) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A1, ptr noundef nonnull %A2, ptr noundef nonnull %A3)
%0 = load i32, ptr %A1, align 4, !tbaa !5
%1 = load i32, ptr %A2, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %A3, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add1, 21
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A3) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A1) #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", &a);
scanf("%d", &b);
scanf("%d", &c);
if(a+b+c<=21)
printf("win\n");
else
printf("bust\n");
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143023/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143023/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 [5 x i8] c"bust\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"win\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)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, 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
%add3 = add nsw i32 %add, %2
%cmp = icmp slt i32 %add3, 22
%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) #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;
int sum=0;
scanf("%d %d %d",&a,&b,&c);
sum = a + b + c;
if(sum>21){
printf("bust");
}else{
printf("win");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143067/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143067/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 [5 x i8] c"bust\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"win\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
%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
%add1 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add1, 21
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
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"}
|
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
#include<stdlib.h>
int main()
{
int n,k;
scanf("%d %d",&n,&k);
int count[101]={0};
int a[n];
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(int i=0;i<n;i++){
count[a[i]]++;
}
int c=0;
for(int i=1;i<101;i++){
if(count[i]>0){
count[i]=1;
c++;
}
}
int t=0;
if(c>=k){
printf("YES\n");
for(int i=0;i<n&&k!=0;i++){
if(count[a[i]]>0&&t<k){
printf("%d ",i+1);
t++;
count[a[i]]=0;
}
}
}
else
printf("NO");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14311/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14311/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.3 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str = 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
%k = alloca i32, align 4
%count = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %count) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) %count, i8 0, i64 404, i1 false)
%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
%cmp70 = icmp sgt i32 %3, 0
br i1 %cmp70, label %for.body, label %vector.body.preheader
for.cond3.preheader: ; preds = %for.body
%cmp472 = icmp sgt i32 %5, 0
br i1 %cmp472, label %for.body6.preheader, label %vector.body.preheader
for.body6.preheader: ; preds = %for.cond3.preheader
%wide.trip.count = zext i32 %5 to i64
%xtraiter = and i64 %wide.trip.count, 3
%4 = icmp ult i32 %5, 4
br i1 %4, label %vector.body.preheader.loopexit.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
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.1, 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
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
vector.body: ; preds = %vector.body.preheader, %pred.store.continue102
%index = phi i64 [ %index.next, %pred.store.continue102 ], [ 0, %vector.body.preheader ]
%vec.phi = phi <4 x i32> [ %predphi, %pred.store.continue102 ], [ zeroinitializer, %vector.body.preheader ]
%offset.idx = or i64 %index, 1
%7 = getelementptr inbounds [101 x i32], ptr %count, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %7, align 4, !tbaa !5
%8 = icmp sgt <4 x i32> %wide.load, zeroinitializer
%9 = extractelement <4 x i1> %8, i64 0
br i1 %9, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body
%10 = getelementptr inbounds [101 x i32], ptr %count, i64 0, i64 %offset.idx
store i32 1, ptr %10, align 4, !tbaa !5
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body
%11 = extractelement <4 x i1> %8, i64 1
br i1 %11, label %pred.store.if97, label %pred.store.continue98
pred.store.if97: ; preds = %pred.store.continue
%12 = or i64 %index, 2
%13 = getelementptr inbounds [101 x i32], ptr %count, i64 0, i64 %12
store i32 1, ptr %13, align 8, !tbaa !5
br label %pred.store.continue98
pred.store.continue98: ; preds = %pred.store.if97, %pred.store.continue
%14 = extractelement <4 x i1> %8, i64 2
br i1 %14, label %pred.store.if99, label %pred.store.continue100
pred.store.if99: ; preds = %pred.store.continue98
%15 = or i64 %index, 3
%16 = getelementptr inbounds [101 x i32], ptr %count, i64 0, i64 %15
store i32 1, ptr %16, align 4, !tbaa !5
br label %pred.store.continue100
pred.store.continue100: ; preds = %pred.store.if99, %pred.store.continue98
%17 = extractelement <4 x i1> %8, i64 3
br i1 %17, label %pred.store.if101, label %pred.store.continue102
pred.store.if101: ; preds = %pred.store.continue100
%18 = add i64 %index, 4
%19 = getelementptr inbounds [101 x i32], ptr %count, i64 0, i64 %18
store i32 1, ptr %19, align 16, !tbaa !5
br label %pred.store.continue102
pred.store.continue102: ; preds = %pred.store.if101, %pred.store.continue100
%20 = zext <4 x i1> %8 to <4 x i32>
%predphi = add <4 x i32> %vec.phi, %20
%index.next = add nuw i64 %index, 4
%21 = icmp eq i64 %index.next, 100
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %pred.store.continue102
%22 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %predphi)
%23 = load i32, ptr %k, align 4, !tbaa !5
%cmp29.not = icmp slt i32 %22, %23
br i1 %cmp29.not, label %if.else, label %if.then30
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv82 = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next83.3, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.3, %for.body6 ]
%arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv82
%24 = load i32, ptr %arrayidx8, align 16, !tbaa !5
%idxprom9 = sext i32 %24 to i64
%arrayidx10 = getelementptr inbounds [101 x i32], ptr %count, i64 0, i64 %idxprom9
%25 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%inc11 = add nsw i32 %25, 1
store i32 %inc11, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next83 = or i64 %indvars.iv82, 1
%arrayidx8.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next83
%26 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5
%idxprom9.1 = sext i32 %26 to i64
%arrayidx10.1 = getelementptr inbounds [101 x i32], ptr %count, i64 0, i64 %idxprom9.1
%27 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%inc11.1 = add nsw i32 %27, 1
store i32 %inc11.1, ptr %arrayidx10.1, align 4, !tbaa !5
%indvars.iv.next83.1 = or i64 %indvars.iv82, 2
%arrayidx8.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next83.1
%28 = load i32, ptr %arrayidx8.2, align 8, !tbaa !5
%idxprom9.2 = sext i32 %28 to i64
%arrayidx10.2 = getelementptr inbounds [101 x i32], ptr %count, i64 0, i64 %idxprom9.2
%29 = load i32, ptr %arrayidx10.2, align 4, !tbaa !5
%inc11.2 = add nsw i32 %29, 1
store i32 %inc11.2, ptr %arrayidx10.2, align 4, !tbaa !5
%indvars.iv.next83.2 = or i64 %indvars.iv82, 3
%arrayidx8.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next83.2
%30 = load i32, ptr %arrayidx8.3, align 4, !tbaa !5
%idxprom9.3 = sext i32 %30 to i64
%arrayidx10.3 = getelementptr inbounds [101 x i32], ptr %count, i64 0, i64 %idxprom9.3
%31 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%inc11.3 = add nsw i32 %31, 1
store i32 %inc11.3, ptr %arrayidx10.3, align 4, !tbaa !5
%indvars.iv.next83.3 = add nuw nsw i64 %indvars.iv82, 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 %vector.body.preheader.loopexit.unr-lcssa, label %for.body6, !llvm.loop !14
vector.body.preheader.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%indvars.iv82.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next83.3, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %vector.body.preheader, label %for.body6.epil
for.body6.epil: ; preds = %vector.body.preheader.loopexit.unr-lcssa, %for.body6.epil
%indvars.iv82.epil = phi i64 [ %indvars.iv.next83.epil, %for.body6.epil ], [ %indvars.iv82.unr, %vector.body.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %vector.body.preheader.loopexit.unr-lcssa ]
%arrayidx8.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv82.epil
%32 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5
%idxprom9.epil = sext i32 %32 to i64
%arrayidx10.epil = getelementptr inbounds [101 x i32], ptr %count, i64 0, i64 %idxprom9.epil
%33 = load i32, ptr %arrayidx10.epil, align 4, !tbaa !5
%inc11.epil = add nsw i32 %33, 1
store i32 %inc11.epil, ptr %arrayidx10.epil, align 4, !tbaa !5
%indvars.iv.next83.epil = add nuw nsw i64 %indvars.iv82.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 %vector.body.preheader, label %for.body6.epil, !llvm.loop !15
vector.body.preheader: ; preds = %vector.body.preheader.loopexit.unr-lcssa, %for.body6.epil, %for.cond3.preheader, %entry
br label %vector.body
if.then30: ; preds = %middle.block
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%34 = load i32, ptr %n, align 4, !tbaa !5
%cmp3476 = icmp sgt i32 %34, 0
%35 = load i32, ptr %k, align 4
%cmp3577 = icmp ne i32 %35, 0
%36 = select i1 %cmp3476, i1 %cmp3577, i1 false
br i1 %36, label %for.body37, label %if.end56
for.body37: ; preds = %if.then30, %for.inc52
%37 = phi i32 [ %44, %for.inc52 ], [ %35, %if.then30 ]
%38 = phi i32 [ %45, %for.inc52 ], [ %34, %if.then30 ]
%indvars.iv89 = phi i64 [ %41, %for.inc52 ], [ 0, %if.then30 ]
%t.078 = phi i32 [ %t.1, %for.inc52 ], [ 0, %if.then30 ]
%arrayidx39 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv89
%39 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%idxprom40 = sext i32 %39 to i64
%arrayidx41 = getelementptr inbounds [101 x i32], ptr %count, i64 0, i64 %idxprom40
%40 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %40, 0
%cmp43 = icmp slt i32 %t.078, %37
%or.cond = select i1 %cmp42, i1 %cmp43, i1 false
%41 = add nuw nsw i64 %indvars.iv89, 1
br i1 %or.cond, label %if.then44, label %for.inc52
if.then44: ; preds = %for.body37
%42 = trunc i64 %41 to i32
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %42)
%inc46 = add nsw i32 %t.078, 1
%43 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%idxprom49 = sext i32 %43 to i64
%arrayidx50 = getelementptr inbounds [101 x i32], ptr %count, i64 0, i64 %idxprom49
store i32 0, ptr %arrayidx50, align 4, !tbaa !5
%.pre = load i32, ptr %n, align 4, !tbaa !5
%.pre93 = load i32, ptr %k, align 4
br label %for.inc52
for.inc52: ; preds = %for.body37, %if.then44
%44 = phi i32 [ %.pre93, %if.then44 ], [ %37, %for.body37 ]
%45 = phi i32 [ %.pre, %if.then44 ], [ %38, %for.body37 ]
%t.1 = phi i32 [ %inc46, %if.then44 ], [ %t.078, %for.body37 ]
%46 = sext i32 %45 to i64
%cmp34 = icmp slt i64 %41, %46
%cmp35 = icmp ne i32 %44, 0
%47 = select i1 %cmp34, i1 %cmp35, i1 false
br i1 %47, label %for.body37, label %if.end56, !llvm.loop !17
if.else: ; preds = %middle.block
%call55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
br label %if.end56
if.end56: ; preds = %for.inc52, %if.then30, %if.else
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %count) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 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
declare ptr @llvm.stacksave.p0() #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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #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 nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<tgmath.h>
#include<stdbool.h>
#include<sys/queue.h>
#include<time.h>
#define ll long long
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
int h, w, t[2222][2222], u[2222][2222];
char s[2222][2222];
int main(){
scanf("%d%d", &h, &w);
for(int i=0; i<h; i++){
scanf("%s", s[i]);
for(int j=0; j<w; j++){
t[i][j] = s[i][j] == '.';
u[i][j] = s[i][j] == '.';
}
}
for(int i=0; i<h; i++){
for(int j=0; j<w; j++){
if(j){
if(t[i][j] != 0)t[i][j] += t[i][j-1];
}
if(i){
if(u[i][j] != 0)u[i][j] += u[i-1][j];
}
}
}
for(int i=0; i<h; i++){
for(int j=w-2; j>=0; j--){
if(s[i][j] == '.')t[i][j] = max(t[i][j],t[i][j+1]);
}
}
for(int i=h-2; i>=0; i--){
for(int j=0; j<w; j++){
if(s[i][j] == '.')u[i][j] = max(u[i][j],u[i+1][j]);
}
}
int ans = 0;
for(int i=0; i<h; i++){
for(int j=0; j<w; j++)ans = max(ans, t[i][j] + u[i][j] -1);
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143153/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143153/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
@h = dso_local global i32 0, align 4
@w = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@s = dso_local global [2222 x [2222 x i8]] zeroinitializer, align 16
@t = dso_local local_unnamed_addr global [2222 x [2222 x i32]] zeroinitializer, align 16
@u = dso_local local_unnamed_addr global [2222 x [2222 x i32]] zeroinitializer, align 16
@.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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @h, ptr noundef nonnull @w)
%0 = load i32, ptr @h, align 4, !tbaa !5
%cmp313 = icmp sgt i32 %0, 0
br i1 %cmp313, label %for.body, label %for.cond.cleanup196
for.cond31.preheader: ; preds = %for.cond.cleanup4
%cmp32317 = icmp sgt i32 %32, 0
br i1 %cmp32317, label %for.cond37.preheader.lr.ph, label %for.cond.cleanup196
for.cond37.preheader.lr.ph: ; preds = %for.cond31.preheader
%1 = load i32, ptr @w, align 4, !tbaa !5
%cmp38315 = icmp sgt i32 %1, 0
br i1 %cmp38315, label %for.cond37.preheader.us.preheader, label %for.cond.cleanup89
for.cond37.preheader.us.preheader: ; preds = %for.cond37.preheader.lr.ph
%wide.trip.count380 = zext i32 %32 to i64
%wide.trip.count366 = zext i32 %1 to i64
%exitcond367.peel.not = icmp eq i32 %1, 1
%2 = add nsw i64 %wide.trip.count366, -1
%xtraiter = and i64 %2, 1
%3 = icmp eq i32 %1, 2
%unroll_iter = and i64 %2, -2
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond37.preheader.us
for.cond37.preheader.us: ; preds = %for.cond37.preheader.us.preheader, %for.cond37.for.cond.cleanup40_crit_edge.us
%indvars.iv376 = phi i64 [ 0, %for.cond37.preheader.us.preheader ], [ %indvars.iv.next377, %for.cond37.for.cond.cleanup40_crit_edge.us ]
%tobool58.not.us = icmp eq i64 %indvars.iv376, 0
%4 = add nsw i64 %indvars.iv376, -1
br i1 %tobool58.not.us, label %if.end57.us.us.peel, label %if.end57.us331.peel
if.end57.us331.peel: ; preds = %for.cond37.preheader.us
%arrayidx63.us.peel = getelementptr inbounds [2222 x [2222 x i32]], ptr @u, i64 0, i64 %indvars.iv376, i64 0
%5 = load i32, ptr %arrayidx63.us.peel, align 8, !tbaa !5
%cmp64.not.us.peel = icmp eq i32 %5, 0
br i1 %cmp64.not.us.peel, label %for.inc79.us.peel, label %if.then66.us.peel
if.then66.us.peel: ; preds = %if.end57.us331.peel
%arrayidx71.us.peel = getelementptr inbounds [2222 x [2222 x i32]], ptr @u, i64 0, i64 %4, i64 0
%6 = load i32, ptr %arrayidx71.us.peel, align 8, !tbaa !5
%add76.us.peel = add nsw i32 %6, %5
store i32 %add76.us.peel, ptr %arrayidx63.us.peel, align 8, !tbaa !5
br label %for.inc79.us.peel
for.inc79.us.peel: ; preds = %if.then66.us.peel, %if.end57.us331.peel
br i1 %exitcond367.peel.not, label %for.cond37.for.cond.cleanup40_crit_edge.us, label %if.then.us322
if.end57.us.us.peel: ; preds = %for.cond37.preheader.us
switch i32 %1, label %if.then.us.us [
i32 1, label %for.cond37.for.cond.cleanup40_crit_edge.us
i32 2, label %for.cond37.for.cond.cleanup40_crit_edge.us.loopexit.unr-lcssa
]
if.then.us322: ; preds = %for.inc79.us.peel, %for.inc79.us
%indvars.iv362 = phi i64 [ %indvars.iv.next363, %for.inc79.us ], [ 1, %for.inc79.us.peel ]
%arrayidx45.us324 = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 %indvars.iv376, i64 %indvars.iv362
%7 = load i32, ptr %arrayidx45.us324, align 4, !tbaa !5
%cmp46.not.us325 = icmp eq i32 %7, 0
br i1 %cmp46.not.us325, label %if.end57.us331, label %if.then48.us326
if.then48.us326: ; preds = %if.then.us322
%8 = add nsw i64 %indvars.iv362, -1
%arrayidx52.us329 = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 %indvars.iv376, i64 %8
%9 = load i32, ptr %arrayidx52.us329, align 4, !tbaa !5
%add.us330 = add nsw i32 %9, %7
store i32 %add.us330, ptr %arrayidx45.us324, align 4, !tbaa !5
br label %if.end57.us331
if.end57.us331: ; preds = %if.then48.us326, %if.then.us322
%arrayidx63.us = getelementptr inbounds [2222 x [2222 x i32]], ptr @u, i64 0, i64 %indvars.iv376, i64 %indvars.iv362
%10 = load i32, ptr %arrayidx63.us, align 4, !tbaa !5
%cmp64.not.us = icmp eq i32 %10, 0
br i1 %cmp64.not.us, label %for.inc79.us, label %if.then66.us
if.then66.us: ; preds = %if.end57.us331
%arrayidx71.us = getelementptr inbounds [2222 x [2222 x i32]], ptr @u, i64 0, i64 %4, i64 %indvars.iv362
%11 = load i32, ptr %arrayidx71.us, align 4, !tbaa !5
%add76.us = add nsw i32 %11, %10
store i32 %add76.us, ptr %arrayidx63.us, align 4, !tbaa !5
br label %for.inc79.us
for.inc79.us: ; preds = %if.then66.us, %if.end57.us331
%indvars.iv.next363 = add nuw nsw i64 %indvars.iv362, 1
%exitcond367.not = icmp eq i64 %indvars.iv.next363, %wide.trip.count366
br i1 %exitcond367.not, label %for.cond37.for.cond.cleanup40_crit_edge.us, label %if.then.us322, !llvm.loop !9
for.cond37.for.cond.cleanup40_crit_edge.us.loopexit.unr-lcssa: ; preds = %if.end57.us.us.1, %if.end57.us.us.peel
%indvars.iv369.unr = phi i64 [ 1, %if.end57.us.us.peel ], [ %indvars.iv.next370.1, %if.end57.us.us.1 ]
br i1 %lcmp.mod.not, label %for.cond37.for.cond.cleanup40_crit_edge.us, label %if.then.us.us.epil
if.then.us.us.epil: ; preds = %for.cond37.for.cond.cleanup40_crit_edge.us.loopexit.unr-lcssa
%arrayidx45.us.us.epil = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 0, i64 %indvars.iv369.unr
%12 = load i32, ptr %arrayidx45.us.us.epil, align 4, !tbaa !5
%cmp46.not.us.us.epil = icmp eq i32 %12, 0
br i1 %cmp46.not.us.us.epil, label %for.cond37.for.cond.cleanup40_crit_edge.us, label %if.then48.us.us.epil
if.then48.us.us.epil: ; preds = %if.then.us.us.epil
%13 = add nsw i64 %indvars.iv369.unr, -1
%arrayidx52.us.us.epil = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 0, i64 %13
%14 = load i32, ptr %arrayidx52.us.us.epil, align 4, !tbaa !5
%add.us.us.epil = add nsw i32 %14, %12
store i32 %add.us.us.epil, ptr %arrayidx45.us.us.epil, align 4, !tbaa !5
br label %for.cond37.for.cond.cleanup40_crit_edge.us
for.cond37.for.cond.cleanup40_crit_edge.us: ; preds = %for.inc79.us, %for.cond37.for.cond.cleanup40_crit_edge.us.loopexit.unr-lcssa, %if.then48.us.us.epil, %if.then.us.us.epil, %if.end57.us.us.peel, %for.inc79.us.peel
%indvars.iv.next377 = add nuw nsw i64 %indvars.iv376, 1
%exitcond381.not = icmp eq i64 %indvars.iv.next377, %wide.trip.count380
br i1 %exitcond381.not, label %for.cond86.preheader, label %for.cond37.preheader.us, !llvm.loop !12
if.then.us.us: ; preds = %if.end57.us.us.peel, %if.end57.us.us.1
%indvars.iv369 = phi i64 [ %indvars.iv.next370.1, %if.end57.us.us.1 ], [ 1, %if.end57.us.us.peel ]
%niter = phi i64 [ %niter.next.1, %if.end57.us.us.1 ], [ 0, %if.end57.us.us.peel ]
%arrayidx45.us.us = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 0, i64 %indvars.iv369
%15 = load i32, ptr %arrayidx45.us.us, align 4, !tbaa !5
%cmp46.not.us.us = icmp eq i32 %15, 0
br i1 %cmp46.not.us.us, label %if.end57.us.us, label %if.then48.us.us
if.then48.us.us: ; preds = %if.then.us.us
%16 = add nsw i64 %indvars.iv369, -1
%arrayidx52.us.us = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 0, i64 %16
%17 = load i32, ptr %arrayidx52.us.us, align 4, !tbaa !5
%add.us.us = add nsw i32 %17, %15
store i32 %add.us.us, ptr %arrayidx45.us.us, align 4, !tbaa !5
br label %if.end57.us.us
if.end57.us.us: ; preds = %if.then48.us.us, %if.then.us.us
%indvars.iv.next370 = add nuw nsw i64 %indvars.iv369, 1
%arrayidx45.us.us.1 = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 0, i64 %indvars.iv.next370
%18 = load i32, ptr %arrayidx45.us.us.1, align 4, !tbaa !5
%cmp46.not.us.us.1 = icmp eq i32 %18, 0
br i1 %cmp46.not.us.us.1, label %if.end57.us.us.1, label %if.then48.us.us.1
if.then48.us.us.1: ; preds = %if.end57.us.us
%arrayidx52.us.us.1 = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 0, i64 %indvars.iv369
%19 = load i32, ptr %arrayidx52.us.us.1, align 4, !tbaa !5
%add.us.us.1 = add nsw i32 %19, %18
store i32 %add.us.us.1, ptr %arrayidx45.us.us.1, align 4, !tbaa !5
br label %if.end57.us.us.1
if.end57.us.us.1: ; preds = %if.then48.us.us.1, %if.end57.us.us
%indvars.iv.next370.1 = add nuw nsw i64 %indvars.iv369, 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.cond37.for.cond.cleanup40_crit_edge.us.loopexit.unr-lcssa, label %if.then.us.us, !llvm.loop !13
for.body: ; preds = %entry, %for.cond.cleanup4
%indvars.iv359 = phi i64 [ %indvars.iv.next360, %for.cond.cleanup4 ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [2222 x [2222 x i8]], ptr @s, i64 0, i64 %indvars.iv359
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%20 = load i32, ptr @w, align 4, !tbaa !5
%cmp3311 = icmp sgt i32 %20, 0
br i1 %cmp3311, label %for.body5.preheader, label %for.cond.cleanup4
for.body5.preheader: ; preds = %for.body
%wide.trip.count = zext i32 %20 to i64
%min.iters.check = icmp ult i32 %20, 8
br i1 %min.iters.check, label %for.body5.preheader439, label %vector.ph
vector.ph: ; preds = %for.body5.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 ]
%21 = getelementptr inbounds [2222 x [2222 x i8]], ptr @s, i64 0, i64 %indvars.iv359, i64 %index
%wide.load = load <4 x i8>, ptr %21, align 2, !tbaa !14
%22 = getelementptr inbounds i8, ptr %21, i64 4
%wide.load437 = load <4 x i8>, ptr %22, align 2, !tbaa !14
%23 = icmp eq <4 x i8> %wide.load, <i8 46, i8 46, i8 46, i8 46>
%24 = icmp eq <4 x i8> %wide.load437, <i8 46, i8 46, i8 46, i8 46>
%25 = zext <4 x i1> %23 to <4 x i32>
%26 = zext <4 x i1> %24 to <4 x i32>
%27 = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 %indvars.iv359, i64 %index
store <4 x i32> %25, ptr %27, align 8, !tbaa !5
%28 = getelementptr inbounds i32, ptr %27, i64 4
store <4 x i32> %26, ptr %28, align 8, !tbaa !5
%29 = getelementptr inbounds [2222 x [2222 x i32]], ptr @u, i64 0, i64 %indvars.iv359, i64 %index
store <4 x i32> %25, ptr %29, align 8, !tbaa !5
%30 = getelementptr inbounds i32, ptr %29, i64 4
store <4 x i32> %26, ptr %30, align 8, !tbaa !5
%index.next = add nuw i64 %index, 8
%31 = icmp eq i64 %index.next, %n.vec
br i1 %31, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup4, label %for.body5.preheader439
for.body5.preheader439: ; preds = %for.body5.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body5.preheader ], [ %n.vec, %middle.block ]
br label %for.body5
for.cond.cleanup4: ; preds = %for.body5, %middle.block, %for.body
%indvars.iv.next360 = add nuw nsw i64 %indvars.iv359, 1
%32 = load i32, ptr @h, align 4, !tbaa !5
%33 = sext i32 %32 to i64
%cmp = icmp slt i64 %indvars.iv.next360, %33
br i1 %cmp, label %for.body, label %for.cond31.preheader, !llvm.loop !18
for.body5: ; preds = %for.body5.preheader439, %for.body5
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body5 ], [ %indvars.iv.ph, %for.body5.preheader439 ]
%arrayidx9 = getelementptr inbounds [2222 x [2222 x i8]], ptr @s, i64 0, i64 %indvars.iv359, i64 %indvars.iv
%34 = load i8, ptr %arrayidx9, align 1, !tbaa !14
%cmp10 = icmp eq i8 %34, 46
%conv11 = zext i1 %cmp10 to i32
%arrayidx15 = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 %indvars.iv359, i64 %indvars.iv
store i32 %conv11, ptr %arrayidx15, align 4, !tbaa !5
%arrayidx26 = getelementptr inbounds [2222 x [2222 x i32]], ptr @u, i64 0, i64 %indvars.iv359, i64 %indvars.iv
store i32 %conv11, ptr %arrayidx26, 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.cond.cleanup4, label %for.body5, !llvm.loop !19
for.cond86.preheader: ; preds = %for.cond37.for.cond.cleanup40_crit_edge.us
br i1 %cmp32317, label %for.body90.lr.ph, label %for.cond.cleanup89
for.body90.lr.ph: ; preds = %for.cond86.preheader
%.pr = load i32, ptr @w, align 4, !tbaa !5
%cmp94336 = icmp sgt i32 %.pr, 1
br i1 %cmp94336, label %for.body90.us.preheader, label %for.cond.cleanup89
for.body90.us.preheader: ; preds = %for.body90.lr.ph
%sub92 = add nsw i32 %.pr, -2
%35 = zext i32 %sub92 to i64
%wide.trip.count389 = zext i32 %32 to i64
br label %for.body90.us
for.body90.us: ; preds = %for.body90.us.preheader, %for.cond93.for.cond.cleanup96_crit_edge.us
%indvars.iv386 = phi i64 [ 0, %for.body90.us.preheader ], [ %indvars.iv.next387, %for.cond93.for.cond.cleanup96_crit_edge.us ]
br label %for.body97.us
for.body97.us: ; preds = %for.body90.us, %for.inc131.us
%indvars.iv382 = phi i64 [ %35, %for.body90.us ], [ %indvars.iv.next383, %for.inc131.us ]
%arrayidx101.us = getelementptr inbounds [2222 x [2222 x i8]], ptr @s, i64 0, i64 %indvars.iv386, i64 %indvars.iv382
%36 = load i8, ptr %arrayidx101.us, align 1, !tbaa !14
%cmp103.us = icmp eq i8 %36, 46
br i1 %cmp103.us, label %if.then105.us, label %for.inc131.us
if.then105.us: ; preds = %for.body97.us
%arrayidx109.us = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 %indvars.iv386, i64 %indvars.iv382
%37 = load i32, ptr %arrayidx109.us, align 4, !tbaa !5
%38 = add nuw nsw i64 %indvars.iv382, 1
%arrayidx114.us = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 %indvars.iv386, i64 %38
%39 = load i32, ptr %arrayidx114.us, align 4, !tbaa !5
%..us = tail call i32 @llvm.smax.i32(i32 %37, i32 %39)
store i32 %..us, ptr %arrayidx109.us, align 4, !tbaa !5
br label %for.inc131.us
for.inc131.us: ; preds = %if.then105.us, %for.body97.us
%indvars.iv.next383 = add nsw i64 %indvars.iv382, -1
%cmp94.us = icmp sgt i64 %indvars.iv382, 0
br i1 %cmp94.us, label %for.body97.us, label %for.cond93.for.cond.cleanup96_crit_edge.us, !llvm.loop !20
for.cond93.for.cond.cleanup96_crit_edge.us: ; preds = %for.inc131.us
%indvars.iv.next387 = add nuw nsw i64 %indvars.iv386, 1
%exitcond390.not = icmp eq i64 %indvars.iv.next387, %wide.trip.count389
br i1 %exitcond390.not, label %for.cond.cleanup89, label %for.body90.us, !llvm.loop !21
for.cond.cleanup89: ; preds = %for.cond93.for.cond.cleanup96_crit_edge.us, %for.cond37.preheader.lr.ph, %for.body90.lr.ph, %for.cond86.preheader
%cmp32317413416 = phi i1 [ false, %for.cond86.preheader ], [ true, %for.body90.lr.ph ], [ true, %for.cond37.preheader.lr.ph ], [ %cmp32317, %for.cond93.for.cond.cleanup96_crit_edge.us ]
%cmp139342 = icmp sgt i32 %32, 1
br i1 %cmp139342, label %for.cond144.preheader.lr.ph, label %for.cond193.preheader
for.cond144.preheader.lr.ph: ; preds = %for.cond.cleanup89
%40 = load i32, ptr @w, align 4, !tbaa !5
%cmp145340 = icmp sgt i32 %40, 0
br i1 %cmp145340, label %for.cond144.preheader.us.preheader, label %for.cond193.preheader
for.cond144.preheader.us.preheader: ; preds = %for.cond144.preheader.lr.ph
%sub137 = add nsw i32 %32, -2
%41 = zext i32 %sub137 to i64
%wide.trip.count394 = zext i32 %40 to i64
br label %for.cond144.preheader.us
for.cond144.preheader.us: ; preds = %for.cond144.preheader.us.preheader, %for.cond144.for.cond.cleanup147_crit_edge.us
%indvars.iv396 = phi i64 [ %41, %for.cond144.preheader.us.preheader ], [ %indvars.iv.next397, %for.cond144.for.cond.cleanup147_crit_edge.us ]
%42 = add nuw nsw i64 %indvars.iv396, 1
br label %for.body148.us
for.body148.us: ; preds = %for.cond144.preheader.us, %for.inc186.us
%indvars.iv391 = phi i64 [ 0, %for.cond144.preheader.us ], [ %indvars.iv.next392, %for.inc186.us ]
%arrayidx152.us = getelementptr inbounds [2222 x [2222 x i8]], ptr @s, i64 0, i64 %indvars.iv396, i64 %indvars.iv391
%43 = load i8, ptr %arrayidx152.us, align 1, !tbaa !14
%cmp154.us = icmp eq i8 %43, 46
br i1 %cmp154.us, label %if.then156.us, label %for.inc186.us
if.then156.us: ; preds = %for.body148.us
%arrayidx160.us = getelementptr inbounds [2222 x [2222 x i32]], ptr @u, i64 0, i64 %indvars.iv396, i64 %indvars.iv391
%44 = load i32, ptr %arrayidx160.us, align 4, !tbaa !5
%arrayidx165.us = getelementptr inbounds [2222 x [2222 x i32]], ptr @u, i64 0, i64 %42, i64 %indvars.iv391
%45 = load i32, ptr %arrayidx165.us, align 4, !tbaa !5
%.310.us = tail call i32 @llvm.smax.i32(i32 %44, i32 %45)
store i32 %.310.us, ptr %arrayidx160.us, align 4, !tbaa !5
br label %for.inc186.us
for.inc186.us: ; preds = %if.then156.us, %for.body148.us
%indvars.iv.next392 = add nuw nsw i64 %indvars.iv391, 1
%exitcond395.not = icmp eq i64 %indvars.iv.next392, %wide.trip.count394
br i1 %exitcond395.not, label %for.cond144.for.cond.cleanup147_crit_edge.us, label %for.body148.us, !llvm.loop !22
for.cond144.for.cond.cleanup147_crit_edge.us: ; preds = %for.inc186.us
%indvars.iv.next397 = add nsw i64 %indvars.iv396, -1
%cmp139.us = icmp sgt i64 %indvars.iv396, 0
br i1 %cmp139.us, label %for.cond144.preheader.us, label %for.cond193.preheader, !llvm.loop !23
for.cond193.preheader: ; preds = %for.cond144.for.cond.cleanup147_crit_edge.us, %for.cond144.preheader.lr.ph, %for.cond.cleanup89
br i1 %cmp32317413416, label %for.cond199.preheader.lr.ph, label %for.cond.cleanup196
for.cond199.preheader.lr.ph: ; preds = %for.cond193.preheader
%46 = load i32, ptr @w, align 4, !tbaa !5
%cmp200344 = icmp sgt i32 %46, 0
br i1 %cmp200344, label %for.cond199.preheader.us.preheader, label %for.cond.cleanup196
for.cond199.preheader.us.preheader: ; preds = %for.cond199.preheader.lr.ph
%wide.trip.count408 = zext i32 %32 to i64
%wide.trip.count403 = zext i32 %46 to i64
%xtraiter440 = and i64 %wide.trip.count403, 1
%47 = icmp eq i32 %46, 1
%unroll_iter443 = and i64 %wide.trip.count403, 4294967294
%lcmp.mod441.not = icmp eq i64 %xtraiter440, 0
br label %for.cond199.preheader.us
for.cond199.preheader.us: ; preds = %for.cond199.preheader.us.preheader, %for.cond199.for.cond.cleanup202_crit_edge.us
%indvars.iv405 = phi i64 [ 0, %for.cond199.preheader.us.preheader ], [ %indvars.iv.next406, %for.cond199.for.cond.cleanup202_crit_edge.us ]
%ans.0349.us = phi i32 [ 0, %for.cond199.preheader.us.preheader ], [ %cond229.us.lcssa, %for.cond199.for.cond.cleanup202_crit_edge.us ]
br i1 %47, label %for.cond199.for.cond.cleanup202_crit_edge.us.unr-lcssa, label %for.body203.us
for.body203.us: ; preds = %for.cond199.preheader.us, %for.body203.us
%indvars.iv400 = phi i64 [ %indvars.iv.next401.1, %for.body203.us ], [ 0, %for.cond199.preheader.us ]
%ans.1345.us = phi i32 [ %cond229.us.1, %for.body203.us ], [ %ans.0349.us, %for.cond199.preheader.us ]
%niter444 = phi i64 [ %niter444.next.1, %for.body203.us ], [ 0, %for.cond199.preheader.us ]
%arrayidx207.us = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 %indvars.iv405, i64 %indvars.iv400
%48 = load i32, ptr %arrayidx207.us, align 8, !tbaa !5
%arrayidx211.us = getelementptr inbounds [2222 x [2222 x i32]], ptr @u, i64 0, i64 %indvars.iv405, i64 %indvars.iv400
%49 = load i32, ptr %arrayidx211.us, align 8, !tbaa !5
%add212.us = add nsw i32 %49, %48
%cmp214.not.us = icmp slt i32 %ans.1345.us, %add212.us
%sub213.us = add nsw i32 %add212.us, -1
%cond229.us = select i1 %cmp214.not.us, i32 %sub213.us, i32 %ans.1345.us
%indvars.iv.next401 = or i64 %indvars.iv400, 1
%arrayidx207.us.1 = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 %indvars.iv405, i64 %indvars.iv.next401
%50 = load i32, ptr %arrayidx207.us.1, align 4, !tbaa !5
%arrayidx211.us.1 = getelementptr inbounds [2222 x [2222 x i32]], ptr @u, i64 0, i64 %indvars.iv405, i64 %indvars.iv.next401
%51 = load i32, ptr %arrayidx211.us.1, align 4, !tbaa !5
%add212.us.1 = add nsw i32 %51, %50
%cmp214.not.us.1 = icmp slt i32 %cond229.us, %add212.us.1
%sub213.us.1 = add nsw i32 %add212.us.1, -1
%cond229.us.1 = select i1 %cmp214.not.us.1, i32 %sub213.us.1, i32 %cond229.us
%indvars.iv.next401.1 = add nuw nsw i64 %indvars.iv400, 2
%niter444.next.1 = add i64 %niter444, 2
%niter444.ncmp.1 = icmp eq i64 %niter444.next.1, %unroll_iter443
br i1 %niter444.ncmp.1, label %for.cond199.for.cond.cleanup202_crit_edge.us.unr-lcssa, label %for.body203.us, !llvm.loop !24
for.cond199.for.cond.cleanup202_crit_edge.us.unr-lcssa: ; preds = %for.body203.us, %for.cond199.preheader.us
%cond229.us.lcssa.ph = phi i32 [ undef, %for.cond199.preheader.us ], [ %cond229.us.1, %for.body203.us ]
%indvars.iv400.unr = phi i64 [ 0, %for.cond199.preheader.us ], [ %indvars.iv.next401.1, %for.body203.us ]
%ans.1345.us.unr = phi i32 [ %ans.0349.us, %for.cond199.preheader.us ], [ %cond229.us.1, %for.body203.us ]
br i1 %lcmp.mod441.not, label %for.cond199.for.cond.cleanup202_crit_edge.us, label %for.body203.us.epil
for.body203.us.epil: ; preds = %for.cond199.for.cond.cleanup202_crit_edge.us.unr-lcssa
%arrayidx207.us.epil = getelementptr inbounds [2222 x [2222 x i32]], ptr @t, i64 0, i64 %indvars.iv405, i64 %indvars.iv400.unr
%52 = load i32, ptr %arrayidx207.us.epil, align 4, !tbaa !5
%arrayidx211.us.epil = getelementptr inbounds [2222 x [2222 x i32]], ptr @u, i64 0, i64 %indvars.iv405, i64 %indvars.iv400.unr
%53 = load i32, ptr %arrayidx211.us.epil, align 4, !tbaa !5
%add212.us.epil = add nsw i32 %53, %52
%cmp214.not.us.epil = icmp slt i32 %ans.1345.us.unr, %add212.us.epil
%sub213.us.epil = add nsw i32 %add212.us.epil, -1
%cond229.us.epil = select i1 %cmp214.not.us.epil, i32 %sub213.us.epil, i32 %ans.1345.us.unr
br label %for.cond199.for.cond.cleanup202_crit_edge.us
for.cond199.for.cond.cleanup202_crit_edge.us: ; preds = %for.cond199.for.cond.cleanup202_crit_edge.us.unr-lcssa, %for.body203.us.epil
%cond229.us.lcssa = phi i32 [ %cond229.us.lcssa.ph, %for.cond199.for.cond.cleanup202_crit_edge.us.unr-lcssa ], [ %cond229.us.epil, %for.body203.us.epil ]
%indvars.iv.next406 = add nuw nsw i64 %indvars.iv405, 1
%exitcond409.not = icmp eq i64 %indvars.iv.next406, %wide.trip.count408
br i1 %exitcond409.not, label %for.cond.cleanup196, label %for.cond199.preheader.us, !llvm.loop !25
for.cond.cleanup196: ; preds = %for.cond199.for.cond.cleanup202_crit_edge.us, %entry, %for.cond31.preheader, %for.cond199.preheader.lr.ph, %for.cond193.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond193.preheader ], [ 0, %for.cond199.preheader.lr.ph ], [ 0, %for.cond31.preheader ], [ 0, %entry ], [ %cond229.us.lcssa, %for.cond199.for.cond.cleanup202_crit_edge.us ]
%call236 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
ret i32 0
}
; 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.smax.i32(i32, 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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !11}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !10, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !17, !16}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(){
int i,j,k,H,W;
scanf("%d %d", &H, &W);
char s[H][W];
int matrix[H][W];
int a[H][W];
int b[H][W];
int cnt=0;
int max=0;
int temp=0;
getchar();
for(i=0;i<H;i++){
for(j=0;j<W;j++){
scanf("%c", &s[i][j]);
if(s[i][j] == '#') {
matrix[i][j] = 1;
}
else{
matrix[i][j] = 0;
}
}
getchar();
}
cnt=0;
for(i=0;i<H;i++){
for(j=0;j<W;j++){
if(matrix[i][j] == 1){
a[i][j]=0;
for(k=cnt; k>0; k--){
a[i][j-k] = cnt;
}
cnt=0;
}
else if(matrix[i][j] == 0 ){
cnt++;
}
if(j==W-1){
for(k=cnt-1; k>=0; k--){
a[i][j-k] = cnt;
}
cnt=0;
}
}
}
cnt=0;
for(i=0;i<W;i++){
for(j=0;j<H;j++){
if(matrix[j][i] == 1){
b[j][i]=0;
for(k=cnt; k>0; k--){
b[j-k][i] = cnt;
}
cnt=0;
}
else if(matrix[j][i] == 0 ){
cnt++;
}
if(j==H-1){
for(k=cnt-1; k>=0; k--){
b[j-k][i] = cnt;
}
cnt=0;
}
}
}
max=0;
for(i=0;i<H;i++){
for(j=0;j<W;j++){
temp = a[i][j]+b[i][j];
if(a[i][j]>0 && b[i][j]>0) temp=temp-1;
if(temp>max){
max = temp;
}
}
}
printf("%d\n", max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143197/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143197/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"%c\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%0 = load i32, ptr %H, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = load i32, ptr %W, align 4, !tbaa !5
%3 = zext i32 %2 to i64
%4 = call ptr @llvm.stacksave.p0()
%5 = mul nuw i64 %3, %1
%vla = alloca i8, i64 %5, align 16
%6 = load i32, ptr %H, align 4, !tbaa !5
%7 = zext i32 %6 to i64
%8 = load i32, ptr %W, align 4, !tbaa !5
%9 = zext i32 %8 to i64
%10 = mul nuw i64 %9, %7
%vla1 = alloca i32, i64 %10, align 16
%vla2 = alloca i32, i64 %10, align 16
%vla3 = alloca i32, i64 %10, align 16
%11 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i = call i32 @getc(ptr noundef %11)
%12 = load i32, ptr %H, align 4, !tbaa !5
%cmp281 = icmp sgt i32 %12, 0
br i1 %cmp281, label %for.cond5.preheader, label %for.end199
for.cond5.preheader: ; preds = %entry, %for.end
%indvars.iv327 = phi i64 [ %indvars.iv.next328, %for.end ], [ 0, %entry ]
%13 = load i32, ptr %W, align 4, !tbaa !5
%cmp6279 = icmp sgt i32 %13, 0
br i1 %cmp6279, label %for.body7.lr.ph, label %for.end
for.body7.lr.ph: ; preds = %for.cond5.preheader
%14 = mul nuw nsw i64 %indvars.iv327, %3
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %14
%15 = mul nuw nsw i64 %indvars.iv327, %9
%arrayidx22 = getelementptr inbounds i32, ptr %vla1, i64 %15
br label %for.body7
for.cond29.preheader: ; preds = %for.end
%cmp30292 = icmp slt i32 %35, 1
%.pre = load i32, ptr %W, align 4, !tbaa !5
br i1 %cmp30292, label %for.cond93.preheader, label %for.cond33.preheader.lr.ph
for.cond33.preheader.lr.ph: ; preds = %for.cond29.preheader
%cmp34287 = icmp sgt i32 %.pre, 0
br i1 %cmp34287, label %for.cond33.preheader.us.preheader, label %for.end199
for.cond33.preheader.us.preheader: ; preds = %for.cond33.preheader.lr.ph
%sub69 = add nsw i32 %.pre, -1
%16 = zext i32 %sub69 to i64
%wide.trip.count344 = zext i32 %35 to i64
%wide.trip.count = zext i32 %.pre to i64
br label %for.cond33.preheader.us
for.cond33.preheader.us: ; preds = %for.cond33.preheader.us.preheader, %for.cond33.for.inc90_crit_edge.us
%indvars.iv341 = phi i64 [ 0, %for.cond33.preheader.us.preheader ], [ %indvars.iv.next342, %for.cond33.for.inc90_crit_edge.us ]
%cnt.0294.us = phi i32 [ 0, %for.cond33.preheader.us.preheader ], [ %cnt.3.us, %for.cond33.for.inc90_crit_edge.us ]
%17 = mul nuw nsw i64 %indvars.iv341, %9
%arrayidx38.us = getelementptr inbounds i32, ptr %vla1, i64 %17
%arrayidx45.us = getelementptr inbounds i32, ptr %vla2, i64 %17
br label %for.body36.us
for.body36.us: ; preds = %for.cond33.preheader.us, %for.inc87.us
%indvars.iv338 = phi i64 [ 0, %for.cond33.preheader.us ], [ %indvars.iv.next339, %for.inc87.us ]
%cnt.1290.us = phi i32 [ %cnt.0294.us, %for.cond33.preheader.us ], [ %cnt.3.us, %for.inc87.us ]
%arrayidx40.us = getelementptr inbounds i32, ptr %arrayidx38.us, i64 %indvars.iv338
%18 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5
switch i32 %18, label %if.end68.us [
i32 1, label %if.then43.us
i32 0, label %if.then65.us
]
if.then65.us: ; preds = %for.body36.us
%inc66.us = add nsw i32 %cnt.1290.us, 1
br label %if.end68.us
if.then43.us: ; preds = %for.body36.us
%arrayidx47.us = getelementptr inbounds i32, ptr %arrayidx45.us, i64 %indvars.iv338
store i32 0, ptr %arrayidx47.us, align 4, !tbaa !5
%cmp49283.us = icmp sgt i32 %cnt.1290.us, 0
br i1 %cmp49283.us, label %for.body51.us.preheader, label %if.end68.us
for.body51.us.preheader: ; preds = %if.then43.us
%19 = zext i32 %cnt.1290.us to i64
%min.iters.check422 = icmp ult i32 %cnt.1290.us, 8
br i1 %min.iters.check422, label %for.body51.us.preheader488, label %vector.ph423
vector.ph423: ; preds = %for.body51.us.preheader
%n.vec425 = and i64 %19, 4294967288
%ind.end426 = and i64 %19, 7
%broadcast.splatinsert432 = insertelement <4 x i32> poison, i32 %cnt.1290.us, i64 0
%broadcast.splat433 = shufflevector <4 x i32> %broadcast.splatinsert432, <4 x i32> poison, <4 x i32> zeroinitializer
%invariant.gep = getelementptr i32, ptr %arrayidx45.us, i64 %indvars.iv338
br label %vector.body429
vector.body429: ; preds = %vector.body429, %vector.ph423
%index430 = phi i64 [ 0, %vector.ph423 ], [ %index.next434, %vector.body429 ]
%offset.idx431.neg = sub i64 %index430, %19
%gep = getelementptr i32, ptr %invariant.gep, i64 %offset.idx431.neg
store <4 x i32> %broadcast.splat433, ptr %gep, align 4, !tbaa !5
%20 = getelementptr inbounds i32, ptr %gep, i64 4
store <4 x i32> %broadcast.splat433, ptr %20, align 4, !tbaa !5
%index.next434 = add nuw i64 %index430, 8
%21 = icmp eq i64 %index.next434, %n.vec425
br i1 %21, label %middle.block420, label %vector.body429, !llvm.loop !11
middle.block420: ; preds = %vector.body429
%cmp.n428 = icmp eq i64 %n.vec425, %19
br i1 %cmp.n428, label %if.end68.us, label %for.body51.us.preheader488
for.body51.us.preheader488: ; preds = %for.body51.us.preheader, %middle.block420
%indvars.iv330.ph = phi i64 [ %19, %for.body51.us.preheader ], [ %ind.end426, %middle.block420 ]
br label %for.body51.us
for.body51.us: ; preds = %for.body51.us.preheader488, %for.body51.us
%indvars.iv330 = phi i64 [ %indvars.iv.next331, %for.body51.us ], [ %indvars.iv330.ph, %for.body51.us.preheader488 ]
%22 = sub nsw i64 %indvars.iv338, %indvars.iv330
%arrayidx55.us = getelementptr inbounds i32, ptr %arrayidx45.us, i64 %22
store i32 %cnt.1290.us, ptr %arrayidx55.us, align 4, !tbaa !5
%indvars.iv.next331 = add nsw i64 %indvars.iv330, -1
%cmp49.us = icmp ugt i64 %indvars.iv330, 1
br i1 %cmp49.us, label %for.body51.us, label %if.end68.us, !llvm.loop !15
if.end68.us: ; preds = %for.body51.us, %middle.block420, %if.then43.us, %if.then65.us, %for.body36.us
%cnt.2.us = phi i32 [ %inc66.us, %if.then65.us ], [ %cnt.1290.us, %for.body36.us ], [ 0, %if.then43.us ], [ 0, %middle.block420 ], [ 0, %for.body51.us ]
%cmp70.us = icmp eq i64 %indvars.iv338, %16
br i1 %cmp70.us, label %for.cond74.preheader.us, label %for.inc87.us
for.inc87.us: ; preds = %for.body77.us, %middle.block, %for.cond74.preheader.us, %if.end68.us
%cnt.3.us = phi i32 [ %cnt.2.us, %if.end68.us ], [ 0, %for.cond74.preheader.us ], [ 0, %middle.block ], [ 0, %for.body77.us ]
%indvars.iv.next339 = add nuw nsw i64 %indvars.iv338, 1
%exitcond.not = icmp eq i64 %indvars.iv.next339, %wide.trip.count
br i1 %exitcond.not, label %for.cond33.for.inc90_crit_edge.us, label %for.body36.us, !llvm.loop !16
for.body77.us: ; preds = %for.body77.us.preheader487, %for.body77.us
%indvars.iv334 = phi i64 [ %indvars.iv.next335, %for.body77.us ], [ %indvars.iv334.ph, %for.body77.us.preheader487 ]
%indvars.iv.next335 = add nsw i64 %indvars.iv334, -1
%23 = sub nsw i64 %16, %indvars.iv.next335
%arrayidx82.us = getelementptr inbounds i32, ptr %arrayidx45.us, i64 %23
store i32 %cnt.2.us, ptr %arrayidx82.us, align 4, !tbaa !5
%cmp75.us = icmp ugt i64 %indvars.iv334, 1
br i1 %cmp75.us, label %for.body77.us, label %for.inc87.us, !llvm.loop !17
for.cond74.preheader.us: ; preds = %if.end68.us
%cmp75285.us = icmp sgt i32 %cnt.2.us, 0
br i1 %cmp75285.us, label %for.body77.us.preheader, label %for.inc87.us
for.body77.us.preheader: ; preds = %for.cond74.preheader.us
%24 = zext i32 %cnt.2.us to i64
%min.iters.check = icmp ult i32 %cnt.2.us, 8
br i1 %min.iters.check, label %for.body77.us.preheader487, label %vector.ph
vector.ph: ; preds = %for.body77.us.preheader
%n.vec = and i64 %24, 4294967288
%ind.end = and i64 %24, 7
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %cnt.2.us, 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 ]
%25 = xor i64 %index, -1
%26 = add i64 %25, %24
%27 = sub nsw i64 %16, %26
%28 = getelementptr inbounds i32, ptr %arrayidx45.us, i64 %27
store <4 x i32> %broadcast.splat, ptr %28, align 4, !tbaa !5
%29 = getelementptr inbounds i32, ptr %28, i64 4
store <4 x i32> %broadcast.splat, ptr %29, align 4, !tbaa !5
%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 !18
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %24
br i1 %cmp.n, label %for.inc87.us, label %for.body77.us.preheader487
for.body77.us.preheader487: ; preds = %for.body77.us.preheader, %middle.block
%indvars.iv334.ph = phi i64 [ %24, %for.body77.us.preheader ], [ %ind.end, %middle.block ]
br label %for.body77.us
for.cond33.for.inc90_crit_edge.us: ; preds = %for.inc87.us
%indvars.iv.next342 = add nuw nsw i64 %indvars.iv341, 1
%exitcond345.not = icmp eq i64 %indvars.iv.next342, %wide.trip.count344
br i1 %exitcond345.not, label %for.cond93.preheader, label %for.cond33.preheader.us, !llvm.loop !19
for.body7: ; preds = %for.body7.lr.ph, %for.body7
%indvars.iv = phi i64 [ 0, %for.body7.lr.ph ], [ %indvars.iv.next, %for.body7 ]
%arrayidx9 = getelementptr inbounds i8, ptr %arrayidx, i64 %indvars.iv
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx9)
%31 = load i8, ptr %arrayidx9, align 1, !tbaa !20
%cmp15 = icmp eq i8 %31, 35
%arrayidx20 = getelementptr inbounds i32, ptr %arrayidx22, i64 %indvars.iv
%. = zext i1 %cmp15 to i32
store i32 %., ptr %arrayidx20, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%32 = load i32, ptr %W, align 4, !tbaa !5
%33 = sext i32 %32 to i64
%cmp6 = icmp slt i64 %indvars.iv.next, %33
br i1 %cmp6, label %for.body7, label %for.end, !llvm.loop !21
for.end: ; preds = %for.body7, %for.cond5.preheader
%34 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i277 = call i32 @getc(ptr noundef %34)
%indvars.iv.next328 = add nuw nsw i64 %indvars.iv327, 1
%35 = load i32, ptr %H, align 4, !tbaa !5
%36 = sext i32 %35 to i64
%cmp = icmp slt i64 %indvars.iv.next328, %36
br i1 %cmp, label %for.cond5.preheader, label %for.cond29.preheader, !llvm.loop !22
for.cond93.preheader: ; preds = %for.cond33.for.inc90_crit_edge.us, %for.cond29.preheader
%cmp94310 = icmp slt i32 %.pre, 1
br i1 %cmp94310, label %for.cond159.preheader, label %for.cond97.preheader.lr.ph
for.cond97.preheader.lr.ph: ; preds = %for.cond93.preheader
br i1 %cmp30292, label %for.end199, label %for.cond97.preheader.us.preheader
for.cond97.preheader.us.preheader: ; preds = %for.cond97.preheader.lr.ph
%sub135 = add nsw i32 %35, -1
%37 = zext i32 %sub135 to i64
%wide.trip.count362 = zext i32 %.pre to i64
%wide.trip.count357 = zext i32 %35 to i64
%ident.check451.not = icmp eq i32 %8, 1
%ident.check.not = icmp eq i32 %8, 1
br label %for.cond97.preheader.us
for.cond97.preheader.us: ; preds = %for.cond97.preheader.us.preheader, %for.cond97.for.inc156_crit_edge.us
%indvars.iv359 = phi i64 [ 0, %for.cond97.preheader.us.preheader ], [ %indvars.iv.next360, %for.cond97.for.inc156_crit_edge.us ]
%cnt.4312.us = phi i32 [ 0, %for.cond97.preheader.us.preheader ], [ %cnt.7.us, %for.cond97.for.inc156_crit_edge.us ]
%invariant.gep306.us = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv359
%invariant.gep308.us = getelementptr i32, ptr %vla3, i64 %indvars.iv359
br label %for.body100.us
for.body100.us: ; preds = %for.cond97.preheader.us, %for.inc153.us
%indvars.iv354 = phi i64 [ 0, %for.cond97.preheader.us ], [ %indvars.iv.next355, %for.inc153.us ]
%cnt.5304.us = phi i32 [ %cnt.4312.us, %for.cond97.preheader.us ], [ %cnt.7.us, %for.inc153.us ]
%38 = mul nuw nsw i64 %indvars.iv354, %9
%gep307.us = getelementptr inbounds i32, ptr %invariant.gep306.us, i64 %38
%39 = load i32, ptr %gep307.us, align 4, !tbaa !5
switch i32 %39, label %if.end134.us [
i32 1, label %if.then107.us
i32 0, label %if.then131.us
]
if.then131.us: ; preds = %for.body100.us
%inc132.us = add nsw i32 %cnt.5304.us, 1
br label %if.end134.us
if.then107.us: ; preds = %for.body100.us
%gep309.us = getelementptr inbounds i32, ptr %invariant.gep308.us, i64 %38
store i32 0, ptr %gep309.us, align 4, !tbaa !5
%cmp113295.us = icmp sgt i32 %cnt.5304.us, 0
br i1 %cmp113295.us, label %for.body115.us.preheader, label %if.end134.us
for.body115.us.preheader: ; preds = %if.then107.us
%40 = zext i32 %cnt.5304.us to i64
%min.iters.check454 = icmp ugt i32 %cnt.5304.us, 7
%or.cond = select i1 %min.iters.check454, i1 %ident.check451.not, i1 false
br i1 %or.cond, label %vector.ph455, label %for.body115.us.preheader486
vector.ph455: ; preds = %for.body115.us.preheader
%n.vec457 = and i64 %40, 4294967288
%ind.end458 = and i64 %40, 7
%broadcast.splatinsert464 = insertelement <4 x i32> poison, i32 %cnt.5304.us, i64 0
%broadcast.splat465 = shufflevector <4 x i32> %broadcast.splatinsert464, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body461
vector.body461: ; preds = %vector.body461, %vector.ph455
%index462 = phi i64 [ 0, %vector.ph455 ], [ %index.next466, %vector.body461 ]
%offset.idx463.neg = sub i64 %index462, %40
%41 = add i64 %offset.idx463.neg, %indvars.iv354
%42 = mul nsw i64 %41, %9
%43 = getelementptr i32, ptr %invariant.gep308.us, i64 %42
store <4 x i32> %broadcast.splat465, ptr %43, align 4, !tbaa !5
%44 = getelementptr i32, ptr %43, i64 4
store <4 x i32> %broadcast.splat465, ptr %44, align 4, !tbaa !5
%index.next466 = add nuw i64 %index462, 8
%45 = icmp eq i64 %index.next466, %n.vec457
br i1 %45, label %middle.block452, label %vector.body461, !llvm.loop !23
middle.block452: ; preds = %vector.body461
%cmp.n460 = icmp eq i64 %n.vec457, %40
br i1 %cmp.n460, label %if.end134.us, label %for.body115.us.preheader486
for.body115.us.preheader486: ; preds = %for.body115.us.preheader, %middle.block452
%indvars.iv346.ph = phi i64 [ %40, %for.body115.us.preheader ], [ %ind.end458, %middle.block452 ]
br label %for.body115.us
for.body115.us: ; preds = %for.body115.us.preheader486, %for.body115.us
%indvars.iv346 = phi i64 [ %indvars.iv.next347, %for.body115.us ], [ %indvars.iv346.ph, %for.body115.us.preheader486 ]
%46 = sub nsw i64 %indvars.iv354, %indvars.iv346
%47 = mul nsw i64 %46, %9
%gep.us = getelementptr i32, ptr %invariant.gep308.us, i64 %47
store i32 %cnt.5304.us, ptr %gep.us, align 4, !tbaa !5
%indvars.iv.next347 = add nsw i64 %indvars.iv346, -1
%cmp113.us = icmp ugt i64 %indvars.iv346, 1
br i1 %cmp113.us, label %for.body115.us, label %if.end134.us, !llvm.loop !24
if.end134.us: ; preds = %for.body115.us, %middle.block452, %if.then107.us, %if.then131.us, %for.body100.us
%cnt.6.us = phi i32 [ %inc132.us, %if.then131.us ], [ %cnt.5304.us, %for.body100.us ], [ 0, %if.then107.us ], [ 0, %middle.block452 ], [ 0, %for.body115.us ]
%cmp136.us = icmp eq i64 %indvars.iv354, %37
br i1 %cmp136.us, label %for.cond140.preheader.us, label %for.inc153.us
for.inc153.us: ; preds = %for.body143.us, %middle.block435, %for.cond140.preheader.us, %if.end134.us
%cnt.7.us = phi i32 [ %cnt.6.us, %if.end134.us ], [ 0, %for.cond140.preheader.us ], [ 0, %middle.block435 ], [ 0, %for.body143.us ]
%indvars.iv.next355 = add nuw nsw i64 %indvars.iv354, 1
%exitcond358.not = icmp eq i64 %indvars.iv.next355, %wide.trip.count357
br i1 %exitcond358.not, label %for.cond97.for.inc156_crit_edge.us, label %for.body100.us, !llvm.loop !25
for.body143.us: ; preds = %for.body143.us.preheader485, %for.body143.us
%indvars.iv350 = phi i64 [ %indvars.iv.next351, %for.body143.us ], [ %indvars.iv350.ph, %for.body143.us.preheader485 ]
%indvars.iv.next351 = add nsw i64 %indvars.iv350, -1
%48 = sub nsw i64 %37, %indvars.iv.next351
%49 = mul nsw i64 %48, %9
%gep298.us = getelementptr i32, ptr %invariant.gep308.us, i64 %49
store i32 %cnt.6.us, ptr %gep298.us, align 4, !tbaa !5
%cmp141.us = icmp ugt i64 %indvars.iv350, 1
br i1 %cmp141.us, label %for.body143.us, label %for.inc153.us, !llvm.loop !26
for.cond140.preheader.us: ; preds = %if.end134.us
%cmp141299.us = icmp sgt i32 %cnt.6.us, 0
br i1 %cmp141299.us, label %for.body143.us.preheader, label %for.inc153.us
for.body143.us.preheader: ; preds = %for.cond140.preheader.us
%50 = zext i32 %cnt.6.us to i64
%min.iters.check437 = icmp ugt i32 %cnt.6.us, 7
%or.cond482 = select i1 %min.iters.check437, i1 %ident.check.not, i1 false
br i1 %or.cond482, label %vector.ph438, label %for.body143.us.preheader485
vector.ph438: ; preds = %for.body143.us.preheader
%n.vec440 = and i64 %50, 4294967288
%ind.end441 = and i64 %50, 7
%broadcast.splatinsert447 = insertelement <4 x i32> poison, i32 %cnt.6.us, i64 0
%broadcast.splat448 = shufflevector <4 x i32> %broadcast.splatinsert447, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body444
vector.body444: ; preds = %vector.body444, %vector.ph438
%index445 = phi i64 [ 0, %vector.ph438 ], [ %index.next449, %vector.body444 ]
%51 = xor i64 %index445, -1
%52 = add i64 %51, %50
%53 = sub nsw i64 %37, %52
%54 = mul nsw i64 %53, %9
%55 = getelementptr i32, ptr %invariant.gep308.us, i64 %54
store <4 x i32> %broadcast.splat448, ptr %55, align 4, !tbaa !5
%56 = getelementptr i32, ptr %55, i64 4
store <4 x i32> %broadcast.splat448, ptr %56, align 4, !tbaa !5
%index.next449 = add nuw i64 %index445, 8
%57 = icmp eq i64 %index.next449, %n.vec440
br i1 %57, label %middle.block435, label %vector.body444, !llvm.loop !27
middle.block435: ; preds = %vector.body444
%cmp.n443 = icmp eq i64 %n.vec440, %50
br i1 %cmp.n443, label %for.inc153.us, label %for.body143.us.preheader485
for.body143.us.preheader485: ; preds = %for.body143.us.preheader, %middle.block435
%indvars.iv350.ph = phi i64 [ %50, %for.body143.us.preheader ], [ %ind.end441, %middle.block435 ]
br label %for.body143.us
for.cond97.for.inc156_crit_edge.us: ; preds = %for.inc153.us
%indvars.iv.next360 = add nuw nsw i64 %indvars.iv359, 1
%exitcond363.not = icmp eq i64 %indvars.iv.next360, %wide.trip.count362
br i1 %exitcond363.not, label %for.cond159.preheader, label %for.cond97.preheader.us, !llvm.loop !28
for.cond159.preheader: ; preds = %for.cond97.for.inc156_crit_edge.us, %for.cond93.preheader
%brmerge = or i1 %cmp30292, %cmp94310
br i1 %brmerge, label %for.end199, label %for.cond163.preheader.us.preheader
for.cond163.preheader.us.preheader: ; preds = %for.cond159.preheader
%wide.trip.count372 = zext i32 %35 to i64
%wide.trip.count367 = zext i32 %.pre to i64
%min.iters.check469 = icmp ult i32 %.pre, 8
%n.vec472 = and i64 %wide.trip.count367, 4294967288
%cmp.n474 = icmp eq i64 %n.vec472, %wide.trip.count367
br label %for.cond163.preheader.us
for.cond163.preheader.us: ; preds = %for.cond163.preheader.us.preheader, %for.cond163.for.inc197_crit_edge.us
%indvars.iv369 = phi i64 [ 0, %for.cond163.preheader.us.preheader ], [ %indvars.iv.next370, %for.cond163.for.inc197_crit_edge.us ]
%max.0320.us = phi i32 [ 0, %for.cond163.preheader.us.preheader ], [ %max.2.us.lcssa, %for.cond163.for.inc197_crit_edge.us ]
%58 = mul nuw nsw i64 %indvars.iv369, %9
%arrayidx168.us = getelementptr inbounds i32, ptr %vla2, i64 %58
%arrayidx172.us = getelementptr inbounds i32, ptr %vla3, i64 %58
br i1 %min.iters.check469, label %for.body166.us.preheader, label %vector.ph470
vector.ph470: ; preds = %for.cond163.preheader.us
%minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %max.0320.us, i64 0
%minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body475
vector.body475: ; preds = %vector.body475, %vector.ph470
%index476 = phi i64 [ 0, %vector.ph470 ], [ %index.next481, %vector.body475 ]
%vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph470 ], [ %75, %vector.body475 ]
%vec.phi477 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph470 ], [ %76, %vector.body475 ]
%59 = getelementptr inbounds i32, ptr %arrayidx168.us, i64 %index476
%wide.load = load <4 x i32>, ptr %59, align 4, !tbaa !5
%60 = getelementptr inbounds i32, ptr %59, i64 4
%wide.load478 = load <4 x i32>, ptr %60, align 4, !tbaa !5
%61 = getelementptr inbounds i32, ptr %arrayidx172.us, i64 %index476
%wide.load479 = load <4 x i32>, ptr %61, align 4, !tbaa !5
%62 = getelementptr inbounds i32, ptr %61, i64 4
%wide.load480 = load <4 x i32>, ptr %62, align 4, !tbaa !5
%63 = add nsw <4 x i32> %wide.load479, %wide.load
%64 = add nsw <4 x i32> %wide.load480, %wide.load478
%65 = icmp sgt <4 x i32> %wide.load, zeroinitializer
%66 = icmp sgt <4 x i32> %wide.load478, zeroinitializer
%67 = icmp sgt <4 x i32> %wide.load479, zeroinitializer
%68 = icmp sgt <4 x i32> %wide.load480, zeroinitializer
%69 = select <4 x i1> %65, <4 x i1> %67, <4 x i1> zeroinitializer
%70 = select <4 x i1> %66, <4 x i1> %68, <4 x i1> zeroinitializer
%71 = sext <4 x i1> %69 to <4 x i32>
%72 = sext <4 x i1> %70 to <4 x i32>
%73 = add nsw <4 x i32> %63, %71
%74 = add nsw <4 x i32> %64, %72
%75 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %73, <4 x i32> %vec.phi)
%76 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %74, <4 x i32> %vec.phi477)
%index.next481 = add nuw i64 %index476, 8
%77 = icmp eq i64 %index.next481, %n.vec472
br i1 %77, label %middle.block467, label %vector.body475, !llvm.loop !29
middle.block467: ; preds = %vector.body475
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %75, <4 x i32> %76)
%78 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
br i1 %cmp.n474, label %for.cond163.for.inc197_crit_edge.us, label %for.body166.us.preheader
for.body166.us.preheader: ; preds = %for.cond163.preheader.us, %middle.block467
%indvars.iv364.ph = phi i64 [ 0, %for.cond163.preheader.us ], [ %n.vec472, %middle.block467 ]
%max.1316.us.ph = phi i32 [ %max.0320.us, %for.cond163.preheader.us ], [ %78, %middle.block467 ]
br label %for.body166.us
for.body166.us: ; preds = %for.body166.us.preheader, %for.body166.us
%indvars.iv364 = phi i64 [ %indvars.iv.next365, %for.body166.us ], [ %indvars.iv364.ph, %for.body166.us.preheader ]
%max.1316.us = phi i32 [ %max.2.us, %for.body166.us ], [ %max.1316.us.ph, %for.body166.us.preheader ]
%arrayidx170.us = getelementptr inbounds i32, ptr %arrayidx168.us, i64 %indvars.iv364
%79 = load i32, ptr %arrayidx170.us, align 4, !tbaa !5
%arrayidx174.us = getelementptr inbounds i32, ptr %arrayidx172.us, i64 %indvars.iv364
%80 = load i32, ptr %arrayidx174.us, align 4, !tbaa !5
%add.us = add nsw i32 %80, %79
%cmp179.us = icmp sgt i32 %79, 0
%cmp185.us = icmp sgt i32 %80, 0
%or.cond.us = select i1 %cmp179.us, i1 %cmp185.us, i1 false
%sub188.us = sext i1 %or.cond.us to i32
%temp.0.us = add nsw i32 %add.us, %sub188.us
%max.2.us = call i32 @llvm.smax.i32(i32 %temp.0.us, i32 %max.1316.us)
%indvars.iv.next365 = add nuw nsw i64 %indvars.iv364, 1
%exitcond368.not = icmp eq i64 %indvars.iv.next365, %wide.trip.count367
br i1 %exitcond368.not, label %for.cond163.for.inc197_crit_edge.us, label %for.body166.us, !llvm.loop !30
for.cond163.for.inc197_crit_edge.us: ; preds = %for.body166.us, %middle.block467
%max.2.us.lcssa = phi i32 [ %78, %middle.block467 ], [ %max.2.us, %for.body166.us ]
%indvars.iv.next370 = add nuw nsw i64 %indvars.iv369, 1
%exitcond373.not = icmp eq i64 %indvars.iv.next370, %wide.trip.count372
br i1 %exitcond373.not, label %for.end199, label %for.cond163.preheader.us, !llvm.loop !31
for.end199: ; preds = %for.cond163.for.inc197_crit_edge.us, %for.cond159.preheader, %entry, %for.cond97.preheader.lr.ph, %for.cond33.preheader.lr.ph
%max.0.lcssa = phi i32 [ 0, %for.cond159.preheader ], [ 0, %for.cond33.preheader.lr.ph ], [ 0, %for.cond97.preheader.lr.ph ], [ 0, %entry ], [ %max.2.us.lcssa, %for.cond163.for.inc197_crit_edge.us ]
%call200 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %max.0.lcssa)
call void @llvm.stackrestore.p0(ptr %4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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: 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 @getc(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; 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 = { 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 = !{!"any pointer", !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}
!17 = distinct !{!17, !12, !14, !13}
!18 = distinct !{!18, !12, !13, !14}
!19 = distinct !{!19, !12}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12, !13, !14}
!24 = distinct !{!24, !12, !13}
!25 = distinct !{!25, !12}
!26 = distinct !{!26, !12, !13}
!27 = distinct !{!27, !12, !13, !14}
!28 = distinct !{!28, !12}
!29 = distinct !{!29, !12, !13, !14}
!30 = distinct !{!30, !12, !14, !13}
!31 = distinct !{!31, !12}
|
//
// main.c
// Surrounding Area
//
// Created by x15071xx on 2016/06/22.
// Copyright ?? 2016??´ AIT. All rights reserved.
//
#include <stdio.h>
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
void paint (char field[51][51],int x,int y,char S,int h,int w) {
int i;
if (S == 'W') {
for (i=0; i<4; i++) {
if (y+dy[i] >= 0 && y+dy[i] < h && x+dx[i] >= 0 && x+dx[i] < w && field[y+dy[i]][x+dx[i]] == '.') {
field[y+dy[i]][x+dx[i]] = 'w';
paint(field, x+dx[i], y+dy[i], 'W', h, w);
}
}
} else if (S=='B'){
for (i=0; i<4; i++) {
if (y+dy[i] >= 0 && y+dy[i] < h && x+dx[i] >= 0 && x+dx[i] < w ) {
if (field[y+dy[i]][x+dx[i]] == 'w') {
field[y+dy[i]][x+dx[i]] = 'x';
paint(field, x+dx[i], y+dy[i], 'B', h, w);
} else if (field[y+dy[i]][x+dx[i]] == '.'){
field[y+dy[i]][x+dx[i]] = 'b';
paint(field, x+dx[i], y+dy[i], 'B', h, w);
}
}
}
}
}
int main(int argc, const char * argv[]) {
int i,j,k;
while (1) {
char field[51][51];
int w,h,b;
int count_w=0,count_b=0;
for (i=0; i<50; i++) {
for (j=0; j<50; j++) {
field[i][j] = 0;
}
}
scanf("%d %d",&w,&h);
if (w==0&&h==0) {
break;
}
for (i=0; i<h; i++) {
scanf("%s",field[i]);
}
for (i=0; i<h; i++) {
for (j=0; j<w; j++) {
if (field[i][j] == 'W') {
paint(field, j, i, 'W', h, w);
}
}
}
for (i=0; i<h; i++) {
for (j=0; j<w; j++) {
if (field[i][j] == 'B') {
paint(field, j, i, 'B', h, w);
}
}
}
for (i=0; i<h; i++) {
for (j=0; j<w; j++) {
if (field[i][j] == 'w') {
count_w++;
} else if (field[i][j] == 'b') {
count_b++;
}
}
}
printf("%d %d\n",count_b,count_w);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143261/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143261/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"
@dx = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 0, i32 -1, i32 0], align 16
@dy = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 1, i32 0, i32 -1], align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\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 @paint(ptr noundef %field, i32 noundef %x, i32 noundef %y, i8 noundef signext %S, i32 noundef %h, i32 noundef %w) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end154.sink.split, %entry
%x.tr = phi i32 [ %x, %entry ], [ %add143.3, %if.end154.sink.split ]
%y.tr = phi i32 [ %y, %entry ], [ %add146.3, %if.end154.sink.split ]
switch i8 %S, label %if.end154 [
i8 87, label %for.body.preheader
i8 66, label %for.body61.preheader
]
for.body61.preheader: ; preds = %tailrecurse
%0 = load i32, ptr @dy, align 16, !tbaa !5
%add64 = add nsw i32 %0, %y.tr
%cmp65 = icmp sgt i32 %add64, -1
%cmp71 = icmp slt i32 %add64, %h
%or.cond226 = and i1 %cmp65, %cmp71
br i1 %or.cond226, label %land.lhs.true73, label %for.inc150
for.body.preheader: ; preds = %tailrecurse
%1 = load i32, ptr @dy, align 16, !tbaa !5
%add = add nsw i32 %1, %y.tr
%cmp4 = icmp sgt i32 %add, -1
%cmp9 = icmp slt i32 %add, %h
%or.cond = and i1 %cmp4, %cmp9
br i1 %or.cond, label %land.lhs.true11, label %for.inc
land.lhs.true11: ; preds = %for.body.preheader
%2 = load i32, ptr @dx, align 16, !tbaa !5
%add14 = add nsw i32 %2, %x.tr
%cmp15 = icmp sgt i32 %add14, -1
%cmp21 = icmp slt i32 %add14, %w
%or.cond225 = and i1 %cmp15, %cmp21
br i1 %or.cond225, label %land.lhs.true23, label %for.inc
land.lhs.true23: ; preds = %land.lhs.true11
%idxprom27 = zext i32 %add to i64
%idxprom32 = zext i32 %add14 to i64
%arrayidx33 = getelementptr inbounds [51 x i8], ptr %field, i64 %idxprom27, i64 %idxprom32
%3 = load i8, ptr %arrayidx33, align 1, !tbaa !9
%cmp35 = icmp eq i8 %3, 46
br i1 %cmp35, label %if.then37, label %for.inc
if.then37: ; preds = %land.lhs.true23
store i8 119, ptr %arrayidx33, align 1, !tbaa !9
%4 = load i32, ptr @dx, align 16, !tbaa !5
%add50 = add nsw i32 %4, %x.tr
%5 = load i32, ptr @dy, align 16, !tbaa !5
%add53 = add nsw i32 %5, %y.tr
tail call void @paint(ptr noundef nonnull %field, i32 noundef %add50, i32 noundef %add53, i8 noundef signext 87, i32 noundef %h, i32 noundef %w)
br label %for.inc
for.inc: ; preds = %for.body.preheader, %land.lhs.true11, %land.lhs.true23, %if.then37
%6 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 1), align 4, !tbaa !5
%add.1 = add nsw i32 %6, %y.tr
%cmp4.1 = icmp sgt i32 %add.1, -1
%cmp9.1 = icmp slt i32 %add.1, %h
%or.cond.1 = and i1 %cmp4.1, %cmp9.1
br i1 %or.cond.1, label %land.lhs.true11.1, label %for.inc.1
land.lhs.true11.1: ; preds = %for.inc
%7 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 1), align 4, !tbaa !5
%add14.1 = add nsw i32 %7, %x.tr
%cmp15.1 = icmp sgt i32 %add14.1, -1
%cmp21.1 = icmp slt i32 %add14.1, %w
%or.cond225.1 = and i1 %cmp15.1, %cmp21.1
br i1 %or.cond225.1, label %land.lhs.true23.1, label %for.inc.1
land.lhs.true23.1: ; preds = %land.lhs.true11.1
%idxprom27.1 = zext i32 %add.1 to i64
%idxprom32.1 = zext i32 %add14.1 to i64
%arrayidx33.1 = getelementptr inbounds [51 x i8], ptr %field, i64 %idxprom27.1, i64 %idxprom32.1
%8 = load i8, ptr %arrayidx33.1, align 1, !tbaa !9
%cmp35.1 = icmp eq i8 %8, 46
br i1 %cmp35.1, label %if.then37.1, label %for.inc.1
if.then37.1: ; preds = %land.lhs.true23.1
store i8 119, ptr %arrayidx33.1, align 1, !tbaa !9
%9 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 1), align 4, !tbaa !5
%add50.1 = add nsw i32 %9, %x.tr
%10 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 1), align 4, !tbaa !5
%add53.1 = add nsw i32 %10, %y.tr
tail call void @paint(ptr noundef nonnull %field, i32 noundef %add50.1, i32 noundef %add53.1, i8 noundef signext 87, i32 noundef %h, i32 noundef %w)
br label %for.inc.1
for.inc.1: ; preds = %if.then37.1, %land.lhs.true23.1, %land.lhs.true11.1, %for.inc
%11 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 2), align 8, !tbaa !5
%add.2 = add nsw i32 %11, %y.tr
%cmp4.2 = icmp sgt i32 %add.2, -1
%cmp9.2 = icmp slt i32 %add.2, %h
%or.cond.2 = and i1 %cmp4.2, %cmp9.2
br i1 %or.cond.2, label %land.lhs.true11.2, label %for.inc.2
land.lhs.true11.2: ; preds = %for.inc.1
%12 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 2), align 8, !tbaa !5
%add14.2 = add nsw i32 %12, %x.tr
%cmp15.2 = icmp sgt i32 %add14.2, -1
%cmp21.2 = icmp slt i32 %add14.2, %w
%or.cond225.2 = and i1 %cmp15.2, %cmp21.2
br i1 %or.cond225.2, label %land.lhs.true23.2, label %for.inc.2
land.lhs.true23.2: ; preds = %land.lhs.true11.2
%idxprom27.2 = zext i32 %add.2 to i64
%idxprom32.2 = zext i32 %add14.2 to i64
%arrayidx33.2 = getelementptr inbounds [51 x i8], ptr %field, i64 %idxprom27.2, i64 %idxprom32.2
%13 = load i8, ptr %arrayidx33.2, align 1, !tbaa !9
%cmp35.2 = icmp eq i8 %13, 46
br i1 %cmp35.2, label %if.then37.2, label %for.inc.2
if.then37.2: ; preds = %land.lhs.true23.2
store i8 119, ptr %arrayidx33.2, align 1, !tbaa !9
%14 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 2), align 8, !tbaa !5
%add50.2 = add nsw i32 %14, %x.tr
%15 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 2), align 8, !tbaa !5
%add53.2 = add nsw i32 %15, %y.tr
tail call void @paint(ptr noundef nonnull %field, i32 noundef %add50.2, i32 noundef %add53.2, i8 noundef signext 87, i32 noundef %h, i32 noundef %w)
br label %for.inc.2
for.inc.2: ; preds = %if.then37.2, %land.lhs.true23.2, %land.lhs.true11.2, %for.inc.1
%16 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 3), align 4, !tbaa !5
%add.3 = add nsw i32 %16, %y.tr
%cmp4.3 = icmp sgt i32 %add.3, -1
%cmp9.3 = icmp slt i32 %add.3, %h
%or.cond.3 = and i1 %cmp4.3, %cmp9.3
br i1 %or.cond.3, label %land.lhs.true11.3, label %if.end154
land.lhs.true11.3: ; preds = %for.inc.2
%17 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 3), align 4, !tbaa !5
%add14.3 = add nsw i32 %17, %x.tr
%cmp15.3 = icmp sgt i32 %add14.3, -1
%cmp21.3 = icmp slt i32 %add14.3, %w
%or.cond225.3 = and i1 %cmp15.3, %cmp21.3
br i1 %or.cond225.3, label %land.lhs.true23.3, label %if.end154
land.lhs.true23.3: ; preds = %land.lhs.true11.3
%idxprom27.3 = zext i32 %add.3 to i64
%idxprom32.3 = zext i32 %add14.3 to i64
%arrayidx33.3 = getelementptr inbounds [51 x i8], ptr %field, i64 %idxprom27.3, i64 %idxprom32.3
%18 = load i8, ptr %arrayidx33.3, align 1, !tbaa !9
%cmp35.3 = icmp eq i8 %18, 46
br i1 %cmp35.3, label %if.then37.3, label %if.end154
if.then37.3: ; preds = %land.lhs.true23.3
store i8 119, ptr %arrayidx33.3, align 1, !tbaa !9
br label %if.end154.sink.split
land.lhs.true73: ; preds = %for.body61.preheader
%19 = load i32, ptr @dx, align 16, !tbaa !5
%add76 = add nsw i32 %19, %x.tr
%cmp77 = icmp sgt i32 %add76, -1
%cmp83 = icmp slt i32 %add76, %w
%or.cond227 = and i1 %cmp77, %cmp83
br i1 %or.cond227, label %if.then85, label %for.inc150
if.then85: ; preds = %land.lhs.true73
%idxprom89 = zext i32 %add64 to i64
%idxprom94 = zext i32 %add76 to i64
%arrayidx95 = getelementptr inbounds [51 x i8], ptr %field, i64 %idxprom89, i64 %idxprom94
%20 = load i8, ptr %arrayidx95, align 1, !tbaa !9
switch i8 %20, label %for.inc150 [
i8 119, label %for.inc150.sink.split
i8 46, label %if.then130
]
if.then130: ; preds = %if.then85
br label %for.inc150.sink.split
for.inc150.sink.split: ; preds = %if.then85, %if.then130
%.sink = phi i8 [ 98, %if.then130 ], [ 120, %if.then85 ]
store i8 %.sink, ptr %arrayidx95, align 1, !tbaa !9
%21 = load i32, ptr @dx, align 16, !tbaa !5
%add143 = add nsw i32 %21, %x.tr
%22 = load i32, ptr @dy, align 16, !tbaa !5
%add146 = add nsw i32 %22, %y.tr
tail call void @paint(ptr noundef nonnull %field, i32 noundef %add143, i32 noundef %add146, i8 noundef signext 66, i32 noundef %h, i32 noundef %w)
br label %for.inc150
for.inc150: ; preds = %for.inc150.sink.split, %if.then85, %for.body61.preheader, %land.lhs.true73
%23 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 1), align 4, !tbaa !5
%add64.1 = add nsw i32 %23, %y.tr
%cmp65.1 = icmp sgt i32 %add64.1, -1
%cmp71.1 = icmp slt i32 %add64.1, %h
%or.cond226.1 = and i1 %cmp65.1, %cmp71.1
br i1 %or.cond226.1, label %land.lhs.true73.1, label %for.inc150.1
land.lhs.true73.1: ; preds = %for.inc150
%24 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 1), align 4, !tbaa !5
%add76.1 = add nsw i32 %24, %x.tr
%cmp77.1 = icmp sgt i32 %add76.1, -1
%cmp83.1 = icmp slt i32 %add76.1, %w
%or.cond227.1 = and i1 %cmp77.1, %cmp83.1
br i1 %or.cond227.1, label %if.then85.1, label %for.inc150.1
if.then85.1: ; preds = %land.lhs.true73.1
%idxprom89.1 = zext i32 %add64.1 to i64
%idxprom94.1 = zext i32 %add76.1 to i64
%arrayidx95.1 = getelementptr inbounds [51 x i8], ptr %field, i64 %idxprom89.1, i64 %idxprom94.1
%25 = load i8, ptr %arrayidx95.1, align 1, !tbaa !9
switch i8 %25, label %for.inc150.1 [
i8 119, label %if.then99.1
i8 46, label %for.inc150.1.sink.split
]
if.then99.1: ; preds = %if.then85.1
br label %for.inc150.1.sink.split
for.inc150.1.sink.split: ; preds = %if.then85.1, %if.then99.1
%.sink236 = phi i8 [ 120, %if.then99.1 ], [ 98, %if.then85.1 ]
store i8 %.sink236, ptr %arrayidx95.1, align 1, !tbaa !9
%26 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 1), align 4, !tbaa !5
%add112.1 = add nsw i32 %26, %x.tr
%27 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 1), align 4, !tbaa !5
%add115.1 = add nsw i32 %27, %y.tr
tail call void @paint(ptr noundef nonnull %field, i32 noundef %add112.1, i32 noundef %add115.1, i8 noundef signext 66, i32 noundef %h, i32 noundef %w)
br label %for.inc150.1
for.inc150.1: ; preds = %for.inc150.1.sink.split, %if.then85.1, %land.lhs.true73.1, %for.inc150
%28 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 2), align 8, !tbaa !5
%add64.2 = add nsw i32 %28, %y.tr
%cmp65.2 = icmp sgt i32 %add64.2, -1
%cmp71.2 = icmp slt i32 %add64.2, %h
%or.cond226.2 = and i1 %cmp65.2, %cmp71.2
br i1 %or.cond226.2, label %land.lhs.true73.2, label %for.inc150.2
land.lhs.true73.2: ; preds = %for.inc150.1
%29 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 2), align 8, !tbaa !5
%add76.2 = add nsw i32 %29, %x.tr
%cmp77.2 = icmp sgt i32 %add76.2, -1
%cmp83.2 = icmp slt i32 %add76.2, %w
%or.cond227.2 = and i1 %cmp77.2, %cmp83.2
br i1 %or.cond227.2, label %if.then85.2, label %for.inc150.2
if.then85.2: ; preds = %land.lhs.true73.2
%idxprom89.2 = zext i32 %add64.2 to i64
%idxprom94.2 = zext i32 %add76.2 to i64
%arrayidx95.2 = getelementptr inbounds [51 x i8], ptr %field, i64 %idxprom89.2, i64 %idxprom94.2
%30 = load i8, ptr %arrayidx95.2, align 1, !tbaa !9
switch i8 %30, label %for.inc150.2 [
i8 119, label %if.then99.2
i8 46, label %for.inc150.2.sink.split
]
if.then99.2: ; preds = %if.then85.2
br label %for.inc150.2.sink.split
for.inc150.2.sink.split: ; preds = %if.then85.2, %if.then99.2
%.sink239 = phi i8 [ 120, %if.then99.2 ], [ 98, %if.then85.2 ]
store i8 %.sink239, ptr %arrayidx95.2, align 1, !tbaa !9
%31 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 2), align 8, !tbaa !5
%add112.2 = add nsw i32 %31, %x.tr
%32 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 2), align 8, !tbaa !5
%add115.2 = add nsw i32 %32, %y.tr
tail call void @paint(ptr noundef nonnull %field, i32 noundef %add112.2, i32 noundef %add115.2, i8 noundef signext 66, i32 noundef %h, i32 noundef %w)
br label %for.inc150.2
for.inc150.2: ; preds = %for.inc150.2.sink.split, %if.then85.2, %land.lhs.true73.2, %for.inc150.1
%33 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 3), align 4, !tbaa !5
%add64.3 = add nsw i32 %33, %y.tr
%cmp65.3 = icmp sgt i32 %add64.3, -1
%cmp71.3 = icmp slt i32 %add64.3, %h
%or.cond226.3 = and i1 %cmp65.3, %cmp71.3
br i1 %or.cond226.3, label %land.lhs.true73.3, label %if.end154
land.lhs.true73.3: ; preds = %for.inc150.2
%34 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 3), align 4, !tbaa !5
%add76.3 = add nsw i32 %34, %x.tr
%cmp77.3 = icmp sgt i32 %add76.3, -1
%cmp83.3 = icmp slt i32 %add76.3, %w
%or.cond227.3 = and i1 %cmp77.3, %cmp83.3
br i1 %or.cond227.3, label %if.then85.3, label %if.end154
if.then85.3: ; preds = %land.lhs.true73.3
%idxprom89.3 = zext i32 %add64.3 to i64
%idxprom94.3 = zext i32 %add76.3 to i64
%arrayidx95.3 = getelementptr inbounds [51 x i8], ptr %field, i64 %idxprom89.3, i64 %idxprom94.3
%35 = load i8, ptr %arrayidx95.3, align 1, !tbaa !9
switch i8 %35, label %if.end154 [
i8 119, label %if.then99.3
i8 46, label %if.then130.3
]
if.then130.3: ; preds = %if.then85.3
store i8 98, ptr %arrayidx95.3, align 1, !tbaa !9
br label %if.end154.sink.split
if.then99.3: ; preds = %if.then85.3
store i8 120, ptr %arrayidx95.3, align 1, !tbaa !9
br label %if.end154.sink.split
if.end154.sink.split: ; preds = %if.then37.3, %if.then99.3, %if.then130.3
%36 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 3), align 4, !tbaa !5
%add143.3 = add nsw i32 %36, %x.tr
%37 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 3), align 4, !tbaa !5
%add146.3 = add nsw i32 %37, %y.tr
br label %tailrecurse
if.end154: ; preds = %for.inc150.2, %land.lhs.true73.3, %if.then85.3, %for.inc.2, %land.lhs.true11.3, %land.lhs.true23.3, %tailrecurse
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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #2 {
entry:
%field = alloca [51 x [51 x i8]], align 16
%w = alloca i32, align 4
%h = alloca i32, align 4
%scevgep.1 = getelementptr inbounds i8, ptr %field, i64 51
%scevgep.2 = getelementptr inbounds i8, ptr %field, i64 102
%scevgep.3 = getelementptr inbounds i8, ptr %field, i64 153
%scevgep.4 = getelementptr inbounds i8, ptr %field, i64 204
%scevgep.5 = getelementptr inbounds i8, ptr %field, i64 255
%scevgep.6 = getelementptr inbounds i8, ptr %field, i64 306
%scevgep.7 = getelementptr inbounds i8, ptr %field, i64 357
%scevgep.8 = getelementptr inbounds i8, ptr %field, i64 408
%scevgep.9 = getelementptr inbounds i8, ptr %field, i64 459
%scevgep.10 = getelementptr inbounds i8, ptr %field, i64 510
%scevgep.11 = getelementptr inbounds i8, ptr %field, i64 561
%scevgep.12 = getelementptr inbounds i8, ptr %field, i64 612
%scevgep.13 = getelementptr inbounds i8, ptr %field, i64 663
%scevgep.14 = getelementptr inbounds i8, ptr %field, i64 714
%scevgep.15 = getelementptr inbounds i8, ptr %field, i64 765
%scevgep.16 = getelementptr inbounds i8, ptr %field, i64 816
%scevgep.17 = getelementptr inbounds i8, ptr %field, i64 867
%scevgep.18 = getelementptr inbounds i8, ptr %field, i64 918
%scevgep.19 = getelementptr inbounds i8, ptr %field, i64 969
%scevgep.20 = getelementptr inbounds i8, ptr %field, i64 1020
%scevgep.21 = getelementptr inbounds i8, ptr %field, i64 1071
%scevgep.22 = getelementptr inbounds i8, ptr %field, i64 1122
%scevgep.23 = getelementptr inbounds i8, ptr %field, i64 1173
%scevgep.24 = getelementptr inbounds i8, ptr %field, i64 1224
%scevgep.25 = getelementptr inbounds i8, ptr %field, i64 1275
%scevgep.26 = getelementptr inbounds i8, ptr %field, i64 1326
%scevgep.27 = getelementptr inbounds i8, ptr %field, i64 1377
%scevgep.28 = getelementptr inbounds i8, ptr %field, i64 1428
%scevgep.29 = getelementptr inbounds i8, ptr %field, i64 1479
%scevgep.30 = getelementptr inbounds i8, ptr %field, i64 1530
%scevgep.31 = getelementptr inbounds i8, ptr %field, i64 1581
%scevgep.32 = getelementptr inbounds i8, ptr %field, i64 1632
%scevgep.33 = getelementptr inbounds i8, ptr %field, i64 1683
%scevgep.34 = getelementptr inbounds i8, ptr %field, i64 1734
%scevgep.35 = getelementptr inbounds i8, ptr %field, i64 1785
%scevgep.36 = getelementptr inbounds i8, ptr %field, i64 1836
%scevgep.37 = getelementptr inbounds i8, ptr %field, i64 1887
%scevgep.38 = getelementptr inbounds i8, ptr %field, i64 1938
%scevgep.39 = getelementptr inbounds i8, ptr %field, i64 1989
%scevgep.40 = getelementptr inbounds i8, ptr %field, i64 2040
%scevgep.41 = getelementptr inbounds i8, ptr %field, i64 2091
%scevgep.42 = getelementptr inbounds i8, ptr %field, i64 2142
%scevgep.43 = getelementptr inbounds i8, ptr %field, i64 2193
%scevgep.44 = getelementptr inbounds i8, ptr %field, i64 2244
%scevgep.45 = getelementptr inbounds i8, ptr %field, i64 2295
%scevgep.46 = getelementptr inbounds i8, ptr %field, i64 2346
%scevgep.47 = getelementptr inbounds i8, ptr %field, i64 2397
%scevgep.48 = getelementptr inbounds i8, ptr %field, i64 2448
%scevgep.49 = getelementptr inbounds i8, ptr %field, i64 2499
br label %while.cond
while.cond: ; preds = %cleanup, %entry
call void @llvm.lifetime.start.p0(i64 2601, ptr nonnull %field) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(50) %field, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.1, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(50) %scevgep.2, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.3, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(50) %scevgep.4, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.5, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(50) %scevgep.6, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.7, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(50) %scevgep.8, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.9, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(50) %scevgep.10, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.11, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(50) %scevgep.12, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.13, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(50) %scevgep.14, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.15, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(50) %scevgep.16, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.17, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(50) %scevgep.18, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.19, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(50) %scevgep.20, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.21, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(50) %scevgep.22, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.23, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(50) %scevgep.24, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.25, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(50) %scevgep.26, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.27, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(50) %scevgep.28, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.29, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(50) %scevgep.30, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.31, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(50) %scevgep.32, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.33, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(50) %scevgep.34, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.35, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(50) %scevgep.36, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.37, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(50) %scevgep.38, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.39, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(50) %scevgep.40, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.41, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(50) %scevgep.42, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.43, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(50) %scevgep.44, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.45, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(50) %scevgep.46, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.47, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(50) %scevgep.48, i8 0, i64 50, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50) %scevgep.49, i8 0, i64 50, i1 false), !tbaa !9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h)
%0 = load i32, ptr %w, align 4, !tbaa !5
%cmp9 = icmp eq i32 %0, 0
%1 = load i32, ptr %h, align 4
%cmp10 = icmp eq i32 %1, 0
%or.cond = select i1 %cmp9, i1 %cmp10, i1 false
br i1 %or.cond, label %while.end, label %for.cond11.preheader
for.cond11.preheader: ; preds = %while.cond
%cmp12146 = icmp sgt i32 %1, 0
br i1 %cmp12146, label %for.body13, label %cleanup
for.cond20.preheader: ; preds = %for.body13
%cmp21150 = icmp sgt i32 %6, 0
br i1 %cmp21150, label %for.cond23.preheader.lr.ph, label %cleanup
for.cond23.preheader.lr.ph: ; preds = %for.cond20.preheader
%2 = load i32, ptr %w, align 4, !tbaa !5
%cmp24148 = icmp sgt i32 %2, 0
br i1 %cmp24148, label %for.cond23.preheader.us.preheader, label %cleanup
for.cond23.preheader.us.preheader: ; preds = %for.cond23.preheader.lr.ph
%wide.trip.count182 = zext i32 %6 to i64
%wide.trip.count = zext i32 %2 to i64
br label %for.cond23.preheader.us
for.cond23.preheader.us: ; preds = %for.cond23.preheader.us.preheader, %for.cond23.for.inc38_crit_edge.us
%indvars.iv179 = phi i64 [ 0, %for.cond23.preheader.us.preheader ], [ %indvars.iv.next180, %for.cond23.for.inc38_crit_edge.us ]
%3 = trunc i64 %indvars.iv179 to i32
br label %for.body25.us
for.body25.us: ; preds = %for.cond23.preheader.us, %for.inc35.us
%indvars.iv176 = phi i64 [ 0, %for.cond23.preheader.us ], [ %indvars.iv.next177, %for.inc35.us ]
%arrayidx29.us = getelementptr inbounds [51 x [51 x i8]], ptr %field, i64 0, i64 %indvars.iv179, i64 %indvars.iv176
%4 = load i8, ptr %arrayidx29.us, align 1, !tbaa !9
%cmp30.us = icmp eq i8 %4, 87
br i1 %cmp30.us, label %if.then32.us, label %for.inc35.us
if.then32.us: ; preds = %for.body25.us
%5 = trunc i64 %indvars.iv176 to i32
call void @paint(ptr noundef nonnull %field, i32 noundef %5, i32 noundef %3, i8 noundef signext 87, i32 noundef %6, i32 noundef %2)
br label %for.inc35.us
for.inc35.us: ; preds = %if.then32.us, %for.body25.us
%indvars.iv.next177 = add nuw nsw i64 %indvars.iv176, 1
%exitcond.not = icmp eq i64 %indvars.iv.next177, %wide.trip.count
br i1 %exitcond.not, label %for.cond23.for.inc38_crit_edge.us, label %for.body25.us, !llvm.loop !10
for.cond23.for.inc38_crit_edge.us: ; preds = %for.inc35.us
%indvars.iv.next180 = add nuw nsw i64 %indvars.iv179, 1
%exitcond183.not = icmp eq i64 %indvars.iv.next180, %wide.trip.count182
br i1 %exitcond183.not, label %for.cond41.preheader, label %for.cond23.preheader.us, !llvm.loop !12
for.body13: ; preds = %for.cond11.preheader, %for.body13
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body13 ], [ 0, %for.cond11.preheader ]
%arrayidx15 = getelementptr inbounds [51 x [51 x i8]], ptr %field, i64 0, i64 %indvars.iv
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx15)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %h, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp12 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp12, label %for.body13, label %for.cond20.preheader, !llvm.loop !13
for.cond41.preheader: ; preds = %for.cond23.for.inc38_crit_edge.us
br i1 %cmp21150, label %for.cond45.preheader.lr.ph, label %cleanup
for.cond45.preheader.lr.ph: ; preds = %for.cond41.preheader
%.pr = load i32, ptr %w, align 4, !tbaa !5
%cmp46152 = icmp sgt i32 %.pr, 0
br i1 %cmp46152, label %for.cond45.preheader.us.preheader, label %cleanup
for.cond45.preheader.us.preheader: ; preds = %for.cond45.preheader.lr.ph
%wide.trip.count192 = zext i32 %6 to i64
%wide.trip.count187 = zext i32 %.pr to i64
br label %for.cond45.preheader.us
for.cond45.preheader.us: ; preds = %for.cond45.preheader.us.preheader, %for.cond45.for.inc62_crit_edge.us
%indvars.iv189 = phi i64 [ 0, %for.cond45.preheader.us.preheader ], [ %indvars.iv.next190, %for.cond45.for.inc62_crit_edge.us ]
%8 = trunc i64 %indvars.iv189 to i32
br label %for.body48.us
for.body48.us: ; preds = %for.cond45.preheader.us, %for.inc59.us
%indvars.iv184 = phi i64 [ 0, %for.cond45.preheader.us ], [ %indvars.iv.next185, %for.inc59.us ]
%arrayidx52.us = getelementptr inbounds [51 x [51 x i8]], ptr %field, i64 0, i64 %indvars.iv189, i64 %indvars.iv184
%9 = load i8, ptr %arrayidx52.us, align 1, !tbaa !9
%cmp54.us = icmp eq i8 %9, 66
br i1 %cmp54.us, label %if.then56.us, label %for.inc59.us
if.then56.us: ; preds = %for.body48.us
%10 = trunc i64 %indvars.iv184 to i32
call void @paint(ptr noundef nonnull %field, i32 noundef %10, i32 noundef %8, i8 noundef signext 66, i32 noundef %6, i32 noundef %.pr)
br label %for.inc59.us
for.inc59.us: ; preds = %if.then56.us, %for.body48.us
%indvars.iv.next185 = add nuw nsw i64 %indvars.iv184, 1
%exitcond188.not = icmp eq i64 %indvars.iv.next185, %wide.trip.count187
br i1 %exitcond188.not, label %for.cond45.for.inc62_crit_edge.us, label %for.body48.us, !llvm.loop !14
for.cond45.for.inc62_crit_edge.us: ; preds = %for.inc59.us
%indvars.iv.next190 = add nuw nsw i64 %indvars.iv189, 1
%exitcond193.not = icmp eq i64 %indvars.iv.next190, %wide.trip.count192
br i1 %exitcond193.not, label %for.cond65.preheader, label %for.cond45.preheader.us, !llvm.loop !15
for.cond65.preheader: ; preds = %for.cond45.for.inc62_crit_edge.us
br i1 %cmp21150, label %for.cond69.preheader.lr.ph, label %cleanup
for.cond69.preheader.lr.ph: ; preds = %for.cond65.preheader
%.pr230 = load i32, ptr %w, align 4, !tbaa !5
%cmp70156 = icmp sgt i32 %.pr230, 0
br i1 %cmp70156, label %for.cond69.preheader.us.preheader, label %cleanup
for.cond69.preheader.us.preheader: ; preds = %for.cond69.preheader.lr.ph
%wide.trip.count202 = zext i32 %6 to i64
%wide.trip.count197 = zext i32 %.pr230 to i64
%xtraiter = and i64 %wide.trip.count197, 1
%11 = icmp eq i32 %.pr230, 1
%unroll_iter = and i64 %wide.trip.count197, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond69.preheader.us
for.cond69.preheader.us: ; preds = %for.cond69.preheader.us.preheader, %for.cond69.for.inc96_crit_edge.us
%indvars.iv199 = phi i64 [ 0, %for.cond69.preheader.us.preheader ], [ %indvars.iv.next200, %for.cond69.for.inc96_crit_edge.us ]
%count_b.0165.us = phi i32 [ 0, %for.cond69.preheader.us.preheader ], [ %count_b.2.us.lcssa, %for.cond69.for.inc96_crit_edge.us ]
%count_w.0164.us = phi i32 [ 0, %for.cond69.preheader.us.preheader ], [ %count_w.2.us.lcssa, %for.cond69.for.inc96_crit_edge.us ]
br i1 %11, label %for.cond69.for.inc96_crit_edge.us.unr-lcssa, label %for.body72.us
for.body72.us: ; preds = %for.cond69.preheader.us, %for.inc93.us.1
%indvars.iv194 = phi i64 [ %indvars.iv.next195.1, %for.inc93.us.1 ], [ 0, %for.cond69.preheader.us ]
%count_b.1159.us = phi i32 [ %count_b.2.us.1, %for.inc93.us.1 ], [ %count_b.0165.us, %for.cond69.preheader.us ]
%count_w.1158.us = phi i32 [ %count_w.2.us.1, %for.inc93.us.1 ], [ %count_w.0164.us, %for.cond69.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.inc93.us.1 ], [ 0, %for.cond69.preheader.us ]
%arrayidx76.us = getelementptr inbounds [51 x [51 x i8]], ptr %field, i64 0, i64 %indvars.iv199, i64 %indvars.iv194
%12 = load i8, ptr %arrayidx76.us, align 1, !tbaa !9
switch i8 %12, label %for.inc93.us [
i8 119, label %if.then80.us
i8 98, label %if.then89.us
]
if.then89.us: ; preds = %for.body72.us
%inc90.us = add nsw i32 %count_b.1159.us, 1
br label %for.inc93.us
if.then80.us: ; preds = %for.body72.us
%inc81.us = add nsw i32 %count_w.1158.us, 1
br label %for.inc93.us
for.inc93.us: ; preds = %if.then80.us, %if.then89.us, %for.body72.us
%count_w.2.us = phi i32 [ %inc81.us, %if.then80.us ], [ %count_w.1158.us, %if.then89.us ], [ %count_w.1158.us, %for.body72.us ]
%count_b.2.us = phi i32 [ %count_b.1159.us, %if.then80.us ], [ %inc90.us, %if.then89.us ], [ %count_b.1159.us, %for.body72.us ]
%indvars.iv.next195 = or i64 %indvars.iv194, 1
%arrayidx76.us.1 = getelementptr inbounds [51 x [51 x i8]], ptr %field, i64 0, i64 %indvars.iv199, i64 %indvars.iv.next195
%13 = load i8, ptr %arrayidx76.us.1, align 1, !tbaa !9
switch i8 %13, label %for.inc93.us.1 [
i8 119, label %if.then80.us.1
i8 98, label %if.then89.us.1
]
if.then89.us.1: ; preds = %for.inc93.us
%inc90.us.1 = add nsw i32 %count_b.2.us, 1
br label %for.inc93.us.1
if.then80.us.1: ; preds = %for.inc93.us
%inc81.us.1 = add nsw i32 %count_w.2.us, 1
br label %for.inc93.us.1
for.inc93.us.1: ; preds = %if.then80.us.1, %if.then89.us.1, %for.inc93.us
%count_w.2.us.1 = phi i32 [ %inc81.us.1, %if.then80.us.1 ], [ %count_w.2.us, %if.then89.us.1 ], [ %count_w.2.us, %for.inc93.us ]
%count_b.2.us.1 = phi i32 [ %count_b.2.us, %if.then80.us.1 ], [ %inc90.us.1, %if.then89.us.1 ], [ %count_b.2.us, %for.inc93.us ]
%indvars.iv.next195.1 = add nuw nsw i64 %indvars.iv194, 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.cond69.for.inc96_crit_edge.us.unr-lcssa, label %for.body72.us, !llvm.loop !16
for.cond69.for.inc96_crit_edge.us.unr-lcssa: ; preds = %for.inc93.us.1, %for.cond69.preheader.us
%count_w.2.us.lcssa.ph = phi i32 [ undef, %for.cond69.preheader.us ], [ %count_w.2.us.1, %for.inc93.us.1 ]
%count_b.2.us.lcssa.ph = phi i32 [ undef, %for.cond69.preheader.us ], [ %count_b.2.us.1, %for.inc93.us.1 ]
%indvars.iv194.unr = phi i64 [ 0, %for.cond69.preheader.us ], [ %indvars.iv.next195.1, %for.inc93.us.1 ]
%count_b.1159.us.unr = phi i32 [ %count_b.0165.us, %for.cond69.preheader.us ], [ %count_b.2.us.1, %for.inc93.us.1 ]
%count_w.1158.us.unr = phi i32 [ %count_w.0164.us, %for.cond69.preheader.us ], [ %count_w.2.us.1, %for.inc93.us.1 ]
br i1 %lcmp.mod.not, label %for.cond69.for.inc96_crit_edge.us, label %for.body72.us.epil
for.body72.us.epil: ; preds = %for.cond69.for.inc96_crit_edge.us.unr-lcssa
%arrayidx76.us.epil = getelementptr inbounds [51 x [51 x i8]], ptr %field, i64 0, i64 %indvars.iv199, i64 %indvars.iv194.unr
%14 = load i8, ptr %arrayidx76.us.epil, align 1, !tbaa !9
switch i8 %14, label %for.cond69.for.inc96_crit_edge.us [
i8 119, label %if.then80.us.epil
i8 98, label %if.then89.us.epil
]
if.then89.us.epil: ; preds = %for.body72.us.epil
%inc90.us.epil = add nsw i32 %count_b.1159.us.unr, 1
br label %for.cond69.for.inc96_crit_edge.us
if.then80.us.epil: ; preds = %for.body72.us.epil
%inc81.us.epil = add nsw i32 %count_w.1158.us.unr, 1
br label %for.cond69.for.inc96_crit_edge.us
for.cond69.for.inc96_crit_edge.us: ; preds = %for.body72.us.epil, %if.then89.us.epil, %if.then80.us.epil, %for.cond69.for.inc96_crit_edge.us.unr-lcssa
%count_w.2.us.lcssa = phi i32 [ %count_w.2.us.lcssa.ph, %for.cond69.for.inc96_crit_edge.us.unr-lcssa ], [ %inc81.us.epil, %if.then80.us.epil ], [ %count_w.1158.us.unr, %if.then89.us.epil ], [ %count_w.1158.us.unr, %for.body72.us.epil ]
%count_b.2.us.lcssa = phi i32 [ %count_b.2.us.lcssa.ph, %for.cond69.for.inc96_crit_edge.us.unr-lcssa ], [ %count_b.1159.us.unr, %if.then80.us.epil ], [ %inc90.us.epil, %if.then89.us.epil ], [ %count_b.1159.us.unr, %for.body72.us.epil ]
%indvars.iv.next200 = add nuw nsw i64 %indvars.iv199, 1
%exitcond203.not = icmp eq i64 %indvars.iv.next200, %wide.trip.count202
br i1 %exitcond203.not, label %cleanup, label %for.cond69.preheader.us, !llvm.loop !17
cleanup: ; preds = %for.cond69.for.inc96_crit_edge.us, %for.cond45.preheader.lr.ph, %for.cond23.preheader.lr.ph, %for.cond11.preheader, %for.cond20.preheader, %for.cond41.preheader, %for.cond69.preheader.lr.ph, %for.cond65.preheader
%count_w.0.lcssa = phi i32 [ 0, %for.cond65.preheader ], [ 0, %for.cond69.preheader.lr.ph ], [ 0, %for.cond41.preheader ], [ 0, %for.cond20.preheader ], [ 0, %for.cond11.preheader ], [ 0, %for.cond23.preheader.lr.ph ], [ 0, %for.cond45.preheader.lr.ph ], [ %count_w.2.us.lcssa, %for.cond69.for.inc96_crit_edge.us ]
%count_b.0.lcssa = phi i32 [ 0, %for.cond65.preheader ], [ 0, %for.cond69.preheader.lr.ph ], [ 0, %for.cond41.preheader ], [ 0, %for.cond20.preheader ], [ 0, %for.cond11.preheader ], [ 0, %for.cond23.preheader.lr.ph ], [ 0, %for.cond45.preheader.lr.ph ], [ %count_b.2.us.lcssa, %for.cond69.for.inc96_crit_edge.us ]
%call99 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count_b.0.lcssa, i32 noundef %count_w.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 2601, ptr nonnull %field) #5
br label %while.cond
while.end: ; preds = %while.cond
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 2601, ptr nonnull %field) #5
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
; 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 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 = { 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
|
#include <stdio.h>
int main(void) {
int N,K = 0;
scanf("%d %d",&N,&K);
int PList[N];
int CList[N];
int i = 0;
for(i=0;i<N;i++){
scanf("%d", &PList[i]);
}
for(i=0;i<N;i++){
scanf("%d", &CList[i]);
}
long long ans = -1e18;
int si = 0;
for(si=0; si<N; si++){
int x = si;
int s[N];
long long total = 0;
long long l = 0;
int idx = -1;
while(1){
x = PList[x]-1;
s[++idx] = CList[x];
l += 1;
total += CList[x];
if (x == si){
break;
}
}
long long t = 0;
for (i=0;i<l;i++){
t += s[i];
if (i+1 > K){
break;
}
long long now = t;
if (total > 0){
long long e = (K-(i+1))/l;
now += total*e;
}
if (ans<now){
ans = now;
}
}
}
printf("%lld", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143319/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143319/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 [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 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 %K) #5
store i32 0, ptr %K, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%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
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%cmp87 = icmp sgt i32 %3, 0
br i1 %cmp87, label %for.body, label %for.end60
for.cond3.preheader: ; preds = %for.body
%cmp489 = icmp sgt i32 %5, 0
br i1 %cmp489, label %for.body5, label %for.end60
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.1, 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
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond12.preheader: ; preds = %for.body5
%cmp1395 = icmp sgt i32 %7, 0
br i1 %cmp1395, label %for.body14, label %for.end60
for.body5: ; preds = %for.cond3.preheader, %for.body5
%indvars.iv101 = phi i64 [ %indvars.iv.next102, %for.body5 ], [ 0, %for.cond3.preheader ]
%arrayidx7 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv101
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx7)
%indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
%7 = load i32, ptr %N, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp4 = icmp slt i64 %indvars.iv.next102, %8
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !11
for.body14: ; preds = %for.cond12.preheader, %for.end57
%9 = phi i32 [ %19, %for.end57 ], [ %7, %for.cond12.preheader ]
%ans.097 = phi i64 [ %.us-phi, %for.end57 ], [ -1000000000000000000, %for.cond12.preheader ]
%si.096 = phi i32 [ %inc59, %for.end57 ], [ 0, %for.cond12.preheader ]
%10 = zext i32 %9 to i64
%11 = call ptr @llvm.stacksave.p0()
%vla16 = alloca i32, i64 %10, align 16
br label %while.cond
while.cond: ; preds = %while.cond, %for.body14
%indvars.iv110 = phi i64 [ %indvars.iv.next111, %while.cond ], [ 1, %for.body14 ]
%indvars.iv104 = phi i64 [ %indvars.iv.next105, %while.cond ], [ -1, %for.body14 ]
%x.0 = phi i32 [ %sub, %while.cond ], [ %si.096, %for.body14 ]
%total.0 = phi i64 [ %add26, %while.cond ], [ 0, %for.body14 ]
%l.0 = phi i64 [ %add, %while.cond ], [ 0, %for.body14 ]
%idxprom17 = sext i32 %x.0 to i64
%arrayidx18 = getelementptr inbounds i32, ptr %vla, i64 %idxprom17
%12 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%sub = add nsw i32 %12, -1
%idxprom19 = sext i32 %sub to i64
%arrayidx20 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom19
%13 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%.fr = freeze i32 %13
%indvars.iv.next105 = add nsw i64 %indvars.iv104, 1
%arrayidx23 = getelementptr inbounds i32, ptr %vla16, i64 %indvars.iv.next105
store i32 %.fr, ptr %arrayidx23, align 4, !tbaa !5
%add = add nuw nsw i64 %l.0, 1
%conv = sext i32 %.fr to i64
%add26 = add i64 %total.0, %conv
%cmp27 = icmp eq i32 %sub, %si.096
%indvars.iv.next111 = add nuw i64 %indvars.iv110, 1
br i1 %cmp27, label %for.cond29.preheader, label %while.cond
for.cond29.preheader: ; preds = %while.cond
%14 = load i32, ptr %K, align 4, !tbaa !5
%cmp43 = icmp sgt i64 %add26, 0
br i1 %cmp43, label %for.body33.us.preheader, label %for.body33.preheader
for.body33.preheader: ; preds = %for.cond29.preheader
%smax = call i32 @llvm.smax.i32(i32 %14, i32 0)
%wide.trip.count = zext i32 %smax to i64
br label %for.body33
for.body33.us.preheader: ; preds = %for.cond29.preheader
%15 = sext i32 %14 to i64
%smax117 = call i32 @llvm.smax.i32(i32 %14, i32 0)
%wide.trip.count118 = zext i32 %smax117 to i64
br label %for.body33.us
for.body33.us: ; preds = %for.body33.us.preheader, %if.end42.us
%indvars.iv113 = phi i64 [ 0, %for.body33.us.preheader ], [ %indvars.iv.next114, %if.end42.us ]
%t.093.us = phi i64 [ 0, %for.body33.us.preheader ], [ %add37.us, %if.end42.us ]
%ans.191.us = phi i64 [ %ans.097, %for.body33.us.preheader ], [ %spec.select.us, %if.end42.us ]
%exitcond119.not = icmp eq i64 %indvars.iv113, %wide.trip.count118
br i1 %exitcond119.not, label %for.end57, label %if.end42.us
if.end42.us: ; preds = %for.body33.us
%indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
%arrayidx35.us = getelementptr inbounds i32, ptr %vla16, i64 %indvars.iv113
%16 = load i32, ptr %arrayidx35.us, align 4, !tbaa !5
%conv36.us = sext i32 %16 to i64
%add37.us = add nsw i64 %t.093.us, %conv36.us
%17 = sub nsw i64 %15, %indvars.iv.next114
%div.us = sdiv i64 %17, %add
%mul.us = mul nsw i64 %div.us, %add26
%add49.us = add nsw i64 %mul.us, %add37.us
%spec.select.us = call i64 @llvm.smax.i64(i64 %ans.191.us, i64 %add49.us)
%exitcond121 = icmp eq i64 %indvars.iv.next114, %indvars.iv110
br i1 %exitcond121, label %for.end57, label %for.body33.us, !llvm.loop !12
for.body33: ; preds = %for.body33.preheader, %if.end42
%indvars.iv107 = phi i64 [ 0, %for.body33.preheader ], [ %indvars.iv.next108, %if.end42 ]
%t.093 = phi i64 [ 0, %for.body33.preheader ], [ %add37, %if.end42 ]
%ans.191 = phi i64 [ %ans.097, %for.body33.preheader ], [ %spec.select, %if.end42 ]
%exitcond.not = icmp eq i64 %indvars.iv107, %wide.trip.count
br i1 %exitcond.not, label %for.end57, label %if.end42
if.end42: ; preds = %for.body33
%indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
%arrayidx35 = getelementptr inbounds i32, ptr %vla16, i64 %indvars.iv107
%18 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%conv36 = sext i32 %18 to i64
%add37 = add nsw i64 %t.093, %conv36
%spec.select = call i64 @llvm.smax.i64(i64 %ans.191, i64 %add37)
%exitcond112 = icmp eq i64 %indvars.iv.next108, %indvars.iv110
br i1 %exitcond112, label %for.end57, label %for.body33, !llvm.loop !12
for.end57: ; preds = %if.end42, %for.body33, %for.body33.us, %if.end42.us
%.us-phi = phi i64 [ %ans.191.us, %for.body33.us ], [ %spec.select.us, %if.end42.us ], [ %ans.191, %for.body33 ], [ %spec.select, %if.end42 ]
call void @llvm.stackrestore.p0(ptr %11)
%inc59 = add nuw nsw i32 %si.096, 1
%19 = load i32, ptr %N, align 4, !tbaa !5
%cmp13 = icmp slt i32 %inc59, %19
br i1 %cmp13, label %for.body14, label %for.end60, !llvm.loop !13
for.end60: ; preds = %for.end57, %entry, %for.cond3.preheader, %for.cond12.preheader
%ans.0.lcssa = phi i64 [ -1000000000000000000, %for.cond12.preheader ], [ -1000000000000000000, %for.cond3.preheader ], [ -1000000000000000000, %entry ], [ %.us-phi, %for.end57 ]
%call61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #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) #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: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; 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 i64 @llvm.smax.i64(i64, i64) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, 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 = { 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}
|
#include <stdio.h>
int main(){
int h,w,k,i,j,a[300][300],c,f,ff;
char s[300][301];
scanf("%d %d %d",&h,&w,&k);
for (i=0;i<h;i++) {
scanf("%s",&s[i]);
for (j=0;j<w;j++)
if (s[i][j]=='.') a[i][j]=0;
else a[i][j]=k--;
}
for (ff=i=0;i<h;i++) {
for (f=c=j=0;j<w;j++)
if (a[i][j]==0 && c>0) a[i][j]=c;
else if (a[i][j]>0) c=a[i][j];
else f=1;
if (f && c>0) {
for (j=0;a[i][j]==0;j++) ;
c=a[i][j];
for (j--;j>=0;j--) a[i][j]=c;
} else if (f && ff) {
for (j=0;j<w;j++) a[i][j]=a[i-1][j];
}
if (c>0 && ff==0) {
ff=1;
for (k=0;k<i;k++)
for (j=0;j<w;j++) a[k][j]=a[i][j];
}
}
for (i=0;i<h;i++) {
printf("%d",a[i][0]);
for (j=1;j<w;j++)
printf(" %d",a[i][j]);
puts("");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143362/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143362/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 [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%k = alloca i32, align 4
%a = alloca [300 x [300 x i32]], align 16
%a343 = ptrtoint ptr %a to i64
%s = alloca [300 x [301 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 360000, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 90300, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w, ptr noundef nonnull %k)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp238 = icmp sgt i32 %0, 0
br i1 %cmp238, label %for.body, label %for.end169
for.cond22.preheader: ; preds = %for.inc19
%cmp23256 = icmp sgt i32 %10, 0
br i1 %cmp23256, label %for.cond26.preheader.lr.ph, label %for.end169
for.cond26.preheader.lr.ph: ; preds = %for.cond22.preheader
%1 = load i32, ptr %w, align 4, !tbaa !5
%cmp27240 = icmp sgt i32 %1, 0
%cmp98247 = icmp slt i32 %1, 1
%wide.trip.count309 = zext i32 %10 to i64
%wide.trip.count275 = zext i32 %1 to i64
%wide.trip.count281 = zext i32 %1 to i64
%wide.trip.count296 = zext i32 %1 to i64
%min.iters.check360 = icmp ult i32 %1, 4
%n.vec363 = and i64 %wide.trip.count275, 4294967292
%cmp.n365 = icmp eq i64 %n.vec363, %wide.trip.count275
%min.iters.check = icmp ult i32 %1, 8
%n.vec = and i64 %wide.trip.count275, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count275
%xtraiter373 = and i64 %wide.trip.count275, 3
%lcmp.mod374.not = icmp eq i64 %xtraiter373, 0
br label %for.cond26.preheader
for.body: ; preds = %entry, %for.inc19
%indvars.iv269 = phi i64 [ %indvars.iv.next270, %for.inc19 ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [300 x [301 x i8]], ptr %s, i64 0, i64 %indvars.iv269
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%2 = load i32, ptr %w, align 4, !tbaa !5
%cmp3235 = icmp sgt i32 %2, 0
br i1 %cmp3235, label %for.body4.preheader, label %for.inc19
for.body4.preheader: ; preds = %for.body
%k.promoted = load i32, ptr %k, align 4, !tbaa !5
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 1
%3 = icmp eq i32 %2, 1
br i1 %3, label %for.inc19.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.body4: ; preds = %for.inc.1, %for.body4.preheader.new
%indvars.iv = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%dec234236 = phi i32 [ %k.promoted, %for.body4.preheader.new ], [ %dec233.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx8 = getelementptr inbounds [300 x [301 x i8]], ptr %s, i64 0, i64 %indvars.iv269, i64 %indvars.iv
%4 = load i8, ptr %arrayidx8, align 1, !tbaa !9
%cmp9 = icmp eq i8 %4, 46
br i1 %cmp9, label %for.inc, label %if.else
if.else: ; preds = %for.body4
%dec = add nsw i32 %dec234236, -1
store i32 %dec, ptr %k, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body4, %if.else
%dec234236.sink = phi i32 [ %dec234236, %if.else ], [ 0, %for.body4 ]
%dec233 = phi i32 [ %dec, %if.else ], [ %dec234236, %for.body4 ]
%5 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv269, i64 %indvars.iv
store i32 %dec234236.sink, ptr %5, align 8
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx8.1 = getelementptr inbounds [300 x [301 x i8]], ptr %s, i64 0, i64 %indvars.iv269, i64 %indvars.iv.next
%6 = load i8, ptr %arrayidx8.1, align 1, !tbaa !9
%cmp9.1 = icmp eq i8 %6, 46
br i1 %cmp9.1, label %for.inc.1, label %if.else.1
if.else.1: ; preds = %for.inc
%dec.1 = add nsw i32 %dec233, -1
store i32 %dec.1, ptr %k, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.else.1, %for.inc
%dec234236.sink.1 = phi i32 [ %dec233, %if.else.1 ], [ 0, %for.inc ]
%dec233.1 = phi i32 [ %dec.1, %if.else.1 ], [ %dec233, %for.inc ]
%7 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv269, i64 %indvars.iv.next
store i32 %dec234236.sink.1, ptr %7, align 4
%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.inc19.loopexit.unr-lcssa, label %for.body4, !llvm.loop !10
for.inc19.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body4.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%dec234236.unr = phi i32 [ %k.promoted, %for.body4.preheader ], [ %dec233.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc19, label %for.body4.epil
for.body4.epil: ; preds = %for.inc19.loopexit.unr-lcssa
%arrayidx8.epil = getelementptr inbounds [300 x [301 x i8]], ptr %s, i64 0, i64 %indvars.iv269, i64 %indvars.iv.unr
%8 = load i8, ptr %arrayidx8.epil, align 1, !tbaa !9
%cmp9.epil = icmp eq i8 %8, 46
br i1 %cmp9.epil, label %for.inc.epil, label %if.else.epil
if.else.epil: ; preds = %for.body4.epil
%dec.epil = add nsw i32 %dec234236.unr, -1
store i32 %dec.epil, ptr %k, align 4, !tbaa !5
br label %for.inc.epil
for.inc.epil: ; preds = %if.else.epil, %for.body4.epil
%dec234236.sink.epil = phi i32 [ %dec234236.unr, %if.else.epil ], [ 0, %for.body4.epil ]
%9 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv269, i64 %indvars.iv.unr
store i32 %dec234236.sink.epil, ptr %9, align 4
br label %for.inc19
for.inc19: ; preds = %for.inc.epil, %for.inc19.loopexit.unr-lcssa, %for.body
%indvars.iv.next270 = add nuw nsw i64 %indvars.iv269, 1
%10 = load i32, ptr %h, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp = icmp slt i64 %indvars.iv.next270, %11
br i1 %cmp, label %for.body, label %for.cond22.preheader, !llvm.loop !12
for.cond26.preheader: ; preds = %for.cond26.preheader.lr.ph, %for.inc143
%indvars.iv304 = phi i64 [ 0, %for.cond26.preheader.lr.ph ], [ %indvars.iv.next305, %for.inc143 ]
%ff.0260 = phi i32 [ 0, %for.cond26.preheader.lr.ph ], [ %ff.1, %for.inc143 ]
%12 = mul nuw nsw i64 %indvars.iv304, 1200
%13 = add i64 %12, %a343
br i1 %cmp27240, label %for.body29, label %for.inc143
for.cond146.preheader: ; preds = %for.inc143
br i1 %cmp23256, label %for.body149, label %for.end169
for.body29: ; preds = %for.cond26.preheader, %for.inc58
%indvars.iv272 = phi i64 [ %indvars.iv.next273, %for.inc58 ], [ 0, %for.cond26.preheader ]
%f.0243 = phi i32 [ %f.1, %for.inc58 ], [ 0, %for.cond26.preheader ]
%c.0242 = phi i32 [ %c.1, %for.inc58 ], [ 0, %for.cond26.preheader ]
%arrayidx33 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv304, i64 %indvars.iv272
%14 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34 = icmp eq i32 %14, 0
%cmp36 = icmp sgt i32 %c.0242, 0
%or.cond = select i1 %cmp34, i1 %cmp36, i1 false
br i1 %or.cond, label %if.then38, label %if.else43
if.then38: ; preds = %for.body29
store i32 %c.0242, ptr %arrayidx33, align 4, !tbaa !5
br label %for.inc58
if.else43: ; preds = %for.body29
%cmp48 = icmp sgt i32 %14, 0
%.c.0 = select i1 %cmp48, i32 %14, i32 %c.0242
%f.0. = select i1 %cmp48, i32 %f.0243, i32 1
br label %for.inc58
for.inc58: ; preds = %if.else43, %if.then38
%c.1 = phi i32 [ %c.0242, %if.then38 ], [ %.c.0, %if.else43 ]
%f.1 = phi i32 [ %f.0243, %if.then38 ], [ %f.0., %if.else43 ]
%indvars.iv.next273 = add nuw nsw i64 %indvars.iv272, 1
%exitcond276.not = icmp eq i64 %indvars.iv.next273, %wide.trip.count275
br i1 %exitcond276.not, label %for.end60, label %for.body29, !llvm.loop !13
for.end60: ; preds = %for.inc58
%tobool = icmp ne i32 %f.1, 0
%cmp62 = icmp sgt i32 %c.1, 0
%or.cond170 = select i1 %tobool, i1 %cmp62, i1 false
br i1 %or.cond170, label %for.cond65, label %if.else92
for.cond65: ; preds = %for.end60, %for.cond65
%indvars.iv283 = phi i64 [ %indvars.iv.next284, %for.cond65 ], [ 0, %for.end60 ]
%arrayidx69 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv304, i64 %indvars.iv283
%15 = load i32, ptr %arrayidx69, align 4, !tbaa !5
%cmp70 = icmp eq i32 %15, 0
%indvars.iv.next284 = add nuw i64 %indvars.iv283, 1
br i1 %cmp70, label %for.cond65, label %for.cond81.preheader, !llvm.loop !14
for.cond81.preheader: ; preds = %for.cond65
%16 = and i64 %indvars.iv283, 4294967295
%cmp82249.not = icmp eq i64 %16, 0
br i1 %cmp82249.not, label %if.end113, label %for.body84.preheader
for.body84.preheader: ; preds = %for.cond81.preheader
%17 = call i64 @llvm.smax.i64(i64 %indvars.iv283, i64 1)
%min.iters.check348 = icmp ult i64 %17, 28
br i1 %min.iters.check348, label %for.body84.preheader370, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body84.preheader
%smin = call i64 @llvm.smin.i64(i64 %indvars.iv283, i64 1)
%18 = sub i64 %indvars.iv283, %smin
%19 = trunc i64 %indvars.iv283 to i32
%20 = add i32 %19, -1
%21 = trunc i64 %18 to i32
%22 = icmp ult i32 %20, %21
%23 = icmp ugt i64 %18, 4294967295
%24 = or i1 %22, %23
br i1 %24, label %for.body84.preheader370, label %vector.ph349
vector.ph349: ; preds = %vector.scevcheck
%n.vec351 = and i64 %17, 9223372036854775800
%ind.end = sub i64 %indvars.iv283, %n.vec351
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %15, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body354
vector.body354: ; preds = %vector.body354, %vector.ph349
%index355 = phi i64 [ 0, %vector.ph349 ], [ %index.next357, %vector.body354 ]
%25 = xor i64 %index355, -1
%26 = add i64 %indvars.iv283, %25
%27 = and i64 %26, 4294967295
%28 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv304, i64 %27
%29 = getelementptr inbounds i32, ptr %28, i64 -3
store <4 x i32> %broadcast.splat, ptr %29, align 4, !tbaa !5
%30 = getelementptr inbounds i32, ptr %28, i64 -7
store <4 x i32> %broadcast.splat, ptr %30, align 4, !tbaa !5
%index.next357 = add nuw i64 %index355, 8
%31 = icmp eq i64 %index.next357, %n.vec351
br i1 %31, label %middle.block346, label %vector.body354, !llvm.loop !15
middle.block346: ; preds = %vector.body354
%cmp.n353 = icmp eq i64 %17, %n.vec351
br i1 %cmp.n353, label %if.end113, label %for.body84.preheader370
for.body84.preheader370: ; preds = %vector.scevcheck, %for.body84.preheader, %middle.block346
%indvars.iv286.ph = phi i64 [ %indvars.iv283, %vector.scevcheck ], [ %indvars.iv283, %for.body84.preheader ], [ %ind.end, %middle.block346 ]
br label %for.body84
for.body84: ; preds = %for.body84.preheader370, %for.body84
%indvars.iv286 = phi i64 [ %indvars.iv.next287, %for.body84 ], [ %indvars.iv286.ph, %for.body84.preheader370 ]
%indvars.iv.next287 = add nsw i64 %indvars.iv286, -1
%idxprom87 = and i64 %indvars.iv.next287, 4294967295
%arrayidx88 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv304, i64 %idxprom87
store i32 %15, ptr %arrayidx88, align 4, !tbaa !5
%32 = icmp sgt i64 %indvars.iv286, 1
br i1 %32, label %for.body84, label %if.end113, !llvm.loop !18
if.else92: ; preds = %for.end60
%tobool95 = icmp eq i32 %ff.0260, 0
%not.tobool = xor i1 %tobool, true
%or.cond171 = select i1 %not.tobool, i1 true, i1 %tobool95
%brmerge = or i1 %or.cond171, %cmp98247
br i1 %brmerge, label %if.end113, label %for.body100.lr.ph
for.body100.lr.ph: ; preds = %if.else92
%33 = add nsw i64 %indvars.iv304, -1
br i1 %min.iters.check360, label %for.body100.preheader, label %vector.body366
vector.body366: ; preds = %for.body100.lr.ph, %vector.body366
%index367 = phi i64 [ %index.next369, %vector.body366 ], [ 0, %for.body100.lr.ph ]
%34 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %33, i64 %index367
%wide.load368 = load <4 x i32>, ptr %34, align 16, !tbaa !5
%35 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv304, i64 %index367
store <4 x i32> %wide.load368, ptr %35, align 16, !tbaa !5
%index.next369 = add nuw i64 %index367, 4
%36 = icmp eq i64 %index.next369, %n.vec363
br i1 %36, label %middle.block358, label %vector.body366, !llvm.loop !19
middle.block358: ; preds = %vector.body366
br i1 %cmp.n365, label %if.end113, label %for.body100.preheader
for.body100.preheader: ; preds = %for.body100.lr.ph, %middle.block358
%indvars.iv278.ph = phi i64 [ 0, %for.body100.lr.ph ], [ %n.vec363, %middle.block358 ]
br label %for.body100
for.body100: ; preds = %for.body100.preheader, %for.body100
%indvars.iv278 = phi i64 [ %indvars.iv.next279, %for.body100 ], [ %indvars.iv278.ph, %for.body100.preheader ]
%arrayidx104 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %33, i64 %indvars.iv278
%37 = load i32, ptr %arrayidx104, align 4, !tbaa !5
%arrayidx108 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv304, i64 %indvars.iv278
store i32 %37, ptr %arrayidx108, align 4, !tbaa !5
%indvars.iv.next279 = add nuw nsw i64 %indvars.iv278, 1
%exitcond282.not = icmp eq i64 %indvars.iv.next279, %wide.trip.count281
br i1 %exitcond282.not, label %if.end113, label %for.body100, !llvm.loop !20
if.end113: ; preds = %for.body100, %for.body84, %middle.block358, %middle.block346, %if.else92, %for.cond81.preheader
%c.2 = phi i32 [ %c.1, %if.else92 ], [ %15, %for.cond81.preheader ], [ %15, %middle.block346 ], [ %c.1, %middle.block358 ], [ %15, %for.body84 ], [ %c.1, %for.body100 ]
%cmp114 = icmp sgt i32 %c.2, 0
%cmp117 = icmp eq i32 %ff.0260, 0
%or.cond172 = select i1 %cmp114, i1 %cmp117, i1 false
br i1 %or.cond172, label %for.cond120.preheader, label %for.inc143
for.cond120.preheader: ; preds = %if.end113
%cmp121253.not = icmp eq i64 %indvars.iv304, 0
br i1 %cmp121253.not, label %for.inc143.loopexit, label %for.cond124.preheader.lr.ph
for.cond124.preheader.lr.ph: ; preds = %for.cond120.preheader
br i1 %cmp27240, label %for.cond124.preheader.us, label %for.cond124.preheader.preheader
for.cond124.preheader.preheader: ; preds = %for.cond124.preheader.lr.ph
%38 = trunc i64 %indvars.iv304 to i32
br label %for.inc143.loopexit
for.cond124.preheader.us: ; preds = %for.cond124.preheader.lr.ph, %for.cond124.for.inc139_crit_edge.us
%indvars.iv298 = phi i64 [ %indvars.iv.next299, %for.cond124.for.inc139_crit_edge.us ], [ 0, %for.cond124.preheader.lr.ph ]
br i1 %min.iters.check, label %for.body127.us.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.cond124.preheader.us
%39 = mul nuw nsw i64 %indvars.iv298, 1200
%40 = add i64 %39, %a343
%41 = sub i64 %40, %13
%diff.check = icmp ult i64 %41, 32
br i1 %diff.check, label %for.body127.us.preheader, label %vector.body
vector.body: ; preds = %vector.memcheck, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.memcheck ]
%42 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv304, i64 %index
%wide.load = load <4 x i32>, ptr %42, align 16, !tbaa !5
%43 = getelementptr inbounds i32, ptr %42, i64 4
%wide.load344 = load <4 x i32>, ptr %43, align 16, !tbaa !5
%44 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv298, i64 %index
store <4 x i32> %wide.load, ptr %44, align 16, !tbaa !5
%45 = getelementptr inbounds i32, ptr %44, i64 4
store <4 x i32> %wide.load344, ptr %45, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%46 = icmp eq i64 %index.next, %n.vec
br i1 %46, label %middle.block, label %vector.body, !llvm.loop !21
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond124.for.inc139_crit_edge.us, label %for.body127.us.preheader
for.body127.us.preheader: ; preds = %vector.memcheck, %for.cond124.preheader.us, %middle.block
%indvars.iv292.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.cond124.preheader.us ], [ %n.vec, %middle.block ]
%47 = xor i64 %indvars.iv292.ph, -1
%48 = add nsw i64 %47, %wide.trip.count275
br i1 %lcmp.mod374.not, label %for.body127.us.prol.loopexit, label %for.body127.us.prol
for.body127.us.prol: ; preds = %for.body127.us.preheader, %for.body127.us.prol
%indvars.iv292.prol = phi i64 [ %indvars.iv.next293.prol, %for.body127.us.prol ], [ %indvars.iv292.ph, %for.body127.us.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body127.us.prol ], [ 0, %for.body127.us.preheader ]
%arrayidx131.us.prol = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv304, i64 %indvars.iv292.prol
%49 = load i32, ptr %arrayidx131.us.prol, align 4, !tbaa !5
%arrayidx135.us.prol = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv298, i64 %indvars.iv292.prol
store i32 %49, ptr %arrayidx135.us.prol, align 4, !tbaa !5
%indvars.iv.next293.prol = add nuw nsw i64 %indvars.iv292.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter373
br i1 %prol.iter.cmp.not, label %for.body127.us.prol.loopexit, label %for.body127.us.prol, !llvm.loop !22
for.body127.us.prol.loopexit: ; preds = %for.body127.us.prol, %for.body127.us.preheader
%indvars.iv292.unr = phi i64 [ %indvars.iv292.ph, %for.body127.us.preheader ], [ %indvars.iv.next293.prol, %for.body127.us.prol ]
%50 = icmp ult i64 %48, 3
br i1 %50, label %for.cond124.for.inc139_crit_edge.us, label %for.body127.us
for.body127.us: ; preds = %for.body127.us.prol.loopexit, %for.body127.us
%indvars.iv292 = phi i64 [ %indvars.iv.next293.3, %for.body127.us ], [ %indvars.iv292.unr, %for.body127.us.prol.loopexit ]
%arrayidx131.us = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv304, i64 %indvars.iv292
%51 = load i32, ptr %arrayidx131.us, align 4, !tbaa !5
%arrayidx135.us = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv298, i64 %indvars.iv292
store i32 %51, ptr %arrayidx135.us, align 4, !tbaa !5
%indvars.iv.next293 = add nuw nsw i64 %indvars.iv292, 1
%arrayidx131.us.1 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv304, i64 %indvars.iv.next293
%52 = load i32, ptr %arrayidx131.us.1, align 4, !tbaa !5
%arrayidx135.us.1 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv298, i64 %indvars.iv.next293
store i32 %52, ptr %arrayidx135.us.1, align 4, !tbaa !5
%indvars.iv.next293.1 = add nuw nsw i64 %indvars.iv292, 2
%arrayidx131.us.2 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv304, i64 %indvars.iv.next293.1
%53 = load i32, ptr %arrayidx131.us.2, align 4, !tbaa !5
%arrayidx135.us.2 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv298, i64 %indvars.iv.next293.1
store i32 %53, ptr %arrayidx135.us.2, align 4, !tbaa !5
%indvars.iv.next293.2 = add nuw nsw i64 %indvars.iv292, 3
%arrayidx131.us.3 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv304, i64 %indvars.iv.next293.2
%54 = load i32, ptr %arrayidx131.us.3, align 4, !tbaa !5
%arrayidx135.us.3 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv298, i64 %indvars.iv.next293.2
store i32 %54, ptr %arrayidx135.us.3, align 4, !tbaa !5
%indvars.iv.next293.3 = add nuw nsw i64 %indvars.iv292, 4
%exitcond297.not.3 = icmp eq i64 %indvars.iv.next293.3, %wide.trip.count296
br i1 %exitcond297.not.3, label %for.cond124.for.inc139_crit_edge.us, label %for.body127.us, !llvm.loop !24
for.cond124.for.inc139_crit_edge.us: ; preds = %for.body127.us.prol.loopexit, %for.body127.us, %middle.block
%indvars.iv.next299 = add nuw nsw i64 %indvars.iv298, 1
%exitcond303.not = icmp eq i64 %indvars.iv.next299, %indvars.iv304
br i1 %exitcond303.not, label %for.inc143.loopexit.loopexit, label %for.cond124.preheader.us, !llvm.loop !25
for.inc143.loopexit.loopexit: ; preds = %for.cond124.for.inc139_crit_edge.us
%55 = trunc i64 %indvars.iv304 to i32
br label %for.inc143.loopexit
for.inc143.loopexit: ; preds = %for.cond124.preheader.preheader, %for.inc143.loopexit.loopexit, %for.cond120.preheader
%storemerge.lcssa = phi i32 [ 0, %for.cond120.preheader ], [ %55, %for.inc143.loopexit.loopexit ], [ %38, %for.cond124.preheader.preheader ]
store i32 %storemerge.lcssa, ptr %k, align 4, !tbaa !5
br label %for.inc143
for.inc143: ; preds = %for.cond26.preheader, %for.inc143.loopexit, %if.end113
%ff.1 = phi i32 [ %ff.0260, %if.end113 ], [ 1, %for.inc143.loopexit ], [ %ff.0260, %for.cond26.preheader ]
%indvars.iv.next305 = add nuw nsw i64 %indvars.iv304, 1
%exitcond310.not = icmp eq i64 %indvars.iv.next305, %wide.trip.count309
br i1 %exitcond310.not, label %for.cond146.preheader, label %for.cond26.preheader, !llvm.loop !26
for.body149: ; preds = %for.cond146.preheader, %for.end165
%indvars.iv315 = phi i64 [ %indvars.iv.next316, %for.end165 ], [ 0, %for.cond146.preheader ]
%arrayidx151 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv315
%56 = load i32, ptr %arrayidx151, align 16, !tbaa !5
%call153 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %56)
%57 = load i32, ptr %w, align 4, !tbaa !5
%cmp155261 = icmp sgt i32 %57, 1
br i1 %cmp155261, label %for.body157, label %for.end165
for.body157: ; preds = %for.body149, %for.body157
%indvars.iv311 = phi i64 [ %indvars.iv.next312, %for.body157 ], [ 1, %for.body149 ]
%arrayidx161 = getelementptr inbounds [300 x [300 x i32]], ptr %a, i64 0, i64 %indvars.iv315, i64 %indvars.iv311
%58 = load i32, ptr %arrayidx161, align 4, !tbaa !5
%call162 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %58)
%indvars.iv.next312 = add nuw nsw i64 %indvars.iv311, 1
%59 = load i32, ptr %w, align 4, !tbaa !5
%60 = sext i32 %59 to i64
%cmp155 = icmp slt i64 %indvars.iv.next312, %60
br i1 %cmp155, label %for.body157, label %for.end165, !llvm.loop !27
for.end165: ; preds = %for.body157, %for.body149
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next316 = add nuw nsw i64 %indvars.iv315, 1
%61 = load i32, ptr %h, align 4, !tbaa !5
%62 = sext i32 %61 to i64
%cmp147 = icmp slt i64 %indvars.iv.next316, %62
br i1 %cmp147, label %for.body149, label %for.end169, !llvm.loop !28
for.end169: ; preds = %for.end165, %entry, %for.cond22.preheader, %for.cond146.preheader
call void @llvm.lifetime.end.p0(i64 90300, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 360000, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !11, !16}
!19 = distinct !{!19, !11, !16, !17}
!20 = distinct !{!20, !11, !17, !16}
!21 = distinct !{!21, !11, !16, !17}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.unroll.disable"}
!24 = distinct !{!24, !11, !16}
!25 = distinct !{!25, !11}
!26 = distinct !{!26, !11}
!27 = distinct !{!27, !11}
!28 = distinct !{!28, !11}
|
#include <stdio.h>
#include <math.h>
int main()
{
double x1, x2, x3, y1, y2, y3, xp, yp;
double s, s1, s2, s3;
double eps = 1e-10;
while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) != EOF){
s = fabs((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1));
s1 = fabs((xp - x1) * (y2 - y1) - (yp - y1) * (x2 - x1));
s2 = fabs((xp - x1) * (y3 - y1) - (yp - y1) * (x3 - x1));
s3 = fabs((xp - x2) * (y3 - y2) - (yp - y2) * (x3 - x2));
if (fabs(s - (s1 + s2 + s3)) <= eps) printf("YES\n");
else printf("NO\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143405/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143405/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 [32 x i8] c"%lf %lf %lf %lf %lf %lf %lf %lf\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:
%x1 = alloca double, align 8
%x2 = alloca double, align 8
%x3 = alloca double, align 8
%y1 = alloca double, align 8
%y2 = alloca double, align 8
%y3 = alloca double, align 8
%xp = alloca double, align 8
%yp = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x3) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y3) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %xp) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %yp) #6
%call29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2, ptr noundef nonnull %x3, ptr noundef nonnull %y3, ptr noundef nonnull %xp, ptr noundef nonnull %yp)
%cmp.not30 = icmp eq i32 %call29, -1
br i1 %cmp.not30, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%2 = load double, ptr %y3, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%4 = load double, ptr %y2, align 8, !tbaa !5
%5 = load double, ptr %x3, align 8, !tbaa !5
%6 = load double, ptr %xp, align 8, !tbaa !5
%sub5 = fsub double %6, %1
%7 = load double, ptr %yp, align 8, !tbaa !5
%sub7 = fsub double %7, %3
%8 = fneg double %sub7
%9 = insertelement <2 x double> poison, double %4, i64 0
%10 = insertelement <2 x double> %9, double %2, i64 1
%11 = insertelement <2 x double> poison, double %3, i64 0
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
%13 = fsub <2 x double> %10, %12
%14 = insertelement <2 x double> poison, double %0, i64 0
%15 = insertelement <2 x double> %14, double %5, i64 1
%16 = insertelement <2 x double> poison, double %1, i64 0
%17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer
%18 = fsub <2 x double> %15, %17
%19 = extractelement <2 x double> %13, i64 0
%20 = fneg double %19
%21 = extractelement <2 x double> %18, i64 1
%neg = fmul double %21, %20
%22 = extractelement <2 x double> %13, i64 1
%23 = extractelement <2 x double> %18, i64 0
%24 = call double @llvm.fmuladd.f64(double %23, double %22, double %neg)
%25 = call double @llvm.fabs.f64(double %24)
%26 = insertelement <2 x double> poison, double %8, i64 0
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> zeroinitializer
%28 = fmul <2 x double> %18, %27
%29 = insertelement <2 x double> poison, double %sub5, i64 0
%30 = shufflevector <2 x double> %29, <2 x double> poison, <2 x i32> zeroinitializer
%31 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %30, <2 x double> %13, <2 x double> %28)
%32 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %31)
%sub17 = fsub double %6, %0
%sub18 = fsub double %2, %4
%sub19 = fsub double %7, %4
%sub20 = fsub double %5, %0
%33 = fneg double %sub19
%neg22 = fmul double %sub20, %33
%34 = call double @llvm.fmuladd.f64(double %sub17, double %sub18, double %neg22)
%35 = call double @llvm.fabs.f64(double %34)
%shift = shufflevector <2 x double> %32, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%36 = fadd <2 x double> %32, %shift
%add = extractelement <2 x double> %36, i64 0
%add23 = fadd double %35, %add
%sub24 = fsub double %25, %add23
%37 = call double @llvm.fabs.f64(double %sub24)
%cmp25 = fcmp ugt double %37, 1.000000e-10
%str.str.3 = select i1 %cmp25, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2, ptr noundef nonnull %x3, ptr noundef nonnull %y3, ptr noundef nonnull %xp, ptr noundef nonnull %yp)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %yp) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %xp) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y3) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x3) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #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 nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fabs.v2f64(<2 x double>) #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 speculatable willreturn memory(none) }
attributes #4 = { nofree nounwind }
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 = !{!6, !6, i64 0}
!6 = !{!"double", !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<math.h>
#define SQ(x) (x)*(x)
#define EPS (1e-10)
#define EQ(a,b) (fabs((a)-(b)) < EPS)
int main(void){
double x[4],y[4],S,s,a,b,c,sum;
while(~scanf("%lf %lf %lf %lf %lf %lf %lf %lf"
,&x[1],&y[1],&x[2],&y[2],&x[3],&y[3],&x[0],&y[0])){
sum=0;
a=sqrt(SQ(x[1]-x[2])+SQ(y[1]-y[2]));
b=sqrt(SQ(x[3]-x[2])+SQ(y[3]-y[2]));
c=sqrt(SQ(x[1]-x[3])+SQ(y[1]-y[3]));
s=(a+b+c)/2;
S=sqrt(s*(s-a)*(s-b)*(s-c));
a=sqrt(SQ(x[0]-x[2])+SQ(y[0]-y[2]));
b=sqrt(SQ(x[3]-x[2])+SQ(y[3]-y[2]));
c=sqrt(SQ(x[0]-x[3])+SQ(y[0]-y[3]));
s=(a+b+c)/2;
sum+=sqrt(s*(s-a)*(s-b)*(s-c));
a=sqrt(SQ(x[1]-x[0])+SQ(y[1]-y[0]));
b=sqrt(SQ(x[3]-x[0])+SQ(y[3]-y[0]));
c=sqrt(SQ(x[1]-x[3])+SQ(y[1]-y[3]));
s=(a+b+c)/2;
sum+=sqrt(s*(s-a)*(s-b)*(s-c));
a=sqrt(SQ(x[1]-x[2])+SQ(y[1]-y[2]));
b=sqrt(SQ(x[0]-x[2])+SQ(y[0]-y[2]));
c=sqrt(SQ(x[1]-x[0])+SQ(y[1]-y[0]));
s=(a+b+c)/2;
sum+=sqrt(s*(s-a)*(s-b)*(s-c));
if(EQ(S,sum))printf("YES\n");
else printf("NO\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143492/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143492/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 [32 x i8] c"%lf %lf %lf %lf %lf %lf %lf %lf\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:
%x = alloca [4 x double], align 16
%y = alloca [4 x double], align 16
call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %x) #7
call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %y) #7
%arrayidx = getelementptr inbounds [4 x double], ptr %x, i64 0, i64 1
%arrayidx1 = getelementptr inbounds [4 x double], ptr %y, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [4 x double], ptr %x, i64 0, i64 2
%arrayidx3 = getelementptr inbounds [4 x double], ptr %y, i64 0, i64 2
%arrayidx4 = getelementptr inbounds [4 x double], ptr %x, i64 0, i64 3
%arrayidx5 = getelementptr inbounds [4 x double], ptr %y, i64 0, i64 3
%call278 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %x, ptr noundef nonnull %y)
%tobool.not279 = icmp eq i32 %call278, -1
br i1 %tobool.not279, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %arrayidx, align 8, !tbaa !5
%1 = load double, ptr %arrayidx1, align 8, !tbaa !5
%2 = load <2 x double>, ptr %arrayidx2, align 16, !tbaa !5
%3 = shufflevector <2 x double> %2, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%4 = extractelement <2 x double> %2, i64 0
%sub = fsub double %0, %4
%5 = load <2 x double>, ptr %arrayidx3, align 16, !tbaa !5
%6 = shufflevector <2 x double> %5, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%7 = extractelement <2 x double> %5, i64 0
%sub15 = fsub double %1, %7
%mul19 = fmul double %sub15, %sub15
%8 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul19)
%sqrt277 = call double @llvm.sqrt.f64(double %8)
%9 = insertelement <2 x double> %2, double %0, i64 0
%10 = fsub <2 x double> %9, %3
%11 = insertelement <2 x double> %5, double %1, i64 0
%12 = fsub <2 x double> %11, %6
%13 = fmul <2 x double> %12, %12
%14 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %10, <2 x double> %10, <2 x double> %13)
%15 = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %14)
%16 = extractelement <2 x double> %15, i64 1
%add = fadd double %sqrt277, %16
%17 = extractelement <2 x double> %15, i64 0
%add49 = fadd double %add, %17
%div = fmul double %add49, 5.000000e-01
%sub50 = fsub double %div, %sqrt277
%mul = fmul double %div, %sub50
%18 = insertelement <2 x double> poison, double %div, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = fsub <2 x double> %19, %15
%21 = extractelement <2 x double> %20, i64 1
%mul52 = fmul double %21, %mul
%22 = extractelement <2 x double> %20, i64 0
%mul54 = fmul double %22, %mul52
%call55 = call double @sqrt(double noundef %mul54) #7
%23 = load double, ptr %x, align 16, !tbaa !5
%24 = load double, ptr %y, align 16, !tbaa !5
%25 = load <2 x double>, ptr %arrayidx2, align 16, !tbaa !5
%26 = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%27 = extractelement <2 x double> %25, i64 0
%sub58 = fsub double %23, %27
%28 = load <2 x double>, ptr %arrayidx3, align 16, !tbaa !5
%29 = shufflevector <2 x double> %28, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%30 = extractelement <2 x double> %28, i64 0
%sub65 = fsub double %24, %30
%mul69 = fmul double %sub65, %sub65
%31 = call double @llvm.fmuladd.f64(double %sub58, double %sub58, double %mul69)
%sqrt274 = call double @llvm.sqrt.f64(double %31)
%32 = insertelement <2 x double> %25, double %23, i64 0
%33 = fsub <2 x double> %32, %26
%34 = insertelement <2 x double> %28, double %24, i64 0
%35 = fsub <2 x double> %34, %29
%36 = fmul <2 x double> %35, %35
%37 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %33, <2 x double> %33, <2 x double> %36)
%38 = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %37)
%39 = extractelement <2 x double> %38, i64 1
%add101 = fadd double %sqrt274, %39
%40 = extractelement <2 x double> %38, i64 0
%add102 = fadd double %add101, %40
%div103 = fmul double %add102, 5.000000e-01
%sub104 = fsub double %div103, %sqrt274
%mul105 = fmul double %div103, %sub104
%41 = insertelement <2 x double> poison, double %div103, i64 0
%42 = shufflevector <2 x double> %41, <2 x double> poison, <2 x i32> zeroinitializer
%43 = fsub <2 x double> %42, %38
%44 = extractelement <2 x double> %43, i64 1
%mul107 = fmul double %44, %mul105
%45 = extractelement <2 x double> %43, i64 0
%mul109 = fmul double %45, %mul107
%call110 = call double @sqrt(double noundef %mul109) #7
%add111 = fadd double %call110, 0.000000e+00
%46 = load double, ptr %arrayidx, align 8, !tbaa !5
%47 = load double, ptr %x, align 16, !tbaa !5
%sub114 = fsub double %46, %47
%48 = load double, ptr %arrayidx1, align 8, !tbaa !5
%49 = load double, ptr %y, align 16, !tbaa !5
%sub121 = fsub double %48, %49
%mul125 = fmul double %sub121, %sub121
%50 = call double @llvm.fmuladd.f64(double %sub114, double %sub114, double %mul125)
%sqrt271 = call double @llvm.sqrt.f64(double %50)
%51 = load double, ptr %arrayidx4, align 8, !tbaa !5
%52 = load double, ptr %arrayidx5, align 8, !tbaa !5
%53 = insertelement <2 x double> poison, double %46, i64 0
%54 = insertelement <2 x double> %53, double %51, i64 1
%55 = insertelement <2 x double> poison, double %51, i64 0
%56 = insertelement <2 x double> %55, double %47, i64 1
%57 = fsub <2 x double> %54, %56
%58 = insertelement <2 x double> poison, double %48, i64 0
%59 = insertelement <2 x double> %58, double %52, i64 1
%60 = insertelement <2 x double> poison, double %52, i64 0
%61 = insertelement <2 x double> %60, double %49, i64 1
%62 = fsub <2 x double> %59, %61
%63 = fmul <2 x double> %62, %62
%64 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %57, <2 x double> %57, <2 x double> %63)
%65 = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %64)
%66 = extractelement <2 x double> %65, i64 1
%add157 = fadd double %sqrt271, %66
%67 = extractelement <2 x double> %65, i64 0
%add158 = fadd double %add157, %67
%div159 = fmul double %add158, 5.000000e-01
%sub160 = fsub double %div159, %sqrt271
%mul161 = fmul double %div159, %sub160
%68 = insertelement <2 x double> poison, double %div159, i64 0
%69 = shufflevector <2 x double> %68, <2 x double> poison, <2 x i32> zeroinitializer
%70 = fsub <2 x double> %69, %65
%71 = extractelement <2 x double> %70, i64 1
%mul163 = fmul double %71, %mul161
%72 = extractelement <2 x double> %70, i64 0
%mul165 = fmul double %72, %mul163
%call166 = call double @sqrt(double noundef %mul165) #7
%add167 = fadd double %add111, %call166
%73 = load double, ptr %arrayidx2, align 16, !tbaa !5
%74 = load double, ptr %arrayidx3, align 16, !tbaa !5
%75 = load <2 x double>, ptr %x, align 16, !tbaa !5
%76 = shufflevector <2 x double> %75, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%77 = extractelement <2 x double> %75, i64 1
%sub170 = fsub double %77, %73
%78 = load <2 x double>, ptr %y, align 16, !tbaa !5
%79 = shufflevector <2 x double> %78, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%80 = extractelement <2 x double> %78, i64 1
%sub177 = fsub double %80, %74
%mul181 = fmul double %sub177, %sub177
%81 = call double @llvm.fmuladd.f64(double %sub170, double %sub170, double %mul181)
%sqrt268 = call double @llvm.sqrt.f64(double %81)
%82 = insertelement <2 x double> %75, double %73, i64 1
%83 = fsub <2 x double> %76, %82
%84 = insertelement <2 x double> %78, double %74, i64 1
%85 = fsub <2 x double> %79, %84
%86 = fmul <2 x double> %85, %85
%87 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %83, <2 x double> %83, <2 x double> %86)
%88 = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %87)
%89 = extractelement <2 x double> %88, i64 1
%add213 = fadd double %sqrt268, %89
%90 = extractelement <2 x double> %88, i64 0
%add214 = fadd double %add213, %90
%div215 = fmul double %add214, 5.000000e-01
%sub216 = fsub double %div215, %sqrt268
%mul217 = fmul double %div215, %sub216
%91 = insertelement <2 x double> poison, double %div215, i64 0
%92 = shufflevector <2 x double> %91, <2 x double> poison, <2 x i32> zeroinitializer
%93 = fsub <2 x double> %92, %88
%94 = extractelement <2 x double> %93, i64 1
%mul219 = fmul double %94, %mul217
%95 = extractelement <2 x double> %93, i64 0
%mul221 = fmul double %95, %mul219
%call222 = call double @sqrt(double noundef %mul221) #7
%add223 = fadd double %add167, %call222
%sub224 = fsub double %call55, %add223
%96 = call double @llvm.fabs.f64(double %sub224)
%cmp = fcmp olt double %96, 1.000000e-10
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %x, ptr noundef nonnull %y)
%tobool.not = icmp eq i32 %call, -1
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %y) #7
call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %x) #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(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #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 nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.sqrt.v2f64(<2 x double>) #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(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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !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 <math.h>
#include <stdlib.h>
#define d double
double s_of_triangle( d ax, d ay, d bx, d by, d cx, d cy ){
double a1, a2, b1, b2;
a1 = ax - cx;
a2 = ay - cy;
b1 = bx - cx;
b2 = by - cy;
return abs((1/2.0)*(a1*b2-a2*b1));
}
int main(){
double ax, ay, bx, by, cx, cy, px, py;
double s, s1, s2, s3;
while( scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
&ax, &ay, &bx, &by, &cx, &cy, &px, &py ) != EOF ){
s = s_of_triangle( ax, ay, bx, by, cx, cy );
s1 = s_of_triangle( px, py, bx, by, cx, cy );
s2 = s_of_triangle( ax, ay, px, py, cx, cy );
s3 = s_of_triangle( ax, ay, bx, by, px, py );
if( s1+s2+s3 > s )
printf("NO\n");
else
printf("YES\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143535/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143535/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 [32 x i8] c"%lf %lf %lf %lf %lf %lf %lf %lf\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: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local double @s_of_triangle(double noundef %ax, double noundef %ay, double noundef %bx, double noundef %by, double noundef %cx, double noundef %cy) local_unnamed_addr #0 {
entry:
%sub = fsub double %ax, %cx
%sub1 = fsub double %ay, %cy
%sub2 = fsub double %bx, %cx
%sub3 = fsub double %by, %cy
%0 = fneg double %sub1
%neg = fmul double %sub2, %0
%1 = tail call double @llvm.fmuladd.f64(double %sub, double %sub3, double %neg)
%mul = fmul double %1, 5.000000e-01
%conv = fptosi double %mul to i32
%2 = tail call i32 @llvm.abs.i32(i32 %conv, i1 true)
%conv5 = sitofp i32 %2 to double
ret double %conv5
}
; 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 speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #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 uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%ax = alloca double, align 8
%ay = alloca double, align 8
%bx = alloca double, align 8
%by = alloca double, align 8
%cx = alloca double, align 8
%cy = alloca double, align 8
%px = alloca double, align 8
%py = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %ax) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %ay) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %bx) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %by) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %cx) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %cy) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %px) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %py) #7
%call34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ax, ptr noundef nonnull %ay, ptr noundef nonnull %bx, ptr noundef nonnull %by, ptr noundef nonnull %cx, ptr noundef nonnull %cy, ptr noundef nonnull %px, ptr noundef nonnull %py)
%cmp.not35 = icmp eq i32 %call34, -1
br i1 %cmp.not35, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %ax, align 8, !tbaa !5
%1 = load double, ptr %ay, align 8, !tbaa !5
%2 = load double, ptr %bx, align 8, !tbaa !5
%3 = load double, ptr %by, align 8, !tbaa !5
%4 = load double, ptr %cx, align 8, !tbaa !5
%5 = load double, ptr %cy, align 8, !tbaa !5
%sub1.i = fsub double %1, %5
%sub2.i = fsub double %2, %4
%6 = load double, ptr %px, align 8, !tbaa !5
%7 = load double, ptr %py, align 8, !tbaa !5
%8 = insertelement <2 x double> poison, double %7, i64 0
%9 = insertelement <2 x double> %8, double %3, i64 1
%10 = insertelement <2 x double> poison, double %5, i64 0
%11 = shufflevector <2 x double> %10, <2 x double> poison, <2 x i32> zeroinitializer
%12 = fsub <2 x double> %9, %11
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> <i32 poison, i32 0>
%14 = insertelement <2 x double> %13, double %sub1.i, i64 0
%15 = fneg <2 x double> %14
%16 = extractelement <2 x double> %15, i64 0
%neg.i = fmul double %sub2.i, %16
%17 = insertelement <2 x double> poison, double %0, i64 0
%18 = insertelement <2 x double> %17, double %6, i64 1
%19 = insertelement <2 x double> poison, double %4, i64 0
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
%21 = fsub <2 x double> %18, %20
%22 = extractelement <2 x double> %21, i64 0
%23 = extractelement <2 x double> %12, i64 1
%24 = call double @llvm.fmuladd.f64(double %22, double %23, double %neg.i)
%mul.i = fmul double %24, 5.000000e-01
%conv.i = fptosi double %mul.i to i32
%25 = call i32 @llvm.abs.i32(i32 %conv.i, i1 true)
%26 = zext i32 %25 to i64
%27 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%28 = insertelement <2 x double> %27, double %sub2.i, i64 1
%29 = fmul <2 x double> %28, %15
%30 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %21, <2 x double> %12, <2 x double> %29)
%31 = fmul <2 x double> %30, <double 5.000000e-01, double 5.000000e-01>
%32 = fptosi <2 x double> %31 to <2 x i32>
%33 = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %32, i1 true)
%sub.i26 = fsub double %0, %6
%sub1.i27 = fsub double %1, %7
%sub2.i28 = fsub double %2, %6
%sub3.i29 = fsub double %3, %7
%34 = fneg double %sub1.i27
%neg.i30 = fmul double %sub2.i28, %34
%35 = call double @llvm.fmuladd.f64(double %sub.i26, double %sub3.i29, double %neg.i30)
%mul.i31 = fmul double %35, 5.000000e-01
%conv.i32 = fptosi double %mul.i31 to i32
%36 = call i32 @llvm.abs.i32(i32 %conv.i32, i1 true)
%37 = zext i32 %36 to i64
%shift = shufflevector <2 x i32> %33, <2 x i32> poison, <2 x i32> <i32 1, i32 poison>
%38 = add nuw <2 x i32> %33, %shift
%narrow = extractelement <2 x i32> %38, i64 0
%add36 = zext i32 %narrow to i64
%add537 = add nuw nsw i64 %add36, %37
%cmp638 = icmp ugt i64 %add537, %26
%str.3.str = select i1 %cmp638, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ax, ptr noundef nonnull %ay, ptr noundef nonnull %bx, ptr noundef nonnull %by, ptr noundef nonnull %cx, ptr noundef nonnull %cy, ptr noundef nonnull %px, ptr noundef nonnull %py)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %py) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %px) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %cy) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %cx) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %by) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %bx) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %ay) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %ax) #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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i32> @llvm.abs.v2i32(<2 x i32>, i1 immarg) #6
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 = { 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 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !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()
{
long long int a,b,i,odd=0,even=0;
scanf("%lld",&a);
for(i=0;i<a;i++){
scanf("%lld",&b);
if(b%2==0)
even++;
else if(b%2!=0)
odd++;
}
if(odd%2==0)
printf("YES");
else
printf("NO");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143579/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143579/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 [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() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i64, ptr %a, align 8, !tbaa !5
%cmp18 = icmp sgt i64 %0, 0
br i1 %cmp18, label %for.body, label %if.end15
for.body: ; preds = %entry, %for.body
%odd.020 = phi i64 [ %odd.1, %for.body ], [ 0, %entry ]
%i.019 = phi i64 [ %inc8, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%1 = load i64, ptr %b, align 8, !tbaa !5
%2 = and i64 %1, 1
%odd.1 = add i64 %2, %odd.020
%inc8 = add nuw nsw i64 %i.019, 1
%3 = load i64, ptr %a, align 8, !tbaa !5
%cmp = icmp slt i64 %inc8, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%4 = and i64 %odd.1, 1
%5 = icmp eq i64 %4, 0
%spec.select = select i1 %5, ptr @.str.1, ptr @.str.2
br label %if.end15
if.end15: ; preds = %for.end, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ %spec.select, %for.end ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"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>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int descending_compare(const void *a, const void *b){
if (*(int*)a > *(int*)b){
return -1;
}else if (*(int*)a == *(int*)b){
return 0;
}else{
return 1;
}
}
int ascending_compare(const void *a, const void *b){
if (*(int*)a < *(int*)b){
return -1;
}else if (*(int*)a == *(int*)b){
return 0;
}else{
return 1;
}
}
int lower_bound(int *a, int n, int key){
int left, mid, right;
left = 0, right = n;
mid = (left + right)/2;
while ((left+1 != mid || mid+1 != right) && mid != left){
if (key > a[mid]){
left = mid;
}else{
right = mid+1;
}
mid = (left + right)/2;
}
if (a[left] >= key)return left;
if (a[mid] >= key)return mid;
if (a[right] >= key)return right;
return n;
}
unsigned long gcd(unsigned long x, unsigned long y)
{
if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
long long calc(int x){
long long rtn = 1;
int i;
for (i = x; i > 1; i--){
rtn = (rtn*i);
}
return rtn;
}
int main(void){
int n;
int even = 0;
int odd = 0;
int a;
int i;
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d", &a);
if (a % 2 == 0){
even++;
}else{
odd++;
}
}
even += odd/2;
odd = odd % 2;
while (even > 1){
even = even/2 + even%2;
}
if (even + odd == 1){
printf("YES\n");
}else{
printf("NO\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143629/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143629/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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @descending_compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %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 @ascending_compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @lower_bound(ptr nocapture noundef readonly %a, i32 noundef %n, i32 noundef %key) local_unnamed_addr #1 {
entry:
%mid.050 = sdiv i32 %n, 2
%0 = and i32 %n, -2
%cmp.not51 = icmp eq i32 %0, 2
%add252 = add nsw i32 %mid.050, 1
%cmp3.not53 = icmp eq i32 %add252, %n
%or.cond54 = select i1 %cmp.not51, i1 %cmp3.not53, i1 false
%n.off = add i32 %n, 1
%cmp4.not55 = icmp ult i32 %n.off, 3
%or.cond4956 = or i1 %cmp4.not55, %or.cond54
br i1 %or.cond4956, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%add260 = phi i32 [ %add2, %while.body ], [ %add252, %entry ]
%mid.059 = phi i32 [ %mid.0, %while.body ], [ %mid.050, %entry ]
%right.058 = phi i32 [ %right.1, %while.body ], [ %n, %entry ]
%left.057 = phi i32 [ %left.1, %while.body ], [ 0, %entry ]
%idxprom = sext i32 %mid.059 to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5 = icmp slt i32 %1, %key
%left.1 = select i1 %cmp5, i32 %mid.059, i32 %left.057
%right.1 = select i1 %cmp5, i32 %right.058, i32 %add260
%add7 = add nsw i32 %left.1, %right.1
%mid.0 = sdiv i32 %add7, 2
%add1 = add nsw i32 %left.1, 1
%cmp.not = icmp eq i32 %add1, %mid.0
%add2 = add nsw i32 %mid.0, 1
%cmp3.not = icmp eq i32 %add2, %right.1
%or.cond = select i1 %cmp.not, i1 %cmp3.not, i1 false
%cmp4.not = icmp eq i32 %mid.0, %left.1
%or.cond49 = or i1 %cmp4.not, %or.cond
br i1 %or.cond49, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%left.0.lcssa = phi i32 [ 0, %entry ], [ %left.1, %while.body ]
%right.0.lcssa = phi i32 [ %n, %entry ], [ %right.1, %while.body ]
%mid.0.lcssa = phi i32 [ %mid.050, %entry ], [ %mid.0, %while.body ]
%idxprom9 = sext i32 %left.0.lcssa to i64
%arrayidx10 = getelementptr inbounds i32, ptr %a, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11.not = icmp slt i32 %2, %key
br i1 %cmp11.not, label %if.end13, label %cleanup
if.end13: ; preds = %while.end
%idxprom14 = sext i32 %mid.0.lcssa to i64
%arrayidx15 = getelementptr inbounds i32, ptr %a, i64 %idxprom14
%3 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%cmp16.not = icmp slt i32 %3, %key
br i1 %cmp16.not, label %if.end18, label %cleanup
if.end18: ; preds = %if.end13
%idxprom19 = sext i32 %right.0.lcssa to i64
%arrayidx20 = getelementptr inbounds i32, ptr %a, i64 %idxprom19
%4 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.not = icmp slt i32 %4, %key
%n.right.0 = select i1 %cmp21.not, i32 %n, i32 %right.0.lcssa
br label %cleanup
cleanup: ; preds = %if.end18, %if.end13, %while.end
%retval.0 = phi i32 [ %left.0.lcssa, %while.end ], [ %mid.0.lcssa, %if.end13 ], [ %n.right.0, %if.end18 ]
ret i32 %retval.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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #3 {
entry:
%cmp4 = icmp eq i64 %y, 0
br i1 %cmp4, label %return, label %if.else
if.else: ; preds = %entry, %if.else
%y.tr6 = phi i64 [ %rem, %if.else ], [ %y, %entry ]
%x.tr5 = phi i64 [ %y.tr6, %if.else ], [ %x, %entry ]
%rem = urem i64 %x.tr5, %y.tr6
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %return, label %if.else
return: ; preds = %if.else, %entry
%x.tr.lcssa = phi i64 [ %x, %entry ], [ %y.tr6, %if.else ]
ret i64 %x.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @calc(i32 noundef %x) local_unnamed_addr #3 {
entry:
%cmp4 = icmp sgt i32 %x, 1
br i1 %cmp4, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = zext i32 %x to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%rtn.05 = phi i64 [ 1, %for.body.preheader ], [ %mul, %for.body ]
%mul = mul nsw i64 %rtn.05, %indvars.iv
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp = icmp ugt i64 %indvars.iv, 2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%rtn.0.lcssa = phi i64 [ 1, %entry ], [ %mul, %for.body ]
ret i64 %rtn.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %0, 0
br i1 %cmp28, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.031 = phi i32 [ %inc4, %for.body ], [ 0, %entry ]
%odd.030 = phi i32 [ %odd.1, %for.body ], [ 0, %entry ]
%even.029 = phi i32 [ %even.1, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = and i32 %1, 1
%3 = xor i32 %2, 1
%even.1 = add i32 %3, %even.029
%odd.1 = add i32 %2, %odd.030
%inc4 = add nuw nsw i32 %i.031, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc4, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body, %entry
%even.0.lcssa = phi i32 [ 0, %entry ], [ %even.1, %for.body ]
%odd.0.lcssa = phi i32 [ 0, %entry ], [ %odd.1, %for.body ]
%div = sdiv i32 %odd.0.lcssa, 2
%add = add nsw i32 %div, %even.0.lcssa
%even.2.lcssa = call i32 @llvm.smin.i32(i32 %add, i32 1)
%rem5 = srem i32 %odd.0.lcssa, 2
%add10 = add nsw i32 %even.2.lcssa, %rem5
%cmp11 = icmp eq i32 %add10, 1
%str.3.str = select i1 %cmp11, 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 %a) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = { nofree nounwind }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(int argc, char const *argv[]) {
long n,i,a,num=0;
scanf("%ld",&n);
for(i=0;i<n;i++){
scanf("%ld",&a);
if(a%2==1) num++;
}
if(num%2==1) printf("NO\n");
else printf("YES\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143672/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143672/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 = 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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%a = 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 %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp13 = icmp sgt i64 %0, 0
br i1 %cmp13, label %for.body, label %if.else
for.body: ; preds = %entry, %for.body
%num.015 = phi i64 [ %spec.select, %for.body ], [ 0, %entry ]
%i.014 = phi i64 [ %inc3, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i64, ptr %a, align 8, !tbaa !5
%2 = and i64 %1, -9223372036854775807
%cmp2 = icmp eq i64 %2, 1
%inc = zext i1 %cmp2 to i64
%spec.select = add nuw nsw i64 %num.015, %inc
%inc3 = add nuw nsw i64 %i.014, 1
%3 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc3, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%4 = and i64 %spec.select, 1
%5 = icmp eq i64 %4, 0
br i1 %5, label %if.else, label %if.end9
if.else: ; preds = %entry, %for.end
br label %if.end9
if.end9: ; preds = %for.end, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %for.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 8, 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 @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 = !{!"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)
{
long long int a, b, tmp;
while(1){
int i=1,r;
scanf("%lld %lld", &a, &b);
if(a == 0&&b == 0) break;
if(a<b)
{
tmp=a;
a=b;
b=tmp;
}
r = a%b;
while(r != 0){
a=b;
b=r;
r=a%b;
i++;
}
printf("%lld %d\n", b, i);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143715/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143715/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 [9 x i8] c"%lld %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
%call28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i64, ptr %a, align 8, !tbaa !5
%cmp29 = icmp eq i64 %0, 0
%1 = load i64, ptr %b, align 8
%cmp130 = icmp eq i64 %1, 0
%or.cond31 = select i1 %cmp29, i1 %cmp130, i1 false
br i1 %or.cond31, label %while.end14, label %if.end
if.end: ; preds = %entry, %cleanup
%2 = phi i64 [ %10, %cleanup ], [ %1, %entry ]
%3 = phi i64 [ %9, %cleanup ], [ %0, %entry ]
%cmp2 = icmp slt i64 %3, %2
br i1 %cmp2, label %if.then3, label %if.end4
if.then3: ; preds = %if.end
store i64 %2, ptr %a, align 8, !tbaa !5
store i64 %3, ptr %b, align 8, !tbaa !5
br label %if.end4
if.end4: ; preds = %if.then3, %if.end
%4 = phi i64 [ %3, %if.then3 ], [ %2, %if.end ]
%5 = phi i64 [ %2, %if.then3 ], [ %3, %if.end ]
%rem = srem i64 %5, %4
%6 = and i64 %rem, 4294967295
%cmp6.not24 = icmp eq i64 %6, 0
br i1 %cmp6.not24, label %cleanup, label %while.body8
while.body8: ; preds = %if.end4, %while.body8
%r.0.in27 = phi i64 [ %rem10, %while.body8 ], [ %rem, %if.end4 ]
%i.026 = phi i32 [ %inc, %while.body8 ], [ 1, %if.end4 ]
%conv92325 = phi i64 [ %conv9, %while.body8 ], [ %4, %if.end4 ]
%sext = shl i64 %r.0.in27, 32
%conv9 = ashr exact i64 %sext, 32
%rem10 = srem i64 %conv92325, %conv9
%inc = add nuw nsw i32 %i.026, 1
%7 = and i64 %rem10, 4294967295
%cmp6.not = icmp eq i64 %7, 0
br i1 %cmp6.not, label %while.cond5.cleanup_crit_edge, label %while.body8, !llvm.loop !9
while.cond5.cleanup_crit_edge: ; preds = %while.body8
store i64 %conv92325, ptr %a, align 8, !tbaa !5
store i64 %conv9, ptr %b, align 8, !tbaa !5
br label %cleanup
cleanup: ; preds = %while.cond5.cleanup_crit_edge, %if.end4
%8 = phi i64 [ %conv9, %while.cond5.cleanup_crit_edge ], [ %4, %if.end4 ]
%i.0.lcssa = phi i32 [ %inc, %while.cond5.cleanup_crit_edge ], [ 1, %if.end4 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %8, i32 noundef %i.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%9 = load i64, ptr %a, align 8, !tbaa !5
%cmp = icmp eq i64 %9, 0
%10 = load i64, ptr %b, align 8
%cmp1 = icmp eq i64 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end14, label %if.end
while.end14: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"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>
#include <math.h>
#include <stdlib.h>
int step,x,y;
void swap (int* x,int* y){
int z;
z=*x;
*x=*y;
*y=z;
}
int main(){
while(scanf("%d %d",&x,&y)*x*y){
step=0;
if(x<y)swap(&x,&y);
while(y>0){
step++;
x=x%y;
swap(&x,&y);
}
printf("%d %d\n",x,step);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143788/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143788/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
@x = dso_local global i32 0, align 4
@y = dso_local global i32 0, align 4
@step = dso_local local_unnamed_addr global i32 0, align 4
@.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(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
store i32 %1, ptr %x, align 4, !tbaa !5
store i32 %0, ptr %y, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call10 = tail 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
%mul11 = mul nsw i32 %0, %call10
%1 = load i32, ptr @y, align 4, !tbaa !5
%mul112 = mul nsw i32 %mul11, %1
%tobool.not13 = icmp eq i32 %mul112, 0
br i1 %tobool.not13, label %while.end6, label %while.body
while.body: ; preds = %entry, %while.end
%2 = phi i32 [ %9, %while.end ], [ %1, %entry ]
%3 = phi i32 [ %8, %while.end ], [ %0, %entry ]
store i32 0, ptr @step, align 4, !tbaa !5
%cmp = icmp slt i32 %3, %2
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %while.body
store i32 %2, ptr @x, align 4, !tbaa !5
store i32 %3, ptr @y, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %while.body
%x.promoted = phi i32 [ %2, %if.then ], [ %3, %while.body ]
%.pr = phi i32 [ %3, %if.then ], [ %2, %while.body ]
%cmp38 = icmp sgt i32 %.pr, 0
br i1 %cmp38, label %while.body4, label %while.end
while.body4: ; preds = %if.end, %while.body4
%4 = phi i32 [ %rem, %while.body4 ], [ %.pr, %if.end ]
%inc79 = phi i32 [ %inc, %while.body4 ], [ 0, %if.end ]
%5 = phi i32 [ %4, %while.body4 ], [ %x.promoted, %if.end ]
%inc = add nuw nsw i32 %inc79, 1
%rem = srem i32 %5, %4
%cmp3 = icmp sgt i32 %rem, 0
br i1 %cmp3, label %while.body4, label %while.cond2.while.end_crit_edge, !llvm.loop !9
while.cond2.while.end_crit_edge: ; preds = %while.body4
store i32 %inc, ptr @step, align 4, !tbaa !5
store i32 %4, ptr @x, align 4, !tbaa !5
store i32 %rem, ptr @y, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond2.while.end_crit_edge, %if.end
%6 = phi i32 [ %inc, %while.cond2.while.end_crit_edge ], [ 0, %if.end ]
%7 = phi i32 [ %4, %while.cond2.while.end_crit_edge ], [ %x.promoted, %if.end ]
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7, i32 noundef %6)
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x, ptr noundef nonnull @y)
%8 = load i32, ptr @x, align 4, !tbaa !5
%mul = mul nsw i32 %8, %call
%9 = load i32, ptr @y, align 4, !tbaa !5
%mul1 = mul nsw i32 %mul, %9
%tobool.not = icmp eq i32 %mul1, 0
br i1 %tobool.not, label %while.end6, label %while.body, !llvm.loop !11
while.end6: ; preds = %while.end, %entry
ret i32 0
}
; 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
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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!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 a,b;
scanf("%d %d",&a ,&b);
printf("%d", (a+b+2-1)/2);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143830/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143830/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) #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
%add = add i32 %0, 1
%sub = add i32 %add, %1
%div = sdiv i32 %sub, 2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
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,x,y;
scanf("%d %d",&a,&b);
x=(a+b)/2;
y=(a+b)%2;
if(y==1)
x=x+1;
printf("%d",x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143874/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143874/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) #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
%add = add nsw i32 %1, %0
%div = sdiv i32 %add, 2
%2 = and i32 %add, -2147483647
%cmp = icmp eq i32 %2, 1
%add2 = zext i1 %cmp to i32
%spec.select = add nsw i32 %div, %add2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select)
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) {
double a, b;
scanf("%lf %lf", &a, &b);
printf("%d", (int)((a+b+1.0)/2));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143917/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143917/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 [8 x i8] c"%lf %lf\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 double, align 8
%b = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load double, ptr %a, align 8, !tbaa !5
%1 = load double, ptr %b, align 8, !tbaa !5
%add = fadd double %0, %1
%add1 = fadd double %add, 1.000000e+00
%div = fmul double %add1, 5.000000e-01
%conv = fptosi double %div to i32
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
int main(){
ll n,m;
scanf("%lld%lld",&n,&m);
printf("%lld",(n+m+1)/2);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143960/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143960/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"%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
%m = 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 %m) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = load i64, ptr %m, align 8, !tbaa !5
%add = add i64 %0, 1
%add1 = add i64 %add, %1
%div = sdiv i64 %add1, 2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #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>
int main() {
int a, b, c;
scanf("%d %d", &a, &b);
if ((a+b)%2==1)
a=a+1;
printf("%d",(a+b)/2);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144002/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144002/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) #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
%add = add nsw i32 %1, %0
%2 = and i32 %add, -2147483647
%cmp = icmp eq i32 %2, 1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %0, 1
store i32 %add1, ptr %a, align 4, !tbaa !5
%.pre = add nsw i32 %add1, %1
br label %if.end
if.end: ; preds = %if.then, %entry
%add2.pre-phi = phi i32 [ %.pre, %if.then ], [ %add, %entry ]
%div = sdiv i32 %add2.pre-phi, 2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
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;
c += (a + b) % 2;
printf("%d\n", c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144053/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144053/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:
%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
%add = add nsw i32 %1, %0
%div = sdiv i32 %add, 2
%rem = srem i32 %add, 2
%add2 = add nsw i32 %div, %rem
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add2)
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;
int e;
scanf("%d %d",&a,&b);
int c;
int d;
e = a + b;
c = e / 2;
d = e % 2;
if(d > 0){
c = c+1;
printf("%d",c);
}
else {
printf("%d",c);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144097/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144097/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) #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
%add = add nsw i32 %1, %0
%div = sdiv i32 %add, 2
%2 = and i32 %add, -2147483647
%cmp = icmp eq i32 %2, 1
%add1 = zext i1 %cmp to i32
%div.sink = add nsw i32 %div, %add1
%call3 = 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>
#include <string.h>
#include <math.h>
char prime[50001];
void eratosthenes() {
int i, l, j, d;
memset(prime, 1, sizeof(prime));
prime[0] = prime[1] = 0;
for (i = 3, l = (int)sqrt(50000) + 1; i < l; i++) {
if (prime[i] == 1) {
for (d = i * 2, j = i + d; j <= 50000; j += d) {
prime[j] = 0;
}
}
}
}
int main(void) {
int n, i, pat;
eratosthenes();
while (scanf("%d", &n) == 1 && n) {
if (n&1 || n == 4) {
if (prime[n - 2]) {
puts("1");
}
else {
puts("0");
}
continue;
}
for (i = n - 1, pat = 0; i >= n / 2; i -= 2) {
if (prime[i] && prime[n - i]) {
pat++;
}
}
printf("%d\n", pat);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144147/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144147/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"
@prime = dso_local local_unnamed_addr global [50001 x i8] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"1\00", align 1
@.str.2 = private unnamed_addr constant [2 x i8] c"0\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @eratosthenes() local_unnamed_addr #0 {
entry:
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(50001) @prime, i8 1, i64 50001, i1 false)
store i8 0, ptr getelementptr inbounds ([50001 x i8], ptr @prime, i64 0, i64 1), align 1, !tbaa !5
store i8 0, ptr @prime, align 16, !tbaa !5
br label %for.body
for.body: ; preds = %for.inc13.1, %entry
%indvars.iv30 = phi i64 [ 3, %entry ], [ %indvars.iv.next31.1, %for.inc13.1 ]
%indvars.iv25 = phi i64 [ 6, %entry ], [ %indvars.iv.next26.1, %for.inc13.1 ]
%indvars.iv = phi i64 [ 9, %entry ], [ %indvars.iv.next.1, %for.inc13.1 ]
%arrayidx = getelementptr inbounds [50001 x i8], ptr @prime, i64 0, i64 %indvars.iv30
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp3 = icmp eq i8 %0, 1
br i1 %cmp3, label %for.body9, label %for.inc13
for.body9: ; preds = %for.body, %for.body9
%indvars.iv27 = phi i64 [ %indvars.iv.next28, %for.body9 ], [ %indvars.iv, %for.body ]
%arrayidx11 = getelementptr inbounds [50001 x i8], ptr @prime, i64 0, i64 %indvars.iv27
store i8 0, ptr %arrayidx11, align 1, !tbaa !5
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, %indvars.iv25
%cmp7 = icmp ult i64 %indvars.iv.next28, 50001
br i1 %cmp7, label %for.body9, label %for.inc13, !llvm.loop !8
for.inc13: ; preds = %for.body9, %for.body
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 3
%indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 2
%exitcond.not = icmp eq i64 %indvars.iv.next31, 224
br i1 %exitcond.not, label %for.end14, label %for.body.1, !llvm.loop !10
for.body.1: ; preds = %for.inc13
%arrayidx.1 = getelementptr inbounds [50001 x i8], ptr @prime, i64 0, i64 %indvars.iv.next31
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp3.1 = icmp eq i8 %1, 1
br i1 %cmp3.1, label %for.body9.1, label %for.inc13.1
for.body9.1: ; preds = %for.body.1, %for.body9.1
%indvars.iv27.1 = phi i64 [ %indvars.iv.next28.1, %for.body9.1 ], [ %indvars.iv.next, %for.body.1 ]
%arrayidx11.1 = getelementptr inbounds [50001 x i8], ptr @prime, i64 0, i64 %indvars.iv27.1
store i8 0, ptr %arrayidx11.1, align 1, !tbaa !5
%indvars.iv.next28.1 = add nuw nsw i64 %indvars.iv27.1, %indvars.iv.next26
%cmp7.1 = icmp ult i64 %indvars.iv.next28.1, 50001
br i1 %cmp7.1, label %for.body9.1, label %for.inc13.1, !llvm.loop !8
for.inc13.1: ; preds = %for.body9.1, %for.body.1
%indvars.iv.next31.1 = add nuw nsw i64 %indvars.iv30, 2
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 6
%indvars.iv.next26.1 = add nuw nsw i64 %indvars.iv25, 4
br label %for.body
for.end14: ; preds = %for.inc13
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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(50001) @prime, i8 1, i64 50001, i1 false)
store i8 0, ptr getelementptr inbounds ([50001 x i8], ptr @prime, i64 0, i64 1), align 1, !tbaa !5
store i8 0, ptr @prime, align 16, !tbaa !5
br label %for.body.i
for.body.i: ; preds = %for.inc13.i.1, %entry
%indvars.iv30.i = phi i64 [ 3, %entry ], [ %indvars.iv.next31.i.1, %for.inc13.i.1 ]
%indvars.iv25.i = phi i64 [ 6, %entry ], [ %indvars.iv.next26.i.1, %for.inc13.i.1 ]
%indvars.iv.i = phi i64 [ 9, %entry ], [ %indvars.iv.next.i.1, %for.inc13.i.1 ]
%arrayidx.i = getelementptr inbounds [50001 x i8], ptr @prime, i64 0, i64 %indvars.iv30.i
%0 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%cmp3.i = icmp eq i8 %0, 1
br i1 %cmp3.i, label %for.body9.i, label %for.inc13.i
for.body9.i: ; preds = %for.body.i, %for.body9.i
%indvars.iv27.i = phi i64 [ %indvars.iv.next28.i, %for.body9.i ], [ %indvars.iv.i, %for.body.i ]
%arrayidx11.i = getelementptr inbounds [50001 x i8], ptr @prime, i64 0, i64 %indvars.iv27.i
store i8 0, ptr %arrayidx11.i, align 1, !tbaa !5
%indvars.iv.next28.i = add nuw nsw i64 %indvars.iv27.i, %indvars.iv25.i
%cmp7.i = icmp ult i64 %indvars.iv.next28.i, 50001
br i1 %cmp7.i, label %for.body9.i, label %for.inc13.i, !llvm.loop !8
for.inc13.i: ; preds = %for.body9.i, %for.body.i
%indvars.iv.next31.i = add nuw nsw i64 %indvars.iv30.i, 1
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 3
%indvars.iv.next26.i = add nuw nsw i64 %indvars.iv25.i, 2
%exitcond.not.i = icmp eq i64 %indvars.iv.next31.i, 224
br i1 %exitcond.not.i, label %while.cond.preheader, label %for.body.i.1, !llvm.loop !10
for.body.i.1: ; preds = %for.inc13.i
%arrayidx.i.1 = getelementptr inbounds [50001 x i8], ptr @prime, i64 0, i64 %indvars.iv.next31.i
%1 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
%cmp3.i.1 = icmp eq i8 %1, 1
br i1 %cmp3.i.1, label %for.body9.i.1, label %for.inc13.i.1
for.body9.i.1: ; preds = %for.body.i.1, %for.body9.i.1
%indvars.iv27.i.1 = phi i64 [ %indvars.iv.next28.i.1, %for.body9.i.1 ], [ %indvars.iv.next.i, %for.body.i.1 ]
%arrayidx11.i.1 = getelementptr inbounds [50001 x i8], ptr @prime, i64 0, i64 %indvars.iv27.i.1
store i8 0, ptr %arrayidx11.i.1, align 1, !tbaa !5
%indvars.iv.next28.i.1 = add nuw nsw i64 %indvars.iv27.i.1, %indvars.iv.next26.i
%cmp7.i.1 = icmp ult i64 %indvars.iv.next28.i.1, 50001
br i1 %cmp7.i.1, label %for.body9.i.1, label %for.inc13.i.1, !llvm.loop !8
for.inc13.i.1: ; preds = %for.body9.i.1, %for.body.i.1
%indvars.iv.next31.i.1 = add nuw nsw i64 %indvars.iv30.i, 2
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 6
%indvars.iv.next26.i.1 = add nuw nsw i64 %indvars.iv25.i, 4
br label %for.body.i
while.cond.preheader: ; preds = %for.inc13.i
%call29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp30 = icmp eq i32 %call29, 1
%2 = load i32, ptr %n, align 4
%tobool31 = icmp ne i32 %2, 0
%3 = select i1 %cmp30, i1 %tobool31, i1 false
br i1 %3, label %while.body, label %while.end
while.body: ; preds = %while.cond.preheader, %while.cond.backedge
%4 = phi i32 [ %6, %while.cond.backedge ], [ %2, %while.cond.preheader ]
%and = and i32 %4, 1
%tobool1 = icmp ne i32 %and, 0
%cmp2 = icmp eq i32 %4, 4
%or.cond = or i1 %cmp2, %tobool1
br i1 %or.cond, label %if.then, label %if.end7
if.then: ; preds = %while.body
%sub = add nsw i32 %4, -2
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [50001 x i8], ptr @prime, i64 0, i64 %idxprom
%5 = load i8, ptr %arrayidx, align 1, !tbaa !5
%tobool3.not = icmp eq i8 %5, 0
br i1 %tobool3.not, label %if.else, label %if.then4
if.then4: ; preds = %if.then
%call5 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %while.cond.backedge
if.else: ; preds = %if.then
%call6 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %while.cond.backedge
while.cond.backedge: ; preds = %if.then4, %if.else, %for.end
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp = icmp eq i32 %call, 1
%6 = load i32, ptr %n, align 4
%tobool = icmp ne i32 %6, 0
%7 = select i1 %cmp, i1 %tobool, i1 false
br i1 %7, label %while.body, label %while.end, !llvm.loop !11
if.end7: ; preds = %while.body
%div = sdiv i32 %4, 2
%cmp9.not26.not = icmp sgt i32 %4, %div
br i1 %cmp9.not26.not, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %if.end7
%sub8 = add i32 %4, -1
%8 = sext i32 %sub8 to i64
%9 = sext i32 %div to i64
%10 = sext i32 %4 to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ %8, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%pat.028 = phi i32 [ 0, %for.body.preheader ], [ %pat.1, %for.inc ]
%arrayidx11 = getelementptr inbounds [50001 x i8], ptr @prime, i64 0, i64 %indvars.iv
%11 = load i8, ptr %arrayidx11, align 1, !tbaa !5
%tobool12.not = icmp eq i8 %11, 0
br i1 %tobool12.not, label %for.inc, label %land.lhs.true
land.lhs.true: ; preds = %for.body
%12 = sub nsw i64 %10, %indvars.iv
%arrayidx15 = getelementptr inbounds [50001 x i8], ptr @prime, i64 0, i64 %12
%13 = load i8, ptr %arrayidx15, align 1, !tbaa !5
%tobool17.not = icmp ne i8 %13, 0
%inc = zext i1 %tobool17.not to i32
%spec.select = add nsw i32 %pat.028, %inc
br label %for.inc
for.inc: ; preds = %land.lhs.true, %for.body
%pat.1 = phi i32 [ %pat.028, %for.body ], [ %spec.select, %land.lhs.true ]
%indvars.iv.next = add nsw i64 %indvars.iv, -2
%cmp9.not = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp9.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.inc, %if.end7
%pat.0.lcssa = phi i32 [ 0, %if.end7 ], [ %pat.1, %for.inc ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %pat.0.lcssa)
br label %while.cond.backedge
while.end: ; preds = %while.cond.backedge, %while.cond.preheader
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 #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9}
!12 = distinct !{!12, !9}
|
#include <stdio.h>
int main(int argc,char* argv[]){
int comb[50001];
int i,j;
int n;
for(i = 2;i <= 50000; i++){
comb[i] = 1;
}
comb[0] = comb[1] = 0;
for(i = 2; i < 224; i++){
if(comb[i] == 0){continue;}
for(j = 2; (i*j) <= 50000; j++){
comb[i*j] = 0;
}
}
for(;;){
int sum = 0;
scanf("%d",&n);
if(n == 0){break;}
for(i = 2; i <= (n/2); i++){
if(comb[i] != 0){
if(comb[n - i] != 0){
sum++;
}
}
}
printf("%d\n",sum);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144219/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144219/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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%comb = alloca [50001 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 200004, ptr nonnull %comb) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
br label %vector.body
vector.body: ; preds = %vector.body, %entry
%index = phi i64 [ 0, %entry ], [ %index.next.2, %vector.body ]
%offset.idx = or i64 %index, 2
%0 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 %offset.idx
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 8, !tbaa !5
%offset.idx.1 = add nuw i64 %index, 10
%2 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 %offset.idx.1
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 8, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 8, !tbaa !5
%offset.idx.2 = add nuw i64 %index, 18
%4 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 %offset.idx.2
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 8, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 8, !tbaa !5
%index.next.2 = add nuw nsw i64 %index, 24
%6 = icmp eq i64 %index.next.2, 49992
br i1 %6, label %for.body, label %vector.body, !llvm.loop !9
for.body: ; preds = %vector.body
%arrayidx = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 49994
store i32 1, ptr %arrayidx, align 8, !tbaa !5
%arrayidx.1 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 49995
store i32 1, ptr %arrayidx.1, align 4, !tbaa !5
%arrayidx.2 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 49996
store i32 1, ptr %arrayidx.2, align 16, !tbaa !5
%arrayidx.3 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 49997
store i32 1, ptr %arrayidx.3, align 4, !tbaa !5
%arrayidx.4 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 49998
store i32 1, ptr %arrayidx.4, align 8, !tbaa !5
%arrayidx.5 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 49999
store i32 1, ptr %arrayidx.5, align 4, !tbaa !5
%arrayidx.6 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 50000
store i32 1, ptr %arrayidx.6, align 16, !tbaa !5
%arrayidx1 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 1
store i32 0, ptr %arrayidx1, align 4, !tbaa !5
store i32 0, ptr %comb, align 16, !tbaa !5
br label %for.body5
for.cond21.preheader: ; preds = %for.inc18
%call73 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp2274 = icmp eq i32 %7, 0
br i1 %cmp2274, label %for.end43, label %for.cond25.preheader
for.body5: ; preds = %for.body, %for.inc18
%indvars.iv78 = phi i64 [ 2, %for.body ], [ %indvars.iv.next79, %for.inc18 ]
%indvars.iv76 = phi i64 [ 4, %for.body ], [ %indvars.iv.next77, %for.inc18 ]
%arrayidx7 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 %indvars.iv78
%8 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not = icmp eq i32 %8, 0
br i1 %cmp8.not, label %for.inc18, label %for.body11
for.body11: ; preds = %for.body5, %for.body11
%indvars.iv82 = phi i64 [ %indvars.iv.next83, %for.body11 ], [ 2, %for.body5 ]
%indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.body11 ], [ %indvars.iv76, %for.body5 ]
%arrayidx14 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 %indvars.iv80
store i32 0, ptr %arrayidx14, align 4, !tbaa !5
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%9 = mul nuw nsw i64 %indvars.iv.next83, %indvars.iv78
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, %indvars.iv78
%cmp10 = icmp ult i64 %9, 50001
br i1 %cmp10, label %for.body11, label %for.inc18, !llvm.loop !13
for.inc18: ; preds = %for.body11, %for.body5
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 2
%exitcond89.not = icmp eq i64 %indvars.iv.next79, 224
br i1 %exitcond89.not, label %for.cond21.preheader, label %for.body5, !llvm.loop !14
for.cond25.preheader: ; preds = %for.cond21.preheader, %cleanup
%10 = phi i32 [ %25, %cleanup ], [ %7, %for.cond21.preheader ]
%cmp26.not70 = icmp slt i32 %10, 4
br i1 %cmp26.not70, label %cleanup, label %for.body27.preheader
for.body27.preheader: ; preds = %for.cond25.preheader
%11 = zext i32 %10 to i64
%12 = lshr i32 %10, 1
%13 = zext i32 %12 to i64
%14 = add nsw i64 %13, -1
%xtraiter = and i64 %14, 1
%15 = icmp eq i32 %12, 2
br i1 %15, label %cleanup.loopexit.unr-lcssa, label %for.body27.preheader.new
for.body27.preheader.new: ; preds = %for.body27.preheader
%unroll_iter = and i64 %14, -2
br label %for.body27
for.body27: ; preds = %for.inc39.1, %for.body27.preheader.new
%indvars.iv90 = phi i64 [ 2, %for.body27.preheader.new ], [ %indvars.iv.next91.1, %for.inc39.1 ]
%sum.072 = phi i32 [ 0, %for.body27.preheader.new ], [ %sum.1.1, %for.inc39.1 ]
%niter = phi i64 [ 0, %for.body27.preheader.new ], [ %niter.next.1, %for.inc39.1 ]
%arrayidx29 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 %indvars.iv90
%16 = load i32, ptr %arrayidx29, align 8, !tbaa !5
%cmp30.not = icmp eq i32 %16, 0
br i1 %cmp30.not, label %for.inc39, label %if.then31
if.then31: ; preds = %for.body27
%17 = sub nsw i64 %11, %indvars.iv90
%arrayidx33 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 %17
%18 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34.not = icmp ne i32 %18, 0
%inc36 = zext i1 %cmp34.not to i32
%spec.select = add nsw i32 %sum.072, %inc36
br label %for.inc39
for.inc39: ; preds = %if.then31, %for.body27
%sum.1 = phi i32 [ %sum.072, %for.body27 ], [ %spec.select, %if.then31 ]
%indvars.iv.next91 = or i64 %indvars.iv90, 1
%arrayidx29.1 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 %indvars.iv.next91
%19 = load i32, ptr %arrayidx29.1, align 4, !tbaa !5
%cmp30.not.1 = icmp eq i32 %19, 0
br i1 %cmp30.not.1, label %for.inc39.1, label %if.then31.1
if.then31.1: ; preds = %for.inc39
%20 = sub nsw i64 %11, %indvars.iv.next91
%arrayidx33.1 = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 %20
%21 = load i32, ptr %arrayidx33.1, align 4, !tbaa !5
%cmp34.not.1 = icmp ne i32 %21, 0
%inc36.1 = zext i1 %cmp34.not.1 to i32
%spec.select.1 = add nsw i32 %sum.1, %inc36.1
br label %for.inc39.1
for.inc39.1: ; preds = %if.then31.1, %for.inc39
%sum.1.1 = phi i32 [ %sum.1, %for.inc39 ], [ %spec.select.1, %if.then31.1 ]
%indvars.iv.next91.1 = add nuw nsw i64 %indvars.iv90, 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 %cleanup.loopexit.unr-lcssa, label %for.body27, !llvm.loop !15
cleanup.loopexit.unr-lcssa: ; preds = %for.inc39.1, %for.body27.preheader
%sum.1.lcssa.ph = phi i32 [ undef, %for.body27.preheader ], [ %sum.1.1, %for.inc39.1 ]
%indvars.iv90.unr = phi i64 [ 2, %for.body27.preheader ], [ %indvars.iv.next91.1, %for.inc39.1 ]
%sum.072.unr = phi i32 [ 0, %for.body27.preheader ], [ %sum.1.1, %for.inc39.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %cleanup, label %for.body27.epil
for.body27.epil: ; preds = %cleanup.loopexit.unr-lcssa
%arrayidx29.epil = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 %indvars.iv90.unr
%22 = load i32, ptr %arrayidx29.epil, align 4, !tbaa !5
%cmp30.not.epil = icmp eq i32 %22, 0
br i1 %cmp30.not.epil, label %cleanup, label %if.then31.epil
if.then31.epil: ; preds = %for.body27.epil
%23 = sub nsw i64 %11, %indvars.iv90.unr
%arrayidx33.epil = getelementptr inbounds [50001 x i32], ptr %comb, i64 0, i64 %23
%24 = load i32, ptr %arrayidx33.epil, align 4, !tbaa !5
%cmp34.not.epil = icmp ne i32 %24, 0
%inc36.epil = zext i1 %cmp34.not.epil to i32
%spec.select.epil = add nsw i32 %sum.072.unr, %inc36.epil
br label %cleanup
cleanup: ; preds = %cleanup.loopexit.unr-lcssa, %if.then31.epil, %for.body27.epil, %for.cond25.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond25.preheader ], [ %sum.1.lcssa.ph, %cleanup.loopexit.unr-lcssa ], [ %sum.072.unr, %for.body27.epil ], [ %spec.select.epil, %if.then31.epil ]
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%25 = load i32, ptr %n, align 4, !tbaa !5
%cmp22 = icmp eq i32 %25, 0
br i1 %cmp22, label %for.end43, label %for.cond25.preheader
for.end43: ; preds = %cleanup, %for.cond21.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 200004, ptr nonnull %comb) #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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
#define max(a,b) ((a)>(b)?(a):(b))
int main(){
int n,i;
long a[100000],x;
long long ans=0;
scanf("%d%ld",&n,&x);
for(i=0;i<n;i++)scanf("%ld",&a[i]);
for(i=0;i<n-1;i++){
if(a[i]+a[i+1]>x){
if(x-a[i]>=0){
ans+=(a[i+1]-(x-a[i]));
a[i+1]=x-a[i];
}
else {
ans+=(a[i+1]+a[i]-x);
a[i+1]=0;
a[i]=x;
}
}
}
printf("%lld\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144277/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144277/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%ld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\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 [100000 x i64], align 16
%x = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %x)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp65 = icmp sgt i32 %0, 0
br i1 %cmp65, label %for.body, label %for.end46
for.cond2.preheader: ; preds = %for.body
%cmp367 = icmp sgt i32 %2, 1
br i1 %cmp367, label %for.body4.lr.ph, label %for.end46
for.body4.lr.ph: ; preds = %for.cond2.preheader
%sub = add nsw i32 %2, -1
%1 = load i64, ptr %x, align 8, !tbaa !9
%wide.trip.count = zext i32 %sub to i64
%.pre = load i64, ptr %a, align 16, !tbaa !9
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 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
%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 !11
for.body4: ; preds = %for.body4.lr.ph, %for.inc44
%4 = phi i64 [ %.pre, %for.body4.lr.ph ], [ %6, %for.inc44 ]
%indvars.iv73 = phi i64 [ 0, %for.body4.lr.ph ], [ %indvars.iv.next74, %for.inc44 ]
%ans.069 = phi i64 [ 0, %for.body4.lr.ph ], [ %ans.1, %for.inc44 ]
%arrayidx6 = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 %indvars.iv73
%indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
%arrayidx8 = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 %indvars.iv.next74
%5 = load i64, ptr %arrayidx8, align 8, !tbaa !9
%add9 = add nsw i64 %5, %4
%cmp10 = icmp sgt i64 %add9, %1
br i1 %cmp10, label %if.then, label %for.inc44
if.then: ; preds = %for.body4
%sub13 = sub nsw i64 %1, %4
%cmp14 = icmp sgt i64 %sub13, -1
br i1 %cmp14, label %if.then15, label %if.else
if.then15: ; preds = %if.then
%sub22 = add i64 %5, %ans.069
%add23 = sub i64 %sub22, %sub13
store i64 %sub13, ptr %arrayidx8, align 8, !tbaa !9
br label %for.inc44
if.else: ; preds = %if.then
%sub36 = sub i64 %ans.069, %1
%add37 = add i64 %sub36, %add9
store i64 0, ptr %arrayidx8, align 8, !tbaa !9
store i64 %1, ptr %arrayidx6, align 8, !tbaa !9
br label %for.inc44
for.inc44: ; preds = %for.body4, %if.else, %if.then15
%6 = phi i64 [ %sub13, %if.then15 ], [ 0, %if.else ], [ %5, %for.body4 ]
%ans.1 = phi i64 [ %add23, %if.then15 ], [ %add37, %if.else ], [ %ans.069, %for.body4 ]
%exitcond.not = icmp eq i64 %indvars.iv.next74, %wide.trip.count
br i1 %exitcond.not, label %for.end46, label %for.body4, !llvm.loop !13
for.end46: ; preds = %for.inc44, %entry, %for.cond2.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %ans.1, %for.inc44 ]
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 800000, 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: 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 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include<stdio.h>
int main()
{
int t,l,r;
scanf("%d",&t);
while(t--)
{
scanf("%d %d",&l,&r);
if(r<(2*l))
printf("-1 -1\n");
else
printf("%d %d\n",l,2*l);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14432/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14432/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.3 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@str = private unnamed_addr constant [6 x i8] c"-1 -1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec5 = add nsw i32 %0, -1
store i32 %dec5, ptr %t, align 4, !tbaa !5
%tobool.not6 = icmp eq i32 %0, 0
br i1 %tobool.not6, 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 %l, ptr noundef nonnull %r)
%1 = load i32, ptr %r, align 4, !tbaa !5
%2 = load i32, ptr %l, align 4, !tbaa !5
%mul = shl nsw i32 %2, 1
%cmp = icmp slt i32 %1, %mul
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %while.body
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %2, i32 noundef %mul)
br label %if.end
if.end: ; preds = %if.else, %if.then
%3 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %3, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %3, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
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: 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"}
|
#include<stdio.h>
#include<string.h>
int main(){
char str[101]="";
char in[100];
int i;
while(~scanf("%s",in)){
int len=strlen(in);
str[0]='\0';
for(i=0;i<len;i++){
if(in[i]!='@'){
char cat[2]="a";
cat[0]=in[i];
strcat(str,cat);
}else{
int j;
char cat[50]="";
for(j=0;j<in[i+1]-'0';j++){
cat[j]=in[i+2];
}
cat[in[i+1]]='\0';
strcat(str,cat);
i+=2;
}
}
puts(str);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144385/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144385/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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [101 x i8], align 16
%in = alloca [100 x i8], align 16
%cat = alloca [2 x i8], align 2
%cat14 = alloca [50 x i8], align 16
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %str) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(101) %str, i8 0, i64 101, i1 false)
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %in) #6
%call54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in)
%tobool.not55 = icmp eq i32 %call54, -1
br i1 %tobool.not55, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end38
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %in) #7
%conv = trunc i64 %call2 to i32
store i8 0, ptr %str, align 16, !tbaa !5
%cmp52 = icmp sgt i32 %conv, 0
br i1 %cmp52, label %for.body, label %for.end38
for.body: ; preds = %while.body, %for.inc36
%i.053 = phi i32 [ %inc37, %for.inc36 ], [ 0, %while.body ]
%idxprom = sext i32 %i.053 to i64
%arrayidx4 = getelementptr inbounds [100 x i8], ptr %in, i64 0, i64 %idxprom
%0 = load i8, ptr %arrayidx4, align 1, !tbaa !5
%cmp6.not = icmp eq i8 %0, 64
br i1 %cmp6.not, label %if.else, label %if.then
if.then: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %cat) #6
store i16 97, ptr %cat, align 2
store i8 %0, ptr %cat, align 2, !tbaa !5
%call13 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %cat) #6
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %cat) #6
br label %for.inc36
if.else: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %cat14) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(50) %cat14, i8 0, i64 50, i1 false)
%add = add nsw i32 %i.053, 1
%idxprom16 = sext i32 %add to i64
%arrayidx17 = getelementptr inbounds [100 x i8], ptr %in, i64 0, i64 %idxprom16
%1 = load i8, ptr %arrayidx17, align 1, !tbaa !5
%cmp1950 = icmp sgt i8 %1, 48
br i1 %cmp1950, label %for.body21.lr.ph, label %if.else.for.end_crit_edge
if.else.for.end_crit_edge: ; preds = %if.else
%.pre = add nsw i32 %i.053, 2
br label %for.end
for.body21.lr.ph: ; preds = %if.else
%conv18 = zext i8 %1 to i64
%sub = add nuw nsw i64 %conv18, 4294967248
%add22 = add nsw i32 %i.053, 2
%idxprom23 = sext i32 %add22 to i64
%arrayidx24 = getelementptr inbounds [100 x i8], ptr %in, i64 0, i64 %idxprom23
%2 = load i8, ptr %arrayidx24, align 1, !tbaa !5
%3 = and i64 %sub, 4294967295
call void @llvm.memset.p0.i64(ptr nonnull align 16 %cat14, i8 %2, i64 %3, i1 false), !tbaa !5
br label %for.end
for.end: ; preds = %if.else.for.end_crit_edge, %for.body21.lr.ph
%add35.pre-phi = phi i32 [ %.pre, %if.else.for.end_crit_edge ], [ %add22, %for.body21.lr.ph ]
%idxprom30 = sext i8 %1 to i64
%arrayidx31 = getelementptr inbounds [50 x i8], ptr %cat14, i64 0, i64 %idxprom30
store i8 0, ptr %arrayidx31, align 1, !tbaa !5
%call34 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %cat14) #6
call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %cat14) #6
br label %for.inc36
for.inc36: ; preds = %if.then, %for.end
%i.1 = phi i32 [ %i.053, %if.then ], [ %add35.pre-phi, %for.end ]
%inc37 = add nsw i32 %i.1, 1
%cmp = icmp slt i32 %inc37, %conv
br i1 %cmp, label %for.body, label %for.end38, !llvm.loop !8
for.end38: ; preds = %for.inc36, %while.body
%call40 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in)
%tobool.not = icmp eq i32 %call, -1
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %for.end38, %entry
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %in) #6
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %str) #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: 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: read)
declare i64 @strlen(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 #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 #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 = { 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 = { 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 #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 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
// Aizu Vol-15 1500: ID
// 2017.9.4 bal4u@uu
#include <stdio.h>
char id[100003];
char a[10];
int t[10] = { 0,2,4,6,8,1,3,5,7,9 };
long long p[2][10];
int main()
{
int n, m, i, j, d, x, k, k1, k2, even;
scanf("%d%s%d", &n, id+1, &m);
for (i = 0; i < m; i++) scanf("%d", &d), a[d] = 1;
p[0][0] = 1, even = !(n & 1);
for (k1 = 0, k2 = 1, i = 1; i <= n; i++, k1 = k2, k2 = !k2, even = !even) {
for (j = 0; j < 10; j++) p[k2][j] = 0;
if (id[i] == '*') {
for (k = 0; k < 10; k++) {
if (!a[k]) continue;
d = even ? t[k] : k;
for (j = 0; j < 10; j++) {
if ((x = d + j) >= 10) x -= 10;
p[k2][x] += p[k1][j];
}
}
} else {
k = id[i] - '0';
d = even ? t[k] : k;
for (j = 0; j < 10; j++) {
if ((x = d + j) >= 10) x -= 10;
p[k2][x] += p[k1][j];
}
}
}
printf("%lld\n", p[k1][0]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144428/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144428/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"
@t = dso_local local_unnamed_addr global [10 x i32] [i32 0, i32 2, i32 4, i32 6, i32 8, i32 1, i32 3, i32 5, i32 7, i32 9], align 16
@.str = private unnamed_addr constant [7 x i8] c"%d%s%d\00", align 1
@id = dso_local global [100003 x i8] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@a = dso_local local_unnamed_addr global [10 x i8] zeroinitializer, align 1
@p = dso_local local_unnamed_addr global [2 x [10 x i64]] zeroinitializer, align 16
@.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
%m = alloca i32, align 4
%d = 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 %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull getelementptr inbounds ([100003 x i8], ptr @id, i64 0, i64 1), ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp134 = icmp sgt i32 %0, 0
br i1 %cmp134, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.0135 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d)
%1 = load i32, ptr %d, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [10 x i8], ptr @a, i64 0, i64 %idxprom
store i8 1, ptr %arrayidx, align 1, !tbaa !9
%inc = add nuw nsw i32 %i.0135, 1
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.body, %entry
store i64 1, ptr @p, align 16, !tbaa !12
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.not140 = icmp slt i32 %3, 1
br i1 %cmp3.not140, label %for.end95, label %for.cond5.preheader.preheader
for.cond5.preheader.preheader: ; preds = %for.end
%and = and i32 %3, 1
%lnot.ext = xor i32 %and, 1
%4 = add nuw i32 %3, 1
%wide.trip.count = zext i32 %4 to i64
br label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.cond5.preheader.preheader, %for.inc87
%indvars.iv154 = phi i64 [ 1, %for.cond5.preheader.preheader ], [ %indvars.iv.next155, %for.inc87 ]
%even.0144 = phi i32 [ %lnot.ext, %for.cond5.preheader.preheader ], [ %lnot.ext94, %for.inc87 ]
%k2.0143 = phi i32 [ 1, %for.cond5.preheader.preheader ], [ %lnot.ext91, %for.inc87 ]
%k1.0142 = phi i32 [ 0, %for.cond5.preheader.preheader ], [ %k2.0143, %for.inc87 ]
%idxprom8 = zext i32 %k2.0143 to i64
%5 = mul nuw nsw i64 %idxprom8, 80
%scevgep = getelementptr i8, ptr @p, i64 %5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(80) %scevgep, i8 0, i64 80, i1 false), !tbaa !12
%arrayidx16 = getelementptr inbounds [100003 x i8], ptr @id, i64 0, i64 %indvars.iv154
%6 = load i8, ptr %arrayidx16, align 1, !tbaa !9
%cmp17 = icmp eq i8 %6, 42
br i1 %cmp17, label %for.cond19.preheader, label %if.else
for.cond19.preheader: ; preds = %for.cond5.preheader
%tobool27.not = icmp eq i32 %even.0144, 0
%idxprom38 = zext i32 %k1.0142 to i64
%arrayidx41 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom38, i64 0
%arrayidx41.1 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom38, i64 1
%arrayidx41.2 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom38, i64 2
%arrayidx41.3 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom38, i64 3
%arrayidx41.4 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom38, i64 4
%arrayidx41.5 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom38, i64 5
%arrayidx41.6 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom38, i64 6
%arrayidx41.7 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom38, i64 7
%arrayidx41.8 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom38, i64 8
%arrayidx41.9 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom38, i64 9
br label %for.body22
for.body22: ; preds = %for.cond19.preheader, %for.inc50
%indvars.iv = phi i64 [ 0, %for.cond19.preheader ], [ %indvars.iv.next, %for.inc50 ]
%arrayidx24 = getelementptr inbounds [10 x i8], ptr @a, i64 0, i64 %indvars.iv
%7 = load i8, ptr %arrayidx24, align 1, !tbaa !9
%tobool25.not = icmp eq i8 %7, 0
br i1 %tobool25.not, label %for.inc50, label %if.end
if.end: ; preds = %for.body22
%8 = trunc i64 %indvars.iv to i32
br i1 %tobool27.not, label %cond.end, label %cond.true
cond.true: ; preds = %if.end
%arrayidx29 = getelementptr inbounds [10 x i32], ptr @t, i64 0, i64 %indvars.iv
%9 = load i32, ptr %arrayidx29, align 4, !tbaa !5
br label %cond.end
cond.end: ; preds = %if.end, %cond.true
%cond = phi i32 [ %9, %cond.true ], [ %8, %if.end ]
store i32 %cond, ptr %d, align 4, !tbaa !5
%cmp34 = icmp sgt i32 %cond, 9
%sub = add nsw i32 %cond, -10
%spec.select = select i1 %cmp34, i32 %sub, i32 %cond
%10 = load i64, ptr %arrayidx41, align 16, !tbaa !12
%idxprom44 = sext i32 %spec.select to i64
%arrayidx45 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom44
%11 = load i64, ptr %arrayidx45, align 8, !tbaa !12
%add46 = add nsw i64 %11, %10
store i64 %add46, ptr %arrayidx45, align 8, !tbaa !12
%cmp34.1 = icmp sgt i32 %cond, 8
%spec.select.1.v = select i1 %cmp34.1, i32 -9, i32 1
%spec.select.1 = add i32 %cond, %spec.select.1.v
%12 = load i64, ptr %arrayidx41.1, align 8, !tbaa !12
%idxprom44.1 = sext i32 %spec.select.1 to i64
%arrayidx45.1 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom44.1
%13 = load i64, ptr %arrayidx45.1, align 8, !tbaa !12
%add46.1 = add nsw i64 %13, %12
store i64 %add46.1, ptr %arrayidx45.1, align 8, !tbaa !12
%cmp34.2 = icmp sgt i32 %cond, 7
%spec.select.2.v = select i1 %cmp34.2, i32 -8, i32 2
%spec.select.2 = add i32 %cond, %spec.select.2.v
%14 = load i64, ptr %arrayidx41.2, align 16, !tbaa !12
%idxprom44.2 = sext i32 %spec.select.2 to i64
%arrayidx45.2 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom44.2
%15 = load i64, ptr %arrayidx45.2, align 8, !tbaa !12
%add46.2 = add nsw i64 %15, %14
store i64 %add46.2, ptr %arrayidx45.2, align 8, !tbaa !12
%cmp34.3 = icmp sgt i32 %cond, 6
%spec.select.3.v = select i1 %cmp34.3, i32 -7, i32 3
%spec.select.3 = add i32 %cond, %spec.select.3.v
%16 = load i64, ptr %arrayidx41.3, align 8, !tbaa !12
%idxprom44.3 = sext i32 %spec.select.3 to i64
%arrayidx45.3 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom44.3
%17 = load i64, ptr %arrayidx45.3, align 8, !tbaa !12
%add46.3 = add nsw i64 %17, %16
store i64 %add46.3, ptr %arrayidx45.3, align 8, !tbaa !12
%cmp34.4 = icmp sgt i32 %cond, 5
%spec.select.4.v = select i1 %cmp34.4, i32 -6, i32 4
%spec.select.4 = add i32 %cond, %spec.select.4.v
%18 = load i64, ptr %arrayidx41.4, align 16, !tbaa !12
%idxprom44.4 = sext i32 %spec.select.4 to i64
%arrayidx45.4 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom44.4
%19 = load i64, ptr %arrayidx45.4, align 8, !tbaa !12
%add46.4 = add nsw i64 %19, %18
store i64 %add46.4, ptr %arrayidx45.4, align 8, !tbaa !12
%cmp34.5.inv = icmp slt i32 %cond, 5
%spec.select.5.v = select i1 %cmp34.5.inv, i32 5, i32 -5
%spec.select.5 = add i32 %cond, %spec.select.5.v
%20 = load i64, ptr %arrayidx41.5, align 8, !tbaa !12
%idxprom44.5 = sext i32 %spec.select.5 to i64
%arrayidx45.5 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom44.5
%21 = load i64, ptr %arrayidx45.5, align 8, !tbaa !12
%add46.5 = add nsw i64 %21, %20
store i64 %add46.5, ptr %arrayidx45.5, align 8, !tbaa !12
%cmp34.6 = icmp sgt i32 %cond, 3
%spec.select.6.v = select i1 %cmp34.6, i32 -4, i32 6
%spec.select.6 = add i32 %cond, %spec.select.6.v
%22 = load i64, ptr %arrayidx41.6, align 16, !tbaa !12
%idxprom44.6 = sext i32 %spec.select.6 to i64
%arrayidx45.6 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom44.6
%23 = load i64, ptr %arrayidx45.6, align 8, !tbaa !12
%add46.6 = add nsw i64 %23, %22
store i64 %add46.6, ptr %arrayidx45.6, align 8, !tbaa !12
%cmp34.7 = icmp sgt i32 %cond, 2
%spec.select.7.v = select i1 %cmp34.7, i32 -3, i32 7
%spec.select.7 = add i32 %cond, %spec.select.7.v
%24 = load i64, ptr %arrayidx41.7, align 8, !tbaa !12
%idxprom44.7 = sext i32 %spec.select.7 to i64
%arrayidx45.7 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom44.7
%25 = load i64, ptr %arrayidx45.7, align 8, !tbaa !12
%add46.7 = add nsw i64 %25, %24
store i64 %add46.7, ptr %arrayidx45.7, align 8, !tbaa !12
%cmp34.8 = icmp sgt i32 %cond, 1
%spec.select.8.v = select i1 %cmp34.8, i32 -2, i32 8
%spec.select.8 = add i32 %cond, %spec.select.8.v
%26 = load i64, ptr %arrayidx41.8, align 16, !tbaa !12
%idxprom44.8 = sext i32 %spec.select.8 to i64
%arrayidx45.8 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom44.8
%27 = load i64, ptr %arrayidx45.8, align 8, !tbaa !12
%add46.8 = add nsw i64 %27, %26
store i64 %add46.8, ptr %arrayidx45.8, align 8, !tbaa !12
%cmp34.9 = icmp sgt i32 %cond, 0
%spec.select.9.v = select i1 %cmp34.9, i32 -1, i32 9
%spec.select.9 = add i32 %cond, %spec.select.9.v
%28 = load i64, ptr %arrayidx41.9, align 8, !tbaa !12
%idxprom44.9 = sext i32 %spec.select.9 to i64
%arrayidx45.9 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom44.9
%29 = load i64, ptr %arrayidx45.9, align 8, !tbaa !12
%add46.9 = add nsw i64 %29, %28
store i64 %add46.9, ptr %arrayidx45.9, align 8, !tbaa !12
br label %for.inc50
for.inc50: ; preds = %cond.end, %for.body22
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 10
br i1 %exitcond.not, label %for.inc87, label %for.body22, !llvm.loop !14
if.else: ; preds = %for.cond5.preheader
%conv = sext i8 %6 to i32
%sub56 = add nsw i32 %conv, -48
%tobool57.not = icmp eq i32 %even.0144, 0
br i1 %tobool57.not, label %cond.end62, label %cond.true58
cond.true58: ; preds = %if.else
%idxprom59 = sext i32 %sub56 to i64
%arrayidx60 = getelementptr inbounds [10 x i32], ptr @t, i64 0, i64 %idxprom59
%30 = load i32, ptr %arrayidx60, align 4, !tbaa !5
br label %cond.end62
cond.end62: ; preds = %if.else, %cond.true58
%cond63 = phi i32 [ %30, %cond.true58 ], [ %sub56, %if.else ]
store i32 %cond63, ptr %d, align 4, !tbaa !5
%idxprom74 = zext i32 %k1.0142 to i64
%cmp69 = icmp sgt i32 %cond63, 9
%sub72 = add nsw i32 %cond63, -10
%spec.select132 = select i1 %cmp69, i32 %sub72, i32 %cond63
%arrayidx77 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom74, i64 0
%31 = load i64, ptr %arrayidx77, align 16, !tbaa !12
%idxprom80 = sext i32 %spec.select132 to i64
%arrayidx81 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom80
%32 = load i64, ptr %arrayidx81, align 8, !tbaa !12
%add82 = add nsw i64 %32, %31
store i64 %add82, ptr %arrayidx81, align 8, !tbaa !12
%cmp69.1 = icmp sgt i32 %cond63, 8
%spec.select132.1.v = select i1 %cmp69.1, i32 -9, i32 1
%spec.select132.1 = add i32 %cond63, %spec.select132.1.v
%arrayidx77.1 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom74, i64 1
%33 = load i64, ptr %arrayidx77.1, align 8, !tbaa !12
%idxprom80.1 = sext i32 %spec.select132.1 to i64
%arrayidx81.1 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom80.1
%34 = load i64, ptr %arrayidx81.1, align 8, !tbaa !12
%add82.1 = add nsw i64 %34, %33
store i64 %add82.1, ptr %arrayidx81.1, align 8, !tbaa !12
%cmp69.2 = icmp sgt i32 %cond63, 7
%spec.select132.2.v = select i1 %cmp69.2, i32 -8, i32 2
%spec.select132.2 = add i32 %cond63, %spec.select132.2.v
%arrayidx77.2 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom74, i64 2
%35 = load i64, ptr %arrayidx77.2, align 16, !tbaa !12
%idxprom80.2 = sext i32 %spec.select132.2 to i64
%arrayidx81.2 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom80.2
%36 = load i64, ptr %arrayidx81.2, align 8, !tbaa !12
%add82.2 = add nsw i64 %36, %35
store i64 %add82.2, ptr %arrayidx81.2, align 8, !tbaa !12
%cmp69.3 = icmp sgt i32 %cond63, 6
%spec.select132.3.v = select i1 %cmp69.3, i32 -7, i32 3
%spec.select132.3 = add i32 %cond63, %spec.select132.3.v
%arrayidx77.3 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom74, i64 3
%37 = load i64, ptr %arrayidx77.3, align 8, !tbaa !12
%idxprom80.3 = sext i32 %spec.select132.3 to i64
%arrayidx81.3 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom80.3
%38 = load i64, ptr %arrayidx81.3, align 8, !tbaa !12
%add82.3 = add nsw i64 %38, %37
store i64 %add82.3, ptr %arrayidx81.3, align 8, !tbaa !12
%cmp69.4 = icmp sgt i32 %cond63, 5
%spec.select132.4.v = select i1 %cmp69.4, i32 -6, i32 4
%spec.select132.4 = add i32 %cond63, %spec.select132.4.v
%arrayidx77.4 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom74, i64 4
%39 = load i64, ptr %arrayidx77.4, align 16, !tbaa !12
%idxprom80.4 = sext i32 %spec.select132.4 to i64
%arrayidx81.4 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom80.4
%40 = load i64, ptr %arrayidx81.4, align 8, !tbaa !12
%add82.4 = add nsw i64 %40, %39
store i64 %add82.4, ptr %arrayidx81.4, align 8, !tbaa !12
%cmp69.5.inv = icmp slt i32 %cond63, 5
%spec.select132.5.v = select i1 %cmp69.5.inv, i32 5, i32 -5
%spec.select132.5 = add i32 %cond63, %spec.select132.5.v
%arrayidx77.5 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom74, i64 5
%41 = load i64, ptr %arrayidx77.5, align 8, !tbaa !12
%idxprom80.5 = sext i32 %spec.select132.5 to i64
%arrayidx81.5 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom80.5
%42 = load i64, ptr %arrayidx81.5, align 8, !tbaa !12
%add82.5 = add nsw i64 %42, %41
store i64 %add82.5, ptr %arrayidx81.5, align 8, !tbaa !12
%cmp69.6 = icmp sgt i32 %cond63, 3
%spec.select132.6.v = select i1 %cmp69.6, i32 -4, i32 6
%spec.select132.6 = add i32 %cond63, %spec.select132.6.v
%arrayidx77.6 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom74, i64 6
%43 = load i64, ptr %arrayidx77.6, align 16, !tbaa !12
%idxprom80.6 = sext i32 %spec.select132.6 to i64
%arrayidx81.6 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom80.6
%44 = load i64, ptr %arrayidx81.6, align 8, !tbaa !12
%add82.6 = add nsw i64 %44, %43
store i64 %add82.6, ptr %arrayidx81.6, align 8, !tbaa !12
%cmp69.7 = icmp sgt i32 %cond63, 2
%spec.select132.7.v = select i1 %cmp69.7, i32 -3, i32 7
%spec.select132.7 = add i32 %cond63, %spec.select132.7.v
%arrayidx77.7 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom74, i64 7
%45 = load i64, ptr %arrayidx77.7, align 8, !tbaa !12
%idxprom80.7 = sext i32 %spec.select132.7 to i64
%arrayidx81.7 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom80.7
%46 = load i64, ptr %arrayidx81.7, align 8, !tbaa !12
%add82.7 = add nsw i64 %46, %45
store i64 %add82.7, ptr %arrayidx81.7, align 8, !tbaa !12
%cmp69.8 = icmp sgt i32 %cond63, 1
%spec.select132.8.v = select i1 %cmp69.8, i32 -2, i32 8
%spec.select132.8 = add i32 %cond63, %spec.select132.8.v
%arrayidx77.8 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom74, i64 8
%47 = load i64, ptr %arrayidx77.8, align 16, !tbaa !12
%idxprom80.8 = sext i32 %spec.select132.8 to i64
%arrayidx81.8 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom80.8
%48 = load i64, ptr %arrayidx81.8, align 8, !tbaa !12
%add82.8 = add nsw i64 %48, %47
store i64 %add82.8, ptr %arrayidx81.8, align 8, !tbaa !12
%cmp69.9 = icmp sgt i32 %cond63, 0
%spec.select132.9.v = select i1 %cmp69.9, i32 -1, i32 9
%spec.select132.9 = add i32 %cond63, %spec.select132.9.v
%arrayidx77.9 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom74, i64 9
%49 = load i64, ptr %arrayidx77.9, align 8, !tbaa !12
%idxprom80.9 = sext i32 %spec.select132.9 to i64
%arrayidx81.9 = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8, i64 %idxprom80.9
%50 = load i64, ptr %arrayidx81.9, align 8, !tbaa !12
%add82.9 = add nsw i64 %50, %49
store i64 %add82.9, ptr %arrayidx81.9, align 8, !tbaa !12
br label %for.inc87
for.inc87: ; preds = %for.inc50, %cond.end62
%indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
%lnot.ext91 = xor i32 %k2.0143, 1
%tobool92.not = icmp eq i32 %even.0144, 0
%lnot.ext94 = zext i1 %tobool92.not to i32
%exitcond157.not = icmp eq i64 %indvars.iv.next155, %wide.trip.count
br i1 %exitcond157.not, label %for.end95.loopexit, label %for.cond5.preheader, !llvm.loop !15
for.end95.loopexit: ; preds = %for.inc87
%arrayidx97.phi.trans.insert = getelementptr inbounds [2 x [10 x i64]], ptr @p, i64 0, i64 %idxprom8
%.pre = load i64, ptr %arrayidx97.phi.trans.insert, align 16, !tbaa !12
br label %for.end95
for.end95: ; preds = %for.end, %for.end95.loopexit
%51 = phi i64 [ %.pre, %for.end95.loopexit ], [ 1, %for.end ]
%call99 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %51)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #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 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
|
#pragma warning(disable:4996)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>
#pragma region 定義
typedef long long ll;
typedef unsigned long long ull;
#define _itoa(A,N) sprintf(A, "%d", N);
int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);
int _gcd(int a, int b);
int _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);
int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);
//昇順
int s_asort(const void* a, const void* b) {
return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
return(strcmp((char*)b, (char*)a));
}
int i_dsort(const void* a, const void* b) {
return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
return(*(int*)a - *(int*)b);
}
int i_gcd(int a, int b);
int i_gcd(int a, int b) {
if (!b)return a;
return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
return (a * b) / i_gcd(a, b);
}
int ll_gcd(ll a, ll b);
int ll_gcd(ll a, ll b) {
if (!b)return a;
return ll_gcd(b, a % b);
}
int ll_lcm(ll a, ll b);
int ll_lcm(ll a, ll b) {
return (a * b) / ll_gcd(a, b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数2つで得る
//#define pai 3.1415926535
//#define _USE_MATH_DEFINES でM_PIが使える
#define deg_rad(X) (X*(M_PI/180))
int _swp(int* a, int* b)
{
int tmp;
tmp = *b; *b = *a; *a = tmp;
return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))
int _cknum(char* a, int n) {
int i;
char t = '0';
for (i = 0; i < n; i++) {
if (a[i] < '0' || a[i]>'9') return 1;
}
return 0;
}
int _atoi(char* s, int len) {
char tmp[20];
memcpy(tmp, s, len);
tmp[len] = 0x00;
return (atoi(tmp));
}
//素因数分解 pf素数が入る pc 素数の数
//ll _pfact(ll a);
//static ll pf[100000000];
//static ll pc;
//
//ll _pfact(ll a) {
// long i, r;
// if (a % 2 == 0) {
// pf[pc] = 2; pc++;
// return(_pfact(a / 2));
// }
// r = sqrt(a);
// for (i = 3; i <= r; i += 2) {
// if (a % i == 0) {
// pf[pc] = i; pc++;
// return(_pfact(a / i));
// }
// }
// if (a != 1) {
// pf[pc] = a; pc++;
// }
// return 0;
//
//}
//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
char rc;
rc = strcmp((char*)b, (char*)a);
if (rc == 0) {
*(char*)a = 0x00;
return(1);
}
return(rc);
}
// 立っている ビットの数
int bitcount(unsigned int uc);
int bitcount(unsigned int uc)
{
int bit;
for (bit = 0; 0 != uc; uc = (unsigned int)(uc >> 1))
if (0 != (uc & 1))++bit;
return bit;
}//bitco
//10進数の桁数の総和
int _sumdig(int n);
int _sumdig(int n) {
int sum = 0;
while (n > 0) { sum += n % 10;n /= 10;}
return(sum);
}
#define _rnd(a,b) ((a+b-1)/b) // A/Bの余りを繰り上げる
#define _abs(x) ((x)<0 ? -(x) : (x))
#define _MAX 200000
#pragma endregion
// ABC145 C - Average Length
//int main(void) {
// int n,i, x[9],y[9],cnt=0;
// double sum=0;
//
// scanf("%d", &n);
// for (i = 0; i < n; i++)
// scanf("%d %d", &x[i], &y[i]);
//
// for(i=0;i<n-1;i++)
// for (int j = i + 1; j < n; j++) {
// sum += hypot(x[i] - x[j], y[i] - y[j]);
// cnt++;
// printf("%d %lf\n", cnt, sum);
// }
// printf("%lf\n",sum/cnt);
// return 0;
//}
////ABC049 C - 白昼夢
//static char s[1000010];
//int main(void)
//{
// int i,l;
//
// scanf("%s", s); l = strlen(s);
//
// int p = 0;
// while (1) {
// if (memcmp(s, "dream", 5) == 0 ||
// memcmp(s, "erase", 5) == 0) {
// p +=(s[p + 5] == 'r') ? 6 : 5;
// }
// else printf("NO\n");
// if (p >= l)break;
// }
// (p == l) ? printf("YES\n") : printf("NO\n");
//
// return 0;
//}
//
//
// ABC096 C - Half ans Half
int main(void) {
int a,b,c,x,y,z;
int i, j;
scanf("%d%d%d%d%d", &a, &b, &c,&x,&y);
z = 0;
ll min = 1000000000,tmp;
while (1) {
tmp=a* x + b * y + 2 * c * z;
min = _min(min, tmp);
if (x == 0 && y == 0)break;
z++; x--; y--;
if (y < 0) y = 0;
if (x < 0) x = 0;
}
printf("%lld\n",min);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144600/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144600/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 [11 x i8] c"%d%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #14
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: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_dsort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #14
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @i_dsort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @i_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
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 norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @i_gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4 = icmp eq i32 %b, 0
br i1 %tobool.not4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i32 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i32 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i32 %a.tr5, %b.tr6
%tobool.not = icmp eq i32 %rem, 0
br i1 %tobool.not, label %return, label %if.end
return: ; preds = %if.end, %entry
%a.tr.lcssa = phi i32 [ %a, %entry ], [ %b.tr6, %if.end ]
ret i32 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @i_lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4.i = icmp eq i32 %b, 0
br i1 %tobool.not4.i, label %i_gcd.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%b.tr6.i = phi i32 [ %rem.i, %if.end.i ], [ %b, %entry ]
%a.tr5.i = phi i32 [ %b.tr6.i, %if.end.i ], [ %a, %entry ]
%rem.i = srem i32 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i32 %rem.i, 0
br i1 %tobool.not.i, label %i_gcd.exit, label %if.end.i
i_gcd.exit: ; preds = %if.end.i, %entry
%a.tr.lcssa.i = phi i32 [ %a, %entry ], [ %b.tr6.i, %if.end.i ]
%mul = mul nsw i32 %b, %a
%div = sdiv i32 %mul, %a.tr.lcssa.i
ret i32 %div
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @ll_gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %if.then, label %if.end
if.then: ; preds = %if.end, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %if.end ]
%conv = trunc i64 %a.tr.lcssa to i32
ret i32 %conv
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i64 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %if.then, label %if.end
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @ll_lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4.i = icmp eq i64 %b, 0
br i1 %tobool.not4.i, label %ll_gcd.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%b.tr6.i = phi i64 [ %rem.i, %if.end.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %if.end.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 %ll_gcd.exit, label %if.end.i
ll_gcd.exit: ; preds = %if.end.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %if.end.i ]
%mul = mul nsw i64 %b, %a
%sext = shl i64 %a.tr.lcssa.i, 32
%conv = ashr exact i64 %sext, 32
%div = sdiv i64 %mul, %conv
%conv1 = trunc i64 %div to i32
ret i32 %conv1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @_swp(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
store i32 %1, ptr %b, align 4, !tbaa !5
store i32 %0, ptr %a, align 4, !tbaa !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) #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #5
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @_cknum(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #6 {
entry:
%cmp13 = icmp sgt i32 %n, 0
br i1 %cmp13, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond: ; preds = %for.body
%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 %cleanup, label %for.body, !llvm.loop !9
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i8, ptr %a, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !11
%1 = add i8 %0, -58
%or.cond = icmp ult i8 %1, -10
br i1 %or.cond, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local i32 @_atoi(ptr nocapture noundef readonly %s, i32 noundef %len) local_unnamed_addr #7 {
entry:
%tmp = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %tmp) #15
%conv = sext i32 %len to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %tmp, ptr align 1 %s, i64 %conv, i1 false)
%arrayidx = getelementptr inbounds [20 x i8], ptr %tmp, i64 0, i64 %conv
store i8 0, ptr %arrayidx, align 1, !tbaa !11
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %tmp, ptr noundef null, i32 noundef 10) #15
%conv.i = trunc i64 %call.i to i32
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %tmp) #15
ret i32 %conv.i
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #8
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @_sort(ptr nocapture noundef %a, ptr nocapture noundef readonly %b) local_unnamed_addr #9 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #14
%sext = shl i32 %call, 24
%cmp = icmp eq i32 %sext, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i8 0, ptr %a, align 1, !tbaa !11
br label %cleanup
if.end: ; preds = %entry
%conv1 = ashr exact i32 %sext, 24
br label %cleanup
cleanup: ; preds = %if.end, %if.then
%retval.0 = phi i32 [ 1, %if.then ], [ %conv1, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @bitcount(i32 noundef %uc) local_unnamed_addr #3 {
entry:
%cmp.not5 = icmp eq i32 %uc, 0
br i1 %cmp.not5, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%bit.07 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%uc.addr.06 = phi i32 [ %shr, %for.body ], [ %uc, %entry ]
%and = and i32 %uc.addr.06, 1
%spec.select = add i32 %bit.07, %and
%shr = lshr i32 %uc.addr.06, 1
%cmp.not = icmp ult i32 %uc.addr.06, 2
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %entry
%bit.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
ret i32 %bit.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @_sumdig(i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp4 = icmp sgt i32 %n, 0
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%sum.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%n.addr.05 = phi i32 [ %div, %while.body ], [ %n, %entry ]
%rem = urem i32 %n.addr.05, 10
%add = add nuw nsw i32 %sum.06, %rem
%div = udiv i32 %n.addr.05, 10
%cmp.not = icmp ult i32 %n.addr.05, 10
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %while.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %sum.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #10 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #15
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #15
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #15
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #15
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #15
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%2 = load i32, ptr %c, align 4, !tbaa !5
%x.promoted = load i32, ptr %x, align 4, !tbaa !5
%y.promoted = load i32, ptr %y, align 4
%mul25 = mul nsw i32 %x.promoted, %0
%mul126 = mul nsw i32 %y.promoted, %1
%add27 = add nsw i32 %mul126, %mul25
%3 = call i32 @llvm.smin.i32(i32 %add27, i32 1000000000)
%cond29 = sext i32 %3 to i64
%cmp630 = icmp eq i32 %x.promoted, 0
%cmp831 = icmp eq i32 %y.promoted, 0
%or.cond32 = select i1 %cmp630, i1 %cmp831, i1 false
br i1 %or.cond32, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end
%cond35 = phi i64 [ %cond, %if.end ], [ %cond29, %entry ]
%z.034 = phi i32 [ %inc, %if.end ], [ 0, %entry ]
%4 = phi i32 [ %spec.select, %if.end ], [ %x.promoted, %entry ]
%spec.store.select2433 = phi i32 [ %spec.store.select, %if.end ], [ %y.promoted, %entry ]
%inc = add nuw nsw i32 %z.034, 1
%dec = add nsw i32 %4, -1
%5 = call i32 @llvm.smax.i32(i32 %spec.store.select2433, i32 1)
%spec.store.select = add nsw i32 %5, -1
%cmp15.inv = icmp sgt i32 %4, 0
%spec.select = select i1 %cmp15.inv, i32 %dec, i32 0
%mul = mul nsw i32 %spec.select, %0
%mul1 = mul nsw i32 %spec.store.select, %1
%add = add nsw i32 %mul1, %mul
%mul2 = shl nuw i32 %inc, 1
%mul3 = mul i32 %mul2, %2
%add4 = add nsw i32 %add, %mul3
%conv = sext i32 %add4 to i64
%cond = call i64 @llvm.smin.i64(i64 %cond35, i64 %conv)
%cmp6 = icmp eq i32 %spec.select, 0
%cmp8 = icmp eq i32 %spec.store.select, 0
%or.cond = select i1 %cmp6, i1 %cmp8, i1 false
br i1 %or.cond, label %while.cond.while.end_crit_edge, label %if.end
while.cond.while.end_crit_edge: ; preds = %if.end
store i32 0, ptr %x, align 4, !tbaa !5
store i32 0, ptr %y, align 4
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%cond.lcssa = phi i64 [ %cond, %while.cond.while.end_crit_edge ], [ %cond29, %entry ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %cond.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #15
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #13
attributes #0 = { 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 #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 = { 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 #3 = { 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 #4 = { 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 #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { mustprogress nofree nounwind willreturn 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { 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 #11 = { 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 #12 = { mustprogress nofree nounwind willreturn "no-trapping-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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #14 = { nounwind willreturn memory(read) }
attributes #15 = { 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
int64_t get_int(void) {
int64_t num;
scanf("%lld", &num);
return num;
}
int get_str(char *str, int size)
{
char format[100];
if (size == 0)
return 0;
snprintf(format, sizeof(format), "%%%ds", size);
scanf(format, str);
return 0;
}
#define STR_MAX 100
#define BUF_MAX (STR_MAX+10)
int main(void) {
static char str[BUF_MAX];
get_str(str, BUF_MAX);
int len = strlen(str);
int64_t pos = get_int();
// 0-indexed
pos--;
int i;
for(i = 0; i < len; i++) {
if(str[i]!='1') break;
}
if(i > pos) {
putchar(str[pos]);
} else {
putchar(str[i]);
}
putchar('\n');
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144644/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144644/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 [6 x i8] c"%%%ds\00", align 1
@main.str = internal global [110 x i8] zeroinitializer, align 16
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @get_int() local_unnamed_addr #0 {
entry:
%num = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %num) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i64, ptr %num, align 8, !tbaa !5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %num) #4
ret i64 %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 uwtable
define dso_local i32 @get_str(ptr noundef %str, i32 noundef %size) local_unnamed_addr #0 {
entry:
%format = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %format) #4
%cmp = icmp eq i32 %size, 0
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%call = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %format, i64 noundef 100, ptr noundef nonnull @.str.1, i32 noundef %size) #4
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull %format, ptr noundef %str)
br label %cleanup
cleanup: ; preds = %entry, %if.end
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %format) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num.i = alloca i64, align 8
%format.i = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %format.i) #4
%call.i = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %format.i, i64 noundef 100, ptr noundef nonnull @.str.1, i32 noundef 110) #4
%call2.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull %format.i, ptr noundef nonnull @main.str)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %format.i) #4
%call1 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @main.str) #5
%conv = trunc i64 %call1 to i32
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %num.i) #4
%call.i26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num.i)
%0 = load i64, ptr %num.i, align 8, !tbaa !5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %num.i) #4
%cmp30 = icmp sgt i32 %conv, 0
br i1 %cmp30, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call1, 4294967295
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds [110 x i8], ptr @main.str, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp5.not = icmp eq i8 %1, 49
br i1 %cmp5.not, label %for.inc, label %for.end.loopexit
for.inc: ; preds = %for.body
%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.loopexit, label %for.body, !llvm.loop !10
for.end.loopexit: ; preds = %for.body, %for.inc
%i.0.lcssa.ph = phi i64 [ %call1, %for.inc ], [ %indvars.iv, %for.body ]
%2 = and i64 %i.0.lcssa.ph, 4294967295
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%i.0.lcssa = phi i64 [ 0, %entry ], [ %2, %for.end.loopexit ]
%dec = add nsw i64 %0, -1
%cmp8.not = icmp sgt i64 %0, %i.0.lcssa
%3 = load ptr, ptr @stdout, align 8, !tbaa !12
%i.0.lcssa.dec = select i1 %cmp8.not, i64 %i.0.lcssa, i64 %dec
%arrayidx15 = getelementptr inbounds [110 x i8], ptr @main.str, i64 0, i64 %i.0.lcssa.dec
%4 = load i8, ptr %arrayidx15, align 1, !tbaa !9
%conv16 = sext i8 %4 to i32
%call.i28 = call i32 @putc(i32 noundef %conv16, ptr noundef %3)
%5 = load ptr, ptr @stdout, align 8, !tbaa !12
%call.i29 = call i32 @putc(i32 noundef 10, ptr noundef %5)
ret i32 0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) 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 = { 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 = !{!"long", !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 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
|
#include <stdio.h>
#include <string.h>
int main(void){
char a[1000];
long long int b;
scanf("%s\n",a);
scanf("%lld\n",&b);
int k=strlen(a);
for (int i = 0; i < k && i<b; i++) {
if (a[i]!='1') {
printf("%c\n", a[i]);
return 0;
}
}
printf("1\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144688/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144688/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"%s\0A\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%c\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [1000 x i8], align 16
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %a) #7
%conv = trunc i64 %call3 to i32
%0 = load i64, ptr %b, align 8
%.fr = freeze i64 %0
%cmp23 = icmp slt i32 %conv, 1
%cmp624 = icmp slt i64 %.fr, 1
%.not25 = or i1 %cmp23, %cmp624
br i1 %.not25, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%sext = shl i64 %call3, 32
%1 = ashr exact i64 %sext, 32
%invariant.smin = call i64 @llvm.smin.i64(i64 %1, i64 %.fr)
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%.not.not = icmp slt i64 %indvars.iv.next, %invariant.smin
br i1 %.not.not, label %for.body, label %for.end, !llvm.loop !5
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds [1000 x i8], ptr %a, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !7
%cmp9.not = icmp eq i8 %2, 49
br i1 %cmp9.not, label %for.cond, label %if.then
if.then: ; preds = %for.body
%conv8 = sext i8 %2 to i32
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv8)
br label %cleanup16
for.end: ; preds = %for.cond, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup16
cleanup16: ; preds = %if.then, %for.end
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %a) #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: read)
declare i64 @strlen(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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #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: 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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"}
!7 = !{!8, !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main(void) {
char S[101];
long K;
int i,len;
scanf("%s",S);
scanf("%ld",&K);
i = 0;
len = strlen(S);
while((i+1 < K)&&(S[i] == '1')&&(i+1 < len))
i++;
printf("%c\n",S[i]);
return(0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144730/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144730/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 [4 x i8] c"%ld\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%c\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [101 x i8], align 16
%K = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %S) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %K) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %K)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %S) #6
%0 = load i64, ptr %K, align 8, !tbaa !5
%sext = shl i64 %call3, 32
%1 = ashr exact i64 %sext, 32
%smax = call i64 @llvm.smax.i64(i64 %0, i64 1)
%2 = add nuw i64 %smax, 4294967295
%3 = add nsw i64 %smax, -1
br label %while.cond
while.cond: ; preds = %land.lhs.true, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %land.lhs.true ], [ 0, %entry ]
%exitcond.not = icmp eq i64 %indvars.iv, %3
br i1 %exitcond.not, label %while.end, label %land.lhs.true
land.lhs.true: ; preds = %while.cond
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [101 x i8], ptr %S, i64 0, i64 %indvars.iv
%4 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp7 = icmp eq i8 %4, 49
%cmp10 = icmp slt i64 %indvars.iv.next, %1
%or.cond = select i1 %cmp7, i1 %cmp10, i1 false
br i1 %or.cond, label %while.cond, label %while.end, !llvm.loop !10
while.end: ; preds = %land.lhs.true, %while.cond
%i.0.lcssa = phi i64 [ %indvars.iv, %land.lhs.true ], [ %2, %while.cond ]
%idxprom12 = and i64 %i.0.lcssa, 4294967295
%arrayidx13 = getelementptr inbounds [101 x i8], ptr %S, i64 0, i64 %idxprom12
%5 = load i8, ptr %arrayidx13, align 1, !tbaa !9
%conv14 = sext i8 %5 to i32
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv14)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #5
call void @llvm.lifetime.end.p0(i64 101, 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: 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: 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) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"long", !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>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
int f(int X){
int s = 0;
while(X > 0){
s += X % 10;
X /= 10;
}
return s;
}
int main(void){
int N;
scanf("%d", &N);
if(N % f(N) == 0){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144789/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144789/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 norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @f(i32 noundef %X) local_unnamed_addr #0 {
entry:
%cmp4 = icmp sgt i32 %X, 0
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%s.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%X.addr.05 = phi i32 [ %div, %while.body ], [ %X, %entry ]
%rem = urem i32 %X.addr.05, 10
%add = add nuw nsw i32 %s.06, %rem
%div = udiv i32 %X.addr.05, 10
%cmp.not = icmp ult i32 %X.addr.05, 10
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%s.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %s.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 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 !7
%cmp4.i = icmp sgt i32 %0, 0
br i1 %cmp4.i, label %while.body.i, label %f.exit
while.body.i: ; preds = %entry, %while.body.i
%s.06.i = phi i32 [ %add.i, %while.body.i ], [ 0, %entry ]
%X.addr.05.i = phi i32 [ %div.i, %while.body.i ], [ %0, %entry ]
%rem.i = urem i32 %X.addr.05.i, 10
%add.i = add nuw nsw i32 %rem.i, %s.06.i
%div.i = udiv i32 %X.addr.05.i, 10
%cmp.not.i = icmp ult i32 %X.addr.05.i, 10
br i1 %cmp.not.i, label %f.exit, label %while.body.i, !llvm.loop !5
f.exit: ; preds = %while.body.i, %entry
%s.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i, %while.body.i ]
%rem = srem i32 %0, %s.0.lcssa.i
%cmp = icmp eq i32 %rem, 0
%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 %N) #5
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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.