Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include<stdio.h>
int main ()
{
int n,k,i,max,cnt1=0,cnt2=0;
int a[101];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
cnt1+=a[i];
}
max=a[0];
for(i=0;i<n;i++)
{
if(max<a[i]) max=a[i];
}
tarin:
cnt2=0;
for(i=0;i<n;i++)
{
cnt2+=(max-a[i]);
}
if(cnt2>cnt1) printf("%d\n",max);
else
{
max++;
goto tarin;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_29308/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_29308/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
%a = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #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 %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp45 = icmp sgt i32 %0, 0
br i1 %cmp45, label %for.body, label %tarin.preheader108
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%cnt1.047 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %1, %cnt1.047
%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.end, !llvm.loop !9
for.end: ; preds = %for.body
%.pre = load i32, ptr %a, align 16, !tbaa !5
%cmp649 = icmp sgt i32 %2, 0
br i1 %cmp649, label %for.body7.preheader, label %tarin.preheader.split
for.body7.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %2 to i64
%min.iters.check = icmp ult i32 %2, 8
br i1 %min.iters.check, label %for.body7.preheader109, label %vector.ph
vector.ph: ; preds = %for.body7.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
%minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %.pre, i64 0
%minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.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> [ %minmax.ident.splat, %vector.ph ], [ %6, %vector.body ]
%vec.phi88 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %7, %vector.body ]
%4 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load89 = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
%7 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi88, <4 x i32> %wide.load89)
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %6, <4 x i32> %7)
%9 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %tarin.preheader, label %for.body7.preheader109
for.body7.preheader109: ; preds = %for.body7.preheader, %middle.block
%indvars.iv65.ph = phi i64 [ 0, %for.body7.preheader ], [ %n.vec, %middle.block ]
%max.051.ph = phi i32 [ %.pre, %for.body7.preheader ], [ %9, %middle.block ]
br label %for.body7
tarin.preheader: ; preds = %for.body7, %middle.block
%spec.select.lcssa = phi i32 [ %9, %middle.block ], [ %spec.select, %for.body7 ]
br i1 %cmp649, label %tarin.us.preheader, label %tarin.preheader.split
tarin.us.preheader: ; preds = %tarin.preheader
%wide.trip.count71 = zext i32 %2 to i64
%min.iters.check92 = icmp ult i32 %2, 8
%n.vec95 = and i64 %wide.trip.count, 4294967288
%cmp.n97 = icmp eq i64 %n.vec95, %wide.trip.count
br label %tarin.us
tarin.us: ; preds = %tarin.us.preheader, %for.cond16.for.end24_crit_edge.us
%max.2.us = phi i32 [ %inc28.us, %for.cond16.for.end24_crit_edge.us ], [ %spec.select.lcssa, %tarin.us.preheader ]
br i1 %min.iters.check92, label %for.body18.us.preheader, label %vector.ph93
vector.ph93: ; preds = %tarin.us
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %max.2.us, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body98
vector.body98: ; preds = %vector.body98, %vector.ph93
%index99 = phi i64 [ 0, %vector.ph93 ], [ %index.next104, %vector.body98 ]
%vec.phi100 = phi <4 x i32> [ zeroinitializer, %vector.ph93 ], [ %14, %vector.body98 ]
%vec.phi101 = phi <4 x i32> [ zeroinitializer, %vector.ph93 ], [ %15, %vector.body98 ]
%10 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %index99
%wide.load102 = load <4 x i32>, ptr %10, align 16, !tbaa !5
%11 = getelementptr inbounds i32, ptr %10, i64 4
%wide.load103 = load <4 x i32>, ptr %11, align 16, !tbaa !5
%12 = add <4 x i32> %vec.phi100, %broadcast.splat
%13 = add <4 x i32> %vec.phi101, %broadcast.splat
%14 = sub <4 x i32> %12, %wide.load102
%15 = sub <4 x i32> %13, %wide.load103
%index.next104 = add nuw i64 %index99, 8
%16 = icmp eq i64 %index.next104, %n.vec95
br i1 %16, label %middle.block90, label %vector.body98, !llvm.loop !14
middle.block90: ; preds = %vector.body98
%bin.rdx = add <4 x i32> %15, %14
%17 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n97, label %for.cond16.for.end24_crit_edge.us, label %for.body18.us.preheader
for.body18.us.preheader: ; preds = %tarin.us, %middle.block90
%indvars.iv68.ph = phi i64 [ 0, %tarin.us ], [ %n.vec95, %middle.block90 ]
%cnt2.055.us.ph = phi i32 [ 0, %tarin.us ], [ %17, %middle.block90 ]
br label %for.body18.us
for.body18.us: ; preds = %for.body18.us.preheader, %for.body18.us
%indvars.iv68 = phi i64 [ %indvars.iv.next69, %for.body18.us ], [ %indvars.iv68.ph, %for.body18.us.preheader ]
%cnt2.055.us = phi i32 [ %add21.us, %for.body18.us ], [ %cnt2.055.us.ph, %for.body18.us.preheader ]
%arrayidx20.us = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv68
%18 = load i32, ptr %arrayidx20.us, align 4, !tbaa !5
%sub.us = add i32 %cnt2.055.us, %max.2.us
%add21.us = sub i32 %sub.us, %18
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%exitcond72.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count71
br i1 %exitcond72.not, label %for.cond16.for.end24_crit_edge.us, label %for.body18.us, !llvm.loop !15
for.cond16.for.end24_crit_edge.us: ; preds = %for.body18.us, %middle.block90
%add21.us.lcssa = phi i32 [ %17, %middle.block90 ], [ %add21.us, %for.body18.us ]
%cmp25.us = icmp sgt i32 %add21.us.lcssa, %add
%inc28.us = add nsw i32 %max.2.us, 1
br i1 %cmp25.us, label %if.then26, label %tarin.us
tarin.preheader.split: ; preds = %for.end, %tarin.preheader
%max.0.lcssa84 = phi i32 [ %spec.select.lcssa, %tarin.preheader ], [ %.pre, %for.end ]
%cmp25 = icmp slt i32 %add, 0
br i1 %cmp25, label %if.then26, label %tarin.preheader108
tarin.preheader108: ; preds = %entry, %tarin.preheader.split
br label %tarin
for.body7: ; preds = %for.body7.preheader109, %for.body7
%indvars.iv65 = phi i64 [ %indvars.iv.next66, %for.body7 ], [ %indvars.iv65.ph, %for.body7.preheader109 ]
%max.051 = phi i32 [ %spec.select, %for.body7 ], [ %max.051.ph, %for.body7.preheader109 ]
%arrayidx9 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv65
%19 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %max.051, i32 %19)
%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 %tarin.preheader, label %for.body7, !llvm.loop !16
tarin: ; preds = %tarin.preheader108, %tarin
br label %tarin
if.then26: ; preds = %for.cond16.for.end24_crit_edge.us, %tarin.preheader.split
%.us-phi = phi i32 [ %max.0.lcssa84, %tarin.preheader.split ], [ %max.2.us, %for.cond16.for.end24_crit_edge.us ]
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.us-phi)
call void @llvm.lifetime.end.p0(i64 404, 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 i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x 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}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !12, !13}
!15 = distinct !{!15, !10, !13, !12}
!16 = distinct !{!16, !10, !13, !12}
|
#include<stdio.h>
#define N 100
int main(){
int M[N][N];
int n, u, k, v;
int i, j;
scanf("%d",&n);
for(i = 0; i < n; i++){
for(j = 0; j < n; j++){
M[i][j] = 0;
}
}
for(i = 0; i < n; i++){
scanf("%d %d",&u,&k);
u--;
for(j = 0; j < k; j++){
scanf("%d",&v);
v--;
M[u][v] = 1;
}
}
for(i = 0; i < n; i++){
for(j = 0; j < n; j++){
if(j != 0) printf(" ");
printf("%d",M[i][j]);
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293122/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293122/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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%M = alloca [100 x [100 x i32]], align 16
%n = alloca i32, align 4
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %M) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp66 = icmp sgt i32 %0, 0
br i1 %cmp66, label %for.cond1.preheader.us.preheader, label %for.end47
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
%invariant.gep = getelementptr i8, ptr %M, i64 400
%invariant.gep84 = getelementptr i8, ptr %M, i64 800
%invariant.gep86 = getelementptr i8, ptr %M, i64 1200
%invariant.gep88 = getelementptr i8, ptr %M, i64 1600
%invariant.gep90 = getelementptr i8, ptr %M, i64 2000
%invariant.gep92 = getelementptr i8, ptr %M, i64 2400
%invariant.gep94 = getelementptr i8, ptr %M, i64 2800
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr %M, i64 %4
call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr %invariant.gep, i64 %5
call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep85 = getelementptr i8, ptr %invariant.gep84, i64 %6
call void @llvm.memset.p0.i64(ptr align 16 %gep85, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep87 = getelementptr i8, ptr %invariant.gep86, i64 %7
call void @llvm.memset.p0.i64(ptr align 16 %gep87, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep89 = getelementptr i8, ptr %invariant.gep88, i64 %8
call void @llvm.memset.p0.i64(ptr align 16 %gep89, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep91 = getelementptr i8, ptr %invariant.gep90, i64 %9
call void @llvm.memset.p0.i64(ptr align 16 %gep91, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep93 = getelementptr i8, ptr %invariant.gep92, i64 %10
call void @llvm.memset.p0.i64(ptr align 16 %gep93, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep95 = getelementptr i8, ptr %invariant.gep94, i64 %11
call void @llvm.memset.p0.i64(ptr align 16 %gep95, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !9
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr %M, i64 %12
call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !11
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp66, label %for.body11, label %for.end47
for.cond28.preheader: ; preds = %for.inc25
%cmp2974 = icmp sgt i32 %18, 0
br i1 %cmp2974, label %for.cond31.preheader, label %for.end47
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.171 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %u, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %u, align 4, !tbaa !5
%14 = load i32, ptr %k, align 4, !tbaa !5
%cmp1468 = icmp sgt i32 %14, 0
br i1 %cmp1468, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.169 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%15 = load i32, ptr %v, align 4, !tbaa !5
%dec17 = add nsw i32 %15, -1
store i32 %dec17, ptr %v, align 4, !tbaa !5
%16 = load i32, ptr %u, align 4, !tbaa !5
%idxprom18 = sext i32 %16 to i64
%idxprom20 = sext i32 %dec17 to i64
%arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 %idxprom18, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.169, 1
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %17
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !13
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.171, 1
%18 = load i32, ptr %n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %18
br i1 %cmp10, label %for.body11, label %for.cond28.preheader, !llvm.loop !14
for.cond31.preheader: ; preds = %for.cond28.preheader, %for.end43
%19 = phi i32 [ %25, %for.end43 ], [ %18, %for.cond28.preheader ]
%indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.end43 ], [ 0, %for.cond28.preheader ]
%cmp3272 = icmp sgt i32 %19, 0
br i1 %cmp3272, label %if.end.peel, label %for.end43
if.end.peel: ; preds = %for.cond31.preheader
%arrayidx39.peel = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 %indvars.iv80, i64 0
%20 = load i32, ptr %arrayidx39.peel, align 16, !tbaa !5
%call40.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %20)
%21 = load i32, ptr %n, align 4, !tbaa !5
%cmp32.peel = icmp sgt i32 %21, 1
br i1 %cmp32.peel, label %if.end, label %for.end43
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar63 = call i32 @putchar(i32 32)
%arrayidx39 = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 %indvars.iv80, i64 %indvars.iv
%22 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %22)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%23 = load i32, ptr %n, align 4, !tbaa !5
%24 = sext i32 %23 to i64
%cmp32 = icmp slt i64 %indvars.iv.next, %24
br i1 %cmp32, label %if.end, label %for.end43, !llvm.loop !15
for.end43: ; preds = %if.end, %if.end.peel, %for.cond31.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%25 = load i32, ptr %n, align 4, !tbaa !5
%26 = sext i32 %25 to i64
%cmp29 = icmp slt i64 %indvars.iv.next81, %26
br i1 %cmp29, label %for.cond31.preheader, label %for.end47, !llvm.loop !17
for.end47: ; preds = %for.end43, %entry, %for.cond9.preheader, %for.cond28.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %M) #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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
#define MAX 100
int main(){
int i,j;
int n,u,k,v;
int g[MAX][MAX];
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
g[i][j]=0;
}
}
for(i=0;i<n;i++){
scanf("%d %d",&u,&k);
for(j=0;j<k;j++){
scanf("%d",&v);
g[u-1][v-1]=1;
}
}
for(i=0;i<n;i++){
for(j=0;j<n-1;j++){
printf("%d ",g[i][j]);
}printf("%d\n",g[i][j]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293166/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293166/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"%d \00", align 1
@.str.3 = 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
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
%g = alloca [100 x [100 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 %u) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %g) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp69 = icmp sgt i32 %0, 0
br i1 %cmp69, label %for.cond1.preheader.us.preheader, label %for.end50
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
%invariant.gep = getelementptr i8, ptr %g, i64 400
%invariant.gep87 = getelementptr i8, ptr %g, i64 800
%invariant.gep89 = getelementptr i8, ptr %g, i64 1200
%invariant.gep91 = getelementptr i8, ptr %g, i64 1600
%invariant.gep93 = getelementptr i8, ptr %g, i64 2000
%invariant.gep95 = getelementptr i8, ptr %g, i64 2400
%invariant.gep97 = getelementptr i8, ptr %g, i64 2800
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr %g, i64 %4
call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr %invariant.gep, i64 %5
call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep88 = getelementptr i8, ptr %invariant.gep87, i64 %6
call void @llvm.memset.p0.i64(ptr align 16 %gep88, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep90 = getelementptr i8, ptr %invariant.gep89, i64 %7
call void @llvm.memset.p0.i64(ptr align 16 %gep90, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep92 = getelementptr i8, ptr %invariant.gep91, i64 %8
call void @llvm.memset.p0.i64(ptr align 16 %gep92, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep94 = getelementptr i8, ptr %invariant.gep93, i64 %9
call void @llvm.memset.p0.i64(ptr align 16 %gep94, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep96 = getelementptr i8, ptr %invariant.gep95, i64 %10
call void @llvm.memset.p0.i64(ptr align 16 %gep96, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep98 = getelementptr i8, ptr %invariant.gep97, i64 %11
call void @llvm.memset.p0.i64(ptr align 16 %gep98, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !9
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr %g, i64 %12
call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !11
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp69, label %for.body11, label %for.end50
for.cond28.preheader: ; preds = %for.inc25
%cmp2978 = icmp sgt i32 %17, 0
br i1 %cmp2978, label %for.cond31.preheader, label %for.end50
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.174 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %k, align 4, !tbaa !5
%cmp1471 = icmp sgt i32 %13, 0
br i1 %cmp1471, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.172 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%14 = load i32, ptr %u, align 4, !tbaa !5
%sub = add nsw i32 %14, -1
%idxprom17 = sext i32 %sub to i64
%15 = load i32, ptr %v, align 4, !tbaa !5
%sub19 = add nsw i32 %15, -1
%idxprom20 = sext i32 %sub19 to i64
%arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr %g, i64 0, i64 %idxprom17, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.172, 1
%16 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %16
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !13
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.174, 1
%17 = load i32, ptr %n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %17
br i1 %cmp10, label %for.body11, label %for.cond28.preheader, !llvm.loop !14
for.cond31.preheader: ; preds = %for.cond28.preheader, %for.end42
%18 = phi i32 [ %23, %for.end42 ], [ %17, %for.cond28.preheader ]
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.end42 ], [ 0, %for.cond28.preheader ]
%cmp3376 = icmp sgt i32 %18, 1
br i1 %cmp3376, label %for.body34, label %for.end42
for.body34: ; preds = %for.cond31.preheader, %for.body34
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body34 ], [ 0, %for.cond31.preheader ]
%arrayidx38 = getelementptr inbounds [100 x [100 x i32]], ptr %g, i64 0, i64 %indvars.iv83, i64 %indvars.iv
%19 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%20 = load i32, ptr %n, align 4, !tbaa !5
%sub32 = add nsw i32 %20, -1
%21 = sext i32 %sub32 to i64
%cmp33 = icmp slt i64 %indvars.iv.next, %21
br i1 %cmp33, label %for.body34, label %for.end42, !llvm.loop !15
for.end42: ; preds = %for.body34, %for.cond31.preheader
%j.2.lcssa = phi i64 [ 0, %for.cond31.preheader ], [ %indvars.iv.next, %for.body34 ]
%idxprom45 = and i64 %j.2.lcssa, 4294967295
%arrayidx46 = getelementptr inbounds [100 x [100 x i32]], ptr %g, i64 0, i64 %indvars.iv83, i64 %idxprom45
%22 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %22)
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%23 = load i32, ptr %n, align 4, !tbaa !5
%24 = sext i32 %23 to i64
%cmp29 = icmp slt i64 %indvars.iv.next84, %24
br i1 %cmp29, label %for.cond31.preheader, label %for.end50, !llvm.loop !16
for.end50: ; preds = %for.end42, %entry, %for.cond9.preheader, %for.cond28.preheader
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %g) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.end.p0(i64 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
#define N 101
typedef struct{
int num;
int v;
int num1;
} hairetu;
int main(){
int i,j;
int u;
scanf("%d", &u);
hairetu Adj[N];
int r[N][N] = {0};
for(i = 0;i<u;i++){
scanf("%d%d", &Adj[i].num,&Adj[i].v);
for(j = 0; j < Adj[i].v;j++){
scanf("%d",&Adj[i].num1);
r[Adj[i].num][Adj[i].num1] = 1;
}
}
for(i = 0; i < u; i++){
for(j = 0; j < u-1; j++){
printf("%d ",r[Adj[i].num][Adj[j].num]);
}
printf("%d" , r[Adj[i].num][Adj[u-1].num]);
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293209/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293209/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.hairetu = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%u = alloca i32, align 4
%Adj = alloca [101 x %struct.hairetu], align 16
%r = alloca [101 x [101 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %u)
call void @llvm.lifetime.start.p0(i64 1212, ptr nonnull %Adj) #5
call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %r) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40804) %r, i8 0, i64 40804, i1 false)
%0 = load i32, ptr %u, align 4, !tbaa !5
%cmp79 = icmp sgt i32 %0, 0
br i1 %cmp79, label %for.body, label %for.end61
for.cond26.preheader: ; preds = %for.inc23
%cmp2784 = icmp sgt i32 %5, 0
br i1 %cmp2784, label %for.cond29.preheader, label %for.end61
for.body: ; preds = %entry, %for.inc23
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc23 ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x %struct.hairetu], ptr %Adj, i64 0, i64 %indvars.iv
%v = getelementptr inbounds [101 x %struct.hairetu], ptr %Adj, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %v)
%1 = load i32, ptr %v, align 4, !tbaa !9
%cmp877 = icmp sgt i32 %1, 0
br i1 %cmp877, label %for.body9.lr.ph, label %for.inc23
for.body9.lr.ph: ; preds = %for.body
%num1 = getelementptr inbounds [101 x %struct.hairetu], ptr %Adj, i64 0, i64 %indvars.iv, i32 2
br label %for.body9
for.body9: ; preds = %for.body9.lr.ph, %for.body9
%j.078 = phi i32 [ 0, %for.body9.lr.ph ], [ %inc, %for.body9 ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num1)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !11
%idxprom16 = sext i32 %2 to i64
%3 = load i32, ptr %num1, align 4, !tbaa !12
%idxprom21 = sext i32 %3 to i64
%arrayidx22 = getelementptr inbounds [101 x [101 x i32]], ptr %r, i64 0, i64 %idxprom16, i64 %idxprom21
store i32 1, ptr %arrayidx22, align 4, !tbaa !5
%inc = add nuw nsw i32 %j.078, 1
%4 = load i32, ptr %v, align 4, !tbaa !9
%cmp8 = icmp slt i32 %inc, %4
br i1 %cmp8, label %for.body9, label %for.inc23, !llvm.loop !13
for.inc23: ; preds = %for.body9, %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %u, 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.cond26.preheader, !llvm.loop !15
for.cond29.preheader: ; preds = %for.cond26.preheader, %for.end45
%7 = phi i32 [ %16, %for.end45 ], [ %5, %for.cond26.preheader ]
%indvars.iv91 = phi i64 [ %indvars.iv.next92, %for.end45 ], [ 0, %for.cond26.preheader ]
%cmp3082 = icmp sgt i32 %7, 1
br i1 %cmp3082, label %for.body31.lr.ph, label %for.cond29.preheader.for.end45_crit_edge
for.cond29.preheader.for.end45_crit_edge: ; preds = %for.cond29.preheader
%sub81 = add nsw i32 %7, -1
%.pre = sext i32 %sub81 to i64
br label %for.end45
for.body31.lr.ph: ; preds = %for.cond29.preheader
%arrayidx33 = getelementptr inbounds [101 x %struct.hairetu], ptr %Adj, i64 0, i64 %indvars.iv91
br label %for.body31
for.body31: ; preds = %for.body31.lr.ph, %for.body31
%indvars.iv88 = phi i64 [ 0, %for.body31.lr.ph ], [ %indvars.iv.next89, %for.body31 ]
%8 = load i32, ptr %arrayidx33, align 4, !tbaa !11
%idxprom35 = sext i32 %8 to i64
%arrayidx38 = getelementptr inbounds [101 x %struct.hairetu], ptr %Adj, i64 0, i64 %indvars.iv88
%9 = load i32, ptr %arrayidx38, align 4, !tbaa !11
%idxprom40 = sext i32 %9 to i64
%arrayidx41 = getelementptr inbounds [101 x [101 x i32]], ptr %r, i64 0, i64 %idxprom35, i64 %idxprom40
%10 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%11 = load i32, ptr %u, align 4, !tbaa !5
%sub = add nsw i32 %11, -1
%12 = sext i32 %sub to i64
%cmp30 = icmp slt i64 %indvars.iv.next89, %12
br i1 %cmp30, label %for.body31, label %for.end45, !llvm.loop !16
for.end45: ; preds = %for.body31, %for.cond29.preheader.for.end45_crit_edge
%idxprom52.pre-phi = phi i64 [ %.pre, %for.cond29.preheader.for.end45_crit_edge ], [ %12, %for.body31 ]
%arrayidx47 = getelementptr inbounds [101 x %struct.hairetu], ptr %Adj, i64 0, i64 %indvars.iv91
%13 = load i32, ptr %arrayidx47, align 4, !tbaa !11
%idxprom49 = sext i32 %13 to i64
%arrayidx53 = getelementptr inbounds [101 x %struct.hairetu], ptr %Adj, i64 0, i64 %idxprom52.pre-phi
%14 = load i32, ptr %arrayidx53, align 4, !tbaa !11
%idxprom55 = sext i32 %14 to i64
%arrayidx56 = getelementptr inbounds [101 x [101 x i32]], ptr %r, i64 0, i64 %idxprom49, i64 %idxprom55
%15 = load i32, ptr %arrayidx56, align 4, !tbaa !5
%call57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %15)
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%16 = load i32, ptr %u, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp27 = icmp slt i64 %indvars.iv.next92, %17
br i1 %cmp27, label %for.cond29.preheader, label %for.end61, !llvm.loop !17
for.end61: ; preds = %for.end45, %entry, %for.cond26.preheader
call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 1212, ptr nonnull %Adj) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 @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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!10, !6, i64 4}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 0}
!12 = !{!10, !6, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
|
#include<stdio.h>
int NODE[100][100] = {0};
int main() {
int n,u, k;
int id;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d %d", &u, &k);
for (int j = 0; j < k; j++) {
scanf("%d", &id);
NODE[u][id] = 1;
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
printf("%d", NODE[i][j]);
if (j != n)printf(" ");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293252/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293252/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"
@NODE = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@.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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%u = alloca i32, align 4
%k = alloca i32, align 4
%id = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp46 = icmp sgt i32 %0, 0
br i1 %cmp46, label %for.body, label %for.cond.cleanup15
for.cond13.preheader: ; preds = %for.cond.cleanup4
%cmp14.not50 = icmp slt i32 %2, 1
br i1 %cmp14.not50, label %for.cond.cleanup15, label %for.cond18.preheader
for.body: ; preds = %entry, %for.cond.cleanup4
%i.047 = phi i32 [ %inc10, %for.cond.cleanup4 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp344 = icmp sgt i32 %1, 0
br i1 %cmp344, label %for.body5, label %for.cond.cleanup4
for.cond.cleanup4: ; preds = %for.body5, %for.body
%inc10 = add nuw nsw i32 %i.047, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc10, %2
br i1 %cmp, label %for.body, label %for.cond13.preheader, !llvm.loop !9
for.body5: ; preds = %for.body, %for.body5
%j.045 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %id)
%3 = load i32, ptr %u, align 4, !tbaa !5
%idxprom = sext i32 %3 to i64
%4 = load i32, ptr %id, align 4, !tbaa !5
%idxprom7 = sext i32 %4 to i64
%arrayidx8 = getelementptr inbounds [100 x [100 x i32]], ptr @NODE, i64 0, i64 %idxprom, i64 %idxprom7
store i32 1, ptr %arrayidx8, align 4, !tbaa !5
%inc = add nuw nsw i32 %j.045, 1
%5 = load i32, ptr %k, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc, %5
br i1 %cmp3, label %for.body5, label %for.cond.cleanup4, !llvm.loop !11
for.cond18.preheader: ; preds = %for.cond13.preheader, %for.cond.cleanup20
%6 = phi i32 [ %7, %for.cond.cleanup20 ], [ %2, %for.cond13.preheader ]
%indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.cond.cleanup20 ], [ 1, %for.cond13.preheader ]
%cmp19.not48 = icmp slt i32 %6, 1
br i1 %cmp19.not48, label %for.cond.cleanup20, label %for.body21
for.cond.cleanup15: ; preds = %for.cond.cleanup20, %entry, %for.cond13.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.cond.cleanup20: ; preds = %for.inc29, %for.cond18.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp14.not.not = icmp slt i64 %indvars.iv53, %8
br i1 %cmp14.not.not, label %for.cond18.preheader, label %for.cond.cleanup15, !llvm.loop !12
for.body21: ; preds = %for.cond18.preheader, %for.inc29
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc29 ], [ 1, %for.cond18.preheader ]
%arrayidx25 = getelementptr inbounds [100 x [100 x i32]], ptr @NODE, i64 0, i64 %indvars.iv53, i64 %indvars.iv
%9 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9)
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = zext i32 %10 to i64
%cmp27.not = icmp eq i64 %indvars.iv, %11
br i1 %cmp27.not, label %for.inc29, label %if.then
if.then: ; preds = %for.body21
%putchar43 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc29
for.inc29: ; preds = %for.body21, %if.then
%12 = phi i32 [ %10, %for.body21 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%13 = sext i32 %12 to i64
%cmp19.not.not = icmp slt i64 %indvars.iv, %13
br i1 %cmp19.not.not, label %for.body21, label %for.cond.cleanup20, !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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#define N 100
int main(){
int i, j, k, n, A[N][N];
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d%d", &A[i][0], &A[i][1]);
for(j=0; j<A[i][1]; j++){
scanf("%d", &A[i][j+2]);
}
}
for(i=0; i<n; i++){
k=2;
for(j=0; j<n; j++){
if(A[i][k] == j+1){
printf("1");
k++;
}
else printf("0");
if(j == n-1)printf("\n");
else printf(" ");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293296/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293296/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%A = alloca [100 x [100 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 %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
%cmp67 = icmp sgt i32 %0, 0
br i1 %cmp67, label %for.body, label %for.end46
for.cond20.preheader: ; preds = %for.inc17
%cmp2172 = icmp sgt i32 %5, 0
br i1 %cmp2172, label %for.cond23.preheader, label %for.end46
for.body: ; preds = %entry, %for.inc17
%indvars.iv77 = phi i64 [ %indvars.iv.next78, %for.inc17 ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x [100 x i32]], ptr %A, i64 0, i64 %indvars.iv77
%arrayidx4 = getelementptr inbounds [100 x [100 x i32]], ptr %A, i64 0, i64 %indvars.iv77, i64 1
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx4)
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp1065 = icmp sgt i32 %1, 0
br i1 %cmp1065, label %for.body11, label %for.inc17
for.body11: ; preds = %for.body, %for.body11
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body11 ], [ 0, %for.body ]
%2 = add nuw nsw i64 %indvars.iv, 2
%arrayidx15 = getelementptr inbounds [100 x [100 x i32]], ptr %A, i64 0, i64 %indvars.iv77, i64 %2
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx15)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp10 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp10, label %for.body11, label %for.inc17, !llvm.loop !9
for.inc17: ; preds = %for.body11, %for.body
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next78, %6
br i1 %cmp, label %for.body, label %for.cond20.preheader, !llvm.loop !11
for.cond23.preheader: ; preds = %for.cond20.preheader, %for.inc44
%7 = phi i32 [ %11, %for.inc44 ], [ %5, %for.cond20.preheader ]
%indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.inc44 ], [ 0, %for.cond20.preheader ]
%cmp2469 = icmp sgt i32 %7, 0
br i1 %cmp2469, label %for.body25, label %for.inc44
for.body25: ; preds = %for.cond23.preheader, %if.end
%k.071 = phi i32 [ %k.1, %if.end ], [ 2, %for.cond23.preheader ]
%j.170 = phi i32 [ %add30, %if.end ], [ 0, %for.cond23.preheader ]
%idxprom28 = sext i32 %k.071 to i64
%arrayidx29 = getelementptr inbounds [100 x [100 x i32]], ptr %A, i64 0, i64 %indvars.iv80, i64 %idxprom28
%8 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%add30 = add nuw nsw i32 %j.170, 1
%cmp31 = icmp eq i32 %8, %add30
br i1 %cmp31, label %if.then, label %if.else
if.then: ; preds = %for.body25
%putchar62 = call i32 @putchar(i32 49)
%inc33 = add nsw i32 %k.071, 1
br label %if.end
if.else: ; preds = %for.body25
%putchar = call i32 @putchar(i32 48)
br label %if.end
if.end: ; preds = %if.else, %if.then
%k.1 = phi i32 [ %inc33, %if.then ], [ %k.071, %if.else ]
%9 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %9, -1
%cmp35 = icmp eq i32 %j.170, %sub
%. = select i1 %cmp35, i32 10, i32 32
%putchar64 = call i32 @putchar(i32 %.)
%10 = load i32, ptr %n, align 4, !tbaa !5
%cmp24 = icmp slt i32 %add30, %10
br i1 %cmp24, label %for.body25, label %for.inc44, !llvm.loop !12
for.inc44: ; preds = %if.end, %for.cond23.preheader
%11 = phi i32 [ %7, %for.cond23.preheader ], [ %10, %if.end ]
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%12 = sext i32 %11 to i64
%cmp21 = icmp slt i64 %indvars.iv.next81, %12
br i1 %cmp21, label %for.cond23.preheader, label %for.end46, !llvm.loop !13
for.end46: ; preds = %for.inc44, %entry, %for.cond20.preheader
call void @llvm.lifetime.end.p0(i64 40000, 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
|
#include <stdio.h>
#define MAX 101
int T[MAX][MAX];
int main()
{
int n,i,j,youso,kazu,v;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d%d",&youso,&kazu);
for(j=0;j<kazu;j++)
{
scanf("%d",&v);
T[i][v]=1;
}
}
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(j!=n)printf("%d ",T[i][j]);
else printf("%d\n",T[i][j]);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293339/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293339/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@T = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.3 = 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
%youso = alloca i32, align 4
%kazu = alloca i32, align 4
%v = 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 %youso) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %kazu) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not48 = icmp slt i32 %0, 1
br i1 %cmp.not48, label %for.end33, label %for.body
for.cond11.preheader: ; preds = %for.inc8
%cmp12.not52 = icmp slt i32 %4, 1
br i1 %cmp12.not52, label %for.end33, label %for.cond14.preheader
for.body: ; preds = %entry, %for.inc8
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc8 ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %youso, ptr noundef nonnull %kazu)
%1 = load i32, ptr %kazu, align 4, !tbaa !5
%cmp346 = icmp sgt i32 %1, 0
br i1 %cmp346, label %for.body4, label %for.inc8
for.body4: ; preds = %for.body, %for.body4
%j.047 = phi i32 [ %inc, %for.body4 ], [ 0, %for.body ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%2 = load i32, ptr %v, align 4, !tbaa !5
%idxprom6 = sext i32 %2 to i64
%arrayidx7 = getelementptr inbounds [101 x [101 x i32]], ptr @T, i64 0, i64 %indvars.iv, i64 %idxprom6
store i32 1, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %j.047, 1
%3 = load i32, ptr %kazu, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc, %3
br i1 %cmp3, label %for.body4, label %for.inc8, !llvm.loop !9
for.inc8: ; preds = %for.body4, %for.body
%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.not.not = icmp slt i64 %indvars.iv, %5
br i1 %cmp.not.not, label %for.body, label %for.cond11.preheader, !llvm.loop !11
for.cond14.preheader: ; preds = %for.cond11.preheader, %for.inc31
%6 = phi i32 [ %12, %for.inc31 ], [ %4, %for.cond11.preheader ]
%indvars.iv59 = phi i64 [ %indvars.iv.next60, %for.inc31 ], [ 1, %for.cond11.preheader ]
%cmp15.not50 = icmp slt i32 %6, 1
br i1 %cmp15.not50, label %for.cond14.preheader.for.inc31_crit_edge, label %for.body16
for.cond14.preheader.for.inc31_crit_edge: ; preds = %for.cond14.preheader
%.pre = sext i32 %6 to i64
br label %for.inc31
for.body16: ; preds = %for.cond14.preheader, %for.body16
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body16 ], [ 1, %for.cond14.preheader ]
%7 = phi i32 [ %10, %for.body16 ], [ %6, %for.cond14.preheader ]
%8 = zext i32 %7 to i64
%cmp17.not = icmp eq i64 %indvars.iv56, %8
%arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr @T, i64 0, i64 %indvars.iv59, i64 %indvars.iv56
%9 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%.str.3..str.2 = select i1 %cmp17.not, ptr @.str.3, ptr @.str.2
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3..str.2, i32 noundef %9)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp15.not.not = icmp slt i64 %indvars.iv56, %11
br i1 %cmp15.not.not, label %for.body16, label %for.inc31, !llvm.loop !12
for.inc31: ; preds = %for.body16, %for.cond14.preheader.for.inc31_crit_edge
%.pre-phi = phi i64 [ %.pre, %for.cond14.preheader.for.inc31_crit_edge ], [ %11, %for.body16 ]
%12 = phi i32 [ %6, %for.cond14.preheader.for.inc31_crit_edge ], [ %10, %for.body16 ]
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%cmp12.not.not = icmp slt i64 %indvars.iv59, %.pre-phi
br i1 %cmp12.not.not, label %for.cond14.preheader, label %for.end33, !llvm.loop !13
for.end33: ; preds = %for.inc31, %entry, %for.cond11.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %kazu) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %youso) #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, !14}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
|
#include<stdio.h>
#define MAX 100
int main(){
int n,i,j,v,u,k;
int Adj[MAX][MAX];
scanf("%d", &n);
for(i=0; i<n; i++){
for(j=0;j<n;j++)
Adj[i][j]=0;
}
for(i=0; i<n; i++){
scanf("%d", &u);
scanf("%d", &k);
u--;
for(j=0;j<k;j++){
scanf("%d", &v);
v--;
Adj[u][v]=1;
}
}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(j==n-1)printf("%d", Adj[i][j]);
else printf("%d ", Adj[i][j]);
}printf("\n");}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293382/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293382/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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%v = alloca i32, align 4
%u = alloca i32, align 4
%k = alloca i32, align 4
%Adj = alloca [100 x [100 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %Adj) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp72 = icmp sgt i32 %0, 0
br i1 %cmp72, label %for.cond1.preheader.us.preheader, label %for.end52
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
%invariant.gep = getelementptr i8, ptr %Adj, i64 400
%invariant.gep89 = getelementptr i8, ptr %Adj, i64 800
%invariant.gep91 = getelementptr i8, ptr %Adj, i64 1200
%invariant.gep93 = getelementptr i8, ptr %Adj, i64 1600
%invariant.gep95 = getelementptr i8, ptr %Adj, i64 2000
%invariant.gep97 = getelementptr i8, ptr %Adj, i64 2400
%invariant.gep99 = getelementptr i8, ptr %Adj, i64 2800
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr %Adj, i64 %4
call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr %invariant.gep, i64 %5
call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep90 = getelementptr i8, ptr %invariant.gep89, i64 %6
call void @llvm.memset.p0.i64(ptr align 16 %gep90, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep92 = getelementptr i8, ptr %invariant.gep91, i64 %7
call void @llvm.memset.p0.i64(ptr align 16 %gep92, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep94 = getelementptr i8, ptr %invariant.gep93, i64 %8
call void @llvm.memset.p0.i64(ptr align 16 %gep94, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep96 = getelementptr i8, ptr %invariant.gep95, i64 %9
call void @llvm.memset.p0.i64(ptr align 16 %gep96, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep98 = getelementptr i8, ptr %invariant.gep97, i64 %10
call void @llvm.memset.p0.i64(ptr align 16 %gep98, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep100 = getelementptr i8, ptr %invariant.gep99, i64 %11
call void @llvm.memset.p0.i64(ptr align 16 %gep100, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !9
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr %Adj, i64 %12
call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !11
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp72, label %for.body11, label %for.end52
for.cond29.preheader: ; preds = %for.inc26
%cmp3080 = icmp sgt i32 %18, 0
br i1 %cmp3080, label %for.cond32.preheader, label %for.end52
for.body11: ; preds = %for.cond9.preheader, %for.inc26
%i.177 = phi i32 [ %inc27, %for.inc26 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %u)
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%13 = load i32, ptr %u, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %u, align 4, !tbaa !5
%14 = load i32, ptr %k, align 4, !tbaa !5
%cmp1574 = icmp sgt i32 %14, 0
br i1 %cmp1574, label %for.body16, label %for.inc26
for.body16: ; preds = %for.body11, %for.body16
%j.175 = phi i32 [ %inc24, %for.body16 ], [ 0, %for.body11 ]
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%15 = load i32, ptr %v, align 4, !tbaa !5
%dec18 = add nsw i32 %15, -1
store i32 %dec18, ptr %v, align 4, !tbaa !5
%16 = load i32, ptr %u, align 4, !tbaa !5
%idxprom19 = sext i32 %16 to i64
%idxprom21 = sext i32 %dec18 to i64
%arrayidx22 = getelementptr inbounds [100 x [100 x i32]], ptr %Adj, i64 0, i64 %idxprom19, i64 %idxprom21
store i32 1, ptr %arrayidx22, align 4, !tbaa !5
%inc24 = add nuw nsw i32 %j.175, 1
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp15 = icmp slt i32 %inc24, %17
br i1 %cmp15, label %for.body16, label %for.inc26, !llvm.loop !13
for.inc26: ; preds = %for.body16, %for.body11
%inc27 = add nuw nsw i32 %i.177, 1
%18 = load i32, ptr %n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc27, %18
br i1 %cmp10, label %for.body11, label %for.cond29.preheader, !llvm.loop !14
for.cond32.preheader: ; preds = %for.cond29.preheader, %for.end48
%19 = phi i32 [ %25, %for.end48 ], [ %18, %for.cond29.preheader ]
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.end48 ], [ 0, %for.cond29.preheader ]
%cmp3378 = icmp sgt i32 %19, 0
br i1 %cmp3378, label %for.body34, label %for.end48
for.body34: ; preds = %for.cond32.preheader, %for.body34
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body34 ], [ 0, %for.cond32.preheader ]
%20 = phi i32 [ %23, %for.body34 ], [ %19, %for.cond32.preheader ]
%sub = add nsw i32 %20, -1
%21 = zext i32 %sub to i64
%cmp35 = icmp eq i64 %indvars.iv, %21
%arrayidx39 = getelementptr inbounds [100 x [100 x i32]], ptr %Adj, i64 0, i64 %indvars.iv85, i64 %indvars.iv
%22 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%.str..str.1 = select i1 %cmp35, ptr @.str, ptr @.str.1
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.1, i32 noundef %22)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%23 = load i32, ptr %n, align 4, !tbaa !5
%24 = sext i32 %23 to i64
%cmp33 = icmp slt i64 %indvars.iv.next, %24
br i1 %cmp33, label %for.body34, label %for.end48, !llvm.loop !15
for.end48: ; preds = %for.body34, %for.cond32.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%25 = load i32, ptr %n, align 4, !tbaa !5
%26 = sext i32 %25 to i64
%cmp30 = icmp slt i64 %indvars.iv.next86, %26
br i1 %cmp30, label %for.cond32.preheader, label %for.end52, !llvm.loop !16
for.end52: ; preds = %for.end48, %entry, %for.cond9.preheader, %for.cond29.preheader
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %Adj) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #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: 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
#define N 100
int main()
{
int n,i,adj[N+1][N+1],j,u,k,v,l,flag = 0,m;
scanf("%d",&n);
for(i = 0; i <= n; i++){
for(j = 0; j <= n; j++){
adj[i][j] = 0;
}
}
for(i = 0; i < n; i++){
scanf("%d %d",&u,&k);
for(j = 0; j < k; j++){
scanf("%d",&v);
adj[u][v] = 1;
}
}
for(i = 1; i <= n; i++){ /*表示*/
for(j = 1; j <= n; j++){
if(j > 1)printf(" ");
printf("%d",adj[i][j]);
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293432/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293432/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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%adj = alloca [101 x [101 x i32]], align 16
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %adj) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not65 = icmp slt i32 %0, 0
br i1 %cmp.not65, label %for.end46, label %for.cond1.preheader.preheader
for.cond1.preheader.preheader: ; preds = %entry
%1 = add nuw i32 %0, 1
%2 = zext i32 %1 to i64
%3 = shl nuw nsw i64 %2, 2
%xtraiter = and i64 %2, 7
%4 = icmp ult i32 %0, 7
br i1 %4, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.preheader.new
for.cond1.preheader.preheader.new: ; preds = %for.cond1.preheader.preheader
%unroll_iter = and i64 %2, 4294967288
%invariant.gep = getelementptr i8, ptr %adj, i64 404
%invariant.gep84 = getelementptr i8, ptr %adj, i64 808
%invariant.gep86 = getelementptr i8, ptr %adj, i64 1212
%invariant.gep88 = getelementptr i8, ptr %adj, i64 1616
%invariant.gep90 = getelementptr i8, ptr %adj, i64 2020
%invariant.gep92 = getelementptr i8, ptr %adj, i64 2424
%invariant.gep94 = getelementptr i8, ptr %adj, i64 2828
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader, %for.cond1.preheader.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.preheader.new ], [ %indvar.next.7, %for.cond1.preheader ]
%niter = phi i64 [ 0, %for.cond1.preheader.preheader.new ], [ %niter.next.7, %for.cond1.preheader ]
%5 = mul nuw nsw i64 %indvar, 404
%scevgep = getelementptr i8, ptr %adj, i64 %5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %scevgep, i8 0, i64 %3, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 404
%gep = getelementptr i8, ptr %invariant.gep, i64 %6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %gep, i8 0, i64 %3, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 404
%gep85 = getelementptr i8, ptr %invariant.gep84, i64 %7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(1) %gep85, i8 0, i64 %3, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 404
%gep87 = getelementptr i8, ptr %invariant.gep86, i64 %8
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %gep87, i8 0, i64 %3, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 404
%gep89 = getelementptr i8, ptr %invariant.gep88, i64 %9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %gep89, i8 0, i64 %3, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 404
%gep91 = getelementptr i8, ptr %invariant.gep90, i64 %10
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %gep91, i8 0, i64 %3, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 404
%gep93 = getelementptr i8, ptr %invariant.gep92, i64 %11
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(1) %gep93, i8 0, i64 %3, i1 false), !tbaa !5
%12 = mul nuw i64 %indvar, 404
%gep95 = getelementptr i8, ptr %invariant.gep94, i64 %12
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %gep95, i8 0, i64 %3, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader, !llvm.loop !9
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader, %for.cond1.preheader.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvar.next.7, %for.cond1.preheader ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.epil
for.cond1.preheader.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%13 = mul nuw nsw i64 %indvar.epil, 404
%scevgep.epil = getelementptr i8, ptr %adj, i64 %13
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep.epil, i8 0, i64 %3, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond9.preheader, label %for.cond1.preheader.epil, !llvm.loop !11
for.cond9.preheader: ; preds = %for.cond1.preheader.epil, %for.cond9.preheader.unr-lcssa
%cmp1069 = icmp sgt i32 %0, 0
br i1 %cmp1069, label %for.body11, label %for.end46
for.cond27.preheader: ; preds = %for.inc24
%cmp28.not73 = icmp slt i32 %18, 1
br i1 %cmp28.not73, label %for.end46, label %for.cond30.preheader
for.body11: ; preds = %for.cond9.preheader, %for.inc24
%i.170 = phi i32 [ %inc25, %for.inc24 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%14 = load i32, ptr %k, align 4, !tbaa !5
%cmp1467 = icmp sgt i32 %14, 0
br i1 %cmp1467, label %for.body15, label %for.inc24
for.body15: ; preds = %for.body11, %for.body15
%j.168 = phi i32 [ %inc22, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%15 = load i32, ptr %u, align 4, !tbaa !5
%idxprom17 = sext i32 %15 to i64
%16 = load i32, ptr %v, align 4, !tbaa !5
%idxprom19 = sext i32 %16 to i64
%arrayidx20 = getelementptr inbounds [101 x [101 x i32]], ptr %adj, i64 0, i64 %idxprom17, i64 %idxprom19
store i32 1, ptr %arrayidx20, align 4, !tbaa !5
%inc22 = add nuw nsw i32 %j.168, 1
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc22, %17
br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !13
for.inc24: ; preds = %for.body15, %for.body11
%inc25 = add nuw nsw i32 %i.170, 1
%18 = load i32, ptr %n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc25, %18
br i1 %cmp10, label %for.body11, label %for.cond27.preheader, !llvm.loop !14
for.cond30.preheader: ; preds = %for.cond27.preheader, %for.end42
%19 = phi i32 [ %25, %for.end42 ], [ %18, %for.cond27.preheader ]
%indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.end42 ], [ 1, %for.cond27.preheader ]
%cmp31.not71 = icmp slt i32 %19, 1
br i1 %cmp31.not71, label %for.end42, label %if.end.peel
if.end.peel: ; preds = %for.cond30.preheader
%arrayidx38.peel = getelementptr inbounds [101 x [101 x i32]], ptr %adj, i64 0, i64 %indvars.iv79, i64 1
%20 = load i32, ptr %arrayidx38.peel, align 4, !tbaa !5
%call39.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %20)
%21 = load i32, ptr %n, align 4, !tbaa !5
%cmp31.not.not.peel = icmp sgt i32 %21, 1
br i1 %cmp31.not.not.peel, label %if.end, label %for.end42
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 2, %if.end.peel ]
%putchar62 = call i32 @putchar(i32 32)
%arrayidx38 = getelementptr inbounds [101 x [101 x i32]], ptr %adj, i64 0, i64 %indvars.iv79, i64 %indvars.iv
%22 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %22)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%23 = load i32, ptr %n, align 4, !tbaa !5
%24 = sext i32 %23 to i64
%cmp31.not.not = icmp slt i64 %indvars.iv, %24
br i1 %cmp31.not.not, label %if.end, label %for.end42, !llvm.loop !15
for.end42: ; preds = %if.end, %if.end.peel, %for.cond30.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%25 = load i32, ptr %n, align 4, !tbaa !5
%26 = sext i32 %25 to i64
%cmp28.not.not = icmp slt i64 %indvars.iv79, %26
br i1 %cmp28.not.not, label %for.cond30.preheader, label %for.end46, !llvm.loop !17
for.end46: ; preds = %for.end42, %entry, %for.cond9.preheader, %for.cond27.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %adj) #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: 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
int main(){
int n,k,v,u,V[101][101]={};
int i,j;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%d",&u,&k);
for(j=0;j<k;j++){
scanf("%d",&v);
V[u][v] = 1;
}
}
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
printf("%d",V[i][j]);
if(j!=n) printf(" ");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293483/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293483/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
; 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
%v = alloca i32, align 4
%u = alloca i32, align 4
%V = alloca [101 x [101 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %V) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40804) %V, i8 0, i64 40804, i1 false)
%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.end30
for.cond11.preheader: ; preds = %for.inc8
%cmp12.not47 = icmp slt i32 %5, 1
br i1 %cmp12.not47, label %for.end30, label %for.cond14.preheader
for.body: ; preds = %entry, %for.inc8
%i.044 = phi i32 [ %inc9, %for.inc8 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp341 = icmp sgt i32 %1, 0
br i1 %cmp341, label %for.body4, label %for.inc8
for.body4: ; preds = %for.body, %for.body4
%j.042 = phi i32 [ %inc, %for.body4 ], [ 0, %for.body ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%2 = load i32, ptr %u, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%3 = load i32, ptr %v, align 4, !tbaa !5
%idxprom6 = sext i32 %3 to i64
%arrayidx7 = getelementptr inbounds [101 x [101 x i32]], ptr %V, i64 0, i64 %idxprom, i64 %idxprom6
store i32 1, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %j.042, 1
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc, %4
br i1 %cmp3, label %for.body4, label %for.inc8, !llvm.loop !9
for.inc8: ; preds = %for.body4, %for.body
%inc9 = add nuw nsw i32 %i.044, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc9, %5
br i1 %cmp, label %for.body, label %for.cond11.preheader, !llvm.loop !11
for.cond14.preheader: ; preds = %for.cond11.preheader, %for.end26
%6 = phi i32 [ %12, %for.end26 ], [ %5, %for.cond11.preheader ]
%indvars.iv50 = phi i64 [ %indvars.iv.next51, %for.end26 ], [ 1, %for.cond11.preheader ]
%cmp15.not45 = icmp slt i32 %6, 1
br i1 %cmp15.not45, label %for.end26, label %for.body16
for.body16: ; preds = %for.cond14.preheader, %for.inc24
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc24 ], [ 1, %for.cond14.preheader ]
%arrayidx20 = getelementptr inbounds [101 x [101 x i32]], ptr %V, i64 0, i64 %indvars.iv50, i64 %indvars.iv
%7 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7)
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = zext i32 %8 to i64
%cmp22.not = icmp eq i64 %indvars.iv, %9
br i1 %cmp22.not, label %for.inc24, label %if.then
if.then: ; preds = %for.body16
%putchar40 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc24
for.inc24: ; preds = %for.body16, %if.then
%10 = phi i32 [ %8, %for.body16 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%11 = sext i32 %10 to i64
%cmp15.not.not = icmp slt i64 %indvars.iv, %11
br i1 %cmp15.not.not, label %for.body16, label %for.end26, !llvm.loop !12
for.end26: ; preds = %for.inc24, %for.cond14.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp12.not.not = icmp slt i64 %indvars.iv50, %13
br i1 %cmp12.not.not, label %for.cond14.preheader, label %for.end30, !llvm.loop !13
for.end30: ; preds = %for.end26, %entry, %for.cond11.preheader
call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %V) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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: 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: 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) #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 = { 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 = { 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>
#define N 100
int main(){
int M[N][N];
int i,j,n,u,k,v;
scanf("%d",&n);
for( i=0; i<n; i++){
for(j=0; j<n; j++){
M[i][j]=0;
}
}
for( i=0; i<n; i++){
scanf("%d%d",&u,&k);
u--;
for(j=0; j<k; j++){
scanf("%d",&v);
v--;
M[u][v]=1;
}
}
for(i=0; i<n; i++){
for(j=0; j<n; j++){
if(j) printf(" ");
printf("%d",M[i][j]);
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293526/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293526/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%M = alloca [100 x [100 x i32]], align 16
%n = alloca i32, align 4
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %M) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp65 = icmp sgt i32 %0, 0
br i1 %cmp65, label %for.cond1.preheader.us.preheader, label %for.end46
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
%invariant.gep = getelementptr i8, ptr %M, i64 400
%invariant.gep83 = getelementptr i8, ptr %M, i64 800
%invariant.gep85 = getelementptr i8, ptr %M, i64 1200
%invariant.gep87 = getelementptr i8, ptr %M, i64 1600
%invariant.gep89 = getelementptr i8, ptr %M, i64 2000
%invariant.gep91 = getelementptr i8, ptr %M, i64 2400
%invariant.gep93 = getelementptr i8, ptr %M, i64 2800
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr %M, i64 %4
call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr %invariant.gep, i64 %5
call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep84 = getelementptr i8, ptr %invariant.gep83, i64 %6
call void @llvm.memset.p0.i64(ptr align 16 %gep84, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep86 = getelementptr i8, ptr %invariant.gep85, i64 %7
call void @llvm.memset.p0.i64(ptr align 16 %gep86, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep88 = getelementptr i8, ptr %invariant.gep87, i64 %8
call void @llvm.memset.p0.i64(ptr align 16 %gep88, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep90 = getelementptr i8, ptr %invariant.gep89, i64 %9
call void @llvm.memset.p0.i64(ptr align 16 %gep90, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep92 = getelementptr i8, ptr %invariant.gep91, i64 %10
call void @llvm.memset.p0.i64(ptr align 16 %gep92, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep94 = getelementptr i8, ptr %invariant.gep93, i64 %11
call void @llvm.memset.p0.i64(ptr align 16 %gep94, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !9
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr %M, i64 %12
call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !11
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp65, label %for.body11, label %for.end46
for.cond28.preheader: ; preds = %for.inc25
%cmp2973 = icmp sgt i32 %18, 0
br i1 %cmp2973, label %for.cond31.preheader, label %for.end46
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.170 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %u, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %u, align 4, !tbaa !5
%14 = load i32, ptr %k, align 4, !tbaa !5
%cmp1467 = icmp sgt i32 %14, 0
br i1 %cmp1467, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.168 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%15 = load i32, ptr %v, align 4, !tbaa !5
%dec17 = add nsw i32 %15, -1
store i32 %dec17, ptr %v, align 4, !tbaa !5
%16 = load i32, ptr %u, align 4, !tbaa !5
%idxprom18 = sext i32 %16 to i64
%idxprom20 = sext i32 %dec17 to i64
%arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 %idxprom18, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.168, 1
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %17
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !13
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.170, 1
%18 = load i32, ptr %n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %18
br i1 %cmp10, label %for.body11, label %for.cond28.preheader, !llvm.loop !14
for.cond31.preheader: ; preds = %for.cond28.preheader, %for.end42
%19 = phi i32 [ %25, %for.end42 ], [ %18, %for.cond28.preheader ]
%indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.end42 ], [ 0, %for.cond28.preheader ]
%cmp3271 = icmp sgt i32 %19, 0
br i1 %cmp3271, label %if.end.peel, label %for.end42
if.end.peel: ; preds = %for.cond31.preheader
%arrayidx38.peel = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 %indvars.iv79, i64 0
%20 = load i32, ptr %arrayidx38.peel, align 16, !tbaa !5
%call39.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %20)
%21 = load i32, ptr %n, align 4, !tbaa !5
%cmp32.peel = icmp sgt i32 %21, 1
br i1 %cmp32.peel, label %if.end, label %for.end42
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar62 = call i32 @putchar(i32 32)
%arrayidx38 = getelementptr inbounds [100 x [100 x i32]], ptr %M, i64 0, i64 %indvars.iv79, i64 %indvars.iv
%22 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %22)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%23 = load i32, ptr %n, align 4, !tbaa !5
%24 = sext i32 %23 to i64
%cmp32 = icmp slt i64 %indvars.iv.next, %24
br i1 %cmp32, label %if.end, label %for.end42, !llvm.loop !15
for.end42: ; preds = %if.end, %if.end.peel, %for.cond31.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%25 = load i32, ptr %n, align 4, !tbaa !5
%26 = sext i32 %25 to i64
%cmp29 = icmp slt i64 %indvars.iv.next80, %26
br i1 %cmp29, label %for.cond31.preheader, label %for.end46, !llvm.loop !17
for.end46: ; preds = %for.end42, %entry, %for.cond9.preheader, %for.cond28.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %M) #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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
int N=100;
int main(){
int M[N][N];
int n,u,k,v,i,j;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
M[i][j]=0;
}
}
for(i=0;i<n;i++){
scanf("%d %d",&u,&k);
for(j=0;j<k;j++){
scanf("%d",&v);
M[u-1][v-1]=1;
}
}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
printf("%d",M[i][j]);
if(j!=n-1){
printf(" ");
}
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293577/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293577/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"
@N = dso_local local_unnamed_addr global i32 100, align 4
@.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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
%0 = load i32, ptr @N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = mul nuw i64 %1, %1
%vla = alloca i32, i64 %2, align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp67 = icmp sgt i32 %3, 0
br i1 %cmp67, label %for.cond1.preheader.us.preheader, label %for.end48
for.cond1.preheader.us.preheader: ; preds = %entry
%4 = shl nuw nsw i64 %1, 2
%5 = zext i32 %3 to i64
%6 = shl nuw nsw i64 %5, 2
%xtraiter = and i64 %5, 7
%7 = icmp ult i32 %3, 8
br i1 %7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %5, 4294967288
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%8 = mul nuw nsw i64 %4, %indvar
%scevgep = getelementptr i8, ptr %vla, i64 %8
call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %6, i1 false), !tbaa !5
%indvar.next = or i64 %indvar, 1
%9 = mul nuw nsw i64 %4, %indvar.next
%scevgep.1 = getelementptr i8, ptr %vla, i64 %9
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.1, i8 0, i64 %6, i1 false), !tbaa !5
%indvar.next.1 = or i64 %indvar, 2
%10 = mul nuw nsw i64 %4, %indvar.next.1
%scevgep.2 = getelementptr i8, ptr %vla, i64 %10
call void @llvm.memset.p0.i64(ptr align 8 %scevgep.2, i8 0, i64 %6, i1 false), !tbaa !5
%indvar.next.2 = or i64 %indvar, 3
%11 = mul nuw nsw i64 %4, %indvar.next.2
%scevgep.3 = getelementptr i8, ptr %vla, i64 %11
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.3, i8 0, i64 %6, i1 false), !tbaa !5
%indvar.next.3 = or i64 %indvar, 4
%12 = mul nuw nsw i64 %4, %indvar.next.3
%scevgep.4 = getelementptr i8, ptr %vla, i64 %12
call void @llvm.memset.p0.i64(ptr align 16 %scevgep.4, i8 0, i64 %6, i1 false), !tbaa !5
%indvar.next.4 = or i64 %indvar, 5
%13 = mul nuw nsw i64 %4, %indvar.next.4
%scevgep.5 = getelementptr i8, ptr %vla, i64 %13
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.5, i8 0, i64 %6, i1 false), !tbaa !5
%indvar.next.5 = or i64 %indvar, 6
%14 = mul nuw nsw i64 %4, %indvar.next.5
%scevgep.6 = getelementptr i8, ptr %vla, i64 %14
call void @llvm.memset.p0.i64(ptr align 8 %scevgep.6, i8 0, i64 %6, i1 false), !tbaa !5
%indvar.next.6 = or i64 %indvar, 7
%15 = mul nuw nsw i64 %4, %indvar.next.6
%scevgep.7 = getelementptr i8, ptr %vla, i64 %15
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.7, i8 0, i64 %6, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !9
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%16 = mul nuw nsw i64 %4, %indvar.epil
%scevgep.epil = getelementptr i8, ptr %vla, i64 %16
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.epil, i8 0, i64 %6, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !11
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp67, label %for.body11, label %for.end48
for.cond28.preheader: ; preds = %for.inc25
%cmp2975 = icmp sgt i32 %22, 0
br i1 %cmp2975, label %for.cond31.preheader, label %for.end48
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.172 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp1469 = icmp sgt i32 %17, 0
br i1 %cmp1469, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.170 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%18 = load i32, ptr %u, align 4, !tbaa !5
%sub = add nsw i32 %18, -1
%idxprom17 = sext i32 %sub to i64
%19 = mul nsw i64 %idxprom17, %1
%arrayidx18 = getelementptr inbounds i32, ptr %vla, i64 %19
%20 = load i32, ptr %v, align 4, !tbaa !5
%sub19 = add nsw i32 %20, -1
%idxprom20 = sext i32 %sub19 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %arrayidx18, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.170, 1
%21 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %21
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !13
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.172, 1
%22 = load i32, ptr %n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %22
br i1 %cmp10, label %for.body11, label %for.cond28.preheader, !llvm.loop !14
for.cond31.preheader: ; preds = %for.cond28.preheader, %for.end44
%23 = phi i32 [ %30, %for.end44 ], [ %22, %for.cond28.preheader ]
%indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.end44 ], [ 0, %for.cond28.preheader ]
%cmp3273 = icmp sgt i32 %23, 0
br i1 %cmp3273, label %for.body33.lr.ph, label %for.end44
for.body33.lr.ph: ; preds = %for.cond31.preheader
%24 = mul nuw nsw i64 %indvars.iv80, %1
%arrayidx35 = getelementptr inbounds i32, ptr %vla, i64 %24
br label %for.body33
for.body33: ; preds = %for.body33.lr.ph, %for.inc42
%indvars.iv = phi i64 [ 0, %for.body33.lr.ph ], [ %indvars.iv.next, %for.inc42 ]
%arrayidx37 = getelementptr inbounds i32, ptr %arrayidx35, i64 %indvars.iv
%25 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %25)
%26 = load i32, ptr %n, align 4, !tbaa !5
%sub39 = add nsw i32 %26, -1
%27 = zext i32 %sub39 to i64
%cmp40.not = icmp eq i64 %indvars.iv, %27
br i1 %cmp40.not, label %for.inc42, label %if.then
if.then: ; preds = %for.body33
%putchar64 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc42
for.inc42: ; preds = %for.body33, %if.then
%28 = phi i32 [ %26, %for.body33 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%29 = sext i32 %28 to i64
%cmp32 = icmp slt i64 %indvars.iv.next, %29
br i1 %cmp32, label %for.body33, label %for.end44, !llvm.loop !15
for.end44: ; preds = %for.inc42, %for.cond31.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%30 = load i32, ptr %n, align 4, !tbaa !5
%31 = sext i32 %30 to i64
%cmp29 = icmp slt i64 %indvars.iv.next81, %31
br i1 %cmp29, label %for.cond31.preheader, label %for.end48, !llvm.loop !16
for.end48: ; preds = %for.end44, %entry, %for.cond9.preheader, %for.cond28.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #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: 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
#include<string.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int i,j,n;
char a[105];
scanf("%d",&n);
int p=n/2,c=0;
scanf("%s",a);
int len=strlen(a);
for(i=0,j=len-1; i<len; i++,j--)
{
if(a[i]==a[j] || a[i]+2==a[j] || a[j]+2==a[i])
c++;
else
{
c=0;
break;
}
}
if(c==0) printf("NO\n");
else printf("YES\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_29362/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_29362/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 [4 x i8] c"YES\00", align 1
@str.4 = 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:
%t = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca [105 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec58 = add nsw i32 %0, -1
store i32 %dec58, ptr %t, align 4, !tbaa !5
%tobool.not59 = icmp eq i32 %0, 0
br i1 %tobool.not59, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end38
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 105, ptr nonnull %a) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %a) #6
%conv = trunc i64 %call4 to i32
%cmp54 = icmp slt i32 %conv, 1
br i1 %cmp54, label %if.end38, label %for.body.preheader
for.body.preheader: ; preds = %while.body
%sext = shl i64 %call4, 32
%1 = ashr exact i64 %sext, 32
%wide.trip.count = and i64 %call4, 4294967295
br label %for.body
for.body: ; preds = %for.body.preheader, %if.then
%indvars.iv60 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next61, %if.then ]
%indvars.iv = phi i64 [ %1, %for.body.preheader ], [ %indvars.iv.next, %if.then ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds [105 x i8], ptr %a, i64 0, i64 %indvars.iv60
%2 = load i8, ptr %arrayidx, align 1, !tbaa !9
%conv6 = sext i8 %2 to i32
%arrayidx8 = getelementptr inbounds [105 x i8], ptr %a, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx8, align 1, !tbaa !9
%conv9 = sext i8 %3 to i32
%cmp10 = icmp eq i8 %2, %3
%add = add nsw i32 %conv6, 2
%cmp18 = icmp eq i32 %add, %conv9
%or.cond = select i1 %cmp10, i1 true, i1 %cmp18
%add24 = add nsw i32 %conv9, 2
%cmp28 = icmp eq i32 %add24, %conv6
%or.cond49 = select i1 %or.cond, i1 true, i1 %cmp28
br i1 %or.cond49, label %if.then, label %if.end38
if.then: ; preds = %for.body
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
%exitcond.not = icmp eq i64 %indvars.iv.next61, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %if.then
%spec.select = select i1 %cmp54, ptr @str.4, ptr @str
br label %if.end38
if.end38: ; preds = %for.body, %for.end, %while.body
%str.sink = phi ptr [ @str.4, %while.body ], [ %spec.select, %for.end ], [ @str.4, %for.body ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 105, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
%4 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.end38, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<stdio.h>
#define N 100
int main(){
int i,j;
int a[N][N]={0};
int n,x,y,z;
scanf("%d",&n);//頂点数
for(i=0; i<n; i++){
scanf("%d %d",&x,&y); //x:1からn番目 y:各頂点に何個隣接するのがあるか
for(j=0; j<y; j++){ //j<yまで、なぜなら隣接する個数分だけスキャンするから
scanf("%d",&z); //z:隣接する頂点の分だけスキャンされる
a[x-1][z-1]=1; //配列だから-1しないといけない n番目に入れたいならn-1とかくように
}
}
for(i=0; i<n; i++){
for(j=0; j<n; j++){
if(j==n-1){
printf("%d",a[i][j]);
}
else{
printf("%d ",a[i][j]);
}
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293663/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293663/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"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [100 x [100 x i32]], align 16
%n = 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 40000, ptr nonnull %a) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40000) %a, i8 0, i64 40000, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp50 = icmp sgt i32 %0, 0
br i1 %cmp50, label %for.body, label %for.end36
for.cond12.preheader: ; preds = %for.inc9
%cmp1354 = icmp sgt i32 %5, 0
br i1 %cmp1354, label %for.cond15.preheader, label %for.end36
for.body: ; preds = %entry, %for.inc9
%i.051 = phi i32 [ %inc10, %for.inc9 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%1 = load i32, ptr %y, align 4, !tbaa !5
%cmp348 = icmp sgt i32 %1, 0
br i1 %cmp348, label %for.body4, label %for.inc9
for.body4: ; preds = %for.body, %for.body4
%j.049 = phi i32 [ %inc, %for.body4 ], [ 0, %for.body ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %z)
%2 = load i32, ptr %x, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%3 = load i32, ptr %z, align 4, !tbaa !5
%sub6 = add nsw i32 %3, -1
%idxprom7 = sext i32 %sub6 to i64
%arrayidx8 = getelementptr inbounds [100 x [100 x i32]], ptr %a, i64 0, i64 %idxprom, i64 %idxprom7
store i32 1, ptr %arrayidx8, align 4, !tbaa !5
%inc = add nuw nsw i32 %j.049, 1
%4 = load i32, ptr %y, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc, %4
br i1 %cmp3, label %for.body4, label %for.inc9, !llvm.loop !9
for.inc9: ; preds = %for.body4, %for.body
%inc10 = add nuw nsw i32 %i.051, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc10, %5
br i1 %cmp, label %for.body, label %for.cond12.preheader, !llvm.loop !11
for.cond15.preheader: ; preds = %for.cond12.preheader, %for.end32
%6 = phi i32 [ %12, %for.end32 ], [ %5, %for.cond12.preheader ]
%indvars.iv57 = phi i64 [ %indvars.iv.next58, %for.end32 ], [ 0, %for.cond12.preheader ]
%cmp1652 = icmp sgt i32 %6, 0
br i1 %cmp1652, label %for.body17, label %for.end32
for.body17: ; preds = %for.cond15.preheader, %for.body17
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body17 ], [ 0, %for.cond15.preheader ]
%7 = phi i32 [ %10, %for.body17 ], [ %6, %for.cond15.preheader ]
%sub18 = add nsw i32 %7, -1
%8 = zext i32 %sub18 to i64
%cmp19 = icmp eq i64 %indvars.iv, %8
%arrayidx23 = getelementptr inbounds [100 x [100 x i32]], ptr %a, i64 0, i64 %indvars.iv57, i64 %indvars.iv
%9 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%.str..str.2 = select i1 %cmp19, ptr @.str, ptr @.str.2
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.2, i32 noundef %9)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp16 = icmp slt i64 %indvars.iv.next, %11
br i1 %cmp16, label %for.body17, label %for.end32, !llvm.loop !12
for.end32: ; preds = %for.body17, %for.cond15.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp13 = icmp slt i64 %indvars.iv.next58, %13
br i1 %cmp13, label %for.cond15.preheader, label %for.end36, !llvm.loop !13
for.end36: ; preds = %for.end32, %entry, %for.cond12.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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: 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) #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 = { 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 = { 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,i,j,v,vv,m;
int map[101][101];
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
map[i][j]=0;
}
}
for(i=0;i<n;i++){
scanf("%d%d",&v,&m);
for(j=0;j<m;j++){
scanf("%d",&vv);
map[v-1][vv-1]=1;
}
}
for(i=0;i<n;i++){
for(j=0;j<n-1;j++){
printf("%d ",map[i][j]);
}
printf("%d\n",map[i][j]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293713/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293713/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.3 = 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
%v = alloca i32, align 4
%vv = alloca i32, align 4
%m = alloca i32, align 4
%map = alloca [101 x [101 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 %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %vv) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %map) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp69 = icmp sgt i32 %0, 0
br i1 %cmp69, label %for.cond1.preheader.us.preheader, label %for.end50
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
%invariant.gep = getelementptr i8, ptr %map, i64 404
%invariant.gep87 = getelementptr i8, ptr %map, i64 808
%invariant.gep89 = getelementptr i8, ptr %map, i64 1212
%invariant.gep91 = getelementptr i8, ptr %map, i64 1616
%invariant.gep93 = getelementptr i8, ptr %map, i64 2020
%invariant.gep95 = getelementptr i8, ptr %map, i64 2424
%invariant.gep97 = getelementptr i8, ptr %map, i64 2828
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 404
%scevgep = getelementptr i8, ptr %map, i64 %4
call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 404
%gep = getelementptr i8, ptr %invariant.gep, i64 %5
call void @llvm.memset.p0.i64(ptr align 4 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 404
%gep88 = getelementptr i8, ptr %invariant.gep87, i64 %6
call void @llvm.memset.p0.i64(ptr align 8 %gep88, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 404
%gep90 = getelementptr i8, ptr %invariant.gep89, i64 %7
call void @llvm.memset.p0.i64(ptr align 4 %gep90, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 404
%gep92 = getelementptr i8, ptr %invariant.gep91, i64 %8
call void @llvm.memset.p0.i64(ptr align 16 %gep92, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 404
%gep94 = getelementptr i8, ptr %invariant.gep93, i64 %9
call void @llvm.memset.p0.i64(ptr align 4 %gep94, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 404
%gep96 = getelementptr i8, ptr %invariant.gep95, i64 %10
call void @llvm.memset.p0.i64(ptr align 8 %gep96, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 404
%gep98 = getelementptr i8, ptr %invariant.gep97, i64 %11
call void @llvm.memset.p0.i64(ptr align 4 %gep98, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !9
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 404
%scevgep.epil = getelementptr i8, ptr %map, i64 %12
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !11
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp69, label %for.body11, label %for.end50
for.cond28.preheader: ; preds = %for.inc25
%cmp2978 = icmp sgt i32 %17, 0
br i1 %cmp2978, label %for.cond31.preheader, label %for.end50
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.174 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %m)
%13 = load i32, ptr %m, align 4, !tbaa !5
%cmp1471 = icmp sgt i32 %13, 0
br i1 %cmp1471, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.172 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %vv)
%14 = load i32, ptr %v, align 4, !tbaa !5
%sub = add nsw i32 %14, -1
%idxprom17 = sext i32 %sub to i64
%15 = load i32, ptr %vv, align 4, !tbaa !5
%sub19 = add nsw i32 %15, -1
%idxprom20 = sext i32 %sub19 to i64
%arrayidx21 = getelementptr inbounds [101 x [101 x i32]], ptr %map, i64 0, i64 %idxprom17, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.172, 1
%16 = load i32, ptr %m, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %16
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !13
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.174, 1
%17 = load i32, ptr %n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %17
br i1 %cmp10, label %for.body11, label %for.cond28.preheader, !llvm.loop !14
for.cond31.preheader: ; preds = %for.cond28.preheader, %for.end42
%18 = phi i32 [ %23, %for.end42 ], [ %17, %for.cond28.preheader ]
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.end42 ], [ 0, %for.cond28.preheader ]
%cmp3376 = icmp sgt i32 %18, 1
br i1 %cmp3376, label %for.body34, label %for.end42
for.body34: ; preds = %for.cond31.preheader, %for.body34
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body34 ], [ 0, %for.cond31.preheader ]
%arrayidx38 = getelementptr inbounds [101 x [101 x i32]], ptr %map, i64 0, i64 %indvars.iv83, i64 %indvars.iv
%19 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%20 = load i32, ptr %n, align 4, !tbaa !5
%sub32 = add nsw i32 %20, -1
%21 = sext i32 %sub32 to i64
%cmp33 = icmp slt i64 %indvars.iv.next, %21
br i1 %cmp33, label %for.body34, label %for.end42, !llvm.loop !15
for.end42: ; preds = %for.body34, %for.cond31.preheader
%j.2.lcssa = phi i64 [ 0, %for.cond31.preheader ], [ %indvars.iv.next, %for.body34 ]
%idxprom45 = and i64 %j.2.lcssa, 4294967295
%arrayidx46 = getelementptr inbounds [101 x [101 x i32]], ptr %map, i64 0, i64 %indvars.iv83, i64 %idxprom45
%22 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %22)
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%23 = load i32, ptr %n, align 4, !tbaa !5
%24 = sext i32 %23 to i64
%cmp29 = icmp slt i64 %indvars.iv.next84, %24
br i1 %cmp29, label %for.cond31.preheader, label %for.end50, !llvm.loop !16
for.end50: ; preds = %for.end42, %entry, %for.cond9.preheader, %for.cond28.preheader
call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %map) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %vv) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#include <stdlib.h>
void printMatrix(int s,int[s][s]);
int main(int argc, char** argv) {
int size;
scanf("%d", &size);
int matrix[size][size];
for(int i = 0; i < size; i++)
for(int j = 0; j < size; j++)
matrix[i][j] = 0;
int loc, count, adjacent;
for(int i = 0; i < size; i++){
scanf("%d %d",&loc, &count);
if(count > 0)
for(int j = 0; j < count; j++){
scanf("%d", &adjacent);
matrix[loc-1][--adjacent] = 1;
}
}
printMatrix(size,matrix);
return (EXIT_SUCCESS);
}
void printMatrix(int size, int mat[size][size]){
for(int i = 0; i < size; i++){
for(int j = 0; j < size; j++){
printf("%d", mat[i][j]);
if(j != size-1)
printf(" ");
}
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293757/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293757/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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%size = alloca i32, align 4
%loc = alloca i32, align 4
%count = alloca i32, align 4
%adjacent = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %size) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %size)
%0 = load i32, ptr %size, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%3 = mul nuw i64 %1, %1
%vla = alloca i32, i64 %3, align 16
%4 = load i32, ptr %size, align 4, !tbaa !5
%cmp41 = icmp sgt i32 %4, 0
br i1 %cmp41, label %for.cond1.preheader.us.preheader, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %loc) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %count) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %adjacent) #6
br label %printMatrix.exit
for.cond1.preheader.us.preheader: ; preds = %entry
%5 = shl nuw nsw i64 %1, 2
%6 = zext i32 %4 to i64
%7 = shl nuw nsw i64 %6, 2
%xtraiter = and i64 %6, 7
%8 = icmp ult i32 %4, 8
br i1 %8, label %for.cond.cleanup.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %6, 4294967288
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%9 = mul nuw nsw i64 %5, %indvar
%scevgep = getelementptr i8, ptr %vla, i64 %9
call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %7, i1 false), !tbaa !5
%indvar.next = or i64 %indvar, 1
%10 = mul nuw nsw i64 %5, %indvar.next
%scevgep.1 = getelementptr i8, ptr %vla, i64 %10
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.1, i8 0, i64 %7, i1 false), !tbaa !5
%indvar.next.1 = or i64 %indvar, 2
%11 = mul nuw nsw i64 %5, %indvar.next.1
%scevgep.2 = getelementptr i8, ptr %vla, i64 %11
call void @llvm.memset.p0.i64(ptr align 8 %scevgep.2, i8 0, i64 %7, i1 false), !tbaa !5
%indvar.next.2 = or i64 %indvar, 3
%12 = mul nuw nsw i64 %5, %indvar.next.2
%scevgep.3 = getelementptr i8, ptr %vla, i64 %12
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.3, i8 0, i64 %7, i1 false), !tbaa !5
%indvar.next.3 = or i64 %indvar, 4
%13 = mul nuw nsw i64 %5, %indvar.next.3
%scevgep.4 = getelementptr i8, ptr %vla, i64 %13
call void @llvm.memset.p0.i64(ptr align 16 %scevgep.4, i8 0, i64 %7, i1 false), !tbaa !5
%indvar.next.4 = or i64 %indvar, 5
%14 = mul nuw nsw i64 %5, %indvar.next.4
%scevgep.5 = getelementptr i8, ptr %vla, i64 %14
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.5, i8 0, i64 %7, i1 false), !tbaa !5
%indvar.next.5 = or i64 %indvar, 6
%15 = mul nuw nsw i64 %5, %indvar.next.5
%scevgep.6 = getelementptr i8, ptr %vla, i64 %15
call void @llvm.memset.p0.i64(ptr align 8 %scevgep.6, i8 0, i64 %7, i1 false), !tbaa !5
%indvar.next.6 = or i64 %indvar, 7
%16 = mul nuw nsw i64 %5, %indvar.next.6
%scevgep.7 = getelementptr i8, ptr %vla, i64 %16
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.7, i8 0, i64 %7, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond.cleanup.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !9
for.cond.cleanup.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond.cleanup.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond.cleanup.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond.cleanup.unr-lcssa ]
%17 = mul nuw nsw i64 %5, %indvar.epil
%scevgep.epil = getelementptr i8, ptr %vla, i64 %17
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.epil, i8 0, i64 %7, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.cond1.preheader.us.epil, !llvm.loop !11
for.cond.cleanup: ; preds = %for.cond1.preheader.us.epil, %for.cond.cleanup.unr-lcssa
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %loc) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %count) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %adjacent) #6
br i1 %cmp41, label %for.body14, label %printMatrix.exit
for.cond.cleanup13: ; preds = %for.inc30
%18 = zext i32 %27 to i64
%cmp25.i = icmp sgt i32 %27, 0
br i1 %cmp25.i, label %for.cond1.preheader.lr.ph.i, label %printMatrix.exit
for.cond1.preheader.lr.ph.i: ; preds = %for.cond.cleanup13
%sub.i = add nsw i32 %27, -1
%19 = zext i32 %sub.i to i64
br label %for.cond1.preheader.us.i
for.cond1.preheader.us.i: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us.i, %for.cond1.preheader.lr.ph.i
%indvars.iv28.i = phi i64 [ %indvars.iv.next29.i, %for.cond1.for.cond.cleanup3_crit_edge.us.i ], [ 0, %for.cond1.preheader.lr.ph.i ]
%20 = mul nuw nsw i64 %indvars.iv28.i, %18
%arrayidx.us.i = getelementptr inbounds i32, ptr %vla, i64 %20
br label %for.body4.us.i
for.body4.us.i: ; preds = %for.inc.us.i, %for.cond1.preheader.us.i
%indvars.iv.i = phi i64 [ 0, %for.cond1.preheader.us.i ], [ %indvars.iv.next.i, %for.inc.us.i ]
%arrayidx6.us.i = getelementptr inbounds i32, ptr %arrayidx.us.i, i64 %indvars.iv.i
%21 = load i32, ptr %arrayidx6.us.i, align 4, !tbaa !5
%call.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %21)
%cmp7.not.us.i = icmp eq i64 %indvars.iv.i, %19
br i1 %cmp7.not.us.i, label %for.inc.us.i, label %if.then.us.i
if.then.us.i: ; preds = %for.body4.us.i
%putchar22.us.i = call i32 @putchar(i32 32)
br label %for.inc.us.i
for.inc.us.i: ; preds = %if.then.us.i, %for.body4.us.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %18
br i1 %exitcond.not.i, label %for.cond1.for.cond.cleanup3_crit_edge.us.i, label %for.body4.us.i, !llvm.loop !13
for.cond1.for.cond.cleanup3_crit_edge.us.i: ; preds = %for.inc.us.i
%putchar.us.i = call i32 @putchar(i32 10)
%indvars.iv.next29.i = add nuw nsw i64 %indvars.iv28.i, 1
%exitcond32.not.i = icmp eq i64 %indvars.iv.next29.i, %18
br i1 %exitcond32.not.i, label %printMatrix.exit, label %for.cond1.preheader.us.i, !llvm.loop !14
printMatrix.exit: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us.i, %for.cond.cleanup.thread, %for.cond.cleanup, %for.cond.cleanup13
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %adjacent) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %count) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %loc) #6
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %size) #6
ret i32 0
for.body14: ; preds = %for.cond.cleanup, %for.inc30
%i10.046 = phi i32 [ %inc31, %for.inc30 ], [ 0, %for.cond.cleanup ]
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %loc, ptr noundef nonnull %count)
%22 = load i32, ptr %count, align 4
%cmp1943 = icmp sgt i32 %22, 0
br i1 %cmp1943, label %for.body21, label %for.inc30
for.body21: ; preds = %for.body14, %for.body21
%j17.044 = phi i32 [ %inc28, %for.body21 ], [ 0, %for.body14 ]
%call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %adjacent)
%23 = load i32, ptr %loc, align 4, !tbaa !5
%sub = add nsw i32 %23, -1
%idxprom23 = sext i32 %sub to i64
%24 = mul nsw i64 %idxprom23, %1
%arrayidx24 = getelementptr inbounds i32, ptr %vla, i64 %24
%25 = load i32, ptr %adjacent, align 4, !tbaa !5
%dec = add nsw i32 %25, -1
store i32 %dec, ptr %adjacent, align 4, !tbaa !5
%idxprom25 = sext i32 %dec to i64
%arrayidx26 = getelementptr inbounds i32, ptr %arrayidx24, i64 %idxprom25
store i32 1, ptr %arrayidx26, align 4, !tbaa !5
%inc28 = add nuw nsw i32 %j17.044, 1
%26 = load i32, ptr %count, align 4, !tbaa !5
%cmp19 = icmp slt i32 %inc28, %26
br i1 %cmp19, label %for.body21, label %for.inc30, !llvm.loop !15
for.inc30: ; preds = %for.body21, %for.body14
%inc31 = add nuw nsw i32 %i10.046, 1
%27 = load i32, ptr %size, align 4, !tbaa !5
%cmp12 = icmp slt i32 %inc31, %27
br i1 %cmp12, label %for.body14, label %for.cond.cleanup13, !llvm.loop !16
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @printMatrix(i32 noundef %size, ptr nocapture noundef readonly %mat) local_unnamed_addr #0 {
entry:
%0 = zext i32 %size to i64
%cmp25 = icmp sgt i32 %size, 0
br i1 %cmp25, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup
for.cond1.preheader.lr.ph: ; preds = %entry
%sub = add nsw i32 %size, -1
%1 = zext i32 %sub to i64
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us, %for.cond1.preheader.lr.ph
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.cond1.for.cond.cleanup3_crit_edge.us ], [ 0, %for.cond1.preheader.lr.ph ]
%2 = mul nuw nsw i64 %indvars.iv28, %0
%arrayidx.us = getelementptr inbounds i32, ptr %mat, i64 %2
br label %for.body4.us
for.body4.us: ; preds = %for.cond1.preheader.us, %for.inc.us
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.us ], [ %indvars.iv.next, %for.inc.us ]
%arrayidx6.us = getelementptr inbounds i32, ptr %arrayidx.us, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6.us, align 4, !tbaa !5
%call.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %3)
%cmp7.not.us = icmp eq i64 %indvars.iv, %1
br i1 %cmp7.not.us, label %for.inc.us, label %if.then.us
if.then.us: ; preds = %for.body4.us
%putchar22.us = tail call i32 @putchar(i32 32)
br label %for.inc.us
for.inc.us: ; preds = %if.then.us, %for.body4.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %0
br i1 %exitcond.not, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us, !llvm.loop !13
for.cond1.for.cond.cleanup3_crit_edge.us: ; preds = %for.inc.us
%putchar.us = tail call i32 @putchar(i32 10)
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
%exitcond32.not = icmp eq i64 %indvars.iv.next29, %0
br i1 %exitcond32.not, label %for.cond.cleanup, label %for.cond1.preheader.us, !llvm.loop !14
for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us, %entry
ret void
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
int main()
{
int t,i;
scanf("%d",&t);
for(i=0;i<t;i++)
{
int n,j,k=0;
scanf("%d",&n);
char a[n+1];
scanf("%s",a);
for(j=0;j<n/2;j++)
{ if(a[n-j-1]-a[j]==0||a[n-j-1]-a[j]==2||a[j]-a[n-j-1]==0||a[j]-a[n-j-1]==2)
{ k=2; }
else
{ k=0; j=n; }
}
if(k==2)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
}return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_29380/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_29380/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp72 = icmp sgt i32 %0, 0
br i1 %cmp72, label %for.body, label %for.end57
for.body: ; preds = %entry, %if.end54
%i.073 = phi i32 [ %inc56, %if.end54 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %1, 1
%2 = zext i32 %add to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %2, align 16
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla)
%4 = load i32, ptr %n, align 4, !tbaa !5
%div = sdiv i32 %4, 2
%cmp470 = icmp sgt i32 %4, 1
br i1 %cmp470, label %for.body5, label %if.else52
for.body5: ; preds = %for.body, %for.body5
%j.071 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body ]
%5 = xor i32 %j.071, -1
%sub6 = add i32 %4, %5
%idxprom = sext i32 %sub6 to i64
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %idxprom
%6 = load i8, ptr %arrayidx, align 1, !tbaa !9
%conv = sext i8 %6 to i32
%idxprom7 = sext i32 %j.071 to i64
%arrayidx8 = getelementptr inbounds i8, ptr %vla, i64 %idxprom7
%7 = load i8, ptr %arrayidx8, align 1, !tbaa !9
%conv9 = sext i8 %7 to i32
%cmp11 = icmp eq i8 %6, %7
%sub10 = sub nsw i32 %conv, %conv9
%cmp22 = icmp eq i32 %sub10, 2
%or.cond = select i1 %cmp11, i1 true, i1 %cmp22
%sub33 = sub nsw i32 %conv9, %conv
%cmp46 = icmp eq i32 %sub33, 2
%or.cond69 = select i1 %or.cond, i1 true, i1 %cmp46
%j.1 = select i1 %or.cond69, i32 %j.071, i32 %4
%inc = add nsw i32 %j.1, 1
%cmp4 = icmp slt i32 %inc, %div
br i1 %cmp4, label %for.body5, label %for.cond3.for.end_crit_edge, !llvm.loop !10
for.cond3.for.end_crit_edge: ; preds = %for.body5
br i1 %or.cond69, label %if.end54, label %if.else52
if.else52: ; preds = %for.cond3.for.end_crit_edge, %for.body
br label %if.end54
if.end54: ; preds = %for.cond3.for.end_crit_edge, %if.else52
%str.sink = phi ptr [ @str, %if.else52 ], [ @str.4, %for.cond3.for.end_crit_edge ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
%inc56 = add nuw nsw i32 %i.073, 1
%8 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc56, %8
br i1 %cmp, label %for.body, label %for.end57, !llvm.loop !12
for.end57: ; preds = %if.end54, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
|
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
int main(void) {
int N, M;
scanf("%d %d", &N, &M);
int from1[200000];
int dst1 = 0;
bool toN[200001];
memset(toN, 0, N);
for (int i = 0; i < M; i++) {
int a, b;
scanf("%d %d", &a, &b);
if (a == 1) {
from1[dst1++] = b;
}
if (b == N) {
toN[a] = true;
}
}
for (int i = 0; i < dst1; i++) {
int v = from1[i];
if (toN[v]) {
printf("POSSIBLE\n");
return 0;
}
}
printf("IMPOSSIBLE\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293843/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293843/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 = private unnamed_addr constant [9 x i8] c"POSSIBLE\00", align 1
@str.3 = private unnamed_addr constant [11 x i8] c"IMPOSSIBLE\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
%from1 = alloca [200000 x i32], align 16
%toN = alloca [200001 x i8], align 16
%a = alloca i32, align 4
%b = 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 %M) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %from1) #5
call void @llvm.lifetime.start.p0(i64 200001, ptr nonnull %toN) #5
%0 = load i32, ptr %N, align 4, !tbaa !5
%conv = sext i32 %0 to i64
call void @llvm.memset.p0.i64(ptr nonnull align 16 %toN, i8 0, i64 %conv, i1 false)
%1 = load i32, ptr %M, align 4, !tbaa !5
%cmp43 = icmp sgt i32 %1, 0
br i1 %cmp43, label %for.body, label %cleanup31
for.cond13.preheader: ; preds = %if.end10
%cmp14.not46 = icmp sgt i32 %dst1.1, 0
br i1 %cmp14.not46, label %for.body17.preheader, label %cleanup31
for.body17.preheader: ; preds = %for.cond13.preheader
%wide.trip.count = zext i32 %dst1.1 to i64
br label %for.body17
for.body: ; preds = %entry, %if.end10
%i.045 = phi i32 [ %inc11, %if.end10 ], [ 0, %entry ]
%dst1.044 = phi i32 [ %dst1.1, %if.end10 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !5
%cmp3 = icmp eq i32 %2, 1
%.pre = load i32, ptr %b, align 4, !tbaa !5
br i1 %cmp3, label %if.then, label %if.end
if.then: ; preds = %for.body
%inc = add nsw i32 %dst1.044, 1
%idxprom = sext i32 %dst1.044 to i64
%arrayidx = getelementptr inbounds [200000 x i32], ptr %from1, i64 0, i64 %idxprom
store i32 %.pre, ptr %arrayidx, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %for.body
%dst1.1 = phi i32 [ %inc, %if.then ], [ %dst1.044, %for.body ]
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp5 = icmp eq i32 %.pre, %3
br i1 %cmp5, label %if.then7, label %if.end10
if.then7: ; preds = %if.end
%idxprom8 = sext i32 %2 to i64
%arrayidx9 = getelementptr inbounds [200001 x i8], ptr %toN, i64 0, i64 %idxprom8
store i8 1, ptr %arrayidx9, align 1, !tbaa !9
br label %if.end10
if.end10: ; preds = %if.then7, %if.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
%inc11 = add nuw nsw i32 %i.045, 1
%4 = load i32, ptr %M, align 4, !tbaa !5
%cmp = icmp slt i32 %inc11, %4
br i1 %cmp, label %for.body, label %for.cond13.preheader, !llvm.loop !11
for.cond13: ; preds = %for.body17
%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 %cleanup31, label %for.body17, !llvm.loop !13
for.body17: ; preds = %for.body17.preheader, %for.cond13
%indvars.iv = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next, %for.cond13 ]
%arrayidx19 = getelementptr inbounds [200000 x i32], ptr %from1, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%idxprom20 = sext i32 %5 to i64
%arrayidx21 = getelementptr inbounds [200001 x i8], ptr %toN, i64 0, i64 %idxprom20
%6 = load i8, ptr %arrayidx21, align 1, !tbaa !9, !range !14, !noundef !15
%tobool.not = icmp eq i8 %6, 0
br i1 %tobool.not, label %for.cond13, label %cleanup31
cleanup31: ; preds = %for.cond13, %for.body17, %for.cond13.preheader, %entry
%str.sink = phi ptr [ @str.3, %entry ], [ @str.3, %for.cond13.preheader ], [ @str, %for.body17 ], [ @str.3, %for.cond13 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 200001, ptr nonnull %toN) #5
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %from1) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!10, !10, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{i8 0, i8 2}
!15 = !{}
|
#include <stdio.h>
#include <stdlib.h>
#define MAX_NUM 200000
#define BIRTHDAY 1009
typedef struct hash{
int num;
struct hash *next;
}hash;
void append(hash**, int);
void search(hash**, int);
void clean(hash**);
void possible();
int a_list[MAX_NUM] = {0};
int a_index = 0;
hash *hash_list[BIRTHDAY] = {NULL};
int main(void){
int N, M;
int a, b;
int i;
hash *p;
scanf("%d %d", &N, &M);
for(i = 0; i < M; i++){
scanf("%d %d", &a, &b);
if(a == 1){
append(hash_list, b);
}
if(b == N){
a_list[a_index++] = a;
}
}
for(i=0; i<a_index; i++){
search(hash_list, a_list[i]);
}
clean(hash_list);
printf("IMPOSSIBLE");
return 0;
}
void append(hash **list, int num){
hash *p, *tmp;
hash *item;
tmp = NULL;
for(p = list[num%BIRTHDAY]; p != NULL && p->num < num; p = p->next)
tmp = p;
item = (hash*)malloc(sizeof(hash));
item->num = num;
item->next = p;
if(tmp == NULL)
list[num%BIRTHDAY] = item;
else
tmp->next = item;
}
void search(hash **list, int num){
hash *p;
for(p = list[num%BIRTHDAY]; p != NULL && p->num <= num; p = p->next){
if(p->num == num)
possible();
}
}
void possible(){
clean(hash_list);
printf("POSSIBLE");
exit(0);
}
void clean(hash **list){
int i;
hash *p, *tmp;
tmp = NULL;
for(i = 0; i < BIRTHDAY; i++){
for(p = list[i]; p != NULL; p = p->next){
free(tmp);
tmp = p;
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_293887/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_293887/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.hash = type { i32, ptr }
@a_list = dso_local local_unnamed_addr global [200000 x i32] zeroinitializer, align 16
@a_index = dso_local local_unnamed_addr global i32 0, align 4
@hash_list = dso_local global [1009 x ptr] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"IMPOSSIBLE\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"POSSIBLE\00", align 1
; Function Attrs: 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
%b = 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 %M) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #8
%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 !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body, label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.inc, %entry
%1 = load i32, ptr @a_index, align 4, !tbaa !5
%cmp841 = icmp sgt i32 %1, 0
br i1 %cmp841, label %for.body9.preheader, label %for.body.i28.preheader
for.body9.preheader: ; preds = %for.cond7.preheader
%wide.trip.count = zext i32 %1 to i64
br label %for.body9
for.body: ; preds = %entry, %for.inc
%i.040 = phi i32 [ %inc6, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !5
%cmp2 = icmp eq i32 %2, 1
%.pre = load i32, ptr %b, align 4, !tbaa !5
br i1 %cmp2, label %if.then, label %if.end
if.then: ; preds = %for.body
%rem.i = srem i32 %.pre, 1009
%idxprom.i = sext i32 %rem.i to i64
%arrayidx.i = getelementptr inbounds ptr, ptr @hash_list, i64 %idxprom.i
%p.022.i = load ptr, ptr %arrayidx.i, align 8, !tbaa !9
%cmp.not23.i = icmp eq ptr %p.022.i, null
br i1 %cmp.not23.i, label %append.exit, label %land.rhs.i.preheader
land.rhs.i.preheader: ; preds = %if.then
%3 = load i32, ptr %p.022.i, align 8, !tbaa !11
%cmp2.i34 = icmp slt i32 %3, %.pre
br i1 %cmp2.i34, label %for.body.i, label %append.exit
land.rhs.i: ; preds = %for.body.i
%4 = load i32, ptr %p.0.i, align 8, !tbaa !11
%cmp2.i = icmp slt i32 %4, %.pre
br i1 %cmp2.i, label %for.body.i, label %append.exit, !llvm.loop !13
for.body.i: ; preds = %land.rhs.i.preheader, %land.rhs.i
%p.025.i35 = phi ptr [ %p.0.i, %land.rhs.i ], [ %p.022.i, %land.rhs.i.preheader ]
%next.i = getelementptr inbounds %struct.hash, ptr %p.025.i35, i64 0, i32 1
%p.0.i = load ptr, ptr %next.i, align 8, !tbaa !9
%cmp.not.i = icmp eq ptr %p.0.i, null
br i1 %cmp.not.i, label %append.exit, label %land.rhs.i, !llvm.loop !13
append.exit: ; preds = %for.body.i, %land.rhs.i, %land.rhs.i.preheader, %if.then
%tmp.0.lcssa.i = phi ptr [ null, %if.then ], [ null, %land.rhs.i.preheader ], [ %p.025.i35, %land.rhs.i ], [ %p.025.i35, %for.body.i ]
%p.0.lcssa.i = phi ptr [ null, %if.then ], [ %p.022.i, %land.rhs.i.preheader ], [ null, %for.body.i ], [ %p.0.i, %land.rhs.i ]
%call.i = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #9
store i32 %.pre, ptr %call.i, align 8, !tbaa !11
%next4.i = getelementptr inbounds %struct.hash, ptr %call.i, i64 0, i32 1
store ptr %p.0.lcssa.i, ptr %next4.i, align 8, !tbaa !15
%cmp5.i = icmp eq ptr %tmp.0.lcssa.i, null
%next9.i = getelementptr inbounds %struct.hash, ptr %tmp.0.lcssa.i, i64 0, i32 1
%next9.sink.i = select i1 %cmp5.i, ptr %arrayidx.i, ptr %next9.i
store ptr %call.i, ptr %next9.sink.i, align 8, !tbaa !9
br label %if.end
if.end: ; preds = %append.exit, %for.body
%5 = load i32, ptr %N, align 4, !tbaa !5
%cmp3 = icmp eq i32 %.pre, %5
br i1 %cmp3, label %if.then4, label %for.inc
if.then4: ; preds = %if.end
%6 = load i32, ptr @a_index, align 4, !tbaa !5
%inc = add nsw i32 %6, 1
store i32 %inc, ptr @a_index, align 4, !tbaa !5
%idxprom = sext i32 %6 to i64
%arrayidx = getelementptr inbounds [200000 x i32], ptr @a_list, i64 0, i64 %idxprom
store i32 %2, ptr %arrayidx, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end, %if.then4
%inc6 = add nuw nsw i32 %i.040, 1
%7 = load i32, ptr %M, align 4, !tbaa !5
%cmp = icmp slt i32 %inc6, %7
br i1 %cmp, label %for.body, label %for.cond7.preheader, !llvm.loop !16
for.body9: ; preds = %for.body9.preheader, %search.exit
%indvars.iv = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next, %search.exit ]
%arrayidx11 = getelementptr inbounds [200000 x i32], ptr @a_list, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%rem.i20 = srem i32 %8, 1009
%idxprom.i21 = sext i32 %rem.i20 to i64
%arrayidx.i22 = getelementptr inbounds ptr, ptr @hash_list, i64 %idxprom.i21
%p.010.i = load ptr, ptr %arrayidx.i22, align 8, !tbaa !9
%cmp.not11.i = icmp eq ptr %p.010.i, null
br i1 %cmp.not11.i, label %search.exit, label %land.rhs.i23
for.cond.i: ; preds = %for.body.i24
%next.i25 = getelementptr inbounds %struct.hash, ptr %p.012.i, i64 0, i32 1
%p.0.i26 = load ptr, ptr %next.i25, align 8, !tbaa !9
%cmp.not.i27 = icmp eq ptr %p.0.i26, null
br i1 %cmp.not.i27, label %search.exit, label %land.rhs.i23, !llvm.loop !17
land.rhs.i23: ; preds = %for.body9, %for.cond.i
%p.012.i = phi ptr [ %p.0.i26, %for.cond.i ], [ %p.010.i, %for.body9 ]
%9 = load i32, ptr %p.012.i, align 8, !tbaa !11
%cmp2.not.i = icmp sgt i32 %9, %8
br i1 %cmp2.not.i, label %search.exit, label %for.body.i24
for.body.i24: ; preds = %land.rhs.i23
%cmp4.i = icmp eq i32 %9, %8
br i1 %cmp4.i, label %if.then.i, label %for.cond.i
if.then.i: ; preds = %for.body.i24
call void @clean(ptr noundef nonnull @hash_list)
%call.i.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
call void @exit(i32 noundef 0) #10
unreachable
search.exit: ; preds = %for.cond.i, %land.rhs.i23, %for.body9
%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.body.i28.preheader, label %for.body9, !llvm.loop !18
for.body.i28.preheader: ; preds = %search.exit, %for.cond7.preheader
br label %for.body.i28
for.body.i28: ; preds = %for.body.i28.preheader, %for.inc4.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc4.i ], [ 0, %for.body.i28.preheader ]
%tmp.015.i = phi ptr [ %tmp.1.lcssa.i, %for.inc4.i ], [ null, %for.body.i28.preheader ]
%arrayidx.i29 = getelementptr inbounds ptr, ptr @hash_list, i64 %indvars.iv.i
%p.010.i30 = load ptr, ptr %arrayidx.i29, align 8, !tbaa !9
%cmp2.not11.i = icmp eq ptr %p.010.i30, null
br i1 %cmp2.not11.i, label %for.inc4.i, label %for.body3.i
for.body3.i: ; preds = %for.body.i28, %for.body3.i
%p.013.i = phi ptr [ %p.0.i32, %for.body3.i ], [ %p.010.i30, %for.body.i28 ]
%tmp.112.i = phi ptr [ %p.013.i, %for.body3.i ], [ %tmp.015.i, %for.body.i28 ]
call void @free(ptr noundef %tmp.112.i) #8
%next.i31 = getelementptr inbounds %struct.hash, ptr %p.013.i, i64 0, i32 1
%p.0.i32 = load ptr, ptr %next.i31, align 8, !tbaa !9
%cmp2.not.i33 = icmp eq ptr %p.0.i32, null
br i1 %cmp2.not.i33, label %for.inc4.i, label %for.body3.i, !llvm.loop !19
for.inc4.i: ; preds = %for.body3.i, %for.body.i28
%tmp.1.lcssa.i = phi ptr [ %tmp.015.i, %for.body.i28 ], [ %p.013.i, %for.body3.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, 1009
br i1 %exitcond.not.i, label %clean.exit, label %for.body.i28, !llvm.loop !20
clean.exit: ; preds = %for.inc4.i
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @append(ptr nocapture noundef %list, i32 noundef %num) local_unnamed_addr #3 {
entry:
%rem = srem i32 %num, 1009
%idxprom = sext i32 %rem to i64
%arrayidx = getelementptr inbounds ptr, ptr %list, i64 %idxprom
%p.022 = load ptr, ptr %arrayidx, align 8, !tbaa !9
%cmp.not23 = icmp eq ptr %p.022, null
br i1 %cmp.not23, label %for.end, label %land.rhs.preheader
land.rhs.preheader: ; preds = %entry
%0 = load i32, ptr %p.022, align 8, !tbaa !11
%cmp229 = icmp slt i32 %0, %num
br i1 %cmp229, label %for.body, label %for.end
land.rhs: ; preds = %for.body
%1 = load i32, ptr %p.0, align 8, !tbaa !11
%cmp2 = icmp slt i32 %1, %num
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !13
for.body: ; preds = %land.rhs.preheader, %land.rhs
%p.02530 = phi ptr [ %p.0, %land.rhs ], [ %p.022, %land.rhs.preheader ]
%next = getelementptr inbounds %struct.hash, ptr %p.02530, i64 0, i32 1
%p.0 = load ptr, ptr %next, align 8, !tbaa !9
%cmp.not = icmp eq ptr %p.0, null
br i1 %cmp.not, label %for.end, label %land.rhs, !llvm.loop !13
for.end: ; preds = %for.body, %land.rhs, %land.rhs.preheader, %entry
%tmp.0.lcssa = phi ptr [ null, %entry ], [ null, %land.rhs.preheader ], [ %p.02530, %land.rhs ], [ %p.02530, %for.body ]
%p.0.lcssa = phi ptr [ null, %entry ], [ %p.022, %land.rhs.preheader ], [ %p.0, %land.rhs ], [ null, %for.body ]
%call = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #9
store i32 %num, ptr %call, align 8, !tbaa !11
%next4 = getelementptr inbounds %struct.hash, ptr %call, i64 0, i32 1
store ptr %p.0.lcssa, ptr %next4, align 8, !tbaa !15
%cmp5 = icmp eq ptr %tmp.0.lcssa, null
%next9 = getelementptr inbounds %struct.hash, ptr %tmp.0.lcssa, i64 0, i32 1
%next9.sink = select i1 %cmp5, ptr %arrayidx, ptr %next9
store ptr %call, ptr %next9.sink, align 8, !tbaa !9
ret void
}
; Function Attrs: nounwind uwtable
define dso_local void @search(ptr nocapture noundef readonly %list, i32 noundef %num) local_unnamed_addr #0 {
entry:
%rem = srem i32 %num, 1009
%idxprom = sext i32 %rem to i64
%arrayidx = getelementptr inbounds ptr, ptr %list, i64 %idxprom
%p.010 = load ptr, ptr %arrayidx, align 8, !tbaa !9
%cmp.not11 = icmp eq ptr %p.010, null
br i1 %cmp.not11, label %for.end, label %land.rhs
for.cond: ; preds = %for.body
%next = getelementptr inbounds %struct.hash, ptr %p.012, i64 0, i32 1
%p.0 = load ptr, ptr %next, align 8, !tbaa !9
%cmp.not = icmp eq ptr %p.0, null
br i1 %cmp.not, label %for.end, label %land.rhs, !llvm.loop !17
land.rhs: ; preds = %entry, %for.cond
%p.012 = phi ptr [ %p.0, %for.cond ], [ %p.010, %entry ]
%0 = load i32, ptr %p.012, align 8, !tbaa !11
%cmp2.not = icmp sgt i32 %0, %num
br i1 %cmp2.not, label %for.end, label %for.body
for.body: ; preds = %land.rhs
%cmp4 = icmp eq i32 %0, %num
br i1 %cmp4, label %if.then, label %for.cond
if.then: ; preds = %for.body
tail call void @clean(ptr noundef nonnull @hash_list)
%call.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
tail call void @exit(i32 noundef 0) #10
unreachable
for.end: ; preds = %land.rhs, %for.cond, %entry
ret void
}
; Function Attrs: nounwind uwtable
define dso_local void @clean(ptr nocapture noundef readonly %list) local_unnamed_addr #0 {
entry:
br label %for.body
for.body: ; preds = %entry, %for.inc4
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc4 ]
%tmp.015 = phi ptr [ null, %entry ], [ %tmp.1.lcssa, %for.inc4 ]
%arrayidx = getelementptr inbounds ptr, ptr %list, i64 %indvars.iv
%p.010 = load ptr, ptr %arrayidx, align 8, !tbaa !9
%cmp2.not11 = icmp eq ptr %p.010, null
br i1 %cmp2.not11, label %for.inc4, label %for.body3
for.body3: ; preds = %for.body, %for.body3
%p.013 = phi ptr [ %p.0, %for.body3 ], [ %p.010, %for.body ]
%tmp.112 = phi ptr [ %p.013, %for.body3 ], [ %tmp.015, %for.body ]
tail call void @free(ptr noundef %tmp.112) #8
%next = getelementptr inbounds %struct.hash, ptr %p.013, i64 0, i32 1
%p.0 = load ptr, ptr %next, align 8, !tbaa !9
%cmp2.not = icmp eq ptr %p.0, null
br i1 %cmp2.not, label %for.inc4, label %for.body3, !llvm.loop !19
for.inc4: ; preds = %for.body3, %for.body
%tmp.1.lcssa = phi ptr [ %tmp.015, %for.body ], [ %p.013, %for.body3 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 1009
br i1 %exitcond.not, label %for.end5, label %for.body, !llvm.loop !20
for.end5: ; preds = %for.inc4
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: noreturn nounwind uwtable
define dso_local void @possible() local_unnamed_addr #5 {
entry:
tail call void @clean(ptr noundef nonnull @hash_list)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
tail call void @exit(i32 noundef 0) #10
unreachable
}
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #7
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { noreturn nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"hash", !6, i64 0, !10, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!12, !10, i64 8}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
|
#define rep(v, a, b) for (v = (a); v <= (b); v++)
#define repi(n) for (i = 0; i < (n); i++)
#define repj(n) for (j = 0; j < (n); j++)
#define repk(n) for (k = 0; k < (n); k++)
#include <stdio.h>
#include <assert.h>
int ok(int m)
{
int k = m, d = 2, cnt = 0;
while (d*d <= k)
{
if (k%d == 0)
{
while (k%d == 0) k /= d;
cnt++;
}
d++;
}
if (k > 1) cnt++;
return cnt == 2;
}
int main()
{
int i, n, sum = 0;
scanf("%d", &n);
rep(i, 1, n) if (ok(i)) sum++;
printf("%d\n", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_29393/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_29393/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(none) uwtable
define dso_local i32 @ok(i32 noundef %m) local_unnamed_addr #0 {
entry:
%cmp.not27 = icmp slt i32 %m, 4
br i1 %cmp.not27, label %while.end7, label %while.body
while.body: ; preds = %entry, %if.end
%cnt.030 = phi i32 [ %cnt.1, %if.end ], [ 0, %entry ]
%d.029 = phi i32 [ %inc6, %if.end ], [ 2, %entry ]
%k.028 = phi i32 [ %k.2, %if.end ], [ %m, %entry ]
%rem = srem i32 %k.028, %d.029
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %while.body5, label %if.end
while.body5: ; preds = %while.body, %while.body5
%k.126 = phi i32 [ %div, %while.body5 ], [ %k.028, %while.body ]
%div = sdiv i32 %k.126, %d.029
%rem3 = srem i32 %div, %d.029
%cmp4 = icmp eq i32 %rem3, 0
br i1 %cmp4, label %while.body5, label %while.end, !llvm.loop !5
while.end: ; preds = %while.body5
%inc = add nsw i32 %cnt.030, 1
br label %if.end
if.end: ; preds = %while.end, %while.body
%k.2 = phi i32 [ %div, %while.end ], [ %k.028, %while.body ]
%cnt.1 = phi i32 [ %inc, %while.end ], [ %cnt.030, %while.body ]
%inc6 = add nuw nsw i32 %d.029, 1
%mul = mul nsw i32 %inc6, %inc6
%cmp.not = icmp sgt i32 %mul, %k.2
br i1 %cmp.not, label %while.end7, label %while.body, !llvm.loop !7
while.end7: ; preds = %if.end, %entry
%k.0.lcssa = phi i32 [ %m, %entry ], [ %k.2, %if.end ]
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %cnt.1, %if.end ]
%cmp8 = icmp sgt i32 %k.0.lcssa, 1
%inc10 = zext i1 %cmp8 to i32
%spec.select = add nsw i32 %cnt.0.lcssa, %inc10
%cmp12 = icmp eq i32 %spec.select, 2
%conv = zext i1 %cmp12 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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !8
%cmp.not7 = icmp slt i32 %0, 1
br i1 %cmp.not7, label %for.end, label %for.body
for.body: ; preds = %entry, %ok.exit
%sum.09 = phi i32 [ %spec.select, %ok.exit ], [ 0, %entry ]
%i.08 = phi i32 [ %inc2, %ok.exit ], [ 1, %entry ]
%cmp.not27.i = icmp ult i32 %i.08, 4
br i1 %cmp.not27.i, label %ok.exit, label %while.body.i
while.body.i: ; preds = %for.body, %if.end.i
%cnt.030.i = phi i32 [ %cnt.1.i, %if.end.i ], [ 0, %for.body ]
%d.029.i = phi i32 [ %inc6.i, %if.end.i ], [ 2, %for.body ]
%k.028.i = phi i32 [ %k.2.i, %if.end.i ], [ %i.08, %for.body ]
%rem.i = srem i32 %k.028.i, %d.029.i
%cmp1.i = icmp eq i32 %rem.i, 0
br i1 %cmp1.i, label %while.body5.i, label %if.end.i
while.body5.i: ; preds = %while.body.i, %while.body5.i
%k.126.i = phi i32 [ %div.i, %while.body5.i ], [ %k.028.i, %while.body.i ]
%div.i = sdiv i32 %k.126.i, %d.029.i
%rem3.i = srem i32 %div.i, %d.029.i
%cmp4.i = icmp eq i32 %rem3.i, 0
br i1 %cmp4.i, label %while.body5.i, label %while.end.i, !llvm.loop !5
while.end.i: ; preds = %while.body5.i
%inc.i = add nsw i32 %cnt.030.i, 1
br label %if.end.i
if.end.i: ; preds = %while.end.i, %while.body.i
%k.2.i = phi i32 [ %div.i, %while.end.i ], [ %k.028.i, %while.body.i ]
%cnt.1.i = phi i32 [ %inc.i, %while.end.i ], [ %cnt.030.i, %while.body.i ]
%inc6.i = add nuw nsw i32 %d.029.i, 1
%mul.i = mul nsw i32 %inc6.i, %inc6.i
%cmp.not.i = icmp sgt i32 %mul.i, %k.2.i
br i1 %cmp.not.i, label %ok.exit, label %while.body.i, !llvm.loop !7
ok.exit: ; preds = %if.end.i, %for.body
%k.0.lcssa.i = phi i32 [ %i.08, %for.body ], [ %k.2.i, %if.end.i ]
%cnt.0.lcssa.i = phi i32 [ 0, %for.body ], [ %cnt.1.i, %if.end.i ]
%cmp8.i = icmp sgt i32 %k.0.lcssa.i, 1
%inc10.i = zext i1 %cmp8.i to i32
%spec.select.i = add nsw i32 %cnt.0.lcssa.i, %inc10.i
%cmp12.i.not = icmp eq i32 %spec.select.i, 2
%inc = zext i1 %cmp12.i.not to i32
%spec.select = add nuw nsw i32 %sum.09, %inc
%inc2 = add nuw i32 %i.08, 1
%exitcond.not = icmp eq i32 %i.08, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %ok.exit, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %ok.exit ]
%call3 = 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 %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = distinct !{!12, !6}
|
#include <stdio.h>
int main(void){
while(1){
int a[5], x, y, i, flag=0, max=0, p=-1;;
for(i=0; i<5; i++) {
scanf(" %d %d", &x, &y);
if(x==0 && y==0) {
flag=1;
break;
}
a[i] = x+y;
if(max < a[i]) {
max = a[i];
p=i;
}
}
if(flag==1) break;
printf("%c %d\n", 'A'+p, a[p]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294022/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294022/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\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%c %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [5 x i32], align 16
%x = alloca i32, align 4
%y = alloca i32, align 4
%arrayidx.1 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 1
%arrayidx.2 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 2
%arrayidx.3 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 3
%arrayidx.4 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 4
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %a) #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
%call37 = 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
%cmp138 = icmp eq i32 %0, 0
%1 = load i32, ptr %y, align 4
%cmp239 = icmp eq i32 %1, 0
%or.cond40 = select i1 %cmp138, i1 %cmp239, i1 false
br i1 %or.cond40, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end.4
%2 = phi i32 [ %14, %if.end.4 ], [ %1, %entry ]
%3 = phi i32 [ %13, %if.end.4 ], [ %0, %entry ]
%add = add nsw i32 %2, %3
store i32 %add, ptr %a, align 16, !tbaa !5
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%4 = load i32, ptr %x, align 4, !tbaa !5
%cmp1.1 = icmp eq i32 %4, 0
%5 = load i32, ptr %y, align 4
%cmp2.1 = icmp eq i32 %5, 0
%or.cond.1 = select i1 %cmp1.1, i1 %cmp2.1, i1 false
br i1 %or.cond.1, label %while.end, label %if.end.1
if.end.1: ; preds = %if.end
%add.1 = add nsw i32 %5, %4
store i32 %add.1, ptr %arrayidx.1, align 4, !tbaa !5
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%6 = load i32, ptr %x, align 4, !tbaa !5
%cmp1.2 = icmp eq i32 %6, 0
%7 = load i32, ptr %y, align 4
%cmp2.2 = icmp eq i32 %7, 0
%or.cond.2 = select i1 %cmp1.2, i1 %cmp2.2, i1 false
br i1 %or.cond.2, label %while.end, label %if.end.2
if.end.2: ; preds = %if.end.1
%add.2 = add nsw i32 %7, %6
store i32 %add.2, ptr %arrayidx.2, align 8, !tbaa !5
%call.3 = 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
%cmp1.3 = icmp eq i32 %8, 0
%9 = load i32, ptr %y, align 4
%cmp2.3 = icmp eq i32 %9, 0
%or.cond.3 = select i1 %cmp1.3, i1 %cmp2.3, i1 false
br i1 %or.cond.3, label %while.end, label %if.end.3
if.end.3: ; preds = %if.end.2
%add.3 = add nsw i32 %9, %8
store i32 %add.3, ptr %arrayidx.3, align 4, !tbaa !5
%call.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%10 = load i32, ptr %x, align 4, !tbaa !5
%cmp1.4 = icmp eq i32 %10, 0
%11 = load i32, ptr %y, align 4
%cmp2.4 = icmp eq i32 %11, 0
%or.cond.4 = select i1 %cmp1.4, i1 %cmp2.4, i1 false
br i1 %or.cond.4, label %while.end, label %if.end.4
if.end.4: ; preds = %if.end.3
%spec.select = call i32 @llvm.smax.i32(i32 %add, i32 0)
%spec.select.1 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %add.1)
%spec.select.2 = call i32 @llvm.smax.i32(i32 %spec.select.1, i32 %add.2)
%cmp5.3 = icmp slt i32 %spec.select.2, %add.3
%cmp5.2 = icmp slt i32 %spec.select.1, %add.2
%cmp5.1 = icmp slt i32 %spec.select, %add.1
%cmp5 = icmp slt i32 %add, 1
%spec.select29 = sext i1 %cmp5 to i32
%spec.select29.1 = select i1 %cmp5.1, i32 1, i32 %spec.select29
%spec.select29.2 = select i1 %cmp5.2, i32 2, i32 %spec.select29.1
%spec.select29.3 = select i1 %cmp5.3, i32 3, i32 %spec.select29.2
%spec.select.3 = call i32 @llvm.smax.i32(i32 %spec.select.2, i32 %add.3)
%add.4 = add nsw i32 %11, %10
store i32 %add.4, ptr %arrayidx.4, align 16, !tbaa !5
%cmp5.4 = icmp slt i32 %spec.select.3, %add.4
%spec.select29.4 = select i1 %cmp5.4, i32 4, i32 %spec.select29.3
%add13 = add nsw i32 %spec.select29.4, 65
%idxprom14 = sext i32 %spec.select29.4 to i64
%arrayidx15 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 %idxprom14
%12 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add13, i32 noundef %12)
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 20, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %a) #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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%13 = load i32, ptr %x, align 4, !tbaa !5
%cmp1 = icmp eq i32 %13, 0
%14 = load i32, ptr %y, align 4
%cmp2 = icmp eq i32 %14, 0
%or.cond = select i1 %cmp1, i1 %cmp2, i1 false
br i1 %or.cond, label %while.end, label %if.end
while.end: ; preds = %if.end.4, %if.end, %if.end.1, %if.end.2, %if.end.3, %entry
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 20, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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>
int main(){
int n,m,i,maxN,max;
for(i=0;scanf("%d %d",&n,&m)&&(n||m);i++){
if(!(i%5))max=-1;
if(n+m>max){
max=n+m;maxN=i%5;}
if(i%5==4)printf("%c %d\n",'A'+maxN,max);
}return 0;} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294066/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294066/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 [7 x i8] c"%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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
%call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%tobool.not19 = icmp eq i32 %call18, 0
br i1 %tobool.not19, label %for.end, label %land.rhs
land.rhs: ; preds = %entry, %for.inc
%max.022 = phi i32 [ %max.2, %for.inc ], [ undef, %entry ]
%maxN.021 = phi i32 [ %maxN.1, %for.inc ], [ undef, %entry ]
%i.020 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool1 = icmp ne i32 %0, 0
%1 = load i32, ptr %m, align 4
%tobool2 = icmp ne i32 %1, 0
%2 = select i1 %tobool1, i1 true, i1 %tobool2
br i1 %2, label %for.body, label %for.end
for.body: ; preds = %land.rhs
%rem = urem i32 %i.020, 5
%tobool3.not = icmp eq i32 %rem, 0
%spec.select = select i1 %tobool3.not, i32 -1, i32 %max.022
%add = add nsw i32 %1, %0
%cmp = icmp sgt i32 %add, %spec.select
%maxN.1 = select i1 %cmp, i32 %rem, i32 %maxN.021
%max.2 = call i32 @llvm.smax.i32(i32 %add, i32 %spec.select)
%cmp9 = icmp eq i32 %rem, 4
br i1 %cmp9, label %if.then10, label %for.inc
if.then10: ; preds = %for.body
%add11 = add nsw i32 %maxN.1, 65
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add11, i32 noundef %max.2)
br label %for.inc
for.inc: ; preds = %for.body, %if.then10
%inc = add nuw nsw i32 %i.020, 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %for.end, label %land.rhs, !llvm.loop !9
for.end: ; preds = %land.rhs, %for.inc, %entry
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 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>
int main(){
int N;
scanf("%d",&N);
if(N%2==0){
printf("%d",N*(N-1)/2-N/2);
for(int i=1;i<=N;++i){
for(int j=i+1;j<=N;++j){
if(i+j!=N+1){
printf(" %d %d",i,j);
}
}
}
}else{
printf("%d\n",N*(N-1)/2-N/2);
for(int i=1;i<=N;++i){
for(int j=i+1;j<=N;++j){
if(i+j!=N){
printf(" %d %d",i,j);
}
}
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294109/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294109/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 [7 x i8] c" %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = and i32 %0, 1
%cmp = icmp eq i32 %1, 0
%sub = add nsw i32 %0, -1
%mul = mul nsw i32 %sub, %0
%div = sdiv i32 %mul, 2
%div1.neg = sdiv i32 %0, -2
%sub2 = add nsw i32 %div, %div1.neg
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub2)
%2 = load i32, ptr %N, align 4, !tbaa !5
%cmp4.not68 = icmp slt i32 %2, 1
br i1 %cmp4.not68, label %if.end45, label %for.body
for.cond.loopexit: ; preds = %for.inc, %for.body
%3 = phi i32 [ %4, %for.body ], [ %7, %for.inc ]
%cmp4.not.not = icmp slt i32 %i.069, %3
br i1 %cmp4.not.not, label %for.body, label %if.end45, !llvm.loop !9
for.body: ; preds = %if.then, %for.cond.loopexit
%4 = phi i32 [ %3, %for.cond.loopexit ], [ %2, %if.then ]
%i.069 = phi i32 [ %add, %for.cond.loopexit ], [ 1, %if.then ]
%add = add nuw nsw i32 %i.069, 1
%cmp6.not66.not = icmp slt i32 %i.069, %4
br i1 %cmp6.not66.not, label %for.body8, label %for.cond.loopexit
for.body8: ; preds = %for.body, %for.inc
%5 = phi i32 [ %7, %for.inc ], [ %4, %for.body ]
%6 = phi i32 [ %8, %for.inc ], [ %4, %for.body ]
%j.067 = phi i32 [ %inc, %for.inc ], [ %add, %for.body ]
%add9 = add nuw nsw i32 %j.067, %i.069
%add10 = add nsw i32 %6, 1
%cmp11.not = icmp eq i32 %add9, %add10
br i1 %cmp11.not, label %for.inc, label %if.then12
if.then12: ; preds = %for.body8
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.069, i32 noundef %j.067)
%.pre71 = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body8, %if.then12
%7 = phi i32 [ %5, %for.body8 ], [ %.pre71, %if.then12 ]
%8 = phi i32 [ %6, %for.body8 ], [ %.pre71, %if.then12 ]
%inc = add nuw nsw i32 %j.067, 1
%cmp6.not.not = icmp slt i32 %j.067, %8
br i1 %cmp6.not.not, label %for.body8, label %for.cond.loopexit, !llvm.loop !11
if.else: ; preds = %entry
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub2)
%9 = load i32, ptr %N, align 4, !tbaa !5
%cmp25.not64 = icmp slt i32 %9, 1
br i1 %cmp25.not64, label %if.end45, label %for.body27
for.cond24.loopexit: ; preds = %for.inc39, %for.body27
%10 = phi i32 [ %11, %for.body27 ], [ %14, %for.inc39 ]
%cmp25.not.not = icmp slt i32 %i23.065, %10
br i1 %cmp25.not.not, label %for.body27, label %if.end45, !llvm.loop !12
for.body27: ; preds = %if.else, %for.cond24.loopexit
%11 = phi i32 [ %10, %for.cond24.loopexit ], [ %9, %if.else ]
%i23.065 = phi i32 [ %add29, %for.cond24.loopexit ], [ 1, %if.else ]
%add29 = add nuw nsw i32 %i23.065, 1
%cmp31.not62.not = icmp slt i32 %i23.065, %11
br i1 %cmp31.not62.not, label %for.body33, label %for.cond24.loopexit
for.body33: ; preds = %for.body27, %for.inc39
%12 = phi i32 [ %14, %for.inc39 ], [ %11, %for.body27 ]
%13 = phi i32 [ %15, %for.inc39 ], [ %11, %for.body27 ]
%j28.063 = phi i32 [ %inc40, %for.inc39 ], [ %add29, %for.body27 ]
%add34 = add nuw nsw i32 %j28.063, %i23.065
%cmp35.not = icmp eq i32 %add34, %13
br i1 %cmp35.not, label %for.inc39, label %if.then36
if.then36: ; preds = %for.body33
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i23.065, i32 noundef %j28.063)
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc39
for.inc39: ; preds = %for.body33, %if.then36
%14 = phi i32 [ %12, %for.body33 ], [ %.pre, %if.then36 ]
%15 = phi i32 [ %13, %for.body33 ], [ %.pre, %if.then36 ]
%inc40 = add nuw nsw i32 %j28.063, 1
%cmp31.not.not = icmp slt i32 %j28.063, %15
br i1 %cmp31.not.not, label %for.body33, label %for.cond24.loopexit, !llvm.loop !13
if.end45: ; preds = %for.cond24.loopexit, %for.cond.loopexit, %if.else, %if.then
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>
#include <string.h>
#define forin(i, n) for (i = 0; i < n; i++)
#define lli long long int
#define printSp(i, a, n) forin(i, n) printf('%d ', a[i]);
#define printLn(i, a, n) forin(i, n) printf('%d\n', a[i]);
#define fis(n) fast_int_scan(n)
#define fls(n) fast_long_scan(n)
#define flli(n) fast_lli_scan(n)
#define scanIA(i, a, n) forin(i, n) fis(a + i);
#define scanLA(i, a, n) forin(i, n) fls(a + i);
#define scanLLIA(i, a, n) forin(i, n) flli(a + i);
void fast_int_scan(int *number)
{
//variable to indicate sign of input number
int negative = 0;
register int c;
*number = 0;
// extract current character from buffer
c = getchar();
if (c == '-')
{
// number is negative
negative = 1;
// extract the next character from the buffer
c = getchar();
}
// Keep on extracting characters if they are integers
// i.e ASCII Value lies from '0'(48) to '9' (57)
for (; (c > 47 && c < 58); c = getchar())
(*number) = (*number) * 10 + c - 48;
// if scanned input has a negative sign, negate the value
if (negative)
(*number) *= -1;
}
int gcd (int a, int b) {
int temp;
while (b) {
a %= b;
temp = a;
a = b;
b = temp;
}
return a;
}
int main()
{
int test, trav;
fast_int_scan(&test);
while (test-- > 0)
{
trav = 0;
char a[21], b[21];
scanf("\n%s", a);
scanf("\n%s", b);
int a_len = strlen(a);
int b_len = strlen(b);
int lcm = ((a_len * b_len) / gcd(a_len, b_len));
for (int i = 0; i < lcm; i++)
{
if (a[i % a_len] != b[i % b_len])
{
trav = 1;
break;
}
}
if (trav == 1)
{
printf("-1\n");
}
else {
for (int i = 0; i < lcm; i+=a_len)
{
printf("%s", a);
}
printf("\n");
}
fflush(stdout);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_29416/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_29416/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"\0A%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
@stdin = external local_unnamed_addr global ptr, align 8
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @fast_int_scan(ptr nocapture noundef %number) local_unnamed_addr #0 {
entry:
store i32 0, ptr %number, align 4, !tbaa !5
%0 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i = tail call i32 @getc(ptr noundef %0)
%cmp.not = icmp eq i32 %call.i, 45
br i1 %cmp.not, label %if.then, label %if.end
if.then: ; preds = %entry
%1 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i14 = tail call i32 @getc(ptr noundef %1)
br label %if.end
if.end: ; preds = %if.then, %entry
%c.0 = phi i32 [ %call.i14, %if.then ], [ %call.i, %entry ]
%2 = add i32 %c.0, -48
%3 = icmp ult i32 %2, 10
br i1 %3, label %for.body, label %for.end
for.body: ; preds = %if.end, %for.body
%c.116 = phi i32 [ %call.i15, %for.body ], [ %c.0, %if.end ]
%4 = load i32, ptr %number, align 4, !tbaa !5
%mul = mul nsw i32 %4, 10
%add = add nsw i32 %c.116, -48
%sub = add i32 %add, %mul
store i32 %sub, ptr %number, align 4, !tbaa !5
%5 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i15 = tail call i32 @getc(ptr noundef %5)
%6 = add i32 %call.i15, -48
%7 = icmp ult i32 %6, 10
br i1 %7, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %if.end
br i1 %cmp.not, label %if.then5, label %if.end7
if.then5: ; preds = %for.end
%8 = load i32, ptr %number, align 4, !tbaa !5
%mul6 = sub nsw i32 0, %8
store i32 %mul6, ptr %number, align 4, !tbaa !5
br label %if.end7
if.end7: ; preds = %if.then5, %for.end
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(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i32 %b, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.07 = phi i32 [ %b.addr.06, %while.body ], [ %a, %entry ]
%b.addr.06 = phi i32 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i32 %a.addr.07, %b.addr.06
%tobool.not = icmp eq i32 %rem, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i32 [ %a, %entry ], [ %b.addr.06, %while.body ]
ret i32 %a.addr.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [21 x i8], align 16
%b = alloca [21 x i8], align 16
%0 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i.i = tail call i32 @getc(ptr noundef %0)
%cmp.not.i = icmp eq i32 %call.i.i, 45
br i1 %cmp.not.i, label %if.then.i, label %if.end.i
if.then.i: ; preds = %entry
%1 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i14.i = tail call i32 @getc(ptr noundef %1)
br label %if.end.i
if.end.i: ; preds = %if.then.i, %entry
%c.0.i = phi i32 [ %call.i14.i, %if.then.i ], [ %call.i.i, %entry ]
%2 = add i32 %c.0.i, -48
%3 = icmp ult i32 %2, 10
br i1 %3, label %for.body.i, label %for.end.i
for.body.i: ; preds = %if.end.i, %for.body.i
%test.0 = phi i32 [ %sub.i, %for.body.i ], [ 0, %if.end.i ]
%c.116.i = phi i32 [ %call.i15.i, %for.body.i ], [ %c.0.i, %if.end.i ]
%mul.i = mul nsw i32 %test.0, 10
%add.i = add nsw i32 %c.116.i, -48
%sub.i = add i32 %add.i, %mul.i
%4 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i15.i = tail call i32 @getc(ptr noundef %4)
%5 = add i32 %call.i15.i, -48
%6 = icmp ult i32 %5, 10
br i1 %6, label %for.body.i, label %for.end.i, !llvm.loop !11
for.end.i: ; preds = %for.body.i, %if.end.i
%test.1 = phi i32 [ 0, %if.end.i ], [ %sub.i, %for.body.i ]
%mul6.i = sub nsw i32 0, %test.1
%spec.select = select i1 %cmp.not.i, i32 %mul6.i, i32 %test.1
%cmp55 = icmp sgt i32 %spec.select, 0
br i1 %cmp55, label %while.body, label %while.end
while.body: ; preds = %for.end.i, %if.end34
%dec56.in = phi i32 [ %dec56, %if.end34 ], [ %spec.select, %for.end.i ]
%dec56 = add nsw i32 %dec56.in, -1
call void @llvm.lifetime.start.p0(i64 21, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 21, ptr nonnull %b) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %a) #7
%conv = trunc i64 %call4 to i32
%call6 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %b) #7
%conv7 = trunc i64 %call6 to i32
%mul = mul nsw i32 %conv7, %conv
%tobool.not5.i = icmp eq i32 %conv7, 0
br i1 %tobool.not5.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %while.body, %while.body.i
%a.addr.07.i = phi i32 [ %b.addr.06.i, %while.body.i ], [ %conv, %while.body ]
%b.addr.06.i = phi i32 [ %rem.i, %while.body.i ], [ %conv7, %while.body ]
%rem.i = srem i32 %a.addr.07.i, %b.addr.06.i
%tobool.not.i = icmp eq i32 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !13
gcd.exit: ; preds = %while.body.i, %while.body
%a.addr.0.lcssa.i = phi i32 [ %conv, %while.body ], [ %b.addr.06.i, %while.body.i ]
%div = sdiv i32 %mul, %a.addr.0.lcssa.i
%cmp950 = icmp sgt i32 %div, 0
br i1 %cmp950, label %for.body, label %for.cond.cleanup26
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %i.051, 1
%exitcond.not = icmp eq i32 %inc, %div
br i1 %exitcond.not, label %for.cond23.preheader, label %for.body, !llvm.loop !14
for.cond23.preheader: ; preds = %for.cond
br i1 %cmp950, label %for.body27, label %for.cond.cleanup26
for.body: ; preds = %gcd.exit, %for.cond
%i.051 = phi i32 [ %inc, %for.cond ], [ 0, %gcd.exit ]
%rem = srem i32 %i.051, %conv
%idxprom = zext i32 %rem to i64
%arrayidx = getelementptr inbounds [21 x i8], ptr %a, i64 0, i64 %idxprom
%7 = load i8, ptr %arrayidx, align 1, !tbaa !15
%rem12 = srem i32 %i.051, %conv7
%idxprom13 = zext i32 %rem12 to i64
%arrayidx14 = getelementptr inbounds [21 x i8], ptr %b, i64 0, i64 %idxprom13
%8 = load i8, ptr %arrayidx14, align 1, !tbaa !15
%cmp16.not = icmp eq i8 %7, %8
br i1 %cmp16.not, label %for.cond, label %if.then20
if.then20: ; preds = %for.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end34
for.cond.cleanup26: ; preds = %for.body27, %gcd.exit, %for.cond23.preheader
%putchar = call i32 @putchar(i32 10)
br label %if.end34
for.body27: ; preds = %for.cond23.preheader, %for.body27
%i22.053 = phi i32 [ %add, %for.body27 ], [ 0, %for.cond23.preheader ]
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %a)
%add = add nsw i32 %i22.053, %conv
%cmp24 = icmp slt i32 %add, %div
br i1 %cmp24, label %for.body27, label %for.cond.cleanup26, !llvm.loop !16
if.end34: ; preds = %for.cond.cleanup26, %if.then20
%9 = load ptr, ptr @stdout, align 8, !tbaa !9
%call35 = call i32 @fflush(ptr noundef %9)
call void @llvm.lifetime.end.p0(i64 21, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 21, ptr nonnull %a) #6
%cmp = icmp sgt i32 %dec56.in, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !17
while.end: ; preds = %if.end34, %for.end.i
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree 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 #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 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!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}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
|
#include<stdio.h>
int main()
{
int i,t,n,d,j,k,A[200],check;
scanf("%d",&t);
for (i=0;i<t;i++)
{
check=0;
scanf("%d %d",&n,&d);
for (j=0;j<n;j++)
{
scanf("%d",&A[j]);
}
for (j=0;j<n;j++)
{
for (k=0;k<j;k++)
{
if (A[j]+A[k]<=d)
{
check=1;
break;
}
}
}
if (check==0)
{
for (j=0;j<n;j++)
{
if (A[j]>d)
check=1;
}
if (check==0)
printf("YES\n");
else printf("NO\n");
}
else printf("YES\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_29421/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_29421/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.4 = 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:
%t = alloca i32, align 4
%n = alloca i32, align 4
%d = alloca i32, align 4
%A = alloca [200 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp76 = icmp sgt i32 %0, 0
br i1 %cmp76, label %for.body, label %for.end46
for.body: ; preds = %entry, %for.inc44
%i.077 = phi i32 [ %inc45, %for.inc44 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %d)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp362 = icmp sgt i32 %1, 0
br i1 %cmp362, label %for.body4, label %for.inc44
for.cond6.preheader: ; preds = %for.body4
%cmp768 = icmp slt i32 %4, 1
br i1 %cmp768, label %for.inc44, label %for.cond9.preheader.lr.ph
for.cond9.preheader.lr.ph: ; preds = %for.cond6.preheader
%2 = load i32, ptr %d, align 4
%wide.trip.count86 = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count86, 1
%3 = icmp eq i32 %4, 1
br i1 %3, label %for.end22.unr-lcssa, label %for.cond9.preheader.lr.ph.new
for.cond9.preheader.lr.ph.new: ; preds = %for.cond9.preheader.lr.ph
%unroll_iter = and i64 %wide.trip.count86, 4294967294
br label %for.cond9.preheader
for.body4: ; preds = %for.body, %for.body4
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 0, %for.body ]
%arrayidx = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %indvars.iv
%call5 = 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
%cmp3 = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp3, label %for.body4, label %for.cond6.preheader, !llvm.loop !9
for.cond9.preheader: ; preds = %for.inc20.1, %for.cond9.preheader.lr.ph.new
%indvars.iv83 = phi i64 [ 0, %for.cond9.preheader.lr.ph.new ], [ %indvars.iv.next84.1, %for.inc20.1 ]
%check.070 = phi i32 [ 0, %for.cond9.preheader.lr.ph.new ], [ %check.1.ph.1, %for.inc20.1 ]
%niter = phi i64 [ 0, %for.cond9.preheader.lr.ph.new ], [ %niter.next.1, %for.inc20.1 ]
%cmp1064.not = icmp eq i64 %indvars.iv83, 0
br i1 %cmp1064.not, label %for.inc20, label %for.body11.lr.ph
for.body11.lr.ph: ; preds = %for.cond9.preheader
%arrayidx13 = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %indvars.iv83
%6 = load i32, ptr %arrayidx13, align 8, !tbaa !5
br label %for.body11
for.cond9: ; preds = %for.body11
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%exitcond.not = icmp eq i64 %indvars.iv.next81, %indvars.iv83
br i1 %exitcond.not, label %for.inc20, label %for.body11, !llvm.loop !11
for.body11: ; preds = %for.body11.lr.ph, %for.cond9
%indvars.iv80 = phi i64 [ 0, %for.body11.lr.ph ], [ %indvars.iv.next81, %for.cond9 ]
%arrayidx15 = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %indvars.iv80
%7 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%add = add nsw i32 %7, %6
%cmp16.not = icmp sgt i32 %add, %2
br i1 %cmp16.not, label %for.cond9, label %for.inc20
for.inc20: ; preds = %for.cond9, %for.body11, %for.cond9.preheader
%check.1 = phi i32 [ %check.070, %for.cond9.preheader ], [ 1, %for.body11 ], [ %check.070, %for.cond9 ]
%indvars.iv.next84 = or i64 %indvars.iv83, 1
%arrayidx13.1 = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %indvars.iv.next84
%8 = load i32, ptr %arrayidx13.1, align 4, !tbaa !5
br label %for.body11.1
for.body11.1: ; preds = %for.cond9.1, %for.inc20
%indvars.iv80.1 = phi i64 [ 0, %for.inc20 ], [ %indvars.iv.next81.1, %for.cond9.1 ]
%arrayidx15.1 = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %indvars.iv80.1
%9 = load i32, ptr %arrayidx15.1, align 4, !tbaa !5
%add.1 = add nsw i32 %9, %8
%cmp16.not.1 = icmp sgt i32 %add.1, %2
br i1 %cmp16.not.1, label %for.cond9.1, label %for.inc20.1
for.cond9.1: ; preds = %for.body11.1
%indvars.iv.next81.1 = add nuw nsw i64 %indvars.iv80.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next81.1, %indvars.iv.next84
br i1 %exitcond.not.1, label %for.inc20.1, label %for.body11.1, !llvm.loop !11
for.inc20.1: ; preds = %for.body11.1, %for.cond9.1
%check.1.ph.1 = phi i32 [ 1, %for.body11.1 ], [ %check.1, %for.cond9.1 ]
%indvars.iv.next84.1 = add nuw nsw i64 %indvars.iv83, 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.end22.unr-lcssa, label %for.cond9.preheader, !llvm.loop !12
for.end22.unr-lcssa: ; preds = %for.inc20.1, %for.cond9.preheader.lr.ph
%check.1.lcssa.ph = phi i32 [ undef, %for.cond9.preheader.lr.ph ], [ %check.1.ph.1, %for.inc20.1 ]
%indvars.iv83.unr = phi i64 [ 0, %for.cond9.preheader.lr.ph ], [ %indvars.iv.next84.1, %for.inc20.1 ]
%check.070.unr = phi i32 [ 0, %for.cond9.preheader.lr.ph ], [ %check.1.ph.1, %for.inc20.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end22, label %for.cond9.preheader.epil
for.cond9.preheader.epil: ; preds = %for.end22.unr-lcssa
%cmp1064.not.epil = icmp eq i64 %indvars.iv83.unr, 0
br i1 %cmp1064.not.epil, label %for.end22, label %for.body11.lr.ph.epil
for.body11.lr.ph.epil: ; preds = %for.cond9.preheader.epil
%arrayidx13.epil = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %indvars.iv83.unr
%10 = load i32, ptr %arrayidx13.epil, align 4, !tbaa !5
br label %for.body11.epil
for.body11.epil: ; preds = %for.cond9.epil, %for.body11.lr.ph.epil
%indvars.iv80.epil = phi i64 [ 0, %for.body11.lr.ph.epil ], [ %indvars.iv.next81.epil, %for.cond9.epil ]
%arrayidx15.epil = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %indvars.iv80.epil
%11 = load i32, ptr %arrayidx15.epil, align 4, !tbaa !5
%add.epil = add nsw i32 %11, %10
%cmp16.not.epil = icmp sgt i32 %add.epil, %2
br i1 %cmp16.not.epil, label %for.cond9.epil, label %for.end22
for.cond9.epil: ; preds = %for.body11.epil
%indvars.iv.next81.epil = add nuw nsw i64 %indvars.iv80.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next81.epil, %indvars.iv83.unr
br i1 %exitcond.not.epil, label %for.end22, label %for.body11.epil, !llvm.loop !11
for.end22: ; preds = %for.cond9.preheader.epil, %for.cond9.epil, %for.body11.epil, %for.end22.unr-lcssa
%check.1.lcssa = phi i32 [ %check.1.lcssa.ph, %for.end22.unr-lcssa ], [ %check.070.unr, %for.cond9.preheader.epil ], [ 1, %for.body11.epil ], [ %check.070.unr, %for.cond9.epil ]
%cmp23 = icmp ne i32 %check.1.lcssa, 0
%brmerge = or i1 %cmp23, %cmp768
%str.mux = select i1 %cmp23, ptr @str.5, ptr @str.5
br i1 %brmerge, label %for.inc44, label %for.body27.lr.ph
for.body27.lr.ph: ; preds = %for.end22
%12 = load i32, ptr %d, align 4, !tbaa !5
%wide.trip.count = zext i32 %4 to i64
%min.iters.check = icmp ult i32 %4, 8
br i1 %min.iters.check, label %for.body27.preheader, label %vector.ph
vector.ph: ; preds = %for.body27.lr.ph
%n.vec = and i64 %wide.trip.count86, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %12, 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> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%vec.phi107 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %18, %vector.body ]
%13 = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %13, align 16, !tbaa !5
%14 = getelementptr inbounds i32, ptr %13, i64 4
%wide.load108 = load <4 x i32>, ptr %14, align 16, !tbaa !5
%15 = icmp sgt <4 x i32> %wide.load, %broadcast.splat
%16 = icmp sgt <4 x i32> %wide.load108, %broadcast.splat
%17 = select <4 x i1> %15, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi
%18 = select <4 x i1> %16, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi107
%index.next = add nuw i64 %index, 8
%19 = icmp eq i64 %index.next, %n.vec
br i1 %19, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%rdx.select.cmp.not = icmp ne <4 x i32> %17, zeroinitializer
%rdx.select.cmp109111 = icmp ne <4 x i32> %18, zeroinitializer
%rdx.select.cmp109 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp109111
%20 = bitcast <4 x i1> %rdx.select.cmp109 to i4
%.not = icmp ne i4 %20, 0
%rdx.select110 = zext i1 %.not to i32
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count86
br i1 %cmp.n, label %for.end35, label %for.body27.preheader
for.body27.preheader: ; preds = %for.body27.lr.ph, %middle.block
%indvars.iv88.ph = phi i64 [ 0, %for.body27.lr.ph ], [ %n.vec, %middle.block ]
%check.274.ph = phi i32 [ 0, %for.body27.lr.ph ], [ %rdx.select110, %middle.block ]
br label %for.body27
for.body27: ; preds = %for.body27.preheader, %for.body27
%indvars.iv88 = phi i64 [ %indvars.iv.next89, %for.body27 ], [ %indvars.iv88.ph, %for.body27.preheader ]
%check.274 = phi i32 [ %spec.select, %for.body27 ], [ %check.274.ph, %for.body27.preheader ]
%arrayidx29 = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %indvars.iv88
%21 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %21, %12
%spec.select = select i1 %cmp30, i32 1, i32 %check.274
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%exitcond91.not = icmp eq i64 %indvars.iv.next89, %wide.trip.count
br i1 %exitcond91.not, label %for.end35, label %for.body27, !llvm.loop !16
for.end35: ; preds = %for.body27, %middle.block
%spec.select.lcssa = phi i32 [ %rdx.select110, %middle.block ], [ %spec.select, %for.body27 ]
%cmp36 = icmp eq i32 %spec.select.lcssa, 0
%spec.select106 = select i1 %cmp36, ptr @str.5, ptr @str.4
br label %for.inc44
for.inc44: ; preds = %for.end35, %for.end22, %for.body, %for.cond6.preheader
%str.sink = phi ptr [ @str.5, %for.cond6.preheader ], [ @str.5, %for.body ], [ %str.mux, %for.end22 ], [ %spec.select106, %for.end35 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%inc45 = add nuw nsw i32 %i.077, 1
%22 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc45, %22
br i1 %cmp, label %for.body, label %for.end46, !llvm.loop !17
for.end46: ; preds = %for.inc44, %entry
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10, !15, !14}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
int main(void){
int sx,sy,tx,ty;
//sとtを2往復しなければならない
scanf("%d %d %d %d",&sx,&sy,&tx,&ty);
int i,j;
for(i=0;i<tx-sx;i++){
printf("R");
}
for(i=0;i<ty-sy;i++){
printf("U");
}
for(i=0;i<tx-sx;i++){
printf("L");
}
for(i=0;i<ty-sy;i++){
printf("D");
}
printf("D");
for(i=0;i<tx-sx+1;i++){
printf("R");
}
for(i=0;i<ty-sy+1;i++){
printf("U");
}
printf("L");
printf("U");
for(i=0;i<tx-sx+1;i++){
printf("L");
}
for(i=0;i<ty-sy+1;i++){
printf("D");
}
printf("R\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294253/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294253/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 = private unnamed_addr constant [2 x i8] c"R\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%sx = alloca i32, align 4
%sy = alloca i32, align 4
%tx = alloca i32, align 4
%ty = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sx) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sy) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tx) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ty) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sx, ptr noundef nonnull %sy, ptr noundef nonnull %tx, ptr noundef nonnull %ty)
%0 = load i32, ptr %tx, align 4, !tbaa !5
%1 = load i32, ptr %sx, align 4, !tbaa !5
%cmp91 = icmp sgt i32 %0, %1
br i1 %cmp91, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%2 = phi i32 [ %1, %entry ], [ %7, %for.body ]
%3 = phi i32 [ %0, %entry ], [ %6, %for.body ]
%4 = load i32, ptr %ty, align 4, !tbaa !5
%5 = load i32, ptr %sy, align 4, !tbaa !5
%cmp494 = icmp sgt i32 %4, %5
br i1 %cmp494, label %for.body5, label %for.cond10.preheader
for.body: ; preds = %entry, %for.body
%i.092 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%putchar89 = call i32 @putchar(i32 82)
%inc = add nuw nsw i32 %i.092, 1
%6 = load i32, ptr %tx, align 4, !tbaa !5
%7 = load i32, ptr %sx, align 4, !tbaa !5
%sub = sub nsw i32 %6, %7
%cmp = icmp slt i32 %inc, %sub
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond10.preheader.loopexit: ; preds = %for.body5
%.pre = load i32, ptr %tx, align 4, !tbaa !5
%.pre114 = load i32, ptr %sx, align 4, !tbaa !5
br label %for.cond10.preheader
for.cond10.preheader: ; preds = %for.cond10.preheader.loopexit, %for.cond2.preheader
%8 = phi i32 [ %13, %for.cond10.preheader.loopexit ], [ %5, %for.cond2.preheader ]
%9 = phi i32 [ %12, %for.cond10.preheader.loopexit ], [ %4, %for.cond2.preheader ]
%10 = phi i32 [ %.pre114, %for.cond10.preheader.loopexit ], [ %2, %for.cond2.preheader ]
%11 = phi i32 [ %.pre, %for.cond10.preheader.loopexit ], [ %3, %for.cond2.preheader ]
%cmp1297 = icmp sgt i32 %11, %10
br i1 %cmp1297, label %for.body13, label %for.cond18.preheader
for.body5: ; preds = %for.cond2.preheader, %for.body5
%i.195 = phi i32 [ %inc8, %for.body5 ], [ 0, %for.cond2.preheader ]
%putchar88 = call i32 @putchar(i32 85)
%inc8 = add nuw nsw i32 %i.195, 1
%12 = load i32, ptr %ty, align 4, !tbaa !5
%13 = load i32, ptr %sy, align 4, !tbaa !5
%sub3 = sub nsw i32 %12, %13
%cmp4 = icmp slt i32 %inc8, %sub3
br i1 %cmp4, label %for.body5, label %for.cond10.preheader.loopexit, !llvm.loop !11
for.cond18.preheader.loopexit: ; preds = %for.body13
%.pre115 = load i32, ptr %ty, align 4, !tbaa !5
%.pre116 = load i32, ptr %sy, align 4, !tbaa !5
br label %for.cond18.preheader
for.cond18.preheader: ; preds = %for.cond18.preheader.loopexit, %for.cond10.preheader
%14 = phi i32 [ %.pre116, %for.cond18.preheader.loopexit ], [ %8, %for.cond10.preheader ]
%15 = phi i32 [ %.pre115, %for.cond18.preheader.loopexit ], [ %9, %for.cond10.preheader ]
%cmp20100 = icmp sgt i32 %15, %14
br i1 %cmp20100, label %for.body21, label %for.end25
for.body13: ; preds = %for.cond10.preheader, %for.body13
%i.298 = phi i32 [ %inc16, %for.body13 ], [ 0, %for.cond10.preheader ]
%putchar87 = call i32 @putchar(i32 76)
%inc16 = add nuw nsw i32 %i.298, 1
%16 = load i32, ptr %tx, align 4, !tbaa !5
%17 = load i32, ptr %sx, align 4, !tbaa !5
%sub11 = sub nsw i32 %16, %17
%cmp12 = icmp slt i32 %inc16, %sub11
br i1 %cmp12, label %for.body13, label %for.cond18.preheader.loopexit, !llvm.loop !12
for.body21: ; preds = %for.cond18.preheader, %for.body21
%i.3101 = phi i32 [ %inc24, %for.body21 ], [ 0, %for.cond18.preheader ]
%putchar86 = call i32 @putchar(i32 68)
%inc24 = add nuw nsw i32 %i.3101, 1
%18 = load i32, ptr %ty, align 4, !tbaa !5
%19 = load i32, ptr %sy, align 4, !tbaa !5
%sub19 = sub nsw i32 %18, %19
%cmp20 = icmp slt i32 %inc24, %sub19
br i1 %cmp20, label %for.body21, label %for.end25, !llvm.loop !13
for.end25: ; preds = %for.body21, %for.cond18.preheader
%putchar = call i32 @putchar(i32 68)
%20 = load i32, ptr %tx, align 4, !tbaa !5
%21 = load i32, ptr %sx, align 4, !tbaa !5
%cmp29.not103 = icmp slt i32 %20, %21
br i1 %cmp29.not103, label %for.cond35.preheader, label %for.body30
for.cond35.preheader: ; preds = %for.body30, %for.end25
%22 = load i32, ptr %ty, align 4, !tbaa !5
%23 = load i32, ptr %sy, align 4, !tbaa !5
%cmp38.not106 = icmp slt i32 %22, %23
br i1 %cmp38.not106, label %for.end43, label %for.body39
for.body30: ; preds = %for.end25, %for.body30
%i.4104 = phi i32 [ %inc33, %for.body30 ], [ 0, %for.end25 ]
%putchar85 = call i32 @putchar(i32 82)
%inc33 = add nuw nsw i32 %i.4104, 1
%24 = load i32, ptr %tx, align 4, !tbaa !5
%25 = load i32, ptr %sx, align 4, !tbaa !5
%sub28 = sub nsw i32 %24, %25
%cmp29.not.not = icmp slt i32 %i.4104, %sub28
br i1 %cmp29.not.not, label %for.body30, label %for.cond35.preheader, !llvm.loop !14
for.body39: ; preds = %for.cond35.preheader, %for.body39
%i.5107 = phi i32 [ %inc42, %for.body39 ], [ 0, %for.cond35.preheader ]
%putchar84 = call i32 @putchar(i32 85)
%inc42 = add nuw nsw i32 %i.5107, 1
%26 = load i32, ptr %ty, align 4, !tbaa !5
%27 = load i32, ptr %sy, align 4, !tbaa !5
%sub36 = sub nsw i32 %26, %27
%cmp38.not.not = icmp slt i32 %i.5107, %sub36
br i1 %cmp38.not.not, label %for.body39, label %for.end43, !llvm.loop !15
for.end43: ; preds = %for.body39, %for.cond35.preheader
%putchar80 = call i32 @putchar(i32 76)
%putchar81 = call i32 @putchar(i32 85)
%28 = load i32, ptr %tx, align 4, !tbaa !5
%29 = load i32, ptr %sx, align 4, !tbaa !5
%cmp49.not109 = icmp slt i32 %28, %29
br i1 %cmp49.not109, label %for.cond55.preheader, label %for.body50
for.cond55.preheader: ; preds = %for.body50, %for.end43
%30 = load i32, ptr %ty, align 4, !tbaa !5
%31 = load i32, ptr %sy, align 4, !tbaa !5
%cmp58.not112 = icmp slt i32 %30, %31
br i1 %cmp58.not112, label %for.end63, label %for.body59
for.body50: ; preds = %for.end43, %for.body50
%i.6110 = phi i32 [ %inc53, %for.body50 ], [ 0, %for.end43 ]
%putchar83 = call i32 @putchar(i32 76)
%inc53 = add nuw nsw i32 %i.6110, 1
%32 = load i32, ptr %tx, align 4, !tbaa !5
%33 = load i32, ptr %sx, align 4, !tbaa !5
%sub47 = sub nsw i32 %32, %33
%cmp49.not.not = icmp slt i32 %i.6110, %sub47
br i1 %cmp49.not.not, label %for.body50, label %for.cond55.preheader, !llvm.loop !16
for.body59: ; preds = %for.cond55.preheader, %for.body59
%i.7113 = phi i32 [ %inc62, %for.body59 ], [ 0, %for.cond55.preheader ]
%putchar82 = call i32 @putchar(i32 68)
%inc62 = add nuw nsw i32 %i.7113, 1
%34 = load i32, ptr %ty, align 4, !tbaa !5
%35 = load i32, ptr %sy, align 4, !tbaa !5
%sub56 = sub nsw i32 %34, %35
%cmp58.not.not = icmp slt i32 %i.7113, %sub56
br i1 %cmp58.not.not, label %for.body59, label %for.end63, !llvm.loop !17
for.end63: ; preds = %for.body59, %for.cond55.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ty) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tx) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sy) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sx) #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 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!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()
{
int n,k,h[100000];
int i,c=0;
scanf("%d %d",&n,&k);
for(i=0;i<n;i++){
scanf("%d",&h[i]);
}
for(i=0;i<n;i++){
if(k<=h[i]){
c++;
}
}
printf("%d\n",c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294297/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294297/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%h = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %h) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %for.end11
for.cond2.preheader: ; preds = %for.body
%cmp321 = icmp sgt i32 %12, 0
br i1 %cmp321, label %for.body4.lr.ph, label %for.end11
for.body4.lr.ph: ; preds = %for.cond2.preheader
%1 = load i32, ptr %k, align 4, !tbaa !5
%wide.trip.count = zext i32 %12 to i64
%min.iters.check = icmp ult i32 %12, 8
br i1 %min.iters.check, label %for.body4.preheader, label %vector.ph
vector.ph: ; preds = %for.body4.lr.ph
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %1, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%vec.phi32 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%2 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
%wide.load33 = load <4 x i32>, ptr %3, align 16, !tbaa !5
%4 = icmp sle <4 x i32> %broadcast.splat, %wide.load
%5 = icmp sle <4 x i32> %broadcast.splat, %wide.load33
%6 = zext <4 x i1> %4 to <4 x i32>
%7 = zext <4 x i1> %5 to <4 x i32>
%8 = add <4 x i32> %vec.phi, %6
%9 = add <4 x i32> %vec.phi32, %7
%index.next = add nuw i64 %index, 8
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %9, %8
%11 = 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.end11, label %for.body4.preheader
for.body4.preheader: ; preds = %for.body4.lr.ph, %middle.block
%indvars.iv27.ph = phi i64 [ 0, %for.body4.lr.ph ], [ %n.vec, %middle.block ]
%c.023.ph = phi i32 [ 0, %for.body4.lr.ph ], [ %11, %middle.block ]
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp = icmp slt i64 %indvars.iv.next, %13
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !13
for.body4: ; preds = %for.body4.preheader, %for.body4
%indvars.iv27 = phi i64 [ %indvars.iv.next28, %for.body4 ], [ %indvars.iv27.ph, %for.body4.preheader ]
%c.023 = phi i32 [ %spec.select, %for.body4 ], [ %c.023.ph, %for.body4.preheader ]
%arrayidx6 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv27
%14 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7.not = icmp sle i32 %1, %14
%inc8 = zext i1 %cmp7.not to i32
%spec.select = add nuw nsw i32 %c.023, %inc8
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
%exitcond.not = icmp eq i64 %indvars.iv.next28, %wide.trip.count
br i1 %exitcond.not, label %for.end11, label %for.body4, !llvm.loop !14
for.end11: ; preds = %for.body4, %middle.block, %entry, %for.cond2.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %11, %middle.block ], [ %spec.select, %for.body4 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %h) #4
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
}
; 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.vector.reduce.add.v4i32(<4 x 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, !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, !12, !11}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int tc, n, d;
int c;
int s[105];
scanf("%d", &tc);
for (int i=0; i<tc; i++)
{
int allS = 1;
int noneedb = 0;
scanf("%d %d", &n, &d);
for (int j=0; j<n; j++)
{
scanf("%d", &s[j]);
}
for (int j=0; j<n; j++)
{
for (int k=j+1; k<n; k++)
{
if (s[j] + s[k] <= d)
{
noneedb = 1;
}
}
if (s[j]>d)
{
allS = 0;
}
}
if (allS==1) noneedb=1;
if (noneedb==0)
{
printf("NO\n");
}
else if (noneedb==1)
{
printf("YES\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_29434/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_29434/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 = 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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%tc = alloca i32, align 4
%n = alloca i32, align 4
%d = alloca i32, align 4
%s = alloca [105 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tc) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tc)
%0 = load i32, ptr %tc, align 4, !tbaa !5
%cmp73 = icmp sgt i32 %0, 0
br i1 %cmp73, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %if.end43, %entry
call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tc) #4
ret i32 0
for.body: ; preds = %entry, %if.end43
%i.074 = phi i32 [ %inc45, %if.end43 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %d)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp361 = icmp sgt i32 %1, 0
br i1 %cmp361, label %for.body5, label %if.then40
for.cond8.preheader: ; preds = %for.body5
%cmp967 = icmp sgt i32 %4, 0
br i1 %cmp967, label %for.body11.lr.ph, label %if.then40
for.body11.lr.ph: ; preds = %for.cond8.preheader
%2 = load i32, ptr %d, align 4
%3 = zext i32 %4 to i64
%wide.trip.count85 = zext i32 %4 to i64
%broadcast.splatinsert96 = insertelement <4 x i32> poison, i32 %2, i64 0
%broadcast.splat97 = shufflevector <4 x i32> %broadcast.splatinsert96, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.body11
for.body5: ; preds = %for.body, %for.body5
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body5 ], [ 0, %for.body ]
%arrayidx = getelementptr inbounds [105 x i32], ptr %s, i64 0, i64 %indvars.iv
%call6 = 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
%cmp3 = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp3, label %for.body5, label %for.cond8.preheader, !llvm.loop !9
for.cond.cleanup10: ; preds = %for.cond.cleanup14
%cmp33 = icmp ne i32 %spec.select58, 1
%cmp3660 = icmp eq i32 %noneedb.1.lcssa, 0
%cmp36 = select i1 %cmp33, i1 %cmp3660, i1 false
br i1 %cmp36, label %if.end43, label %if.then40
for.body11: ; preds = %for.body11.lr.ph, %for.cond.cleanup14
%indvars.iv82 = phi i64 [ 0, %for.body11.lr.ph ], [ %indvars.iv.next83, %for.cond.cleanup14 ]
%indvars.iv77 = phi i64 [ 1, %for.body11.lr.ph ], [ %indvars.iv.next78, %for.cond.cleanup14 ]
%6 = phi <2 x i32> [ <i32 1, i32 0>, %for.body11.lr.ph ], [ %23, %for.cond.cleanup14 ]
%7 = xor i64 %indvars.iv82, -1
%8 = add nsw i64 %7, %wide.trip.count85
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%cmp1363 = icmp ult i64 %indvars.iv.next83, %3
%arrayidx17 = getelementptr inbounds [105 x i32], ptr %s, i64 0, i64 %indvars.iv82
%9 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%10 = extractelement <2 x i32> %6, i64 1
br i1 %cmp1363, label %for.body15.preheader, label %for.cond.cleanup14
for.body15.preheader: ; preds = %for.body11
%min.iters.check = icmp ult i64 %8, 8
br i1 %min.iters.check, label %for.body15.preheader103, label %vector.ph
vector.ph: ; preds = %for.body15.preheader
%n.vec = and i64 %8, -8
%ind.end = add i64 %indvars.iv77, %n.vec
%minmax.ident.splat = shufflevector <2 x i32> %6, <2 x i32> poison, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %9, 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> [ %minmax.ident.splat, %vector.ph ], [ %17, %vector.body ]
%vec.phi94 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %18, %vector.body ]
%offset.idx = add i64 %indvars.iv77, %index
%11 = getelementptr inbounds [105 x i32], ptr %s, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %11, align 4, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 4
%wide.load95 = load <4 x i32>, ptr %12, align 4, !tbaa !5
%13 = add nsw <4 x i32> %wide.load, %broadcast.splat
%14 = add nsw <4 x i32> %wide.load95, %broadcast.splat
%15 = icmp sgt <4 x i32> %13, %broadcast.splat97
%16 = icmp sgt <4 x i32> %14, %broadcast.splat97
%17 = select <4 x i1> %15, <4 x i32> %vec.phi, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%18 = select <4 x i1> %16, <4 x i32> %vec.phi94, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%index.next = add nuw i64 %index, 8
%19 = icmp eq i64 %index.next, %n.vec
br i1 %19, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%rdx.select.cmp.not = icmp ne <4 x i32> %17, %minmax.ident.splat
%rdx.select.cmp100102 = icmp ne <4 x i32> %18, %minmax.ident.splat
%rdx.select.cmp100 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp100102
%20 = bitcast <4 x i1> %rdx.select.cmp100 to i4
%.not = icmp eq i4 %20, 0
%rdx.select101 = select i1 %.not, i32 %10, i32 1
%cmp.n = icmp eq i64 %8, %n.vec
br i1 %cmp.n, label %for.cond.cleanup14, label %for.body15.preheader103
for.body15.preheader103: ; preds = %for.body15.preheader, %middle.block
%indvars.iv79.ph = phi i64 [ %indvars.iv77, %for.body15.preheader ], [ %ind.end, %middle.block ]
%noneedb.164.ph = phi i32 [ %10, %for.body15.preheader ], [ %rdx.select101, %middle.block ]
br label %for.body15
for.cond.cleanup14: ; preds = %for.body15, %middle.block, %for.body11
%noneedb.1.lcssa = phi i32 [ %10, %for.body11 ], [ %rdx.select101, %middle.block ], [ %spec.select59, %for.body15 ]
%cmp27 = icmp sgt i32 %9, %2
%21 = extractelement <2 x i32> %6, i64 0
%spec.select58 = select i1 %cmp27, i32 0, i32 %21
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%exitcond86.not = icmp eq i64 %indvars.iv.next83, %wide.trip.count85
%22 = insertelement <2 x i32> poison, i32 %spec.select58, i64 0
%23 = insertelement <2 x i32> %22, i32 %noneedb.1.lcssa, i64 1
br i1 %exitcond86.not, label %for.cond.cleanup10, label %for.body11, !llvm.loop !14
for.body15: ; preds = %for.body15.preheader103, %for.body15
%indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.body15 ], [ %indvars.iv79.ph, %for.body15.preheader103 ]
%noneedb.164 = phi i32 [ %spec.select59, %for.body15 ], [ %noneedb.164.ph, %for.body15.preheader103 ]
%arrayidx19 = getelementptr inbounds [105 x i32], ptr %s, i64 0, i64 %indvars.iv79
%24 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%add20 = add nsw i32 %24, %9
%cmp21.not = icmp sgt i32 %add20, %2
%spec.select59 = select i1 %cmp21.not, i32 %noneedb.164, i32 1
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%exitcond.not = icmp eq i64 %indvars.iv.next80, %wide.trip.count85
br i1 %exitcond.not, label %for.cond.cleanup14, label %for.body15, !llvm.loop !15
if.then40: ; preds = %for.body, %for.cond8.preheader, %for.cond.cleanup10
br label %if.end43
if.end43: ; preds = %for.cond.cleanup10, %if.then40
%str.sink = phi ptr [ @str, %if.then40 ], [ @str.4, %for.cond.cleanup10 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%inc45 = add nuw nsw i32 %i.074, 1
%25 = load i32, ptr %tc, align 4, !tbaa !5
%cmp = icmp slt i32 %inc45, %25
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !16
}
; 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 = 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}
|
#include<stdio.h>
int main(){
int n,k;
scanf("%d%d",&n,&k);
int h[n];
for(int i=0;i<n;i++){
scanf("%d",&h[i]);
}
int count=0;
for(int i=0;i<n;i++){
if(h[i]>=k){
count++;
}
}
printf("%d",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294390/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294390/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
%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
%cmp20 = icmp sgt i32 %3, 0
br i1 %cmp20, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp422 = icmp sgt i32 %15, 0
br i1 %cmp422, label %for.body6.lr.ph, label %for.cond.cleanup5
for.body6.lr.ph: ; preds = %for.cond3.preheader
%4 = load i32, ptr %k, align 4, !tbaa !5
%wide.trip.count = zext i32 %15 to i64
%min.iters.check = icmp ult i32 %15, 8
br i1 %min.iters.check, label %for.body6.preheader, label %vector.ph
vector.ph: ; preds = %for.body6.lr.ph
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %4, 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> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%vec.phi33 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%5 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load34 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = icmp sge <4 x i32> %wide.load, %broadcast.splat
%8 = icmp sge <4 x i32> %wide.load34, %broadcast.splat
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = zext <4 x i1> %8 to <4 x i32>
%11 = add <4 x i32> %vec.phi, %9
%12 = add <4 x i32> %vec.phi33, %10
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %12, %11
%14 = 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.cond.cleanup5, label %for.body6.preheader
for.body6.preheader: ; preds = %for.body6.lr.ph, %middle.block
%indvars.iv28.ph = phi i64 [ 0, %for.body6.lr.ph ], [ %n.vec, %middle.block ]
%count.023.ph = phi i32 [ 0, %for.body6.lr.ph ], [ %14, %middle.block ]
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp = icmp slt i64 %indvars.iv.next, %16
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !13
for.cond.cleanup5: ; preds = %for.body6, %middle.block, %entry, %for.cond3.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %14, %middle.block ], [ %spec.select, %for.body6 ]
%call14 = 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 %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body6: ; preds = %for.body6.preheader, %for.body6
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.body6 ], [ %indvars.iv28.ph, %for.body6.preheader ]
%count.023 = phi i32 [ %spec.select, %for.body6 ], [ %count.023.ph, %for.body6.preheader ]
%arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv28
%17 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not = icmp sge i32 %17, %4
%inc10 = zext i1 %cmp9.not to i32
%spec.select = add nuw nsw i32 %count.023, %inc10
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
%exitcond.not = icmp eq i64 %indvars.iv.next29, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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 = 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, !12, !11}
|
#include<stdio.h>
int main()
{
int n,k,h,b,s;
s = 0;
scanf("%d %d",&n,&k);
for(h = 0;h < n;h++)
{
scanf("%d",&b);
if(b >= k)
{
s = s + 1;
}
}
printf("%d",s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294433/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294433/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:
%n = alloca i32, align 4
%k = alloca i32, align 4
%b = 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #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
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%s.08 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%h.07 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b)
%1 = load i32, ptr %b, align 4, !tbaa !5
%2 = load i32, ptr %k, align 4, !tbaa !5
%cmp2.not = icmp sge i32 %1, %2
%add = zext i1 %cmp2.not to i32
%spec.select = add nuw nsw i32 %s.08, %add
%inc = add nuw nsw i32 %h.07, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%s.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %s.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
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
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
int main() {
int N, K;
scanf("%d %d", &N, &K);
int i, h, count=0;
for (i=0; i<N; i++) {
scanf("%d", &h);
if (h >= K) {
count++;
}
}
printf("%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294491/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294491/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
%h = 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)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %0, 0
br i1 %cmp7, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%count.09 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%i.08 = phi i32 [ %inc3, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%1 = load i32, ptr %h, align 4, !tbaa !5
%2 = load i32, ptr %K, align 4, !tbaa !5
%cmp2.not = icmp sge i32 %1, %2
%inc = zext i1 %cmp2.not to i32
%spec.select = add nuw nsw i32 %count.09, %inc
%inc3 = add nuw nsw i32 %i.08, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc3, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
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
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int N,K,i;
int h[100000];
int safe = 0;
scanf("%d %d",&N,&K);
for(i = 0 ; i < N ; i++){
scanf("%d",&h[i]);
}
for(i = 0 ; i < N ; i++){
if(h[i] >= K){
safe++;
}
}
printf("%d\n",safe);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294534/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294534/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
%h = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %h) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %for.end11
for.cond2.preheader: ; preds = %for.body
%cmp321 = icmp sgt i32 %12, 0
br i1 %cmp321, label %for.body4.lr.ph, label %for.end11
for.body4.lr.ph: ; preds = %for.cond2.preheader
%1 = load i32, ptr %K, align 4, !tbaa !5
%wide.trip.count = zext i32 %12 to i64
%min.iters.check = icmp ult i32 %12, 8
br i1 %min.iters.check, label %for.body4.preheader, label %vector.ph
vector.ph: ; preds = %for.body4.lr.ph
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %1, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%vec.phi32 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%2 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
%wide.load33 = load <4 x i32>, ptr %3, align 16, !tbaa !5
%4 = icmp sge <4 x i32> %wide.load, %broadcast.splat
%5 = icmp sge <4 x i32> %wide.load33, %broadcast.splat
%6 = zext <4 x i1> %4 to <4 x i32>
%7 = zext <4 x i1> %5 to <4 x i32>
%8 = add <4 x i32> %vec.phi, %6
%9 = add <4 x i32> %vec.phi32, %7
%index.next = add nuw i64 %index, 8
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %9, %8
%11 = 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.end11, label %for.body4.preheader
for.body4.preheader: ; preds = %for.body4.lr.ph, %middle.block
%indvars.iv27.ph = phi i64 [ 0, %for.body4.lr.ph ], [ %n.vec, %middle.block ]
%safe.023.ph = phi i32 [ 0, %for.body4.lr.ph ], [ %11, %middle.block ]
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%12 = load i32, ptr %N, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp = icmp slt i64 %indvars.iv.next, %13
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !13
for.body4: ; preds = %for.body4.preheader, %for.body4
%indvars.iv27 = phi i64 [ %indvars.iv.next28, %for.body4 ], [ %indvars.iv27.ph, %for.body4.preheader ]
%safe.023 = phi i32 [ %spec.select, %for.body4 ], [ %safe.023.ph, %for.body4.preheader ]
%arrayidx6 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv27
%14 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7.not = icmp sge i32 %14, %1
%inc8 = zext i1 %cmp7.not to i32
%spec.select = add nuw nsw i32 %safe.023, %inc8
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
%exitcond.not = icmp eq i64 %indvars.iv.next28, %wide.trip.count
br i1 %exitcond.not, label %for.end11, label %for.body4, !llvm.loop !14
for.end11: ; preds = %for.body4, %middle.block, %entry, %for.cond2.preheader
%safe.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %11, %middle.block ], [ %spec.select, %for.body4 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %safe.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %h) #4
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
}
; 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.vector.reduce.add.v4i32(<4 x 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, !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, !12, !11}
|
#include <stdio.h>
int main(){
int N=0;
int K=0;
int count=0;
scanf("%d",&N);
scanf("%d",&K);
int h[N];
for(int i=0;i<N;i++){
scanf("%d",&h[i]);
}
for(int i=0;i<N;i++){
if(K<=h[i]){
count = count +1;
}
}
printf("%d",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294578/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294578/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
store i32 0, ptr %N, align 4, !tbaa !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)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, 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
%cmp20 = icmp sgt i32 %3, 0
br i1 %cmp20, label %for.body, label %for.cond.cleanup6
for.cond4.preheader: ; preds = %for.body
%cmp522 = icmp sgt i32 %15, 0
br i1 %cmp522, label %for.body7.lr.ph, label %for.cond.cleanup6
for.body7.lr.ph: ; preds = %for.cond4.preheader
%4 = load i32, ptr %K, align 4, !tbaa !5
%wide.trip.count = zext i32 %15 to i64
%min.iters.check = icmp ult i32 %15, 8
br i1 %min.iters.check, label %for.body7.preheader, label %vector.ph
vector.ph: ; preds = %for.body7.lr.ph
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %4, 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> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%vec.phi33 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%5 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load34 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = icmp sle <4 x i32> %broadcast.splat, %wide.load
%8 = icmp sle <4 x i32> %broadcast.splat, %wide.load34
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = zext <4 x i1> %8 to <4 x i32>
%11 = add <4 x i32> %vec.phi, %9
%12 = add <4 x i32> %vec.phi33, %10
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %12, %11
%14 = 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.cond.cleanup6, label %for.body7.preheader
for.body7.preheader: ; preds = %for.body7.lr.ph, %middle.block
%indvars.iv28.ph = phi i64 [ 0, %for.body7.lr.ph ], [ %n.vec, %middle.block ]
%count.023.ph = phi i32 [ 0, %for.body7.lr.ph ], [ %14, %middle.block ]
br label %for.body7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%15 = load i32, ptr %N, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp = icmp slt i64 %indvars.iv.next, %16
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !13
for.cond.cleanup6: ; preds = %for.body7, %middle.block, %entry, %for.cond4.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond4.preheader ], [ 0, %entry ], [ %14, %middle.block ], [ %spec.select, %for.body7 ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %count.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
for.body7: ; preds = %for.body7.preheader, %for.body7
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.body7 ], [ %indvars.iv28.ph, %for.body7.preheader ]
%count.023 = phi i32 [ %spec.select, %for.body7 ], [ %count.023.ph, %for.body7.preheader ]
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv28
%17 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10.not = icmp sle i32 %4, %17
%add = zext i1 %cmp10.not to i32
%spec.select = add nuw nsw i32 %count.023, %add
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
%exitcond.not = icmp eq i64 %indvars.iv.next29, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup6, label %for.body7, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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 = 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, !12, !11}
|
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
int main(void) {
int n, k;
scanf("%d %d", &n, &k);
int i,h,count = 0;
for(i = 0; i<n; i++) {
scanf("%d", &h);
if (h >= k) count++;
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294628/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294628/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @acs(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 @des(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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_char(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !9
%conv = sext i8 %0 to i32
%1 = load i8, ptr %b, align 1, !tbaa !9
%conv1 = sext i8 %1 to i32
%sub = sub nsw i32 %conv, %conv1
ret i32 %sub
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @cmp_str(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr %a, align 8, !tbaa !10
%1 = load ptr, ptr %b, align 8, !tbaa !10
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #6
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%h = 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 %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 4, ptr nonnull %h) #7
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %0, 0
br i1 %cmp7, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%count.09 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%i.08 = phi i32 [ %inc3, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%1 = load i32, ptr %h, align 4, !tbaa !5
%2 = load i32, ptr %k, align 4, !tbaa !5
%cmp2.not = icmp sge i32 %1, %2
%inc = zext i1 %cmp2.not to i32
%spec.select = add nuw nsw i32 %count.09, %inc
%inc3 = add nuw nsw i32 %i.08, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc3, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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) #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
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 nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind willreturn memory(read) }
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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void) {
int asumikana = 0;
int N;
int K;
int i;
if (scanf("%d%d", &N, &K) != 2) return 1;
for (i = 0; i < N; i++) {
int h;
if (scanf("%d", &h) != 1) return 1;
if (h >= K) asumikana++;
}
printf("%d\n", asumikana);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294671/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294671/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
%h = 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)
%cmp.not = icmp eq i32 %call, 2
br i1 %cmp.not, label %for.cond.preheader, label %cleanup11
for.cond.preheader: ; preds = %entry
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp122 = icmp sgt i32 %0, 0
br i1 %cmp122, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.inc
%i.024 = phi i32 [ %inc9, %for.inc ], [ 0, %for.cond.preheader ]
%asumikana.023 = phi i32 [ %spec.select, %for.inc ], [ 0, %for.cond.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%cmp3.not = icmp eq i32 %call2, 1
br i1 %cmp3.not, label %for.inc, label %cleanup
cleanup: ; preds = %for.body
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
br label %cleanup11
for.inc: ; preds = %for.body
%1 = load i32, ptr %h, align 4, !tbaa !5
%2 = load i32, ptr %K, align 4, !tbaa !5
%cmp6.not = icmp sge i32 %1, %2
%inc = zext i1 %cmp6.not to i32
%spec.select = add nuw nsw i32 %asumikana.023, %inc
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
%inc9 = add nuw nsw i32 %i.024, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc9, %3
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.cond.preheader
%asumikana.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %spec.select, %for.inc ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %asumikana.0.lcssa)
br label %cleanup11
cleanup11: ; preds = %cleanup, %entry, %for.end
%retval.2 = phi i32 [ 1, %cleanup ], [ 0, %for.end ], [ 1, %entry ]
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 %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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
static inline int IN(void)
{
int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
static inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}
const int Primes[168]=
{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,
97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,
227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,
367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,
509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,
661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,
829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997};
const char common[]="not coprime",disjoint[]="pairwise coprime",several[]="setwise coprime";
char esc[1000000];
static inline int Divide(int x)
{
if(!x){return 0;}
rep(i,168)
{
if(Primes[i]*Primes[i]>x)break;
if(x%Primes[i])continue;
if(esc[Primes[i]-1])return 0;
esc[Primes[i]-1]=1;
while(x%Primes[i]==0&&x)x/=Primes[i];
}
if(x>1){if(esc[x-1])return 0;esc[x-1]=1;}
return 1;
}
int main(void)
{
int N=IN(),A=0,f=0,g=0;
rep(i,N){A=IN();g=GCD(g,A);if(i&&g!=1){f=1;}if(f)continue;else{if(!Divide(A))f=1;}}
if(g>1)return puts(common),0;else{if(f)return puts(several),0;else return puts(disjoint),0;}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294714/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294714/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"
@Primes = dso_local local_unnamed_addr constant [168 x i32] [i32 2, i32 3, i32 5, i32 7, i32 11, i32 13, i32 17, i32 19, i32 23, i32 29, i32 31, i32 37, i32 41, i32 43, i32 47, i32 53, i32 59, i32 61, i32 67, i32 71, i32 73, i32 79, i32 83, i32 89, i32 97, i32 101, i32 103, i32 107, i32 109, i32 113, i32 127, i32 131, i32 137, i32 139, i32 149, i32 151, i32 157, i32 163, i32 167, i32 173, i32 179, i32 181, i32 191, i32 193, i32 197, i32 199, i32 211, i32 223, i32 227, i32 229, i32 233, i32 239, i32 241, i32 251, i32 257, i32 263, i32 269, i32 271, i32 277, i32 281, i32 283, i32 293, i32 307, i32 311, i32 313, i32 317, i32 331, i32 337, i32 347, i32 349, i32 353, i32 359, i32 367, i32 373, i32 379, i32 383, i32 389, i32 397, i32 401, i32 409, i32 419, i32 421, i32 431, i32 433, i32 439, i32 443, i32 449, i32 457, i32 461, i32 463, i32 467, i32 479, i32 487, i32 491, i32 499, i32 503, i32 509, i32 521, i32 523, i32 541, i32 547, i32 557, i32 563, i32 569, i32 571, i32 577, i32 587, i32 593, i32 599, i32 601, i32 607, i32 613, i32 617, i32 619, i32 631, i32 641, i32 643, i32 647, i32 653, i32 659, i32 661, i32 673, i32 677, i32 683, i32 691, i32 701, i32 709, i32 719, i32 727, i32 733, i32 739, i32 743, i32 751, i32 757, i32 761, i32 769, i32 773, i32 787, i32 797, i32 809, i32 811, i32 821, i32 823, i32 827, i32 829, i32 839, i32 853, i32 857, i32 859, i32 863, i32 877, i32 881, i32 883, i32 887, i32 907, i32 911, i32 919, i32 929, i32 937, i32 941, i32 947, i32 953, i32 967, i32 971, i32 977, i32 983, i32 991, i32 997], align 16
@common = dso_local constant [12 x i8] c"not coprime\00", align 1
@disjoint = dso_local constant [17 x i8] c"pairwise coprime\00", align 16
@several = dso_local constant [16 x i8] c"setwise coprime\00", align 16
@esc = dso_local local_unnamed_addr global [1000000 x i8] zeroinitializer, align 16
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.i = tail call i32 @getc(ptr noundef %0)
%1 = add i32 %call.i.i, -58
%2 = icmp ult i32 %1, -10
br i1 %2, label %while.body.i, label %while.body9.preheader.i
while.cond4.preheader.loopexit.i: ; preds = %while.body.i
%3 = icmp eq i32 %xor.i, 0
br label %while.body9.preheader.i
while.body9.preheader.i: ; preds = %while.cond4.preheader.loopexit.i, %entry
%f.0.lcssa.i = phi i1 [ true, %entry ], [ %3, %while.cond4.preheader.loopexit.i ]
%c.0.lcssa.i = phi i32 [ %call.i.i, %entry ], [ %call.i21.i, %while.cond4.preheader.loopexit.i ]
br label %while.body9.i
while.body.i: ; preds = %entry, %while.body.i
%c.024.i = phi i32 [ %call.i21.i, %while.body.i ], [ %call.i.i, %entry ]
%f.023.i = phi i32 [ %xor.i, %while.body.i ], [ 0, %entry ]
%cmp2.i = icmp eq i32 %c.024.i, 45
%conv.i = zext i1 %cmp2.i to i32
%xor.i = xor i32 %f.023.i, %conv.i
%4 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i21.i = tail call i32 @getc(ptr noundef %4)
%5 = add i32 %call.i21.i, -58
%6 = icmp ult i32 %5, -10
br i1 %6, label %while.body.i, label %while.cond4.preheader.loopexit.i, !llvm.loop !9
while.body9.i: ; preds = %while.body9.i, %while.body9.preheader.i
%c.127.i = phi i32 [ %call.i22.i, %while.body9.i ], [ %c.0.lcssa.i, %while.body9.preheader.i ]
%x.026.i = phi i32 [ %sub.i, %while.body9.i ], [ 0, %while.body9.preheader.i ]
%mul.i = mul nsw i32 %x.026.i, 10
%add.i = add nsw i32 %c.127.i, -48
%sub.i = add i32 %add.i, %mul.i
%7 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i22.i = tail call i32 @getc(ptr noundef %7)
%8 = add i32 %call.i22.i, -48
%9 = icmp ult i32 %8, 10
br i1 %9, label %while.body9.i, label %IN.exit, !llvm.loop !11
IN.exit: ; preds = %while.body9.i
%sub12.i = sub nsw i32 0, %sub.i
%cond.i = select i1 %f.0.lcssa.i, i32 %sub.i, i32 %sub12.i
%cmp73 = icmp sgt i32 %cond.i, 0
br i1 %cmp73, label %for.body, label %if.else18
for.cond.cleanup: ; preds = %for.inc
%10 = icmp sgt i32 %a.tr.lcssa.i63, 1
%brmerge = or i1 %10, %.lcssa.not
%common.mux = select i1 %10, ptr @common, ptr @several
br i1 %brmerge, label %cleanup, label %if.else18
for.body: ; preds = %IN.exit, %for.inc
%i.076 = phi i32 [ %inc, %for.inc ], [ 0, %IN.exit ]
%g.075 = phi i32 [ %a.tr.lcssa.i63, %for.inc ], [ 0, %IN.exit ]
%f.074 = phi i32 [ %f.2, %for.inc ], [ 0, %IN.exit ]
%11 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.i30 = tail call i32 @getc(ptr noundef %11)
%12 = add i32 %call.i.i30, -58
%13 = icmp ult i32 %12, -10
br i1 %13, label %while.body.i43, label %while.body9.preheader.i31
while.cond4.preheader.loopexit.i50: ; preds = %while.body.i43
%14 = icmp eq i32 %xor.i48, 0
br label %while.body9.preheader.i31
while.body9.preheader.i31: ; preds = %while.cond4.preheader.loopexit.i50, %for.body
%f.0.lcssa.i32 = phi i1 [ true, %for.body ], [ %14, %while.cond4.preheader.loopexit.i50 ]
%c.0.lcssa.i33 = phi i32 [ %call.i.i30, %for.body ], [ %call.i21.i49, %while.cond4.preheader.loopexit.i50 ]
br label %while.body9.i34
while.body.i43: ; preds = %for.body, %while.body.i43
%c.024.i44 = phi i32 [ %call.i21.i49, %while.body.i43 ], [ %call.i.i30, %for.body ]
%f.023.i45 = phi i32 [ %xor.i48, %while.body.i43 ], [ 0, %for.body ]
%cmp2.i46 = icmp eq i32 %c.024.i44, 45
%conv.i47 = zext i1 %cmp2.i46 to i32
%xor.i48 = xor i32 %f.023.i45, %conv.i47
%15 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i21.i49 = tail call i32 @getc(ptr noundef %15)
%16 = add i32 %call.i21.i49, -58
%17 = icmp ult i32 %16, -10
br i1 %17, label %while.body.i43, label %while.cond4.preheader.loopexit.i50, !llvm.loop !9
while.body9.i34: ; preds = %while.body9.i34, %while.body9.preheader.i31
%c.127.i35 = phi i32 [ %call.i22.i40, %while.body9.i34 ], [ %c.0.lcssa.i33, %while.body9.preheader.i31 ]
%x.026.i36 = phi i32 [ %sub.i39, %while.body9.i34 ], [ 0, %while.body9.preheader.i31 ]
%mul.i37 = mul nsw i32 %x.026.i36, 10
%add.i38 = add nsw i32 %c.127.i35, -48
%sub.i39 = add i32 %add.i38, %mul.i37
%18 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i22.i40 = tail call i32 @getc(ptr noundef %18)
%19 = add i32 %call.i22.i40, -48
%20 = icmp ult i32 %19, 10
br i1 %20, label %while.body9.i34, label %IN.exit51, !llvm.loop !11
IN.exit51: ; preds = %while.body9.i34
%sub12.i41 = sub nsw i32 0, %sub.i39
%cond.i42 = select i1 %f.0.lcssa.i32, i32 %sub.i39, i32 %sub12.i41
%tobool.not4.i.not = icmp eq i32 %sub.i39, 0
br i1 %tobool.not4.i.not, label %for.inc, label %cond.false.i
cond.false.i: ; preds = %IN.exit51, %cond.false.i
%b.tr6.i = phi i32 [ %rem.i, %cond.false.i ], [ %cond.i42, %IN.exit51 ]
%a.tr5.i = phi i32 [ %b.tr6.i, %cond.false.i ], [ %g.075, %IN.exit51 ]
%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 %GCD.exit, label %cond.false.i
GCD.exit: ; preds = %cond.false.i
%tobool = icmp eq i32 %i.076, 0
%cmp3 = icmp eq i32 %b.tr6.i, 1
%or.cond.not = or i1 %tobool, %cmp3
%tobool4.not72 = icmp eq i32 %f.074, 0
%tobool4.not = and i1 %tobool4.not72, %or.cond.not
br i1 %tobool4.not, label %for.body.i, label %for.inc
for.body.i: ; preds = %GCD.exit, %for.inc.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ 0, %GCD.exit ]
%x.addr.066.i = phi i32 [ %x.addr.2.i, %for.inc.i ], [ %cond.i42, %GCD.exit ]
%arrayidx.i = getelementptr inbounds [168 x i32], ptr @Primes, i64 0, i64 %indvars.iv.i
%21 = load i32, ptr %arrayidx.i, align 4, !tbaa !12
%mul.i53 = mul nsw i32 %21, %21
%cmp3.i = icmp sgt i32 %mul.i53, %x.addr.066.i
br i1 %cmp3.i, label %for.end.i, label %if.end5.i
if.end5.i: ; preds = %for.body.i
%rem.i54 = srem i32 %x.addr.066.i, %21
%tobool8.not.i = icmp eq i32 %rem.i54, 0
br i1 %tobool8.not.i, label %if.end10.i, label %for.inc.i
if.end10.i: ; preds = %if.end5.i
%sub.i55 = add nsw i32 %21, -1
%idxprom13.i = sext i32 %sub.i55 to i64
%arrayidx14.i = getelementptr inbounds [1000000 x i8], ptr @esc, i64 0, i64 %idxprom13.i
%22 = load i8, ptr %arrayidx14.i, align 1, !tbaa !14
%tobool15.not.i = icmp eq i8 %22, 0
br i1 %tobool15.not.i, label %if.end17.i, label %for.inc
if.end17.i: ; preds = %if.end10.i
store i8 1, ptr %arrayidx14.i, align 1, !tbaa !14
%tobool2764.not.i = icmp eq i32 %x.addr.066.i, 0
br i1 %tobool2764.not.i, label %for.inc.i, label %while.body.i56
while.body.i56: ; preds = %if.end17.i, %while.body.i56
%x.addr.165.i = phi i32 [ %div.i, %while.body.i56 ], [ %x.addr.066.i, %if.end17.i ]
%div.i = sdiv i32 %x.addr.165.i, %21
%rem25.i = srem i32 %div.i, %21
%cmp26.i = icmp eq i32 %rem25.i, 0
%tobool27.i = icmp ne i32 %div.i, 0
%23 = and i1 %tobool27.i, %cmp26.i
br i1 %23, label %while.body.i56, label %for.inc.i, !llvm.loop !15
for.inc.i: ; preds = %while.body.i56, %if.end17.i, %if.end5.i
%x.addr.2.i = phi i32 [ %x.addr.066.i, %if.end5.i ], [ 0, %if.end17.i ], [ %div.i, %while.body.i56 ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, 168
br i1 %exitcond.not.i, label %for.end.i, label %for.body.i, !llvm.loop !16
for.end.i: ; preds = %for.inc.i, %for.body.i
%x.addr.0.lcssa.i = phi i32 [ %x.addr.2.i, %for.inc.i ], [ %x.addr.066.i, %for.body.i ]
%cmp30.i = icmp sgt i32 %x.addr.0.lcssa.i, 1
br i1 %cmp30.i, label %if.then31.i, label %for.inc
if.then31.i: ; preds = %for.end.i
%sub32.i = add nsw i32 %x.addr.0.lcssa.i, -1
%idxprom33.i = zext i32 %sub32.i to i64
%arrayidx34.i = getelementptr inbounds [1000000 x i8], ptr @esc, i64 0, i64 %idxprom33.i
%24 = load i8, ptr %arrayidx34.i, align 1, !tbaa !14
%tobool35.not.i = icmp eq i8 %24, 0
br i1 %tobool35.not.i, label %if.end37.i, label %for.inc
if.end37.i: ; preds = %if.then31.i
store i8 1, ptr %arrayidx34.i, align 1, !tbaa !14
br label %for.inc
for.inc: ; preds = %if.end10.i, %GCD.exit, %IN.exit51, %for.end.i, %if.end37.i, %if.then31.i
%a.tr.lcssa.i63 = phi i32 [ %b.tr6.i, %GCD.exit ], [ %b.tr6.i, %if.end37.i ], [ %b.tr6.i, %for.end.i ], [ %b.tr6.i, %if.then31.i ], [ %g.075, %IN.exit51 ], [ %b.tr6.i, %if.end10.i ]
%.lcssa.not = phi i1 [ true, %GCD.exit ], [ false, %if.end37.i ], [ false, %for.end.i ], [ true, %if.then31.i ], [ true, %IN.exit51 ], [ true, %if.end10.i ]
%f.2 = phi i32 [ 1, %GCD.exit ], [ 0, %if.end37.i ], [ 0, %for.end.i ], [ 1, %if.then31.i ], [ 1, %IN.exit51 ], [ 1, %if.end10.i ]
%inc = add nuw nsw i32 %i.076, 1
%exitcond.not = icmp eq i32 %inc, %cond.i
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !17
if.else18: ; preds = %for.cond.cleanup, %IN.exit
br label %cleanup
cleanup: ; preds = %for.cond.cleanup, %if.else18
%disjoint.sink = phi ptr [ @disjoint, %if.else18 ], [ %common.mux, %for.cond.cleanup ]
%call19 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %disjoint.sink)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #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 = { 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 = !{!"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 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
#define NUM 100001
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int GCD(int a,int b){int c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
int LCM(int a,int b){return a*b/GCD(a,b);}
int POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return (int)ans;}
int icmp(const void* a,const void* b){return *(int*)a-*(int*)b;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}
LL fac[NUM],finv[NUM],inv[NUM];
void comi(){int i;fac[0]=fac[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fac[i]=fac[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
int com(int n,int k){if(n<k||n<0||k<0)return 0;return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;}
typedef struct{LL A,B;}P;
int cmp(const void* a,const void* b){return ((P*)a)->A-((P*)b)->A;}
int main(){
LL N,M,i,ans=0;
scanf("%lld%lld",&N,&M);
P p[N];
FOR(i,0,N)scanf("%lld%lld",&p[i].A,&p[i].B);
qsort(p,N,sizeof(P),cmp);
FOR(i,0,N){
LL a=p[i].A,b=p[i].B;
if(b<=M){
ans+=a*b;
M-=b;
}
else{
ans+=a*M;
break;
}
}
printf("%lld\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294765/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294765/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.P = type { i64, i64 }
@fac = dso_local local_unnamed_addr global [100001 x i64] zeroinitializer, align 16
@finv = dso_local local_unnamed_addr global [100001 x i64] zeroinitializer, align 16
@inv = dso_local local_unnamed_addr global [100001 x i64] zeroinitializer, align 16
@.str = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @GCD(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%cond5 = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
br label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.019 = phi i32 [ %cond, %entry ], [ %b.addr.018, %while.body ]
%b.addr.018 = phi i32 [ %cond5, %entry ], [ %rem, %while.body ]
%rem = srem i32 %a.addr.019, %b.addr.018
%cmp6.not = icmp eq i32 %rem, 0
br i1 %cmp6.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body
ret i32 %b.addr.018
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @LCM(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cond.i = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%cond5.i = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
br label %while.body.i
while.body.i: ; preds = %while.body.i, %entry
%a.addr.019.i = phi i32 [ %cond.i, %entry ], [ %b.addr.018.i, %while.body.i ]
%b.addr.018.i = phi i32 [ %cond5.i, %entry ], [ %rem.i, %while.body.i ]
%rem.i = srem i32 %a.addr.019.i, %b.addr.018.i
%cmp6.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp6.not.i, label %GCD.exit, label %while.body.i, !llvm.loop !9
GCD.exit: ; preds = %while.body.i
%mul = mul nsw i32 %b, %a
%div = sdiv i32 %mul, %b.addr.018.i
ret i32 %div
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @POW(i64 noundef %a, i64 noundef %n) local_unnamed_addr #3 {
entry:
%cmp8 = icmp sgt i64 %n, 0
br i1 %cmp8, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end
%ans.011 = phi i64 [ %ans.1, %if.end ], [ 1, %entry ]
%n.addr.010 = phi i64 [ %shr, %if.end ], [ %n, %entry ]
%a.addr.09 = phi i64 [ %rem2, %if.end ], [ %a, %entry ]
%and = and i64 %n.addr.010, 1
%tobool.not = icmp eq i64 %and, 0
br i1 %tobool.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul nsw i64 %ans.011, %a.addr.09
%rem = srem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%ans.1 = phi i64 [ %rem, %if.then ], [ %ans.011, %while.body ]
%mul1 = mul nsw i64 %a.addr.09, %a.addr.09
%rem2 = urem i64 %mul1, 1000000007
%shr = lshr i64 %n.addr.010, 1
%cmp.not = icmp ult i64 %n.addr.010, 2
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !11
while.end.loopexit: ; preds = %if.end
%0 = trunc i64 %ans.1 to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%ans.0.lcssa = phi i32 [ 1, %entry ], [ %0, %while.end.loopexit ]
ret i32 %ans.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @icmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
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 @ccmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !12
%conv = sext i8 %0 to i32
%1 = load i8, ptr %b, align 1, !tbaa !12
%conv1 = sext i8 %1 to i32
%sub = sub nsw i32 %conv, %conv1
ret i32 %sub
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @scmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load ptr, ptr %a, align 8, !tbaa !13
%1 = load ptr, ptr %b, align 8, !tbaa !13
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #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 #6
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @comi() local_unnamed_addr #7 {
entry:
store i64 1, ptr getelementptr inbounds ([100001 x i64], ptr @fac, i64 0, i64 1), align 8, !tbaa !15
store i64 1, ptr @fac, align 16, !tbaa !15
store i64 1, ptr getelementptr inbounds ([100001 x i64], ptr @finv, i64 0, i64 1), align 8, !tbaa !15
store i64 1, ptr @finv, align 16, !tbaa !15
store i64 1, ptr getelementptr inbounds ([100001 x i64], ptr @inv, i64 0, i64 1), align 8, !tbaa !15
br label %for.body
for.body: ; preds = %entry, %for.body
%0 = phi i64 [ 1, %entry ], [ %rem18, %for.body ]
%1 = phi i64 [ 1, %entry ], [ %rem, %for.body ]
%indvars.iv = phi i64 [ 2, %entry ], [ %indvars.iv.next, %for.body ]
%mul = mul nsw i64 %1, %indvars.iv
%rem = srem i64 %mul, 1000000007
%arrayidx2 = getelementptr inbounds [100001 x i64], ptr @fac, i64 0, i64 %indvars.iv
store i64 %rem, ptr %arrayidx2, align 8, !tbaa !15
%2 = trunc i64 %indvars.iv to i32
%rem3 = urem i32 1000000007, %2
%idxprom4 = zext i32 %rem3 to i64
%arrayidx5 = getelementptr inbounds [100001 x i64], ptr @inv, i64 0, i64 %idxprom4
%3 = load i64, ptr %arrayidx5, align 8, !tbaa !15
%div = udiv i32 1000000007, %2
%conv6 = zext i32 %div to i64
%mul7 = mul nsw i64 %3, %conv6
%rem8 = srem i64 %mul7, 1000000007
%sub9 = sub nsw i64 1000000007, %rem8
%arrayidx11 = getelementptr inbounds [100001 x i64], ptr @inv, i64 0, i64 %indvars.iv
store i64 %sub9, ptr %arrayidx11, align 8, !tbaa !15
%mul17 = mul nuw nsw i64 %sub9, %0
%rem18 = urem i64 %mul17, 1000000007
%arrayidx20 = getelementptr inbounds [100001 x i64], ptr @finv, i64 0, i64 %indvars.iv
store i64 %rem18, ptr %arrayidx20, align 8, !tbaa !15
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 100001
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !17
for.end: ; preds = %for.body
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @com(i32 noundef %n, i32 noundef %k) local_unnamed_addr #8 {
entry:
%cmp = icmp slt i32 %n, %k
%0 = or i32 %k, %n
%1 = icmp slt i32 %0, 0
%or.cond10 = or i1 %cmp, %1
br i1 %or.cond10, label %return, label %if.end
if.end: ; preds = %entry
%idxprom = zext i32 %n to i64
%arrayidx = getelementptr inbounds [100001 x i64], ptr @fac, i64 0, i64 %idxprom
%2 = load i64, ptr %arrayidx, align 8, !tbaa !15
%idxprom4 = zext i32 %k to i64
%arrayidx5 = getelementptr inbounds [100001 x i64], ptr @finv, i64 0, i64 %idxprom4
%3 = load i64, ptr %arrayidx5, align 8, !tbaa !15
%sub = sub nsw i32 %n, %k
%idxprom6 = sext i32 %sub to i64
%arrayidx7 = getelementptr inbounds [100001 x i64], ptr @finv, i64 0, i64 %idxprom6
%4 = load i64, ptr %arrayidx7, align 8, !tbaa !15
%mul = mul nsw i64 %4, %3
%rem = srem i64 %mul, 1000000007
%mul8 = mul nsw i64 %rem, %2
%rem9 = srem i64 %mul8, 1000000007
%conv = trunc i64 %rem9 to i32
br label %return
return: ; preds = %entry, %if.end
%retval.0 = phi i32 [ %conv, %if.end ], [ 0, %entry ]
ret i32 %retval.0
}
; 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) #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !18
%1 = load i64, ptr %b, align 8, !tbaa !18
%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 #9 {
entry:
%N = alloca i64, align 8
%M = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #15
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %M) #15
%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 !15
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.P, i64 %0, align 16
%2 = load i64, ptr %N, align 8, !tbaa !15
%cmp46 = icmp sgt i64 %2, 0
br i1 %cmp46, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.047 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.P, ptr %vla, i64 %i.047
%B = getelementptr inbounds %struct.P, ptr %vla, i64 %i.047, i32 1
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %B)
%inc = add nuw nsw i64 %i.047, 1
%3 = load i64, ptr %N, align 8, !tbaa !15
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !20
for.end: ; preds = %for.body, %entry
%.lcssa45 = phi i64 [ %2, %entry ], [ %3, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %.lcssa45, i64 noundef 16, ptr noundef nonnull @cmp) #15
%4 = load i64, ptr %N, align 8, !tbaa !15
%cmp449 = icmp sgt i64 %4, 0
br i1 %cmp449, label %for.body5.preheader, label %for.end16
for.body5.preheader: ; preds = %for.end
%M.promoted = load i64, ptr %M, align 8, !tbaa !15
br label %for.body5
for.body5: ; preds = %for.body5.preheader, %for.inc14
%i.152 = phi i64 [ %inc15, %for.inc14 ], [ 0, %for.body5.preheader ]
%ans.051 = phi i64 [ %ans.140, %for.inc14 ], [ 0, %for.body5.preheader ]
%sub4850 = phi i64 [ %sub, %for.inc14 ], [ %M.promoted, %for.body5.preheader ]
%arrayidx6 = getelementptr inbounds %struct.P, ptr %vla, i64 %i.152
%5 = load i64, ptr %arrayidx6, align 16, !tbaa !18
%B9 = getelementptr inbounds %struct.P, ptr %vla, i64 %i.152, i32 1
%6 = load i64, ptr %B9, align 8, !tbaa !21
%cmp10.not = icmp sgt i64 %6, %sub4850
br i1 %cmp10.not, label %cleanup, label %for.inc14
cleanup: ; preds = %for.body5
%mul.pn = mul nsw i64 %sub4850, %5
%ans.1 = add nsw i64 %mul.pn, %ans.051
br label %for.end16
for.inc14: ; preds = %for.body5
%sub = sub nsw i64 %sub4850, %6
store i64 %sub, ptr %M, align 8, !tbaa !15
%mul.pn39 = mul nsw i64 %6, %5
%ans.140 = add nsw i64 %mul.pn39, %ans.051
%inc15 = add nuw nsw i64 %i.152, 1
%exitcond.not = icmp eq i64 %inc15, %4
br i1 %exitcond.not, label %for.end16, label %for.body5, !llvm.loop !22
for.end16: ; preds = %for.inc14, %for.end, %cleanup
%ans.2 = phi i64 [ %ans.1, %cleanup ], [ 0, %for.end ], [ %ans.140, %for.inc14 ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.2)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %M) #15
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #15
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #11
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #12
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #11
; 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 norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree 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 #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: 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 #5 = { mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { 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 #8 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { 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 #10 = { 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 #11 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #12 = { 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 #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 = distinct !{!11, !10}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = distinct !{!17, !10}
!18 = !{!19, !16, i64 0}
!19 = !{!"", !16, i64 0, !16, i64 8}
!20 = distinct !{!20, !10}
!21 = !{!19, !16, i64 8}
!22 = distinct !{!22, !10}
|
#include <stdio.h>
#include <stdlib.h>
#define MAX 100007
struct pair {
long a;
int b;
};
int compare(const void *x, const void *y) {
long x_a = ((struct pair *) x)->a;
long y_a = ((struct pair *) y)->a;
return x_a - y_a;
}
int main() {
int N, M;
scanf("%d %d", &N, &M);
struct pair AB[MAX];
for (int i = 0; i < N; i++)
scanf("%ld %d", &AB[i].a, &AB[i].b);
qsort(AB, N, sizeof(struct pair), compare);
struct pair ab = {0, 0};
for (int i = 0; i < N; i++) {
if (ab.b + AB[i].b <= M) {
ab.a += AB[i].a * AB[i].b;
ab.b += AB[i].b;
} else {
ab.a += AB[i].a * (M - ab.b);
break;
}
}
printf("%ld\n", ab.a);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294808/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294808/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.pair = type { i64, i32 }
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%ld %d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %x, ptr nocapture noundef readonly %y) #0 {
entry:
%0 = load i64, ptr %x, align 8, !tbaa !5
%1 = load i64, ptr %y, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub 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
%M = alloca i32, align 4
%AB = alloca [100007 x %struct.pair], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
call void @llvm.lifetime.start.p0(i64 1600112, ptr nonnull %AB) #5
%0 = load i32, ptr %N, align 4, !tbaa !11
%cmp68 = icmp sgt i32 %0, 0
br i1 %cmp68, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %4, %for.body ]
call void @qsort(ptr noundef nonnull %AB, i64 noundef %conv.pre-phi, i64 noundef 16, ptr noundef nonnull @compare) #5
%1 = load i32, ptr %N, align 4, !tbaa !11
%cmp670 = icmp sgt i32 %1, 0
br i1 %cmp670, label %for.body9.lr.ph, label %cleanup
for.body9.lr.ph: ; preds = %for.cond.cleanup
%2 = load i32, ptr %M, align 4, !tbaa !11
%wide.trip.count = zext i32 %1 to i64
br label %for.body9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100007 x %struct.pair], ptr %AB, i64 0, i64 %indvars.iv
%b = getelementptr inbounds [100007 x %struct.pair], ptr %AB, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %b)
%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
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !12
for.body9: ; preds = %for.body9.lr.ph, %if.then
%indvars.iv79 = phi i64 [ 0, %for.body9.lr.ph ], [ %indvars.iv.next80, %if.then ]
%ab.sroa.8.072 = phi i32 [ 0, %for.body9.lr.ph ], [ %add, %if.then ]
%ab.sroa.0.071 = phi i64 [ 0, %for.body9.lr.ph ], [ %add24, %if.then ]
%arrayidx12 = getelementptr inbounds [100007 x %struct.pair], ptr %AB, i64 0, i64 %indvars.iv79
%b13 = getelementptr inbounds [100007 x %struct.pair], ptr %AB, i64 0, i64 %indvars.iv79, i32 1
%5 = load i32, ptr %b13, align 8, !tbaa !14
%add = add nsw i32 %5, %ab.sroa.8.072
%cmp14.not = icmp sgt i32 %add, %2
%6 = load i64, ptr %arrayidx12, align 16, !tbaa !5
br i1 %cmp14.not, label %if.else, label %if.then
if.then: ; preds = %for.body9
%conv22 = sext i32 %5 to i64
%mul = mul nsw i64 %6, %conv22
%add24 = add nsw i64 %mul, %ab.sroa.0.071
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%exitcond.not = icmp eq i64 %indvars.iv.next80, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body9, !llvm.loop !15
if.else: ; preds = %for.body9
%sub = sub nsw i32 %2, %ab.sroa.8.072
%conv34 = sext i32 %sub to i64
%mul35 = mul nsw i64 %6, %conv34
%add37 = add nsw i64 %mul35, %ab.sroa.0.071
br label %cleanup
cleanup: ; preds = %if.then, %for.cond.cleanup, %if.else
%ab.sroa.0.1 = phi i64 [ %add37, %if.else ], [ 0, %for.cond.cleanup ], [ %add24, %if.then ]
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ab.sroa.0.1)
call void @llvm.lifetime.end.p0(i64 1600112, ptr nonnull %AB) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = !{!"pair", !7, i64 0, !10, i64 8}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!6, !10, i64 8}
!15 = distinct !{!15, !13}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long int
typedef struct{
ll a;
ll b;
} data;//data型を作成
int compare(const void *x, const void *y){
return (((data*)x)->a - ((data*)y)->a);
}//data型のポインタのメンバaのこと
int main(void){
int n,m,i;
scanf("%d %d",&n,&m);
ll ans=0;
data d[n];
for(i=0;i<n;i++)scanf("%lld %lld",&d[i].a,&d[i].b);
qsort(d, n, sizeof(data), compare);
i=0;
while(m>0){
if(m>d[i].b){
ans += d[i].a*d[i].b;
m -= d[i].b;
}else{
ans += d[i].a * m;
break;
}
i++;
}
printf("%lld",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294866/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294866/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.data = type { i64, i64 }
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %x, ptr nocapture noundef readonly %y) #0 {
entry:
%0 = load i64, ptr %x, align 8, !tbaa !5
%1 = load i64, ptr %y, align 8, !tbaa !5
%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 #1 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !10
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.data, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !10
%cmp45 = icmp sgt i32 %3, 0
br i1 %cmp45, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %3 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.data, ptr %vla, i64 %indvars.iv
%b = getelementptr inbounds %struct.data, ptr %vla, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %b)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !10
%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 !12
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %5, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 16, ptr noundef nonnull @compare) #6
%.pr = load i32, ptr %m, align 4, !tbaa !10
%cmp447 = icmp sgt i32 %.pr, 0
br i1 %cmp447, label %while.body, label %while.end
while.body: ; preds = %for.end, %if.then
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %if.then ], [ 0, %for.end ]
%ans.048 = phi i64 [ %add, %if.then ], [ 0, %for.end ]
%6 = phi i32 [ %conv22, %if.then ], [ %.pr, %for.end ]
%conv6 = zext i32 %6 to i64
%arrayidx8 = getelementptr inbounds %struct.data, ptr %vla, i64 %indvars.iv56
%b9 = getelementptr inbounds %struct.data, ptr %vla, i64 %indvars.iv56, i32 1
%7 = load i64, ptr %b9, align 8, !tbaa !14
%cmp10 = icmp slt i64 %7, %conv6
%8 = load i64, ptr %arrayidx8, align 16, !tbaa !5
br i1 %cmp10, label %if.then, label %if.else
if.then: ; preds = %while.body
%mul = mul nsw i64 %8, %7
%add = add nsw i64 %mul, %ans.048
%9 = trunc i64 %7 to i32
%conv22 = sub i32 %6, %9
store i32 %conv22, ptr %m, align 4, !tbaa !10
%indvars.iv.next57 = add nuw i64 %indvars.iv56, 1
%cmp4 = icmp sgt i32 %conv22, 0
br i1 %cmp4, label %while.body, label %while.end, !llvm.loop !15
if.else: ; preds = %while.body
%mul27 = mul nsw i64 %8, %conv6
%add28 = add nsw i64 %mul27, %ans.048
br label %while.end
while.end: ; preds = %if.then, %for.end, %if.else
%ans.1 = phi i64 [ %add28, %if.else ], [ 0, %for.end ], [ %add, %if.then ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.1)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 8}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!6, !7, i64 8}
!15 = distinct !{!15, !13}
|
#include<stdio.h>
int main(void){
int x,y,i,j,a,b,n,dp[20][20]={0};
int fail_a,fail_b;
while(scanf("%d %d",&a,&b),a|b){
scanf("%d",&n);
i = 0;
while(i<n){
scanf("%d %d",&x,&y);
dp[x-1][y-1] = -1;
i++;
}
i = 0;
fail_a = 0;
fail_b = 0;
while(i < a){
j = 0;
while(j < b){
if(dp[i][j] == -1){
dp[i][j] = 0;
if(i == 0){
fail_a = 1;
}else if(j == 0){
fail_b = 1;
}
}else if(i == 0 || j == 0){
if(i == 0 && fail_a || j == 0 && fail_b)dp[i][j] = 0;
else dp[i][j] = 1;
}else{
dp[i][j] = dp[i-1][j] + dp[i][j-1];
}
j++;
}
i++;
}
printf("%d\n",dp[a-1][b-1]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294909/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294909/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%n = alloca i32, align 4
%dp = alloca [20 x [20 x i32]], align 16
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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %dp) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1600) %dp, i8 0, i64 1600, i1 false)
%call161 = 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
%or162 = or i32 %1, %0
%tobool.not163 = icmp eq i32 %or162, 0
br i1 %tobool.not163, label %while.end77, label %while.body
while.body: ; preds = %entry, %while.end69
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp105 = icmp sgt i32 %2, 0
br i1 %cmp105, label %while.body3, label %while.cond8.preheader
while.cond8.preheader: ; preds = %while.body3, %while.body
%3 = load i32, ptr %a, align 4, !tbaa !5
%cmp9115 = icmp sgt i32 %3, 0
%.pre = load i32, ptr %b, align 4, !tbaa !5
%cmp12107 = icmp sgt i32 %.pre, 0
%or.cond = select i1 %cmp9115, i1 %cmp12107, i1 false
br i1 %or.cond, label %while.cond11.preheader.us.preheader, label %while.end69
while.cond11.preheader.us.preheader: ; preds = %while.cond8.preheader
%wide.trip.count186 = zext i32 %3 to i64
%wide.trip.count = zext i32 %.pre to i64
%exitcond.peel.not = icmp eq i32 %.pre, 1
%exitcond180.peel.not = icmp eq i32 %.pre, 1
%4 = add nsw i64 %wide.trip.count, -1
%5 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %4, 1
%6 = icmp eq i64 %5, 0
%unroll_iter = and i64 %4, -2
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%xtraiter197 = and i64 %4, 1
%7 = icmp eq i64 %5, 0
%unroll_iter200 = and i64 %4, -2
%lcmp.mod198.not = icmp eq i64 %xtraiter197, 0
br label %while.cond11.preheader.us
while.cond11.preheader.us: ; preds = %while.cond11.preheader.us.preheader, %while.cond11.while.end67_crit_edge.us
%indvars.iv182 = phi i64 [ 0, %while.cond11.preheader.us.preheader ], [ %indvars.iv.next183, %while.cond11.while.end67_crit_edge.us ]
%fail_b.0118.us = phi i32 [ 0, %while.cond11.preheader.us.preheader ], [ %.us-phi112.us, %while.cond11.while.end67_crit_edge.us ]
%fail_a.0117.us = phi i32 [ 0, %while.cond11.preheader.us.preheader ], [ %.us-phi.us, %while.cond11.while.end67_crit_edge.us ]
%cmp29.us = icmp eq i64 %indvars.iv182, 0
%8 = add nsw i64 %indvars.iv182, -1
br i1 %cmp29.us, label %while.body13.lr.ph.split.us.split.us.us, label %while.body13.us120.preheader
while.body13.us120.preheader: ; preds = %while.cond11.preheader.us
%arrayidx17.us124.peel = getelementptr inbounds [20 x [20 x i32]], ptr %dp, i64 0, i64 %indvars.iv182, i64 0
%9 = load i32, ptr %arrayidx17.us124.peel, align 16, !tbaa !5
%cmp18.us125.peel = icmp ne i32 %9, -1
%tobool37.us128.not.peel = icmp eq i32 %fail_b.0118.us, 0
%narrow = select i1 %cmp18.us125.peel, i1 %tobool37.us128.not.peel, i1 false
%.sink = zext i1 %narrow to i32
%fail_b.2.us135.peel = select i1 %cmp18.us125.peel, i32 %fail_b.0118.us, i32 1
store i32 %.sink, ptr %arrayidx17.us124.peel, align 16, !tbaa !5
br i1 %exitcond.peel.not, label %while.cond11.while.end67_crit_edge.us, label %while.body13.us120.preheader195
while.body13.us120.preheader195: ; preds = %while.body13.us120.preheader
br i1 %6, label %while.cond11.while.end67_crit_edge.us.loopexit196.unr-lcssa, label %while.body13.us120
while.body13.us120: ; preds = %while.body13.us120.preheader195, %if.end65.us134.1
%10 = phi i32 [ %.sink189.1, %if.end65.us134.1 ], [ %.sink, %while.body13.us120.preheader195 ]
%indvars.iv = phi i64 [ %indvars.iv.next.1, %if.end65.us134.1 ], [ 1, %while.body13.us120.preheader195 ]
%niter = phi i64 [ %niter.next.1, %if.end65.us134.1 ], [ 0, %while.body13.us120.preheader195 ]
%arrayidx17.us124 = getelementptr inbounds [20 x [20 x i32]], ptr %dp, i64 0, i64 %indvars.iv182, i64 %indvars.iv
%11 = load i32, ptr %arrayidx17.us124, align 4, !tbaa !5
%cmp18.us125 = icmp eq i32 %11, -1
br i1 %cmp18.us125, label %if.end65.us134, label %if.else49.us
if.else49.us: ; preds = %while.body13.us120
%arrayidx54.us = getelementptr inbounds [20 x [20 x i32]], ptr %dp, i64 0, i64 %8, i64 %indvars.iv
%12 = load i32, ptr %arrayidx54.us, align 4, !tbaa !5
%add.us = add nsw i32 %10, %12
br label %if.end65.us134
if.end65.us134: ; preds = %while.body13.us120, %if.else49.us
%.sink189 = phi i32 [ %add.us, %if.else49.us ], [ 0, %while.body13.us120 ]
store i32 %.sink189, ptr %arrayidx17.us124, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx17.us124.1 = getelementptr inbounds [20 x [20 x i32]], ptr %dp, i64 0, i64 %indvars.iv182, i64 %indvars.iv.next
%13 = load i32, ptr %arrayidx17.us124.1, align 4, !tbaa !5
%cmp18.us125.1 = icmp eq i32 %13, -1
br i1 %cmp18.us125.1, label %if.end65.us134.1, label %if.else49.us.1
if.else49.us.1: ; preds = %if.end65.us134
%arrayidx54.us.1 = getelementptr inbounds [20 x [20 x i32]], ptr %dp, i64 0, i64 %8, i64 %indvars.iv.next
%14 = load i32, ptr %arrayidx54.us.1, align 4, !tbaa !5
%add.us.1 = add nsw i32 %.sink189, %14
br label %if.end65.us134.1
if.end65.us134.1: ; preds = %if.else49.us.1, %if.end65.us134
%.sink189.1 = phi i32 [ %add.us.1, %if.else49.us.1 ], [ 0, %if.end65.us134 ]
store i32 %.sink189.1, ptr %arrayidx17.us124.1, align 4, !tbaa !5
%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 %while.cond11.while.end67_crit_edge.us.loopexit196.unr-lcssa, label %while.body13.us120, !llvm.loop !9
while.cond11.while.end67_crit_edge.us.loopexit.unr-lcssa: ; preds = %while.body13.us.us.us, %while.body13.us.us.us.preheader
%fail_a.2.us.us.us.lcssa.ph = phi i32 [ undef, %while.body13.us.us.us.preheader ], [ %fail_a.2.us.us.us.1, %while.body13.us.us.us ]
%indvars.iv176.unr = phi i64 [ 1, %while.body13.us.us.us.preheader ], [ %indvars.iv.next177.1, %while.body13.us.us.us ]
%fail_a.1109.us.us.us.unr = phi i32 [ %fail_a.2.us.us.us.peel, %while.body13.us.us.us.preheader ], [ %fail_a.2.us.us.us.1, %while.body13.us.us.us ]
br i1 %lcmp.mod198.not, label %while.cond11.while.end67_crit_edge.us, label %while.body13.us.us.us.epil
while.body13.us.us.us.epil: ; preds = %while.cond11.while.end67_crit_edge.us.loopexit.unr-lcssa
%arrayidx17.us.us.us.epil = getelementptr inbounds [20 x [20 x i32]], ptr %dp, i64 0, i64 0, i64 %indvars.iv176.unr
%15 = load i32, ptr %arrayidx17.us.us.us.epil, align 4, !tbaa !5
%cmp18.us.us.us.epil = icmp ne i32 %15, -1
%tobool33.us.us.us.not.epil = icmp eq i32 %fail_a.1109.us.us.us.unr, 0
%narrow192.epil = select i1 %cmp18.us.us.us.epil, i1 %tobool33.us.us.us.not.epil, i1 false
%.sink190.epil = zext i1 %narrow192.epil to i32
%fail_a.2.us.us.us.epil = select i1 %cmp18.us.us.us.epil, i32 %fail_a.1109.us.us.us.unr, i32 1
store i32 %.sink190.epil, ptr %arrayidx17.us.us.us.epil, align 4, !tbaa !5
br label %while.cond11.while.end67_crit_edge.us
while.cond11.while.end67_crit_edge.us.loopexit196.unr-lcssa: ; preds = %if.end65.us134.1, %while.body13.us120.preheader195
%.unr = phi i32 [ %.sink, %while.body13.us120.preheader195 ], [ %.sink189.1, %if.end65.us134.1 ]
%indvars.iv.unr = phi i64 [ 1, %while.body13.us120.preheader195 ], [ %indvars.iv.next.1, %if.end65.us134.1 ]
br i1 %lcmp.mod.not, label %while.cond11.while.end67_crit_edge.us, label %while.body13.us120.epil
while.body13.us120.epil: ; preds = %while.cond11.while.end67_crit_edge.us.loopexit196.unr-lcssa
%arrayidx17.us124.epil = getelementptr inbounds [20 x [20 x i32]], ptr %dp, i64 0, i64 %indvars.iv182, i64 %indvars.iv.unr
%16 = load i32, ptr %arrayidx17.us124.epil, align 4, !tbaa !5
%cmp18.us125.epil = icmp eq i32 %16, -1
br i1 %cmp18.us125.epil, label %if.end65.us134.epil, label %if.else49.us.epil
if.else49.us.epil: ; preds = %while.body13.us120.epil
%arrayidx54.us.epil = getelementptr inbounds [20 x [20 x i32]], ptr %dp, i64 0, i64 %8, i64 %indvars.iv.unr
%17 = load i32, ptr %arrayidx54.us.epil, align 4, !tbaa !5
%add.us.epil = add nsw i32 %.unr, %17
br label %if.end65.us134.epil
if.end65.us134.epil: ; preds = %if.else49.us.epil, %while.body13.us120.epil
%.sink189.epil = phi i32 [ %add.us.epil, %if.else49.us.epil ], [ 0, %while.body13.us120.epil ]
store i32 %.sink189.epil, ptr %arrayidx17.us124.epil, align 4, !tbaa !5
br label %while.cond11.while.end67_crit_edge.us
while.cond11.while.end67_crit_edge.us: ; preds = %if.end65.us134.epil, %while.cond11.while.end67_crit_edge.us.loopexit196.unr-lcssa, %while.body13.us.us.us.epil, %while.cond11.while.end67_crit_edge.us.loopexit.unr-lcssa, %while.body13.us120.preheader, %if.end65.us.us.us.peel
%.us-phi.us = phi i32 [ %fail_a.2.us.us.us.peel, %if.end65.us.us.us.peel ], [ %fail_a.0117.us, %while.body13.us120.preheader ], [ %fail_a.2.us.us.us.lcssa.ph, %while.cond11.while.end67_crit_edge.us.loopexit.unr-lcssa ], [ %fail_a.2.us.us.us.epil, %while.body13.us.us.us.epil ], [ %fail_a.0117.us, %while.cond11.while.end67_crit_edge.us.loopexit196.unr-lcssa ], [ %fail_a.0117.us, %if.end65.us134.epil ]
%.us-phi112.us = phi i32 [ %fail_b.0118.us, %if.end65.us.us.us.peel ], [ %fail_b.2.us135.peel, %while.body13.us120.preheader ], [ %fail_b.0118.us, %while.cond11.while.end67_crit_edge.us.loopexit.unr-lcssa ], [ %fail_b.0118.us, %while.body13.us.us.us.epil ], [ %fail_b.2.us135.peel, %while.cond11.while.end67_crit_edge.us.loopexit196.unr-lcssa ], [ %fail_b.2.us135.peel, %if.end65.us134.epil ]
%indvars.iv.next183 = add nuw nsw i64 %indvars.iv182, 1
%exitcond187.not = icmp eq i64 %indvars.iv.next183, %wide.trip.count186
br i1 %exitcond187.not, label %while.end69, label %while.cond11.preheader.us, !llvm.loop !12
while.body13.lr.ph.split.us.split.us.us: ; preds = %while.cond11.preheader.us
%18 = load i32, ptr %dp, align 16, !tbaa !5
%cmp18.us.us.us.peel = icmp eq i32 %18, -1
br i1 %cmp18.us.us.us.peel, label %if.then.us.us.us.peel, label %if.else28.us.us.us.peel
if.else28.us.us.us.peel: ; preds = %while.body13.lr.ph.split.us.split.us.us
%tobool37.us.us.us = icmp ne i32 %fail_b.0118.us, 0
%tobool33.us.us.us.peel = icmp ne i32 %fail_a.0117.us, 0
%or.cond104.us.us.us.peel = select i1 %tobool33.us.us.us.peel, i1 true, i1 %tobool37.us.us.us
br i1 %or.cond104.us.us.us.peel, label %if.then38.us.us.us.peel, label %if.else43.us.us.us.peel
if.else43.us.us.us.peel: ; preds = %if.else28.us.us.us.peel
store i32 1, ptr %dp, align 16, !tbaa !5
br label %if.end65.us.us.us.peel
if.then38.us.us.us.peel: ; preds = %if.else28.us.us.us.peel
store i32 0, ptr %dp, align 16, !tbaa !5
br label %if.end65.us.us.us.peel
if.then.us.us.us.peel: ; preds = %while.body13.lr.ph.split.us.split.us.us
store i32 0, ptr %dp, align 16, !tbaa !5
br label %if.end65.us.us.us.peel
if.end65.us.us.us.peel: ; preds = %if.then.us.us.us.peel, %if.then38.us.us.us.peel, %if.else43.us.us.us.peel
%fail_a.2.us.us.us.peel = phi i32 [ %fail_a.0117.us, %if.then38.us.us.us.peel ], [ 0, %if.else43.us.us.us.peel ], [ 1, %if.then.us.us.us.peel ]
br i1 %exitcond180.peel.not, label %while.cond11.while.end67_crit_edge.us, label %while.body13.us.us.us.preheader
while.body13.us.us.us.preheader: ; preds = %if.end65.us.us.us.peel
br i1 %7, label %while.cond11.while.end67_crit_edge.us.loopexit.unr-lcssa, label %while.body13.us.us.us
while.body13.us.us.us: ; preds = %while.body13.us.us.us.preheader, %while.body13.us.us.us
%indvars.iv176 = phi i64 [ %indvars.iv.next177.1, %while.body13.us.us.us ], [ 1, %while.body13.us.us.us.preheader ]
%fail_a.1109.us.us.us = phi i32 [ %fail_a.2.us.us.us.1, %while.body13.us.us.us ], [ %fail_a.2.us.us.us.peel, %while.body13.us.us.us.preheader ]
%niter201 = phi i64 [ %niter201.next.1, %while.body13.us.us.us ], [ 0, %while.body13.us.us.us.preheader ]
%arrayidx17.us.us.us = getelementptr inbounds [20 x [20 x i32]], ptr %dp, i64 0, i64 0, i64 %indvars.iv176
%19 = load i32, ptr %arrayidx17.us.us.us, align 4, !tbaa !5
%cmp18.us.us.us = icmp ne i32 %19, -1
%tobool33.us.us.us.not = icmp eq i32 %fail_a.1109.us.us.us, 0
%narrow192 = select i1 %cmp18.us.us.us, i1 %tobool33.us.us.us.not, i1 false
%.sink190 = zext i1 %narrow192 to i32
%fail_a.2.us.us.us = select i1 %cmp18.us.us.us, i32 %fail_a.1109.us.us.us, i32 1
store i32 %.sink190, ptr %arrayidx17.us.us.us, align 4, !tbaa !5
%indvars.iv.next177 = add nuw nsw i64 %indvars.iv176, 1
%arrayidx17.us.us.us.1 = getelementptr inbounds [20 x [20 x i32]], ptr %dp, i64 0, i64 0, i64 %indvars.iv.next177
%20 = load i32, ptr %arrayidx17.us.us.us.1, align 4, !tbaa !5
%cmp18.us.us.us.1 = icmp ne i32 %20, -1
%tobool33.us.us.us.not.1 = icmp eq i32 %fail_a.2.us.us.us, 0
%narrow192.1 = select i1 %cmp18.us.us.us.1, i1 %tobool33.us.us.us.not.1, i1 false
%.sink190.1 = zext i1 %narrow192.1 to i32
%fail_a.2.us.us.us.1 = select i1 %cmp18.us.us.us.1, i32 %fail_a.2.us.us.us, i32 1
store i32 %.sink190.1, ptr %arrayidx17.us.us.us.1, align 4, !tbaa !5
%indvars.iv.next177.1 = add nuw nsw i64 %indvars.iv176, 2
%niter201.next.1 = add i64 %niter201, 2
%niter201.ncmp.1 = icmp eq i64 %niter201.next.1, %unroll_iter200
br i1 %niter201.ncmp.1, label %while.cond11.while.end67_crit_edge.us.loopexit.unr-lcssa, label %while.body13.us.us.us, !llvm.loop !13
while.body3: ; preds = %while.body, %while.body3
%i.0106 = phi i32 [ %inc, %while.body3 ], [ 0, %while.body ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%21 = load i32, ptr %x, align 4, !tbaa !5
%sub = add nsw i32 %21, -1
%idxprom = sext i32 %sub to i64
%22 = load i32, ptr %y, align 4, !tbaa !5
%sub5 = add nsw i32 %22, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [20 x [20 x i32]], ptr %dp, i64 0, i64 %idxprom, i64 %idxprom6
store i32 -1, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.0106, 1
%23 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %23
br i1 %cmp, label %while.body3, label %while.cond8.preheader, !llvm.loop !14
while.end69: ; preds = %while.cond11.while.end67_crit_edge.us, %while.cond8.preheader
%sub70 = add nsw i32 %3, -1
%idxprom71 = sext i32 %sub70 to i64
%sub73 = add nsw i32 %.pre, -1
%idxprom74 = sext i32 %sub73 to i64
%arrayidx75 = getelementptr inbounds [20 x [20 x i32]], ptr %dp, i64 0, i64 %idxprom71, i64 %idxprom74
%24 = load i32, ptr %arrayidx75, align 4, !tbaa !5
%call76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%25 = load i32, ptr %a, align 4, !tbaa !5
%26 = load i32, ptr %b, align 4, !tbaa !5
%or = or i32 %26, %25
%tobool.not = icmp eq i32 %or, 0
br i1 %tobool.not, label %while.end77, label %while.body, !llvm.loop !15
while.end77: ; preds = %while.end69, %entry
call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %dp) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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: 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: 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) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#define ABMAX 16
int main(void)
{
int a, b, n, x, y;
while (scanf("%d %d", &a, &b), a) {
int map[ABMAX][ABMAX] = {0}, mcase[ABMAX][ABMAX] = {0};
scanf("%d", &n);
while (n--) {
scanf("%d %d", &x, &y);
map[x-1][y-1] = 1;
}
for (x = 0; x < a; x++) {
if (map[x][0]) break;
mcase[x][0] = 1;
}
for (y = 0; y < b; y++) {
if (map[0][y]) break;
mcase[0][y] = 1;
}
for (x = 1; x < a; x++) {
for (y = 1; y < b; y++) {
if (!map[x-1][y]) mcase[x][y] += mcase[x-1][y];
if (!map[x][y-1])mcase[x][y] += mcase[x][y-1];
}
}
printf("%d\n", mcase[a-1][b-1]);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294967/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294967/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%n = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%map = alloca [16 x [16 x i32]], align 16
%mcase = alloca [16 x [16 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 %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
%call113 = 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
%tobool.not114 = icmp eq i32 %0, 0
br i1 %tobool.not114, label %while.end85, label %while.body
while.body: ; preds = %entry, %for.end77
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %map) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %map, i8 0, i64 1024, i1 false)
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %mcase) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %mcase, i8 0, i64 1024, i1 false)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%dec93 = add nsw i32 %1, -1
store i32 %dec93, ptr %n, align 4, !tbaa !5
%tobool3.not94 = icmp eq i32 %1, 0
br i1 %tobool3.not94, label %for.cond.preheader, label %while.body4
for.cond.preheader: ; preds = %while.body4, %while.body
%2 = load i32, ptr %a, align 4, !tbaa !5
%cmp95 = icmp sgt i32 %2, 0
br i1 %cmp95, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %2 to i64
br label %for.body
while.body4: ; preds = %while.body, %while.body4
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%3 = load i32, ptr %x, align 4, !tbaa !5
%sub = add nsw i32 %3, -1
%idxprom = sext i32 %sub to i64
%4 = load i32, ptr %y, align 4, !tbaa !5
%sub6 = add nsw i32 %4, -1
%idxprom7 = sext i32 %sub6 to i64
%arrayidx8 = getelementptr inbounds [16 x [16 x i32]], ptr %map, i64 0, i64 %idxprom, i64 %idxprom7
store i32 1, ptr %arrayidx8, align 4, !tbaa !5
%5 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %5, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool3.not = icmp eq i32 %5, 0
br i1 %tobool3.not, label %for.cond.preheader, label %while.body4, !llvm.loop !9
for.body: ; preds = %for.body.preheader, %if.end
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %if.end ]
%arrayidx10 = getelementptr inbounds [16 x [16 x i32]], ptr %map, i64 0, i64 %indvars.iv
%6 = load i32, ptr %arrayidx10, align 16, !tbaa !5
%tobool12.not = icmp eq i32 %6, 0
br i1 %tobool12.not, label %if.end, label %for.end
if.end: ; preds = %for.body
%arrayidx14 = getelementptr inbounds [16 x [16 x i32]], ptr %mcase, i64 0, i64 %indvars.iv
store i32 1, ptr %arrayidx14, align 16, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %if.end, %for.body, %for.cond.preheader
%7 = load i32, ptr %b, align 4, !tbaa !5
%cmp17100 = icmp sgt i32 %7, 0
br i1 %cmp17100, label %for.body18.preheader, label %for.end30
for.body18.preheader: ; preds = %for.end
%wide.trip.count120 = zext i32 %7 to i64
br label %for.body18
for.body18: ; preds = %for.body18.preheader, %if.end24
%indvars.iv117 = phi i64 [ 0, %for.body18.preheader ], [ %indvars.iv.next118, %if.end24 ]
%arrayidx21 = getelementptr inbounds [16 x i32], ptr %map, i64 0, i64 %indvars.iv117
%8 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%tobool22.not = icmp eq i32 %8, 0
br i1 %tobool22.not, label %if.end24, label %for.end30.loopexit.split.loop.exit
if.end24: ; preds = %for.body18
%arrayidx27 = getelementptr inbounds [16 x i32], ptr %mcase, i64 0, i64 %indvars.iv117
store i32 1, ptr %arrayidx27, align 4, !tbaa !5
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%exitcond121.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count120
br i1 %exitcond121.not, label %for.end30, label %for.body18, !llvm.loop !12
for.end30.loopexit.split.loop.exit: ; preds = %for.body18
%9 = trunc i64 %indvars.iv117 to i32
br label %for.end30
for.end30: ; preds = %if.end24, %for.end30.loopexit.split.loop.exit, %for.end
%storemerge89.lcssa = phi i32 [ 0, %for.end ], [ %9, %for.end30.loopexit.split.loop.exit ], [ %7, %if.end24 ]
store i32 %storemerge89.lcssa, ptr %y, align 4, !tbaa !5
%cmp32109 = icmp sgt i32 %2, 1
br i1 %cmp32109, label %for.cond34.preheader.lr.ph, label %for.end77
for.cond34.preheader.lr.ph: ; preds = %for.end30
%cmp35106 = icmp sgt i32 %7, 1
br i1 %cmp35106, label %for.cond34.preheader.us.preheader, label %for.cond31.for.end77_crit_edge
for.cond34.preheader.us.preheader: ; preds = %for.cond34.preheader.lr.ph
%wide.trip.count132 = zext i32 %2 to i64
%wide.trip.count126 = zext i32 %7 to i64
br label %for.cond34.preheader.us
for.cond34.preheader.us: ; preds = %for.cond34.preheader.us.preheader, %for.cond34.for.inc75_crit_edge.us
%indvars.iv128 = phi i64 [ 1, %for.cond34.preheader.us.preheader ], [ %indvars.iv.next129, %for.cond34.for.inc75_crit_edge.us ]
%10 = add nsw i64 %indvars.iv128, -1
br label %for.body36.us
for.body36.us: ; preds = %for.cond34.preheader.us, %for.inc72.us
%indvars.iv122 = phi i64 [ 1, %for.cond34.preheader.us ], [ %indvars.iv.next123, %for.inc72.us ]
%arrayidx41.us = getelementptr inbounds [16 x [16 x i32]], ptr %map, i64 0, i64 %10, i64 %indvars.iv122
%11 = load i32, ptr %arrayidx41.us, align 4, !tbaa !5
%tobool42.not.us = icmp eq i32 %11, 0
br i1 %tobool42.not.us, label %if.then43.us, label %if.end53.us
if.then43.us: ; preds = %for.body36.us
%arrayidx48.us = getelementptr inbounds [16 x [16 x i32]], ptr %mcase, i64 0, i64 %10, i64 %indvars.iv122
%12 = load i32, ptr %arrayidx48.us, align 4, !tbaa !5
%arrayidx52.us = getelementptr inbounds [16 x [16 x i32]], ptr %mcase, i64 0, i64 %indvars.iv128, i64 %indvars.iv122
%13 = load i32, ptr %arrayidx52.us, align 4, !tbaa !5
%add.us = add nsw i32 %13, %12
store i32 %add.us, ptr %arrayidx52.us, align 4, !tbaa !5
br label %if.end53.us
if.end53.us: ; preds = %if.then43.us, %for.body36.us
%14 = add nsw i64 %indvars.iv122, -1
%arrayidx58.us = getelementptr inbounds [16 x [16 x i32]], ptr %map, i64 0, i64 %indvars.iv128, i64 %14
%15 = load i32, ptr %arrayidx58.us, align 4, !tbaa !5
%tobool59.not.us = icmp eq i32 %15, 0
br i1 %tobool59.not.us, label %if.then60.us, label %for.inc72.us
if.then60.us: ; preds = %if.end53.us
%arrayidx65.us = getelementptr inbounds [16 x [16 x i32]], ptr %mcase, i64 0, i64 %indvars.iv128, i64 %14
%16 = load i32, ptr %arrayidx65.us, align 4, !tbaa !5
%arrayidx69.us = getelementptr inbounds [16 x [16 x i32]], ptr %mcase, i64 0, i64 %indvars.iv128, i64 %indvars.iv122
%17 = load i32, ptr %arrayidx69.us, align 4, !tbaa !5
%add70.us = add nsw i32 %17, %16
store i32 %add70.us, ptr %arrayidx69.us, align 4, !tbaa !5
br label %for.inc72.us
for.inc72.us: ; preds = %if.then60.us, %if.end53.us
%indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
%exitcond127.not = icmp eq i64 %indvars.iv.next123, %wide.trip.count126
br i1 %exitcond127.not, label %for.cond34.for.inc75_crit_edge.us, label %for.body36.us, !llvm.loop !13
for.cond34.for.inc75_crit_edge.us: ; preds = %for.inc72.us
%indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1
%exitcond133.not = icmp eq i64 %indvars.iv.next129, %wide.trip.count132
br i1 %exitcond133.not, label %for.cond31.for.end77_crit_edge, label %for.cond34.preheader.us, !llvm.loop !14
for.cond31.for.end77_crit_edge: ; preds = %for.cond34.for.inc75_crit_edge.us, %for.cond34.preheader.lr.ph
%.us-phi = phi i32 [ 1, %for.cond34.preheader.lr.ph ], [ %7, %for.cond34.for.inc75_crit_edge.us ]
store i32 %.us-phi, ptr %y, align 4, !tbaa !5
br label %for.end77
for.end77: ; preds = %for.cond31.for.end77_crit_edge, %for.end30
%storemerge90.lcssa = phi i32 [ %2, %for.cond31.for.end77_crit_edge ], [ 1, %for.end30 ]
store i32 %storemerge90.lcssa, ptr %x, align 4, !tbaa !5
%sub78 = add nsw i32 %2, -1
%idxprom79 = sext i32 %sub78 to i64
%sub81 = add nsw i32 %7, -1
%idxprom82 = sext i32 %sub81 to i64
%arrayidx83 = getelementptr inbounds [16 x [16 x i32]], ptr %mcase, i64 0, i64 %idxprom79, i64 %idxprom82
%18 = load i32, ptr %arrayidx83, align 4, !tbaa !5
%call84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %mcase) #4
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %map) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%19 = load i32, ptr %a, align 4, !tbaa !5
%tobool.not = icmp eq i32 %19, 0
br i1 %tobool.not, label %while.end85, label %while.body, !llvm.loop !15
while.end85: ; preds = %for.end77, %entry
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 %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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int main(void)
{
int x,n,p[100],flg,w,y,i,c,t;
scanf("%d %d",&x,&n);
flg=0;
w=x;
y=x;
if(n==0){
printf("%d\n",x);
flg=1;
}
else if(flg==0){
for(i=0;i<n;i++){
scanf("%d",&p[i]);
}
while(1){
c=0;
t=0;
for(i=0;i<n;i++){
if(w==p[i]) {
c++;
}
if(y==p[i]){
t++;
}
}
if(c==0&&t==0){
printf("%d\n",y);
break;
}
else if(c==0){
printf("%d\n",w);
break;
}
else if(t==0){
printf("%d\n",y);
break;
}
w=w+1;
y=y-1;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295009/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295009/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%n = alloca i32, align 4
%p = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %p) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %n)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp459 = icmp sgt i32 %1, 0
br i1 %cmp459, label %for.body, label %if.end39
while.cond.preheader: ; preds = %for.body
%cmp761 = icmp sgt i32 %29, 0
br i1 %cmp761, label %while.cond.us.preheader, label %if.end39
while.cond.us.preheader: ; preds = %while.cond.preheader
%wide.trip.count = zext i32 %29 to i64
%2 = insertelement <2 x i32> poison, i32 %0, i64 0
%3 = shufflevector <2 x i32> %2, <2 x i32> poison, <2 x i32> zeroinitializer
%min.iters.check = icmp ult i32 %29, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %while.cond.us
while.cond.us: ; preds = %while.cond.us.preheader, %if.end37.us
%4 = phi <2 x i32> [ %22, %if.end37.us ], [ %3, %while.cond.us.preheader ]
br i1 %min.iters.check, label %for.body8.us.preheader, label %vector.ph
vector.ph: ; preds = %while.cond.us
%broadcast.splat = shufflevector <2 x i32> %4, <2 x i32> poison, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%broadcast.splat93 = shufflevector <2 x i32> %4, <2 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> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%vec.phi88 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %18, %vector.body ]
%vec.phi89 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%vec.phi90 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%5 = getelementptr inbounds [100 x i32], ptr %p, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load91 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = icmp eq <4 x i32> %broadcast.splat, %wide.load
%8 = icmp eq <4 x i32> %broadcast.splat, %wide.load91
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = zext <4 x i1> %8 to <4 x i32>
%11 = add <4 x i32> %vec.phi89, %9
%12 = add <4 x i32> %vec.phi90, %10
%13 = icmp eq <4 x i32> %broadcast.splat93, %wide.load
%14 = icmp eq <4 x i32> %broadcast.splat93, %wide.load91
%15 = zext <4 x i1> %13 to <4 x i32>
%16 = zext <4 x i1> %14 to <4 x i32>
%17 = add <4 x i32> %vec.phi, %15
%18 = add <4 x i32> %vec.phi88, %16
%index.next = add nuw i64 %index, 8
%19 = icmp eq i64 %index.next, %n.vec
br i1 %19, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx94 = add <4 x i32> %12, %11
%20 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx94)
%bin.rdx = add <4 x i32> %18, %17
%21 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond6.for.end22_crit_edge.us, label %for.body8.us.preheader
for.body8.us.preheader: ; preds = %while.cond.us, %middle.block
%indvars.iv78.ph = phi i64 [ 0, %while.cond.us ], [ %n.vec, %middle.block ]
%t.064.us.ph = phi i32 [ 0, %while.cond.us ], [ %21, %middle.block ]
%c.063.us.ph = phi i32 [ 0, %while.cond.us ], [ %20, %middle.block ]
br label %for.body8.us
if.end37.us: ; preds = %for.cond6.for.end22_crit_edge.us
%22 = add nsw <2 x i32> %4, <i32 -1, i32 1>
br label %while.cond.us
for.body8.us: ; preds = %for.body8.us.preheader, %for.body8.us
%indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body8.us ], [ %indvars.iv78.ph, %for.body8.us.preheader ]
%t.064.us = phi i32 [ %t.1.us, %for.body8.us ], [ %t.064.us.ph, %for.body8.us.preheader ]
%c.063.us = phi i32 [ %spec.select.us, %for.body8.us ], [ %c.063.us.ph, %for.body8.us.preheader ]
%arrayidx10.us = getelementptr inbounds [100 x i32], ptr %p, i64 0, i64 %indvars.iv78
%23 = load i32, ptr %arrayidx10.us, align 4, !tbaa !5
%24 = insertelement <2 x i32> poison, i32 %23, i64 0
%25 = shufflevector <2 x i32> %24, <2 x i32> poison, <2 x i32> zeroinitializer
%26 = icmp eq <2 x i32> %4, %25
%27 = extractelement <2 x i1> %26, i64 1
%inc13.us = zext i1 %27 to i32
%spec.select.us = add nuw nsw i32 %c.063.us, %inc13.us
%28 = extractelement <2 x i1> %26, i64 0
%inc18.us = zext i1 %28 to i32
%t.1.us = add nuw nsw i32 %t.064.us, %inc18.us
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%exitcond.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count
br i1 %exitcond.not, label %for.cond6.for.end22_crit_edge.us, label %for.body8.us, !llvm.loop !13
for.cond6.for.end22_crit_edge.us: ; preds = %for.body8.us, %middle.block
%spec.select.us.lcssa = phi i32 [ %20, %middle.block ], [ %spec.select.us, %for.body8.us ]
%t.1.us.lcssa = phi i32 [ %21, %middle.block ], [ %t.1.us, %for.body8.us ]
%cmp23.us = icmp eq i32 %spec.select.us.lcssa, 0
%cmp24.us = icmp eq i32 %t.1.us.lcssa, 0
%brmerge87 = select i1 %cmp23.us, i1 true, i1 %cmp24.us
br i1 %brmerge87, label %if.end39.loopexit, label %if.end37.us
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %p, i64 0, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%29 = load i32, ptr %n, align 4, !tbaa !5
%30 = sext i32 %29 to i64
%cmp4 = icmp slt i64 %indvars.iv.next, %30
br i1 %cmp4, label %for.body, label %while.cond.preheader, !llvm.loop !14
if.end39.loopexit: ; preds = %for.cond6.for.end22_crit_edge.us
%or.cond.us = select i1 %cmp23.us, i1 %cmp24.us, i1 false
%31 = extractelement <2 x i32> %4, i64 0
%32 = extractelement <2 x i32> %4, i64 1
%y.0.us.mux = select i1 %or.cond.us, i32 %31, i32 %32
%y.0.us.mux.mux = select i1 %cmp23.us, i32 %y.0.us.mux, i32 %31
br label %if.end39
if.end39: ; preds = %if.end39.loopexit, %while.cond.preheader, %entry
%y.0.us.lcssa84.sink = phi i32 [ %0, %entry ], [ %0, %while.cond.preheader ], [ %y.0.us.mux.mux, %if.end39.loopexit ]
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %y.0.us.lcssa84.sink)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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.vector.reduce.add.v4i32(<4 x 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, !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}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int x, n, p, check[110]={0}, min, sub = -1;
scanf("%d %d", &x, &n);
for (int i = 0; i < n; i++)
{
scanf("%d", &p);
check[p]++;
}
if (n == 0)
{
printf("%d", x);
return 0;
}
for (int i = 0; i <= 101; i++)
{
if (check[i] == 0)
{
if (abs(x - i) < sub || sub == -1)
{
min = i;
sub = abs(x - i);
}
}
}
printf("%d", min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295052/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295052/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%n = alloca i32, align 4
%p = alloca i32, align 4
%check = alloca [110 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #5
call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %check) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(440) %check, i8 0, i64 440, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp38 = icmp sgt i32 %0, 0
br i1 %cmp38, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %4, %for.body ]
%cmp3 = icmp eq i32 %.lcssa, 0
%1 = load i32, ptr %x, align 4
br i1 %cmp3, label %cleanup, label %for.body9
for.body: ; preds = %entry, %for.body
%i.039 = phi i32 [ %inc2, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %p)
%2 = load i32, ptr %p, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%arrayidx = getelementptr inbounds [110 x i32], ptr %check, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %3, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%inc2 = add nuw nsw i32 %i.039, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc2, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.body9: ; preds = %for.cond.cleanup, %for.inc21
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc21 ], [ 0, %for.cond.cleanup ]
%sub.041 = phi i32 [ %sub.1, %for.inc21 ], [ -1, %for.cond.cleanup ]
%min.040 = phi i32 [ %min.1, %for.inc21 ], [ undef, %for.cond.cleanup ]
%arrayidx11 = getelementptr inbounds [110 x i32], ptr %check, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp eq i32 %5, 0
br i1 %cmp12, label %if.then13, label %for.inc21
if.then13: ; preds = %for.body9
%6 = trunc i64 %indvars.iv to i32
%sub14 = sub nsw i32 %1, %6
%7 = call i32 @llvm.abs.i32(i32 %sub14, i1 true)
%cmp15 = icmp slt i32 %7, %sub.041
%cmp16 = icmp eq i32 %sub.041, -1
%or.cond = or i1 %cmp16, %cmp15
%spec.select = select i1 %or.cond, i32 %6, i32 %min.040
%spec.select37 = select i1 %or.cond, i32 %7, i32 %sub.041
br label %for.inc21
for.inc21: ; preds = %if.then13, %for.body9
%min.1 = phi i32 [ %min.040, %for.body9 ], [ %spec.select, %if.then13 ]
%sub.1 = phi i32 [ %sub.041, %for.body9 ], [ %spec.select37, %if.then13 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 102
br i1 %exitcond.not, label %cleanup, label %for.body9, !llvm.loop !11
cleanup: ; preds = %for.inc21, %for.cond.cleanup
%min.1.lcssa.sink = phi i32 [ %1, %for.cond.cleanup ], [ %min.1, %for.inc21 ]
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.1.lcssa.sink)
call void @llvm.lifetime.end.p0(i64 440, ptr nonnull %check) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 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 #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 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}
|
#include <stdio.h>
#include <stdlib.h>
#define MAX 200
void input(int*, int n);
int work(int*, int, int);
int main()
{
int number[MAX];
int x, n;
//for (int i = 0; i < 100; i++) printf("%d ", i + 1);
scanf("%d %d", &x, &n);
input(number, n);
printf("%d\n", work(number, x, n));
return 0;
}
void input(int* number, int n)
{
int a;
for (int i = 0; i < MAX; i++)
number[i] = i;
for (int i = 0; i < n; i++) {
scanf("%d", &a);
number[a] = 0;
}
}
int work(int* number, int x, int n)
{
int r = x;
int min = MAX;
if (n != 0) {
for (int i = 0; i <MAX; i++) {
if (min > abs(number[i] - x)) {
min = abs(number[i] - x);
r = i;
}
//printf("%d\n", number[i]);
}
}
return r;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295096/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295096/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a.i = alloca i32, align 4
%number = alloca [200 x i32], align 16
%x = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %number) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6
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 %x, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a.i) #6
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, ptr %number, align 16, !tbaa !5
%1 = getelementptr inbounds i32, ptr %number, i64 4
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %number, i64 8
store <4 x i32> <i32 8, i32 9, i32 10, i32 11>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %number, i64 12
store <4 x i32> <i32 12, i32 13, i32 14, i32 15>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %number, i64 16
store <4 x i32> <i32 16, i32 17, i32 18, i32 19>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %number, i64 20
store <4 x i32> <i32 20, i32 21, i32 22, i32 23>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %number, i64 24
store <4 x i32> <i32 24, i32 25, i32 26, i32 27>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %number, i64 28
store <4 x i32> <i32 28, i32 29, i32 30, i32 31>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds i32, ptr %number, i64 32
store <4 x i32> <i32 32, i32 33, i32 34, i32 35>, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds i32, ptr %number, i64 36
store <4 x i32> <i32 36, i32 37, i32 38, i32 39>, ptr %9, align 16, !tbaa !5
%10 = getelementptr inbounds i32, ptr %number, i64 40
store <4 x i32> <i32 40, i32 41, i32 42, i32 43>, ptr %10, align 16, !tbaa !5
%11 = getelementptr inbounds i32, ptr %number, i64 44
store <4 x i32> <i32 44, i32 45, i32 46, i32 47>, ptr %11, align 16, !tbaa !5
%12 = getelementptr inbounds i32, ptr %number, i64 48
store <4 x i32> <i32 48, i32 49, i32 50, i32 51>, ptr %12, align 16, !tbaa !5
%13 = getelementptr inbounds i32, ptr %number, i64 52
store <4 x i32> <i32 52, i32 53, i32 54, i32 55>, ptr %13, align 16, !tbaa !5
%14 = getelementptr inbounds i32, ptr %number, i64 56
store <4 x i32> <i32 56, i32 57, i32 58, i32 59>, ptr %14, align 16, !tbaa !5
%15 = getelementptr inbounds i32, ptr %number, i64 60
store <4 x i32> <i32 60, i32 61, i32 62, i32 63>, ptr %15, align 16, !tbaa !5
%16 = getelementptr inbounds i32, ptr %number, i64 64
store <4 x i32> <i32 64, i32 65, i32 66, i32 67>, ptr %16, align 16, !tbaa !5
%17 = getelementptr inbounds i32, ptr %number, i64 68
store <4 x i32> <i32 68, i32 69, i32 70, i32 71>, ptr %17, align 16, !tbaa !5
%18 = getelementptr inbounds i32, ptr %number, i64 72
store <4 x i32> <i32 72, i32 73, i32 74, i32 75>, ptr %18, align 16, !tbaa !5
%19 = getelementptr inbounds i32, ptr %number, i64 76
store <4 x i32> <i32 76, i32 77, i32 78, i32 79>, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %number, i64 80
store <4 x i32> <i32 80, i32 81, i32 82, i32 83>, ptr %20, align 16, !tbaa !5
%21 = getelementptr inbounds i32, ptr %number, i64 84
store <4 x i32> <i32 84, i32 85, i32 86, i32 87>, ptr %21, align 16, !tbaa !5
%22 = getelementptr inbounds i32, ptr %number, i64 88
store <4 x i32> <i32 88, i32 89, i32 90, i32 91>, ptr %22, align 16, !tbaa !5
%23 = getelementptr inbounds i32, ptr %number, i64 92
store <4 x i32> <i32 92, i32 93, i32 94, i32 95>, ptr %23, align 16, !tbaa !5
%24 = getelementptr inbounds i32, ptr %number, i64 96
store <4 x i32> <i32 96, i32 97, i32 98, i32 99>, ptr %24, align 16, !tbaa !5
%25 = getelementptr inbounds i32, ptr %number, i64 100
store <4 x i32> <i32 100, i32 101, i32 102, i32 103>, ptr %25, align 16, !tbaa !5
%26 = getelementptr inbounds i32, ptr %number, i64 104
store <4 x i32> <i32 104, i32 105, i32 106, i32 107>, ptr %26, align 16, !tbaa !5
%27 = getelementptr inbounds i32, ptr %number, i64 108
store <4 x i32> <i32 108, i32 109, i32 110, i32 111>, ptr %27, align 16, !tbaa !5
%28 = getelementptr inbounds i32, ptr %number, i64 112
store <4 x i32> <i32 112, i32 113, i32 114, i32 115>, ptr %28, align 16, !tbaa !5
%29 = getelementptr inbounds i32, ptr %number, i64 116
store <4 x i32> <i32 116, i32 117, i32 118, i32 119>, ptr %29, align 16, !tbaa !5
%30 = getelementptr inbounds i32, ptr %number, i64 120
store <4 x i32> <i32 120, i32 121, i32 122, i32 123>, ptr %30, align 16, !tbaa !5
%31 = getelementptr inbounds i32, ptr %number, i64 124
store <4 x i32> <i32 124, i32 125, i32 126, i32 127>, ptr %31, align 16, !tbaa !5
%32 = getelementptr inbounds i32, ptr %number, i64 128
store <4 x i32> <i32 128, i32 129, i32 130, i32 131>, ptr %32, align 16, !tbaa !5
%33 = getelementptr inbounds i32, ptr %number, i64 132
store <4 x i32> <i32 132, i32 133, i32 134, i32 135>, ptr %33, align 16, !tbaa !5
%34 = getelementptr inbounds i32, ptr %number, i64 136
store <4 x i32> <i32 136, i32 137, i32 138, i32 139>, ptr %34, align 16, !tbaa !5
%35 = getelementptr inbounds i32, ptr %number, i64 140
store <4 x i32> <i32 140, i32 141, i32 142, i32 143>, ptr %35, align 16, !tbaa !5
%36 = getelementptr inbounds i32, ptr %number, i64 144
store <4 x i32> <i32 144, i32 145, i32 146, i32 147>, ptr %36, align 16, !tbaa !5
%37 = getelementptr inbounds i32, ptr %number, i64 148
store <4 x i32> <i32 148, i32 149, i32 150, i32 151>, ptr %37, align 16, !tbaa !5
%38 = getelementptr inbounds i32, ptr %number, i64 152
store <4 x i32> <i32 152, i32 153, i32 154, i32 155>, ptr %38, align 16, !tbaa !5
%39 = getelementptr inbounds i32, ptr %number, i64 156
store <4 x i32> <i32 156, i32 157, i32 158, i32 159>, ptr %39, align 16, !tbaa !5
%40 = getelementptr inbounds i32, ptr %number, i64 160
store <4 x i32> <i32 160, i32 161, i32 162, i32 163>, ptr %40, align 16, !tbaa !5
%41 = getelementptr inbounds i32, ptr %number, i64 164
store <4 x i32> <i32 164, i32 165, i32 166, i32 167>, ptr %41, align 16, !tbaa !5
%42 = getelementptr inbounds i32, ptr %number, i64 168
store <4 x i32> <i32 168, i32 169, i32 170, i32 171>, ptr %42, align 16, !tbaa !5
%43 = getelementptr inbounds i32, ptr %number, i64 172
store <4 x i32> <i32 172, i32 173, i32 174, i32 175>, ptr %43, align 16, !tbaa !5
%44 = getelementptr inbounds i32, ptr %number, i64 176
store <4 x i32> <i32 176, i32 177, i32 178, i32 179>, ptr %44, align 16, !tbaa !5
%45 = getelementptr inbounds i32, ptr %number, i64 180
store <4 x i32> <i32 180, i32 181, i32 182, i32 183>, ptr %45, align 16, !tbaa !5
%46 = getelementptr inbounds i32, ptr %number, i64 184
store <4 x i32> <i32 184, i32 185, i32 186, i32 187>, ptr %46, align 16, !tbaa !5
%47 = getelementptr inbounds i32, ptr %number, i64 188
store <4 x i32> <i32 188, i32 189, i32 190, i32 191>, ptr %47, align 16, !tbaa !5
%48 = getelementptr inbounds i32, ptr %number, i64 192
store <4 x i32> <i32 192, i32 193, i32 194, i32 195>, ptr %48, align 16, !tbaa !5
%49 = getelementptr inbounds i32, ptr %number, i64 196
store <4 x i32> <i32 196, i32 197, i32 198, i32 199>, ptr %49, align 16, !tbaa !5
%cmp317.i = icmp sgt i32 %0, 0
br i1 %cmp317.i, label %for.body5.i, label %input.exit
for.body5.i: ; preds = %entry, %for.body5.i
%i1.018.i = phi i32 [ %inc9.i, %for.body5.i ], [ 0, %entry ]
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a.i)
%50 = load i32, ptr %a.i, align 4, !tbaa !5
%idxprom6.i = sext i32 %50 to i64
%arrayidx7.i = getelementptr inbounds i32, ptr %number, i64 %idxprom6.i
store i32 0, ptr %arrayidx7.i, align 4, !tbaa !5
%inc9.i = add nuw nsw i32 %i1.018.i, 1
%exitcond20.not.i = icmp eq i32 %inc9.i, %0
br i1 %exitcond20.not.i, label %input.exit.loopexit, label %for.body5.i, !llvm.loop !9
input.exit.loopexit: ; preds = %for.body5.i
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %input.exit
input.exit: ; preds = %input.exit.loopexit, %entry
%51 = phi i32 [ %.pre, %input.exit.loopexit ], [ %0, %entry ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a.i) #6
%52 = load i32, ptr %x, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %51, 0
br i1 %cmp.not.i, label %work.exit, label %for.body.i4
for.body.i4: ; preds = %input.exit, %for.body.i4
%indvars.iv.i5 = phi i64 [ %indvars.iv.next.i7.1, %for.body.i4 ], [ 0, %input.exit ]
%min.017.i = phi i32 [ %spec.select15.i.1, %for.body.i4 ], [ 200, %input.exit ]
%r.016.i = phi i32 [ %spec.select.i.1, %for.body.i4 ], [ %52, %input.exit ]
%arrayidx.i6 = getelementptr inbounds i32, ptr %number, i64 %indvars.iv.i5
%53 = load i32, ptr %arrayidx.i6, align 8, !tbaa !5
%sub.i = sub nsw i32 %53, %52
%54 = call i32 @llvm.abs.i32(i32 %sub.i, i1 true)
%cmp2.i = icmp sgt i32 %min.017.i, %54
%55 = trunc i64 %indvars.iv.i5 to i32
%spec.select.i = select i1 %cmp2.i, i32 %55, i32 %r.016.i
%spec.select15.i = call i32 @llvm.smin.i32(i32 %min.017.i, i32 %54)
%indvars.iv.next.i7 = or i64 %indvars.iv.i5, 1
%arrayidx.i6.1 = getelementptr inbounds i32, ptr %number, i64 %indvars.iv.next.i7
%56 = load i32, ptr %arrayidx.i6.1, align 4, !tbaa !5
%sub.i.1 = sub nsw i32 %56, %52
%57 = call i32 @llvm.abs.i32(i32 %sub.i.1, i1 true)
%cmp2.i.1 = icmp sgt i32 %spec.select15.i, %57
%58 = trunc i64 %indvars.iv.next.i7 to i32
%spec.select.i.1 = select i1 %cmp2.i.1, i32 %58, i32 %spec.select.i
%spec.select15.i.1 = call i32 @llvm.smin.i32(i32 %spec.select15.i, i32 %57)
%indvars.iv.next.i7.1 = add nuw nsw i64 %indvars.iv.i5, 2
%exitcond.not.i8.1 = icmp eq i64 %indvars.iv.next.i7.1, 200
br i1 %exitcond.not.i8.1, label %work.exit, label %for.body.i4, !llvm.loop !11
work.exit: ; preds = %for.body.i4, %input.exit
%r.2.i = phi i32 [ %52, %input.exit ], [ %spec.select.i.1, %for.body.i4 ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %r.2.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %number) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @input(ptr nocapture noundef writeonly %number, i32 noundef %n) local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, ptr %number, align 4, !tbaa !5
%0 = getelementptr inbounds i32, ptr %number, i64 4
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, ptr %0, align 4, !tbaa !5
%1 = getelementptr inbounds i32, ptr %number, i64 8
store <4 x i32> <i32 8, i32 9, i32 10, i32 11>, ptr %1, align 4, !tbaa !5
%2 = getelementptr inbounds i32, ptr %number, i64 12
store <4 x i32> <i32 12, i32 13, i32 14, i32 15>, ptr %2, align 4, !tbaa !5
%3 = getelementptr inbounds i32, ptr %number, i64 16
store <4 x i32> <i32 16, i32 17, i32 18, i32 19>, ptr %3, align 4, !tbaa !5
%4 = getelementptr inbounds i32, ptr %number, i64 20
store <4 x i32> <i32 20, i32 21, i32 22, i32 23>, ptr %4, align 4, !tbaa !5
%5 = getelementptr inbounds i32, ptr %number, i64 24
store <4 x i32> <i32 24, i32 25, i32 26, i32 27>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds i32, ptr %number, i64 28
store <4 x i32> <i32 28, i32 29, i32 30, i32 31>, ptr %6, align 4, !tbaa !5
%7 = getelementptr inbounds i32, ptr %number, i64 32
store <4 x i32> <i32 32, i32 33, i32 34, i32 35>, ptr %7, align 4, !tbaa !5
%8 = getelementptr inbounds i32, ptr %number, i64 36
store <4 x i32> <i32 36, i32 37, i32 38, i32 39>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %number, i64 40
store <4 x i32> <i32 40, i32 41, i32 42, i32 43>, ptr %9, align 4, !tbaa !5
%10 = getelementptr inbounds i32, ptr %number, i64 44
store <4 x i32> <i32 44, i32 45, i32 46, i32 47>, ptr %10, align 4, !tbaa !5
%11 = getelementptr inbounds i32, ptr %number, i64 48
store <4 x i32> <i32 48, i32 49, i32 50, i32 51>, ptr %11, align 4, !tbaa !5
%12 = getelementptr inbounds i32, ptr %number, i64 52
store <4 x i32> <i32 52, i32 53, i32 54, i32 55>, ptr %12, align 4, !tbaa !5
%13 = getelementptr inbounds i32, ptr %number, i64 56
store <4 x i32> <i32 56, i32 57, i32 58, i32 59>, ptr %13, align 4, !tbaa !5
%14 = getelementptr inbounds i32, ptr %number, i64 60
store <4 x i32> <i32 60, i32 61, i32 62, i32 63>, ptr %14, align 4, !tbaa !5
%15 = getelementptr inbounds i32, ptr %number, i64 64
store <4 x i32> <i32 64, i32 65, i32 66, i32 67>, ptr %15, align 4, !tbaa !5
%16 = getelementptr inbounds i32, ptr %number, i64 68
store <4 x i32> <i32 68, i32 69, i32 70, i32 71>, ptr %16, align 4, !tbaa !5
%17 = getelementptr inbounds i32, ptr %number, i64 72
store <4 x i32> <i32 72, i32 73, i32 74, i32 75>, ptr %17, align 4, !tbaa !5
%18 = getelementptr inbounds i32, ptr %number, i64 76
store <4 x i32> <i32 76, i32 77, i32 78, i32 79>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds i32, ptr %number, i64 80
store <4 x i32> <i32 80, i32 81, i32 82, i32 83>, ptr %19, align 4, !tbaa !5
%20 = getelementptr inbounds i32, ptr %number, i64 84
store <4 x i32> <i32 84, i32 85, i32 86, i32 87>, ptr %20, align 4, !tbaa !5
%21 = getelementptr inbounds i32, ptr %number, i64 88
store <4 x i32> <i32 88, i32 89, i32 90, i32 91>, ptr %21, align 4, !tbaa !5
%22 = getelementptr inbounds i32, ptr %number, i64 92
store <4 x i32> <i32 92, i32 93, i32 94, i32 95>, ptr %22, align 4, !tbaa !5
%23 = getelementptr inbounds i32, ptr %number, i64 96
store <4 x i32> <i32 96, i32 97, i32 98, i32 99>, ptr %23, align 4, !tbaa !5
%24 = getelementptr inbounds i32, ptr %number, i64 100
store <4 x i32> <i32 100, i32 101, i32 102, i32 103>, ptr %24, align 4, !tbaa !5
%25 = getelementptr inbounds i32, ptr %number, i64 104
store <4 x i32> <i32 104, i32 105, i32 106, i32 107>, ptr %25, align 4, !tbaa !5
%26 = getelementptr inbounds i32, ptr %number, i64 108
store <4 x i32> <i32 108, i32 109, i32 110, i32 111>, ptr %26, align 4, !tbaa !5
%27 = getelementptr inbounds i32, ptr %number, i64 112
store <4 x i32> <i32 112, i32 113, i32 114, i32 115>, ptr %27, align 4, !tbaa !5
%28 = getelementptr inbounds i32, ptr %number, i64 116
store <4 x i32> <i32 116, i32 117, i32 118, i32 119>, ptr %28, align 4, !tbaa !5
%29 = getelementptr inbounds i32, ptr %number, i64 120
store <4 x i32> <i32 120, i32 121, i32 122, i32 123>, ptr %29, align 4, !tbaa !5
%30 = getelementptr inbounds i32, ptr %number, i64 124
store <4 x i32> <i32 124, i32 125, i32 126, i32 127>, ptr %30, align 4, !tbaa !5
%31 = getelementptr inbounds i32, ptr %number, i64 128
store <4 x i32> <i32 128, i32 129, i32 130, i32 131>, ptr %31, align 4, !tbaa !5
%32 = getelementptr inbounds i32, ptr %number, i64 132
store <4 x i32> <i32 132, i32 133, i32 134, i32 135>, ptr %32, align 4, !tbaa !5
%33 = getelementptr inbounds i32, ptr %number, i64 136
store <4 x i32> <i32 136, i32 137, i32 138, i32 139>, ptr %33, align 4, !tbaa !5
%34 = getelementptr inbounds i32, ptr %number, i64 140
store <4 x i32> <i32 140, i32 141, i32 142, i32 143>, ptr %34, align 4, !tbaa !5
%35 = getelementptr inbounds i32, ptr %number, i64 144
store <4 x i32> <i32 144, i32 145, i32 146, i32 147>, ptr %35, align 4, !tbaa !5
%36 = getelementptr inbounds i32, ptr %number, i64 148
store <4 x i32> <i32 148, i32 149, i32 150, i32 151>, ptr %36, align 4, !tbaa !5
%37 = getelementptr inbounds i32, ptr %number, i64 152
store <4 x i32> <i32 152, i32 153, i32 154, i32 155>, ptr %37, align 4, !tbaa !5
%38 = getelementptr inbounds i32, ptr %number, i64 156
store <4 x i32> <i32 156, i32 157, i32 158, i32 159>, ptr %38, align 4, !tbaa !5
%39 = getelementptr inbounds i32, ptr %number, i64 160
store <4 x i32> <i32 160, i32 161, i32 162, i32 163>, ptr %39, align 4, !tbaa !5
%40 = getelementptr inbounds i32, ptr %number, i64 164
store <4 x i32> <i32 164, i32 165, i32 166, i32 167>, ptr %40, align 4, !tbaa !5
%41 = getelementptr inbounds i32, ptr %number, i64 168
store <4 x i32> <i32 168, i32 169, i32 170, i32 171>, ptr %41, align 4, !tbaa !5
%42 = getelementptr inbounds i32, ptr %number, i64 172
store <4 x i32> <i32 172, i32 173, i32 174, i32 175>, ptr %42, align 4, !tbaa !5
%43 = getelementptr inbounds i32, ptr %number, i64 176
store <4 x i32> <i32 176, i32 177, i32 178, i32 179>, ptr %43, align 4, !tbaa !5
%44 = getelementptr inbounds i32, ptr %number, i64 180
store <4 x i32> <i32 180, i32 181, i32 182, i32 183>, ptr %44, align 4, !tbaa !5
%45 = getelementptr inbounds i32, ptr %number, i64 184
store <4 x i32> <i32 184, i32 185, i32 186, i32 187>, ptr %45, align 4, !tbaa !5
%46 = getelementptr inbounds i32, ptr %number, i64 188
store <4 x i32> <i32 188, i32 189, i32 190, i32 191>, ptr %46, align 4, !tbaa !5
%47 = getelementptr inbounds i32, ptr %number, i64 192
store <4 x i32> <i32 192, i32 193, i32 194, i32 195>, ptr %47, align 4, !tbaa !5
%48 = getelementptr inbounds i32, ptr %number, i64 196
store <4 x i32> <i32 196, i32 197, i32 198, i32 199>, ptr %48, align 4, !tbaa !5
%cmp317 = icmp sgt i32 %n, 0
br i1 %cmp317, label %for.body5, label %for.cond.cleanup4
for.cond.cleanup4: ; preds = %for.body5, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6
ret void
for.body5: ; preds = %entry, %for.body5
%i1.018 = phi i32 [ %inc9, %for.body5 ], [ 0, %entry ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a)
%49 = load i32, ptr %a, align 4, !tbaa !5
%idxprom6 = sext i32 %49 to i64
%arrayidx7 = getelementptr inbounds i32, ptr %number, i64 %idxprom6
store i32 0, ptr %arrayidx7, align 4, !tbaa !5
%inc9 = add nuw nsw i32 %i1.018, 1
%exitcond20.not = icmp eq i32 %inc9, %n
br i1 %exitcond20.not, label %for.cond.cleanup4, label %for.body5, !llvm.loop !9
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @work(ptr nocapture noundef readonly %number, i32 noundef %x, i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp.not = icmp eq i32 %n, 0
br i1 %cmp.not, label %if.end7, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body ], [ 0, %entry ]
%min.017 = phi i32 [ %spec.select15.1, %for.body ], [ 200, %entry ]
%r.016 = phi i32 [ %spec.select.1, %for.body ], [ %x, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %number, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%sub = sub nsw i32 %0, %x
%1 = tail call i32 @llvm.abs.i32(i32 %sub, i1 true)
%cmp2 = icmp sgt i32 %min.017, %1
%2 = trunc i64 %indvars.iv to i32
%spec.select = select i1 %cmp2, i32 %2, i32 %r.016
%spec.select15 = tail call i32 @llvm.smin.i32(i32 %min.017, i32 %1)
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %number, i64 %indvars.iv.next
%3 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%sub.1 = sub nsw i32 %3, %x
%4 = tail call i32 @llvm.abs.i32(i32 %sub.1, i1 true)
%cmp2.1 = icmp sgt i32 %spec.select15, %4
%5 = trunc i64 %indvars.iv.next to i32
%spec.select.1 = select i1 %cmp2.1, i32 %5, i32 %spec.select
%spec.select15.1 = tail call i32 @llvm.smin.i32(i32 %spec.select15, i32 %4)
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 200
br i1 %exitcond.not.1, label %if.end7, label %for.body, !llvm.loop !11
if.end7: ; preds = %for.body, %entry
%r.2 = phi i32 [ %x, %entry ], [ %spec.select.1, %for.body ]
ret i32 %r.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 speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, 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 = { 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<stdlib.h>
typedef long long ll;
int max(int a, int b){
if(a > b) return a;
else return b;
}
int min(int a, int b){
if(a < b) return a;
else return b;
}
int sort(const void *a ,const void *b){
return *(int*)a - *(int*)b;
}
int main(){
int x,n;
scanf("%d%d",&x,&n);
if(n == 0){
printf("%d",x);
return 0;
}
int p[n];
for(int i = 0; i < n; ++i){
scanf("%d",p+i);
}
int flag;
int tmp = 200;
int ans = 200;
for(int i = -100; i <= 101; ++i){
flag = 0;
if(i >= 0){
for(int j = 0; j < n; ++j){
if( i == p[j] ) flag = 1;
}
}
if(flag == 0){
if(tmp > abs(x-i)){
tmp = min(tmp,abs(x-i));
ans = i;
}else if(tmp == abs(x-i)){
if(ans > i) ans = i;
}
}
}
printf("%d",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295139/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295139/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; 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:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #1 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%x = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%1 = load i32, ptr %x, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
br label %cleanup
if.end: ; preds = %entry
%2 = zext i32 %0 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %2, align 16
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp262 = icmp sgt i32 %4, 0
br i1 %cmp262, label %for.body, label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.body, %if.end
%.lcssa = phi i32 [ %4, %if.end ], [ %16, %for.body ]
%.lcssa.fr = freeze i32 %.lcssa
%cmp1264 = icmp sgt i32 %.lcssa.fr, 0
%5 = load i32, ptr %x, align 4
br i1 %cmp1264, label %for.body8.us.preheader, label %for.body8
for.body8.us.preheader: ; preds = %for.cond5.preheader
%wide.trip.count = zext i32 %.lcssa.fr to i64
%min.iters.check = icmp ult i32 %.lcssa.fr, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.body8.us
for.body8.us: ; preds = %for.body8.us.preheader, %for.inc37.us
%i4.070.us = phi i32 [ %inc38.us, %for.inc37.us ], [ -100, %for.body8.us.preheader ]
%ans.069.us = phi i32 [ %ans.1.us, %for.inc37.us ], [ 200, %for.body8.us.preheader ]
%tmp.068.us = phi i32 [ %tmp.1.us, %for.inc37.us ], [ 200, %for.body8.us.preheader ]
%cmp9.us = icmp sgt i32 %i4.070.us, -1
br i1 %cmp9.us, label %for.body14.us.preheader, label %if.then23.us
for.body14.us.preheader: ; preds = %for.body8.us
br i1 %min.iters.check, label %for.body14.us.preheader88, label %vector.ph
vector.ph: ; preds = %for.body14.us.preheader
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %i4.070.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 ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%vec.phi83 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%6 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
%wide.load84 = load <4 x i32>, ptr %7, align 16, !tbaa !5
%8 = icmp eq <4 x i32> %broadcast.splat, %wide.load
%9 = icmp eq <4 x i32> %broadcast.splat, %wide.load84
%10 = select <4 x i1> %8, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi
%11 = select <4 x i1> %9, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi83
%index.next = add nuw i64 %index, 8
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.select.cmp.not = icmp ne <4 x i32> %10, zeroinitializer
%rdx.select.cmp8587 = icmp ne <4 x i32> %11, zeroinitializer
%rdx.select.cmp85 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp8587
%13 = bitcast <4 x i1> %rdx.select.cmp85 to i4
%.not = icmp ne i4 %13, 0
%rdx.select86 = zext i1 %.not to i32
br i1 %cmp.n, label %for.cond11.if.end21_crit_edge.us, label %for.body14.us.preheader88
for.body14.us.preheader88: ; preds = %for.body14.us.preheader, %middle.block
%indvars.iv74.ph = phi i64 [ 0, %for.body14.us.preheader ], [ %n.vec, %middle.block ]
%flag.065.us.ph = phi i32 [ 0, %for.body14.us.preheader ], [ %rdx.select86, %middle.block ]
br label %for.body14.us
if.then23.us: ; preds = %for.cond11.if.end21_crit_edge.us, %for.body8.us
%sub.us = sub nsw i32 %5, %i4.070.us
%14 = call i32 @llvm.abs.i32(i32 %sub.us, i1 true)
%cmp24.us = icmp sgt i32 %tmp.068.us, %14
br i1 %cmp24.us, label %for.inc37.us, label %if.else.us
if.else.us: ; preds = %if.then23.us
%cmp29.us = icmp eq i32 %tmp.068.us, %14
%cmp31.us = icmp sgt i32 %ans.069.us, %i4.070.us
%or.cond.us = select i1 %cmp29.us, i1 %cmp31.us, i1 false
%spec.select59.us = select i1 %or.cond.us, i32 %i4.070.us, i32 %ans.069.us
br label %for.inc37.us
for.inc37.us: ; preds = %if.else.us, %if.then23.us, %for.cond11.if.end21_crit_edge.us
%tmp.1.us = phi i32 [ %tmp.068.us, %for.cond11.if.end21_crit_edge.us ], [ %tmp.068.us, %if.else.us ], [ %14, %if.then23.us ]
%ans.1.us = phi i32 [ %ans.069.us, %for.cond11.if.end21_crit_edge.us ], [ %spec.select59.us, %if.else.us ], [ %i4.070.us, %if.then23.us ]
%inc38.us = add nsw i32 %i4.070.us, 1
%exitcond78.not = icmp eq i32 %inc38.us, 102
br i1 %exitcond78.not, label %for.cond.cleanup7, label %for.body8.us, !llvm.loop !13
for.body14.us: ; preds = %for.body14.us.preheader88, %for.body14.us
%indvars.iv74 = phi i64 [ %indvars.iv.next75, %for.body14.us ], [ %indvars.iv74.ph, %for.body14.us.preheader88 ]
%flag.065.us = phi i32 [ %spec.select.us, %for.body14.us ], [ %flag.065.us.ph, %for.body14.us.preheader88 ]
%arrayidx.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv74
%15 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
%cmp15.us = icmp eq i32 %i4.070.us, %15
%spec.select.us = select i1 %cmp15.us, i32 1, i32 %flag.065.us
%indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
%exitcond77.not = icmp eq i64 %indvars.iv.next75, %wide.trip.count
br i1 %exitcond77.not, label %for.cond11.if.end21_crit_edge.us, label %for.body14.us, !llvm.loop !14
for.cond11.if.end21_crit_edge.us: ; preds = %for.body14.us, %middle.block
%spec.select.us.lcssa = phi i32 [ %rdx.select86, %middle.block ], [ %spec.select.us, %for.body14.us ]
%cmp22.us = icmp eq i32 %spec.select.us.lcssa, 0
br i1 %cmp22.us, label %if.then23.us, label %for.inc37.us
for.body: ; preds = %if.end, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %if.end ]
%add.ptr = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%16 = load i32, ptr %n, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %17
br i1 %cmp2, label %for.body, label %for.cond5.preheader, !llvm.loop !15
for.cond.cleanup7: ; preds = %for.body8, %for.inc37.us
%.us-phi = phi i32 [ %ans.1.us, %for.inc37.us ], [ %ans.1.1, %for.body8 ]
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.us-phi)
call void @llvm.stackrestore.p0(ptr %3)
br label %cleanup
for.body8: ; preds = %for.cond5.preheader, %for.body8
%i4.070 = phi i32 [ %inc38.1, %for.body8 ], [ -100, %for.cond5.preheader ]
%ans.069 = phi i32 [ %ans.1.1, %for.body8 ], [ 200, %for.cond5.preheader ]
%tmp.068 = phi i32 [ %tmp.1.1, %for.body8 ], [ 200, %for.cond5.preheader ]
%sub = sub nsw i32 %5, %i4.070
%18 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%cmp24 = icmp sgt i32 %tmp.068, %18
%cmp29 = icmp eq i32 %tmp.068, %18
%cmp31 = icmp sgt i32 %ans.069, %i4.070
%or.cond = select i1 %cmp29, i1 %cmp31, i1 false
%tmp.1 = call i32 @llvm.smin.i32(i32 %tmp.068, i32 %18)
%19 = select i1 %cmp24, i1 true, i1 %or.cond
%ans.1 = select i1 %19, i32 %i4.070, i32 %ans.069
%inc38 = or i32 %i4.070, 1
%sub.1 = sub nsw i32 %5, %inc38
%20 = call i32 @llvm.abs.i32(i32 %sub.1, i1 true)
%cmp24.1 = icmp sgt i32 %tmp.1, %20
%cmp29.1 = icmp eq i32 %tmp.1, %20
%cmp31.1 = icmp sgt i32 %ans.1, %inc38
%or.cond.1 = select i1 %cmp29.1, i1 %cmp31.1, i1 false
%tmp.1.1 = call i32 @llvm.smin.i32(i32 %tmp.1, i32 %20)
%21 = select i1 %cmp24.1, i1 true, i1 %or.cond.1
%ans.1.1 = select i1 %21, i32 %inc38, i32 %ans.1
%inc38.1 = add nsw i32 %i4.070, 2
%exitcond.not.1 = icmp eq i32 %inc38.1, 102
br i1 %exitcond.not.1, label %for.cond.cleanup7, label %for.body8, !llvm.loop !13
cleanup: ; preds = %for.cond.cleanup7, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
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 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = !{!"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, !12, !11}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int main(){
int n,m,d,i,b[100010]={};
scanf("%d %d",&n,&m);
for(i=0;i<m;i++){
scanf("%d",&d);
b[d]=1;
}
for(i=0;1;i++){
if(b[n-i]==0){
printf("%d\n",n-i);
return 0;
}
if(b[n+i]==0){
printf("%d\n",n+i);
return 0;
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295182/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295182/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%d = alloca i32, align 4
%b = alloca [100010 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 %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 400040, ptr nonnull %b) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400040) %b, i8 0, i64 400040, i1 false)
%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 !5
%cmp30 = icmp sgt i32 %0, 0
br i1 %cmp30, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr %n, align 4, !tbaa !5
%idxprom432 = sext i32 %1 to i64
%arrayidx533 = getelementptr inbounds [100010 x i32], ptr %b, i64 0, i64 %idxprom432
%2 = load i32, ptr %arrayidx533, align 4, !tbaa !5
%cmp634 = icmp eq i32 %2, 0
br i1 %cmp634, label %cleanup, label %if.end
for.body: ; preds = %entry, %for.body
%i.031 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d)
%3 = load i32, ptr %d, align 4, !tbaa !5
%idxprom = sext i32 %3 to i64
%arrayidx = getelementptr inbounds [100010 x i32], ptr %b, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.031, 1
%4 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond2: ; preds = %if.end
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%5 = sub nsw i64 %idxprom432, %indvars.iv.next
%arrayidx5 = getelementptr inbounds [100010 x i32], ptr %b, i64 0, i64 %5
%6 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %6, 0
br i1 %cmp6, label %if.then.loopexit, label %if.end
if.then.loopexit: ; preds = %for.cond2
%7 = trunc i64 %5 to i32
br label %cleanup
if.end: ; preds = %for.cond2.preheader, %for.cond2
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond2 ], [ 0, %for.cond2.preheader ]
%8 = add nsw i64 %indvars.iv, %idxprom432
%arrayidx10 = getelementptr inbounds [100010 x i32], ptr %b, i64 0, i64 %8
%9 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %9, 0
br i1 %cmp11, label %if.then12, label %for.cond2
if.then12: ; preds = %if.end
%10 = trunc i64 %8 to i32
br label %cleanup
cleanup: ; preds = %for.cond2.preheader, %if.then.loopexit, %if.then12
%.sink = phi i32 [ %10, %if.then12 ], [ %1, %for.cond2.preheader ], [ %7, %if.then.loopexit ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.sink)
call void @llvm.lifetime.end.p0(i64 400040, ptr nonnull %b) #4
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: 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: 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) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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<string.h>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;i++)
int gcd(int a, int b){
int r=1;
while(r!=0){
r=a%b;
a=b;
b=r;
}
return a;
}
void revStr(char* str){
int size = strlen(str);
int i,j;
char tmp = {0};
for(i = 0, j = size - 1; i < size / 2; i++, j--){
tmp = str[i];
str[i] = str[j];
str[j] = tmp;
}return;
}
struct data{
int a,b,c;
};
//降順
int compare_int(const void *a, const void *b)
{
return *(int*)b - *(int*)a;
}
#define MAXSIZE 200000
int list[MAXSIZE];
int tail;
void Init(void){
tail=0;
}
int Top(void){
return 0;
}
int Next(int pos){
if(pos<tail-1){
return pos+1;
}else{
return -1;
}
}
int Count(void){
return tail;
}
int Item(int pos){
if((pos>=0)&&(pos<tail)){
return list[pos];
}else{
return 0;
}
}
void Add(int value){
if(tail<MAXSIZE){
list[tail]=value;
tail++;
}
}
void Delete(int pos){
if((pos>=0)&&(pos<tail)){
int i;
for(i=pos;i<tail-1;i++){
list[i]=list[i+1];
}
tail--;
}
}
int main(){
long long N,K;
scanf("%lld%lld",&N,&K);
long long min=0;
long long minn=0;
min=N%K;
minn=K-min;
(min<=minn)?printf("%lld",min):printf("%lld",minn);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295232/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295232/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"
@tail = dso_local local_unnamed_addr global i32 0, align 4
@list = dso_local local_unnamed_addr global [200000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
br label %while.body
while.body: ; preds = %entry, %while.body
%b.addr.05 = phi i32 [ %b, %entry ], [ %rem, %while.body ]
%a.addr.04 = phi i32 [ %a, %entry ], [ %b.addr.05, %while.body ]
%rem = srem i32 %a.addr.04, %b.addr.05
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body
ret i32 %b.addr.05
}
; 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 memory(argmem: readwrite) uwtable
define dso_local void @revStr(ptr nocapture noundef %str) local_unnamed_addr #2 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #13
%conv = trunc i64 %call to i32
%cmp18 = icmp sgt i32 %conv, 1
br i1 %cmp18, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%div2627 = lshr i64 %call, 1
%sext = shl i64 %call, 32
%0 = ashr exact i64 %sext, 32
%wide.trip.count = and i64 %div2627, 2147483647
%xtraiter = and i64 %div2627, 1
%1 = icmp eq i64 %wide.trip.count, 1
br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = sub nsw i64 %wide.trip.count, %xtraiter
%invariant.gep = getelementptr i8, ptr %str, i64 -1
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv21 = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next22.1, %for.body ]
%indvars.iv = phi i64 [ %0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %indvars.iv21
%2 = load i8, ptr %arrayidx, align 1, !tbaa !7
%gep = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv
%3 = load i8, ptr %gep, align 1, !tbaa !7
store i8 %3, ptr %arrayidx, align 1, !tbaa !7
store i8 %2, ptr %gep, align 1, !tbaa !7
%indvars.iv.next22 = or i64 %indvars.iv21, 1
%indvars.iv.next.1 = add nsw i64 %indvars.iv, -2
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next22
%4 = load i8, ptr %arrayidx.1, align 1, !tbaa !7
%arrayidx3.1 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.1
%5 = load i8, ptr %arrayidx3.1, align 1, !tbaa !7
store i8 %5, ptr %arrayidx.1, align 1, !tbaa !7
store i8 %4, ptr %arrayidx3.1, align 1, !tbaa !7
%indvars.iv.next22.1 = add nuw nsw i64 %indvars.iv21, 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 !10
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv21.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next22.1, %for.body ]
%indvars.iv.unr = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %indvars.iv21.unr
%6 = load i8, ptr %arrayidx.epil, align 1, !tbaa !7
%7 = getelementptr i8, ptr %str, i64 %indvars.iv.unr
%arrayidx3.epil = getelementptr i8, ptr %7, i64 -1
%8 = load i8, ptr %arrayidx3.epil, align 1, !tbaa !7
store i8 %8, ptr %arrayidx.epil, align 1, !tbaa !7
store i8 %6, ptr %arrayidx3.epil, align 1, !tbaa !7
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !11
%1 = load i32, ptr %a, align 4, !tbaa !11
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @Init() local_unnamed_addr #5 {
entry:
store i32 0, ptr @tail, align 4, !tbaa !11
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @Top() local_unnamed_addr #6 {
entry:
ret i32 0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Next(i32 noundef %pos) local_unnamed_addr #7 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !11
%sub = add nsw i32 %0, -1
%cmp = icmp sgt i32 %sub, %pos
%add = add nsw i32 %pos, 1
%retval.0 = select i1 %cmp, i32 %add, i32 -1
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Count() local_unnamed_addr #7 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !11
ret i32 %0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Item(i32 noundef %pos) local_unnamed_addr #7 {
entry:
%cmp = icmp sgt i32 %pos, -1
%0 = load i32, ptr @tail, align 4
%cmp1 = icmp sgt i32 %0, %pos
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %if.then, label %return
if.then: ; preds = %entry
%idxprom = zext i32 %pos to i64
%arrayidx = getelementptr inbounds [200000 x i32], ptr @list, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !11
br label %return
return: ; preds = %entry, %if.then
%retval.0 = phi i32 [ %1, %if.then ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @Add(i32 noundef %value) local_unnamed_addr #8 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !11
%cmp = icmp slt i32 %0, 200000
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [200000 x i32], ptr @list, i64 0, i64 %idxprom
store i32 %value, ptr %arrayidx, align 4, !tbaa !11
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @tail, align 4, !tbaa !11
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @Delete(i32 noundef %pos) local_unnamed_addr #9 {
entry:
%cmp = icmp sgt i32 %pos, -1
%0 = load i32, ptr @tail, align 4
%cmp1 = icmp sgt i32 %0, %pos
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %for.cond.preheader, label %if.end
for.cond.preheader: ; preds = %entry
%sub = add nsw i32 %0, -1
%cmp210 = icmp sgt i32 %sub, %pos
br i1 %cmp210, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %for.cond.preheader
%1 = zext i32 %pos to i64
%wide.trip.count = sext i32 %sub to i64
%2 = sub nsw i64 %wide.trip.count, %1
%min.iters.check = icmp ult i64 %2, 8
br i1 %min.iters.check, label %for.body.preheader15, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %2, -8
%ind.end = add nsw i64 %n.vec, %1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = add i64 %index, %1
%3 = add nuw nsw i64 %offset.idx, 1
%4 = getelementptr inbounds [200000 x i32], ptr @list, i64 0, i64 %3
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !11
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load14 = load <4 x i32>, ptr %5, align 4, !tbaa !11
%6 = getelementptr inbounds [200000 x i32], ptr @list, i64 0, i64 %offset.idx
store <4 x i32> %wide.load, ptr %6, align 4, !tbaa !11
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load14, ptr %7, align 4, !tbaa !11
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %2, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader15
for.body.preheader15: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader15, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader15 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [200000 x i32], ptr @list, i64 0, i64 %indvars.iv.next
%9 = load i32, ptr %arrayidx, align 4, !tbaa !11
%arrayidx4 = getelementptr inbounds [200000 x i32], ptr @list, i64 0, i64 %indvars.iv
store i32 %9, ptr %arrayidx4, align 4, !tbaa !11
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !16
for.end: ; preds = %for.body, %middle.block, %for.cond.preheader
store i32 %sub, ptr @tail, align 4, !tbaa !11
br label %if.end
if.end: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #10 {
entry:
%N = alloca i64, align 8
%K = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #14
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %K) #14
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i64, ptr %N, align 8, !tbaa !17
%1 = load i64, ptr %K, align 8, !tbaa !17
%rem = srem i64 %0, %1
%sub = sub nsw i64 %1, %rem
%sub.rem = call i64 @llvm.smin.i64(i64 %rem, i64 %sub)
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub.rem)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #14
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #14
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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #12
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 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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #13 = { nounwind willreturn memory(read) }
attributes #14 = { 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 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = distinct !{!10, !6}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = distinct !{!13, !6, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !6, !15, !14}
!17 = !{!18, !18, i64 0}
!18 = !{!"long long", !8, i64 0}
|
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#define LINE_BUF_SIZE 1024
int main(void) {
int i;
long long int N,K;
long long int t = 0;
scanf("%lld %lld",&N,&K);
t = N % K;
if(t >= K - t){
printf("%lld",K - t);
}else{
printf("%lld",t);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295276/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295276/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
%K = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i64, ptr %N, align 8, !tbaa !5
%1 = load i64, ptr %K, align 8, !tbaa !5
%rem = srem i64 %0, %1
%sub = sub nsw i64 %1, %rem
%rem.sub = call i64 @llvm.smin.i64(i64 %rem, i64 %sub)
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %rem.sub)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
// 内部変数
static FILE *szpFpI; // 入力
// 内部変数 - テスト用
#ifdef D_TEST
static int siRes;
static FILE *szpFpA;
static int siTNo;
#endif
// 1行出力
int
fOutLine(
char *pcpLine // <I> 1行
)
{
char lc1Buf[1024];
#ifdef D_TEST
lc1Buf[0] = '\0';
fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
if (strcmp(lc1Buf, pcpLine)) {
siRes = -1;
}
#else
printf("%s", pcpLine);
#endif
return 0;
}
// 実行メイン
int
fMain(
)
{
char lc1Buf[1024];
// 入力値 - 取得
long long llN, llK;
fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
sscanf(lc1Buf, "%lld%lld", &llN, &llK);
// 最小値 - 取得
llN %= llK;
long long llMin = llN;
long long llVal = llK - llN;
if (llMin > llVal) {
llMin = llVal;
}
// 出力
sprintf(lc1Buf, "%lld\n", llMin);
fOutLine(lc1Buf);
return 0;
}
// 1回実行
int
fOne(
)
{
int liRet;
char lc1Buf[1024];
// 入力 - セット
#ifdef D_TEST
sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
szpFpI = fopen(lc1Buf, "r");
sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
szpFpA = fopen(lc1Buf, "r");
siRes = 0;
#else
szpFpI = stdin;
#endif
// 実行メイン
liRet = fMain();
// 残データ有無
#ifdef D_TEST
lc1Buf[0] = '\0';
fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
if (strcmp(lc1Buf, "")) {
siRes = -1;
}
#endif
// テストファイルクローズ
#ifdef D_TEST
fclose(szpFpI);
fclose(szpFpA);
#endif
// テスト結果
#ifdef D_TEST
if (siRes == 0) {
printf("OK %d\n", siTNo);
}
else {
printf("NG %d\n", siTNo);
}
#endif
return 0;
}
// プログラム開始
int
main()
{
#ifdef D_TEST
int i;
for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
siTNo = i;
fOne();
}
#else
fOne();
#endif
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295319/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295319/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
@szpFpI = internal unnamed_addr global ptr null, align 8
@.str.1 = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @fOutLine(ptr noundef %pcpLine) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %pcpLine)
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 @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 uwtable
define dso_local i32 @fMain() local_unnamed_addr #0 {
entry:
%lc1Buf = alloca [1024 x i8], align 16
%llN = alloca i64, align 8
%llK = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Buf) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %llN) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %llK) #4
%0 = load ptr, ptr @szpFpI, align 8, !tbaa !5
%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.1, ptr noundef nonnull %llN, ptr noundef nonnull %llK) #4
%1 = load i64, ptr %llK, align 8, !tbaa !9
%2 = load i64, ptr %llN, align 8, !tbaa !9
%rem = srem i64 %2, %1
store i64 %rem, ptr %llN, align 8, !tbaa !9
%sub = sub nsw i64 %1, %rem
%spec.select = call i64 @llvm.smin.i64(i64 %rem, i64 %sub)
%call4 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %lc1Buf, ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %spec.select) #4
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %lc1Buf)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %llK) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %llN) #4
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Buf) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @fOne() local_unnamed_addr #0 {
entry:
%lc1Buf.i = alloca [1024 x i8], align 16
%llN.i = alloca i64, align 8
%llK.i = alloca i64, align 8
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
store ptr %0, ptr @szpFpI, align 8, !tbaa !5
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Buf.i) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %llN.i) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %llK.i) #4
%call.i = call ptr @fgets(ptr noundef nonnull %lc1Buf.i, i32 noundef 1024, ptr noundef %0)
%call2.i = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %lc1Buf.i, ptr noundef nonnull @.str.1, ptr noundef nonnull %llN.i, ptr noundef nonnull %llK.i) #4
%1 = load i64, ptr %llK.i, align 8, !tbaa !9
%2 = load i64, ptr %llN.i, align 8, !tbaa !9
%rem.i = srem i64 %2, %1
store i64 %rem.i, ptr %llN.i, align 8, !tbaa !9
%sub.i = sub nsw i64 %1, %rem.i
%spec.select.i = call i64 @llvm.smin.i64(i64 %rem.i, i64 %sub.i)
%call4.i = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %lc1Buf.i, ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %spec.select.i) #4
%call.i.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %lc1Buf.i)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %llK.i) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %llN.i) #4
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Buf.i) #4
ret i32 0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%lc1Buf.i.i = alloca [1024 x i8], align 16
%llN.i.i = alloca i64, align 8
%llK.i.i = alloca i64, align 8
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
store ptr %0, ptr @szpFpI, align 8, !tbaa !5
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Buf.i.i) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %llN.i.i) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %llK.i.i) #4
%call.i.i = call ptr @fgets(ptr noundef nonnull %lc1Buf.i.i, i32 noundef 1024, ptr noundef %0)
%call2.i.i = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %lc1Buf.i.i, ptr noundef nonnull @.str.1, ptr noundef nonnull %llN.i.i, ptr noundef nonnull %llK.i.i) #4
%1 = load i64, ptr %llK.i.i, align 8, !tbaa !9
%2 = load i64, ptr %llN.i.i, align 8, !tbaa !9
%rem.i.i = srem i64 %2, %1
store i64 %rem.i.i, ptr %llN.i.i, align 8, !tbaa !9
%sub.i.i = sub nsw i64 %1, %rem.i.i
%spec.select.i.i = call i64 @llvm.smin.i64(i64 %rem.i.i, i64 %sub.i.i)
%call4.i.i = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %lc1Buf.i.i, ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %spec.select.i.i) #4
%call.i.i.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %lc1Buf.i.i)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %llK.i.i) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %llN.i.i) #4
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Buf.i.i) #4
ret i32 0
}
; 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 = !{!"any pointer", !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}
|
#include<stdio.h>
#include<math.h>
int main()
{
unsigned long long int K,N,t,a;
scanf("%lld%lld",&N,&K);
if(K==0) a=N;
else{
t=N%K;
if(t*2>K) a=K-t;
else a=t;
}
printf("%lld",a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295377/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295377/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:
%K = alloca i64, align 8
%N = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %K) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i64, ptr %K, align 8, !tbaa !5
%cmp = icmp eq i64 %0, 0
%1 = load i64, ptr %N, align 8, !tbaa !5
br i1 %cmp, label %if.end4, label %if.else
if.else: ; preds = %entry
%rem = urem i64 %1, %0
%mul = shl i64 %rem, 1
%cmp1 = icmp ugt i64 %mul, %0
%sub = sub i64 %0, %rem
%spec.select = select i1 %cmp1, i64 %sub, i64 %rem
br label %if.end4
if.end4: ; preds = %entry, %if.else
%a.0 = phi i64 [ %spec.select, %if.else ], [ %1, %entry ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %a.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #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 <math.h>
#include <stdio.h>
#include <stdlib.h>
long long abs_ll (long long num) {
if ( num < 0 )
return num * -1;
return num;
}
int main (void) {
long long n, k;
scanf("%lld%lld", &n, &k);
long long ans = n % k;
if ( ans > abs_ll(ans - k) )
ans = abs_ll(ans - k);
printf("%lld\n", ans);
return EXIT_SUCCESS;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295427/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295427/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 [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @abs_ll(i64 noundef %num) local_unnamed_addr #0 {
entry:
%retval.0 = tail call i64 @llvm.abs.i64(i64 %num, i1 true)
ret i64 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i64, align 8
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #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 %n, ptr noundef nonnull %k)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = load i64, ptr %k, align 8, !tbaa !5
%rem = srem i64 %0, %1
%sub = sub nsw i64 %rem, %1
%retval.0.i = call i64 @llvm.abs.i64(i64 %sub, i1 true)
%spec.select = call i64 @llvm.smin.i64(i64 %rem, i64 %retval.0.i)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %spec.select)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 8, 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 i64 @llvm.abs.i64(i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int min(const int a, const int b);
inline int min(const int a, const int b)
{
return a > b ? b : a;
}
int main()
{
int n, k, c[2] = {0};
scanf("%d %d\n", &n, &k);
char s[100008];
fread(s, sizeof(s), 1, stdin);
char last = s[0];
for (int i = 1; i < n; i++)
{
c[s[i] == last] ++;
last = s[i];
}
c[1] += min(c[0], 2 * k);
printf("%d", c[1]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295478/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295478/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\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: inlinehint 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:
%n = alloca i32, align 4
%k = alloca i32, align 4
%c = alloca [2 x i32], align 8
%s = alloca [100008 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #5
store i64 0, ptr %c, align 8
%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 100008, ptr nonnull %s) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call1 = call i64 @fread(ptr noundef nonnull %s, i64 noundef 100008, i64 noundef 1, ptr noundef %0)
%1 = load i32, ptr %n, align 4, !tbaa !9
%cmp19 = icmp sgt i32 %1, 1
br i1 %cmp19, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %1 to i64
%last.0.pre = load i8, ptr %s, align 16, !tbaa !11
%2 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %2, 1
%3 = icmp eq i32 %1, 2
br i1 %3, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %2, -2
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%last.0.unr = phi i8 [ %last.0.pre, %for.body.preheader ], [ %11, %for.body ]
%indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup.loopexit, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa
%arrayidx2.epil = getelementptr inbounds [100008 x i8], ptr %s, i64 0, i64 %indvars.iv.unr
%4 = load i8, ptr %arrayidx2.epil, align 1, !tbaa !11
%cmp4.epil = icmp eq i8 %4, %last.0.unr
%idxprom6.epil = zext i1 %cmp4.epil to i64
%arrayidx7.epil = getelementptr inbounds [2 x i32], ptr %c, i64 0, i64 %idxprom6.epil
%5 = load i32, ptr %arrayidx7.epil, align 4, !tbaa !9
%inc.epil = add nsw i32 %5, 1
store i32 %inc.epil, ptr %arrayidx7.epil, align 4, !tbaa !9
br label %for.cond.cleanup.loopexit
for.cond.cleanup.loopexit: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%.pre = load i32, ptr %c, align 8, !tbaa !9
%arrayidx13.phi.trans.insert = getelementptr inbounds [2 x i32], ptr %c, i64 0, i64 1
%.pre24 = load i32, ptr %arrayidx13.phi.trans.insert, align 4, !tbaa !9
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
%6 = phi i32 [ %.pre24, %for.cond.cleanup.loopexit ], [ 0, %entry ]
%7 = phi i32 [ %.pre, %for.cond.cleanup.loopexit ], [ 0, %entry ]
%8 = load i32, ptr %k, align 4, !tbaa !9
%mul = shl nsw i32 %8, 1
%cond.i = call i32 @llvm.smin.i32(i32 %7, i32 %mul)
%add = add nsw i32 %cond.i, %6
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 100008, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #5
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
for.body: ; preds = %for.body, %for.body.preheader.new
%last.0 = phi i8 [ %last.0.pre, %for.body.preheader.new ], [ %11, %for.body ]
%indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%arrayidx2 = getelementptr inbounds [100008 x i8], ptr %s, i64 0, i64 %indvars.iv
%9 = load i8, ptr %arrayidx2, align 1, !tbaa !11
%cmp4 = icmp eq i8 %9, %last.0
%idxprom6 = zext i1 %cmp4 to i64
%arrayidx7 = getelementptr inbounds [2 x i32], ptr %c, i64 0, i64 %idxprom6
%10 = load i32, ptr %arrayidx7, align 4, !tbaa !9
%inc = add nsw i32 %10, 1
store i32 %inc, ptr %arrayidx7, align 4, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx2.1 = getelementptr inbounds [100008 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%11 = load i8, ptr %arrayidx2.1, align 1, !tbaa !11
%cmp4.1 = icmp eq i8 %11, %9
%idxprom6.1 = zext i1 %cmp4.1 to i64
%arrayidx7.1 = getelementptr inbounds [2 x i32], ptr %c, i64 0, i64 %idxprom6.1
%12 = load i32, ptr %arrayidx7.1, align 4, !tbaa !9
%inc.1 = add nsw i32 %12, 1
store i32 %inc.1, ptr %arrayidx7.1, align 4, !tbaa !9
%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.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !12
}
; 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 i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, 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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { inlinehint 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 = !{!"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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#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<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)
char s[100010];
int main(){
int n,k;
scanf("%d%d%s",&n,&k,s);
int cnt=0;
int i=0;
while(i<n){
while(i<n&&s[i]=='R')i++;
while(i<n&&s[i]=='L')i++;
cnt++;
}
ll temp=min(k,max(cnt-2,0));
k-=temp;
cnt-=temp;
ll ans=1e9;
if(cnt>2){
//kが足りない
ans=n-cnt*2+(s[0]=='L')+(s[n-1]=='R');
}else if(cnt==2){
int aaa=(s[0]=='L')+(s[n-1]=='R');
if(aaa==2){
if(k)ans=n-1;
else ans=n-2;
}else if(aaa==1){
if(k)ans=n-1;
else ans=n-3;
}else{
if(k>=2)ans=n-1;
else if(k==1)ans=n-2;
else ans=n-4;
}
}else if(cnt==1){
if(s[0]!=s[n-1]&&k==0)ans=n-2;
else ans=n-1;
}
printf("%d",ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295520/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295520/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%s\00", align 1
@s = dso_local global [100010 x i8] zeroinitializer, align 16
@.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 @upll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
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) #0 {
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 #1 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #7
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #1 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @downll) #7
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @pom(i64 noundef %a, i64 noundef %n, i32 noundef %m) local_unnamed_addr #3 {
entry:
%conv = sext i32 %m to i64
%tobool.not16 = icmp eq i64 %n, 0
br i1 %tobool.not16, label %for.end, label %for.body
for.body: ; preds = %entry, %cond.end
%mul4.pn = phi i64 [ %mul4, %cond.end ], [ %a, %entry ]
%x.018 = phi i64 [ %x.1, %cond.end ], [ 1, %entry ]
%n.addr.017 = phi i64 [ %div, %cond.end ], [ %n, %entry ]
%a.addr.019 = srem i64 %mul4.pn, %conv
%and = and i64 %n.addr.017, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %cond.end, label %cond.true
cond.true: ; preds = %for.body
%mul = mul nsw i64 %a.addr.019, %x.018
%rem3 = srem i64 %mul, %conv
br label %cond.end
cond.end: ; preds = %for.body, %cond.true
%x.1 = phi i64 [ %rem3, %cond.true ], [ %x.018, %for.body ]
%mul4 = mul nsw i64 %a.addr.019, %a.addr.019
%div = sdiv i64 %n.addr.017, 2
%n.addr.017.off = add i64 %n.addr.017, 1
%tobool.not = icmp ult i64 %n.addr.017.off, 3
br i1 %tobool.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %cond.end, %entry
%x.0.lcssa = phi i64 [ 1, %entry ], [ %x.1, %cond.end ]
ret i64 %x.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%k = 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 %k) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k, ptr noundef nonnull @s)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp157 = icmp sgt i32 %0, 0
br i1 %cmp157, label %while.cond1.preheader.preheader, label %while.end20
while.cond1.preheader.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
br label %while.cond1.preheader
while.cond1.preheader: ; preds = %while.cond1.preheader.preheader, %while.end18
%cnt.0159 = phi i32 [ %inc19, %while.end18 ], [ 0, %while.cond1.preheader.preheader ]
%i.0158 = phi i32 [ %i.2.lcssa, %while.end18 ], [ 0, %while.cond1.preheader.preheader ]
%2 = sext i32 %i.0158 to i64
br label %land.rhs
land.rhs: ; preds = %while.cond1.preheader, %while.body5
%indvars.iv = phi i64 [ %2, %while.cond1.preheader ], [ %indvars.iv.next, %while.body5 ]
%arrayidx = getelementptr inbounds [100010 x i8], ptr @s, i64 0, i64 %indvars.iv
%3 = load i8, ptr %arrayidx, align 1, !tbaa !13
%cmp3 = icmp eq i8 %3, 82
br i1 %cmp3, label %while.body5, label %while.end
while.body5: ; preds = %land.rhs
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%cmp2 = icmp slt i64 %indvars.iv.next, %1
br i1 %cmp2, label %land.rhs, label %while.end18.thread, !llvm.loop !14
while.end: ; preds = %land.rhs
%4 = trunc i64 %indvars.iv to i32
%cmp7154 = icmp sgt i32 %0, %4
br i1 %cmp7154, label %land.rhs9.preheader, label %while.end18
land.rhs9.preheader: ; preds = %while.end
%sext = shl i64 %indvars.iv, 32
%5 = ashr exact i64 %sext, 32
br label %land.rhs9
land.rhs9: ; preds = %land.rhs9.preheader, %while.body16
%indvars.iv164 = phi i64 [ %5, %land.rhs9.preheader ], [ %indvars.iv.next165, %while.body16 ]
%arrayidx11 = getelementptr inbounds [100010 x i8], ptr @s, i64 0, i64 %indvars.iv164
%6 = load i8, ptr %arrayidx11, align 1, !tbaa !13
%cmp13 = icmp eq i8 %6, 76
br i1 %cmp13, label %while.body16, label %while.end18.loopexit
while.body16: ; preds = %land.rhs9
%indvars.iv.next165 = add nsw i64 %indvars.iv164, 1
%exitcond.not = icmp eq i64 %indvars.iv.next165, %1
br i1 %exitcond.not, label %while.end18.thread, label %land.rhs9, !llvm.loop !15
while.end18.thread: ; preds = %while.body5, %while.body16
%inc19170 = add nuw nsw i32 %cnt.0159, 1
br label %while.end20
while.end18.loopexit: ; preds = %land.rhs9
%7 = trunc i64 %indvars.iv164 to i32
br label %while.end18
while.end18: ; preds = %while.end18.loopexit, %while.end
%i.2.lcssa = phi i32 [ %4, %while.end ], [ %7, %while.end18.loopexit ]
%inc19 = add nuw nsw i32 %cnt.0159, 1
%cmp = icmp slt i32 %i.2.lcssa, %0
br i1 %cmp, label %while.cond1.preheader, label %while.end20, !llvm.loop !16
while.end20: ; preds = %while.end18, %while.end18.thread, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %inc19170, %while.end18.thread ], [ %inc19, %while.end18 ]
%8 = load i32, ptr %k, align 4, !tbaa !11
%9 = call i32 @llvm.smax.i32(i32 %cnt.0.lcssa, i32 2)
%cond = add nsw i32 %9, -2
%.cond = call i32 @llvm.smin.i32(i32 %8, i32 %cond)
%sub40 = sub i32 %8, %.cond
store i32 %sub40, ptr %k, align 4, !tbaa !11
%sub43 = sub i32 %cnt.0.lcssa, %.cond
%cmp45 = icmp sgt i32 %sub43, 2
br i1 %cmp45, label %if.then, label %if.else
if.then: ; preds = %while.end20
%10 = shl nuw i32 %sub43, 1
%sub47 = sub i32 %0, %10
%11 = load i8, ptr @s, align 16, !tbaa !13
%cmp49 = icmp eq i8 %11, 76
%conv50 = zext i1 %cmp49 to i32
%add = add nsw i32 %sub47, %conv50
%sub51 = add nsw i32 %0, -1
%idxprom52 = sext i32 %sub51 to i64
%arrayidx53 = getelementptr inbounds [100010 x i8], ptr @s, i64 0, i64 %idxprom52
%12 = load i8, ptr %arrayidx53, align 1, !tbaa !13
%cmp55 = icmp eq i8 %12, 82
%conv56 = zext i1 %cmp55 to i32
%add57 = add nsw i32 %add, %conv56
%conv58 = sext i32 %add57 to i64
br label %if.end134
if.else: ; preds = %while.end20
switch i32 %sub43, label %if.end134 [
i32 2, label %if.then61
i32 1, label %if.then115
]
if.then61: ; preds = %if.else
%13 = load i8, ptr @s, align 16, !tbaa !13
%cmp63 = icmp eq i8 %13, 76
%sub65 = add nsw i32 %0, -1
%idxprom66 = sext i32 %sub65 to i64
%arrayidx67 = getelementptr inbounds [100010 x i8], ptr @s, i64 0, i64 %idxprom66
%14 = load i8, ptr %arrayidx67, align 1, !tbaa !13
%cmp69 = icmp eq i8 %14, 82
%cmp72 = and i1 %cmp63, %cmp69
br i1 %cmp72, label %if.then74, label %if.else81
if.then74: ; preds = %if.then61
%tobool.not.not = icmp sgt i32 %8, %cond
br i1 %tobool.not.not, label %if.end134, label %if.else78
if.else78: ; preds = %if.then74
%sub79 = add nsw i32 %0, -2
%conv80 = sext i32 %sub79 to i64
br label %if.end134
if.else81: ; preds = %if.then61
%cmp82 = xor i1 %cmp63, %cmp69
br i1 %cmp82, label %if.then84, label %if.else93
if.then84: ; preds = %if.else81
%tobool85.not.not = icmp sgt i32 %8, %cond
br i1 %tobool85.not.not, label %if.end134, label %if.else89
if.else89: ; preds = %if.then84
%sub90 = add nsw i32 %0, -3
%conv91 = sext i32 %sub90 to i64
br label %if.end134
if.else93: ; preds = %if.else81
%cmp94 = icmp sgt i32 %sub40, 1
br i1 %cmp94, label %if.end134, label %if.else99
if.else99: ; preds = %if.else93
%cmp100 = icmp eq i32 %sub40, 1
br i1 %cmp100, label %if.then102, label %if.else105
if.then102: ; preds = %if.else99
%sub103 = add nsw i32 %0, -2
%conv104 = sext i32 %sub103 to i64
br label %if.end134
if.else105: ; preds = %if.else99
%sub106 = add nsw i32 %0, -4
%conv107 = sext i32 %sub106 to i64
br label %if.end134
if.then115: ; preds = %if.else
%15 = load i8, ptr @s, align 16, !tbaa !13
%sub117 = add nsw i32 %0, -1
%idxprom118 = sext i32 %sub117 to i64
%arrayidx119 = getelementptr inbounds [100010 x i8], ptr @s, i64 0, i64 %idxprom118
%16 = load i8, ptr %arrayidx119, align 1, !tbaa !13
%cmp121 = icmp ne i8 %15, %16
%cmp123 = icmp sle i32 %8, %cond
%or.cond = select i1 %cmp121, i1 %cmp123, i1 false
br i1 %or.cond, label %if.then125, label %if.end134
if.then125: ; preds = %if.then115
%sub126 = add nsw i32 %0, -2
%conv127 = sext i32 %sub126 to i64
br label %if.end134
if.end134: ; preds = %if.then115, %if.else, %if.else78, %if.else105, %if.then102, %if.else89, %if.then74, %if.then84, %if.else93, %if.then125, %if.then
%ans.1 = phi i64 [ %conv58, %if.then ], [ %conv127, %if.then125 ], [ %conv80, %if.else78 ], [ %conv91, %if.else89 ], [ %conv104, %if.then102 ], [ %conv107, %if.else105 ], [ %idxprom66, %if.then74 ], [ %idxprom66, %if.then84 ], [ %idxprom66, %if.else93 ], [ 1000000000, %if.else ], [ %idxprom118, %if.then115 ]
%call135 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.1)
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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #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 = { 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 #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
int LIS(void);
int h[201],r[201],m,n;
int main(void)
{
int i,j,t;
while(1)
{
scanf("%d",&n);
if(n==0)break;
for(i=0;i<n;i++)
scanf("%d%d",&h[i],&r[i]);
scanf("%d",&m);
for(i=n;i<n+m;i++)
scanf("%d%d",&h[i],&r[i]);
for(i=0;i<n+m;i++)
{
for(j=0;j<n+m;j++)
{
if(h[i]<h[j])
{
t=h[i];
h[i]=h[j];
h[j]=t;
t=r[i];
r [i]=r[j];
r[j]=t;
}
if(h[i]==h[j] && r[i]<r[j])
{
t=h[i];
h[i]=h[j];
h[j]=t;
t=r[i];
r [i]=r[j];
r[j]=t;
}
}
}
printf("%d\n",LIS());
}
return 0;
}
int LIS(void)
{
int i,j,k,L[201],max=0;
for(i=0;i<201;i++)
L[i]=1;
for(i=1;i<n+m;i++)
{
j=i-1;
/*if(r[j]<r[i] && h[j]<h[i])
{
L[i]=L[j]+1;
}
else
{*/
for(k=0;k<i;k++)
{
if(r[k]<r[i] && h[k]<h[i] && L[k]>=L[i])L[i]=L[k]+1;
}
// }
}
for(i=0;i<n+m;i++)
if(max<L[i])max=L[i];
return max;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295564/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295564/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
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@h = dso_local global [201 x i32] zeroinitializer, align 16
@r = dso_local global [201 x i32] zeroinitializer, align 16
@m = dso_local global i32 0, align 4
@.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:
%L.i = alloca [201 x i32], align 16
%call131 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp132 = icmp eq i32 %0, 0
br i1 %cmp132, label %while.end, label %for.cond.preheader.preheader
for.cond.preheader.preheader: ; preds = %entry
%1 = getelementptr inbounds i32, ptr %L.i, i64 4
%2 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 8
%3 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 12
%4 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 16
%5 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 20
%6 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 24
%7 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 28
%8 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 32
%9 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 36
%10 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 40
%11 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 44
%12 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 48
%13 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 52
%14 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 56
%15 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 60
%16 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 64
%17 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 68
%18 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 72
%19 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 76
%20 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 80
%21 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 84
%22 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 88
%23 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 92
%24 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 96
%25 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 100
%26 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 104
%27 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 108
%28 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 112
%29 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 116
%30 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 120
%31 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 124
%32 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 128
%33 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 132
%34 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 136
%35 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 140
%36 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 144
%37 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 148
%38 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 152
%39 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 156
%40 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 160
%41 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 164
%42 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 168
%43 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 172
%44 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 176
%45 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 180
%46 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 184
%47 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 188
%48 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 192
%49 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 196
%arrayidx.i = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 200
br label %for.cond.preheader
for.cond.preheader: ; preds = %for.cond.preheader.preheader, %LIS.exit
%50 = phi i32 [ %80, %LIS.exit ], [ %0, %for.cond.preheader.preheader ]
%cmp1122 = icmp sgt i32 %50, 0
br i1 %cmp1122, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [201 x i32], ptr @h, i64 0, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds [201 x i32], ptr @r, i64 0, i64 %indvars.iv
%call4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%51 = load i32, ptr @n, align 4, !tbaa !5
%52 = sext i32 %51 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %52
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
%call5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
%53 = load i32, ptr @n, align 4, !tbaa !5
%54 = load i32, ptr @m, align 4, !tbaa !5
%add124 = add nsw i32 %54, %53
%cmp7125 = icmp sgt i32 %54, 0
br i1 %cmp7125, label %for.body8.preheader, label %for.cond17.preheader
for.body8.preheader: ; preds = %for.end
%55 = sext i32 %53 to i64
br label %for.body8
for.cond17.preheader: ; preds = %for.body8, %for.end
%add.lcssa = phi i32 [ %add124, %for.end ], [ %add, %for.body8 ]
%cmp19129 = icmp sgt i32 %add.lcssa, 0
br i1 %cmp19129, label %for.cond21.preheader.us.preheader, label %for.end81
for.cond21.preheader.us.preheader: ; preds = %for.cond17.preheader
%wide.trip.count144 = zext i32 %add.lcssa to i64
br label %for.cond21.preheader.us
for.cond21.preheader.us: ; preds = %for.cond21.preheader.us.preheader, %for.cond21.for.inc79_crit_edge.us
%indvars.iv141 = phi i64 [ 0, %for.cond21.preheader.us.preheader ], [ %indvars.iv.next142, %for.cond21.for.inc79_crit_edge.us ]
%arrayidx26.us = getelementptr inbounds [201 x i32], ptr @h, i64 0, i64 %indvars.iv141
%arrayidx40.us = getelementptr inbounds [201 x i32], ptr @r, i64 0, i64 %indvars.iv141
br label %for.body24.us
for.body24.us: ; preds = %for.cond21.preheader.us, %for.inc76.us
%indvars.iv138 = phi i64 [ 0, %for.cond21.preheader.us ], [ %indvars.iv.next139, %for.inc76.us ]
%56 = load i32, ptr %arrayidx26.us, align 4, !tbaa !5
%arrayidx28.us = getelementptr inbounds [201 x i32], ptr @h, i64 0, i64 %indvars.iv138
%57 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%cmp29.us = icmp slt i32 %56, %57
br i1 %cmp29.us, label %if.then30.us, label %if.end47.us
if.then30.us: ; preds = %for.body24.us
store i32 %57, ptr %arrayidx26.us, align 4, !tbaa !5
store i32 %56, ptr %arrayidx28.us, align 4, !tbaa !5
%58 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5
%arrayidx42.us = getelementptr inbounds [201 x i32], ptr @r, i64 0, i64 %indvars.iv138
%59 = load i32, ptr %arrayidx42.us, align 4, !tbaa !5
store i32 %59, ptr %arrayidx40.us, align 4, !tbaa !5
store i32 %58, ptr %arrayidx42.us, align 4, !tbaa !5
%.pre = load i32, ptr %arrayidx26.us, align 4, !tbaa !5
br label %if.end47.us
if.end47.us: ; preds = %if.then30.us, %for.body24.us
%60 = phi i32 [ %56, %if.then30.us ], [ %57, %for.body24.us ]
%61 = phi i32 [ %.pre, %if.then30.us ], [ %56, %for.body24.us ]
%cmp52.us = icmp eq i32 %61, %60
br i1 %cmp52.us, label %land.lhs.true.us, label %for.inc76.us
land.lhs.true.us: ; preds = %if.end47.us
%62 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5
%arrayidx56.us = getelementptr inbounds [201 x i32], ptr @r, i64 0, i64 %indvars.iv138
%63 = load i32, ptr %arrayidx56.us, align 4, !tbaa !5
%cmp57.us = icmp slt i32 %62, %63
br i1 %cmp57.us, label %if.then58.us, label %for.inc76.us
if.then58.us: ; preds = %land.lhs.true.us
store i32 %60, ptr %arrayidx26.us, align 4, !tbaa !5
store i32 %60, ptr %arrayidx28.us, align 4, !tbaa !5
store i32 %63, ptr %arrayidx40.us, align 4, !tbaa !5
store i32 %62, ptr %arrayidx56.us, align 4, !tbaa !5
br label %for.inc76.us
for.inc76.us: ; preds = %if.then58.us, %land.lhs.true.us, %if.end47.us
%indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
%exitcond.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count144
br i1 %exitcond.not, label %for.cond21.for.inc79_crit_edge.us, label %for.body24.us, !llvm.loop !11
for.cond21.for.inc79_crit_edge.us: ; preds = %for.inc76.us
%indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1
%exitcond145.not = icmp eq i64 %indvars.iv.next142, %wide.trip.count144
br i1 %exitcond145.not, label %for.end81, label %for.cond21.preheader.us, !llvm.loop !12
for.body8: ; preds = %for.body8.preheader, %for.body8
%indvars.iv135 = phi i64 [ %55, %for.body8.preheader ], [ %indvars.iv.next136, %for.body8 ]
%arrayidx10 = getelementptr inbounds [201 x i32], ptr @h, i64 0, i64 %indvars.iv135
%arrayidx12 = getelementptr inbounds [201 x i32], ptr @r, i64 0, i64 %indvars.iv135
%call13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx10, ptr noundef nonnull %arrayidx12)
%indvars.iv.next136 = add nsw i64 %indvars.iv135, 1
%64 = load i32, ptr @n, align 4, !tbaa !5
%65 = load i32, ptr @m, align 4, !tbaa !5
%add = add nsw i32 %65, %64
%66 = sext i32 %add to i64
%cmp7 = icmp slt i64 %indvars.iv.next136, %66
br i1 %cmp7, label %for.body8, label %for.cond17.preheader, !llvm.loop !13
for.end81: ; preds = %for.cond21.for.inc79_crit_edge.us, %for.cond17.preheader
call void @llvm.lifetime.start.p0(i64 804, ptr nonnull %L.i) #5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %L.i, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %10, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %11, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %12, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %13, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %14, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %15, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %16, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %17, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %18, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %19, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %20, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %21, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %22, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %23, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %24, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %25, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %26, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %27, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %28, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %29, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %30, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %31, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %32, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %33, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %34, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %35, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %36, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %37, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %38, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %39, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %40, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %41, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %42, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %43, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %44, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %45, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %46, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %47, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %48, align 16, !tbaa !5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %49, align 16, !tbaa !5
store i32 1, ptr %arrayidx.i, align 16, !tbaa !5
%cmp271.i = icmp sgt i32 %add.lcssa, 1
br i1 %cmp271.i, label %for.cond4.preheader.preheader.i, label %for.cond34.preheader.i
for.cond4.preheader.preheader.i: ; preds = %for.end81
%wide.trip.count85.i = zext i32 %add.lcssa to i64
br label %for.cond4.preheader.i
for.cond4.preheader.i: ; preds = %for.inc31.i, %for.cond4.preheader.preheader.i
%indvars.iv82.i = phi i64 [ 1, %for.cond4.preheader.preheader.i ], [ %indvars.iv.next83.i, %for.inc31.i ]
%arrayidx10.i = getelementptr inbounds [201 x i32], ptr @r, i64 0, i64 %indvars.iv82.i
%67 = load i32, ptr %arrayidx10.i, align 4, !tbaa !5
%arrayidx15.i = getelementptr inbounds [201 x i32], ptr @h, i64 0, i64 %indvars.iv82.i
%arrayidx21.i = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 %indvars.iv82.i
br label %for.body6.i
for.cond34.preheader.i: ; preds = %for.inc31.i, %for.end81
br i1 %cmp19129, label %for.body37.preheader.i, label %LIS.exit
for.body37.preheader.i: ; preds = %for.cond34.preheader.i
%wide.trip.count.i = zext i32 %add.lcssa to i64
%min.iters.check = icmp ult i32 %add.lcssa, 8
br i1 %min.iters.check, label %for.body37.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body37.preheader.i
%n.vec = and i64 %wide.trip.count.i, 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 ], [ %70, %vector.body ]
%vec.phi148 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %71, %vector.body ]
%68 = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %68, align 16, !tbaa !5
%69 = getelementptr inbounds i32, ptr %68, i64 4
%wide.load149 = load <4 x i32>, ptr %69, align 16, !tbaa !5
%70 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
%71 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi148, <4 x i32> %wide.load149)
%index.next = add nuw i64 %index, 8
%72 = icmp eq i64 %index.next, %n.vec
br i1 %72, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %70, <4 x i32> %71)
%73 = tail call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %LIS.exit, label %for.body37.i.preheader
for.body37.i.preheader: ; preds = %for.body37.preheader.i, %middle.block
%indvars.iv87.i.ph = phi i64 [ 0, %for.body37.preheader.i ], [ %n.vec, %middle.block ]
%max.075.i.ph = phi i32 [ 0, %for.body37.preheader.i ], [ %73, %middle.block ]
br label %for.body37.i
for.body6.i: ; preds = %for.inc28.i, %for.cond4.preheader.i
%indvars.iv78.i = phi i64 [ 0, %for.cond4.preheader.i ], [ %indvars.iv.next79.i, %for.inc28.i ]
%arrayidx8.i = getelementptr inbounds [201 x i32], ptr @r, i64 0, i64 %indvars.iv78.i
%74 = load i32, ptr %arrayidx8.i, align 4, !tbaa !5
%cmp11.i = icmp slt i32 %74, %67
br i1 %cmp11.i, label %land.lhs.true.i, label %for.inc28.i
land.lhs.true.i: ; preds = %for.body6.i
%arrayidx13.i = getelementptr inbounds [201 x i32], ptr @h, i64 0, i64 %indvars.iv78.i
%75 = load i32, ptr %arrayidx13.i, align 4, !tbaa !5
%76 = load i32, ptr %arrayidx15.i, align 4, !tbaa !5
%cmp16.i = icmp slt i32 %75, %76
br i1 %cmp16.i, label %land.lhs.true17.i, label %for.inc28.i
land.lhs.true17.i: ; preds = %land.lhs.true.i
%arrayidx19.i = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 %indvars.iv78.i
%77 = load i32, ptr %arrayidx19.i, align 4, !tbaa !5
%78 = load i32, ptr %arrayidx21.i, align 4, !tbaa !5
%cmp22.not.i = icmp slt i32 %77, %78
br i1 %cmp22.not.i, label %for.inc28.i, label %if.then.i
if.then.i: ; preds = %land.lhs.true17.i
%add25.i = add nsw i32 %77, 1
store i32 %add25.i, ptr %arrayidx21.i, align 4, !tbaa !5
br label %for.inc28.i
for.inc28.i: ; preds = %if.then.i, %land.lhs.true17.i, %land.lhs.true.i, %for.body6.i
%indvars.iv.next79.i = add nuw nsw i64 %indvars.iv78.i, 1
%exitcond81.not.i = icmp eq i64 %indvars.iv.next79.i, %indvars.iv82.i
br i1 %exitcond81.not.i, label %for.inc31.i, label %for.body6.i, !llvm.loop !17
for.inc31.i: ; preds = %for.inc28.i
%indvars.iv.next83.i = add nuw nsw i64 %indvars.iv82.i, 1
%exitcond86.not.i = icmp eq i64 %indvars.iv.next83.i, %wide.trip.count85.i
br i1 %exitcond86.not.i, label %for.cond34.preheader.i, label %for.cond4.preheader.i, !llvm.loop !18
for.body37.i: ; preds = %for.body37.i.preheader, %for.body37.i
%indvars.iv87.i = phi i64 [ %indvars.iv.next88.i, %for.body37.i ], [ %indvars.iv87.i.ph, %for.body37.i.preheader ]
%max.075.i = phi i32 [ %spec.select.i, %for.body37.i ], [ %max.075.i.ph, %for.body37.i.preheader ]
%arrayidx39.i = getelementptr inbounds [201 x i32], ptr %L.i, i64 0, i64 %indvars.iv87.i
%79 = load i32, ptr %arrayidx39.i, align 4, !tbaa !5
%spec.select.i = tail call i32 @llvm.smax.i32(i32 %max.075.i, i32 %79)
%indvars.iv.next88.i = add nuw nsw i64 %indvars.iv87.i, 1
%exitcond90.not.i = icmp eq i64 %indvars.iv.next88.i, %wide.trip.count.i
br i1 %exitcond90.not.i, label %LIS.exit, label %for.body37.i, !llvm.loop !19
LIS.exit: ; preds = %for.body37.i, %middle.block, %for.cond34.preheader.i
%max.0.lcssa.i = phi i32 [ 0, %for.cond34.preheader.i ], [ %73, %middle.block ], [ %spec.select.i, %for.body37.i ]
call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %L.i) #5
%call83 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %max.0.lcssa.i)
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%80 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp eq i32 %80, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %LIS.exit, %entry
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 nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @LIS() local_unnamed_addr #3 {
entry:
%L = alloca [201 x i32], align 16
call void @llvm.lifetime.start.p0(i64 804, ptr nonnull %L) #5
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %L, align 16, !tbaa !5
%0 = getelementptr inbounds i32, ptr %L, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 16, !tbaa !5
%1 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 8
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 12
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 16
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 20
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 24
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 28
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 32
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 36
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 40
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 16, !tbaa !5
%10 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 44
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %10, align 16, !tbaa !5
%11 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 48
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %11, align 16, !tbaa !5
%12 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 52
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %12, align 16, !tbaa !5
%13 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 56
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %13, align 16, !tbaa !5
%14 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 60
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %14, align 16, !tbaa !5
%15 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 64
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %15, align 16, !tbaa !5
%16 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 68
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %16, align 16, !tbaa !5
%17 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 72
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %17, align 16, !tbaa !5
%18 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 76
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %18, align 16, !tbaa !5
%19 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 80
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 84
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %20, align 16, !tbaa !5
%21 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 88
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %21, align 16, !tbaa !5
%22 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 92
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %22, align 16, !tbaa !5
%23 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 96
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %23, align 16, !tbaa !5
%24 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 100
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %24, align 16, !tbaa !5
%25 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 104
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %25, align 16, !tbaa !5
%26 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 108
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %26, align 16, !tbaa !5
%27 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 112
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %27, align 16, !tbaa !5
%28 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 116
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %28, align 16, !tbaa !5
%29 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 120
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %29, align 16, !tbaa !5
%30 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 124
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %30, align 16, !tbaa !5
%31 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 128
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %31, align 16, !tbaa !5
%32 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 132
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %32, align 16, !tbaa !5
%33 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 136
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %33, align 16, !tbaa !5
%34 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 140
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %34, align 16, !tbaa !5
%35 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 144
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %35, align 16, !tbaa !5
%36 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 148
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %36, align 16, !tbaa !5
%37 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 152
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %37, align 16, !tbaa !5
%38 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 156
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %38, align 16, !tbaa !5
%39 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 160
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %39, align 16, !tbaa !5
%40 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 164
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %40, align 16, !tbaa !5
%41 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 168
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %41, align 16, !tbaa !5
%42 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 172
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %42, align 16, !tbaa !5
%43 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 176
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %43, align 16, !tbaa !5
%44 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 180
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %44, align 16, !tbaa !5
%45 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 184
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %45, align 16, !tbaa !5
%46 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 188
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %46, align 16, !tbaa !5
%47 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 192
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %47, align 16, !tbaa !5
%48 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 196
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %48, align 16, !tbaa !5
%arrayidx = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 200
store i32 1, ptr %arrayidx, align 16, !tbaa !5
%49 = load i32, ptr @n, align 4, !tbaa !5
%50 = load i32, ptr @m, align 4, !tbaa !5
%add = add nsw i32 %50, %49
%cmp271 = icmp sgt i32 %add, 1
br i1 %cmp271, label %for.cond4.preheader.preheader, label %for.cond34.preheader
for.cond4.preheader.preheader: ; preds = %entry
%wide.trip.count85 = zext i32 %add to i64
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond4.preheader.preheader, %for.inc31
%indvars.iv82 = phi i64 [ 1, %for.cond4.preheader.preheader ], [ %indvars.iv.next83, %for.inc31 ]
%arrayidx10 = getelementptr inbounds [201 x i32], ptr @r, i64 0, i64 %indvars.iv82
%51 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%arrayidx15 = getelementptr inbounds [201 x i32], ptr @h, i64 0, i64 %indvars.iv82
%arrayidx21 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 %indvars.iv82
br label %for.body6
for.cond34.preheader: ; preds = %for.inc31, %entry
%cmp3673 = icmp sgt i32 %add, 0
br i1 %cmp3673, label %for.body37.preheader, label %for.end47
for.body37.preheader: ; preds = %for.cond34.preheader
%wide.trip.count = zext i32 %add to i64
%min.iters.check = icmp ult i32 %add, 8
br i1 %min.iters.check, label %for.body37.preheader100, label %vector.ph93
vector.ph93: ; preds = %for.body37.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body95
vector.body95: ; preds = %vector.body95, %vector.ph93
%index96 = phi i64 [ 0, %vector.ph93 ], [ %index.next99, %vector.body95 ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph93 ], [ %54, %vector.body95 ]
%vec.phi97 = phi <4 x i32> [ zeroinitializer, %vector.ph93 ], [ %55, %vector.body95 ]
%52 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 %index96
%wide.load = load <4 x i32>, ptr %52, align 16, !tbaa !5
%53 = getelementptr inbounds i32, ptr %52, i64 4
%wide.load98 = load <4 x i32>, ptr %53, align 16, !tbaa !5
%54 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
%55 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi97, <4 x i32> %wide.load98)
%index.next99 = add nuw i64 %index96, 8
%56 = icmp eq i64 %index.next99, %n.vec
br i1 %56, label %middle.block91, label %vector.body95, !llvm.loop !20
middle.block91: ; preds = %vector.body95
%rdx.minmax = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %54, <4 x i32> %55)
%57 = tail call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end47, label %for.body37.preheader100
for.body37.preheader100: ; preds = %for.body37.preheader, %middle.block91
%indvars.iv87.ph = phi i64 [ 0, %for.body37.preheader ], [ %n.vec, %middle.block91 ]
%max.075.ph = phi i32 [ 0, %for.body37.preheader ], [ %57, %middle.block91 ]
br label %for.body37
for.body6: ; preds = %for.cond4.preheader, %for.inc28
%indvars.iv78 = phi i64 [ 0, %for.cond4.preheader ], [ %indvars.iv.next79, %for.inc28 ]
%arrayidx8 = getelementptr inbounds [201 x i32], ptr @r, i64 0, i64 %indvars.iv78
%58 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp11 = icmp slt i32 %58, %51
br i1 %cmp11, label %land.lhs.true, label %for.inc28
land.lhs.true: ; preds = %for.body6
%arrayidx13 = getelementptr inbounds [201 x i32], ptr @h, i64 0, i64 %indvars.iv78
%59 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%60 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%cmp16 = icmp slt i32 %59, %60
br i1 %cmp16, label %land.lhs.true17, label %for.inc28
land.lhs.true17: ; preds = %land.lhs.true
%arrayidx19 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 %indvars.iv78
%61 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%62 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.not = icmp slt i32 %61, %62
br i1 %cmp22.not, label %for.inc28, label %if.then
if.then: ; preds = %land.lhs.true17
%add25 = add nsw i32 %61, 1
store i32 %add25, ptr %arrayidx21, align 4, !tbaa !5
br label %for.inc28
for.inc28: ; preds = %for.body6, %land.lhs.true, %land.lhs.true17, %if.then
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%exitcond81.not = icmp eq i64 %indvars.iv.next79, %indvars.iv82
br i1 %exitcond81.not, label %for.inc31, label %for.body6, !llvm.loop !17
for.inc31: ; preds = %for.inc28
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%exitcond86.not = icmp eq i64 %indvars.iv.next83, %wide.trip.count85
br i1 %exitcond86.not, label %for.cond34.preheader, label %for.cond4.preheader, !llvm.loop !18
for.body37: ; preds = %for.body37.preheader100, %for.body37
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.body37 ], [ %indvars.iv87.ph, %for.body37.preheader100 ]
%max.075 = phi i32 [ %spec.select, %for.body37 ], [ %max.075.ph, %for.body37.preheader100 ]
%arrayidx39 = getelementptr inbounds [201 x i32], ptr %L, i64 0, i64 %indvars.iv87
%63 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%spec.select = tail call i32 @llvm.smax.i32(i32 %max.075, i32 %63)
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%exitcond90.not = icmp eq i64 %indvars.iv.next88, %wide.trip.count
br i1 %exitcond90.not, label %for.end47, label %for.body37, !llvm.loop !21
for.end47: ; preds = %for.body37, %middle.block91, %for.cond34.preheader
%max.0.lcssa = phi i32 [ 0, %for.cond34.preheader ], [ %57, %middle.block91 ], [ %spec.select, %for.body37 ]
call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %L) #5
ret i32 %max.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #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 = { nofree 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 = { 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}
!14 = distinct !{!14, !10, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !16, !15}
!20 = distinct !{!20, !10, !15, !16}
!21 = distinct !{!21, !10, !16, !15}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
return *(ll*)b-*(ll*)a;
}
int z(int a){
if(a<1)a*=-1;
return a;
}
int min(int a,int b){
if(a>b)return b;
return a;
}
int max(int a,int b){
if(a>b)return a;
return b;
}
int gcd(int a,int b){
if(!b)return a;
return gcd(b,a%b);
}
int kt(ll a){
int sum=0;
while(a){
a/=10;
sum++;
}
return sum;
}
int ks(ll a){
int sum=0;
while(a){
sum+=a%10;
a/=10;
}
return sum;
}
int main(void){
char s[20];
scanf("%s",s);
int flg=0;
FOR(strlen(s))if(i&&s[i]!='9')flg=1;
PRN((s[0]-'0')-flg+9*(strlen(s)-1));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295614/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295614/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"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @u(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @d(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @z(i32 noundef %a) local_unnamed_addr #1 {
entry:
%spec.select = tail call i32 @llvm.abs.i32(i32 %a, i1 true)
ret i32 %spec.select
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%b.a = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %b.a
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
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 @kt(i64 noundef %a) local_unnamed_addr #2 {
entry:
%tobool.not3 = icmp eq i64 %a, 0
br i1 %tobool.not3, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%sum.05 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
%a.addr.04 = phi i64 [ %div, %while.body ], [ %a, %entry ]
%div = sdiv i64 %a.addr.04, 10
%inc = add nuw nsw i32 %sum.05, 1
%a.addr.04.off = add i64 %a.addr.04, 9
%tobool.not = icmp ult i64 %a.addr.04.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
ret i32 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @ks(i64 noundef %a) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i64 %a, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%sum.07 = phi i32 [ %conv1, %while.body ], [ 0, %entry ]
%a.addr.06 = phi i64 [ %div, %while.body ], [ %a, %entry ]
%rem = srem i64 %a.addr.06, 10
%0 = trunc i64 %rem to i32
%conv1 = add i32 %sum.07, %0
%div = sdiv i64 %a.addr.06, 10
%a.addr.06.off = add i64 %a.addr.06, 9
%tobool.not = icmp ult i64 %a.addr.06.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %while.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %conv1, %while.body ]
ret i32 %sum.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%s = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %s) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #9
%switch = icmp ult i64 %call2, 2
br i1 %switch, label %for.cond.cleanup, label %for.inc.preheader
for.inc.preheader: ; preds = %entry
%0 = add i64 %call2, -1
%min.iters.check = icmp ult i64 %call2, 9
br i1 %min.iters.check, label %for.inc.preheader30, label %vector.ph
vector.ph: ; preds = %for.inc.preheader
%n.vec = and i64 %0, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %5, %vector.body ]
%vec.phi25 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds [20 x i8], ptr %s, i64 0, i64 %offset.idx
%wide.load = load <4 x i8>, ptr %1, align 1, !tbaa !12
%2 = getelementptr inbounds i8, ptr %1, i64 4
%wide.load26 = load <4 x i8>, ptr %2, align 1, !tbaa !12
%3 = icmp eq <4 x i8> %wide.load, <i8 57, i8 57, i8 57, i8 57>
%4 = icmp eq <4 x i8> %wide.load26, <i8 57, i8 57, i8 57, i8 57>
%5 = select <4 x i1> %3, <4 x i32> %vec.phi, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%6 = select <4 x i1> %4, <4 x i32> %vec.phi25, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%index.next = add nuw i64 %index, 8
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%rdx.select.cmp.not = icmp ne <4 x i32> %5, zeroinitializer
%rdx.select.cmp2729 = icmp ne <4 x i32> %6, zeroinitializer
%rdx.select.cmp27 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp2729
%8 = bitcast <4 x i1> %rdx.select.cmp27 to i4
%.not = icmp ne i4 %8, 0
%rdx.select28 = zext i1 %.not to i32
%cmp.n = icmp eq i64 %0, %n.vec
br i1 %cmp.n, label %for.cond.cleanup, label %for.inc.preheader30
for.inc.preheader30: ; preds = %for.inc.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 1, %for.inc.preheader ], [ %ind.end, %middle.block ]
%flg.019.ph = phi i32 [ 0, %for.inc.preheader ], [ %rdx.select28, %middle.block ]
br label %for.inc
for.cond.cleanup: ; preds = %for.inc, %middle.block, %entry
%flg.0.lcssa = phi i32 [ 0, %entry ], [ %rdx.select28, %middle.block ], [ %spec.select, %for.inc ]
%9 = load i8, ptr %s, align 16, !tbaa !12
%conv8 = sext i8 %9 to i32
%reass.sub = sub nsw i32 %conv8, %flg.0.lcssa
%sub9 = add nsw i32 %reass.sub, -48
%conv10 = sext i32 %sub9 to i64
%10 = mul i64 %call2, 9
%mul = add i64 %10, -9
%add = add i64 %mul, %conv10
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %s) #8
ret i32 0
for.inc: ; preds = %for.inc.preheader30, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %indvars.iv.ph, %for.inc.preheader30 ]
%flg.019 = phi i32 [ %spec.select, %for.inc ], [ %flg.019.ph, %for.inc.preheader30 ]
%arrayidx = getelementptr inbounds [20 x i8], ptr %s, i64 0, i64 %indvars.iv
%11 = load i8, ptr %arrayidx, align 1, !tbaa !12
%cmp5.not = icmp eq i8 %11, 57
%spec.select = select i1 %cmp5.not, i32 %flg.019, i32 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %call2
br i1 %exitcond.not, label %for.cond.cleanup, label %for.inc, !llvm.loop !17
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10, !14, !15, !16}
!14 = !{!"llvm.loop.peeled.count", i32 1}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10, !14, !16, !15}
|
#include <stdio.h>
#include <string.h>
int main() {
int k;
scanf("%d", &k);
int arr[32]= {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
printf("%d",arr[k-1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295672/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295672/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
@__const.main.arr = private unnamed_addr constant [32 x i32] [i32 1, i32 1, i32 1, i32 2, i32 1, i32 2, i32 1, i32 5, i32 2, i32 2, i32 1, i32 5, i32 1, i32 2, i32 1, i32 14, i32 1, i32 5, i32 1, i32 5, i32 2, i32 2, i32 1, i32 15, i32 2, i32 2, i32 5, i32 4, i32 1, i32 4, i32 1, i32 51], align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [32 x i32], ptr @__const.main.arr, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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>
char s[50][50];
int n;
int i;
int f1(int x);
int f2(int x);
int f1(int x)
{
int res = 0;
int d = strlen(s[x]);
i = x + 1;
for (; i < n; i++)
{
if (strlen(s[i]) != d + 1)
break;
if (s[i][d] >= '0' && s[i][d] <= '9')
res += s[i][d] - '0';
if (s[i][d] == '+')
res += f1(i);
if (s[i][d] == '*')
res += f2(i);
}
i--;
return res;
}
int f2(int x)
{
int res = 1;
int d = strlen(s[x]);
i = x + 1;
for (; i < n; i++)
{
if (strlen(s[i]) != d + 1)
break;
if (s[i][d] >= '0' && s[i][d] <= '9')
res *= s[i][d] - '0';
if (s[i][d] == '+')
res *= f1(i);
if (s[i][d] == '*')
res *= f2(i);
}
i--;
return res;
}
int main()
{
int k, j;
int ans[10002];
for (j = 0;; j++)
{
scanf("%d", &n);
if (n == 0)
break;
for (k = 0; k < n; k++)
scanf("%s", s[k]);
if (n == 1)
{
ans[j] = s[0][0] - '0';
continue;
}
if (s[0][0] == '+')
ans[j] = f1(0);
else
ans[j] = f2(0);
}
for (k = 0; k < j; k++)
printf("%d\n", ans[k]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100002/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100002/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"
@s = dso_local global [50 x [50 x i8]] zeroinitializer, align 16
@i = dso_local local_unnamed_addr global i32 0, align 4
@n = dso_local global i32 0, align 4
@.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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @f1(i32 noundef %x) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %x to i64
%arrayidx = getelementptr inbounds [50 x [50 x i8]], ptr @s, i64 0, i64 %idxprom
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx) #5
%storemerge64 = add nsw i32 %x, 1
store i32 %storemerge64, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp65 = icmp slt i32 %storemerge64, %0
br i1 %cmp65, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%add6 = shl i64 %call, 32
%sext = add i64 %add6, 4294967296
%conv7 = ashr exact i64 %sext, 32
%idxprom12 = ashr exact i64 %add6, 32
%idxprom274 = sext i32 %storemerge64 to i64
%arrayidx375 = getelementptr inbounds [50 x [50 x i8]], ptr @s, i64 0, i64 %idxprom274
%call576 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx375) #5
%cmp8.not77 = icmp eq i64 %call576, %conv7
br i1 %cmp8.not77, label %if.end, label %for.end
for.body: ; preds = %for.inc
%idxprom2 = sext i32 %storemerge to i64
%arrayidx3 = getelementptr inbounds [50 x [50 x i8]], ptr @s, i64 0, i64 %idxprom2
%call5 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx3) #5
%cmp8.not = icmp eq i64 %call5, %conv7
br i1 %cmp8.not, label %if.end, label %for.end, !llvm.loop !9
if.end: ; preds = %for.body.lr.ph, %for.body
%idxprom280 = phi i64 [ %idxprom2, %for.body ], [ %idxprom274, %for.body.lr.ph ]
%res.06779 = phi i32 [ %res.3, %for.body ], [ 0, %for.body.lr.ph ]
%storemerge6878 = phi i32 [ %storemerge, %for.body ], [ %storemerge64, %for.body.lr.ph ]
%arrayidx13 = getelementptr inbounds [50 x [50 x i8]], ptr @s, i64 0, i64 %idxprom280, i64 %idxprom12
%1 = load i8, ptr %arrayidx13, align 1, !tbaa !11
%conv14 = sext i8 %1 to i32
%2 = add i8 %1, -48
%or.cond = icmp ult i8 %2, 10
%sub = add nsw i32 %conv14, -48
%add30 = select i1 %or.cond, i32 %sub, i32 0
%res.1 = add nsw i32 %add30, %res.06779
%cmp37 = icmp eq i8 %1, 43
br i1 %cmp37, label %if.then39, label %if.end42
if.then39: ; preds = %if.end
%call40 = tail call i32 @f1(i32 noundef %storemerge6878)
%add41 = add nsw i32 %call40, %res.1
%.pre = load i32, ptr @i, align 4, !tbaa !5
%idxprom43.phi.trans.insert = sext i32 %.pre to i64
%arrayidx46.phi.trans.insert = getelementptr inbounds [50 x [50 x i8]], ptr @s, i64 0, i64 %idxprom43.phi.trans.insert, i64 %idxprom12
%.pre72 = load i8, ptr %arrayidx46.phi.trans.insert, align 1, !tbaa !11
br label %if.end42
if.end42: ; preds = %if.then39, %if.end
%3 = phi i8 [ %.pre72, %if.then39 ], [ %1, %if.end ]
%4 = phi i32 [ %.pre, %if.then39 ], [ %storemerge6878, %if.end ]
%res.2 = phi i32 [ %add41, %if.then39 ], [ %res.1, %if.end ]
%cmp48 = icmp eq i8 %3, 42
br i1 %cmp48, label %if.then50, label %for.inc
if.then50: ; preds = %if.end42
%call51 = tail call i32 @f2(i32 noundef %4)
%add52 = add nsw i32 %call51, %res.2
%.pre73 = load i32, ptr @i, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end42, %if.then50
%5 = phi i32 [ %.pre73, %if.then50 ], [ %4, %if.end42 ]
%res.3 = phi i32 [ %add52, %if.then50 ], [ %res.2, %if.end42 ]
%storemerge = add nsw i32 %5, 1
store i32 %storemerge, ptr @i, align 4, !tbaa !5
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp slt i32 %storemerge, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.inc, %for.body.lr.ph, %entry
%storemerge.in.lcssa = phi i32 [ %x, %entry ], [ %x, %for.body.lr.ph ], [ %5, %for.inc ], [ %5, %for.body ]
%res.0.lcssa = phi i32 [ 0, %entry ], [ 0, %for.body.lr.ph ], [ %res.3, %for.inc ], [ %res.3, %for.body ]
store i32 %storemerge.in.lcssa, ptr @i, align 4, !tbaa !5
ret i32 %res.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 nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @f2(i32 noundef %x) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %x to i64
%arrayidx = getelementptr inbounds [50 x [50 x i8]], ptr @s, i64 0, i64 %idxprom
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx) #5
%storemerge63 = add nsw i32 %x, 1
store i32 %storemerge63, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp64 = icmp slt i32 %storemerge63, %0
br i1 %cmp64, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%add6 = shl i64 %call, 32
%sext = add i64 %add6, 4294967296
%conv7 = ashr exact i64 %sext, 32
%idxprom12 = ashr exact i64 %add6, 32
%idxprom273 = sext i32 %storemerge63 to i64
%arrayidx374 = getelementptr inbounds [50 x [50 x i8]], ptr @s, i64 0, i64 %idxprom273
%call575 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx374) #5
%cmp8.not76 = icmp eq i64 %call575, %conv7
br i1 %cmp8.not76, label %if.end, label %for.end
for.body: ; preds = %for.inc
%idxprom2 = sext i32 %storemerge to i64
%arrayidx3 = getelementptr inbounds [50 x [50 x i8]], ptr @s, i64 0, i64 %idxprom2
%call5 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx3) #5
%cmp8.not = icmp eq i64 %call5, %conv7
br i1 %cmp8.not, label %if.end, label %for.end, !llvm.loop !12
if.end: ; preds = %for.body.lr.ph, %for.body
%idxprom279 = phi i64 [ %idxprom2, %for.body ], [ %idxprom273, %for.body.lr.ph ]
%res.06678 = phi i32 [ %res.3, %for.body ], [ 1, %for.body.lr.ph ]
%storemerge6777 = phi i32 [ %storemerge, %for.body ], [ %storemerge63, %for.body.lr.ph ]
%arrayidx13 = getelementptr inbounds [50 x [50 x i8]], ptr @s, i64 0, i64 %idxprom279, i64 %idxprom12
%1 = load i8, ptr %arrayidx13, align 1, !tbaa !11
%conv14 = sext i8 %1 to i32
%2 = add i8 %1, -48
%or.cond = icmp ult i8 %2, 10
%sub = add nsw i32 %conv14, -48
%mul = select i1 %or.cond, i32 %sub, i32 1
%res.1 = mul nsw i32 %mul, %res.06678
%cmp36 = icmp eq i8 %1, 43
br i1 %cmp36, label %if.then38, label %if.end41
if.then38: ; preds = %if.end
%call39 = tail call i32 @f1(i32 noundef %storemerge6777)
%mul40 = mul nsw i32 %call39, %res.1
%.pre = load i32, ptr @i, align 4, !tbaa !5
%idxprom42.phi.trans.insert = sext i32 %.pre to i64
%arrayidx45.phi.trans.insert = getelementptr inbounds [50 x [50 x i8]], ptr @s, i64 0, i64 %idxprom42.phi.trans.insert, i64 %idxprom12
%.pre71 = load i8, ptr %arrayidx45.phi.trans.insert, align 1, !tbaa !11
br label %if.end41
if.end41: ; preds = %if.then38, %if.end
%3 = phi i8 [ %.pre71, %if.then38 ], [ %1, %if.end ]
%4 = phi i32 [ %.pre, %if.then38 ], [ %storemerge6777, %if.end ]
%res.2 = phi i32 [ %mul40, %if.then38 ], [ %res.1, %if.end ]
%cmp47 = icmp eq i8 %3, 42
br i1 %cmp47, label %if.then49, label %for.inc
if.then49: ; preds = %if.end41
%call50 = tail call i32 @f2(i32 noundef %4)
%mul51 = mul nsw i32 %call50, %res.2
%.pre72 = load i32, ptr @i, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end41, %if.then49
%5 = phi i32 [ %.pre72, %if.then49 ], [ %4, %if.end41 ]
%res.3 = phi i32 [ %mul51, %if.then49 ], [ %res.2, %if.end41 ]
%storemerge = add nsw i32 %5, 1
store i32 %storemerge, ptr @i, align 4, !tbaa !5
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp slt i32 %storemerge, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body, %for.inc, %for.body.lr.ph, %entry
%storemerge.in.lcssa = phi i32 [ %x, %entry ], [ %x, %for.body.lr.ph ], [ %5, %for.inc ], [ %5, %for.body ]
%res.0.lcssa = phi i32 [ 1, %entry ], [ 1, %for.body.lr.ph ], [ %res.3, %for.inc ], [ %res.3, %for.body ]
store i32 %storemerge.in.lcssa, ptr @i, align 4, !tbaa !5
ret i32 %res.0.lcssa
}
; 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:
%ans = alloca [10002 x i32], align 16
call void @llvm.lifetime.start.p0(i64 40008, ptr nonnull %ans) #6
%call44 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp45 = icmp eq i32 %0, 0
br i1 %cmp45, label %for.end32, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc20
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %for.inc20 ], [ 0, %entry ]
%1 = phi i32 [ %6, %for.inc20 ], [ %0, %entry ]
%cmp242 = icmp sgt i32 %1, 0
br i1 %cmp242, label %for.body, label %if.end8
for.cond23.preheader: ; preds = %for.inc20
%2 = and i64 %indvars.iv.next52, 4294967295
%cmp2448.not = icmp eq i64 %2, 0
br i1 %cmp2448.not, label %for.end32, label %for.body26.preheader
for.body26.preheader: ; preds = %for.cond23.preheader
%wide.trip.count = and i64 %indvars.iv.next52, 4294967295
br label %for.body26
for.body: ; preds = %for.cond1.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond1.preheader ]
%arrayidx = getelementptr inbounds [50 x [50 x i8]], ptr @s, i64 0, i64 %indvars.iv
%call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%.pr = load i32, ptr @n, align 4, !tbaa !5
%3 = sext i32 %.pr to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body
%cmp4 = icmp eq i32 %.pr, 1
br i1 %cmp4, label %if.then5, label %if.end8
if.then5: ; preds = %for.end
%4 = load i8, ptr @s, align 16, !tbaa !11
%conv = sext i8 %4 to i32
%sub = add nsw i32 %conv, -48
%arrayidx7 = getelementptr inbounds [10002 x i32], ptr %ans, i64 0, i64 %indvars.iv51
store i32 %sub, ptr %arrayidx7, align 4, !tbaa !5
br label %for.inc20
if.end8: ; preds = %for.cond1.preheader, %for.end
%5 = load i8, ptr @s, align 16, !tbaa !11
%cmp10 = icmp eq i8 %5, 43
%arrayidx15 = getelementptr inbounds [10002 x i32], ptr %ans, i64 0, i64 %indvars.iv51
br i1 %cmp10, label %if.then12, label %if.else
if.then12: ; preds = %if.end8
%call13 = tail call i32 @f1(i32 noundef 0)
store i32 %call13, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc20
if.else: ; preds = %if.end8
%call16 = tail call i32 @f2(i32 noundef 0)
store i32 %call16, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc20
for.inc20: ; preds = %if.then12, %if.else, %if.then5
%indvars.iv.next52 = add nuw i64 %indvars.iv51, 1
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp eq i32 %6, 0
br i1 %cmp, label %for.cond23.preheader, label %for.cond1.preheader
for.body26: ; preds = %for.body26.preheader, %for.body26
%indvars.iv54 = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next55, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10002 x i32], ptr %ans, i64 0, i64 %indvars.iv54
%7 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%call29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count
br i1 %exitcond.not, label %for.end32, label %for.body26, !llvm.loop !14
for.end32: ; preds = %for.body26, %entry, %for.cond23.preheader
call void @llvm.lifetime.end.p0(i64 40008, ptr nonnull %ans) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree 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 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 #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 willreturn memory(read) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(){
int h,w,i,j;
while(1){
scanf("%d %d",&h,&w);
if(h==0 && w==0) break;
for(i=0;i<h;i++){
for(j=0;j<w;j++){
if((j!=0 && j!=w-1) && (i!=0 && i!=h-1)) printf(".");
else printf("#");
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100046/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100046/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call39 = 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
%cmp40 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp141 = icmp eq i32 %1, 0
%or.cond42 = select i1 %cmp40, i1 %cmp141, i1 false
br i1 %or.cond42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end21
%2 = phi i32 [ %9, %for.end21 ], [ %0, %entry ]
%cmp236 = icmp sgt i32 %2, 0
br i1 %cmp236, label %for.cond3.preheader, label %for.end21
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.037 = phi i32 [ %inc20, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp10.not = icmp eq i32 %i.037, 0
br i1 %cmp10.not, label %for.body5.us, label %for.inc.peel
for.inc.peel: ; preds = %for.body5.lr.ph
%putchar31.peel = call i32 @putchar(i32 35)
%.pre = load i32, ptr %w, align 4, !tbaa !5
%cmp4.peel = icmp sgt i32 %.pre, 1
br i1 %cmp4.peel, label %for.body5, label %for.end
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.034.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.034.us, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.inc.peel, %for.inc
%5 = phi i32 [ %7, %for.inc ], [ %.pre, %for.inc.peel ]
%j.034 = phi i32 [ %inc, %for.inc ], [ 1, %for.inc.peel ]
%sub = add nsw i32 %5, -1
%cmp8.not = icmp eq i32 %j.034, %sub
br i1 %cmp8.not, label %if.else, label %land.lhs.true11
land.lhs.true11: ; preds = %for.body5
%6 = load i32, ptr %h, align 4, !tbaa !5
%sub12 = add nsw i32 %6, -1
%cmp13.not = icmp eq i32 %i.037, %sub12
br i1 %cmp13.not, label %if.else, label %for.inc
if.else: ; preds = %land.lhs.true11, %for.body5
br label %for.inc
for.inc: ; preds = %land.lhs.true11, %if.else
%.sink = phi i32 [ 35, %if.else ], [ 46, %land.lhs.true11 ]
%putchar32 = call i32 @putchar(i32 %.sink)
%inc = add nuw nsw i32 %j.034, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %7
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !11
for.end: ; preds = %for.inc, %for.body5.us, %for.inc.peel, %for.cond3.preheader
%putchar30 = call i32 @putchar(i32 10)
%inc20 = add nuw nsw i32 %i.037, 1
%8 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc20, %8
br i1 %cmp2, label %for.cond3.preheader, label %for.end21, !llvm.loop !13
for.end21: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end21, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(void){
int x,y,i,j;
for(;;){
scanf("%d %d",&y,&x);
if(x+y==0) break;
for(i=0;i<y;i++){
for(j=0;j<x;j++)
if(i*j==0 || i+1==y || j+1==x)
printf("#");
else
printf(".");
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100097/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100097/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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
%call36 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %y, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%add37 = sub i32 0, %1
%cmp38 = icmp eq i32 %0, %add37
br i1 %cmp38, label %for.end21, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.end19
%2 = phi i32 [ %9, %for.end19 ], [ %1, %entry ]
%cmp234 = icmp sgt i32 %2, 0
br i1 %cmp234, label %for.cond3.preheader, label %for.end19
for.cond3.preheader: ; preds = %for.cond1.preheader, %for.end
%i.035 = phi i32 [ %add7, %for.end ], [ 0, %for.cond1.preheader ]
%3 = load i32, ptr %x, align 4, !tbaa !5
%cmp431 = icmp sgt i32 %3, 0
%add7 = add nuw nsw i32 %i.035, 1
br i1 %cmp431, label %for.body5, label %for.end
for.body5: ; preds = %for.cond3.preheader, %for.inc
%4 = phi i32 [ %6, %for.inc ], [ %3, %for.cond3.preheader ]
%j.032 = phi i32 [ %inc.pre-phi, %for.inc ], [ 0, %for.cond3.preheader ]
%mul = mul nuw nsw i32 %j.032, %i.035
%cmp6 = icmp eq i32 %mul, 0
br i1 %cmp6, label %for.body5.if.then12_crit_edge, label %lor.lhs.false
for.body5.if.then12_crit_edge: ; preds = %for.body5
%.pre40 = add nuw nsw i32 %j.032, 1
br label %for.inc
lor.lhs.false: ; preds = %for.body5
%5 = load i32, ptr %y, align 4, !tbaa !5
%cmp8 = icmp eq i32 %add7, %5
%add10 = add nuw nsw i32 %j.032, 1
%cmp11 = icmp eq i32 %add10, %4
%or.cond = select i1 %cmp8, i1 true, i1 %cmp11
%spec.select = select i1 %or.cond, i32 35, i32 46
br label %for.inc
for.inc: ; preds = %lor.lhs.false, %for.body5.if.then12_crit_edge
%.sink = phi i32 [ 35, %for.body5.if.then12_crit_edge ], [ %spec.select, %lor.lhs.false ]
%inc.pre-phi = phi i32 [ %.pre40, %for.body5.if.then12_crit_edge ], [ %add10, %lor.lhs.false ]
%putchar30 = call i32 @putchar(i32 %.sink)
%6 = load i32, ptr %x, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc.pre-phi, %6
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.cond3.preheader
%putchar28 = call i32 @putchar(i32 10)
%7 = load i32, ptr %y, align 4, !tbaa !5
%cmp2 = icmp slt i32 %add7, %7
br i1 %cmp2, label %for.cond3.preheader, label %for.end19, !llvm.loop !11
for.end19: ; preds = %for.end, %for.cond1.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %y, ptr noundef nonnull %x)
%8 = load i32, ptr %x, align 4, !tbaa !5
%9 = load i32, ptr %y, align 4, !tbaa !5
%add = sub i32 0, %9
%cmp = icmp eq i32 %8, %add
br i1 %cmp, label %for.end21, label %for.cond1.preheader
for.end21: ; preds = %for.end19, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main()
{
int H,W,j,i;
while(1){
scanf("%d", &H);
scanf("%d", &W);
if(H == 0 && W == 0)
break;
for(i = 1; i <= H; i++)
{
for(j = 1; j <= W; j++)
{
if(i!=1 && i!=H){
if(j!=1 && j!=W){
printf(".");
}else{
printf("#");
}
}else{
printf("#");
}
/*
if(i>1 && i<H && j>1 && j<W)printf(".");
else printf("#");
*/
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100147/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100147/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:
%H = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H)
%call144 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %W)
%0 = load i32, ptr %H, align 4, !tbaa !5
%cmp45 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp246 = icmp eq i32 %1, 0
%or.cond47 = select i1 %cmp45, i1 %cmp246, i1 false
br i1 %or.cond47, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end24
%2 = phi i32 [ %10, %for.end24 ], [ %0, %entry ]
%cmp3.not40 = icmp slt i32 %2, 1
br i1 %cmp3.not40, label %for.end24, label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond.preheader, %for.end
%i.041 = phi i32 [ %inc23, %for.end ], [ 1, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp5.not38 = icmp slt i32 %3, 1
br i1 %cmp5.not38, label %for.end, label %for.body6.lr.ph
for.body6.lr.ph: ; preds = %for.cond4.preheader
%cmp7.not = icmp eq i32 %i.041, 1
br i1 %cmp7.not, label %for.body6.us, label %for.body6
for.body6.us: ; preds = %for.body6.lr.ph, %for.body6.us
%j.039.us = phi i32 [ %inc.us, %for.body6.us ], [ 1, %for.body6.lr.ph ]
%putchar33.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.039.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp5.not.us.not = icmp slt i32 %j.039.us, %4
br i1 %cmp5.not.us.not, label %for.body6.us, label %for.end, !llvm.loop !9
for.body6: ; preds = %for.body6.lr.ph, %for.body6
%5 = phi i32 [ %8, %for.body6 ], [ %3, %for.body6.lr.ph ]
%j.039 = phi i32 [ %inc, %for.body6 ], [ 1, %for.body6.lr.ph ]
%6 = load i32, ptr %H, align 4
%cmp9.not = icmp eq i32 %i.041, %6
%cmp11.not = icmp eq i32 %j.039, 1
%cmp13.not = icmp eq i32 %j.039, %5
%or.cond37 = or i1 %cmp11.not, %cmp13.not
%7 = select i1 %cmp9.not, i1 true, i1 %or.cond37
%.sink = select i1 %7, i32 35, i32 46
%putchar33 = call i32 @putchar(i32 %.sink)
%inc = add nuw nsw i32 %j.039, 1
%8 = load i32, ptr %W, align 4, !tbaa !5
%cmp5.not.not = icmp slt i32 %j.039, %8
br i1 %cmp5.not.not, label %for.body6, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body6, %for.body6.us, %for.cond4.preheader
%putchar32 = call i32 @putchar(i32 10)
%inc23 = add i32 %i.041, 1
%9 = load i32, ptr %H, align 4, !tbaa !5
%cmp3.not = icmp sgt i32 %inc23, %9
br i1 %cmp3.not, label %for.end24, label %for.cond4.preheader, !llvm.loop !11
for.end24: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %W)
%10 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %10, 0
%11 = load i32, ptr %W, align 4
%cmp2 = icmp eq i32 %11, 0
%or.cond = select i1 %cmp, i1 %cmp2, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end24, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main (){
int H,W,i,j;
while(1){
scanf("%d %d",&H,&W);
if(H==0 && W==0)
break;
for(i=0;i<H;i++){
for(j=0;j<W;j++){
if(i==0 || j==0 || i==H-1 || j==W-1 )
{
printf("#");
}
else printf(".");
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100190/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100190/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call39 = 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
%cmp40 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp141 = icmp eq i32 %1, 0
%or.cond42 = select i1 %cmp40, i1 %cmp141, i1 false
br i1 %or.cond42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end20
%2 = phi i32 [ %9, %for.end20 ], [ %0, %entry ]
%cmp236 = icmp sgt i32 %2, 0
br i1 %cmp236, label %for.cond3.preheader, label %for.end20
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.037 = phi i32 [ %inc19, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.037, 0
br i1 %cmp6, label %for.body5.us, label %for.inc.peel
for.inc.peel: ; preds = %for.body5.lr.ph
%putchar31.peel = call i32 @putchar(i32 35)
%.pre = load i32, ptr %W, align 4, !tbaa !5
%cmp4.peel = icmp sgt i32 %.pre, 1
br i1 %cmp4.peel, label %lor.lhs.false8, label %for.end
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.034.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.034.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
lor.lhs.false8: ; preds = %for.inc.peel, %lor.lhs.false8
%5 = phi i32 [ %7, %lor.lhs.false8 ], [ %.pre, %for.inc.peel ]
%j.034 = phi i32 [ %inc, %lor.lhs.false8 ], [ 1, %for.inc.peel ]
%6 = load i32, ptr %H, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp9 = icmp eq i32 %i.037, %sub
%sub11 = add nsw i32 %5, -1
%cmp12 = icmp eq i32 %j.034, %sub11
%or.cond32 = select i1 %cmp9, i1 true, i1 %cmp12
%. = select i1 %or.cond32, i32 35, i32 46
%putchar31 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.034, 1
%7 = load i32, ptr %W, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %7
br i1 %cmp4, label %lor.lhs.false8, label %for.end, !llvm.loop !11
for.end: ; preds = %lor.lhs.false8, %for.body5.us, %for.inc.peel, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc19 = add nuw nsw i32 %i.037, 1
%8 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc19, %8
br i1 %cmp2, label %for.cond3.preheader, label %for.end20, !llvm.loop !13
for.end20: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%9 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end20, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(void) {
int x, y, i, j;
while(1){
scanf("%d %d", &x, &y);
if(x == 0 && y == 0){
break;
}
for(i = 0; i < x; i++){
if(i == 0 || i == x - 1){
for( j = 0; j < y; j++){
putchar('#');
}
putchar('\n');
}else if( i > 0 && i < x - 1){
for(j = 0; j < y; j++){
if( j == 0){
putchar('#');
}else if( j == y - 1){
putchar('#');
putchar('\n');
}else if( j > 0 && j < y -1){
putchar('.');
}
}
}
}
putchar('\n');
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100277/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100277/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
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
%call73 = 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
%cmp74 = icmp eq i32 %0, 0
%1 = load i32, ptr %y, align 4
%cmp175 = icmp eq i32 %1, 0
%or.cond76 = select i1 %cmp74, i1 %cmp175, i1 false
br i1 %or.cond76, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end45
%2 = phi i32 [ %15, %for.end45 ], [ %0, %entry ]
%cmp270 = icmp sgt i32 %2, 0
br i1 %cmp270, label %for.body, label %for.end45
for.body: ; preds = %for.cond.preheader, %for.inc43
%3 = phi i32 [ %13, %for.inc43 ], [ %2, %for.cond.preheader ]
%i.071 = phi i32 [ %inc44, %for.inc43 ], [ 0, %for.cond.preheader ]
%cmp3 = icmp eq i32 %i.071, 0
br i1 %cmp3, label %for.body.if.then5_crit_edge, label %lor.lhs.false
for.body.if.then5_crit_edge: ; preds = %for.body
%.pre79 = load i32, ptr %y, align 4, !tbaa !5
br label %if.then5
lor.lhs.false: ; preds = %for.body
%sub = add nsw i32 %3, -1
%cmp4 = icmp eq i32 %i.071, %sub
%.pre80 = load i32, ptr %y, align 4
br i1 %cmp4, label %if.then5, label %land.lhs.true12
if.then5: ; preds = %for.body.if.then5_crit_edge, %lor.lhs.false
%4 = phi i32 [ %.pre79, %for.body.if.then5_crit_edge ], [ %.pre80, %lor.lhs.false ]
%cmp768 = icmp sgt i32 %4, 0
br i1 %cmp768, label %for.body8, label %for.end
for.body8: ; preds = %if.then5, %for.body8
%j.069 = phi i32 [ %inc, %for.body8 ], [ 0, %if.then5 ]
%5 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i = call i32 @putc(i32 noundef 35, ptr noundef %5)
%inc = add nuw nsw i32 %j.069, 1
%6 = load i32, ptr %y, align 4, !tbaa !5
%cmp7 = icmp slt i32 %inc, %6
br i1 %cmp7, label %for.body8, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body8, %if.then5
%7 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i60 = call i32 @putc(i32 noundef 10, ptr noundef %7)
br label %for.inc43
land.lhs.true12: ; preds = %lor.lhs.false
%cmp14 = icmp slt i32 %i.071, %sub
%cmp1766 = icmp sgt i32 %.pre80, 0
%or.cond77 = select i1 %cmp14, i1 %cmp1766, i1 false
br i1 %or.cond77, label %for.inc38.peel, label %for.inc43
for.inc38.peel: ; preds = %land.lhs.true12
%8 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i61.peel = call i32 @putc(i32 noundef 35, ptr noundef %8)
%.pre = load i32, ptr %y, align 4, !tbaa !5
%cmp17.peel = icmp sgt i32 %.pre, 1
br i1 %cmp17.peel, label %if.else22, label %for.inc43
if.else22: ; preds = %for.inc38.peel, %for.inc38
%9 = phi i32 [ %12, %for.inc38 ], [ %.pre, %for.inc38.peel ]
%j.167 = phi i32 [ %inc39, %for.inc38 ], [ 1, %for.inc38.peel ]
%sub23 = add nsw i32 %9, -1
%cmp24 = icmp eq i32 %j.167, %sub23
br i1 %cmp24, label %if.then25, label %land.lhs.true30
if.then25: ; preds = %if.else22
%10 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i62 = call i32 @putc(i32 noundef 35, ptr noundef %10)
br label %for.inc38.sink.split
land.lhs.true30: ; preds = %if.else22
%cmp32 = icmp slt i32 %j.167, %sub23
br i1 %cmp32, label %for.inc38.sink.split, label %for.inc38
for.inc38.sink.split: ; preds = %land.lhs.true30, %if.then25
%.sink = phi i32 [ 10, %if.then25 ], [ 46, %land.lhs.true30 ]
%11 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i64 = call i32 @putc(i32 noundef %.sink, ptr noundef %11)
br label %for.inc38
for.inc38: ; preds = %for.inc38.sink.split, %land.lhs.true30
%inc39 = add nuw nsw i32 %j.167, 1
%12 = load i32, ptr %y, align 4, !tbaa !5
%cmp17 = icmp slt i32 %inc39, %12
br i1 %cmp17, label %if.else22, label %for.inc43, !llvm.loop !13
for.inc43: ; preds = %for.inc38, %for.inc38.peel, %for.end, %land.lhs.true12
%inc44 = add nuw nsw i32 %i.071, 1
%13 = load i32, ptr %x, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc44, %13
br i1 %cmp2, label %for.body, label %for.end45, !llvm.loop !15
for.end45: ; preds = %for.inc43, %for.cond.preheader
%14 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i65 = call i32 @putc(i32 noundef 10, ptr noundef %14)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%15 = load i32, ptr %x, align 4, !tbaa !5
%cmp = icmp eq i32 %15, 0
%16 = load i32, ptr %y, align 4
%cmp1 = icmp eq i32 %16, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end45, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 @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 = { 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}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14}
!14 = !{!"llvm.loop.peeled.count", i32 1}
!15 = distinct !{!15, !12}
|
#include<stdio.h>
int main(){
int H,W;
int i,j;
while(1){
scanf("%d%d",&H,&W);
if(H==0 && W==0)break;
else {
for(i=0;i<H;i++){
printf("#");
for(j=1;j<W-1;j++){
if(i==0 ||i==H-1){
printf("#");
}else {
printf(".");
}
}
printf("#");
printf("\n");
}
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100327/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100327/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call36 = 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
%cmp37 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp138 = icmp eq i32 %1, 0
%or.cond39 = select i1 %cmp37, i1 %cmp138, i1 false
br i1 %or.cond39, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %if.end19
%2 = phi i32 [ %8, %if.end19 ], [ %0, %entry ]
%cmp233 = icmp sgt i32 %2, 0
br i1 %cmp233, label %for.body, label %if.end19
for.body: ; preds = %for.cond.preheader, %for.end
%i.034 = phi i32 [ %inc17, %for.end ], [ 0, %for.cond.preheader ]
%putchar25 = call i32 @putchar(i32 35)
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp531 = icmp sgt i32 %3, 2
br i1 %cmp531, label %for.body6.lr.ph, label %for.end
for.body6.lr.ph: ; preds = %for.body
%cmp7 = icmp eq i32 %i.034, 0
br i1 %cmp7, label %for.body6.us, label %for.body6
for.body6.us: ; preds = %for.body6.lr.ph, %for.body6.us
%j.032.us = phi i32 [ %inc.us, %for.body6.us ], [ 1, %for.body6.lr.ph ]
%putchar29.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.032.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%sub.us = add nsw i32 %4, -1
%cmp5.us = icmp slt i32 %inc.us, %sub.us
br i1 %cmp5.us, label %for.body6.us, label %for.end, !llvm.loop !9
for.body6: ; preds = %for.body6.lr.ph, %for.body6
%j.032 = phi i32 [ %inc, %for.body6 ], [ 1, %for.body6.lr.ph ]
%5 = load i32, ptr %H, align 4, !tbaa !5
%sub8 = add nsw i32 %5, -1
%cmp9 = icmp eq i32 %i.034, %sub8
%. = select i1 %cmp9, i32 35, i32 46
%putchar29 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.032, 1
%6 = load i32, ptr %W, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp5 = icmp slt i32 %inc, %sub
br i1 %cmp5, label %for.body6, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body6, %for.body6.us, %for.body
%putchar26 = call i32 @putchar(i32 35)
%putchar27 = call i32 @putchar(i32 10)
%inc17 = add nuw nsw i32 %i.034, 1
%7 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc17, %7
br i1 %cmp2, label %for.body, label %if.end19, !llvm.loop !11
if.end19: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%8 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %8, 0
%9 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %9, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %if.end19, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main (void)
{
int H[1000], W[1000];
int i,j,h,w;
for(i=0;;i++){
scanf("%d %d", &H[i], &W[i]);
if(H[i]==0 && W[i]==0) break;
}
for(j=0;j<i;j++){
for(w=0;w<W[j];w++){
printf("#");
}
printf("\n");
for(h=1;h<H[j]-1;h++){
for(w=0;w<W[j];w++){
if(w==0||w==W[j]-1){
printf("#");
} else {
printf(".");
}
}
printf("\n");
}
for(w=0;w<W[j];w++){
printf("#");
}
printf("\n\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100370/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100370/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 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca [1000 x i32], align 16
%W = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %W) #4
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%indvars.iv101 = phi i32 [ %indvars.iv.next102, %for.inc ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %H, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [1000 x i32], ptr %W, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 0
br i1 %cmp, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.cond
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp7 = icmp eq i32 %1, 0
br i1 %cmp7, label %for.cond8.preheader, label %for.inc
for.cond8.preheader: ; preds = %land.lhs.true
%2 = and i64 %indvars.iv, 4294967295
%cmp994.not = icmp eq i64 %2, 0
br i1 %cmp994.not, label %for.end58, label %for.cond10.preheader.preheader
for.cond10.preheader.preheader: ; preds = %for.cond8.preheader
%wide.trip.count = zext i32 %indvars.iv101 to i64
br label %for.cond10.preheader
for.inc: ; preds = %for.cond, %land.lhs.true
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next102 = add nuw i32 %indvars.iv101, 1
br label %for.cond
for.cond10.preheader: ; preds = %for.cond10.preheader.preheader, %for.end54
%indvars.iv98 = phi i64 [ 0, %for.cond10.preheader.preheader ], [ %indvars.iv.next99, %for.end54 ]
%arrayidx12 = getelementptr inbounds [1000 x i32], ptr %W, i64 0, i64 %indvars.iv98
%3 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp1384 = icmp sgt i32 %3, 0
br i1 %cmp1384, label %for.body14, label %for.end18
for.body14: ; preds = %for.cond10.preheader, %for.body14
%w.085 = phi i32 [ %inc17, %for.body14 ], [ 0, %for.cond10.preheader ]
%putchar82 = call i32 @putchar(i32 35)
%inc17 = add nuw nsw i32 %w.085, 1
%4 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13 = icmp slt i32 %inc17, %4
br i1 %cmp13, label %for.body14, label %for.end18, !llvm.loop !9
for.end18: ; preds = %for.body14, %for.cond10.preheader
%putchar = call i32 @putchar(i32 10)
%arrayidx22 = getelementptr inbounds [1000 x i32], ptr %H, i64 0, i64 %indvars.iv98
%5 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp2390 = icmp sgt i32 %5, 2
br i1 %cmp2390, label %for.cond25.preheader, label %for.cond46.preheader
for.cond46.preheader: ; preds = %for.end41, %for.end18
%6 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp4992 = icmp sgt i32 %6, 0
br i1 %cmp4992, label %for.body50, label %for.end54
for.cond25.preheader: ; preds = %for.end18, %for.end41
%h.091 = phi i32 [ %inc44, %for.end41 ], [ 1, %for.end18 ]
%7 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp2887 = icmp sgt i32 %7, 0
br i1 %cmp2887, label %for.inc39.peel, label %for.end41
for.inc39.peel: ; preds = %for.cond25.preheader
%putchar81.peel = call i32 @putchar(i32 35)
%.pre = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp28.peel = icmp sgt i32 %.pre, 1
br i1 %cmp28.peel, label %for.body29, label %for.end41
for.body29: ; preds = %for.inc39.peel, %for.body29
%8 = phi i32 [ %9, %for.body29 ], [ %.pre, %for.inc39.peel ]
%w.188 = phi i32 [ %inc40, %for.body29 ], [ 1, %for.inc39.peel ]
%sub33 = add nsw i32 %8, -1
%cmp34 = icmp eq i32 %w.188, %sub33
%. = select i1 %cmp34, i32 35, i32 46
%putchar81 = call i32 @putchar(i32 %.)
%inc40 = add nuw nsw i32 %w.188, 1
%9 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp28 = icmp slt i32 %inc40, %9
br i1 %cmp28, label %for.body29, label %for.end41, !llvm.loop !11
for.end41: ; preds = %for.body29, %for.inc39.peel, %for.cond25.preheader
%putchar79 = call i32 @putchar(i32 10)
%inc44 = add nuw nsw i32 %h.091, 1
%10 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%sub = add nsw i32 %10, -1
%cmp23 = icmp slt i32 %inc44, %sub
br i1 %cmp23, label %for.cond25.preheader, label %for.cond46.preheader, !llvm.loop !13
for.body50: ; preds = %for.cond46.preheader, %for.body50
%w.293 = phi i32 [ %inc53, %for.body50 ], [ 0, %for.cond46.preheader ]
%putchar78 = call i32 @putchar(i32 35)
%inc53 = add nuw nsw i32 %w.293, 1
%11 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp49 = icmp slt i32 %inc53, %11
br i1 %cmp49, label %for.body50, label %for.end54, !llvm.loop !14
for.end54: ; preds = %for.body50, %for.cond46.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
%exitcond.not = icmp eq i64 %indvars.iv.next99, %wide.trip.count
br i1 %exitcond.not, label %for.end58, label %for.cond10.preheader, !llvm.loop !15
for.end58: ; preds = %for.end54, %for.cond8.preheader
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %H) #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 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int main(void)
{
int h, w;
int i, j;
scanf("%d %d", &h, &w);
while (h != 0 && w != 0)
{
for (i = 0; i < h; i++)
{
if (i == 0 || i == h - 1) {
for (j = 0; j < w; j++)
{
printf("#");
}
}
else{
for (j = 0; j < w; j++)
{
if (j == 0 || j == w - 1)
printf("#");
else
printf(".");
}
}
printf("\n");
}
printf("\n");
scanf("%d %d", &h, &w);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100413/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100413/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%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
%cmp51 = icmp ne i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp152 = icmp ne i32 %1, 0
%2 = select i1 %cmp51, i1 %cmp152, i1 false
br i1 %2, label %for.cond.preheader, label %while.end
for.cond.preheader: ; preds = %entry, %for.end27
%3 = phi i32 [ %10, %for.end27 ], [ %0, %entry ]
%cmp249 = icmp sgt i32 %3, 0
br i1 %cmp249, label %for.body, label %for.end27
for.body: ; preds = %for.cond.preheader, %if.end23
%4 = phi i32 [ %9, %if.end23 ], [ %3, %for.cond.preheader ]
%i.050 = phi i32 [ %inc26, %if.end23 ], [ 0, %for.cond.preheader ]
%cmp3 = icmp eq i32 %i.050, 0
%sub = add nsw i32 %4, -1
%cmp4 = icmp eq i32 %i.050, %sub
%or.cond = select i1 %cmp3, i1 true, i1 %cmp4
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp647 = icmp sgt i32 %5, 0
br i1 %or.cond, label %for.cond5.preheader, label %for.cond9.preheader
for.cond9.preheader: ; preds = %for.body
br i1 %cmp647, label %for.inc20.peel, label %if.end23
for.inc20.peel: ; preds = %for.cond9.preheader
%putchar40.peel = call i32 @putchar(i32 35)
%.pre = load i32, ptr %w, align 4, !tbaa !5
%cmp10.peel = icmp sgt i32 %.pre, 1
br i1 %cmp10.peel, label %for.body11, label %if.end23
for.cond5.preheader: ; preds = %for.body
br i1 %cmp647, label %for.body7, label %if.end23
for.body7: ; preds = %for.cond5.preheader, %for.body7
%j.048 = phi i32 [ %inc, %for.body7 ], [ 0, %for.cond5.preheader ]
%putchar42 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %j.048, 1
%6 = load i32, ptr %w, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc, %6
br i1 %cmp6, label %for.body7, label %if.end23, !llvm.loop !9
for.body11: ; preds = %for.inc20.peel, %for.body11
%7 = phi i32 [ %8, %for.body11 ], [ %.pre, %for.inc20.peel ]
%j.146 = phi i32 [ %inc21, %for.body11 ], [ 1, %for.inc20.peel ]
%sub14 = add nsw i32 %7, -1
%cmp15 = icmp eq i32 %j.146, %sub14
%. = select i1 %cmp15, i32 35, i32 46
%putchar40 = call i32 @putchar(i32 %.)
%inc21 = add nuw nsw i32 %j.146, 1
%8 = load i32, ptr %w, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc21, %8
br i1 %cmp10, label %for.body11, label %if.end23, !llvm.loop !11
if.end23: ; preds = %for.body11, %for.body7, %for.inc20.peel, %for.cond9.preheader, %for.cond5.preheader
%putchar41 = call i32 @putchar(i32 10)
%inc26 = add nuw nsw i32 %i.050, 1
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc26, %9
br i1 %cmp2, label %for.body, label %for.end27, !llvm.loop !13
for.end27: ; preds = %if.end23, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%10 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp ne i32 %10, 0
%11 = load i32, ptr %w, align 4
%cmp1 = icmp ne i32 %11, 0
%12 = select i1 %cmp, i1 %cmp1, i1 false
br i1 %12, label %for.cond.preheader, label %while.end, !llvm.loop !14
while.end: ; preds = %for.end27, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(){
int H,W,i,j;
for(;;){
scanf("%d %d",&H,&W);
if(H==0&&W==0)break;
for(j=0;j<H;j++){
for(i=0;i<W;i++){
if(i==0||i==W-1||j==0||j==H-1){
printf("#");
}else{
printf(".");
}
}printf("\n");
}printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100457/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100457/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call40 = 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
%cmp41 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp142 = icmp eq i32 %1, 0
%or.cond43 = select i1 %cmp41, i1 %cmp142, i1 false
br i1 %or.cond43, label %for.end23, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %for.end21
%2 = phi i32 [ %10, %for.end21 ], [ %0, %entry ]
%cmp337 = icmp sgt i32 %2, 0
br i1 %cmp337, label %for.cond4.preheader, label %for.end21
for.cond4.preheader: ; preds = %for.cond2.preheader, %for.end
%j.038 = phi i32 [ %inc20, %for.end ], [ 0, %for.cond2.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp534 = icmp sgt i32 %3, 0
br i1 %cmp534, label %for.body6.lr.ph, label %for.end
for.body6.lr.ph: ; preds = %for.cond4.preheader
%cmp10 = icmp eq i32 %j.038, 0
br i1 %cmp10, label %for.body6.us, label %for.inc.peel
for.inc.peel: ; preds = %for.body6.lr.ph
%putchar33.peel = call i32 @putchar(i32 35)
%.pre = load i32, ptr %W, align 4, !tbaa !5
%cmp5.peel = icmp sgt i32 %.pre, 1
br i1 %cmp5.peel, label %for.body6, label %for.end
for.body6.us: ; preds = %for.body6.lr.ph, %for.body6.us
%i.035.us = phi i32 [ %inc.us, %for.body6.us ], [ 0, %for.body6.lr.ph ]
%putchar33.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %i.035.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp5.us = icmp slt i32 %inc.us, %4
br i1 %cmp5.us, label %for.body6.us, label %for.end, !llvm.loop !9
for.body6: ; preds = %for.inc.peel, %for.body6
%5 = phi i32 [ %8, %for.body6 ], [ %.pre, %for.inc.peel ]
%i.035 = phi i32 [ %inc, %for.body6 ], [ 1, %for.inc.peel ]
%sub = add nsw i32 %5, -1
%cmp8 = icmp eq i32 %i.035, %sub
%6 = load i32, ptr %H, align 4
%sub12 = add nsw i32 %6, -1
%cmp13 = icmp eq i32 %j.038, %sub12
%7 = select i1 %cmp8, i1 true, i1 %cmp13
%.sink = select i1 %7, i32 35, i32 46
%putchar33 = call i32 @putchar(i32 %.sink)
%inc = add nuw nsw i32 %i.035, 1
%8 = load i32, ptr %W, align 4, !tbaa !5
%cmp5 = icmp slt i32 %inc, %8
br i1 %cmp5, label %for.body6, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body6, %for.body6.us, %for.inc.peel, %for.cond4.preheader
%putchar31 = call i32 @putchar(i32 10)
%inc20 = add nuw nsw i32 %j.038, 1
%9 = load i32, ptr %H, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc20, %9
br i1 %cmp3, label %for.cond4.preheader, label %for.end21, !llvm.loop !13
for.end21: ; preds = %for.end, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%10 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %10, 0
%11 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %11, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %for.end23, label %for.cond2.preheader
for.end23: ; preds = %for.end21, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main()
{
long long int n, m, ta, tb, k;
scanf("%lld %lld %lld %lld %lld", &n, &m, &ta, &tb, &k);
long long int i;
long long int a[200005], b[200005];
for (i = 0; i < n; i++)
scanf("%lld", &a[i]);
for (i = 0; i < m; i++)
scanf("%lld", &b[i]);
if (n <= k || m <= k)
{
printf("-1\n");
return 0;
}
long long int ans = 0;
long long int max, min, mid, t;
for (i = 0; i <= k; i++)
{
t = a[i] + ta;
if (b[0] >= t)
min = 0;
else if (b[m - 1] < t)
{
min = m;
}
else
{
min = 0;
max = m - 1;
while (max - min > 1)
{
mid = (max + min) / 2;
if (b[mid] >= t)
max = mid;
else
min = mid;
}
min++;
}
min += k - i;
if (min >= m)
{
printf("-1\n");
return 0;
}
t = b[min] + tb;
if (ans < t)
ans = t;
}
printf("%lld\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10050/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10050/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 [25 x i8] c"%lld %lld %lld %lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%m = alloca i64, align 8
%ta = alloca i64, align 8
%tb = alloca i64, align 8
%k = alloca i64, align 8
%a = alloca [200005 x i64], align 16
%b = alloca [200005 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %ta) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %tb) #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 %n, ptr noundef nonnull %m, ptr noundef nonnull %ta, ptr noundef nonnull %tb, ptr noundef nonnull %k)
call void @llvm.lifetime.start.p0(i64 1600040, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 1600040, ptr nonnull %b) #5
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp88 = icmp sgt i64 %0, 0
br i1 %cmp88, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%1 = phi i64 [ %0, %entry ], [ %3, %for.body ]
%2 = load i64, ptr %m, align 8, !tbaa !5
%cmp390 = icmp sgt i64 %2, 0
br i1 %cmp390, label %for.body4, label %for.end9
for.body: ; preds = %entry, %for.body
%i.089 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200005 x i64], ptr %a, i64 0, i64 %i.089
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.089, 1
%3 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.body4
%i.191 = phi i64 [ %inc8, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx5 = getelementptr inbounds [200005 x i64], ptr %b, i64 0, i64 %i.191
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5)
%inc8 = add nuw nsw i64 %i.191, 1
%4 = load i64, ptr %m, align 8, !tbaa !5
%cmp3 = icmp slt i64 %inc8, %4
br i1 %cmp3, label %for.body4, label %for.end9.loopexit, !llvm.loop !11
for.end9.loopexit: ; preds = %for.body4
%.pre = load i64, ptr %n, align 8, !tbaa !5
br label %for.end9
for.end9: ; preds = %for.end9.loopexit, %for.cond2.preheader
%5 = phi i64 [ %1, %for.cond2.preheader ], [ %.pre, %for.end9.loopexit ]
%.lcssa = phi i64 [ %2, %for.cond2.preheader ], [ %4, %for.end9.loopexit ]
%.lcssa.fr = freeze i64 %.lcssa
%6 = load i64, ptr %k, align 8, !tbaa !5
%cmp10.not = icmp sgt i64 %5, %6
%cmp11.not = icmp sgt i64 %.lcssa.fr, %6
%or.cond = and i1 %cmp10.not, %cmp11.not
br i1 %or.cond, label %for.cond13.preheader, label %if.then
for.cond13.preheader: ; preds = %for.end9
%cmp14.not96 = icmp slt i64 %6, 0
br i1 %cmp14.not96, label %for.end49, label %for.body15.lr.ph
for.body15.lr.ph: ; preds = %for.cond13.preheader
%7 = load i64, ptr %ta, align 8, !tbaa !5
%8 = load i64, ptr %b, align 16, !tbaa !5
%sub = add nsw i64 %.lcssa.fr, -1
%arrayidx20 = getelementptr inbounds [200005 x i64], ptr %b, i64 0, i64 %sub
%cmp2692 = icmp sgt i64 %.lcssa.fr, 2
%9 = load i64, ptr %tb, align 8
br i1 %cmp2692, label %for.body15.us, label %for.body15
for.body15.us: ; preds = %for.body15.lr.ph, %if.end41.us
%ans.098.us = phi i64 [ %spec.select.us, %if.end41.us ], [ 0, %for.body15.lr.ph ]
%i.297.us = phi i64 [ %inc48.us, %if.end41.us ], [ 0, %for.body15.lr.ph ]
%arrayidx16.us = getelementptr inbounds [200005 x i64], ptr %a, i64 0, i64 %i.297.us
%10 = load i64, ptr %arrayidx16.us, align 8, !tbaa !5
%add.us = add nsw i64 %7, %10
%cmp18.not.us = icmp slt i64 %8, %add.us
br i1 %cmp18.not.us, label %if.else.us, label %if.end35.us
if.else.us: ; preds = %for.body15.us
%11 = load i64, ptr %arrayidx20, align 8, !tbaa !5
%cmp21.us = icmp slt i64 %11, %add.us
br i1 %cmp21.us, label %if.end35.us, label %while.body.us
while.body.us: ; preds = %if.else.us, %while.body.us
%min.094.us = phi i64 [ %div.min.0.us, %while.body.us ], [ 0, %if.else.us ]
%max.093.us = phi i64 [ %max.0.div.us, %while.body.us ], [ %sub, %if.else.us ]
%add27.us = add nsw i64 %min.094.us, %max.093.us
%div.us = sdiv i64 %add27.us, 2
%arrayidx28.us = getelementptr inbounds [200005 x i64], ptr %b, i64 0, i64 %div.us
%12 = load i64, ptr %arrayidx28.us, align 8, !tbaa !5
%cmp29.not.us = icmp slt i64 %12, %add.us
%max.0.div.us = select i1 %cmp29.not.us, i64 %max.093.us, i64 %div.us
%div.min.0.us = select i1 %cmp29.not.us, i64 %div.us, i64 %min.094.us
%sub25.us = sub nsw i64 %max.0.div.us, %div.min.0.us
%cmp26.us = icmp sgt i64 %sub25.us, 1
br i1 %cmp26.us, label %while.body.us, label %while.cond.while.end_crit_edge.us, !llvm.loop !12
if.end35.us: ; preds = %while.cond.while.end_crit_edge.us, %if.else.us, %for.body15.us
%min.2.us = phi i64 [ %inc33.us, %while.cond.while.end_crit_edge.us ], [ 0, %for.body15.us ], [ %.lcssa.fr, %if.else.us ]
%sub36.us = sub nsw i64 %6, %i.297.us
%add37.us = add nsw i64 %min.2.us, %sub36.us
%cmp38.not.us = icmp slt i64 %add37.us, %.lcssa.fr
br i1 %cmp38.not.us, label %if.end41.us, label %if.then39
if.end41.us: ; preds = %if.end35.us
%arrayidx42.us = getelementptr inbounds [200005 x i64], ptr %b, i64 0, i64 %add37.us
%13 = load i64, ptr %arrayidx42.us, align 8, !tbaa !5
%add43.us = add nsw i64 %9, %13
%spec.select.us = call i64 @llvm.smax.i64(i64 %ans.098.us, i64 %add43.us)
%inc48.us = add nuw i64 %i.297.us, 1
%exitcond104.not = icmp eq i64 %i.297.us, %6
br i1 %exitcond104.not, label %for.end49, label %for.body15.us, !llvm.loop !13
while.cond.while.end_crit_edge.us: ; preds = %while.body.us
%inc33.us = add nsw i64 %div.min.0.us, 1
br label %if.end35.us
if.then: ; preds = %for.end9
%puts86 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %cleanup55
for.body15: ; preds = %for.body15.lr.ph, %if.end41
%ans.098 = phi i64 [ %spec.select, %if.end41 ], [ 0, %for.body15.lr.ph ]
%i.297 = phi i64 [ %inc48, %if.end41 ], [ 0, %for.body15.lr.ph ]
%arrayidx16 = getelementptr inbounds [200005 x i64], ptr %a, i64 0, i64 %i.297
%14 = load i64, ptr %arrayidx16, align 8, !tbaa !5
%add = add nsw i64 %7, %14
%cmp18.not = icmp slt i64 %8, %add
br i1 %cmp18.not, label %if.else, label %if.end35
if.else: ; preds = %for.body15
%15 = load i64, ptr %arrayidx20, align 8, !tbaa !5
%cmp21 = icmp slt i64 %15, %add
%spec.select100 = select i1 %cmp21, i64 %.lcssa.fr, i64 1
br label %if.end35
if.end35: ; preds = %if.else, %for.body15
%min.2 = phi i64 [ 0, %for.body15 ], [ %spec.select100, %if.else ]
%sub36 = sub nsw i64 %6, %i.297
%add37 = add nsw i64 %min.2, %sub36
%cmp38.not = icmp slt i64 %add37, %.lcssa.fr
br i1 %cmp38.not, label %if.end41, label %if.then39
if.then39: ; preds = %if.end35, %if.end35.us
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %cleanup55
if.end41: ; preds = %if.end35
%arrayidx42 = getelementptr inbounds [200005 x i64], ptr %b, i64 0, i64 %add37
%16 = load i64, ptr %arrayidx42, align 8, !tbaa !5
%add43 = add nsw i64 %9, %16
%spec.select = call i64 @llvm.smax.i64(i64 %ans.098, i64 %add43)
%inc48 = add nuw i64 %i.297, 1
%exitcond.not = icmp eq i64 %i.297, %6
br i1 %exitcond.not, label %for.end49, label %for.body15, !llvm.loop !13
for.end49: ; preds = %if.end41, %if.end41.us, %for.cond13.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond13.preheader ], [ %spec.select.us, %if.end41.us ], [ %spec.select, %if.end41 ]
%call50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %ans.0.lcssa)
br label %cleanup55
cleanup55: ; preds = %if.then39, %for.end49, %if.then
call void @llvm.lifetime.end.p0(i64 1600040, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 1600040, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %tb) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %ta) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 8, 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: 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
; 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main()
{
int H,W,i,j;
while(1)
{
scanf("%d %d",&H,&W);
if(H==0 && W==0)
{
break;
}
for(i=0;i<H;i++)
{
for(j=0;j<W;j++)
{
if(i==0 || i==H-1 || j==0 || j==W-1)
{
printf("#");
}
else
{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100543/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100543/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call39 = 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
%cmp40 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp141 = icmp eq i32 %1, 0
%or.cond42 = select i1 %cmp40, i1 %cmp141, i1 false
br i1 %or.cond42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end20
%2 = phi i32 [ %9, %for.end20 ], [ %0, %entry ]
%cmp236 = icmp sgt i32 %2, 0
br i1 %cmp236, label %for.cond3.preheader, label %for.end20
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.037 = phi i32 [ %inc19, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.037, 0
br i1 %cmp6, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.034.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.034.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%5 = phi i32 [ %7, %for.body5 ], [ %3, %for.body5.lr.ph ]
%j.034 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body5.lr.ph ]
%6 = load i32, ptr %H, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp7 = icmp eq i32 %i.037, %sub
%cmp9 = icmp eq i32 %j.034, 0
%or.cond22 = or i1 %cmp9, %cmp7
%sub11 = add nsw i32 %5, -1
%cmp12 = icmp eq i32 %j.034, %sub11
%or.cond32 = select i1 %or.cond22, i1 true, i1 %cmp12
%. = select i1 %or.cond32, i32 35, i32 46
%putchar31 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.034, 1
%7 = load i32, ptr %W, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %7
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc19 = add nuw nsw i32 %i.037, 1
%8 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc19, %8
br i1 %cmp2, label %for.cond3.preheader, label %for.end20, !llvm.loop !11
for.end20: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%9 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end20, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
// ITP1_5_B: Print a Frame
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
int main()
{
int H, W;
int h, w;
while (1) {
scanf("%d%d", &H, &W);
if (H == 0 && W == 0) break;
for (w = 0; w < W; w++) putchar('#');
putchar('\n');
for (h = 2; h < H; h++) {
putchar('#');
for (w = 2; w < W; w++) putchar('.');
putchar('#');
putchar('\n');
}
for (w = 0; w < W; w++) putchar('#');
putchar('\n');
putchar('\n');
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100594/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100594/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
@stdout = 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) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #3
%call52 = 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
%cmp53 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp154 = icmp eq i32 %1, 0
%or.cond55 = select i1 %cmp53, i1 %cmp154, i1 false
br i1 %or.cond55, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end27
%2 = phi i32 [ %20, %for.end27 ], [ %1, %entry ]
%cmp244 = icmp sgt i32 %2, 0
br i1 %cmp244, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.body
%w.045 = phi i32 [ %inc, %for.body ], [ 0, %for.cond.preheader ]
%3 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i = call i32 @putc(i32 noundef 35, ptr noundef %3)
%inc = add nuw nsw i32 %w.045, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc, %4
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %for.cond.preheader
%5 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i36 = call i32 @putc(i32 noundef 10, ptr noundef %5)
%6 = load i32, ptr %H, align 4, !tbaa !5
%cmp648 = icmp sgt i32 %6, 2
br i1 %cmp648, label %for.body7, label %for.cond21.preheader
for.cond21.preheader: ; preds = %for.end15, %for.end
%7 = load i32, ptr %W, align 4, !tbaa !5
%cmp2250 = icmp sgt i32 %7, 0
br i1 %cmp2250, label %for.body23, label %for.end27
for.body7: ; preds = %for.end, %for.end15
%h.049 = phi i32 [ %inc19, %for.end15 ], [ 2, %for.end ]
%8 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i37 = call i32 @putc(i32 noundef 35, ptr noundef %8)
%9 = load i32, ptr %W, align 4, !tbaa !5
%cmp1046 = icmp sgt i32 %9, 2
br i1 %cmp1046, label %for.body11, label %for.end15
for.body11: ; preds = %for.body7, %for.body11
%w.147 = phi i32 [ %inc14, %for.body11 ], [ 2, %for.body7 ]
%10 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i38 = call i32 @putc(i32 noundef 46, ptr noundef %10)
%inc14 = add nuw nsw i32 %w.147, 1
%11 = load i32, ptr %W, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc14, %11
br i1 %cmp10, label %for.body11, label %for.end15, !llvm.loop !13
for.end15: ; preds = %for.body11, %for.body7
%12 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i39 = call i32 @putc(i32 noundef 35, ptr noundef %12)
%13 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i40 = call i32 @putc(i32 noundef 10, ptr noundef %13)
%inc19 = add nuw nsw i32 %h.049, 1
%14 = load i32, ptr %H, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc19, %14
br i1 %cmp6, label %for.body7, label %for.cond21.preheader, !llvm.loop !14
for.body23: ; preds = %for.cond21.preheader, %for.body23
%w.251 = phi i32 [ %inc26, %for.body23 ], [ 0, %for.cond21.preheader ]
%15 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i41 = call i32 @putc(i32 noundef 35, ptr noundef %15)
%inc26 = add nuw nsw i32 %w.251, 1
%16 = load i32, ptr %W, align 4, !tbaa !5
%cmp22 = icmp slt i32 %inc26, %16
br i1 %cmp22, label %for.body23, label %for.end27, !llvm.loop !15
for.end27: ; preds = %for.body23, %for.cond21.preheader
%17 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i42 = call i32 @putc(i32 noundef 10, ptr noundef %17)
%18 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i43 = call i32 @putc(i32 noundef 10, ptr noundef %18)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%19 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %19, 0
%20 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %20, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end27, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 @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 = { 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}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
|
#include<stdio.h>
int main(void){
int Height, Width;
int i, j;
do{
scanf("%d%d",&Height,&Width);
if(Height==0&&Width==0)break;
for(i=0;i<Height;i++){
for(j=0;j<Width;j++){
if((i==0)||(i==Height-1))
putchar('#');
else if((j==0)||(j==Width-1))
putchar('#');
else
putchar('.');
}
putchar('\n');
}
putchar('\n');
}while(1);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100644/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100644/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
@stdout = external local_unnamed_addr global ptr, align 8
; 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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Height) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Width) #3
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %Height, ptr noundef nonnull %Width)
%0 = load i32, ptr %Height, align 4, !tbaa !5
%cmp43 = icmp eq i32 %0, 0
%1 = load i32, ptr %Width, align 4
%cmp144 = icmp eq i32 %1, 0
%or.cond45 = select i1 %cmp43, i1 %cmp144, i1 false
br i1 %or.cond45, label %do.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%2 = phi i32 [ %16, %for.end23 ], [ %0, %entry ]
%cmp239 = icmp sgt i32 %2, 0
br i1 %cmp239, label %for.cond3.preheader, label %for.end23
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.040 = phi i32 [ %inc22, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %Width, align 4, !tbaa !5
%cmp436 = icmp sgt i32 %3, 0
br i1 %cmp436, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.040, 0
br i1 %cmp6, label %for.body5.us, label %for.body5.preheader
for.body5.preheader: ; preds = %for.body5.lr.ph
%4 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i.peel = call i32 @putc(i32 noundef 35, ptr noundef %4)
%5 = load i32, ptr %Width, align 4, !tbaa !5
%cmp4.peel = icmp sgt i32 %5, 1
br i1 %cmp4.peel, label %for.body5, label %for.end
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.037.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%6 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i.us = call i32 @putc(i32 noundef 35, ptr noundef %6)
%inc.us = add nuw nsw i32 %j.037.us, 1
%7 = load i32, ptr %Width, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %7
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !11
for.body5: ; preds = %for.body5.preheader, %for.inc
%8 = phi i32 [ %12, %for.inc ], [ %5, %for.body5.preheader ]
%j.037 = phi i32 [ %inc, %for.inc ], [ 1, %for.body5.preheader ]
%9 = load i32, ptr %Height, align 4, !tbaa !5
%sub = add nsw i32 %9, -1
%cmp7 = icmp eq i32 %i.040, %sub
br i1 %cmp7, label %if.then8, label %if.else
if.then8: ; preds = %for.body5
%10 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i = call i32 @putc(i32 noundef 35, ptr noundef %10)
br label %for.inc
if.else: ; preds = %for.body5
%sub12 = add nsw i32 %8, -1
%cmp13 = icmp eq i32 %j.037, %sub12
%11 = load ptr, ptr @stdout, align 8, !tbaa !9
br i1 %cmp13, label %if.then14, label %if.else16
if.then14: ; preds = %if.else
%call.i32 = call i32 @putc(i32 noundef 35, ptr noundef %11)
br label %for.inc
if.else16: ; preds = %if.else
%call.i33 = call i32 @putc(i32 noundef 46, ptr noundef %11)
br label %for.inc
for.inc: ; preds = %if.then8, %if.else16, %if.then14
%inc = add nuw nsw i32 %j.037, 1
%12 = load i32, ptr %Width, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %12
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !13
for.end: ; preds = %for.inc, %for.body5.us, %for.body5.preheader, %for.cond3.preheader
%13 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i34 = call i32 @putc(i32 noundef 10, ptr noundef %13)
%inc22 = add nuw nsw i32 %i.040, 1
%14 = load i32, ptr %Height, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc22, %14
br i1 %cmp2, label %for.cond3.preheader, label %for.end23, !llvm.loop !15
for.end23: ; preds = %for.end, %for.cond.preheader
%15 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i35 = call i32 @putc(i32 noundef 10, ptr noundef %15)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %Height, ptr noundef nonnull %Width)
%16 = load i32, ptr %Height, align 4, !tbaa !5
%cmp = icmp eq i32 %16, 0
%17 = load i32, ptr %Width, align 4
%cmp1 = icmp eq i32 %17, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %do.end, label %for.cond.preheader
do.end: ; preds = %for.end23, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Width) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Height) #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 @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 = { 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}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14}
!14 = !{!"llvm.loop.peeled.count", i32 1}
!15 = distinct !{!15, !12}
|
#include <stdio.h>
int main(void)
{
int H, W, x, y, i;
for(i = 0; i < 300; i++){
scanf("%d%d", &H, &W);
if((H == 0) && (W == 0)) break;
for(y = 1; y <= H; y++){
for(x = 1; x <= W; x++){
if((y == 1) || (y == H)){
printf("#");
}else{
if((x == 1) || (x == W)){
printf("#");
}else{
printf(".");
}
}
}
printf("\n");
}
printf("\n");
}
return(0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100701/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100701/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
br label %for.body
for.body: ; preds = %entry, %for.end25
%i.048 = phi i32 [ 0, %entry ], [ %inc28, %for.end25 ]
%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
%cmp1 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp2 = icmp eq i32 %1, 0
%or.cond = select i1 %cmp1, i1 %cmp2, i1 false
br i1 %or.cond, label %for.end29, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.body
%cmp4.not45 = icmp slt i32 %0, 1
br i1 %cmp4.not45, label %for.end25, label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.cond3.preheader, %for.end
%y.046 = phi i32 [ %inc24, %for.end ], [ 1, %for.cond3.preheader ]
%2 = load i32, ptr %W, align 4, !tbaa !5
%cmp7.not43 = icmp slt i32 %2, 1
br i1 %cmp7.not43, label %for.end, label %for.body8.lr.ph
for.body8.lr.ph: ; preds = %for.cond6.preheader
%cmp9 = icmp eq i32 %y.046, 1
br i1 %cmp9, label %for.body8.us, label %for.body8
for.body8.us: ; preds = %for.body8.lr.ph, %for.body8.us
%x.044.us = phi i32 [ %inc.us, %for.body8.us ], [ 1, %for.body8.lr.ph ]
%putchar40.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %x.044.us, 1
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp7.not.us.not = icmp slt i32 %x.044.us, %3
br i1 %cmp7.not.us.not, label %for.body8.us, label %for.end, !llvm.loop !9
for.body8: ; preds = %for.body8.lr.ph, %for.body8
%4 = phi i32 [ %7, %for.body8 ], [ %2, %for.body8.lr.ph ]
%x.044 = phi i32 [ %inc, %for.body8 ], [ 1, %for.body8.lr.ph ]
%5 = load i32, ptr %H, align 4
%cmp10 = icmp eq i32 %y.046, %5
%cmp13 = icmp eq i32 %x.044, 1
%cmp15 = icmp eq i32 %x.044, %4
%or.cond42 = or i1 %cmp13, %cmp15
%6 = select i1 %cmp10, i1 true, i1 %or.cond42
%.sink = select i1 %6, i32 35, i32 46
%putchar40 = call i32 @putchar(i32 %.sink)
%inc = add nuw nsw i32 %x.044, 1
%7 = load i32, ptr %W, align 4, !tbaa !5
%cmp7.not.not = icmp slt i32 %x.044, %7
br i1 %cmp7.not.not, label %for.body8, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body8, %for.body8.us, %for.cond6.preheader
%putchar37 = call i32 @putchar(i32 10)
%inc24 = add i32 %y.046, 1
%8 = load i32, ptr %H, align 4, !tbaa !5
%cmp4.not = icmp sgt i32 %inc24, %8
br i1 %cmp4.not, label %for.end25, label %for.cond6.preheader, !llvm.loop !11
for.end25: ; preds = %for.end, %for.cond3.preheader
%putchar = call i32 @putchar(i32 10)
%inc28 = add nuw nsw i32 %i.048, 1
%exitcond.not = icmp eq i32 %inc28, 300
br i1 %exitcond.not, label %for.end29, label %for.body, !llvm.loop !12
for.end29: ; preds = %for.body, %for.end25
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void){
int h, w;
int i, j;
while(1) {
scanf("%d %d", &h, &w);
if(h==0 && w==0)
break;
for (i=1; i<=h; i++) {
for(j=1; j<=w; j++) {
if(i>1 && i<h && j<w && j>1) printf(".");
else printf("#");
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100745/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100745/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call39 = 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
%cmp40 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp141 = icmp eq i32 %1, 0
%or.cond42 = select i1 %cmp40, i1 %cmp141, i1 false
br i1 %or.cond42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end20
%2 = phi i32 [ %9, %for.end20 ], [ %0, %entry ]
%cmp2.not36 = icmp slt i32 %2, 1
br i1 %cmp2.not36, label %for.end20, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.037 = phi i32 [ %inc19, %for.end ], [ 1, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.not33 = icmp slt i32 %3, 1
br i1 %cmp4.not33, label %for.end, label %for.body5.lr.ph
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp ugt i32 %i.037, 1
br i1 %cmp6, label %for.body5, label %for.body5.us
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.034.us = phi i32 [ %inc.us, %for.body5.us ], [ 1, %for.body5.lr.ph ]
%putchar30.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.034.us, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.not.us.not = icmp slt i32 %j.034.us, %4
br i1 %cmp4.not.us.not, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.inc
%5 = phi i32 [ %7, %for.inc ], [ %3, %for.body5.lr.ph ]
%j.034 = phi i32 [ %inc, %for.inc ], [ 1, %for.body5.lr.ph ]
%6 = load i32, ptr %h, align 4
%cmp8 = icmp slt i32 %i.037, %6
br i1 %cmp8, label %land.lhs.true9, label %if.else
land.lhs.true9: ; preds = %for.body5
%cmp10 = icmp slt i32 %j.034, %5
%cmp12 = icmp ugt i32 %j.034, 1
%or.cond22 = and i1 %cmp12, %cmp10
br i1 %or.cond22, label %for.inc, label %if.else
if.else: ; preds = %land.lhs.true9, %for.body5
br label %for.inc
for.inc: ; preds = %land.lhs.true9, %if.else
%.sink = phi i32 [ 35, %if.else ], [ 46, %land.lhs.true9 ]
%putchar31 = call i32 @putchar(i32 %.sink)
%inc = add nuw nsw i32 %j.034, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.not.not = icmp slt i32 %j.034, %7
br i1 %cmp4.not.not, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5.us, %for.inc, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc19 = add i32 %i.037, 1
%8 = load i32, ptr %h, align 4, !tbaa !5
%cmp2.not = icmp sgt i32 %inc19, %8
br i1 %cmp2.not, label %for.end20, label %for.cond3.preheader, !llvm.loop !11
for.end20: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end20, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(int argc, const char * argv[]) {
// insert code here...
int w,h;
while(1){
scanf("%d %d",&w,&h);
if(w==0&&h==0){
break;
}
for(int y=1;y<=w;y++){
for(int x=1;x<=h;x++){
if(x==1 || x==h || y==1 || y==w){
printf("#");
}else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100789/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100789/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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%w = alloca i32, align 4
%h = 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
%call39 = 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
%cmp40 = icmp eq i32 %0, 0
%1 = load i32, ptr %h, align 4
%cmp141 = icmp eq i32 %1, 0
%or.cond42 = select i1 %cmp40, i1 %cmp141, i1 false
br i1 %or.cond42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.cond.cleanup
%2 = phi i32 [ %5, %for.cond.cleanup ], [ %0, %entry ]
%cmp2.not36 = icmp slt i32 %2, 1
br i1 %cmp2.not36, label %for.cond.cleanup, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.cond.preheader, %for.cond.cleanup5
%y.037 = phi i32 [ %inc19, %for.cond.cleanup5 ], [ 1, %for.cond.preheader ]
%3 = load i32, ptr %h, align 4, !tbaa !5
%cmp4.not33 = icmp slt i32 %3, 1
br i1 %cmp4.not33, label %for.cond.cleanup5, label %for.body6.lr.ph
for.body6.lr.ph: ; preds = %for.cond3.preheader
%cmp10 = icmp eq i32 %y.037, 1
br i1 %cmp10, label %for.body6.us, label %for.inc.peel
for.inc.peel: ; preds = %for.body6.lr.ph
%putchar31.peel = call i32 @putchar(i32 35)
%.pre = load i32, ptr %h, align 4, !tbaa !5
%cmp4.not.not.peel = icmp sgt i32 %.pre, 1
br i1 %cmp4.not.not.peel, label %lor.lhs.false, label %for.cond.cleanup5
for.body6.us: ; preds = %for.body6.lr.ph, %for.body6.us
%x.034.us = phi i32 [ %inc.us, %for.body6.us ], [ 1, %for.body6.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %x.034.us, 1
%4 = load i32, ptr %h, align 4, !tbaa !5
%cmp4.not.us.not = icmp slt i32 %x.034.us, %4
br i1 %cmp4.not.us.not, label %for.body6.us, label %for.cond.cleanup5, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond.cleanup5, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h)
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp = icmp eq i32 %5, 0
%6 = load i32, ptr %h, align 4
%cmp1 = icmp eq i32 %6, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
for.cond.cleanup5: ; preds = %lor.lhs.false, %for.body6.us, %for.inc.peel, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc19 = add i32 %y.037, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp2.not = icmp sgt i32 %inc19, %7
br i1 %cmp2.not, label %for.cond.cleanup, label %for.cond3.preheader, !llvm.loop !11
lor.lhs.false: ; preds = %for.inc.peel, %lor.lhs.false
%8 = phi i32 [ %10, %lor.lhs.false ], [ %.pre, %for.inc.peel ]
%x.034 = phi i32 [ %inc, %lor.lhs.false ], [ 2, %for.inc.peel ]
%cmp8 = icmp eq i32 %x.034, %8
%9 = load i32, ptr %w, align 4
%cmp12 = icmp eq i32 %y.037, %9
%or.cond32 = select i1 %cmp8, i1 true, i1 %cmp12
%. = select i1 %or.cond32, i32 35, i32 46
%putchar31 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %x.034, 1
%10 = load i32, ptr %h, align 4, !tbaa !5
%cmp4.not.not = icmp slt i32 %x.034, %10
br i1 %cmp4.not.not, label %lor.lhs.false, label %for.cond.cleanup5, !llvm.loop !12
while.end: ; preds = %for.cond.cleanup, %entry
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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
int main(void){
int i, j, n, h, w;
while(1){
scanf("%d %d", &h, &w);
if(h == 0 && w == 0){
break;
}
for(i = 0; i < h; i++){
for(j = 0; j < w; j++){
if(i == 0 ||i == (h - 1) || j == 0 || j == (w - 1)){
printf("#");
}else{ printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100831/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100831/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call39 = 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
%cmp40 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp141 = icmp eq i32 %1, 0
%or.cond42 = select i1 %cmp40, i1 %cmp141, i1 false
br i1 %or.cond42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end20
%2 = phi i32 [ %9, %for.end20 ], [ %0, %entry ]
%cmp236 = icmp sgt i32 %2, 0
br i1 %cmp236, label %for.cond3.preheader, label %for.end20
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.037 = phi i32 [ %inc19, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.037, 0
br i1 %cmp6, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.034.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.034.us, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%5 = phi i32 [ %7, %for.body5 ], [ %3, %for.body5.lr.ph ]
%j.034 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body5.lr.ph ]
%6 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp7 = icmp eq i32 %i.037, %sub
%cmp9 = icmp eq i32 %j.034, 0
%or.cond22 = or i1 %cmp9, %cmp7
%sub11 = add nsw i32 %5, -1
%cmp12 = icmp eq i32 %j.034, %sub11
%or.cond32 = select i1 %or.cond22, i1 true, i1 %cmp12
%. = select i1 %or.cond32, i32 35, i32 46
%putchar31 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.034, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %7
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc19 = add nuw nsw i32 %i.037, 1
%8 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc19, %8
br i1 %cmp2, label %for.cond3.preheader, label %for.end20, !llvm.loop !11
for.end20: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end20, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
int H,W,i,j,k;
for(k=0; k<300; k++){
scanf("%d %d",&H,&W);
if(H==0 && W==0)
break;
for(j=0; j<H; j++){
for(i=0; i<W; i++){
if(j==0 || j==H-1 || i==0 || i==W-1){
printf("#");
}else{
printf(".");}
}printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100875/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100875/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
br label %for.body
for.body: ; preds = %entry, %for.end23
%k.046 = phi i32 [ 0, %entry ], [ %inc26, %for.end23 ]
%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
%cmp1 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp2 = icmp eq i32 %1, 0
%or.cond = select i1 %cmp1, i1 %cmp2, i1 false
br i1 %or.cond, label %for.end27, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.body
%cmp443 = icmp sgt i32 %0, 0
br i1 %cmp443, label %for.cond6.preheader, label %for.end23
for.cond6.preheader: ; preds = %for.cond3.preheader, %for.end
%j.044 = phi i32 [ %inc22, %for.end ], [ 0, %for.cond3.preheader ]
%2 = load i32, ptr %W, align 4, !tbaa !5
%cmp740 = icmp sgt i32 %2, 0
br i1 %cmp740, label %for.body8.lr.ph, label %for.end
for.body8.lr.ph: ; preds = %for.cond6.preheader
%cmp9 = icmp eq i32 %j.044, 0
br i1 %cmp9, label %for.body8.us, label %for.body8
for.body8.us: ; preds = %for.body8.lr.ph, %for.body8.us
%i.041.us = phi i32 [ %inc.us, %for.body8.us ], [ 0, %for.body8.lr.ph ]
%putchar38.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %i.041.us, 1
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp7.us = icmp slt i32 %inc.us, %3
br i1 %cmp7.us, label %for.body8.us, label %for.end, !llvm.loop !9
for.body8: ; preds = %for.body8.lr.ph, %for.body8
%4 = phi i32 [ %6, %for.body8 ], [ %2, %for.body8.lr.ph ]
%i.041 = phi i32 [ %inc, %for.body8 ], [ 0, %for.body8.lr.ph ]
%5 = load i32, ptr %H, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%cmp10 = icmp eq i32 %j.044, %sub
%cmp12 = icmp eq i32 %i.041, 0
%or.cond28 = or i1 %cmp12, %cmp10
%sub14 = add nsw i32 %4, -1
%cmp15 = icmp eq i32 %i.041, %sub14
%or.cond39 = select i1 %or.cond28, i1 true, i1 %cmp15
%. = select i1 %or.cond39, i32 35, i32 46
%putchar38 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %i.041, 1
%6 = load i32, ptr %W, align 4, !tbaa !5
%cmp7 = icmp slt i32 %inc, %6
br i1 %cmp7, label %for.body8, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body8, %for.body8.us, %for.cond6.preheader
%putchar36 = call i32 @putchar(i32 10)
%inc22 = add nuw nsw i32 %j.044, 1
%7 = load i32, ptr %H, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc22, %7
br i1 %cmp4, label %for.cond6.preheader, label %for.end23, !llvm.loop !11
for.end23: ; preds = %for.end, %for.cond3.preheader
%putchar = call i32 @putchar(i32 10)
%inc26 = add nuw nsw i32 %k.046, 1
%exitcond.not = icmp eq i32 %inc26, 300
br i1 %exitcond.not, label %for.end27, label %for.body, !llvm.loop !12
for.end27: ; preds = %for.body, %for.end23
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void){
int h,w,i,j;
while(1){
scanf("%d %d",&h,&w);
if( h==0 && w==0)
break;
for(i=1; i<=h; i++){
for(j=1; j<=w; j++){
if(i==1 || i==h || j==1 || j==w)
printf("#");
else
printf(".");
}printf("\n");
}printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100925/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100925/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call38 = 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
%cmp39 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp140 = icmp eq i32 %1, 0
%or.cond41 = select i1 %cmp39, i1 %cmp140, i1 false
br i1 %or.cond41, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end19
%2 = phi i32 [ %9, %for.end19 ], [ %0, %entry ]
%cmp2.not35 = icmp slt i32 %2, 1
br i1 %cmp2.not35, label %for.end19, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.036 = phi i32 [ %inc18, %for.end ], [ 1, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.not32 = icmp slt i32 %3, 1
br i1 %cmp4.not32, label %for.end, label %for.body5.lr.ph
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.036, 1
br i1 %cmp6, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.033.us = phi i32 [ %inc.us, %for.body5.us ], [ 1, %for.body5.lr.ph ]
%putchar30.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.033.us, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.not.us.not = icmp slt i32 %j.033.us, %4
br i1 %cmp4.not.us.not, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%5 = phi i32 [ %7, %for.body5 ], [ %3, %for.body5.lr.ph ]
%j.033 = phi i32 [ %inc, %for.body5 ], [ 1, %for.body5.lr.ph ]
%6 = load i32, ptr %h, align 4, !tbaa !5
%cmp7 = icmp eq i32 %i.036, %6
%cmp9 = icmp eq i32 %j.033, 1
%or.cond21 = or i1 %cmp9, %cmp7
%cmp11 = icmp eq i32 %j.033, %5
%or.cond31 = or i1 %cmp11, %or.cond21
%. = select i1 %or.cond31, i32 35, i32 46
%putchar30 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.033, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.not.not = icmp slt i32 %j.033, %7
br i1 %cmp4.not.not, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar28 = call i32 @putchar(i32 10)
%inc18 = add nuw nsw i32 %i.036, 1
%8 = load i32, ptr %h, align 4, !tbaa !5
%cmp2.not.not = icmp slt i32 %i.036, %8
br i1 %cmp2.not.not, label %for.cond3.preheader, label %for.end19, !llvm.loop !11
for.end19: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end19, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
int h,w;
while(1){
scanf("%d %d", &h, &w);
if(h == 0 && w == 0) break;
int i, j;
for ( i = 0; i < h; i++ ){
for ( j = 0; j < w; j++ ){
(!i || i ==h-1 || !j || j==w-1)?printf("#"):printf(".");
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100976/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100976/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call37 = 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
%cmp38 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp139 = icmp eq i32 %1, 0
%or.cond40 = select i1 %cmp38, i1 %cmp139, i1 false
br i1 %or.cond40, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end17
%2 = phi i32 [ %9, %for.end17 ], [ %0, %entry ]
%cmp234 = icmp sgt i32 %2, 0
br i1 %cmp234, label %for.cond3.preheader, label %for.end17
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.035 = phi i32 [ %inc16, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp431 = icmp sgt i32 %3, 0
br i1 %cmp431, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%tobool.not = icmp eq i32 %i.035, 0
br i1 %tobool.not, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.032.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar28.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.032.us, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%5 = phi i32 [ %7, %for.body5 ], [ %3, %for.body5.lr.ph ]
%j.032 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body5.lr.ph ]
%6 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp6 = icmp eq i32 %i.035, %sub
%tobool8 = icmp eq i32 %j.032, 0
%or.cond19.not30 = or i1 %tobool8, %cmp6
%sub10 = add nsw i32 %5, -1
%cmp11 = icmp eq i32 %j.032, %sub10
%or.cond29 = select i1 %or.cond19.not30, i1 true, i1 %cmp11
%. = select i1 %or.cond29, i32 35, i32 46
%putchar28 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.032, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %7
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar26 = call i32 @putchar(i32 10)
%inc16 = add nuw nsw i32 %i.035, 1
%8 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc16, %8
br i1 %cmp2, label %for.cond3.preheader, label %for.end17, !llvm.loop !11
for.end17: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end17, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main() {
int W, H,i,j;
while (1) {
scanf("%d %d", &H, &W);
if (H == 0 && W == 0) break;
for (i = 0; i < H; i++) {
for (j = 0; j < W; j++) {
if (i == 0 || i == H - 1 || j == 0 || j == W - 1) printf("#");
else printf(".");
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101018/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101018/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
; 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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
%call39 = 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
%cmp40 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp141 = icmp eq i32 %1, 0
%or.cond42 = select i1 %cmp40, i1 %cmp141, i1 false
br i1 %or.cond42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end20
%2 = phi i32 [ %9, %for.end20 ], [ %0, %entry ]
%cmp236 = icmp sgt i32 %2, 0
br i1 %cmp236, label %for.cond3.preheader, label %for.end20
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.037 = phi i32 [ %inc19, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.037, 0
br i1 %cmp6, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.034.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.034.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%5 = phi i32 [ %7, %for.body5 ], [ %3, %for.body5.lr.ph ]
%j.034 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body5.lr.ph ]
%6 = load i32, ptr %H, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp7 = icmp eq i32 %i.037, %sub
%cmp9 = icmp eq i32 %j.034, 0
%or.cond22 = or i1 %cmp9, %cmp7
%sub11 = add nsw i32 %5, -1
%cmp12 = icmp eq i32 %j.034, %sub11
%or.cond32 = select i1 %or.cond22, i1 true, i1 %cmp12
%. = select i1 %or.cond32, i32 35, i32 46
%putchar31 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.034, 1
%7 = load i32, ptr %W, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %7
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc19 = add nuw nsw i32 %i.037, 1
%8 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc19, %8
br i1 %cmp2, label %for.cond3.preheader, label %for.end20, !llvm.loop !11
for.end20: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%9 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end20, %entry
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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
int H, W, i, j;
while(1){
scanf("%d %d",&H ,&W);
if(H == 0 && W == 0)break;
for(i = 0; i < H; i++){
for(j = 0; j < W; j++){
if(i == 0 || j == 0 || j == (W - 1) || i == (H - 1) ){
printf("#");
}else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101061/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101061/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call38 = 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
%cmp39 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp140 = icmp eq i32 %1, 0
%or.cond41 = select i1 %cmp39, i1 %cmp140, i1 false
br i1 %or.cond41, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end20
%2 = phi i32 [ %10, %for.end20 ], [ %0, %entry ]
%cmp235 = icmp sgt i32 %2, 0
br i1 %cmp235, label %for.cond3.preheader, label %for.end20
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.036 = phi i32 [ %inc19, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.036, 0
br i1 %cmp6, label %for.body5.us, label %for.inc.peel
for.inc.peel: ; preds = %for.body5.lr.ph
%putchar31.peel = call i32 @putchar(i32 35)
%.pre = load i32, ptr %W, align 4, !tbaa !5
%cmp4.peel = icmp sgt i32 %.pre, 1
br i1 %cmp4.peel, label %for.body5, label %for.end
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.034.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.034.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.inc.peel, %for.body5
%5 = phi i32 [ %8, %for.body5 ], [ %.pre, %for.inc.peel ]
%j.034 = phi i32 [ %inc, %for.body5 ], [ 1, %for.inc.peel ]
%sub = add nsw i32 %5, -1
%cmp9 = icmp eq i32 %j.034, %sub
%6 = load i32, ptr %H, align 4
%sub11 = add nsw i32 %6, -1
%cmp12 = icmp eq i32 %i.036, %sub11
%7 = select i1 %cmp9, i1 true, i1 %cmp12
%.sink = select i1 %7, i32 35, i32 46
%putchar31 = call i32 @putchar(i32 %.sink)
%inc = add nuw nsw i32 %j.034, 1
%8 = load i32, ptr %W, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %8
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body5, %for.body5.us, %for.inc.peel, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc19 = add nuw nsw i32 %i.036, 1
%9 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc19, %9
br i1 %cmp2, label %for.cond3.preheader, label %for.end20, !llvm.loop !13
for.end20: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%10 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %10, 0
%11 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %11, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end20, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(){
int W,H,i,j;
while(1){
scanf("%d %d",&H,&W);
if(H==0){
break;
}
for(i=0;i<H;i++){
for(j=0;j<W;j++){
if(i==0 || i==H-1 || j==0 ||j==W-1){
printf("#");
}else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101104/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101104/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
; 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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
%call37 = 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
%cmp38 = icmp eq i32 %0, 0
br i1 %cmp38, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end19
%1 = phi i32 [ %8, %for.end19 ], [ %0, %entry ]
%cmp134 = icmp sgt i32 %1, 0
br i1 %cmp134, label %for.cond2.preheader, label %for.end19
for.cond2.preheader: ; preds = %for.cond.preheader, %for.end
%i.035 = phi i32 [ %inc18, %for.end ], [ 0, %for.cond.preheader ]
%2 = load i32, ptr %W, align 4, !tbaa !5
%cmp331 = icmp sgt i32 %2, 0
br i1 %cmp331, label %for.body4.lr.ph, label %for.end
for.body4.lr.ph: ; preds = %for.cond2.preheader
%cmp5 = icmp eq i32 %i.035, 0
br i1 %cmp5, label %for.body4.us, label %for.body4
for.body4.us: ; preds = %for.body4.lr.ph, %for.body4.us
%j.032.us = phi i32 [ %inc.us, %for.body4.us ], [ 0, %for.body4.lr.ph ]
%putchar29.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.032.us, 1
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp3.us = icmp slt i32 %inc.us, %3
br i1 %cmp3.us, label %for.body4.us, label %for.end, !llvm.loop !9
for.body4: ; preds = %for.body4.lr.ph, %for.body4
%4 = phi i32 [ %6, %for.body4 ], [ %2, %for.body4.lr.ph ]
%j.032 = phi i32 [ %inc, %for.body4 ], [ 0, %for.body4.lr.ph ]
%5 = load i32, ptr %H, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%cmp6 = icmp eq i32 %i.035, %sub
%cmp8 = icmp eq i32 %j.032, 0
%or.cond = or i1 %cmp8, %cmp6
%sub10 = add nsw i32 %4, -1
%cmp11 = icmp eq i32 %j.032, %sub10
%or.cond30 = select i1 %or.cond, i1 true, i1 %cmp11
%. = select i1 %or.cond30, i32 35, i32 46
%putchar29 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.032, 1
%6 = load i32, ptr %W, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc, %6
br i1 %cmp3, label %for.body4, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body4, %for.body4.us, %for.cond2.preheader
%putchar27 = call i32 @putchar(i32 10)
%inc18 = add nuw nsw i32 %i.035, 1
%7 = load i32, ptr %H, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc18, %7
br i1 %cmp1, label %for.cond2.preheader, label %for.end19, !llvm.loop !11
for.end19: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%8 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %8, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end19, %entry
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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void) {
int H,W;
int h,w;
while (1) {
scanf("%d %d", &H, &W);
if (H == 0 && W == 0) break;
for (h = 0; h < H; h++) {
for (w = 0; w < W; w++) {
if (
(h != 0 && h != H - 1) &&
(w != 0 && w != W - 1)
) {
printf(".");
}
else {
printf("#");
}
}
printf("\n");
}
printf("\n");
}
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101148/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101148/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call41 = 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
%cmp42 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp143 = icmp eq i32 %1, 0
%or.cond44 = select i1 %cmp42, i1 %cmp143, i1 false
br i1 %or.cond44, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end21
%2 = phi i32 [ %9, %for.end21 ], [ %0, %entry ]
%cmp238 = icmp sgt i32 %2, 0
br i1 %cmp238, label %for.cond3.preheader, label %for.end21
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%h.039 = phi i32 [ %inc20, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp435 = icmp sgt i32 %3, 0
br i1 %cmp435, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6.not = icmp eq i32 %h.039, 0
br i1 %cmp6.not, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%w.036.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %w.036.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%5 = phi i32 [ %7, %for.body5 ], [ %3, %for.body5.lr.ph ]
%w.036 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body5.lr.ph ]
%6 = load i32, ptr %H, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp8 = icmp eq i32 %h.039, %sub
%cmp10 = icmp eq i32 %w.036, 0
%or.cond23.not34 = or i1 %cmp10, %cmp8
%sub12 = add nsw i32 %5, -1
%cmp13.not = icmp eq i32 %w.036, %sub12
%or.cond33 = select i1 %or.cond23.not34, i1 true, i1 %cmp13.not
%. = select i1 %or.cond33, i32 35, i32 46
%putchar32 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %w.036, 1
%7 = load i32, ptr %W, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %7
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar30 = call i32 @putchar(i32 10)
%inc20 = add nuw nsw i32 %h.039, 1
%8 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc20, %8
br i1 %cmp2, label %for.cond3.preheader, label %for.end21, !llvm.loop !11
for.end21: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%9 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end21, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int
main(void)
{
int i, h, w;
char str1[301];
char str2[301];
for (;;) {
scanf("%d %d", &h, &w);
if (h == 0 && w == 0)
break;
for (i = 0; i < w; i++) {
str1[i] = '#', str2[i] = '.';
}
str2[0] = '#';
str2[i - 1] = '#';
str1[i] = '\0';
str2[i] = '\0';
puts(str1);
for (i = 1; i < h - 1; i++)
puts(str2);
puts(str1);
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101191/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101191/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
; 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
%str1 = alloca [301 x i8], align 16
%str2 = alloca [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 301, ptr nonnull %str1) #5
call void @llvm.lifetime.start.p0(i64 301, ptr nonnull %str2) #5
%call40 = 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
%cmp41 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp142 = icmp eq i32 %1, 0
%or.cond43 = select i1 %cmp41, i1 %cmp142, i1 false
br i1 %or.cond43, label %for.end26, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %for.end22
%2 = phi i32 [ %7, %for.end22 ], [ %1, %entry ]
%cmp335 = icmp sgt i32 %2, 0
br i1 %cmp335, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %for.cond2.preheader
%3 = zext i32 %2 to i64
call void @llvm.memset.p0.i64(ptr nonnull align 16 %str1, i8 35, i64 %3, i1 false), !tbaa !9
call void @llvm.memset.p0.i64(ptr nonnull align 16 %str2, i8 46, i64 %3, i1 false), !tbaa !9
br label %for.end
for.end: ; preds = %for.body.preheader, %for.cond2.preheader
%i.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %2, %for.body.preheader ]
store i8 35, ptr %str2, align 16, !tbaa !9
%sub = add nsw i32 %i.0.lcssa, -1
%idxprom7 = sext i32 %sub to i64
%arrayidx8 = getelementptr inbounds [301 x i8], ptr %str2, i64 0, i64 %idxprom7
store i8 35, ptr %arrayidx8, align 1, !tbaa !9
%idxprom9 = zext i32 %i.0.lcssa to i64
%arrayidx10 = getelementptr inbounds [301 x i8], ptr %str1, i64 0, i64 %idxprom9
store i8 0, ptr %arrayidx10, align 1, !tbaa !9
%arrayidx12 = getelementptr inbounds [301 x i8], ptr %str2, i64 0, i64 %idxprom9
store i8 0, ptr %arrayidx12, align 1, !tbaa !9
%call13 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %str1)
%4 = load i32, ptr %h, align 4, !tbaa !5
%cmp1638 = icmp sgt i32 %4, 2
br i1 %cmp1638, label %for.body17, label %for.end22
for.body17: ; preds = %for.end, %for.body17
%i.139 = phi i32 [ %inc21, %for.body17 ], [ 1, %for.end ]
%call19 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %str2)
%inc21 = add nuw nsw i32 %i.139, 1
%5 = load i32, ptr %h, align 4, !tbaa !5
%sub15 = add nsw i32 %5, -1
%cmp16 = icmp slt i32 %inc21, %sub15
br i1 %cmp16, label %for.body17, label %for.end22, !llvm.loop !10
for.end22: ; preds = %for.body17, %for.end
%call24 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %str1)
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%6 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %6, 0
%7 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %7, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %for.end26, label %for.cond2.preheader
for.end26: ; preds = %for.end22, %entry
call void @llvm.lifetime.end.p0(i64 301, ptr nonnull %str2) #5
call void @llvm.lifetime.end.p0(i64 301, ptr nonnull %str1) #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 @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
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) 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 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 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"}
|
#include<stdio.h>
#include<string.h>
#define MAX 300
int main(void)
{
int H[MAX],W[MAX];
int i,j,k,l;
for(i=0;i<MAX;i++)
{
scanf("%d %d",&H[i],&W[i]);
if((H[i]==0)&&(W[i]==0))
break;
}
for(l=0;l<i;l++)
{
for(j=0;j<W[l];j++)
printf("#");
printf("\n");
for(k=1;k<H[l]-1;k++)
{
printf("#");
for(j=1;j<W[l]-1;j++)
printf(".");
printf("#");
printf("\n");
}
for(j=0;j<W[l];j++)
printf("#");
printf("\n");
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101249/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101249/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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca [300 x i32], align 16
%W = alloca [300 x i32], align 16
call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %W) #4
br label %for.body
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds [300 x i32], ptr %H, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [300 x i32], ptr %W, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5 = icmp eq i32 %0, 0
br i1 %cmp5, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp8 = icmp eq i32 %1, 0
br i1 %cmp8, label %for.end, label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 300
br i1 %exitcond.not, label %for.cond12.preheader.preheader, label %for.body, !llvm.loop !9
for.end: ; preds = %land.lhs.true
%2 = and i64 %indvars.iv, 4294967295
%cmp1095.not = icmp eq i64 %2, 0
br i1 %cmp1095.not, label %for.end56, label %for.cond12.preheader.preheader
for.cond12.preheader.preheader: ; preds = %for.inc, %for.end
%i.0.lcssa104 = phi i64 [ %indvars.iv, %for.end ], [ 300, %for.inc ]
%wide.trip.count = and i64 %i.0.lcssa104, 4294967295
br label %for.cond12.preheader
for.cond12.preheader: ; preds = %for.cond12.preheader.preheader, %for.end51
%indvars.iv98 = phi i64 [ 0, %for.cond12.preheader.preheader ], [ %indvars.iv.next99, %for.end51 ]
%arrayidx14 = getelementptr inbounds [300 x i32], ptr %W, i64 0, i64 %indvars.iv98
%3 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp1584 = icmp sgt i32 %3, 0
br i1 %cmp1584, label %for.body16, label %for.end20
for.body16: ; preds = %for.cond12.preheader, %for.body16
%j.085 = phi i32 [ %inc19, %for.body16 ], [ 0, %for.cond12.preheader ]
%putchar81 = call i32 @putchar(i32 35)
%inc19 = add nuw nsw i32 %j.085, 1
%4 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15 = icmp slt i32 %inc19, %4
br i1 %cmp15, label %for.body16, label %for.end20, !llvm.loop !11
for.end20: ; preds = %for.body16, %for.cond12.preheader
%putchar = call i32 @putchar(i32 10)
%arrayidx24 = getelementptr inbounds [300 x i32], ptr %H, i64 0, i64 %indvars.iv98
%5 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%cmp2591 = icmp sgt i32 %5, 2
br i1 %cmp2591, label %for.body26, label %for.cond43.preheader
for.cond43.preheader: ; preds = %for.end37, %for.end20
%6 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp4693 = icmp sgt i32 %6, 0
br i1 %cmp4693, label %for.body47, label %for.end51
for.body26: ; preds = %for.end20, %for.end37
%k.092 = phi i32 [ %inc41, %for.end37 ], [ 1, %for.end20 ]
%putchar77 = call i32 @putchar(i32 35)
%7 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp3288 = icmp sgt i32 %7, 2
br i1 %cmp3288, label %for.body33, label %for.end37
for.body33: ; preds = %for.body26, %for.body33
%j.189 = phi i32 [ %inc36, %for.body33 ], [ 1, %for.body26 ]
%putchar80 = call i32 @putchar(i32 46)
%inc36 = add nuw nsw i32 %j.189, 1
%8 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%sub31 = add nsw i32 %8, -1
%cmp32 = icmp slt i32 %inc36, %sub31
br i1 %cmp32, label %for.body33, label %for.end37, !llvm.loop !12
for.end37: ; preds = %for.body33, %for.body26
%putchar78 = call i32 @putchar(i32 35)
%putchar79 = call i32 @putchar(i32 10)
%inc41 = add nuw nsw i32 %k.092, 1
%9 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%sub = add nsw i32 %9, -1
%cmp25 = icmp slt i32 %inc41, %sub
br i1 %cmp25, label %for.body26, label %for.cond43.preheader, !llvm.loop !13
for.body47: ; preds = %for.cond43.preheader, %for.body47
%j.294 = phi i32 [ %inc50, %for.body47 ], [ 0, %for.cond43.preheader ]
%putchar76 = call i32 @putchar(i32 35)
%inc50 = add nuw nsw i32 %j.294, 1
%10 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp46 = icmp slt i32 %inc50, %10
br i1 %cmp46, label %for.body47, label %for.end51, !llvm.loop !14
for.end51: ; preds = %for.body47, %for.cond43.preheader
%putchar74 = call i32 @putchar(i32 10)
%putchar75 = call i32 @putchar(i32 10)
%indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
%exitcond101.not = icmp eq i64 %indvars.iv.next99, %wide.trip.count
br i1 %exitcond101.not, label %for.end56, label %for.cond12.preheader, !llvm.loop !15
for.end56: ; preds = %for.end51, %for.end
call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %H) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int main(void){
int H,W;
while(1){
scanf("%d %d",&H,&W);
if(H==0&&W==0){
break;
}
for(int row=0;row<H;row++){
for(int col=0;col<W;col++){
if(row==0||row==H-1||col==0||col==W-1){
printf("#");
}
else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101292/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101292/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call40 = 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
%cmp41 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp142 = icmp eq i32 %1, 0
%or.cond43 = select i1 %cmp41, i1 %cmp142, i1 false
br i1 %or.cond43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.cond.cleanup
%2 = phi i32 [ %5, %for.cond.cleanup ], [ %0, %entry ]
%cmp237 = icmp sgt i32 %2, 0
br i1 %cmp237, label %for.cond3.preheader, label %for.cond.cleanup
for.cond3.preheader: ; preds = %for.cond.preheader, %for.cond.cleanup5
%row.038 = phi i32 [ %inc20, %for.cond.cleanup5 ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp434 = icmp sgt i32 %3, 0
br i1 %cmp434, label %for.body6.lr.ph, label %for.cond.cleanup5
for.body6.lr.ph: ; preds = %for.cond3.preheader
%cmp7 = icmp eq i32 %row.038, 0
br i1 %cmp7, label %for.body6.us, label %for.body6
for.body6.us: ; preds = %for.body6.lr.ph, %for.body6.us
%col.035.us = phi i32 [ %inc.us, %for.body6.us ], [ 0, %for.body6.lr.ph ]
%putchar32.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %col.035.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body6.us, label %for.cond.cleanup5, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond.cleanup5, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%5 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %5, 0
%6 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %6, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
for.cond.cleanup5: ; preds = %for.body6, %for.body6.us, %for.cond3.preheader
%putchar30 = call i32 @putchar(i32 10)
%inc20 = add nuw nsw i32 %row.038, 1
%7 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc20, %7
br i1 %cmp2, label %for.cond3.preheader, label %for.cond.cleanup, !llvm.loop !11
for.body6: ; preds = %for.body6.lr.ph, %for.body6
%8 = phi i32 [ %10, %for.body6 ], [ %3, %for.body6.lr.ph ]
%col.035 = phi i32 [ %inc, %for.body6 ], [ 0, %for.body6.lr.ph ]
%9 = load i32, ptr %H, align 4, !tbaa !5
%sub = add nsw i32 %9, -1
%cmp8 = icmp eq i32 %row.038, %sub
%cmp10 = icmp eq i32 %col.035, 0
%or.cond23 = or i1 %cmp10, %cmp8
%sub12 = add nsw i32 %8, -1
%cmp13 = icmp eq i32 %col.035, %sub12
%or.cond33 = select i1 %or.cond23, i1 true, i1 %cmp13
%. = select i1 %or.cond33, i32 35, i32 46
%putchar32 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %col.035, 1
%10 = load i32, ptr %W, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %10
br i1 %cmp4, label %for.body6, label %for.cond.cleanup5, !llvm.loop !9
while.end: ; preds = %for.cond.cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(){
int a,b,c=0,d,e;
while(c==0){
scanf("%d %d\n",&a,&b);
if(a==0 && b==0){
break;
}
else{
for(d=0;d<a;d++){
for(e=0;e<b;e++){
if(d==0 || d==a-1){
printf("#");
}
else{
if(e==0 || e==b-1){
printf("#");
}
else{
printf(".");
}
}
}
printf("\n");
}
printf("\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101335/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101335/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\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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call44 = 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
%cmp145 = icmp eq i32 %0, 0
%1 = load i32, ptr %b, align 4
%cmp246 = icmp eq i32 %1, 0
%or.cond47 = select i1 %cmp145, i1 %cmp246, i1 false
br i1 %or.cond47, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end24
%2 = phi i32 [ %11, %for.end24 ], [ %0, %entry ]
%cmp341 = icmp sgt i32 %2, 0
br i1 %cmp341, label %for.cond4.preheader, label %for.end24
for.cond4.preheader: ; preds = %for.cond.preheader, %for.end
%d.042 = phi i32 [ %inc23, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %b, align 4, !tbaa !5
%cmp538 = icmp sgt i32 %3, 0
br i1 %cmp538, label %for.body6.lr.ph, label %for.end
for.body6.lr.ph: ; preds = %for.cond4.preheader
%cmp7 = icmp eq i32 %d.042, 0
br i1 %cmp7, label %for.body6.us, label %for.body6.preheader
for.body6.preheader: ; preds = %for.body6.lr.ph
%putchar36.peel = call i32 @putchar(i32 35)
%4 = load i32, ptr %b, align 4, !tbaa !5
%cmp5.peel = icmp sgt i32 %4, 1
br i1 %cmp5.peel, label %for.body6, label %for.end
for.body6.us: ; preds = %for.body6.lr.ph, %for.body6.us
%e.039.us = phi i32 [ %inc.us, %for.body6.us ], [ 0, %for.body6.lr.ph ]
%putchar36.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %e.039.us, 1
%5 = load i32, ptr %b, align 4, !tbaa !5
%cmp5.us = icmp slt i32 %inc.us, %5
br i1 %cmp5.us, label %for.body6.us, label %for.end, !llvm.loop !9
for.body6: ; preds = %for.body6.preheader, %for.body6
%6 = phi i32 [ %9, %for.body6 ], [ %4, %for.body6.preheader ]
%e.039 = phi i32 [ %inc, %for.body6 ], [ 1, %for.body6.preheader ]
%7 = load i32, ptr %a, align 4, !tbaa !5
%sub = add nsw i32 %7, -1
%cmp8 = icmp eq i32 %d.042, %sub
%sub14 = add nsw i32 %6, -1
%cmp15 = icmp eq i32 %e.039, %sub14
%8 = select i1 %cmp8, i1 true, i1 %cmp15
%.sink = select i1 %8, i32 35, i32 46
%putchar36 = call i32 @putchar(i32 %.sink)
%inc = add nuw nsw i32 %e.039, 1
%9 = load i32, ptr %b, align 4, !tbaa !5
%cmp5 = icmp slt i32 %inc, %9
br i1 %cmp5, label %for.body6, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body6, %for.body6.us, %for.body6.preheader, %for.cond4.preheader
%putchar33 = call i32 @putchar(i32 10)
%inc23 = add nuw nsw i32 %d.042, 1
%10 = load i32, ptr %a, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc23, %10
br i1 %cmp3, label %for.cond4.preheader, label %for.end24, !llvm.loop !13
for.end24: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%11 = load i32, ptr %a, align 4, !tbaa !5
%cmp1 = icmp eq i32 %11, 0
%12 = load i32, ptr %b, align 4
%cmp2 = icmp eq i32 %12, 0
%or.cond = select i1 %cmp1, i1 %cmp2, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader, !llvm.loop !14
while.end: ; preds = %for.end24, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main(){
int H,W,i,j;
while(scanf("%d %d",&H,&W),H!=0&&W!=0){
for(i=0;i<H;i++){
for(j=0;j<W;j++){
if(i==0 || i==H-1 || j==0 || j==W-1){
printf("#");
}else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101379/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101379/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
; 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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call36 = 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
%cmp37 = icmp ne i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp138 = icmp ne i32 %1, 0
%2 = select i1 %cmp37, i1 %cmp138, i1 false
br i1 %2, label %for.cond.preheader, label %while.end
for.cond.preheader: ; preds = %entry, %for.end18
%3 = phi i32 [ %10, %for.end18 ], [ %0, %entry ]
%cmp233 = icmp sgt i32 %3, 0
br i1 %cmp233, label %for.cond3.preheader, label %for.end18
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.034 = phi i32 [ %inc17, %for.end ], [ 0, %for.cond.preheader ]
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp430 = icmp sgt i32 %4, 0
br i1 %cmp430, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.034, 0
br i1 %cmp6, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.031.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar28.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.031.us, 1
%5 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %5
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%6 = phi i32 [ %8, %for.body5 ], [ %4, %for.body5.lr.ph ]
%j.031 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body5.lr.ph ]
%7 = load i32, ptr %H, align 4, !tbaa !5
%sub = add nsw i32 %7, -1
%cmp7 = icmp eq i32 %i.034, %sub
%cmp9 = icmp eq i32 %j.031, 0
%or.cond = or i1 %cmp9, %cmp7
%sub11 = add nsw i32 %6, -1
%cmp12 = icmp eq i32 %j.031, %sub11
%or.cond29 = select i1 %or.cond, i1 true, i1 %cmp12
%. = select i1 %or.cond29, i32 35, i32 46
%putchar28 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.031, 1
%8 = load i32, ptr %W, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %8
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar26 = call i32 @putchar(i32 10)
%inc17 = add nuw nsw i32 %i.034, 1
%9 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc17, %9
br i1 %cmp2, label %for.cond3.preheader, label %for.end18, !llvm.loop !11
for.end18: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%10 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp ne i32 %10, 0
%11 = load i32, ptr %W, align 4
%cmp1 = icmp ne i32 %11, 0
%12 = select i1 %cmp, i1 %cmp1, i1 false
br i1 %12, label %for.cond.preheader, label %while.end, !llvm.loop !12
while.end: ; preds = %for.end18, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(){
int i,j;
int ans;
int n,a,b,c,x;
int y[100];
while(scanf("%d%d%d%d%d",&n,&a,&b,&c,&x),n){
for(i = 0;i < n;i++){
scanf("%d",&y[i]);
}
if(n==1&&x==y[0]){printf("0\n");continue;}
j = 0;
if(y[j] == x)j++;
for(i = 0;i < 10000;i++){
x = (a * x + b) % c;
if(x == y[j]){
j++;
}
if(n == j)break;
}
if(i == 10000)i = -2;
i++;
printf("%d\n",i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101465/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101465/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 [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca [100 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 %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 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %y) #4
%call50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %x)
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not51 = icmp eq i32 %0, 0
br i1 %tobool.not51, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %while.cond.backedge
%1 = phi i32 [ %5, %while.cond.backedge ], [ %0, %entry ]
%cmp44 = icmp sgt i32 %1, 0
br i1 %cmp44, label %for.body, label %for.end.if.end_crit_edge
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %y, 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
%.pr = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %.pr 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
%cmp2 = icmp eq i32 %.pr, 1
br i1 %cmp2, label %land.lhs.true, label %for.end.if.end_crit_edge
for.end.if.end_crit_edge: ; preds = %for.cond.preheader, %for.end
%.lcssa57 = phi i32 [ %.pr, %for.end ], [ %1, %for.cond.preheader ]
%.pre = load i32, ptr %y, align 16, !tbaa !5
%.pre53 = load i32, ptr %x, align 4, !tbaa !5
br label %if.end
land.lhs.true: ; preds = %for.end
%3 = load i32, ptr %x, align 4, !tbaa !5
%4 = load i32, ptr %y, align 16, !tbaa !5
%cmp4 = icmp eq i32 %3, %4
br i1 %cmp4, label %if.then, label %if.end
if.then: ; preds = %land.lhs.true
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %while.cond.backedge
while.cond.backedge: ; preds = %if.then, %15
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %x)
%5 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %5, 0
br i1 %tobool.not, label %while.end, label %for.cond.preheader, !llvm.loop !11
if.end: ; preds = %for.end.if.end_crit_edge, %land.lhs.true
%.lcssa56 = phi i32 [ %.lcssa57, %for.end.if.end_crit_edge ], [ 1, %land.lhs.true ]
%6 = phi i32 [ %.pre53, %for.end.if.end_crit_edge ], [ %3, %land.lhs.true ]
%7 = phi i32 [ %.pre, %for.end.if.end_crit_edge ], [ %4, %land.lhs.true ]
%cmp8 = icmp eq i32 %7, %6
%spec.select = zext i1 %cmp8 to i32
%8 = load i32, ptr %a, align 4, !tbaa !5
%9 = load i32, ptr %b, align 4, !tbaa !5
%10 = load i32, ptr %c, align 4, !tbaa !5
br label %for.body14
for.body14: ; preds = %for.inc24.1, %if.end
%i.149 = phi i32 [ 0, %if.end ], [ %inc25.1, %for.inc24.1 ]
%j.148 = phi i32 [ %spec.select, %if.end ], [ %spec.select43.1, %for.inc24.1 ]
%rem4647 = phi i32 [ %6, %if.end ], [ %rem.1, %for.inc24.1 ]
%mul = mul nsw i32 %rem4647, %8
%add = add nsw i32 %mul, %9
%rem = srem i32 %add, %10
%idxprom15 = zext i32 %j.148 to i64
%arrayidx16 = getelementptr inbounds [100 x i32], ptr %y, i64 0, i64 %idxprom15
%11 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%cmp17 = icmp eq i32 %rem, %11
%inc19 = zext i1 %cmp17 to i32
%spec.select43 = add nuw nsw i32 %j.148, %inc19
%cmp21 = icmp eq i32 %.lcssa56, %spec.select43
br i1 %cmp21, label %for.end26, label %for.inc24
for.inc24: ; preds = %for.body14
%mul.1 = mul nsw i32 %rem, %8
%add.1 = add nsw i32 %mul.1, %9
%rem.1 = srem i32 %add.1, %10
%idxprom15.1 = zext i32 %spec.select43 to i64
%arrayidx16.1 = getelementptr inbounds [100 x i32], ptr %y, i64 0, i64 %idxprom15.1
%12 = load i32, ptr %arrayidx16.1, align 4, !tbaa !5
%cmp17.1 = icmp eq i32 %rem.1, %12
%inc19.1 = zext i1 %cmp17.1 to i32
%spec.select43.1 = add nuw nsw i32 %spec.select43, %inc19.1
%cmp21.1 = icmp eq i32 %.lcssa56, %spec.select43.1
br i1 %cmp21.1, label %for.end26.split.loop.exit, label %for.inc24.1
for.inc24.1: ; preds = %for.inc24
%inc25.1 = add nuw nsw i32 %i.149, 2
%exitcond.not.1 = icmp eq i32 %inc25.1, 10000
br i1 %exitcond.not.1, label %for.end26.thread, label %for.body14, !llvm.loop !12
for.end26.thread: ; preds = %for.inc24.1
store i32 %rem.1, ptr %x, align 4, !tbaa !5
br label %14
for.end26.split.loop.exit: ; preds = %for.inc24
%inc25.le = or i32 %i.149, 1
br label %for.end26
for.end26: ; preds = %for.body14, %for.end26.split.loop.exit
%i.149.lcssa = phi i32 [ %inc25.le, %for.end26.split.loop.exit ], [ %i.149, %for.body14 ]
%rem.lcssa = phi i32 [ %rem.1, %for.end26.split.loop.exit ], [ %rem, %for.body14 ]
store i32 %rem.lcssa, ptr %x, align 4, !tbaa !5
%cmp27 = icmp eq i32 %i.149.lcssa, 10000
%13 = add nuw nsw i32 %i.149.lcssa, 1
br i1 %cmp27, label %14, label %15
14: ; preds = %for.end26.thread, %for.end26
br label %15
15: ; preds = %for.end26, %14
%16 = phi i32 [ -1, %14 ], [ %13, %for.end26 ]
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %16)
br label %while.cond.backedge
while.end: ; preds = %while.cond.backedge, %entry
call void @llvm.lifetime.end.p0(i64 400, 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 %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
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
#define NUM 100001
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
LL dup(LL a,LL b){if(a%b==0)return a/b;else return a/b+1;}
int GCD(int a,int b){int c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
int LCM(int a,int b){return a*b/GCD(a,b);}
int POW(int a,int n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return (int)ans;}
int icmp(const void* a,const void* b){return *(int*)a-*(int*)b;}
int lcmp(const void* a,const void* b){return *(LL*)a-*(LL*)b;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}
LL fac[NUM],finv[NUM],inv[NUM];
void comi(){int i;fac[0]=fac[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fac[i]=fac[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
int com(int n,int k){if(n<k||n<0||k<0)return 0;return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;}
int rcmp(const void* a,const void* b){return *(LL*)b-*(LL*)a;}
int main(){
LL N,K,i,min=-1,mid=0,max=LNF/2,ans=0,a;
scanf("%lld%lld",&N,&K);
LL A[N],F[N],cos=-K;
FOR(i,0,N)scanf("%lld",&A[i]);
FOR(i,0,N)scanf("%lld",&F[i]);
qsort(A,N,sizeof(LL),lcmp);qsort(F,N,sizeof(LL),rcmp);
while(max-min>1){
mid=(max+min)/2,a=0;
FOR(i,0,N)if(A[i]*F[i]>mid)a+=dup(A[i]*F[i]-mid,F[i]);
if(a>K)min=mid;else max=mid;
}
printf("%lld\n",max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101537/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101537/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"
@fac = dso_local local_unnamed_addr global [100001 x i64] zeroinitializer, align 16
@finv = dso_local local_unnamed_addr global [100001 x i64] zeroinitializer, align 16
@inv = dso_local local_unnamed_addr global [100001 x i64] zeroinitializer, align 16
@.str = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !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 norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @dup(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%rem = srem i64 %a, %b
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %a, %b
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @GCD(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%cond5 = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
br label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.019 = phi i32 [ %cond, %entry ], [ %b.addr.018, %while.body ]
%b.addr.018 = phi i32 [ %cond5, %entry ], [ %rem, %while.body ]
%rem = srem i32 %a.addr.019, %b.addr.018
%cmp6.not = icmp eq i32 %rem, 0
br i1 %cmp6.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body
ret i32 %b.addr.018
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @LCM(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%cond.i = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%cond5.i = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
br label %while.body.i
while.body.i: ; preds = %while.body.i, %entry
%a.addr.019.i = phi i32 [ %cond.i, %entry ], [ %b.addr.018.i, %while.body.i ]
%b.addr.018.i = phi i32 [ %cond5.i, %entry ], [ %rem.i, %while.body.i ]
%rem.i = srem i32 %a.addr.019.i, %b.addr.018.i
%cmp6.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp6.not.i, label %GCD.exit, label %while.body.i, !llvm.loop !9
GCD.exit: ; preds = %while.body.i
%mul = mul nsw i32 %b, %a
%div = sdiv i32 %mul, %b.addr.018.i
ret i32 %div
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @POW(i32 noundef %a, i32 noundef %n) local_unnamed_addr #4 {
entry:
%cmp9 = icmp sgt i32 %n, 0
br i1 %cmp9, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end
%ans.012 = phi i64 [ %ans.1, %if.end ], [ 1, %entry ]
%n.addr.011 = phi i32 [ %shr, %if.end ], [ %n, %entry ]
%a.addr.010 = phi i32 [ %rem2, %if.end ], [ %a, %entry ]
%and = and i32 %n.addr.011, 1
%tobool.not = icmp eq i32 %and, 0
br i1 %tobool.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%conv = sext i32 %a.addr.010 to i64
%mul = mul nsw i64 %ans.012, %conv
%rem = srem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%ans.1 = phi i64 [ %rem, %if.then ], [ %ans.012, %while.body ]
%mul1 = mul nsw i32 %a.addr.010, %a.addr.010
%rem2 = urem i32 %mul1, 1000000007
%shr = lshr i32 %n.addr.011, 1
%cmp.not = icmp ult i32 %n.addr.011, 2
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !11
while.end.loopexit: ; preds = %if.end
%0 = trunc i64 %ans.1 to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%ans.0.lcssa = phi i32 [ 1, %entry ], [ %0, %while.end.loopexit ]
ret i32 %ans.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @icmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
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 @lcmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !12
%1 = load i64, ptr %b, align 8, !tbaa !12
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ccmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !14
%conv = sext i8 %0 to i32
%1 = load i8, ptr %b, align 1, !tbaa !14
%conv1 = sext i8 %1 to i32
%sub = sub nsw i32 %conv, %conv1
ret i32 %sub
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @scmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 {
entry:
%0 = load ptr, ptr %a, align 8, !tbaa !15
%1 = load ptr, ptr %b, align 8, !tbaa !15
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #15
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @comi() local_unnamed_addr #8 {
entry:
store i64 1, ptr getelementptr inbounds ([100001 x i64], ptr @fac, i64 0, i64 1), align 8, !tbaa !12
store i64 1, ptr @fac, align 16, !tbaa !12
store i64 1, ptr getelementptr inbounds ([100001 x i64], ptr @finv, i64 0, i64 1), align 8, !tbaa !12
store i64 1, ptr @finv, align 16, !tbaa !12
store i64 1, ptr getelementptr inbounds ([100001 x i64], ptr @inv, i64 0, i64 1), align 8, !tbaa !12
br label %for.body
for.body: ; preds = %entry, %for.body
%0 = phi i64 [ 1, %entry ], [ %rem18, %for.body ]
%1 = phi i64 [ 1, %entry ], [ %rem, %for.body ]
%indvars.iv = phi i64 [ 2, %entry ], [ %indvars.iv.next, %for.body ]
%mul = mul nsw i64 %1, %indvars.iv
%rem = srem i64 %mul, 1000000007
%arrayidx2 = getelementptr inbounds [100001 x i64], ptr @fac, i64 0, i64 %indvars.iv
store i64 %rem, ptr %arrayidx2, align 8, !tbaa !12
%2 = trunc i64 %indvars.iv to i32
%rem3 = urem i32 1000000007, %2
%idxprom4 = zext i32 %rem3 to i64
%arrayidx5 = getelementptr inbounds [100001 x i64], ptr @inv, i64 0, i64 %idxprom4
%3 = load i64, ptr %arrayidx5, align 8, !tbaa !12
%div = udiv i32 1000000007, %2
%conv6 = zext i32 %div to i64
%mul7 = mul nsw i64 %3, %conv6
%rem8 = srem i64 %mul7, 1000000007
%sub9 = sub nsw i64 1000000007, %rem8
%arrayidx11 = getelementptr inbounds [100001 x i64], ptr @inv, i64 0, i64 %indvars.iv
store i64 %sub9, ptr %arrayidx11, align 8, !tbaa !12
%mul17 = mul nuw nsw i64 %sub9, %0
%rem18 = urem i64 %mul17, 1000000007
%arrayidx20 = getelementptr inbounds [100001 x i64], ptr @finv, i64 0, i64 %indvars.iv
store i64 %rem18, ptr %arrayidx20, align 8, !tbaa !12
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 100001
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !17
for.end: ; preds = %for.body
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @com(i32 noundef %n, i32 noundef %k) local_unnamed_addr #9 {
entry:
%cmp = icmp slt i32 %n, %k
%0 = or i32 %k, %n
%1 = icmp slt i32 %0, 0
%or.cond10 = or i1 %cmp, %1
br i1 %or.cond10, label %return, label %if.end
if.end: ; preds = %entry
%idxprom = zext i32 %n to i64
%arrayidx = getelementptr inbounds [100001 x i64], ptr @fac, i64 0, i64 %idxprom
%2 = load i64, ptr %arrayidx, align 8, !tbaa !12
%idxprom4 = zext i32 %k to i64
%arrayidx5 = getelementptr inbounds [100001 x i64], ptr @finv, i64 0, i64 %idxprom4
%3 = load i64, ptr %arrayidx5, align 8, !tbaa !12
%sub = sub nsw i32 %n, %k
%idxprom6 = sext i32 %sub to i64
%arrayidx7 = getelementptr inbounds [100001 x i64], ptr @finv, i64 0, i64 %idxprom6
%4 = load i64, ptr %arrayidx7, align 8, !tbaa !12
%mul = mul nsw i64 %4, %3
%rem = srem i64 %mul, 1000000007
%mul8 = mul nsw i64 %rem, %2
%rem9 = srem i64 %mul8, 1000000007
%conv = trunc i64 %rem9 to i32
br label %return
return: ; preds = %entry, %if.end
%retval.0 = phi i32 [ %conv, %if.end ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @rcmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !12
%1 = load i64, ptr %a, align 8, !tbaa !12
%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 #10 {
entry:
%N = alloca i64, align 8
%K = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %K) #16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i64, ptr %N, align 8, !tbaa !12
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %0, align 16
%2 = load i64, ptr %N, align 8, !tbaa !12
%vla1 = alloca i64, i64 %2, align 16
%cmp52 = icmp sgt i64 %2, 0
br i1 %cmp52, label %for.body, label %for.end10
for.cond3.preheader: ; preds = %for.body
%cmp454 = icmp sgt i64 %3, 0
br i1 %cmp454, label %for.body5, label %for.end10
for.body: ; preds = %entry, %for.body
%i.053 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.053
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.053, 1
%3 = load i64, ptr %N, align 8, !tbaa !12
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !18
for.body5: ; preds = %for.cond3.preheader, %for.body5
%i.155 = phi i64 [ %inc9, %for.body5 ], [ 0, %for.cond3.preheader ]
%arrayidx6 = getelementptr inbounds i64, ptr %vla1, i64 %i.155
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6)
%inc9 = add nuw nsw i64 %i.155, 1
%4 = load i64, ptr %N, align 8, !tbaa !12
%cmp4 = icmp slt i64 %inc9, %4
br i1 %cmp4, label %for.body5, label %for.end10, !llvm.loop !19
for.end10: ; preds = %for.body5, %entry, %for.cond3.preheader
%.lcssa = phi i64 [ %3, %for.cond3.preheader ], [ %2, %entry ], [ %4, %for.body5 ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %.lcssa, i64 noundef 8, ptr noundef nonnull @lcmp) #16
%5 = load i64, ptr %N, align 8, !tbaa !12
call void @qsort(ptr noundef nonnull %vla1, i64 noundef %5, i64 noundef 8, ptr noundef nonnull @rcmp) #16
%6 = load i64, ptr %N, align 8, !tbaa !12
%cmp1456 = icmp sgt i64 %6, 0
%7 = load i64, ptr %K, align 8, !tbaa !12
%.fr = freeze i64 %7
br i1 %cmp1456, label %while.body.us, label %for.end10.split
while.body.us: ; preds = %for.end10, %for.cond13.for.end28_crit_edge.us
%min.061.us = phi i64 [ %div.min.0.us, %for.cond13.for.end28_crit_edge.us ], [ -1, %for.end10 ]
%max.060.us = phi i64 [ %max.0.div.us, %for.cond13.for.end28_crit_edge.us ], [ 4611686018427387903, %for.end10 ]
%add.us = add nsw i64 %min.061.us, %max.060.us
%div.us = sdiv i64 %add.us, 2
br label %for.body15.us
for.body15.us: ; preds = %while.body.us, %for.inc26.us
%i.258.us = phi i64 [ 0, %while.body.us ], [ %inc27.us, %for.inc26.us ]
%a.057.us = phi i64 [ 0, %while.body.us ], [ %a.1.us, %for.inc26.us ]
%arrayidx16.us = getelementptr inbounds i64, ptr %vla, i64 %i.258.us
%8 = load i64, ptr %arrayidx16.us, align 8, !tbaa !12
%arrayidx17.us = getelementptr inbounds i64, ptr %vla1, i64 %i.258.us
%9 = load i64, ptr %arrayidx17.us, align 8, !tbaa !12
%mul.us = mul nsw i64 %9, %8
%cmp18.us = icmp sgt i64 %mul.us, %div.us
br i1 %cmp18.us, label %if.then.us, label %for.inc26.us
if.then.us: ; preds = %for.body15.us
%sub22.us = sub nsw i64 %mul.us, %div.us
%rem.i.us = srem i64 %sub22.us, %9
%cmp.i.us = icmp ne i64 %rem.i.us, 0
%div.i.us = sdiv i64 %sub22.us, %9
%add.i.us = zext i1 %cmp.i.us to i64
%retval.0.i.us = add i64 %div.i.us, %a.057.us
%add25.us = add i64 %retval.0.i.us, %add.i.us
br label %for.inc26.us
for.inc26.us: ; preds = %if.then.us, %for.body15.us
%a.1.us = phi i64 [ %add25.us, %if.then.us ], [ %a.057.us, %for.body15.us ]
%inc27.us = add nuw nsw i64 %i.258.us, 1
%exitcond.not = icmp eq i64 %inc27.us, %6
br i1 %exitcond.not, label %for.cond13.for.end28_crit_edge.us, label %for.body15.us, !llvm.loop !20
for.cond13.for.end28_crit_edge.us: ; preds = %for.inc26.us
%cmp29.us = icmp sgt i64 %a.1.us, %.fr
%max.0.div.us = select i1 %cmp29.us, i64 %max.060.us, i64 %div.us
%div.min.0.us = select i1 %cmp29.us, i64 %div.us, i64 %min.061.us
%sub11.us = sub nsw i64 %max.0.div.us, %div.min.0.us
%cmp12.us = icmp sgt i64 %sub11.us, 1
br i1 %cmp12.us, label %while.body.us, label %while.end, !llvm.loop !21
for.end10.split: ; preds = %for.end10
%cmp29 = icmp slt i64 %.fr, 0
%spec.select = select i1 %cmp29, i64 4611686018427387903, i64 0
br label %while.end
while.end: ; preds = %for.cond13.for.end28_crit_edge.us, %for.end10.split
%.us-phi = phi i64 [ %spec.select, %for.end10.split ], [ %max.0.div.us, %for.cond13.for.end28_crit_edge.us ]
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %.us-phi)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #16
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #16
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #12
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #13
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #14
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #14
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 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 #3 = { 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 #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 = { mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { 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 #9 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 nocallback nofree nosync nounwind willreturn }
attributes #13 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #14 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #15 = { nounwind willreturn memory(read) }
attributes #16 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
|
#include<stdio.h>
#include<stdlib.h>
int u[100005], v[100005], w[100005];
int ascu(const void* a, const void* b)
{
if (u[*(int*)a] > u[*(int*)b])return 1;
if (u[*(int*)a] < u[*(int*)b])return -1;
return 0;
}
int ascv(const void* a, const void* b)
{
if (v[*(int*)a] > v[*(int*)b])return 1;
if (v[*(int*)a] < v[*(int*)b])return -1;
return 0;
}
int main()
{
int n;
scanf("%d", &n);
int i;
for (i = 0; i < n - 1; i++)
{
scanf("%d %d %d", &u[i], &v[i], &w[i]);
u[i]--;
v[i]--;
}
int ans[100005];
for (i = 0; i < n; i++)
ans[i] = 0;
int l[100005];
int m = 0;
int c1[100005], c2[100005];
for (i = 0; i < n - 1; i++)
c1[i] = c2[i] = i;
qsort(c1, n - 1, sizeof(int), ascu);
qsort(c2, n - 1, sizeof(int), ascv);
ans[0] = 1;
i = 0;
while (u[c1[i]] == 0)
{
if (w[c1[i]] % 2 == 0)
ans[v[c1[i]]] = 1;
else
ans[v[c1[i]]] = 2;
l[m] = v[c1[i]];
m++;
i++;
}
int min, max, mid, x;
while (m >= 0)
{
m--;
x = l[m];
min = 0;
max = n - 1;
if (u[c1[min]] != x)
{
while (max - min > 1)
{
mid = (max + min) / 2;
if (u[c1[mid]] < x)
min = mid;
else
max = mid;
}
min++;
}
while (min < n - 1 && u[c1[min]] == x)
{
if (ans[v[c1[min]]] == 0)
{
l[m] = v[c1[min]];
m++;
}
if (ans[x] == 1)
{
if (w[c1[min]] % 2 == 0)
ans[v[c1[min]]] = 1;
else
ans[v[c1[min]]] = 2;
}
else
{
if (w[c1[min]] % 2 == 0)
ans[v[c1[min]]] = 2;
else
ans[v[c1[min]]] = 1;
}
min++;
}
min = 0;
max = n - 1;
if (v[c2[min]] != x)
{
while (max - min > 1)
{
mid = (max + min) / 2;
if (v[c2[mid]] < x)
min = mid;
else
max = mid;
}
min++;
}
while (min < n - 1 && v[c2[min]] == x)
{
if (ans[u[c2[min]]] == 0)
{
l[m] = u[c2[min]];
m++;
}
if (ans[x] == 1)
{
if (w[c2[min]] % 2 == 0)
ans[u[c2[min]]] = 1;
else
ans[u[c2[min]]] = 2;
}
else
{
if (w[c2[min]] % 2 == 0)
ans[u[c2[min]]] = 2;
else
ans[u[c2[min]]] = 1;
}
min++;
}
}
for (i = 0; i < n; i++)
printf("%d\n", ans[i] - 1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101580/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101580/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"
@u = dso_local global [100005 x i32] zeroinitializer, align 16
@v = dso_local global [100005 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@w = dso_local global [100005 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @ascu(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x i32], ptr @u, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%idxprom1 = sext i32 %2 to i64
%arrayidx2 = getelementptr inbounds [100005 x i32], ptr @u, i64 0, i64 %idxprom1
%3 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp = icmp sgt i32 %1, %3
%cmp7 = icmp slt i32 %1, %3
%. = sext i1 %cmp7 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @ascv(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x i32], ptr @v, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%idxprom1 = sext i32 %2 to i64
%arrayidx2 = getelementptr inbounds [100005 x i32], ptr @v, i64 0, i64 %idxprom1
%3 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp = icmp sgt i32 %1, %3
%cmp7 = icmp slt i32 %1, %3
%. = sext i1 %cmp7 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%ans = alloca [100005 x i32], align 16
%l = alloca [100005 x i32], align 16
%c1 = alloca [100005 x i32], align 16
%c2 = alloca [100005 x i32], 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)
%0 = load i32, ptr %n, align 4, !tbaa !5
%sub377 = add nsw i32 %0, -1
%cmp378 = icmp sgt i32 %0, 1
br i1 %cmp378, 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 [100005 x i32], ptr @u, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [100005 x i32], ptr @v, i64 0, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [100005 x i32], ptr @w, i64 0, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx4)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%dec = add nsw i32 %1, -1
store i32 %dec, ptr %arrayidx, align 4, !tbaa !5
%2 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%dec10 = add nsw i32 %2, -1
store i32 %dec10, ptr %arrayidx2, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %3, -1
%4 = sext i32 %sub to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %3, %for.body ]
%sub.lcssa = phi i32 [ %sub377, %entry ], [ %sub, %for.body ]
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %ans) #6
%cmp12381 = icmp sgt i32 %.lcssa, 0
br i1 %cmp12381, label %for.body13.preheader, label %for.end18
for.body13.preheader: ; preds = %for.end
%5 = zext i32 %.lcssa to i64
%6 = shl nuw nsw i64 %5, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %ans, i8 0, i64 %6, i1 false), !tbaa !5
br label %for.end18
for.end18: ; preds = %for.body13.preheader, %for.end
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %l) #6
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %c1) #6
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %c2) #6
%cmp21383 = icmp sgt i32 %sub.lcssa, 0
br i1 %cmp21383, label %for.body22.preheader, label %for.end29
for.body22.preheader: ; preds = %for.end18
%wide.trip.count = zext i32 %sub.lcssa to i64
%min.iters.check = icmp ult i32 %sub.lcssa, 8
br i1 %min.iters.check, label %for.body22.preheader457, label %vector.ph
vector.ph: ; preds = %for.body22.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.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%7 = getelementptr inbounds [100005 x i32], ptr %c2, i64 0, i64 %index
store <4 x i32> %vec.ind, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
store <4 x i32> %step.add, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds [100005 x i32], ptr %c1, i64 0, i64 %index
store <4 x i32> %vec.ind, ptr %9, align 16, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
store <4 x i32> %step.add, ptr %10, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end29, label %for.body22.preheader457
for.body22.preheader457: ; preds = %for.body22.preheader, %middle.block
%indvars.iv420.ph = phi i64 [ 0, %for.body22.preheader ], [ %n.vec, %middle.block ]
br label %for.body22
for.body22: ; preds = %for.body22.preheader457, %for.body22
%indvars.iv420 = phi i64 [ %indvars.iv.next421, %for.body22 ], [ %indvars.iv420.ph, %for.body22.preheader457 ]
%arrayidx24 = getelementptr inbounds [100005 x i32], ptr %c2, i64 0, i64 %indvars.iv420
%12 = trunc i64 %indvars.iv420 to i32
store i32 %12, ptr %arrayidx24, align 4, !tbaa !5
%arrayidx26 = getelementptr inbounds [100005 x i32], ptr %c1, i64 0, i64 %indvars.iv420
store i32 %12, ptr %arrayidx26, align 4, !tbaa !5
%indvars.iv.next421 = add nuw nsw i64 %indvars.iv420, 1
%exitcond.not = icmp eq i64 %indvars.iv.next421, %wide.trip.count
br i1 %exitcond.not, label %for.end29, label %for.body22, !llvm.loop !14
for.end29: ; preds = %for.body22, %middle.block, %for.end18
%conv = sext i32 %sub.lcssa to i64
call void @qsort(ptr noundef nonnull %c1, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @ascu) #6
%13 = load i32, ptr %n, align 4, !tbaa !5
%sub32 = add nsw i32 %13, -1
%conv33 = sext i32 %sub32 to i64
call void @qsort(ptr noundef nonnull %c2, i64 noundef %conv33, i64 noundef 4, ptr noundef nonnull @ascv) #6
store i32 1, ptr %ans, align 16, !tbaa !5
%14 = load i32, ptr %c1, align 16, !tbaa !5
%idxprom37385 = sext i32 %14 to i64
%arrayidx38386 = getelementptr inbounds [100005 x i32], ptr @u, i64 0, i64 %idxprom37385
%15 = load i32, ptr %arrayidx38386, align 4, !tbaa !5
%cmp39387 = icmp eq i32 %15, 0
br i1 %cmp39387, label %while.body, label %while.cond67.preheader.thread
while.cond67.preheader.thread: ; preds = %for.end29
%.pre442 = load i32, ptr %n, align 4, !tbaa !5
br label %while.body70.lr.ph
while.cond67.preheader: ; preds = %while.body
%16 = trunc i64 %indvars.iv.next424 to i32
%cmp68410 = icmp sgt i32 %16, -1
%.pre = load i32, ptr %n, align 4, !tbaa !5
br i1 %cmp68410, label %while.body70.lr.ph, label %for.cond291.preheader
while.body70.lr.ph: ; preds = %while.cond67.preheader.thread, %while.cond67.preheader
%.pre444 = phi i32 [ %.pre442, %while.cond67.preheader.thread ], [ %.pre, %while.cond67.preheader ]
%m.0.lcssa443 = phi i32 [ 0, %while.cond67.preheader.thread ], [ %16, %while.cond67.preheader ]
%sub74 = add i32 %.pre444, -1
%cmp84392 = icmp sgt i32 %.pre444, 2
%17 = load i32, ptr %c2, align 16, !tbaa !5
%idxprom183 = sext i32 %17 to i64
%arrayidx184 = getelementptr inbounds [100005 x i32], ptr @v, i64 0, i64 %idxprom183
%18 = load i32, ptr %arrayidx184, align 4, !tbaa !5
br label %while.body70
while.body: ; preds = %for.end29, %while.body
%indvars.iv423 = phi i64 [ %indvars.iv.next424, %while.body ], [ 0, %for.end29 ]
%idxprom37390 = phi i64 [ %idxprom37, %while.body ], [ %idxprom37385, %for.end29 ]
%arrayidx44 = getelementptr inbounds [100005 x i32], ptr @w, i64 0, i64 %idxprom37390
%19 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%20 = and i32 %19, 1
%cmp45 = icmp eq i32 %20, 0
%arrayidx50 = getelementptr inbounds [100005 x i32], ptr @v, i64 0, i64 %idxprom37390
%21 = load i32, ptr %arrayidx50, align 4, !tbaa !5
%idxprom51 = sext i32 %21 to i64
%arrayidx52 = getelementptr inbounds [100005 x i32], ptr %ans, i64 0, i64 %idxprom51
%. = select i1 %cmp45, i32 1, i32 2
store i32 %., ptr %arrayidx52, align 4, !tbaa !5
%arrayidx64 = getelementptr inbounds [100005 x i32], ptr %l, i64 0, i64 %indvars.iv423
store i32 %21, ptr %arrayidx64, align 4, !tbaa !5
%indvars.iv.next424 = add nuw nsw i64 %indvars.iv423, 1
%arrayidx36 = getelementptr inbounds [100005 x i32], ptr %c1, i64 0, i64 %indvars.iv.next424
%22 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%idxprom37 = sext i32 %22 to i64
%arrayidx38 = getelementptr inbounds [100005 x i32], ptr @u, i64 0, i64 %idxprom37
%23 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%cmp39 = icmp eq i32 %23, 0
br i1 %cmp39, label %while.body, label %while.cond67.preheader, !llvm.loop !15
for.cond291.preheader: ; preds = %while.end289, %while.cond67.preheader
%.pre445 = phi i32 [ %.pre, %while.cond67.preheader ], [ %.pre444, %while.end289 ]
%cmp292412 = icmp sgt i32 %.pre445, 0
br i1 %cmp292412, label %for.body294, label %for.end301
while.body70: ; preds = %while.body70.lr.ph, %while.end289
%m.1411 = phi i32 [ %m.0.lcssa443, %while.body70.lr.ph ], [ %m.4.lcssa, %while.end289 ]
%dec71 = add nsw i32 %m.1411, -1
%idxprom72 = sext i32 %dec71 to i64
%arrayidx73 = getelementptr inbounds [100005 x i32], ptr %l, i64 0, i64 %idxprom72
%24 = load i32, ptr %arrayidx73, align 4, !tbaa !5
%cmp79.not = icmp eq i32 %15, %24
br i1 %cmp79.not, label %if.end98, label %while.cond82.preheader
while.cond82.preheader: ; preds = %while.body70
br i1 %cmp84392, label %while.body86, label %while.end96
while.body86: ; preds = %while.cond82.preheader, %while.body86
%max.0394 = phi i32 [ %max.0.div, %while.body86 ], [ %sub74, %while.cond82.preheader ]
%min.0393 = phi i32 [ %div.min.0, %while.body86 ], [ 0, %while.cond82.preheader ]
%add = add nsw i32 %max.0394, %min.0393
%div = sdiv i32 %add, 2
%idxprom87 = sext i32 %div to i64
%arrayidx88 = getelementptr inbounds [100005 x i32], ptr %c1, i64 0, i64 %idxprom87
%25 = load i32, ptr %arrayidx88, align 4, !tbaa !5
%idxprom89 = sext i32 %25 to i64
%arrayidx90 = getelementptr inbounds [100005 x i32], ptr @u, i64 0, i64 %idxprom89
%26 = load i32, ptr %arrayidx90, align 4, !tbaa !5
%cmp91 = icmp slt i32 %26, %24
%div.min.0 = select i1 %cmp91, i32 %div, i32 %min.0393
%max.0.div = select i1 %cmp91, i32 %max.0394, i32 %div
%sub83 = sub nsw i32 %max.0.div, %div.min.0
%cmp84 = icmp sgt i32 %sub83, 1
br i1 %cmp84, label %while.body86, label %while.end96, !llvm.loop !16
while.end96: ; preds = %while.body86, %while.cond82.preheader
%min.0.lcssa = phi i32 [ 0, %while.cond82.preheader ], [ %div.min.0, %while.body86 ]
%inc97 = add nsw i32 %min.0.lcssa, 1
br label %if.end98
if.end98: ; preds = %while.end96, %while.body70
%min.2 = phi i32 [ %inc97, %while.end96 ], [ 0, %while.body70 ]
%cmp101396 = icmp slt i32 %min.2, %sub74
br i1 %cmp101396, label %land.rhs.lr.ph, label %while.end179
land.rhs.lr.ph: ; preds = %if.end98
%idxprom127 = sext i32 %24 to i64
%arrayidx128 = getelementptr inbounds [100005 x i32], ptr %ans, i64 0, i64 %idxprom127
%27 = sext i32 %min.2 to i64
br label %land.rhs
land.rhs: ; preds = %land.rhs.lr.ph, %if.end126
%indvars.iv428 = phi i64 [ %27, %land.rhs.lr.ph ], [ %indvars.iv.next429, %if.end126 ]
%m.2397 = phi i32 [ %dec71, %land.rhs.lr.ph ], [ %m.3, %if.end126 ]
%arrayidx104 = getelementptr inbounds [100005 x i32], ptr %c1, i64 0, i64 %indvars.iv428
%28 = load i32, ptr %arrayidx104, align 4, !tbaa !5
%idxprom105 = sext i32 %28 to i64
%arrayidx106 = getelementptr inbounds [100005 x i32], ptr @u, i64 0, i64 %idxprom105
%29 = load i32, ptr %arrayidx106, align 4, !tbaa !5
%cmp107 = icmp eq i32 %29, %24
br i1 %cmp107, label %while.body109, label %while.end179
while.body109: ; preds = %land.rhs
%arrayidx113 = getelementptr inbounds [100005 x i32], ptr @v, i64 0, i64 %idxprom105
%30 = load i32, ptr %arrayidx113, align 4, !tbaa !5
%idxprom114 = sext i32 %30 to i64
%arrayidx115 = getelementptr inbounds [100005 x i32], ptr %ans, i64 0, i64 %idxprom114
%31 = load i32, ptr %arrayidx115, align 4, !tbaa !5
%cmp116 = icmp eq i32 %31, 0
br i1 %cmp116, label %if.then118, label %if.end126
if.then118: ; preds = %while.body109
%idxprom123 = sext i32 %m.2397 to i64
%arrayidx124 = getelementptr inbounds [100005 x i32], ptr %l, i64 0, i64 %idxprom123
store i32 %30, ptr %arrayidx124, align 4, !tbaa !5
%inc125 = add nsw i32 %m.2397, 1
br label %if.end126
if.end126: ; preds = %if.then118, %while.body109
%m.3 = phi i32 [ %inc125, %if.then118 ], [ %m.2397, %while.body109 ]
%32 = load i32, ptr %arrayidx128, align 4, !tbaa !5
%cmp129 = icmp eq i32 %32, 1
%arrayidx135 = getelementptr inbounds [100005 x i32], ptr @w, i64 0, i64 %idxprom105
%33 = load i32, ptr %arrayidx135, align 4, !tbaa !5
%34 = and i32 %33, 1
%cmp137 = icmp eq i32 %34, 0
%.450 = select i1 %cmp137, i32 1, i32 2
%.451 = select i1 %cmp137, i32 2, i32 1
%.sink448 = select i1 %cmp129, i32 %.450, i32 %.451
store i32 %.sink448, ptr %arrayidx115, align 4, !tbaa !5
%indvars.iv.next429 = add nsw i64 %indvars.iv428, 1
%lftr.wideiv = trunc i64 %indvars.iv.next429 to i32
%exitcond431.not = icmp eq i32 %sub74, %lftr.wideiv
br i1 %exitcond431.not, label %while.end179, label %land.rhs, !llvm.loop !17
while.end179: ; preds = %land.rhs, %if.end126, %if.end98
%m.2.lcssa = phi i32 [ %dec71, %if.end98 ], [ %m.3, %if.end126 ], [ %m.2397, %land.rhs ]
%cmp185.not = icmp eq i32 %18, %24
br i1 %cmp185.not, label %if.end206, label %while.cond188.preheader
while.cond188.preheader: ; preds = %while.end179
br i1 %cmp84392, label %while.body192, label %while.end204
while.body192: ; preds = %while.cond188.preheader, %while.body192
%max.2403 = phi i32 [ %max.2.div194, %while.body192 ], [ %sub74, %while.cond188.preheader ]
%min.4402 = phi i32 [ %div194.min.4, %while.body192 ], [ 0, %while.cond188.preheader ]
%add193 = add nsw i32 %max.2403, %min.4402
%div194 = sdiv i32 %add193, 2
%idxprom195 = sext i32 %div194 to i64
%arrayidx196 = getelementptr inbounds [100005 x i32], ptr %c2, i64 0, i64 %idxprom195
%35 = load i32, ptr %arrayidx196, align 4, !tbaa !5
%idxprom197 = sext i32 %35 to i64
%arrayidx198 = getelementptr inbounds [100005 x i32], ptr @v, i64 0, i64 %idxprom197
%36 = load i32, ptr %arrayidx198, align 4, !tbaa !5
%cmp199 = icmp slt i32 %36, %24
%div194.min.4 = select i1 %cmp199, i32 %div194, i32 %min.4402
%max.2.div194 = select i1 %cmp199, i32 %max.2403, i32 %div194
%sub189 = sub nsw i32 %max.2.div194, %div194.min.4
%cmp190 = icmp sgt i32 %sub189, 1
br i1 %cmp190, label %while.body192, label %while.end204, !llvm.loop !18
while.end204: ; preds = %while.body192, %while.cond188.preheader
%min.4.lcssa = phi i32 [ 0, %while.cond188.preheader ], [ %div194.min.4, %while.body192 ]
%inc205 = add nsw i32 %min.4.lcssa, 1
br label %if.end206
if.end206: ; preds = %while.end204, %while.end179
%min.6 = phi i32 [ %inc205, %while.end204 ], [ 0, %while.end179 ]
%cmp209405 = icmp slt i32 %min.6, %sub74
br i1 %cmp209405, label %land.rhs211.lr.ph, label %while.end289
land.rhs211.lr.ph: ; preds = %if.end206
%idxprom237 = sext i32 %24 to i64
%arrayidx238 = getelementptr inbounds [100005 x i32], ptr %ans, i64 0, i64 %idxprom237
%37 = sext i32 %min.6 to i64
br label %land.rhs211
land.rhs211: ; preds = %land.rhs211.lr.ph, %if.end236
%indvars.iv432 = phi i64 [ %37, %land.rhs211.lr.ph ], [ %indvars.iv.next433, %if.end236 ]
%m.4406 = phi i32 [ %m.2.lcssa, %land.rhs211.lr.ph ], [ %m.5, %if.end236 ]
%arrayidx213 = getelementptr inbounds [100005 x i32], ptr %c2, i64 0, i64 %indvars.iv432
%38 = load i32, ptr %arrayidx213, align 4, !tbaa !5
%idxprom214 = sext i32 %38 to i64
%arrayidx215 = getelementptr inbounds [100005 x i32], ptr @v, i64 0, i64 %idxprom214
%39 = load i32, ptr %arrayidx215, align 4, !tbaa !5
%cmp216 = icmp eq i32 %39, %24
br i1 %cmp216, label %while.body219, label %while.end289
while.body219: ; preds = %land.rhs211
%arrayidx223 = getelementptr inbounds [100005 x i32], ptr @u, i64 0, i64 %idxprom214
%40 = load i32, ptr %arrayidx223, align 4, !tbaa !5
%idxprom224 = sext i32 %40 to i64
%arrayidx225 = getelementptr inbounds [100005 x i32], ptr %ans, i64 0, i64 %idxprom224
%41 = load i32, ptr %arrayidx225, align 4, !tbaa !5
%cmp226 = icmp eq i32 %41, 0
br i1 %cmp226, label %if.then228, label %if.end236
if.then228: ; preds = %while.body219
%idxprom233 = sext i32 %m.4406 to i64
%arrayidx234 = getelementptr inbounds [100005 x i32], ptr %l, i64 0, i64 %idxprom233
store i32 %40, ptr %arrayidx234, align 4, !tbaa !5
%inc235 = add nsw i32 %m.4406, 1
br label %if.end236
if.end236: ; preds = %if.then228, %while.body219
%m.5 = phi i32 [ %inc235, %if.then228 ], [ %m.4406, %while.body219 ]
%42 = load i32, ptr %arrayidx238, align 4, !tbaa !5
%cmp239 = icmp eq i32 %42, 1
%arrayidx245 = getelementptr inbounds [100005 x i32], ptr @w, i64 0, i64 %idxprom214
%43 = load i32, ptr %arrayidx245, align 4, !tbaa !5
%44 = and i32 %43, 1
%cmp247 = icmp eq i32 %44, 0
%.452 = select i1 %cmp247, i32 1, i32 2
%.453 = select i1 %cmp247, i32 2, i32 1
%.sink449 = select i1 %cmp239, i32 %.452, i32 %.453
store i32 %.sink449, ptr %arrayidx225, align 4, !tbaa !5
%indvars.iv.next433 = add nsw i64 %indvars.iv432, 1
%lftr.wideiv435 = trunc i64 %indvars.iv.next433 to i32
%exitcond436.not = icmp eq i32 %sub74, %lftr.wideiv435
br i1 %exitcond436.not, label %while.end289, label %land.rhs211, !llvm.loop !19
while.end289: ; preds = %land.rhs211, %if.end236, %if.end206
%m.4.lcssa = phi i32 [ %m.2.lcssa, %if.end206 ], [ %m.5, %if.end236 ], [ %m.4406, %land.rhs211 ]
%cmp68 = icmp sgt i32 %m.4.lcssa, -1
br i1 %cmp68, label %while.body70, label %for.cond291.preheader, !llvm.loop !20
for.body294: ; preds = %for.cond291.preheader, %for.body294
%indvars.iv437 = phi i64 [ %indvars.iv.next438, %for.body294 ], [ 0, %for.cond291.preheader ]
%arrayidx296 = getelementptr inbounds [100005 x i32], ptr %ans, i64 0, i64 %indvars.iv437
%45 = load i32, ptr %arrayidx296, align 4, !tbaa !5
%sub297 = add nsw i32 %45, -1
%call298 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub297)
%indvars.iv.next438 = add nuw nsw i64 %indvars.iv437, 1
%46 = load i32, ptr %n, align 4, !tbaa !5
%47 = sext i32 %46 to i64
%cmp292 = icmp slt i64 %indvars.iv.next438, %47
br i1 %cmp292, label %for.body294, label %for.end301, !llvm.loop !21
for.end301: ; preds = %for.body294, %for.cond291.preheader
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %c2) #6
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %c1) #6
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %l) #6
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %ans) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define BIG 2000000007
#define MOD 1000000007
typedef unsigned long long ull;
typedef signed long long sll;
#define N_MAX 200000
#define M_MAX 100000
typedef struct {
int a;
int b;
} hw;
const hw vector8[8] = {
{-1, -1},
{-1, 0},
{-1, +1},
{ 0, -1},
{ 0, +1},
{+1, -1},
{+1, 0},
{+1, +1}
};
ull n, m;
ull h, w;
ull k;
ull va, vb, vc, vd, ve, vf;
ull a[N_MAX];
// sll a[N_MAX];
// ull b[N_MAX];
// ull dp[N_MAX][M_MAX + 1];
// char s[N_MAX + 1];
// char t[N_MAX + 1];
// hw arr[N_MAX];
// hw brr[N_MAX];
// ull digitdp[102][ 2][ 2];
// pos less carry
void swap_adj(ull *a, ull *b){
ull tmp = *b;
*b = *a;
*a = tmp;
return;
}
ull divide(ull a, ull b){
ull x = MOD - 2;
ull ans = 1;
while (x) {
if (x & 1) ans = (ans * b) % MOD;
b = (b * b) % MOD;
x /= 2;
}
return (a * ans) % MOD;
}
int digits(ull x){
int i = 1;
while (x >= 10) {
x /= 10;
i++;
}
return i;
}
int min(ull x, ull y){
return (x < y) ? x : y;
}
ull gcd(ull x, ull y){
if (x < y) {
return gcd(y, x);
} else if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
ull bitpow(ull a, ull x){
ull result = 1;
while (x) {
if (x & 1) {
result *= a;
result %= MOD;
}
x /= 2;
a = (a * a) % MOD;
}
return result;
}
// int nextroute(int arr[]){
// int i = n - 1;
// int j, x;
// while (arr[i - 1] > arr[i]) i--;
// x = n;
// for (j = i; j < n; j++) {
// if (arr[j] < arr[i - 1]) continue;
// if (x == n || arr[x] > arr[j]) x = j;
// }
// arr[i - 1] ^= arr[x];
// arr[x] ^= arr[i - 1];
// arr[i - 1] ^= arr[x];
// qsort(&arr[i], n - i, sizeof(int), comp);
// return 0;
// }
int nibutan_target(ull target){
ull maxdist = (target * (target + 1) / 2); // 時刻targetまでに到着できる距離は[-maxdist, maxdist]
return (n <= maxdist);
}
int targetdig(ull x, int index /* 1-indexed */){
// static...?
int posmax = digits(x);
if (posmax < index) return -1;
while (posmax > index) {
posmax--;
x /= 10;
}
return x % 10;
}
int intcomp(const void *left, const void *right){
if ((*(int*)left) < (*(int*)right)) {
return -1;
} else if ((*(int*)left) > (*(int*)right)) {
return +1;
} else {
return 0;
}
}
int ullcomp(const void *left, const void *right){
if ((*(ull*)left) < (*(ull*)right)) {
return -1;
} else if ((*(ull*)left) > (*(ull*)right)) {
return +1;
} else {
return 0;
}
}
int hwAcomp(const void *left, const void *right){
return intcomp(&(((hw*)left)->a), &(((hw*)right)->a));
}
int hwBcomp(const void *left, const void *right){
return intcomp(&(((hw*)left)->b), &(((hw*)right)->b));
}
int hwABcomp(const void *left, const void *right){
int x = hwAcomp(left, right);
if (x) return x;
return hwBcomp(left, right);
}
int findarr(hw arr[], int length, int h, int w){
int minok = length - 1;
int minng = -1;
while (minng + 1 < minok) {
int med = (minok + minng) / 2;
if (arr[med].a <= h) {
minok = med;
} else {
minng = med;
}
}
if (arr[minok].a != h) return 0;
int maxok = minok;
int maxng = length;
while (maxok + 1 < maxng) {
int med = (maxok + maxng) / 2;
if (arr[med].a <= h) {
maxok = med;
} else {
maxng = med;
}
}
minok = minok;
minng = maxok + 1;
while (minok + 1 < minng) {
int med = (maxok + maxng) / 2;
if (arr[med].b < w) {
minok = med;
} else if (arr[med].b > w) {
minng = med;
} else {
return 1;
}
}
if (arr[minok].a != w) return 0;
return 1;
}
ull solve(){
int i, j;
// int pos, less, carry;
// const int posmax = strlen(s);
// int stackmax = -1;
ull result = 0;
ull odd = 0, even = 0;
ull conbination;
for (i = 0; i < n; i++) {
if (a[i] & 1) {
odd++;
} else {
even++;
}
}
conbination = 1;
j = 0;
for (i = k; i <= odd; i += 2) {
while (j < i) {
j++;
conbination *= (odd + 1 - j);
conbination /= j;
}
result += conbination;
}
for (i = 0; i < even; i++) {
result *= 2;
}
printf("%llu\n", result);
return 0;
}
int main(void){
int i, j;
int x = 0;
// int a, b, c;
scanf("%llu%llu", &n, &k);
for (i = 0; i < n; i++) {
scanf("%llu", &a[i]);
// puts("HELLO!");
}
// puts("I'm going to solve");
solve();
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101623/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101623/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.hw = type { i32, i32 }
@vector8 = dso_local local_unnamed_addr constant [8 x %struct.hw] [%struct.hw { i32 -1, i32 -1 }, %struct.hw { i32 -1, i32 0 }, %struct.hw { i32 -1, i32 1 }, %struct.hw { i32 0, i32 -1 }, %struct.hw { i32 0, i32 1 }, %struct.hw { i32 1, i32 -1 }, %struct.hw { i32 1, i32 0 }, %struct.hw { i32 1, i32 1 }], align 16
@n = dso_local global i64 0, align 8
@a = dso_local global [200000 x i64] zeroinitializer, align 16
@k = dso_local global i64 0, align 8
@.str = private unnamed_addr constant [6 x i8] c"%llu\0A\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%llu%llu\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%llu\00", align 1
@m = dso_local local_unnamed_addr global i64 0, align 8
@h = dso_local local_unnamed_addr global i64 0, align 8
@w = dso_local local_unnamed_addr global i64 0, align 8
@va = dso_local local_unnamed_addr global i64 0, align 8
@vb = dso_local local_unnamed_addr global i64 0, align 8
@vc = dso_local local_unnamed_addr global i64 0, align 8
@vd = dso_local local_unnamed_addr global i64 0, align 8
@ve = dso_local local_unnamed_addr global i64 0, align 8
@vf = dso_local local_unnamed_addr global i64 0, align 8
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap_adj(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: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @divide(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
br label %while.body
while.body: ; preds = %entry, %if.end
%ans.014 = phi i64 [ 1, %entry ], [ %ans.1, %if.end ]
%x.013 = phi i64 [ 1000000005, %entry ], [ %div11, %if.end ]
%b.addr.012 = phi i64 [ %b, %entry ], [ %rem3, %if.end ]
%and = and i64 %x.013, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul i64 %ans.014, %b.addr.012
%rem = urem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%ans.1 = phi i64 [ %rem, %if.then ], [ %ans.014, %while.body ]
%mul2 = mul i64 %b.addr.012, %b.addr.012
%rem3 = urem i64 %mul2, 1000000007
%div11 = lshr i64 %x.013, 1
%tobool.not = icmp ult i64 %x.013, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end
%mul4 = mul i64 %ans.1, %a
%rem5 = urem i64 %mul4, 1000000007
ret i64 %rem5
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @digits(i64 noundef %x) local_unnamed_addr #1 {
entry:
%cmp3 = icmp ugt i64 %x, 9
br i1 %cmp3, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%i.05 = phi i32 [ %inc, %while.body ], [ 1, %entry ]
%x.addr.04 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%div = udiv i64 %x.addr.04, 10
%inc = add nuw nsw i32 %i.05, 1
%cmp = icmp ugt i64 %x.addr.04, 99
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !11
while.end: ; preds = %while.body, %entry
%i.0.lcssa = phi i32 [ 1, %entry ], [ %inc, %while.body ]
ret i32 %i.0.lcssa
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i64 noundef %x, i64 noundef %y) local_unnamed_addr #2 {
entry:
%cond = tail call i64 @llvm.umin.i64(i64 %x, i64 %y)
%conv = trunc i64 %cond to i32
ret i32 %conv
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #1 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse.backedge, %entry
%x.tr = phi i64 [ %x, %entry ], [ %y.tr, %tailrecurse.backedge ]
%y.tr = phi i64 [ %y, %entry ], [ %y.tr.be, %tailrecurse.backedge ]
%cmp = icmp ult i64 %x.tr, %y.tr
br i1 %cmp, label %tailrecurse.backedge, label %if.else
if.else: ; preds = %tailrecurse
%cmp1 = icmp eq i64 %y.tr, 0
br i1 %cmp1, label %return, label %if.else3
if.else3: ; preds = %if.else
%rem = urem i64 %x.tr, %y.tr
br label %tailrecurse.backedge
tailrecurse.backedge: ; preds = %if.else3, %tailrecurse
%y.tr.be = phi i64 [ %rem, %if.else3 ], [ %x.tr, %tailrecurse ]
br label %tailrecurse
return: ; preds = %if.else
ret i64 %x.tr
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @bitpow(i64 noundef %a, i64 noundef %x) local_unnamed_addr #1 {
entry:
%tobool.not11 = icmp eq i64 %x, 0
br i1 %tobool.not11, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%result.014 = phi i64 [ %result.1, %if.end ], [ 1, %entry ]
%x.addr.013 = phi i64 [ %div10, %if.end ], [ %x, %entry ]
%a.addr.012 = phi i64 [ %rem3, %if.end ], [ %a, %entry ]
%and = and i64 %x.addr.013, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul i64 %result.014, %a.addr.012
%rem = urem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%result.1 = phi i64 [ %rem, %if.then ], [ %result.014, %while.body ]
%div10 = lshr i64 %x.addr.013, 1
%mul2 = mul i64 %a.addr.012, %a.addr.012
%rem3 = urem i64 %mul2, 1000000007
%tobool.not = icmp ult i64 %x.addr.013, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.end, %entry
%result.0.lcssa = phi i64 [ 1, %entry ], [ %result.1, %if.end ]
ret i64 %result.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @nibutan_target(i64 noundef %target) local_unnamed_addr #3 {
entry:
%add = add i64 %target, 1
%mul = mul i64 %add, %target
%div2 = lshr i64 %mul, 1
%0 = load i64, ptr @n, align 8, !tbaa !5
%cmp = icmp ule i64 %0, %div2
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @targetdig(i64 noundef %x, i32 noundef %index) local_unnamed_addr #1 {
entry:
%cmp3.i = icmp ugt i64 %x, 9
br i1 %cmp3.i, label %while.body.i, label %digits.exit
while.body.i: ; preds = %entry, %while.body.i
%i.05.i = phi i32 [ %inc.i, %while.body.i ], [ 1, %entry ]
%x.addr.04.i = phi i64 [ %div.i, %while.body.i ], [ %x, %entry ]
%div.i = udiv i64 %x.addr.04.i, 10
%inc.i = add nuw nsw i32 %i.05.i, 1
%cmp.i = icmp ugt i64 %x.addr.04.i, 99
br i1 %cmp.i, label %while.body.i, label %digits.exit, !llvm.loop !11
digits.exit: ; preds = %while.body.i, %entry
%i.0.lcssa.i = phi i32 [ 1, %entry ], [ %inc.i, %while.body.i ]
%cmp = icmp slt i32 %i.0.lcssa.i, %index
br i1 %cmp, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %digits.exit
%cmp17 = icmp sgt i32 %i.0.lcssa.i, %index
br i1 %cmp17, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %while.cond.preheader
%0 = sub i32 %i.0.lcssa.i, %index
%1 = xor i32 %index, -1
%2 = add i32 %i.0.lcssa.i, %1
%xtraiter = and i32 %0, 3
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.body.prol.loopexit, label %while.body.prol
while.body.prol: ; preds = %while.body.preheader, %while.body.prol
%posmax.09.prol = phi i32 [ %dec.prol, %while.body.prol ], [ %i.0.lcssa.i, %while.body.preheader ]
%x.addr.08.prol = phi i64 [ %div.prol, %while.body.prol ], [ %x, %while.body.preheader ]
%prol.iter = phi i32 [ %prol.iter.next, %while.body.prol ], [ 0, %while.body.preheader ]
%dec.prol = add nsw i32 %posmax.09.prol, -1
%div.prol = udiv i64 %x.addr.08.prol, 10
%prol.iter.next = add i32 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %while.body.prol.loopexit, label %while.body.prol, !llvm.loop !13
while.body.prol.loopexit: ; preds = %while.body.prol, %while.body.preheader
%posmax.09.unr = phi i32 [ %i.0.lcssa.i, %while.body.preheader ], [ %dec.prol, %while.body.prol ]
%x.addr.08.unr = phi i64 [ %x, %while.body.preheader ], [ %div.prol, %while.body.prol ]
%div.lcssa.unr = phi i64 [ undef, %while.body.preheader ], [ %div.prol, %while.body.prol ]
%3 = icmp ult i32 %2, 3
br i1 %3, label %while.end, label %while.body
while.body: ; preds = %while.body.prol.loopexit, %while.body
%posmax.09 = phi i32 [ %dec.3, %while.body ], [ %posmax.09.unr, %while.body.prol.loopexit ]
%x.addr.08 = phi i64 [ %div.3, %while.body ], [ %x.addr.08.unr, %while.body.prol.loopexit ]
%dec.3 = add nsw i32 %posmax.09, -4
%div.3 = udiv i64 %x.addr.08, 10000
%cmp1.3 = icmp sgt i32 %dec.3, %index
br i1 %cmp1.3, label %while.body, label %while.end, !llvm.loop !15
while.end: ; preds = %while.body.prol.loopexit, %while.body, %while.cond.preheader
%x.addr.0.lcssa = phi i64 [ %x, %while.cond.preheader ], [ %div.lcssa.unr, %while.body.prol.loopexit ], [ %div.3, %while.body ]
%rem = urem i64 %x.addr.0.lcssa, 10
%conv = trunc i64 %rem to i32
br label %cleanup
cleanup: ; preds = %digits.exit, %while.end
%retval.0 = phi i32 [ %conv, %while.end ], [ -1, %digits.exit ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @intcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %left, align 4, !tbaa !16
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp sgt 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 @ullcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !5
%1 = load i64, ptr %right, align 8, !tbaa !5
%cmp = icmp ult i64 %0, %1
%cmp1 = icmp ugt i64 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @hwAcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %left, align 4, !tbaa !16
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp.i = icmp slt i32 %0, %1
%cmp1.i = icmp sgt i32 %0, %1
%..i = zext i1 %cmp1.i to i32
%retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i
ret i32 %retval.0.i
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @hwBcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%b = getelementptr inbounds %struct.hw, ptr %left, i64 0, i32 1
%b1 = getelementptr inbounds %struct.hw, ptr %right, i64 0, i32 1
%0 = load i32, ptr %b, align 4, !tbaa !16
%1 = load i32, ptr %b1, align 4, !tbaa !16
%cmp.i = icmp slt i32 %0, %1
%cmp1.i = icmp sgt i32 %0, %1
%..i = zext i1 %cmp1.i to i32
%retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i
ret i32 %retval.0.i
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @hwABcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %left, align 4, !tbaa !16
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp.i.i = icmp slt i32 %0, %1
%cmp1.i.i = icmp sgt i32 %0, %1
%..i.i = zext i1 %cmp1.i.i to i32
%retval.0.i.i = select i1 %cmp.i.i, i32 -1, i32 %..i.i
%tobool.not = icmp eq i32 %retval.0.i.i, 0
br i1 %tobool.not, label %if.end, label %cleanup
if.end: ; preds = %entry
%b.i = getelementptr inbounds %struct.hw, ptr %left, i64 0, i32 1
%b1.i = getelementptr inbounds %struct.hw, ptr %right, i64 0, i32 1
%2 = load i32, ptr %b.i, align 4, !tbaa !16
%3 = load i32, ptr %b1.i, align 4, !tbaa !16
%cmp.i.i5 = icmp slt i32 %2, %3
%cmp1.i.i6 = icmp sgt i32 %2, %3
%..i.i7 = zext i1 %cmp1.i.i6 to i32
%retval.0.i.i8 = select i1 %cmp.i.i5, i32 -1, i32 %..i.i7
br label %cleanup
cleanup: ; preds = %entry, %if.end
%retval.0 = phi i32 [ %retval.0.i.i8, %if.end ], [ %retval.0.i.i, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @findarr(ptr nocapture noundef readonly %arr, i32 noundef %length, i32 noundef %h, i32 noundef %w) local_unnamed_addr #5 {
entry:
%sub = add nsw i32 %length, -1
%cmp90 = icmp sgt i32 %length, 1
br i1 %cmp90, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%minok.092 = phi i32 [ %minok.0.div, %while.body ], [ %sub, %entry ]
%minng.091 = phi i32 [ %div.minng.0, %while.body ], [ -1, %entry ]
%add1 = add nsw i32 %minok.092, %minng.091
%div = sdiv i32 %add1, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds %struct.hw, ptr %arr, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !18
%cmp2.not = icmp sgt i32 %0, %h
%div.minng.0 = select i1 %cmp2.not, i32 %div, i32 %minng.091
%minok.0.div = select i1 %cmp2.not, i32 %minok.092, i32 %div
%add = add nsw i32 %div.minng.0, 1
%cmp = icmp slt i32 %add, %minok.0.div
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !20
while.end: ; preds = %while.body, %entry
%minok.0.lcssa = phi i32 [ %sub, %entry ], [ %minok.0.div, %while.body ]
%idxprom3 = sext i32 %minok.0.lcssa to i64
%arrayidx4 = getelementptr inbounds %struct.hw, ptr %arr, i64 %idxprom3
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !18
%cmp6.not = icmp eq i32 %1, %h
br i1 %cmp6.not, label %while.cond9.preheader, label %cleanup54
while.cond9.preheader: ; preds = %while.end
%add1093 = add nsw i32 %minok.0.lcssa, 1
%cmp1194 = icmp slt i32 %add1093, %length
br i1 %cmp1194, label %while.body12, label %while.end45
while.cond25.preheader: ; preds = %while.body12
%cmp27101 = icmp slt i32 %minok.0.lcssa, %maxok.0.div15
br i1 %cmp27101, label %while.body28.lr.ph, label %while.end45
while.body28.lr.ph: ; preds = %while.cond25.preheader
%add30 = add nsw i32 %div15.maxng.0, %maxok.0.div15
%div31 = sdiv i32 %add30, 2
%idxprom32 = sext i32 %div31 to i64
%b = getelementptr inbounds %struct.hw, ptr %arr, i64 %idxprom32, i32 1
%2 = load i32, ptr %b, align 4, !tbaa !21
%cmp34 = icmp slt i32 %2, %w
br i1 %cmp34, label %while.body28.lr.ph.split.us, label %while.body28.lr.ph.split
while.body28.lr.ph.split.us: ; preds = %while.body28.lr.ph
%cmp27.us = icmp slt i32 %div31, %maxok.0.div15
br i1 %cmp27.us, label %while.body28.us, label %while.body28.lr.ph.split.us.while.end45_crit_edge, !llvm.loop !22
while.body28.lr.ph.split.us.while.end45_crit_edge: ; preds = %while.body28.lr.ph.split.us
%arrayidx47.phi.trans.insert = getelementptr inbounds %struct.hw, ptr %arr, i64 %idxprom32
%.pre = load i32, ptr %arrayidx47.phi.trans.insert, align 4, !tbaa !18
br label %while.end45
while.body28.us: ; preds = %while.body28.lr.ph.split.us, %while.body28.us
br label %while.body28.us
while.body28.lr.ph.split: ; preds = %while.body28.lr.ph
%cmp40 = icmp sgt i32 %2, %w
br i1 %cmp40, label %while.body28.lr.ph.split.split, label %cleanup54
while.body28.lr.ph.split.split: ; preds = %while.body28.lr.ph.split
%cmp27 = icmp slt i32 %add1093, %div31
br i1 %cmp27, label %while.body28, label %while.end45, !llvm.loop !22
while.body12: ; preds = %while.cond9.preheader, %while.body12
%maxng.096 = phi i32 [ %div15.maxng.0, %while.body12 ], [ %length, %while.cond9.preheader ]
%maxok.095 = phi i32 [ %maxok.0.div15, %while.body12 ], [ %minok.0.lcssa, %while.cond9.preheader ]
%add14 = add nsw i32 %maxng.096, %maxok.095
%div15 = sdiv i32 %add14, 2
%idxprom16 = sext i32 %div15 to i64
%arrayidx17 = getelementptr inbounds %struct.hw, ptr %arr, i64 %idxprom16
%3 = load i32, ptr %arrayidx17, align 4, !tbaa !18
%cmp19.not = icmp sgt i32 %3, %h
%maxok.0.div15 = select i1 %cmp19.not, i32 %maxok.095, i32 %div15
%div15.maxng.0 = select i1 %cmp19.not, i32 %div15, i32 %maxng.096
%add10 = add nsw i32 %maxok.0.div15, 1
%cmp11 = icmp slt i32 %add10, %div15.maxng.0
br i1 %cmp11, label %while.body12, label %while.cond25.preheader, !llvm.loop !23
while.body28: ; preds = %while.body28.lr.ph.split.split, %while.body28
br label %while.body28
while.end45: ; preds = %while.cond9.preheader, %while.body28.lr.ph.split.us.while.end45_crit_edge, %while.body28.lr.ph.split.split, %while.cond25.preheader
%4 = phi i32 [ %.pre, %while.body28.lr.ph.split.us.while.end45_crit_edge ], [ %h, %while.body28.lr.ph.split.split ], [ %h, %while.cond25.preheader ], [ %h, %while.cond9.preheader ]
%cmp49.not = icmp eq i32 %4, %w
%. = zext i1 %cmp49.not to i32
br label %cleanup54
cleanup54: ; preds = %while.body28.lr.ph.split, %while.end45, %while.end
%retval.3 = phi i32 [ 0, %while.end ], [ %., %while.end45 ], [ 1, %while.body28.lr.ph.split ]
ret i32 %retval.3
}
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @solve() local_unnamed_addr #6 {
entry:
%0 = load i64, ptr @n, align 8, !tbaa !5
%cmp45.not = icmp eq i64 %0, 0
br i1 %cmp45.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %0, 4
br i1 %min.iters.check, label %for.body.preheader84, 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 ], [ %9, %vector.body ]
%vec.phi78 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%vec.phi79 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %5, %vector.body ]
%vec.phi80 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%1 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %index
%wide.load = load <2 x i64>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i64, ptr %1, i64 2
%wide.load81 = load <2 x i64>, ptr %2, align 16, !tbaa !5
%3 = and <2 x i64> %wide.load, <i64 1, i64 1>
%4 = and <2 x i64> %wide.load81, <i64 1, i64 1>
%5 = add <2 x i64> %3, %vec.phi79
%6 = add <2 x i64> %4, %vec.phi80
%7 = xor <2 x i64> %3, <i64 1, i64 1>
%8 = xor <2 x i64> %4, <i64 1, i64 1>
%9 = add <2 x i64> %7, %vec.phi
%10 = add <2 x i64> %8, %vec.phi78
%index.next = add nuw i64 %index, 4
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !24
middle.block: ; preds = %vector.body
%bin.rdx82 = add <2 x i64> %6, %5
%12 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx82)
%bin.rdx = add <2 x i64> %10, %9
%13 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %0, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader84
for.body.preheader84: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%even.048.ph = phi i64 [ 0, %for.body.preheader ], [ %13, %middle.block ]
%odd.047.ph = phi i64 [ 0, %for.body.preheader ], [ %12, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader84, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader84 ]
%even.048 = phi i64 [ %even.1, %for.body ], [ %even.048.ph, %for.body.preheader84 ]
%odd.047 = phi i64 [ %odd.1, %for.body ], [ %odd.047.ph, %for.body.preheader84 ]
%arrayidx = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv
%14 = load i64, ptr %arrayidx, align 8, !tbaa !5
%and = and i64 %14, 1
%odd.1 = add i64 %and, %odd.047
%15 = xor i64 %and, 1
%even.1 = add i64 %15, %even.048
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !27
for.end: ; preds = %for.body, %middle.block, %entry
%odd.0.lcssa = phi i64 [ 0, %entry ], [ %12, %middle.block ], [ %odd.1, %for.body ]
%even.0.lcssa = phi i64 [ 0, %entry ], [ %13, %middle.block ], [ %even.1, %for.body ]
%16 = load i64, ptr @k, align 8, !tbaa !5
%sext = shl i64 %16, 32
%conv656 = ashr exact i64 %sext, 32
%cmp7.not57 = icmp ult i64 %odd.0.lcssa, %conv656
br i1 %cmp7.not57, label %for.cond19.preheader, label %while.cond.preheader.lr.ph
while.cond.preheader.lr.ph: ; preds = %for.end
%add = add i64 %odd.0.lcssa, 1
%17 = add nsw i64 %conv656, -1
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.cond.preheader.lr.ph, %while.end
%indvar = phi i64 [ 0, %while.cond.preheader.lr.ph ], [ %indvar.next, %while.end ]
%indvars.iv71 = phi i64 [ %conv656, %while.cond.preheader.lr.ph ], [ %indvars.iv.next72, %while.end ]
%conbination.061 = phi i64 [ 1, %while.cond.preheader.lr.ph ], [ %conbination.1.lcssa, %while.end ]
%result.060 = phi i64 [ 0, %while.cond.preheader.lr.ph ], [ %add15, %while.end ]
%j.059 = phi i32 [ 0, %while.cond.preheader.lr.ph ], [ %j.1.lcssa, %while.end ]
%18 = sext i32 %j.059 to i64
%cmp1051 = icmp sgt i64 %indvars.iv71, %18
br i1 %cmp1051, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %while.cond.preheader
%19 = shl i64 %indvar, 1
%20 = add i64 %17, %19
%21 = sub i64 %indvars.iv71, %18
%xtraiter = and i64 %21, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.body.prol.loopexit, label %while.body.prol
while.body.prol: ; preds = %while.body.preheader
%indvars.iv.next69.prol = add nsw i64 %18, 1
%sub.prol = sub i64 %add, %indvars.iv.next69.prol
%mul.prol = mul i64 %sub.prol, %conbination.061
%div.prol = udiv i64 %mul.prol, %indvars.iv.next69.prol
br label %while.body.prol.loopexit
while.body.prol.loopexit: ; preds = %while.body.prol, %while.body.preheader
%indvars.iv68.unr = phi i64 [ %18, %while.body.preheader ], [ %indvars.iv.next69.prol, %while.body.prol ]
%conbination.153.unr = phi i64 [ %conbination.061, %while.body.preheader ], [ %div.prol, %while.body.prol ]
%indvars.iv.next69.lcssa.unr = phi i64 [ undef, %while.body.preheader ], [ %indvars.iv.next69.prol, %while.body.prol ]
%div.lcssa.unr = phi i64 [ undef, %while.body.preheader ], [ %div.prol, %while.body.prol ]
%22 = icmp eq i64 %20, %18
br i1 %22, label %while.end.loopexit, label %while.body
for.cond19.preheader: ; preds = %while.end, %for.end
%result.0.lcssa = phi i64 [ 0, %for.end ], [ %add15, %while.end ]
%cmp2163.not = icmp eq i64 %even.0.lcssa, 0
br i1 %cmp2163.not, label %for.end27, label %for.body23.preheader
for.body23.preheader: ; preds = %for.cond19.preheader
%xtraiter88 = and i64 %even.0.lcssa, 7
%23 = icmp ult i64 %even.0.lcssa, 8
br i1 %23, label %for.end27.loopexit.unr-lcssa, label %for.body23.preheader.new
for.body23.preheader.new: ; preds = %for.body23.preheader
%unroll_iter = and i64 %even.0.lcssa, -8
br label %for.body23
while.body: ; preds = %while.body.prol.loopexit, %while.body
%indvars.iv68 = phi i64 [ %indvars.iv.next69.1, %while.body ], [ %indvars.iv68.unr, %while.body.prol.loopexit ]
%conbination.153 = phi i64 [ %div.1, %while.body ], [ %conbination.153.unr, %while.body.prol.loopexit ]
%indvars.iv.next69 = add nsw i64 %indvars.iv68, 1
%sub = sub i64 %add, %indvars.iv.next69
%mul = mul i64 %sub, %conbination.153
%div = udiv i64 %mul, %indvars.iv.next69
%indvars.iv.next69.1 = add nsw i64 %indvars.iv68, 2
%sub.1 = sub i64 %add, %indvars.iv.next69.1
%mul.1 = mul i64 %sub.1, %div
%div.1 = udiv i64 %mul.1, %indvars.iv.next69.1
%cmp10.1 = icmp slt i64 %indvars.iv.next69.1, %indvars.iv71
br i1 %cmp10.1, label %while.body, label %while.end.loopexit, !llvm.loop !28
while.end.loopexit: ; preds = %while.body, %while.body.prol.loopexit
%indvars.iv.next69.lcssa = phi i64 [ %indvars.iv.next69.lcssa.unr, %while.body.prol.loopexit ], [ %indvars.iv.next69.1, %while.body ]
%div.lcssa = phi i64 [ %div.lcssa.unr, %while.body.prol.loopexit ], [ %div.1, %while.body ]
%24 = trunc i64 %indvars.iv.next69.lcssa to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %while.cond.preheader
%j.1.lcssa = phi i32 [ %j.059, %while.cond.preheader ], [ %24, %while.end.loopexit ]
%conbination.1.lcssa = phi i64 [ %conbination.061, %while.cond.preheader ], [ %div.lcssa, %while.end.loopexit ]
%add15 = add i64 %conbination.1.lcssa, %result.060
%indvars.iv.next72 = add i64 %indvars.iv71, 2
%cmp7.not = icmp ult i64 %odd.0.lcssa, %indvars.iv.next72
%indvar.next = add i64 %indvar, 1
br i1 %cmp7.not, label %for.cond19.preheader, label %while.cond.preheader, !llvm.loop !29
for.body23: ; preds = %for.body23, %for.body23.preheader.new
%result.165 = phi i64 [ %result.0.lcssa, %for.body23.preheader.new ], [ %mul24, %for.body23 ]
%niter = phi i64 [ 0, %for.body23.preheader.new ], [ %niter.next.7, %for.body23 ]
%mul24 = shl i64 %result.165, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end27.loopexit.unr-lcssa, label %for.body23, !llvm.loop !30
for.end27.loopexit.unr-lcssa: ; preds = %for.body23, %for.body23.preheader
%mul24.lcssa.ph = phi i64 [ undef, %for.body23.preheader ], [ %mul24, %for.body23 ]
%result.165.unr = phi i64 [ %result.0.lcssa, %for.body23.preheader ], [ %mul24, %for.body23 ]
%lcmp.mod89.not = icmp eq i64 %xtraiter88, 0
br i1 %lcmp.mod89.not, label %for.end27, label %for.body23.epil
for.body23.epil: ; preds = %for.end27.loopexit.unr-lcssa, %for.body23.epil
%result.165.epil = phi i64 [ %mul24.epil, %for.body23.epil ], [ %result.165.unr, %for.end27.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body23.epil ], [ 0, %for.end27.loopexit.unr-lcssa ]
%mul24.epil = shl i64 %result.165.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter88
br i1 %epil.iter.cmp.not, label %for.end27, label %for.body23.epil, !llvm.loop !31
for.end27: ; preds = %for.end27.loopexit.unr-lcssa, %for.body23.epil, %for.cond19.preheader
%result.1.lcssa = phi i64 [ %result.0.lcssa, %for.cond19.preheader ], [ %mul24.lcssa.ph, %for.end27.loopexit.unr-lcssa ], [ %mul24.epil, %for.body23.epil ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %result.1.lcssa)
ret i64 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #6 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @k)
%0 = load i64, ptr @n, align 8, !tbaa !5
%cmp6.not = icmp eq i64 %0, 0
br i1 %cmp6.not, label %for.end.i, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%1 = load i64, ptr @n, align 8, !tbaa !5
%cmp = icmp ugt i64 %1, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !32
for.end: ; preds = %for.body
%cmp45.not.i = icmp eq i64 %1, 0
br i1 %cmp45.not.i, label %for.end.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.end
%min.iters.check = icmp ult i64 %1, 4
br i1 %min.iters.check, label %for.body.i.preheader19, label %vector.ph
vector.ph: ; preds = %for.body.i.preheader
%n.vec = and i64 %1, -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 ], [ %10, %vector.body ]
%vec.phi13 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%vec.phi14 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%vec.phi15 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%2 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %index
%wide.load = load <2 x i64>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i64, ptr %2, i64 2
%wide.load16 = load <2 x i64>, ptr %3, align 16, !tbaa !5
%4 = and <2 x i64> %wide.load, <i64 1, i64 1>
%5 = and <2 x i64> %wide.load16, <i64 1, i64 1>
%6 = add <2 x i64> %4, %vec.phi14
%7 = add <2 x i64> %5, %vec.phi15
%8 = xor <2 x i64> %4, <i64 1, i64 1>
%9 = xor <2 x i64> %5, <i64 1, i64 1>
%10 = add <2 x i64> %8, %vec.phi
%11 = add <2 x i64> %9, %vec.phi13
%index.next = add nuw i64 %index, 4
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !33
middle.block: ; preds = %vector.body
%bin.rdx17 = add <2 x i64> %7, %6
%13 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx17)
%bin.rdx = add <2 x i64> %11, %10
%14 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %1, %n.vec
br i1 %cmp.n, label %for.end.i, label %for.body.i.preheader19
for.body.i.preheader19: ; preds = %for.body.i.preheader, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %for.body.i.preheader ], [ %n.vec, %middle.block ]
%even.048.i.ph = phi i64 [ 0, %for.body.i.preheader ], [ %14, %middle.block ]
%odd.047.i.ph = phi i64 [ 0, %for.body.i.preheader ], [ %13, %middle.block ]
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader19, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader19 ]
%even.048.i = phi i64 [ %even.1.i, %for.body.i ], [ %even.048.i.ph, %for.body.i.preheader19 ]
%odd.047.i = phi i64 [ %odd.1.i, %for.body.i ], [ %odd.047.i.ph, %for.body.i.preheader19 ]
%arrayidx.i = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv.i
%15 = load i64, ptr %arrayidx.i, align 8, !tbaa !5
%and.i = and i64 %15, 1
%odd.1.i = add i64 %and.i, %odd.047.i
%16 = xor i64 %and.i, 1
%even.1.i = add i64 %16, %even.048.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %1
br i1 %exitcond.not.i, label %for.end.i, label %for.body.i, !llvm.loop !34
for.end.i: ; preds = %for.body.i, %middle.block, %entry, %for.end
%odd.0.lcssa.i = phi i64 [ 0, %for.end ], [ 0, %entry ], [ %13, %middle.block ], [ %odd.1.i, %for.body.i ]
%even.0.lcssa.i = phi i64 [ 0, %for.end ], [ 0, %entry ], [ %14, %middle.block ], [ %even.1.i, %for.body.i ]
%17 = load i64, ptr @k, align 8, !tbaa !5
%sext.i = shl i64 %17, 32
%conv656.i = ashr exact i64 %sext.i, 32
%cmp7.not57.i = icmp ult i64 %odd.0.lcssa.i, %conv656.i
br i1 %cmp7.not57.i, label %for.cond19.preheader.i, label %while.cond.preheader.i.preheader
while.cond.preheader.i.preheader: ; preds = %for.end.i
%18 = add nsw i64 %conv656.i, -1
br label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %while.cond.preheader.i.preheader, %while.end.i
%indvar = phi i64 [ 0, %while.cond.preheader.i.preheader ], [ %indvar.next, %while.end.i ]
%indvars.iv71.i = phi i64 [ %conv656.i, %while.cond.preheader.i.preheader ], [ %indvars.iv.next72.i, %while.end.i ]
%conbination.061.i = phi i64 [ 1, %while.cond.preheader.i.preheader ], [ %conbination.1.lcssa.i, %while.end.i ]
%result.060.i = phi i64 [ 0, %while.cond.preheader.i.preheader ], [ %add15.i, %while.end.i ]
%j.059.i = phi i32 [ 0, %while.cond.preheader.i.preheader ], [ %j.1.lcssa.i, %while.end.i ]
%19 = sext i32 %j.059.i to i64
%cmp1051.i = icmp sgt i64 %indvars.iv71.i, %19
br i1 %cmp1051.i, label %while.body.i.preheader, label %while.end.i
while.body.i.preheader: ; preds = %while.cond.preheader.i
%20 = shl i64 %indvar, 1
%21 = add i64 %18, %20
%22 = sub i64 %indvars.iv71.i, %19
%xtraiter = and i64 %22, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.body.i.prol.loopexit, label %while.body.i.prol
while.body.i.prol: ; preds = %while.body.i.preheader
%indvars.iv.next69.i.prol = add nsw i64 %19, 1
%sub.i.prol = sub i64 %odd.0.lcssa.i, %19
%mul.i.prol = mul i64 %sub.i.prol, %conbination.061.i
%div.i.prol = udiv i64 %mul.i.prol, %indvars.iv.next69.i.prol
br label %while.body.i.prol.loopexit
while.body.i.prol.loopexit: ; preds = %while.body.i.prol, %while.body.i.preheader
%indvars.iv68.i.unr = phi i64 [ %19, %while.body.i.preheader ], [ %indvars.iv.next69.i.prol, %while.body.i.prol ]
%conbination.153.i.unr = phi i64 [ %conbination.061.i, %while.body.i.preheader ], [ %div.i.prol, %while.body.i.prol ]
%div.i.lcssa.unr = phi i64 [ undef, %while.body.i.preheader ], [ %div.i.prol, %while.body.i.prol ]
%23 = icmp eq i64 %21, %19
br i1 %23, label %while.end.loopexit.i, label %while.body.i
for.cond19.preheader.i: ; preds = %while.end.i, %for.end.i
%result.0.lcssa.i = phi i64 [ 0, %for.end.i ], [ %add15.i, %while.end.i ]
%cmp2163.not.i = icmp eq i64 %even.0.lcssa.i, 0
br i1 %cmp2163.not.i, label %solve.exit, label %for.body23.i.preheader
for.body23.i.preheader: ; preds = %for.cond19.preheader.i
%xtraiter24 = and i64 %even.0.lcssa.i, 7
%24 = icmp ult i64 %even.0.lcssa.i, 8
br i1 %24, label %solve.exit.loopexit.unr-lcssa, label %for.body23.i.preheader.new
for.body23.i.preheader.new: ; preds = %for.body23.i.preheader
%unroll_iter = and i64 %even.0.lcssa.i, -8
br label %for.body23.i
while.body.i: ; preds = %while.body.i.prol.loopexit, %while.body.i
%indvars.iv68.i = phi i64 [ %indvars.iv.next69.i.1, %while.body.i ], [ %indvars.iv68.i.unr, %while.body.i.prol.loopexit ]
%conbination.153.i = phi i64 [ %div.i.1, %while.body.i ], [ %conbination.153.i.unr, %while.body.i.prol.loopexit ]
%indvars.iv.next69.i = add nsw i64 %indvars.iv68.i, 1
%sub.i = sub i64 %odd.0.lcssa.i, %indvars.iv68.i
%mul.i = mul i64 %sub.i, %conbination.153.i
%div.i = udiv i64 %mul.i, %indvars.iv.next69.i
%indvars.iv.next69.i.1 = add nsw i64 %indvars.iv68.i, 2
%sub.i.1 = sub i64 %odd.0.lcssa.i, %indvars.iv.next69.i
%mul.i.1 = mul i64 %sub.i.1, %div.i
%div.i.1 = udiv i64 %mul.i.1, %indvars.iv.next69.i.1
%cmp10.i.1 = icmp slt i64 %indvars.iv.next69.i.1, %indvars.iv71.i
br i1 %cmp10.i.1, label %while.body.i, label %while.end.loopexit.i, !llvm.loop !28
while.end.loopexit.i: ; preds = %while.body.i, %while.body.i.prol.loopexit
%div.i.lcssa = phi i64 [ %div.i.lcssa.unr, %while.body.i.prol.loopexit ], [ %div.i.1, %while.body.i ]
%25 = trunc i64 %indvars.iv71.i to i32
br label %while.end.i
while.end.i: ; preds = %while.end.loopexit.i, %while.cond.preheader.i
%j.1.lcssa.i = phi i32 [ %j.059.i, %while.cond.preheader.i ], [ %25, %while.end.loopexit.i ]
%conbination.1.lcssa.i = phi i64 [ %conbination.061.i, %while.cond.preheader.i ], [ %div.i.lcssa, %while.end.loopexit.i ]
%add15.i = add i64 %conbination.1.lcssa.i, %result.060.i
%indvars.iv.next72.i = add i64 %indvars.iv71.i, 2
%cmp7.not.i = icmp ult i64 %odd.0.lcssa.i, %indvars.iv.next72.i
%indvar.next = add i64 %indvar, 1
br i1 %cmp7.not.i, label %for.cond19.preheader.i, label %while.cond.preheader.i, !llvm.loop !29
for.body23.i: ; preds = %for.body23.i, %for.body23.i.preheader.new
%result.165.i = phi i64 [ %result.0.lcssa.i, %for.body23.i.preheader.new ], [ %mul24.i, %for.body23.i ]
%niter = phi i64 [ 0, %for.body23.i.preheader.new ], [ %niter.next.7, %for.body23.i ]
%mul24.i = shl i64 %result.165.i, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %solve.exit.loopexit.unr-lcssa, label %for.body23.i, !llvm.loop !30
solve.exit.loopexit.unr-lcssa: ; preds = %for.body23.i, %for.body23.i.preheader
%mul24.i.lcssa.ph = phi i64 [ undef, %for.body23.i.preheader ], [ %mul24.i, %for.body23.i ]
%result.165.i.unr = phi i64 [ %result.0.lcssa.i, %for.body23.i.preheader ], [ %mul24.i, %for.body23.i ]
%lcmp.mod25.not = icmp eq i64 %xtraiter24, 0
br i1 %lcmp.mod25.not, label %solve.exit, label %for.body23.i.epil
for.body23.i.epil: ; preds = %solve.exit.loopexit.unr-lcssa, %for.body23.i.epil
%result.165.i.epil = phi i64 [ %mul24.i.epil, %for.body23.i.epil ], [ %result.165.i.unr, %solve.exit.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body23.i.epil ], [ 0, %solve.exit.loopexit.unr-lcssa ]
%mul24.i.epil = shl i64 %result.165.i.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter24
br i1 %epil.iter.cmp.not, label %solve.exit, label %for.body23.i.epil, !llvm.loop !35
solve.exit: ; preds = %solve.exit.loopexit.unr-lcssa, %for.body23.i.epil, %for.cond19.preheader.i
%result.1.lcssa.i = phi i64 [ %result.0.lcssa.i, %for.cond19.preheader.i ], [ %mul24.i.lcssa.ph, %solve.exit.loopexit.unr-lcssa ], [ %mul24.i.epil, %for.body23.i.epil ]
%call.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %result.1.lcssa.i)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #8
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 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 = { 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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { 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 #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 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 #8 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!19, !17, i64 0}
!19 = !{!"", !17, i64 0, !17, i64 4}
!20 = distinct !{!20, !10}
!21 = !{!19, !17, i64 4}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10, !25, !26}
!25 = !{!"llvm.loop.isvectorized", i32 1}
!26 = !{!"llvm.loop.unroll.runtime.disable"}
!27 = distinct !{!27, !10, !26, !25}
!28 = distinct !{!28, !10}
!29 = distinct !{!29, !10}
!30 = distinct !{!30, !10}
!31 = distinct !{!31, !14}
!32 = distinct !{!32, !10}
!33 = distinct !{!33, !10, !25, !26}
!34 = distinct !{!34, !10, !26, !25}
!35 = distinct !{!35, !14}
|
#include <stdio.h>
int main(void)
{
int n=0;
int d[51]={};
long sum=0;
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%d",&d[i]);
for(int i=1;i<n;i++){
for(int j=0;j<i;j++){
sum+=d[i]*d[j];
}
}
printf("%ld",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101674/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101674/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
%d = alloca [51 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
store i32 0, ptr %n, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 204, ptr nonnull %d) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(204) %d, i8 0, i64 204, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %0, 0
br i1 %cmp30, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp434 = icmp sgt i32 %1, 1
br i1 %cmp434, label %for.cond7.preheader.preheader, label %for.cond.cleanup5
for.cond7.preheader.preheader: ; preds = %for.cond3.preheader
%wide.trip.count46 = zext i32 %1 to i64
br label %for.cond7.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [51 x i32], ptr %d, 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.cond3.preheader, !llvm.loop !9
for.cond7.preheader: ; preds = %for.cond7.preheader.preheader, %for.cond.cleanup9
%indvar = phi i64 [ 0, %for.cond7.preheader.preheader ], [ %indvar.next, %for.cond.cleanup9 ]
%indvars.iv43 = phi i64 [ 1, %for.cond7.preheader.preheader ], [ %indvars.iv.next44, %for.cond.cleanup9 ]
%sum.035 = phi i64 [ 0, %for.cond7.preheader.preheader ], [ %add.lcssa, %for.cond.cleanup9 ]
%arrayidx12 = getelementptr inbounds [51 x i32], ptr %d, i64 0, i64 %indvars.iv43
%3 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%xtraiter = and i64 %indvars.iv43, 3
%4 = icmp ult i64 %indvar, 3
br i1 %4, label %for.cond.cleanup9.unr-lcssa, label %for.cond7.preheader.new
for.cond7.preheader.new: ; preds = %for.cond7.preheader
%unroll_iter = and i64 %indvars.iv43, 9223372036854775804
br label %for.body10
for.cond.cleanup5: ; preds = %for.cond.cleanup9, %entry, %for.cond3.preheader
%sum.0.lcssa = phi i64 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %add.lcssa, %for.cond.cleanup9 ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 204, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.cond.cleanup9.unr-lcssa: ; preds = %for.body10, %for.cond7.preheader
%add.lcssa.ph = phi i64 [ undef, %for.cond7.preheader ], [ %add.3, %for.body10 ]
%indvars.iv40.unr = phi i64 [ 0, %for.cond7.preheader ], [ %indvars.iv.next41.3, %for.body10 ]
%sum.132.unr = phi i64 [ %sum.035, %for.cond7.preheader ], [ %add.3, %for.body10 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup9, label %for.body10.epil
for.body10.epil: ; preds = %for.cond.cleanup9.unr-lcssa, %for.body10.epil
%indvars.iv40.epil = phi i64 [ %indvars.iv.next41.epil, %for.body10.epil ], [ %indvars.iv40.unr, %for.cond.cleanup9.unr-lcssa ]
%sum.132.epil = phi i64 [ %add.epil, %for.body10.epil ], [ %sum.132.unr, %for.cond.cleanup9.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body10.epil ], [ 0, %for.cond.cleanup9.unr-lcssa ]
%arrayidx14.epil = getelementptr inbounds [51 x i32], ptr %d, i64 0, i64 %indvars.iv40.epil
%5 = load i32, ptr %arrayidx14.epil, align 4, !tbaa !5
%mul.epil = mul nsw i32 %5, %3
%conv.epil = sext i32 %mul.epil to i64
%add.epil = add nsw i64 %sum.132.epil, %conv.epil
%indvars.iv.next41.epil = add nuw nsw i64 %indvars.iv40.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup9, label %for.body10.epil, !llvm.loop !11
for.cond.cleanup9: ; preds = %for.body10.epil, %for.cond.cleanup9.unr-lcssa
%add.lcssa = phi i64 [ %add.lcssa.ph, %for.cond.cleanup9.unr-lcssa ], [ %add.epil, %for.body10.epil ]
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond47.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count46
%indvar.next = add i64 %indvar, 1
br i1 %exitcond47.not, label %for.cond.cleanup5, label %for.cond7.preheader, !llvm.loop !13
for.body10: ; preds = %for.body10, %for.cond7.preheader.new
%indvars.iv40 = phi i64 [ 0, %for.cond7.preheader.new ], [ %indvars.iv.next41.3, %for.body10 ]
%sum.132 = phi i64 [ %sum.035, %for.cond7.preheader.new ], [ %add.3, %for.body10 ]
%niter = phi i64 [ 0, %for.cond7.preheader.new ], [ %niter.next.3, %for.body10 ]
%arrayidx14 = getelementptr inbounds [51 x i32], ptr %d, i64 0, i64 %indvars.iv40
%6 = load i32, ptr %arrayidx14, align 16, !tbaa !5
%mul = mul nsw i32 %6, %3
%conv = sext i32 %mul to i64
%add = add nsw i64 %sum.132, %conv
%indvars.iv.next41 = or i64 %indvars.iv40, 1
%arrayidx14.1 = getelementptr inbounds [51 x i32], ptr %d, i64 0, i64 %indvars.iv.next41
%7 = load i32, ptr %arrayidx14.1, align 4, !tbaa !5
%mul.1 = mul nsw i32 %7, %3
%conv.1 = sext i32 %mul.1 to i64
%add.1 = add nsw i64 %add, %conv.1
%indvars.iv.next41.1 = or i64 %indvars.iv40, 2
%arrayidx14.2 = getelementptr inbounds [51 x i32], ptr %d, i64 0, i64 %indvars.iv.next41.1
%8 = load i32, ptr %arrayidx14.2, align 8, !tbaa !5
%mul.2 = mul nsw i32 %8, %3
%conv.2 = sext i32 %mul.2 to i64
%add.2 = add nsw i64 %add.1, %conv.2
%indvars.iv.next41.2 = or i64 %indvars.iv40, 3
%arrayidx14.3 = getelementptr inbounds [51 x i32], ptr %d, i64 0, i64 %indvars.iv.next41.2
%9 = load i32, ptr %arrayidx14.3, align 4, !tbaa !5
%mul.3 = mul nsw i32 %9, %3
%conv.3 = sext i32 %mul.3 to i64
%add.3 = add nsw i64 %add.2, %conv.3
%indvars.iv.next41.3 = add nuw nsw i64 %indvars.iv40, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond.cleanup9.unr-lcssa, label %for.body10, !llvm.loop !14
}
; 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 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 #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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main()
{
int a,i,j;
long int b;
scanf("%d",&a);
b=0;
int c[a];
for(i=0;i<a;++i)
{scanf("%d",&c[i]);
}
for(i=1;i<a;++i)
{
for(j=0;j<i;++j)
{b=b+c[i]*c[j];}
}
printf("%ld",b);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101717/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101717/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:
%a = alloca i32, align 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 %a)
%0 = load i32, ptr %a, 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 %a, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %3, 0
br i1 %cmp28, label %for.body, label %for.end17
for.cond2.preheader: ; preds = %for.body
%cmp332 = icmp sgt i32 %4, 1
br i1 %cmp332, label %for.cond5.preheader.preheader, label %for.end17
for.cond5.preheader.preheader: ; preds = %for.cond2.preheader
%wide.trip.count44 = zext i32 %4 to i64
br label %for.cond5.preheader
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 %a, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond5.preheader.preheader, %for.inc15
%indvar = phi i64 [ 0, %for.cond5.preheader.preheader ], [ %indvar.next, %for.inc15 ]
%indvars.iv41 = phi i64 [ 1, %for.cond5.preheader.preheader ], [ %indvars.iv.next42, %for.inc15 ]
%b.033 = phi i64 [ 0, %for.cond5.preheader.preheader ], [ %add.lcssa, %for.inc15 ]
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv41
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%xtraiter = and i64 %indvars.iv41, 3
%7 = icmp ult i64 %indvar, 3
br i1 %7, label %for.inc15.unr-lcssa, label %for.cond5.preheader.new
for.cond5.preheader.new: ; preds = %for.cond5.preheader
%unroll_iter = and i64 %indvars.iv41, 9223372036854775804
br label %for.body7
for.body7: ; preds = %for.body7, %for.cond5.preheader.new
%indvars.iv38 = phi i64 [ 0, %for.cond5.preheader.new ], [ %indvars.iv.next39.3, %for.body7 ]
%b.131 = phi i64 [ %b.033, %for.cond5.preheader.new ], [ %add.3, %for.body7 ]
%niter = phi i64 [ 0, %for.cond5.preheader.new ], [ %niter.next.3, %for.body7 ]
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv38
%8 = load i32, ptr %arrayidx11, align 16, !tbaa !5
%mul = mul nsw i32 %8, %6
%conv = sext i32 %mul to i64
%add = add nsw i64 %b.131, %conv
%indvars.iv.next39 = or i64 %indvars.iv38, 1
%arrayidx11.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next39
%9 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5
%mul.1 = mul nsw i32 %9, %6
%conv.1 = sext i32 %mul.1 to i64
%add.1 = add nsw i64 %add, %conv.1
%indvars.iv.next39.1 = or i64 %indvars.iv38, 2
%arrayidx11.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next39.1
%10 = load i32, ptr %arrayidx11.2, align 8, !tbaa !5
%mul.2 = mul nsw i32 %10, %6
%conv.2 = sext i32 %mul.2 to i64
%add.2 = add nsw i64 %add.1, %conv.2
%indvars.iv.next39.2 = or i64 %indvars.iv38, 3
%arrayidx11.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next39.2
%11 = load i32, ptr %arrayidx11.3, align 4, !tbaa !5
%mul.3 = mul nsw i32 %11, %6
%conv.3 = sext i32 %mul.3 to i64
%add.3 = add nsw i64 %add.2, %conv.3
%indvars.iv.next39.3 = add nuw nsw i64 %indvars.iv38, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.inc15.unr-lcssa, label %for.body7, !llvm.loop !11
for.inc15.unr-lcssa: ; preds = %for.body7, %for.cond5.preheader
%add.lcssa.ph = phi i64 [ undef, %for.cond5.preheader ], [ %add.3, %for.body7 ]
%indvars.iv38.unr = phi i64 [ 0, %for.cond5.preheader ], [ %indvars.iv.next39.3, %for.body7 ]
%b.131.unr = phi i64 [ %b.033, %for.cond5.preheader ], [ %add.3, %for.body7 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc15, label %for.body7.epil
for.body7.epil: ; preds = %for.inc15.unr-lcssa, %for.body7.epil
%indvars.iv38.epil = phi i64 [ %indvars.iv.next39.epil, %for.body7.epil ], [ %indvars.iv38.unr, %for.inc15.unr-lcssa ]
%b.131.epil = phi i64 [ %add.epil, %for.body7.epil ], [ %b.131.unr, %for.inc15.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body7.epil ], [ 0, %for.inc15.unr-lcssa ]
%arrayidx11.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv38.epil
%12 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5
%mul.epil = mul nsw i32 %12, %6
%conv.epil = sext i32 %mul.epil to i64
%add.epil = add nsw i64 %b.131.epil, %conv.epil
%indvars.iv.next39.epil = add nuw nsw i64 %indvars.iv38.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.inc15, label %for.body7.epil, !llvm.loop !12
for.inc15: ; preds = %for.body7.epil, %for.inc15.unr-lcssa
%add.lcssa = phi i64 [ %add.lcssa.ph, %for.inc15.unr-lcssa ], [ %add.epil, %for.body7.epil ]
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond45.not = icmp eq i64 %indvars.iv.next42, %wide.trip.count44
%indvar.next = add i64 %indvar, 1
br i1 %exitcond45.not, label %for.end17, label %for.cond5.preheader, !llvm.loop !14
for.end17: ; preds = %for.inc15, %entry, %for.cond2.preheader
%b.0.lcssa = phi i64 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %add.lcssa, %for.inc15 ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %b.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
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
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, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main()
{
// 入力用変数
int N;
int d[50];
// 出力用変数
int point = 0;
// 入力処理
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%d", &d[i]);
}
// 計算
for (int i = 0; i < N-1; i++) {
for (int j = i+1; j < N; j++) {
point += d[i] * d[j];
}
}
// 出力処理
printf("%d\n", point);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101768/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101768/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
%d = alloca [50 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %d) #4
%call = 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.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp437 = icmp sgt i32 %2, 1
br i1 %cmp437, label %for.body6.preheader, label %for.cond.cleanup5
for.body6.preheader: ; preds = %for.cond3.preheader
%sub = add nsw i32 %2, -1
%1 = zext i32 %2 to i64
%wide.trip.count51 = zext i32 %sub to i64
%wide.trip.count = zext i32 %2 to i64
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x i32], ptr %d, 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.cond3.preheader, !llvm.loop !9
for.cond3.loopexit: ; preds = %for.body10, %middle.block, %for.body6
%point.1.lcssa = phi i32 [ %point.038, %for.body6 ], [ %15, %middle.block ], [ %add15, %for.body10 ]
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond52.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count51
br i1 %exitcond52.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !11
for.cond.cleanup5: ; preds = %for.cond3.loopexit, %entry, %for.cond3.preheader
%point.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %point.1.lcssa, %for.cond3.loopexit ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %point.0.lcssa)
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
for.body6: ; preds = %for.body6.preheader, %for.cond3.loopexit
%indvars.iv48 = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next49, %for.cond3.loopexit ]
%indvars.iv43 = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next44, %for.cond3.loopexit ]
%point.038 = phi i32 [ 0, %for.body6.preheader ], [ %point.1.lcssa, %for.cond3.loopexit ]
%4 = xor i64 %indvars.iv48, -1
%5 = add nsw i64 %4, %wide.trip.count
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%cmp833 = icmp ult i64 %indvars.iv.next49, %1
br i1 %cmp833, label %for.body10.lr.ph, label %for.cond3.loopexit
for.body10.lr.ph: ; preds = %for.body6
%arrayidx12 = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv48
%6 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %5, 8
br i1 %min.iters.check, label %for.body10.preheader, label %vector.ph
vector.ph: ; preds = %for.body10.lr.ph
%n.vec = and i64 %5, -8
%ind.end = add i64 %indvars.iv43, %n.vec
%7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %point.038, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %6, 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> [ %7, %vector.ph ], [ %12, %vector.body ]
%vec.phi55 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%offset.idx = add i64 %indvars.iv43, %index
%8 = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load56 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%11 = mul nsw <4 x i32> %wide.load56, %broadcast.splat
%12 = add <4 x i32> %10, %vec.phi
%13 = add <4 x i32> %11, %vec.phi55
%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 !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %13, %12
%15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.cond3.loopexit, label %for.body10.preheader
for.body10.preheader: ; preds = %for.body10.lr.ph, %middle.block
%indvars.iv45.ph = phi i64 [ %indvars.iv43, %for.body10.lr.ph ], [ %ind.end, %middle.block ]
%point.134.ph = phi i32 [ %point.038, %for.body10.lr.ph ], [ %15, %middle.block ]
br label %for.body10
for.body10: ; preds = %for.body10.preheader, %for.body10
%indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.body10 ], [ %indvars.iv45.ph, %for.body10.preheader ]
%point.134 = phi i32 [ %add15, %for.body10 ], [ %point.134.ph, %for.body10.preheader ]
%arrayidx14 = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv45
%16 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%mul = mul nsw i32 %16, %6
%add15 = add nsw i32 %mul, %point.134
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count
br i1 %exitcond.not, label %for.cond3.loopexit, label %for.body10, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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.vector.reduce.add.v4i32(<4 x 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 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include<stdio.h>
int main()
{
int a, c=0;/*たこ焼きの数・美味しさ値総量*/
int b[101];/*たこ焼きの美味しさデータ*/
scanf("%d", &a);
for(int i=0; i<a; i++)
{
scanf("%d", &b[i]);
}
for(int i=0; i<a; i++)
{
for(int j=i+1; j<a; j++)
{
c += b[i]*b[j];
}
}
printf("%d", c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101810/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101810/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:
%a = alloca i32, align 4
%b = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp437 = icmp sgt i32 %2, 0
br i1 %cmp437, label %for.body6.preheader, label %for.cond.cleanup5
for.body6.preheader: ; preds = %for.cond3.preheader
%1 = zext i32 %2 to i64
%wide.trip.count51 = zext i32 %2 to i64
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x i32], ptr %b, 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 %a, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond3.loopexit: ; preds = %for.body10, %middle.block, %for.body6
%c.1.lcssa = phi i32 [ %c.038, %for.body6 ], [ %15, %middle.block ], [ %add15, %for.body10 ]
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond52.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count51
br i1 %exitcond52.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !11
for.cond.cleanup5: ; preds = %for.cond3.loopexit, %entry, %for.cond3.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %c.1.lcssa, %for.cond3.loopexit ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
for.body6: ; preds = %for.body6.preheader, %for.cond3.loopexit
%indvars.iv48 = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next49, %for.cond3.loopexit ]
%indvars.iv43 = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next44, %for.cond3.loopexit ]
%c.038 = phi i32 [ 0, %for.body6.preheader ], [ %c.1.lcssa, %for.cond3.loopexit ]
%4 = xor i64 %indvars.iv48, -1
%5 = add nsw i64 %4, %wide.trip.count51
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%cmp833 = icmp ult i64 %indvars.iv.next49, %1
br i1 %cmp833, label %for.body10.lr.ph, label %for.cond3.loopexit
for.body10.lr.ph: ; preds = %for.body6
%arrayidx12 = getelementptr inbounds [101 x i32], ptr %b, i64 0, i64 %indvars.iv48
%6 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %5, 8
br i1 %min.iters.check, label %for.body10.preheader, label %vector.ph
vector.ph: ; preds = %for.body10.lr.ph
%n.vec = and i64 %5, -8
%ind.end = add i64 %indvars.iv43, %n.vec
%7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %c.038, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %6, 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> [ %7, %vector.ph ], [ %12, %vector.body ]
%vec.phi55 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%offset.idx = add i64 %indvars.iv43, %index
%8 = getelementptr inbounds [101 x i32], ptr %b, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load56 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%11 = mul nsw <4 x i32> %wide.load56, %broadcast.splat
%12 = add <4 x i32> %10, %vec.phi
%13 = add <4 x i32> %11, %vec.phi55
%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 !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %13, %12
%15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.cond3.loopexit, label %for.body10.preheader
for.body10.preheader: ; preds = %for.body10.lr.ph, %middle.block
%indvars.iv45.ph = phi i64 [ %indvars.iv43, %for.body10.lr.ph ], [ %ind.end, %middle.block ]
%c.134.ph = phi i32 [ %c.038, %for.body10.lr.ph ], [ %15, %middle.block ]
br label %for.body10
for.body10: ; preds = %for.body10.preheader, %for.body10
%indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.body10 ], [ %indvars.iv45.ph, %for.body10.preheader ]
%c.134 = phi i32 [ %add15, %for.body10 ], [ %c.134.ph, %for.body10.preheader ]
%arrayidx14 = getelementptr inbounds [101 x i32], ptr %b, i64 0, i64 %indvars.iv45
%16 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%mul = mul nsw i32 %16, %6
%add15 = add nsw i32 %mul, %c.134
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count51
br i1 %exitcond.not, label %for.cond3.loopexit, label %for.body10, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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.vector.reduce.add.v4i32(<4 x 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 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include<stdio.h>
int main()
{
int a[105],b,c,d,i,n;
int sum=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
for(d=1;d<=n-1;d++)
for(b=1+d;b<=n;b++)
{c=a[d]*a[b];
sum=sum+c;}
printf("%d",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101854/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101854/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:
%a = alloca [105 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not28 = icmp slt i32 %0, 1
br i1 %cmp.not28, label %for.end18, label %for.body
for.cond2.preheader: ; preds = %for.body
%cmp3.not.not34 = icmp sgt i32 %3, 1
br i1 %cmp3.not.not34, label %for.body4.preheader, label %for.end18
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = add nuw i32 %3, 1
%wide.trip.count48 = zext i32 %3 to i64
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -2
br label %for.body7.lr.ph
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [105 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
%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.cond2.preheader, !llvm.loop !9
for.cond2.loopexit: ; preds = %for.body7, %middle.block
%add12.lcssa = phi i32 [ %15, %middle.block ], [ %add12, %for.body7 ]
%indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
%exitcond49.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count48
%indvar.next = add i64 %indvar, 1
br i1 %exitcond49.not, label %for.end18, label %for.body7.lr.ph, !llvm.loop !11
for.body7.lr.ph: ; preds = %for.cond2.loopexit, %for.body4.preheader
%indvar = phi i64 [ %indvar.next, %for.cond2.loopexit ], [ 0, %for.body4.preheader ]
%indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.cond2.loopexit ], [ 1, %for.body4.preheader ]
%indvars.iv40 = phi i64 [ %indvars.iv.next41, %for.cond2.loopexit ], [ 2, %for.body4.preheader ]
%sum.036 = phi i32 [ %add12.lcssa, %for.cond2.loopexit ], [ 0, %for.body4.preheader ]
%5 = sub i64 %2, %indvar
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%arrayidx9 = getelementptr inbounds [105 x i32], ptr %a, i64 0, i64 %indvars.iv45
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %5, 8
br i1 %min.iters.check, label %for.body7.preheader, label %vector.ph
vector.ph: ; preds = %for.body7.lr.ph
%n.vec = and i64 %5, -8
%ind.end = add i64 %indvars.iv40, %n.vec
%7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %sum.036, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %6, 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> [ %7, %vector.ph ], [ %12, %vector.body ]
%vec.phi52 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%offset.idx = add i64 %indvars.iv40, %index
%8 = getelementptr inbounds [105 x i32], ptr %a, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load53 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%11 = mul nsw <4 x i32> %wide.load53, %broadcast.splat
%12 = add <4 x i32> %10, %vec.phi
%13 = add <4 x i32> %11, %vec.phi52
%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 !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %13, %12
%15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.cond2.loopexit, label %for.body7.preheader
for.body7.preheader: ; preds = %for.body7.lr.ph, %middle.block
%indvars.iv42.ph = phi i64 [ %indvars.iv40, %for.body7.lr.ph ], [ %ind.end, %middle.block ]
%sum.132.ph = phi i32 [ %sum.036, %for.body7.lr.ph ], [ %15, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body7 ], [ %indvars.iv42.ph, %for.body7.preheader ]
%sum.132 = phi i32 [ %add12, %for.body7 ], [ %sum.132.ph, %for.body7.preheader ]
%arrayidx11 = getelementptr inbounds [105 x i32], ptr %a, i64 0, i64 %indvars.iv42
%16 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%mul = mul nsw i32 %16, %6
%add12 = add nsw i32 %mul, %sum.132
%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.cond2.loopexit, label %for.body7, !llvm.loop !15
for.end18: ; preds = %for.cond2.loopexit, %entry, %for.cond2.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %add12.lcssa, %for.cond2.loopexit ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x 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 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include <stdio.h>
int main(int argc,char *argv[]){
int N,i,j=0;
int a[50];
scanf("%d",&N);
if(N<2||N>50){ return -1;}
i=N;
while(i>0){
scanf("%d",&a[j]);
j++;
i--;
}
j=0;
int k=0;
int max=0;
for(k=0;k<N;k++){
for(j=k+1;j<N;j++){
max += a[k]*a[j];
}
}
printf("%d",max);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101898/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101898/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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%a = alloca [50 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 200, 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
%1 = add i32 %0, -51
%or.cond = icmp ult i32 %1, -49
br i1 %or.cond, label %cleanup, label %while.body.preheader
while.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
br label %while.body
for.cond.preheader: ; preds = %while.body
%.pre = load i32, ptr %N, align 4, !tbaa !5
%cmp436 = icmp sgt i32 %.pre, 0
br i1 %cmp436, label %for.body.preheader, label %for.end16
for.body.preheader: ; preds = %for.cond.preheader
%2 = zext i32 %.pre to i64
%wide.trip.count51 = zext i32 %.pre to i64
br label %for.body
while.body: ; preds = %while.body.preheader, %while.body
%indvars.iv = phi i64 [ 0, %while.body.preheader ], [ %indvars.iv.next, %while.body ]
%arrayidx = getelementptr inbounds [50 x i32], ptr %a, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%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.preheader, label %while.body, !llvm.loop !9
for.cond.loopexit: ; preds = %for.body7, %middle.block, %for.body
%max.1.lcssa = phi i32 [ %max.038, %for.body ], [ %14, %middle.block ], [ %add12, %for.body7 ]
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond52.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count51
br i1 %exitcond52.not, label %for.end16, label %for.body, !llvm.loop !11
for.body: ; preds = %for.body.preheader, %for.cond.loopexit
%indvars.iv48 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next49, %for.cond.loopexit ]
%indvars.iv41 = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next42, %for.cond.loopexit ]
%max.038 = phi i32 [ 0, %for.body.preheader ], [ %max.1.lcssa, %for.cond.loopexit ]
%3 = xor i64 %indvars.iv48, -1
%4 = add nsw i64 %3, %wide.trip.count51
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%cmp633 = icmp ult i64 %indvars.iv.next49, %2
br i1 %cmp633, label %for.body7.lr.ph, label %for.cond.loopexit
for.body7.lr.ph: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [50 x i32], ptr %a, i64 0, i64 %indvars.iv48
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %4, 8
br i1 %min.iters.check, label %for.body7.preheader, label %vector.ph
vector.ph: ; preds = %for.body7.lr.ph
%n.vec = and i64 %4, -8
%ind.end = add i64 %indvars.iv41, %n.vec
%6 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %max.038, 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 ], [ %11, %vector.body ]
%vec.phi53 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%offset.idx = add i64 %indvars.iv41, %index
%7 = getelementptr inbounds [50 x i32], ptr %a, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %7, align 4, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load54 = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%10 = mul nsw <4 x i32> %wide.load54, %broadcast.splat
%11 = add <4 x i32> %9, %vec.phi
%12 = add <4 x i32> %10, %vec.phi53
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %12, %11
%14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %4, %n.vec
br i1 %cmp.n, label %for.cond.loopexit, label %for.body7.preheader
for.body7.preheader: ; preds = %for.body7.lr.ph, %middle.block
%indvars.iv43.ph = phi i64 [ %indvars.iv41, %for.body7.lr.ph ], [ %ind.end, %middle.block ]
%max.135.ph = phi i32 [ %max.038, %for.body7.lr.ph ], [ %14, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body7 ], [ %indvars.iv43.ph, %for.body7.preheader ]
%max.135 = phi i32 [ %add12, %for.body7 ], [ %max.135.ph, %for.body7.preheader ]
%arrayidx11 = getelementptr inbounds [50 x i32], ptr %a, i64 0, i64 %indvars.iv43
%15 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%mul = mul nsw i32 %15, %5
%add12 = add nsw i32 %mul, %max.135
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond47.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count51
br i1 %exitcond47.not, label %for.cond.loopexit, label %for.body7, !llvm.loop !15
for.end16: ; preds = %for.cond.loopexit, %for.cond.preheader
%max.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %max.1.lcssa, %for.cond.loopexit ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %max.0.lcssa)
br label %cleanup
cleanup: ; preds = %entry, %for.end16
%retval.0 = phi i32 [ 0, %for.end16 ], [ -1, %entry ]
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
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: 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.vector.reduce.add.v4i32(<4 x 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 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include<stdio.h>
int main()
{
int i,j,n,a[200001],m,l=0;
scanf("%d",&n);
for(m=0;m<n;m++)
scanf("%d",&a[m]);
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
l=l+(a[i]*a[j]);
}
printf("%d",l);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101940/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101940/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [200001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 800004, 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
%cmp28 = icmp sgt i32 %0, 0
br i1 %cmp28, label %for.body, label %for.end18
for.cond2.preheader: ; preds = %for.body
%cmp334 = icmp sgt i32 %2, 1
br i1 %cmp334, label %for.body4.preheader, label %for.end18
for.body4.preheader: ; preds = %for.cond2.preheader
%sub = add nsw i32 %2, -1
%1 = zext i32 %2 to i64
%wide.trip.count48 = zext i32 %sub to i64
%wide.trip.count = zext i32 %2 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 [200001 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond2.loopexit: ; preds = %for.body7, %middle.block, %for.body4
%l.1.lcssa = phi i32 [ %l.036, %for.body4 ], [ %15, %middle.block ], [ %add12, %for.body7 ]
%indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
%exitcond49.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count48
br i1 %exitcond49.not, label %for.end18, label %for.body4, !llvm.loop !11
for.body4: ; preds = %for.body4.preheader, %for.cond2.loopexit
%indvars.iv45 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next46, %for.cond2.loopexit ]
%indvars.iv40 = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next41, %for.cond2.loopexit ]
%l.036 = phi i32 [ 0, %for.body4.preheader ], [ %l.1.lcssa, %for.cond2.loopexit ]
%4 = xor i64 %indvars.iv45, -1
%5 = add nsw i64 %4, %wide.trip.count
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%cmp630 = icmp ult i64 %indvars.iv.next46, %1
br i1 %cmp630, label %for.body7.lr.ph, label %for.cond2.loopexit
for.body7.lr.ph: ; preds = %for.body4
%arrayidx9 = getelementptr inbounds [200001 x i32], ptr %a, i64 0, i64 %indvars.iv45
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %5, 8
br i1 %min.iters.check, label %for.body7.preheader, label %vector.ph
vector.ph: ; preds = %for.body7.lr.ph
%n.vec = and i64 %5, -8
%ind.end = add i64 %indvars.iv40, %n.vec
%7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %l.036, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %6, 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> [ %7, %vector.ph ], [ %12, %vector.body ]
%vec.phi52 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%offset.idx = add i64 %indvars.iv40, %index
%8 = getelementptr inbounds [200001 x i32], ptr %a, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load53 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%11 = mul nsw <4 x i32> %wide.load53, %broadcast.splat
%12 = add <4 x i32> %10, %vec.phi
%13 = add <4 x i32> %11, %vec.phi52
%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 !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %13, %12
%15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.cond2.loopexit, label %for.body7.preheader
for.body7.preheader: ; preds = %for.body7.lr.ph, %middle.block
%indvars.iv42.ph = phi i64 [ %indvars.iv40, %for.body7.lr.ph ], [ %ind.end, %middle.block ]
%l.132.ph = phi i32 [ %l.036, %for.body7.lr.ph ], [ %15, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body7 ], [ %indvars.iv42.ph, %for.body7.preheader ]
%l.132 = phi i32 [ %add12, %for.body7 ], [ %l.132.ph, %for.body7.preheader ]
%arrayidx11 = getelementptr inbounds [200001 x i32], ptr %a, i64 0, i64 %indvars.iv42
%16 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%mul = mul nsw i32 %16, %6
%add12 = add nsw i32 %mul, %l.132
%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.cond2.loopexit, label %for.body7, !llvm.loop !15
for.end18: ; preds = %for.cond2.loopexit, %entry, %for.cond2.preheader
%l.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %l.1.lcssa, %for.cond2.loopexit ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %l.0.lcssa)
call void @llvm.lifetime.end.p0(i64 800004, 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 i32 @llvm.vector.reduce.add.v4i32(<4 x 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 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include <stdio.h>
int main(void){
int N;
int d[50];
int sum=0;
int heal;
scanf("%d",&N);
for(int i=0;i<N;i++){
scanf("%d",&d[i]);
}
for (int i=0;i<N;i++){
for(int j=0;j<N;j++){
if(i<j){
heal=d[i]*d[j];
sum+=heal;
}
}
}
printf("%d",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101984/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101984/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%d = alloca [50 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %d) #3
%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.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp438 = icmp sgt i32 %8, 0
br i1 %cmp438, label %for.cond7.preheader.us.preheader, label %for.cond.cleanup5
for.cond7.preheader.us.preheader: ; preds = %for.cond3.preheader
%wide.trip.count50 = zext i32 %8 to i64
%xtraiter = and i64 %wide.trip.count50, 1
%1 = icmp eq i32 %8, 1
%unroll_iter = and i64 %wide.trip.count50, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond7.preheader.us
for.cond7.preheader.us: ; preds = %for.cond7.preheader.us.preheader, %for.cond7.for.cond.cleanup9_crit_edge.us
%indvars.iv47 = phi i64 [ 0, %for.cond7.preheader.us.preheader ], [ %indvars.iv.next48, %for.cond7.for.cond.cleanup9_crit_edge.us ]
%sum.039.us = phi i32 [ 0, %for.cond7.preheader.us.preheader ], [ %sum.2.us.lcssa, %for.cond7.for.cond.cleanup9_crit_edge.us ]
%arrayidx13.us = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv47
br i1 %1, label %for.cond7.for.cond.cleanup9_crit_edge.us.unr-lcssa, label %for.body10.us
for.body10.us: ; preds = %for.cond7.preheader.us, %for.inc16.us.1
%indvars.iv44 = phi i64 [ %indvars.iv.next45.1, %for.inc16.us.1 ], [ 0, %for.cond7.preheader.us ]
%sum.135.us = phi i32 [ %sum.2.us.1, %for.inc16.us.1 ], [ %sum.039.us, %for.cond7.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.inc16.us.1 ], [ 0, %for.cond7.preheader.us ]
%cmp11.us = icmp ult i64 %indvars.iv47, %indvars.iv44
br i1 %cmp11.us, label %if.then.us, label %for.inc16.us
if.then.us: ; preds = %for.body10.us
%2 = load i32, ptr %arrayidx13.us, align 4, !tbaa !5
%arrayidx15.us = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv44
%3 = load i32, ptr %arrayidx15.us, align 8, !tbaa !5
%mul.us = mul nsw i32 %3, %2
%add.us = add nsw i32 %mul.us, %sum.135.us
br label %for.inc16.us
for.inc16.us: ; preds = %if.then.us, %for.body10.us
%sum.2.us = phi i32 [ %add.us, %if.then.us ], [ %sum.135.us, %for.body10.us ]
%indvars.iv.next45 = or i64 %indvars.iv44, 1
%cmp11.us.1 = icmp ult i64 %indvars.iv47, %indvars.iv.next45
br i1 %cmp11.us.1, label %if.then.us.1, label %for.inc16.us.1
if.then.us.1: ; preds = %for.inc16.us
%4 = load i32, ptr %arrayidx13.us, align 4, !tbaa !5
%arrayidx15.us.1 = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv.next45
%5 = load i32, ptr %arrayidx15.us.1, align 4, !tbaa !5
%mul.us.1 = mul nsw i32 %5, %4
%add.us.1 = add nsw i32 %mul.us.1, %sum.2.us
br label %for.inc16.us.1
for.inc16.us.1: ; preds = %if.then.us.1, %for.inc16.us
%sum.2.us.1 = phi i32 [ %add.us.1, %if.then.us.1 ], [ %sum.2.us, %for.inc16.us ]
%indvars.iv.next45.1 = add nuw nsw i64 %indvars.iv44, 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.cond7.for.cond.cleanup9_crit_edge.us.unr-lcssa, label %for.body10.us, !llvm.loop !9
for.cond7.for.cond.cleanup9_crit_edge.us.unr-lcssa: ; preds = %for.inc16.us.1, %for.cond7.preheader.us
%sum.2.us.lcssa.ph = phi i32 [ undef, %for.cond7.preheader.us ], [ %sum.2.us.1, %for.inc16.us.1 ]
%indvars.iv44.unr = phi i64 [ 0, %for.cond7.preheader.us ], [ %indvars.iv.next45.1, %for.inc16.us.1 ]
%sum.135.us.unr = phi i32 [ %sum.039.us, %for.cond7.preheader.us ], [ %sum.2.us.1, %for.inc16.us.1 ]
br i1 %lcmp.mod.not, label %for.cond7.for.cond.cleanup9_crit_edge.us, label %for.body10.us.epil
for.body10.us.epil: ; preds = %for.cond7.for.cond.cleanup9_crit_edge.us.unr-lcssa
%cmp11.us.epil = icmp ult i64 %indvars.iv47, %indvars.iv44.unr
br i1 %cmp11.us.epil, label %if.then.us.epil, label %for.cond7.for.cond.cleanup9_crit_edge.us
if.then.us.epil: ; preds = %for.body10.us.epil
%6 = load i32, ptr %arrayidx13.us, align 4, !tbaa !5
%arrayidx15.us.epil = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv44.unr
%7 = load i32, ptr %arrayidx15.us.epil, align 4, !tbaa !5
%mul.us.epil = mul nsw i32 %7, %6
%add.us.epil = add nsw i32 %mul.us.epil, %sum.135.us.unr
br label %for.cond7.for.cond.cleanup9_crit_edge.us
for.cond7.for.cond.cleanup9_crit_edge.us: ; preds = %for.body10.us.epil, %if.then.us.epil, %for.cond7.for.cond.cleanup9_crit_edge.us.unr-lcssa
%sum.2.us.lcssa = phi i32 [ %sum.2.us.lcssa.ph, %for.cond7.for.cond.cleanup9_crit_edge.us.unr-lcssa ], [ %add.us.epil, %if.then.us.epil ], [ %sum.135.us.unr, %for.body10.us.epil ]
%indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
%exitcond51.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count50
br i1 %exitcond51.not, label %for.cond.cleanup5, label %for.cond7.preheader.us, !llvm.loop !11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x i32], ptr %d, 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
%8 = load i32, ptr %N, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !12
for.cond.cleanup5: ; preds = %for.cond7.for.cond.cleanup9_crit_edge.us, %entry, %for.cond3.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %sum.2.us.lcssa, %for.cond7.for.cond.cleanup9_crit_edge.us ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(void){
int N;
scanf("%d",&N);
int d[N];
int i;
for(i=0;i<N;i++){
scanf("%d",&d[i]);
}
int ans=0;
int wa;
wa=d[0];
for(i=1;i<N;i++){
ans+=wa*d[i];
wa+=d[i];
}
printf("%d",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102026/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102026/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %3, 0
br i1 %cmp23, label %for.body, label %for.end13
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
%cmp425 = icmp sgt i32 %4, 1
br i1 %cmp425, label %for.body5.preheader, label %for.end13
for.body5.preheader: ; preds = %for.end
%.pre = load i32, ptr %vla, align 16, !tbaa !5
%wide.trip.count = zext i32 %4 to i64
%6 = add nsw i64 %wide.trip.count, -1
%7 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %6, 3
%8 = icmp ult i64 %7, 3
br i1 %8, label %for.end13.loopexit.unr-lcssa, label %for.body5.preheader.new
for.body5.preheader.new: ; preds = %for.body5.preheader
%unroll_iter = and i64 %6, -4
%invariant.gep = getelementptr i32, ptr %vla, i64 1
%invariant.gep38 = getelementptr i32, ptr %vla, i64 2
%invariant.gep40 = getelementptr i32, ptr %vla, i64 3
br label %for.body5
for.body5: ; preds = %for.body5, %for.body5.preheader.new
%indvars.iv32 = phi i64 [ 1, %for.body5.preheader.new ], [ %indvars.iv.next33.3, %for.body5 ]
%wa.028 = phi i32 [ %.pre, %for.body5.preheader.new ], [ %add10.3, %for.body5 ]
%ans.027 = phi i32 [ 0, %for.body5.preheader.new ], [ %add.3, %for.body5 ]
%niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.3, %for.body5 ]
%arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv32
%9 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%mul = mul nsw i32 %9, %wa.028
%add = add nsw i32 %mul, %ans.027
%add10 = add nsw i32 %9, %wa.028
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv32
%10 = load i32, ptr %gep, align 4, !tbaa !5
%mul.1 = mul nsw i32 %10, %add10
%add.1 = add nsw i32 %mul.1, %add
%add10.1 = add nsw i32 %10, %add10
%gep39 = getelementptr i32, ptr %invariant.gep38, i64 %indvars.iv32
%11 = load i32, ptr %gep39, align 4, !tbaa !5
%mul.2 = mul nsw i32 %11, %add10.1
%add.2 = add nsw i32 %mul.2, %add.1
%add10.2 = add nsw i32 %11, %add10.1
%gep41 = getelementptr i32, ptr %invariant.gep40, i64 %indvars.iv32
%12 = load i32, ptr %gep41, align 4, !tbaa !5
%mul.3 = mul nsw i32 %12, %add10.2
%add.3 = add nsw i32 %mul.3, %add.2
%add10.3 = add nsw i32 %12, %add10.2
%indvars.iv.next33.3 = add nuw nsw i64 %indvars.iv32, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.end13.loopexit.unr-lcssa, label %for.body5, !llvm.loop !11
for.end13.loopexit.unr-lcssa: ; preds = %for.body5, %for.body5.preheader
%add.lcssa.ph = phi i32 [ undef, %for.body5.preheader ], [ %add.3, %for.body5 ]
%indvars.iv32.unr = phi i64 [ 1, %for.body5.preheader ], [ %indvars.iv.next33.3, %for.body5 ]
%wa.028.unr = phi i32 [ %.pre, %for.body5.preheader ], [ %add10.3, %for.body5 ]
%ans.027.unr = phi i32 [ 0, %for.body5.preheader ], [ %add.3, %for.body5 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end13, label %for.body5.epil
for.body5.epil: ; preds = %for.end13.loopexit.unr-lcssa, %for.body5.epil
%indvars.iv32.epil = phi i64 [ %indvars.iv.next33.epil, %for.body5.epil ], [ %indvars.iv32.unr, %for.end13.loopexit.unr-lcssa ]
%wa.028.epil = phi i32 [ %add10.epil, %for.body5.epil ], [ %wa.028.unr, %for.end13.loopexit.unr-lcssa ]
%ans.027.epil = phi i32 [ %add.epil, %for.body5.epil ], [ %ans.027.unr, %for.end13.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body5.epil ], [ 0, %for.end13.loopexit.unr-lcssa ]
%arrayidx7.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv32.epil
%13 = load i32, ptr %arrayidx7.epil, align 4, !tbaa !5
%mul.epil = mul nsw i32 %13, %wa.028.epil
%add.epil = add nsw i32 %mul.epil, %ans.027.epil
%add10.epil = add nsw i32 %13, %wa.028.epil
%indvars.iv.next33.epil = add nuw nsw i64 %indvars.iv32.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end13, label %for.body5.epil, !llvm.loop !12
for.end13: ; preds = %for.end13.loopexit.unr-lcssa, %for.body5.epil, %entry, %for.end
%ans.0.lcssa = phi i32 [ 0, %for.end ], [ 0, %entry ], [ %add.lcssa.ph, %for.end13.loopexit.unr-lcssa ], [ %add.epil, %for.body5.epil ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
int count1(char str[],int n)
{
int count=0,i;
for(i=0;i<n;i++)
{
if(str[i]=='0')
count++;
}
return count;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,c1,c2,h;
scanf("%d %d %d %d",&n,&c1,&c2,&h);
char str[n];
scanf("%s",str);
int n1=count1(str,n);
int n2=n-n1;
int sum=(n1*c1)+(n2*c2);
int sum1=(n1*h)+(n*c2);
int sum2=(n*c1)+(n2*h);
int final;
if(sum<=sum1&&sum<=sum2)
final=sum;
else if(sum2<=sum&&sum2<=sum1)
final=sum2;
else
final=sum1;
printf("%d\n",final);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10207/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10207/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"%d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.3 = 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 @count1(ptr nocapture noundef readonly %str, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader13, 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 ], [ %6, %vector.body ]
%vec.phi11 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%0 = getelementptr inbounds i8, ptr %str, i64 %index
%wide.load = load <4 x i8>, ptr %0, align 1, !tbaa !5
%1 = getelementptr inbounds i8, ptr %0, i64 4
%wide.load12 = load <4 x i8>, ptr %1, align 1, !tbaa !5
%2 = icmp eq <4 x i8> %wide.load, <i8 48, i8 48, i8 48, i8 48>
%3 = icmp eq <4 x i8> %wide.load12, <i8 48, i8 48, i8 48, i8 48>
%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.phi, %4
%7 = add <4 x i32> %vec.phi11, %5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %7, %6
%9 = tail 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.preheader13
for.body.preheader13: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%count.08.ph = phi i32 [ 0, %for.body.preheader ], [ %9, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader13, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader13 ]
%count.08 = phi i32 [ %spec.select, %for.body ], [ %count.08.ph, %for.body.preheader13 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %indvars.iv
%10 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp1 = icmp eq i8 %10, 48
%inc = zext i1 %cmp1 to i32
%spec.select = add nuw nsw i32 %count.08, %inc
%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 !12
for.end: ; preds = %for.body, %middle.block, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %9, %middle.block ], [ %spec.select, %for.body ]
ret i32 %count.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:
%t = alloca i32, align 4
%n = alloca i32, align 4
%c1 = alloca i32, align 4
%c2 = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !13
%dec31 = add nsw i32 %0, -1
store i32 %dec31, ptr %t, align 4, !tbaa !13
%tobool.not32 = icmp eq i32 %0, 0
br i1 %tobool.not32, label %while.end, label %while.body
while.body: ; preds = %entry, %count1.exit
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c1) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c2) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %c1, ptr noundef nonnull %c2, ptr noundef nonnull %h)
%1 = load i32, ptr %n, align 4, !tbaa !13
%2 = zext i32 %1 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %2, align 16
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %vla)
%4 = load i32, ptr %n, align 4, !tbaa !13
%cmp7.i = icmp sgt i32 %4, 0
br i1 %cmp7.i, label %for.body.preheader.i, label %count1.exit
for.body.preheader.i: ; preds = %while.body
%wide.trip.count.i = zext i32 %4 to i64
%min.iters.check = icmp ult i32 %4, 8
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body.preheader.i
%n.vec = and i64 %wide.trip.count.i, 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 ], [ %11, %vector.body ]
%vec.phi33 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%5 = getelementptr inbounds i8, ptr %vla, i64 %index
%wide.load = load <4 x i8>, ptr %5, align 8, !tbaa !5
%6 = getelementptr inbounds i8, ptr %5, i64 4
%wide.load34 = load <4 x i8>, ptr %6, align 4, !tbaa !5
%7 = icmp eq <4 x i8> %wide.load, <i8 48, i8 48, i8 48, i8 48>
%8 = icmp eq <4 x i8> %wide.load34, <i8 48, i8 48, i8 48, i8 48>
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = zext <4 x i1> %8 to <4 x i32>
%11 = add <4 x i32> %vec.phi, %9
%12 = add <4 x i32> %vec.phi33, %10
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %12, %11
%14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %count1.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%count.08.i.ph = phi i32 [ 0, %for.body.preheader.i ], [ %14, %middle.block ]
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%count.08.i = phi i32 [ %spec.select.i, %for.body.i ], [ %count.08.i.ph, %for.body.i.preheader ]
%arrayidx.i = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv.i
%15 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%cmp1.i = icmp eq i8 %15, 48
%inc.i = zext i1 %cmp1.i to i32
%spec.select.i = add nuw nsw i32 %count.08.i, %inc.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 %count1.exit, label %for.body.i, !llvm.loop !16
count1.exit: ; preds = %for.body.i, %middle.block, %while.body
%count.0.lcssa.i = phi i32 [ 0, %while.body ], [ %14, %middle.block ], [ %spec.select.i, %for.body.i ]
%sub = sub nsw i32 %4, %count.0.lcssa.i
%16 = load i32, ptr %c1, align 4, !tbaa !13
%mul = mul nsw i32 %16, %count.0.lcssa.i
%17 = load i32, ptr %c2, align 4, !tbaa !13
%mul4 = mul nsw i32 %17, %sub
%add = add nsw i32 %mul4, %mul
%18 = load i32, ptr %h, align 4, !tbaa !13
%mul5 = mul nsw i32 %18, %count.0.lcssa.i
%mul6 = mul nsw i32 %17, %4
%add7 = add nsw i32 %mul5, %mul6
%mul8 = mul nsw i32 %16, %4
%mul9 = mul nsw i32 %18, %sub
%add10 = add nsw i32 %mul9, %mul8
%cmp.not = icmp sgt i32 %add, %add7
%cmp11.not = icmp sgt i32 %add, %add10
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp11.not
%cmp12.not = icmp sgt i32 %add10, %add
%cmp14.not = icmp sgt i32 %add10, %add7
%or.cond30 = or i1 %cmp12.not, %cmp14.not
%spec.select = select i1 %or.cond30, i32 %add7, i32 %add10
%final.0 = select i1 %or.cond, i32 %spec.select, i32 %add
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %final.0)
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c2) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c1) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
%19 = load i32, ptr %t, align 4, !tbaa !13
%dec = add nsw i32 %19, -1
store i32 %dec, ptr %t, align 4, !tbaa !13
%tobool.not = icmp eq i32 %19, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !17
while.end: ; preds = %count1.exit, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
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 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !6, i64 0}
!15 = distinct !{!15, !9, !10, !11}
!16 = distinct !{!16, !9, !11, !10}
!17 = distinct !{!17, !9}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.