Source_Code
stringlengths 69
484k
| IR_Original
stringlengths 2.05k
17.9M
|
---|---|
#include<stdio.h>
int main(void)
{
int num;
scanf("%d",&num);
int i,a[num];
for(i=0;i<num;i++)
scanf("%d",&a[i]);
int tmp,j;
for(i=0;i<num;i++){
for(j=num-1;j>i;j--){
if(a[j-1]>a[j]){
tmp=a[j-1];
a[j-1]=a[j];
a[j]=tmp;
}
}
}
double ans=(double)a[0];
for(i=1;i<num;i++){
ans=(ans+a[i])/2;
}
printf("%f\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138128/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138128/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, 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 %num, align 4, !tbaa !5
%cmp59 = icmp sgt i32 %3, 0
br i1 %cmp59, label %for.body, label %for.end28.thread
for.cond2.preheader: ; preds = %for.body
%cmp365 = icmp sgt i32 %7, 0
br i1 %cmp365, label %for.cond5.preheader.lr.ph, label %for.end28.thread
for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader
%j.061 = add nsw i32 %7, -1
%4 = zext i32 %7 to i64
%5 = add nsw i64 %4, -1
%6 = zext i32 %j.061 to i64
%wide.trip.count = zext i32 %7 to i64
%invariant.gep = getelementptr i32, ptr %vla, i64 -2
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
%7 = load i32, ptr %num, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond5.preheader.lr.ph, %for.inc26
%indvars.iv81 = phi i64 [ 0, %for.cond5.preheader.lr.ph ], [ %indvars.iv.next82, %for.inc26 ]
%cmp662 = icmp ult i64 %indvars.iv81, %6
br i1 %cmp662, label %for.body7, label %for.inc26
for.body7: ; preds = %for.cond5.preheader, %for.inc24
%indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.inc24 ], [ %4, %for.cond5.preheader ]
%indvars.iv73 = phi i64 [ %indvars.iv.next74, %for.inc24 ], [ %5, %for.cond5.preheader ]
%indvars.iv.next76 = add nsw i64 %indvars.iv75, -1
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv75
%9 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx12 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv73
%10 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13 = icmp sgt i32 %9, %10
br i1 %cmp13, label %if.then, label %for.inc24
if.then: ; preds = %for.body7
store i32 %10, ptr %gep, align 4, !tbaa !5
store i32 %9, ptr %arrayidx12, align 4, !tbaa !5
br label %for.inc24
for.inc24: ; preds = %for.body7, %if.then
%indvars.iv.next74 = add nsw i64 %indvars.iv73, -1
%cmp6 = icmp sgt i64 %indvars.iv.next74, %indvars.iv81
br i1 %cmp6, label %for.body7, label %for.inc26, !llvm.loop !11
for.inc26: ; preds = %for.inc24, %for.cond5.preheader
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%exitcond.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count
br i1 %exitcond.not, label %for.end28, label %for.cond5.preheader, !llvm.loop !12
for.end28.thread: ; preds = %for.cond2.preheader, %entry
%11 = load i32, ptr %vla, align 16, !tbaa !5
%conv93 = sitofp i32 %11 to double
br label %for.end39
for.end28: ; preds = %for.inc26
%12 = load i32, ptr %vla, align 16, !tbaa !5
%conv = sitofp i32 %12 to double
%cmp3167 = icmp sgt i32 %7, 1
br i1 %cmp3167, label %for.body33.preheader, label %for.end39
for.body33.preheader: ; preds = %for.end28
%13 = add nsw i64 %4, -2
%xtraiter = and i64 %5, 3
%14 = icmp ult i64 %13, 3
br i1 %14, label %for.end39.loopexit.unr-lcssa, label %for.body33.preheader.new
for.body33.preheader.new: ; preds = %for.body33.preheader
%unroll_iter = and i64 %5, -4
%invariant.gep96 = getelementptr i32, ptr %vla, i64 1
%invariant.gep98 = getelementptr i32, ptr %vla, i64 2
%invariant.gep100 = getelementptr i32, ptr %vla, i64 3
br label %for.body33
for.body33: ; preds = %for.body33, %for.body33.preheader.new
%indvars.iv84 = phi i64 [ 1, %for.body33.preheader.new ], [ %indvars.iv.next85.3, %for.body33 ]
%ans.069 = phi double [ %conv, %for.body33.preheader.new ], [ %div.3, %for.body33 ]
%niter = phi i64 [ 0, %for.body33.preheader.new ], [ %niter.next.3, %for.body33 ]
%arrayidx35 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv84
%15 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%conv36 = sitofp i32 %15 to double
%add = fadd double %ans.069, %conv36
%div = fmul double %add, 5.000000e-01
%gep97 = getelementptr i32, ptr %invariant.gep96, i64 %indvars.iv84
%16 = load i32, ptr %gep97, align 4, !tbaa !5
%conv36.1 = sitofp i32 %16 to double
%add.1 = fadd double %div, %conv36.1
%div.1 = fmul double %add.1, 5.000000e-01
%gep99 = getelementptr i32, ptr %invariant.gep98, i64 %indvars.iv84
%17 = load i32, ptr %gep99, align 4, !tbaa !5
%conv36.2 = sitofp i32 %17 to double
%add.2 = fadd double %div.1, %conv36.2
%div.2 = fmul double %add.2, 5.000000e-01
%gep101 = getelementptr i32, ptr %invariant.gep100, i64 %indvars.iv84
%18 = load i32, ptr %gep101, align 4, !tbaa !5
%conv36.3 = sitofp i32 %18 to double
%add.3 = fadd double %div.2, %conv36.3
%div.3 = fmul double %add.3, 5.000000e-01
%indvars.iv.next85.3 = add nuw nsw i64 %indvars.iv84, 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.end39.loopexit.unr-lcssa, label %for.body33, !llvm.loop !13
for.end39.loopexit.unr-lcssa: ; preds = %for.body33, %for.body33.preheader
%div.lcssa.ph = phi double [ undef, %for.body33.preheader ], [ %div.3, %for.body33 ]
%indvars.iv84.unr = phi i64 [ 1, %for.body33.preheader ], [ %indvars.iv.next85.3, %for.body33 ]
%ans.069.unr = phi double [ %conv, %for.body33.preheader ], [ %div.3, %for.body33 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end39, label %for.body33.epil
for.body33.epil: ; preds = %for.end39.loopexit.unr-lcssa, %for.body33.epil
%indvars.iv84.epil = phi i64 [ %indvars.iv.next85.epil, %for.body33.epil ], [ %indvars.iv84.unr, %for.end39.loopexit.unr-lcssa ]
%ans.069.epil = phi double [ %div.epil, %for.body33.epil ], [ %ans.069.unr, %for.end39.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body33.epil ], [ 0, %for.end39.loopexit.unr-lcssa ]
%arrayidx35.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv84.epil
%19 = load i32, ptr %arrayidx35.epil, align 4, !tbaa !5
%conv36.epil = sitofp i32 %19 to double
%add.epil = fadd double %ans.069.epil, %conv36.epil
%div.epil = fmul double %add.epil, 5.000000e-01
%indvars.iv.next85.epil = add nuw nsw i64 %indvars.iv84.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.end39, label %for.body33.epil, !llvm.loop !14
for.end39: ; preds = %for.end39.loopexit.unr-lcssa, %for.body33.epil, %for.end28.thread, %for.end28
%ans.0.lcssa = phi double [ %conv, %for.end28 ], [ %conv93, %for.end28.thread ], [ %div.lcssa.ph, %for.end39.loopexit.unr-lcssa ], [ %div.epil, %for.body33.epil ]
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #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, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void dsort(double *a,int n);
int main(){
int n;
double val;
double *v;
scanf("%d",&n);
v=(double*)malloc(n*sizeof(double));
for (int i=0;i<n;i++) scanf("%lf",&v[i]);
dsort(v,n);
val=0;
for (int i=0;i<n;i++){
if (i==n-1) val=val+v[i]*pow(2,-i);
else val=val+v[i]*pow(2,-i-1);
}
printf("%f\n",val);
free(v);
return 0;
}
void dsort(double *a,int n){
double *store;
int hf=n,unit=1,a1,a2;
store=(double *)malloc(sizeof(double)*n);
for (int i=0;i<n;i++) store[i]=a[i];
while (hf>1){
if (hf==2){
hf=(hf+1)/2;
for (int i=0;i<hf;i++){
a1=0;
a2=0;
while (a1+a2<2*unit && 2*i*unit+a1+a2<n){
if (a1==unit){
store[2*i*unit+a1+a2]=a[(2*i+1)*unit+a2];
a2++;
}
else if (a2==unit || (2*i+1)*unit+a2==n){
store[2*i*unit+a1+a2]=a[2*i*unit+a1];
a1++;
}
else if (a[(2*i+1)*unit+a2]<a[2*i*unit+a1]){
store[2*i*unit+a1+a2]=a[2*i*unit+a1];
a1++;
}
else {
store[2*i*unit+a1+a2]=a[(2*i+1)*unit+a2];
a2++;
}
}
}
for (int i=0;i<n;i++) a[i]=store[i];
break;
}
else if (hf%2){
hf=(hf+1)/2;
for (int i=0;i<hf-1;i++){
a1=0;
a2=0;
while (a1+a2<2*unit && 2*i*unit+a1+a2<n){
if (a1==unit){
store[2*i*unit+a1+a2]=a[(2*i+1)*unit+a2];
a2++;
}
else if (a2==unit || (2*i+1)*unit+a2==n){
store[2*i*unit+a1+a2]=a[2*i*unit+a1];
a1++;
}
else if (a[(2*i+1)*unit+a2]<a[2*i*unit+a1]){
store[2*i*unit+a1+a2]=a[2*i*unit+a1];
a1++;
}
else {
store[2*i*unit+a1+a2]=a[(2*i+1)*unit+a2];
a2++;
}
}
}
}
else {
hf=(hf+1)/2;
for (int i=0;i<hf;i++){
a1=0;
a2=0;
while (a1+a2<2*unit && 2*i*unit+a1+a2<n){
if (a1==unit){
store[2*i*unit+a1+a2]=a[(2*i+1)*unit+a2];
a2++;
}
else if (a2==unit || (2*i+1)*unit+a2==n){
store[2*i*unit+a1+a2]=a[2*i*unit+a1];
a1++;
}
else if (a[(2*i+1)*unit+a2]<a[2*i*unit+a1]){
store[2*i*unit+a1+a2]=a[2*i*unit+a1];
a1++;
}
else {
store[2*i*unit+a1+a2]=a[(2*i+1)*unit+a2];
a2++;
}
}
}
}
unit*=2;
for (int i=0;i<n;i++) a[i]=store[i];
}
free(store);
return;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138171/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138171/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #10
%cmp45 = icmp sgt i32 %0, 0
br i1 %cmp45, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
call void @dsort(ptr noundef %call1, i32 noundef %.lcssa)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp647 = icmp sgt i32 %1, 0
br i1 %cmp647, label %for.body9, label %for.cond.cleanup8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds double, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond.cleanup8: ; preds = %for.body9, %for.cond.cleanup
%val.0.lcssa = phi double [ 0.000000e+00, %for.cond.cleanup ], [ %8, %for.body9 ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %val.0.lcssa)
call void @free(ptr noundef %call1) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
for.body9: ; preds = %for.cond.cleanup, %for.body9
%indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.body9 ], [ 0, %for.cond.cleanup ]
%4 = phi i32 [ %9, %for.body9 ], [ %1, %for.cond.cleanup ]
%val.048 = phi double [ %8, %for.body9 ], [ 0.000000e+00, %for.cond.cleanup ]
%sub = add nsw i32 %4, -1
%5 = zext i32 %sub to i64
%cmp10 = icmp eq i64 %indvars.iv53, %5
%6 = trunc i64 %indvars.iv53 to i32
%7 = sub i32 0, %6
%sub21 = xor i32 %6, -1
%.sink59 = select i1 %cmp10, i32 %7, i32 %sub21
%.sink.in = getelementptr inbounds double, ptr %call1, i64 %indvars.iv53
%.sink = load double, ptr %.sink.in, align 8, !tbaa !11
%ldexp44 = call double @ldexp(double 1.000000e+00, i32 %.sink59) #9
%8 = call double @llvm.fmuladd.f64(double %.sink, double %ldexp44, double %val.048)
%indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp6 = icmp slt i64 %indvars.iv.next54, %10
br i1 %cmp6, label %for.body9, label %for.cond.cleanup8, !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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 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: nounwind uwtable
define dso_local void @dsort(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%conv = sext i32 %n to i64
%mul = shl nsw i64 %conv, 3
%call = tail call noalias ptr @malloc(i64 noundef %mul) #10
%cmp591 = icmp sgt i32 %n, 0
br i1 %cmp591, label %while.cond.preheader, label %while.end359
while.cond.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%1 = shl nuw nsw i64 %0, 3
tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %call, ptr align 8 %a, i64 %1, i1 false), !tbaa !11
%cmp4604.not = icmp eq i32 %n, 1
br i1 %cmp4604.not, label %while.end359, label %while.body.lr.ph
while.body.lr.ph: ; preds = %while.cond.preheader
%2 = zext i32 %n to i64
%3 = shl nuw nsw i64 %2, 3
br label %while.body
while.cond.loopexit: ; preds = %for.inc230.us, %for.inc340, %while.cond132.preheader.lr.ph
%mul345 = shl nsw i32 %unit.0606, 1
tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %a, ptr align 8 %call, i64 %3, i1 false), !tbaa !11
%cmp4 = icmp ugt i32 %add234, 3
br i1 %cmp4, label %while.body, label %while.end359, !llvm.loop !14
while.body: ; preds = %while.body.lr.ph, %while.cond.loopexit
%unit.0606 = phi i32 [ 1, %while.body.lr.ph ], [ %mul345, %while.cond.loopexit ]
%hf.0605 = phi i32 [ %n, %while.body.lr.ph ], [ %div235584587, %while.cond.loopexit ]
%cmp6 = icmp eq i32 %hf.0605, 2
br i1 %cmp6, label %while.cond14.preheader, label %if.else122
while.cond14.preheader: ; preds = %while.body
%mul16 = shl nsw i32 %unit.0606, 1
%invariant.smin = tail call i32 @llvm.smin.i32(i32 %mul16, i32 %n)
%or.cond609 = icmp sgt i32 %invariant.smin, 0
br i1 %or.cond609, label %while.body25, label %for.cond110.preheader
for.cond110.preheader: ; preds = %if.end105, %while.cond14.preheader
br i1 %cmp591, label %for.body114.preheader, label %while.end359
for.body114.preheader: ; preds = %for.cond110.preheader
tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %a, ptr align 8 %call, i64 %3, i1 false), !tbaa !11
br label %while.end359
while.body25: ; preds = %while.cond14.preheader, %if.end105
%add15612 = phi i32 [ %add15, %if.end105 ], [ 0, %while.cond14.preheader ]
%a2.0611 = phi i32 [ %a2.1, %if.end105 ], [ 0, %while.cond14.preheader ]
%a1.0610 = phi i32 [ %a1.1, %if.end105 ], [ 0, %while.cond14.preheader ]
%cmp26 = icmp eq i32 %a1.0610, %unit.0606
br i1 %cmp26, label %if.then28, label %if.else
if.then28: ; preds = %while.body25
%add32 = add nsw i32 %a2.0611, %unit.0606
%idxprom33 = sext i32 %add32 to i64
%arrayidx34 = getelementptr inbounds double, ptr %a, i64 %idxprom33
%4 = load double, ptr %arrayidx34, align 8, !tbaa !11
%idxprom39 = sext i32 %add15612 to i64
%arrayidx40 = getelementptr inbounds double, ptr %call, i64 %idxprom39
store double %4, ptr %arrayidx40, align 8, !tbaa !11
%inc41 = add nsw i32 %a2.0611, 1
br label %if.end105
if.else: ; preds = %while.body25
%cmp42 = icmp eq i32 %a2.0611, %unit.0606
br i1 %cmp42, label %if.then50, label %lor.lhs.false
lor.lhs.false: ; preds = %if.else
%add47 = add nsw i32 %a2.0611, %unit.0606
%cmp48 = icmp eq i32 %add47, %n
br i1 %cmp48, label %if.then50, label %if.else63
if.then50: ; preds = %lor.lhs.false, %if.else
%idxprom54 = sext i32 %a1.0610 to i64
%arrayidx55 = getelementptr inbounds double, ptr %a, i64 %idxprom54
%5 = load double, ptr %arrayidx55, align 8, !tbaa !11
%idxprom60 = sext i32 %add15612 to i64
%arrayidx61 = getelementptr inbounds double, ptr %call, i64 %idxprom60
store double %5, ptr %arrayidx61, align 8, !tbaa !11
%inc62 = add nsw i32 %a1.0610, 1
br label %if.end105
if.else63: ; preds = %lor.lhs.false
%idxprom68 = sext i32 %add47 to i64
%arrayidx69 = getelementptr inbounds double, ptr %a, i64 %idxprom68
%6 = load double, ptr %arrayidx69, align 8, !tbaa !11
%idxprom73 = sext i32 %a1.0610 to i64
%arrayidx74 = getelementptr inbounds double, ptr %a, i64 %idxprom73
%7 = load double, ptr %arrayidx74, align 8, !tbaa !11
%cmp75 = fcmp olt double %6, %7
%idxprom87 = sext i32 %add15612 to i64
%arrayidx88 = getelementptr inbounds double, ptr %call, i64 %idxprom87
br i1 %cmp75, label %if.then77, label %if.else90
if.then77: ; preds = %if.else63
store double %7, ptr %arrayidx88, align 8, !tbaa !11
%inc89 = add nsw i32 %a1.0610, 1
br label %if.end105
if.else90: ; preds = %if.else63
store double %6, ptr %arrayidx88, align 8, !tbaa !11
%inc103 = add nsw i32 %a2.0611, 1
br label %if.end105
if.end105: ; preds = %if.then50, %if.else90, %if.then77, %if.then28
%a1.1 = phi i32 [ %unit.0606, %if.then28 ], [ %inc62, %if.then50 ], [ %inc89, %if.then77 ], [ %a1.0610, %if.else90 ]
%a2.1 = phi i32 [ %inc41, %if.then28 ], [ %a2.0611, %if.then50 ], [ %a2.0611, %if.then77 ], [ %inc103, %if.else90 ]
%add15 = add nsw i32 %a2.1, %a1.1
%or.cond = icmp slt i32 %add15, %invariant.smin
br i1 %or.cond, label %while.body25, label %for.cond110.preheader, !llvm.loop !15
if.else122: ; preds = %while.body
%rem = and i32 %hf.0605, 1
%tobool.not = icmp eq i32 %rem, 0
%add234 = add i32 %hf.0605, 1
%div235584587 = lshr i32 %add234, 1
%mul244 = shl nsw i32 %unit.0606, 1
br i1 %tobool.not, label %while.cond242.preheader, label %while.cond132.preheader.lr.ph
while.cond132.preheader.lr.ph: ; preds = %if.else122
%cmp135593 = icmp sgt i32 %unit.0606, 0
br i1 %cmp135593, label %while.cond132.preheader.us.preheader, label %while.cond.loopexit
while.cond132.preheader.us.preheader: ; preds = %while.cond132.preheader.lr.ph
%8 = tail call i32 @llvm.smax.i32(i32 %div235584587, i32 2)
%9 = add nsw i32 %8, -2
br label %while.cond132.preheader.us
while.cond132.preheader.us: ; preds = %while.cond132.preheader.us.preheader, %for.inc230.us
%i126.0597.us = phi i32 [ %inc231.us, %for.inc230.us ], [ 0, %while.cond132.preheader.us.preheader ]
%mul138.us = shl nuw nsw i32 %i126.0597.us, 1
%mul139.us = mul nsw i32 %mul138.us, %unit.0606
%add167.us = or i32 %mul138.us, 1
%mul168.us = mul nsw i32 %add167.us, %unit.0606
br label %land.rhs137.us
land.rhs137.us: ; preds = %while.cond132.preheader.us, %if.end228.us
%a2.2595.us = phi i32 [ 0, %while.cond132.preheader.us ], [ %a2.3.us, %if.end228.us ]
%a1.2594.us = phi i32 [ 0, %while.cond132.preheader.us ], [ %a1.3.us, %if.end228.us ]
%add140.us = add nsw i32 %a1.2594.us, %mul139.us
%add141.us = add nsw i32 %add140.us, %a2.2595.us
%cmp142.us = icmp slt i32 %add141.us, %n
br i1 %cmp142.us, label %while.body145.us, label %for.inc230.us
for.inc230.us: ; preds = %if.end228.us, %land.rhs137.us
%inc231.us = add nuw nsw i32 %i126.0597.us, 1
%exitcond.not = icmp eq i32 %i126.0597.us, %9
br i1 %exitcond.not, label %while.cond.loopexit, label %while.cond132.preheader.us, !llvm.loop !16
while.body145.us: ; preds = %land.rhs137.us
%cmp146.us = icmp eq i32 %a1.2594.us, %unit.0606
br i1 %cmp146.us, label %if.then148.us, label %if.else162.us
if.else162.us: ; preds = %while.body145.us
%cmp163.us = icmp eq i32 %a2.2595.us, %unit.0606
br i1 %cmp163.us, label %if.then172.us, label %lor.lhs.false165.us
lor.lhs.false165.us: ; preds = %if.else162.us
%add169.us = add nsw i32 %a2.2595.us, %mul168.us
%cmp170.us = icmp eq i32 %add169.us, %n
br i1 %cmp170.us, label %if.then172.us, label %if.else185.us
if.else185.us: ; preds = %lor.lhs.false165.us
%idxprom190.us = sext i32 %add169.us to i64
%arrayidx191.us = getelementptr inbounds double, ptr %a, i64 %idxprom190.us
%10 = load double, ptr %arrayidx191.us, align 8, !tbaa !11
%idxprom195.us = sext i32 %add140.us to i64
%arrayidx196.us = getelementptr inbounds double, ptr %a, i64 %idxprom195.us
%11 = load double, ptr %arrayidx196.us, align 8, !tbaa !11
%cmp197.us = fcmp olt double %10, %11
%idxprom209.us = sext i32 %add141.us to i64
%arrayidx210.us = getelementptr inbounds double, ptr %call, i64 %idxprom209.us
br i1 %cmp197.us, label %if.then199.us, label %if.else212.us
if.else212.us: ; preds = %if.else185.us
store double %10, ptr %arrayidx210.us, align 8, !tbaa !11
%inc225.us = add nsw i32 %a2.2595.us, 1
br label %if.end228.us
if.then199.us: ; preds = %if.else185.us
store double %11, ptr %arrayidx210.us, align 8, !tbaa !11
%inc211.us = add nsw i32 %a1.2594.us, 1
br label %if.end228.us
if.then172.us: ; preds = %lor.lhs.false165.us, %if.else162.us
%idxprom176.us = sext i32 %add140.us to i64
%arrayidx177.us = getelementptr inbounds double, ptr %a, i64 %idxprom176.us
%12 = load double, ptr %arrayidx177.us, align 8, !tbaa !11
%idxprom182.us = sext i32 %add141.us to i64
%arrayidx183.us = getelementptr inbounds double, ptr %call, i64 %idxprom182.us
store double %12, ptr %arrayidx183.us, align 8, !tbaa !11
%inc184.us = add nsw i32 %a1.2594.us, 1
br label %if.end228.us
if.then148.us: ; preds = %while.body145.us
%add152.us = add nsw i32 %a2.2595.us, %mul168.us
%idxprom153.us = sext i32 %add152.us to i64
%arrayidx154.us = getelementptr inbounds double, ptr %a, i64 %idxprom153.us
%13 = load double, ptr %arrayidx154.us, align 8, !tbaa !11
%idxprom159.us = sext i32 %add141.us to i64
%arrayidx160.us = getelementptr inbounds double, ptr %call, i64 %idxprom159.us
store double %13, ptr %arrayidx160.us, align 8, !tbaa !11
%inc161.us = add nsw i32 %a2.2595.us, 1
br label %if.end228.us
if.end228.us: ; preds = %if.then148.us, %if.then172.us, %if.then199.us, %if.else212.us
%a1.3.us = phi i32 [ %unit.0606, %if.then148.us ], [ %inc184.us, %if.then172.us ], [ %inc211.us, %if.then199.us ], [ %a1.2594.us, %if.else212.us ]
%a2.3.us = phi i32 [ %inc161.us, %if.then148.us ], [ %a2.2595.us, %if.then172.us ], [ %a2.2595.us, %if.then199.us ], [ %inc225.us, %if.else212.us ]
%add133.us = add nsw i32 %a2.3.us, %a1.3.us
%cmp135.us = icmp slt i32 %add133.us, %mul244
br i1 %cmp135.us, label %land.rhs137.us, label %for.inc230.us, !llvm.loop !17
while.cond242.preheader: ; preds = %if.else122, %for.inc340
%i236.0601 = phi i32 [ %inc341, %for.inc340 ], [ 0, %if.else122 ]
%mul248 = shl nuw nsw i32 %i236.0601, 1
%mul249 = mul nsw i32 %mul248, %unit.0606
%add277 = or i32 %mul248, 1
%mul278 = mul nsw i32 %add277, %unit.0606
br label %land.rhs247
land.rhs247: ; preds = %while.cond242.preheader, %if.end338
%a2.4599 = phi i32 [ 0, %while.cond242.preheader ], [ %a2.5, %if.end338 ]
%a1.4598 = phi i32 [ 0, %while.cond242.preheader ], [ %a1.5, %if.end338 ]
%add250 = add nsw i32 %a1.4598, %mul249
%add251 = add nsw i32 %add250, %a2.4599
%cmp252 = icmp slt i32 %add251, %n
br i1 %cmp252, label %while.body255, label %for.inc340
while.body255: ; preds = %land.rhs247
%cmp256 = icmp eq i32 %a1.4598, %unit.0606
br i1 %cmp256, label %if.then258, label %if.else272
if.then258: ; preds = %while.body255
%add262 = add nsw i32 %a2.4599, %mul278
%idxprom263 = sext i32 %add262 to i64
%arrayidx264 = getelementptr inbounds double, ptr %a, i64 %idxprom263
%14 = load double, ptr %arrayidx264, align 8, !tbaa !11
%idxprom269 = sext i32 %add251 to i64
%arrayidx270 = getelementptr inbounds double, ptr %call, i64 %idxprom269
store double %14, ptr %arrayidx270, align 8, !tbaa !11
%inc271 = add nsw i32 %a2.4599, 1
br label %if.end338
if.else272: ; preds = %while.body255
%cmp273 = icmp eq i32 %a2.4599, %unit.0606
br i1 %cmp273, label %if.then282, label %lor.lhs.false275
lor.lhs.false275: ; preds = %if.else272
%add279 = add nsw i32 %a2.4599, %mul278
%cmp280 = icmp eq i32 %add279, %n
br i1 %cmp280, label %if.then282, label %if.else295
if.then282: ; preds = %lor.lhs.false275, %if.else272
%idxprom286 = sext i32 %add250 to i64
%arrayidx287 = getelementptr inbounds double, ptr %a, i64 %idxprom286
%15 = load double, ptr %arrayidx287, align 8, !tbaa !11
%idxprom292 = sext i32 %add251 to i64
%arrayidx293 = getelementptr inbounds double, ptr %call, i64 %idxprom292
store double %15, ptr %arrayidx293, align 8, !tbaa !11
%inc294 = add nsw i32 %a1.4598, 1
br label %if.end338
if.else295: ; preds = %lor.lhs.false275
%idxprom300 = sext i32 %add279 to i64
%arrayidx301 = getelementptr inbounds double, ptr %a, i64 %idxprom300
%16 = load double, ptr %arrayidx301, align 8, !tbaa !11
%idxprom305 = sext i32 %add250 to i64
%arrayidx306 = getelementptr inbounds double, ptr %a, i64 %idxprom305
%17 = load double, ptr %arrayidx306, align 8, !tbaa !11
%cmp307 = fcmp olt double %16, %17
%idxprom319 = sext i32 %add251 to i64
%arrayidx320 = getelementptr inbounds double, ptr %call, i64 %idxprom319
br i1 %cmp307, label %if.then309, label %if.else322
if.then309: ; preds = %if.else295
store double %17, ptr %arrayidx320, align 8, !tbaa !11
%inc321 = add nsw i32 %a1.4598, 1
br label %if.end338
if.else322: ; preds = %if.else295
store double %16, ptr %arrayidx320, align 8, !tbaa !11
%inc335 = add nsw i32 %a2.4599, 1
br label %if.end338
if.end338: ; preds = %if.then282, %if.else322, %if.then309, %if.then258
%a1.5 = phi i32 [ %unit.0606, %if.then258 ], [ %inc294, %if.then282 ], [ %inc321, %if.then309 ], [ %a1.4598, %if.else322 ]
%a2.5 = phi i32 [ %inc271, %if.then258 ], [ %a2.4599, %if.then282 ], [ %a2.4599, %if.then309 ], [ %inc335, %if.else322 ]
%add243 = add nsw i32 %a2.5, %a1.5
%cmp245 = icmp slt i32 %add243, %mul244
br i1 %cmp245, label %land.rhs247, label %for.inc340, !llvm.loop !18
for.inc340: ; preds = %land.rhs247, %if.end338
%inc341 = add nuw nsw i32 %i236.0601, 1
%exitcond620.not = icmp eq i32 %inc341, %div235584587
br i1 %exitcond620.not, label %while.cond.loopexit, label %while.cond242.preheader, !llvm.loop !19
while.end359: ; preds = %while.cond.loopexit, %entry, %for.body114.preheader, %while.cond.preheader, %for.cond110.preheader
tail call void @free(ptr noundef %call) #9
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree willreturn
declare double @ldexp(double, i32) local_unnamed_addr #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree willreturn }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { nounwind }
attributes #10 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
int main() {
int n, m, a, b, c, d;
scanf("%d %d", &n, &m);
int student[n][2];
int point[m][2];
for (int i = 0; i < n; i++) {
scanf("%d %d", &a, &b);
student[i][0] = a;
student[i][1] = b;
}
for (int j = 0; j < m; j++) {
scanf("%d %d", &c, &d);
point[j][0] = c;
point[j][1] = d;
}
for (int k = 0; k < n; k++) {
int mysum = INT_MAX;
int checkpoint = -1;
for (int l = 0; l < m; l++) {
//printf("%d %d %d %d\n", student[k][0], student[k][1], point[l][0], point[l][1]);
int temp = abs(student[k][0] - point[l][0]) + abs(student[k][1] - point[l][1]);
//printf("temp=%d %d\n",temp,checkpoint);
if (temp < mysum) {
mysum = temp;
checkpoint = l + 1;
}
}
printf("%d\n", checkpoint);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138214/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138214/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5
%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 !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca [2 x i32], i64 %1, align 16
%3 = load i32, ptr %m, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca [2 x i32], i64 %4, align 16
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp66 = icmp sgt i32 %5, 0
br i1 %cmp66, label %for.body, label %for.cond7.preheader
for.cond7.preheader.loopexit: ; preds = %for.body
%.pre = load i32, ptr %m, align 4, !tbaa !5
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.cond7.preheader.loopexit, %entry
%6 = phi i32 [ %10, %for.cond7.preheader.loopexit ], [ %5, %entry ]
%7 = phi i32 [ %.pre, %for.cond7.preheader.loopexit ], [ %3, %entry ]
%cmp868 = icmp sgt i32 %7, 0
br i1 %cmp868, label %for.body10, label %for.cond21.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%8 = load i32, ptr %a, align 4, !tbaa !5
%arrayidx = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv
store i32 %8, ptr %arrayidx, align 8, !tbaa !5
%9 = load i32, ptr %b, align 4, !tbaa !5
%arrayidx6 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv, i64 1
store i32 %9, ptr %arrayidx6, align 4, !tbaa !5
%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
%cmp = icmp slt i64 %indvars.iv.next, %11
br i1 %cmp, label %for.body, label %for.cond7.preheader.loopexit, !llvm.loop !9
for.cond21.preheader.loopexit: ; preds = %for.body10
%.pre86 = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond21.preheader
for.cond21.preheader: ; preds = %for.cond21.preheader.loopexit, %for.cond7.preheader
%12 = phi i32 [ %.pre86, %for.cond21.preheader.loopexit ], [ %6, %for.cond7.preheader ]
%cmp2274 = icmp sgt i32 %12, 0
br i1 %cmp2274, label %for.cond25.preheader, label %for.cond.cleanup23
for.body10: ; preds = %for.cond7.preheader, %for.body10
%indvars.iv77 = phi i64 [ %indvars.iv.next78, %for.body10 ], [ 0, %for.cond7.preheader ]
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c, ptr noundef nonnull %d)
%13 = load i32, ptr %c, align 4, !tbaa !5
%arrayidx13 = getelementptr inbounds [2 x i32], ptr %vla1, i64 %indvars.iv77
store i32 %13, ptr %arrayidx13, align 8, !tbaa !5
%14 = load i32, ptr %d, align 4, !tbaa !5
%arrayidx17 = getelementptr inbounds [2 x i32], ptr %vla1, i64 %indvars.iv77, i64 1
store i32 %14, ptr %arrayidx17, align 4, !tbaa !5
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%15 = load i32, ptr %m, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp8 = icmp slt i64 %indvars.iv.next78, %16
br i1 %cmp8, label %for.body10, label %for.cond21.preheader.loopexit, !llvm.loop !11
for.cond25.preheader: ; preds = %for.cond21.preheader, %for.cond.cleanup27
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.cond.cleanup27 ], [ 0, %for.cond21.preheader ]
%17 = load i32, ptr %m, align 4, !tbaa !5
%cmp2670 = icmp sgt i32 %17, 0
br i1 %cmp2670, label %for.body28.lr.ph, label %for.cond.cleanup27
for.body28.lr.ph: ; preds = %for.cond25.preheader
%arrayidx30 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv83
%18 = load <2 x i32>, ptr %arrayidx30, align 8, !tbaa !5
%wide.trip.count = zext i32 %17 to i64
br label %for.body28
for.cond.cleanup23: ; preds = %for.cond.cleanup27, %for.cond21.preheader
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
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
for.cond.cleanup27: ; preds = %for.body28, %for.cond25.preheader
%checkpoint.0.lcssa = phi i32 [ -1, %for.cond25.preheader ], [ %spec.select65, %for.body28 ]
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %checkpoint.0.lcssa)
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%19 = load i32, ptr %n, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp22 = icmp slt i64 %indvars.iv.next84, %20
br i1 %cmp22, label %for.cond25.preheader, label %for.cond.cleanup23, !llvm.loop !12
for.body28: ; preds = %for.body28.lr.ph, %for.body28
%indvars.iv80 = phi i64 [ 0, %for.body28.lr.ph ], [ %indvars.iv.next81, %for.body28 ]
%checkpoint.072 = phi i32 [ -1, %for.body28.lr.ph ], [ %spec.select65, %for.body28 ]
%mysum.071 = phi i32 [ 2147483647, %for.body28.lr.ph ], [ %spec.select, %for.body28 ]
%arrayidx33 = getelementptr inbounds [2 x i32], ptr %vla1, i64 %indvars.iv80
%21 = load <2 x i32>, ptr %arrayidx33, align 8, !tbaa !5
%22 = sub nsw <2 x i32> %18, %21
%23 = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %22, i1 true)
%shift = shufflevector <2 x i32> %23, <2 x i32> poison, <2 x i32> <i32 1, i32 poison>
%24 = add nuw nsw <2 x i32> %shift, %23
%add = extractelement <2 x i32> %24, i64 0
%cmp42 = icmp slt i32 %add, %mysum.071
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%spec.select = call i32 @llvm.smin.i32(i32 %add, i32 %mysum.071)
%25 = trunc i64 %indvars.iv.next81 to i32
%spec.select65 = select i1 %cmp42, i32 %25, i32 %checkpoint.072
%exitcond.not = icmp eq i64 %indvars.iv.next81, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup27, label %for.body28, !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
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.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i32> @llvm.abs.v2i32(<2 x i32>, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#define abs(x) ((x) > 0 ? (x) : -(x))
struct grid {
int x, y;
};
int d(struct grid r1, struct grid r2){
return abs(r1.x - r2.x) + abs(r1.y - r2.y);
}
int
main(int argc, char *argv[])
{
int n, m;
struct grid a[50], b[50];
scanf("%d %d", &n, &m);
for(int i = 0; i < n; i++) scanf("%d %d", &a[i].x, &a[i].y);
for(int i = 0; i < m; i++) scanf("%d %d", &b[i].x, &b[i].y);
int ans, min, temp;
for(int i = 0; i < n; i++){
min = 1000000000;
for(int j = 0; j < m; j++){
temp = d(a[i], b[j]);
if(min > temp){
min = temp;
ans = j + 1;
}
}
printf("%d\n", ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138265/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138265/source.c"
target datalayout = "e-m:e-p270: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.grid = type { i32, i32 }
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @d(i64 %r1.coerce, i64 %r2.coerce) local_unnamed_addr #0 {
entry:
%r1.sroa.0.0.extract.trunc = trunc i64 %r1.coerce to i32
%r1.sroa.4.0.extract.shift = lshr i64 %r1.coerce, 32
%r1.sroa.4.0.extract.trunc = trunc i64 %r1.sroa.4.0.extract.shift to i32
%r2.sroa.0.0.extract.trunc = trunc i64 %r2.coerce to i32
%r2.sroa.4.0.extract.shift = lshr i64 %r2.coerce, 32
%r2.sroa.4.0.extract.trunc = trunc i64 %r2.sroa.4.0.extract.shift to i32
%sub = sub nsw i32 %r1.sroa.0.0.extract.trunc, %r2.sroa.0.0.extract.trunc
%cond = tail call i32 @llvm.abs.i32(i32 %sub, i1 true)
%sub10 = sub nsw i32 %r1.sroa.4.0.extract.trunc, %r2.sroa.4.0.extract.trunc
%cond22 = tail call i32 @llvm.abs.i32(i32 %sub10, i1 true)
%add = add nuw nsw i32 %cond22, %cond
ret i32 %add
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca [50 x %struct.grid], align 16
%b = alloca [50 x %struct.grid], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %b) #5
%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 !5
%cmp54 = icmp sgt i32 %0, 0
br i1 %cmp54, label %for.body, label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %3, %for.body ]
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp656 = icmp sgt i32 %2, 0
br i1 %cmp656, label %for.body8, label %for.cond20.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x %struct.grid], ptr %a, i64 0, i64 %indvars.iv
%y = getelementptr inbounds [50 x %struct.grid], ptr %a, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %y)
%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 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond5.preheader, !llvm.loop !9
for.cond20.preheader.loopexit: ; preds = %for.body8
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.cond20.preheader.loopexit, %for.cond5.preheader
%5 = phi i32 [ %.pre, %for.cond20.preheader.loopexit ], [ %1, %for.cond5.preheader ]
%cmp2162 = icmp sgt i32 %5, 0
br i1 %cmp2162, label %for.cond24.preheader, label %for.cond.cleanup22
for.body8: ; preds = %for.cond5.preheader, %for.body8
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.body8 ], [ 0, %for.cond5.preheader ]
%arrayidx10 = getelementptr inbounds [50 x %struct.grid], ptr %b, i64 0, i64 %indvars.iv66
%y14 = getelementptr inbounds [50 x %struct.grid], ptr %b, i64 0, i64 %indvars.iv66, i32 1
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx10, ptr noundef nonnull %y14)
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%6 = load i32, ptr %m, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp6 = icmp slt i64 %indvars.iv.next67, %7
br i1 %cmp6, label %for.body8, label %for.cond20.preheader.loopexit, !llvm.loop !11
for.cond24.preheader: ; preds = %for.cond20.preheader, %for.cond.cleanup26
%indvars.iv72 = phi i64 [ %indvars.iv.next73, %for.cond.cleanup26 ], [ 0, %for.cond20.preheader ]
%ans.063 = phi i32 [ %ans.1.lcssa, %for.cond.cleanup26 ], [ undef, %for.cond20.preheader ]
%8 = load i32, ptr %m, align 4, !tbaa !5
%cmp2558 = icmp sgt i32 %8, 0
br i1 %cmp2558, label %for.body27.lr.ph, label %for.cond.cleanup26
for.body27.lr.ph: ; preds = %for.cond24.preheader
%arrayidx29 = getelementptr inbounds [50 x %struct.grid], ptr %a, i64 0, i64 %indvars.iv72
%9 = load i64, ptr %arrayidx29, align 8
%r1.sroa.0.0.extract.trunc.i = trunc i64 %9 to i32
%r1.sroa.4.0.extract.shift.i = lshr i64 %9, 32
%r1.sroa.4.0.extract.trunc.i = trunc i64 %r1.sroa.4.0.extract.shift.i to i32
%wide.trip.count = zext i32 %8 to i64
br label %for.body27
for.cond.cleanup22: ; preds = %for.cond.cleanup26, %for.cond20.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.cond.cleanup26: ; preds = %for.body27, %for.cond24.preheader
%ans.1.lcssa = phi i32 [ %ans.063, %for.cond24.preheader ], [ %spec.select, %for.body27 ]
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.1.lcssa)
%indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp21 = icmp slt i64 %indvars.iv.next73, %11
br i1 %cmp21, label %for.cond24.preheader, label %for.cond.cleanup22, !llvm.loop !12
for.body27: ; preds = %for.body27.lr.ph, %for.body27
%indvars.iv69 = phi i64 [ 0, %for.body27.lr.ph ], [ %indvars.iv.next70, %for.body27 ]
%min.060 = phi i32 [ 1000000000, %for.body27.lr.ph ], [ %spec.select53, %for.body27 ]
%ans.159 = phi i32 [ %ans.063, %for.body27.lr.ph ], [ %spec.select, %for.body27 ]
%arrayidx31 = getelementptr inbounds [50 x %struct.grid], ptr %b, i64 0, i64 %indvars.iv69
%12 = load i64, ptr %arrayidx31, align 8
%r2.sroa.0.0.extract.trunc.i = trunc i64 %12 to i32
%r2.sroa.4.0.extract.shift.i = lshr i64 %12, 32
%r2.sroa.4.0.extract.trunc.i = trunc i64 %r2.sroa.4.0.extract.shift.i to i32
%sub.i = sub nsw i32 %r1.sroa.0.0.extract.trunc.i, %r2.sroa.0.0.extract.trunc.i
%cond.i = call i32 @llvm.abs.i32(i32 %sub.i, i1 true)
%sub10.i = sub nsw i32 %r1.sroa.4.0.extract.trunc.i, %r2.sroa.4.0.extract.trunc.i
%cond22.i = call i32 @llvm.abs.i32(i32 %sub10.i, i1 true)
%add.i = add nuw nsw i32 %cond22.i, %cond.i
%cmp33 = icmp sgt i32 %min.060, %add.i
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%13 = trunc i64 %indvars.iv.next70 to i32
%spec.select = select i1 %cmp33, i32 %13, i32 %ans.159
%spec.select53 = call i32 @llvm.smin.i32(i32 %min.060, i32 %add.i)
%exitcond.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup26, label %for.body27, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree 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.abs.i32(i32, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int descending_compare(const void *a, const void *b){
if (*(int*)a > *(int*)b){
return -1;
}else if (*(int*)a == *(int*)b){
return 0;
}else{
return 1;
}
}
int ascending_compare(const void *a, const void *b){
if (*(int*)a < *(int*)b){
return -1;
}else if (*(int*)a == *(int*)b){
return 0;
}else{
return 1;
}
}
int lower_bound(int *a, int n, int key){
int left, mid, right;
left = 0, right = n;
mid = (left + right)/2;
while ((left+1 != mid || mid+1 != right) && mid != left){
if (key > a[mid]){
left = mid;
}else{
right = mid+1;
}
mid = (left + right)/2;
}
if (a[left] >= key)return left;
if (a[mid] >= key)return mid;
if (a[right] >= key)return right;
return n;
}
//greatest common divisor
unsigned long gcd(unsigned long x, unsigned long y){
if (y == 0){
return x;
}else if (x > y){
return gcd(y, x % y);
}else{
return gcd(x, y % x);
}
}
long long factorial(int x){
long long rtn = 1;
int i;
for (i = x; i > 1; i--){
rtn = (rtn*i);
}
return rtn;
}
int a[55];
int b[55];
int c[55];
int d[55];
int main(void){
int n, m;
int min;
int mini;
scanf("%d %d", &n, &m);
for (int i = 0; i < n; i++){
scanf("%d %d", &a[i], &b[i]);
}
for (int i = 0; i < m; i++){
scanf("%d %d", &c[i], &d[i]);
}
for (int i = 0; i < n; i++){
min = 1000000000;
for (int j = m-1; j >= 0; j--){
if (min >= abs(a[i]-c[j]) + abs(b[i]-d[j])){
min = abs(a[i]-c[j]) + abs(b[i]-d[j]);
mini = j+1;
}
}
printf("%d\n", mini);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138308/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138308/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@a = dso_local global [55 x i32] zeroinitializer, align 16
@b = dso_local global [55 x i32] zeroinitializer, align 16
@c = dso_local global [55 x i32] zeroinitializer, align 16
@d = dso_local global [55 x i32] zeroinitializer, align 16
@.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 @descending_compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ascending_compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @lower_bound(ptr nocapture noundef readonly %a, i32 noundef %n, i32 noundef %key) local_unnamed_addr #1 {
entry:
%mid.050 = sdiv i32 %n, 2
%0 = and i32 %n, -2
%cmp.not51 = icmp eq i32 %0, 2
%add252 = add nsw i32 %mid.050, 1
%cmp3.not53 = icmp eq i32 %add252, %n
%or.cond54 = select i1 %cmp.not51, i1 %cmp3.not53, i1 false
%n.off = add i32 %n, 1
%cmp4.not55 = icmp ult i32 %n.off, 3
%or.cond4956 = or i1 %cmp4.not55, %or.cond54
br i1 %or.cond4956, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%add260 = phi i32 [ %add2, %while.body ], [ %add252, %entry ]
%mid.059 = phi i32 [ %mid.0, %while.body ], [ %mid.050, %entry ]
%right.058 = phi i32 [ %right.1, %while.body ], [ %n, %entry ]
%left.057 = phi i32 [ %left.1, %while.body ], [ 0, %entry ]
%idxprom = sext i32 %mid.059 to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5 = icmp slt i32 %1, %key
%left.1 = select i1 %cmp5, i32 %mid.059, i32 %left.057
%right.1 = select i1 %cmp5, i32 %right.058, i32 %add260
%add7 = add nsw i32 %left.1, %right.1
%mid.0 = sdiv i32 %add7, 2
%add1 = add nsw i32 %left.1, 1
%cmp.not = icmp eq i32 %add1, %mid.0
%add2 = add nsw i32 %mid.0, 1
%cmp3.not = icmp eq i32 %add2, %right.1
%or.cond = select i1 %cmp.not, i1 %cmp3.not, i1 false
%cmp4.not = icmp eq i32 %mid.0, %left.1
%or.cond49 = or i1 %cmp4.not, %or.cond
br i1 %or.cond49, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%left.0.lcssa = phi i32 [ 0, %entry ], [ %left.1, %while.body ]
%right.0.lcssa = phi i32 [ %n, %entry ], [ %right.1, %while.body ]
%mid.0.lcssa = phi i32 [ %mid.050, %entry ], [ %mid.0, %while.body ]
%idxprom9 = sext i32 %left.0.lcssa to i64
%arrayidx10 = getelementptr inbounds i32, ptr %a, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11.not = icmp slt i32 %2, %key
br i1 %cmp11.not, label %if.end13, label %cleanup
if.end13: ; preds = %while.end
%idxprom14 = sext i32 %mid.0.lcssa to i64
%arrayidx15 = getelementptr inbounds i32, ptr %a, i64 %idxprom14
%3 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%cmp16.not = icmp slt i32 %3, %key
br i1 %cmp16.not, label %if.end18, label %cleanup
if.end18: ; preds = %if.end13
%idxprom19 = sext i32 %right.0.lcssa to i64
%arrayidx20 = getelementptr inbounds i32, ptr %a, i64 %idxprom19
%4 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.not = icmp slt i32 %4, %key
%n.right.0 = select i1 %cmp21.not, i32 %n, i32 %right.0.lcssa
br label %cleanup
cleanup: ; preds = %if.end18, %if.end13, %while.end
%retval.0 = phi i32 [ %left.0.lcssa, %while.end ], [ %mid.0.lcssa, %if.end13 ], [ %n.right.0, %if.end18 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #3 {
entry:
%cmp1518 = icmp eq i64 %y, 0
br i1 %cmp1518, label %return, label %if.else.lr.ph
if.else.lr.ph: ; preds = %entry, %if.then2
%y.tr.ph20 = phi i64 [ %rem, %if.then2 ], [ %y, %entry ]
%x.tr.ph19 = phi i64 [ %y.tr16, %if.then2 ], [ %x, %entry ]
br label %if.else
if.else: ; preds = %if.else.lr.ph, %if.else3
%y.tr16 = phi i64 [ %y.tr.ph20, %if.else.lr.ph ], [ %rem4, %if.else3 ]
%cmp1 = icmp ugt i64 %x.tr.ph19, %y.tr16
br i1 %cmp1, label %if.then2, label %if.else3
if.then2: ; preds = %if.else
%rem = urem i64 %x.tr.ph19, %y.tr16
%cmp15 = icmp eq i64 %rem, 0
br i1 %cmp15, label %return, label %if.else.lr.ph
if.else3: ; preds = %if.else
%rem4 = urem i64 %y.tr16, %x.tr.ph19
%cmp = icmp eq i64 %rem4, 0
br i1 %cmp, label %return, label %if.else
return: ; preds = %if.then2, %if.else3, %entry
%x.tr.ph.lcssa = phi i64 [ %x, %entry ], [ %x.tr.ph19, %if.else3 ], [ %y.tr16, %if.then2 ]
ret i64 %x.tr.ph.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @factorial(i32 noundef %x) local_unnamed_addr #3 {
entry:
%cmp4 = icmp sgt i32 %x, 1
br i1 %cmp4, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = zext i32 %x to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%rtn.05 = phi i64 [ 1, %for.body.preheader ], [ %mul, %for.body ]
%mul = mul nsw i64 %rtn.05, %indvars.iv
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp = icmp ugt i64 %indvars.iv, 2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%rtn.0.lcssa = phi i64 [ 1, %entry ], [ %mul, %for.body ]
ret i64 %rtn.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
%m = 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp73 = icmp sgt i32 %0, 0
br i1 %cmp73, label %for.body, label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %3, %for.body ]
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp675 = icmp sgt i32 %2, 0
br i1 %cmp675, label %for.body8, label %for.cond18.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [55 x i32], ptr @a, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [55 x i32], ptr @b, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%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 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond5.preheader, !llvm.loop !12
for.cond18.preheader.loopexit: ; preds = %for.body8
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond18.preheader
for.cond18.preheader: ; preds = %for.cond18.preheader.loopexit, %for.cond5.preheader
%5 = phi i32 [ %.pre, %for.cond18.preheader.loopexit ], [ %1, %for.cond5.preheader ]
%cmp1981 = icmp sgt i32 %5, 0
br i1 %cmp1981, label %for.body21, label %for.cond.cleanup20
for.body8: ; preds = %for.cond5.preheader, %for.body8
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.body8 ], [ 0, %for.cond5.preheader ]
%arrayidx10 = getelementptr inbounds [55 x i32], ptr @c, i64 0, i64 %indvars.iv85
%arrayidx12 = getelementptr inbounds [55 x i32], ptr @d, i64 0, i64 %indvars.iv85
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx10, ptr noundef nonnull %arrayidx12)
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%6 = load i32, ptr %m, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp6 = icmp slt i64 %indvars.iv.next86, %7
br i1 %cmp6, label %for.body8, label %for.cond18.preheader.loopexit, !llvm.loop !13
for.cond.cleanup20: ; preds = %for.cond.cleanup24, %for.cond18.preheader
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
for.body21: ; preds = %for.cond18.preheader, %for.cond.cleanup24
%indvars.iv91 = phi i64 [ %indvars.iv.next92, %for.cond.cleanup24 ], [ 0, %for.cond18.preheader ]
%mini.082 = phi i32 [ %mini.1.lcssa, %for.cond.cleanup24 ], [ undef, %for.cond18.preheader ]
%8 = load i32, ptr %m, align 4, !tbaa !5
%cmp2377 = icmp sgt i32 %8, 0
br i1 %cmp2377, label %for.body25.lr.ph, label %for.cond.cleanup24
for.body25.lr.ph: ; preds = %for.body21
%arrayidx27 = getelementptr inbounds [55 x i32], ptr @a, i64 0, i64 %indvars.iv91
%9 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%arrayidx32 = getelementptr inbounds [55 x i32], ptr @b, i64 0, i64 %indvars.iv91
%10 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%11 = zext i32 %8 to i64
br label %for.body25
for.cond.cleanup24: ; preds = %for.body25, %for.body21
%mini.1.lcssa = phi i32 [ %mini.082, %for.body21 ], [ %spec.select72, %for.body25 ]
%call51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mini.1.lcssa)
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp19 = icmp slt i64 %indvars.iv.next92, %13
br i1 %cmp19, label %for.body21, label %for.cond.cleanup20, !llvm.loop !14
for.body25: ; preds = %for.body25.lr.ph, %for.body25
%indvars.iv88 = phi i64 [ %11, %for.body25.lr.ph ], [ %indvars.iv.next89, %for.body25 ]
%mini.179 = phi i32 [ %mini.082, %for.body25.lr.ph ], [ %spec.select72, %for.body25 ]
%min.078 = phi i32 [ 1000000000, %for.body25.lr.ph ], [ %spec.select, %for.body25 ]
%indvars.iv.next89 = add nsw i64 %indvars.iv88, -1
%idxprom28 = and i64 %indvars.iv.next89, 4294967295
%arrayidx29 = getelementptr inbounds [55 x i32], ptr @c, i64 0, i64 %idxprom28
%14 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%sub30 = sub nsw i32 %9, %14
%15 = call i32 @llvm.abs.i32(i32 %sub30, i1 true)
%arrayidx34 = getelementptr inbounds [55 x i32], ptr @d, i64 0, i64 %idxprom28
%16 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%sub35 = sub nsw i32 %10, %16
%17 = call i32 @llvm.abs.i32(i32 %sub35, i1 true)
%add = add nuw nsw i32 %17, %15
%cmp36.not = icmp slt i32 %min.078, %add
%spec.select = call i32 @llvm.smin.i32(i32 %min.078, i32 %add)
%18 = trunc i64 %indvars.iv88 to i32
%spec.select72 = select i1 %cmp36.not, i32 %mini.179, i32 %18
%cmp23 = icmp ugt i64 %indvars.iv88, 1
br i1 %cmp23, label %for.body25, label %for.cond.cleanup24, !llvm.loop !15
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #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.smin.i32(i32, i32) #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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}
!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>
#include<stdlib.h>
int main(void){
int N,M,i,j,target;
int a[51],b[51],c[51],d[51];
int dist[51][51];
scanf("%d %d",&N,&M);
for(i=0;i<N;i++){
scanf("%d %d",&a[i],&b[i]);
}
for(i=0;i<M;i++){
scanf("%d %d",&c[i],&d[i]);
}
for(i=0;i<N;i++){
for(j=0;j<M;j++){
dist[i][j]=abs(a[i]-c[j])+abs(b[i]-d[j]);
}
target=0;
for(j=1;j<M;j++){
if(dist[i][j]<dist[i][target]) target=j;
}
printf("%d\n",target+1);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138351/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138351/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%M = alloca i32, align 4
%a = alloca [51 x i32], align 16
%b = alloca [51 x i32], align 16
%c = alloca [51 x i32], align 16
%d = alloca [51 x i32], align 16
%dist = alloca [51 x [51 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #5
call void @llvm.lifetime.start.p0(i64 204, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 204, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 204, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 204, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 10404, ptr nonnull %dist) #5
%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 !5
%cmp80 = icmp sgt i32 %0, 0
br i1 %cmp80, label %for.body, label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %3, %for.body ]
%2 = load i32, ptr %M, align 4, !tbaa !5
%cmp582 = icmp sgt i32 %2, 0
br i1 %cmp582, label %for.body6, label %for.cond15.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 %a, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [51 x i32], ptr %b, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%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 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond15.preheader.loopexit: ; preds = %for.body6
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.cond15.preheader
for.cond15.preheader: ; preds = %for.cond15.preheader.loopexit, %for.cond4.preheader
%5 = phi i32 [ %.pre, %for.cond15.preheader.loopexit ], [ %1, %for.cond4.preheader ]
%cmp1690 = icmp sgt i32 %5, 0
br i1 %cmp1690, label %for.cond18.preheader, label %for.end56
for.body6: ; preds = %for.cond4.preheader, %for.body6
%indvars.iv93 = phi i64 [ %indvars.iv.next94, %for.body6 ], [ 0, %for.cond4.preheader ]
%arrayidx8 = getelementptr inbounds [51 x i32], ptr %c, i64 0, i64 %indvars.iv93
%arrayidx10 = getelementptr inbounds [51 x i32], ptr %d, i64 0, i64 %indvars.iv93
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8, ptr noundef nonnull %arrayidx10)
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%6 = load i32, ptr %M, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp5 = icmp slt i64 %indvars.iv.next94, %7
br i1 %cmp5, label %for.body6, label %for.cond15.preheader.loopexit, !llvm.loop !11
for.cond18.preheader: ; preds = %for.cond15.preheader, %for.end51
%indvars.iv104 = phi i64 [ %indvars.iv.next105, %for.end51 ], [ 0, %for.cond15.preheader ]
%8 = load i32, ptr %M, align 4, !tbaa !5
%cmp1984 = icmp sgt i32 %8, 0
br i1 %cmp1984, label %for.body20.lr.ph, label %for.end51
for.body20.lr.ph: ; preds = %for.cond18.preheader
%arrayidx22 = getelementptr inbounds [51 x i32], ptr %a, i64 0, i64 %indvars.iv104
%9 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%arrayidx26 = getelementptr inbounds [51 x i32], ptr %b, i64 0, i64 %indvars.iv104
%10 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%wide.trip.count = zext i32 %8 to i64
%min.iters.check = icmp ult i32 %8, 8
br i1 %min.iters.check, label %for.body20.preheader, label %vector.ph
vector.ph: ; preds = %for.body20.lr.ph
%n.vec = and i64 %wide.trip.count, 4294967288
%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
%broadcast.splatinsert111 = insertelement <4 x i32> poison, i32 %10, i64 0
%broadcast.splat112 = shufflevector <4 x i32> %broadcast.splatinsert111, <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 ]
%11 = getelementptr inbounds [51 x i32], ptr %c, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %11, align 16, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 4
%wide.load108 = load <4 x i32>, ptr %12, align 16, !tbaa !5
%13 = sub nsw <4 x i32> %broadcast.splat, %wide.load
%14 = sub nsw <4 x i32> %broadcast.splat, %wide.load108
%15 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %13, i1 true)
%16 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %14, i1 true)
%17 = getelementptr inbounds [51 x i32], ptr %d, i64 0, i64 %index
%wide.load109 = load <4 x i32>, ptr %17, align 16, !tbaa !5
%18 = getelementptr inbounds i32, ptr %17, i64 4
%wide.load110 = load <4 x i32>, ptr %18, align 16, !tbaa !5
%19 = sub nsw <4 x i32> %broadcast.splat112, %wide.load109
%20 = sub nsw <4 x i32> %broadcast.splat112, %wide.load110
%21 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %19, i1 true)
%22 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %20, i1 true)
%23 = add nuw nsw <4 x i32> %21, %15
%24 = add nuw nsw <4 x i32> %22, %16
%25 = getelementptr inbounds [51 x [51 x i32]], ptr %dist, i64 0, i64 %indvars.iv104, i64 %index
store <4 x i32> %23, ptr %25, align 4, !tbaa !5
%26 = getelementptr inbounds i32, ptr %25, i64 4
store <4 x i32> %24, ptr %26, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%27 = icmp eq i64 %index.next, %n.vec
br i1 %27, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond37.preheader, label %for.body20.preheader
for.body20.preheader: ; preds = %for.body20.lr.ph, %middle.block
%indvars.iv96.ph = phi i64 [ 0, %for.body20.lr.ph ], [ %n.vec, %middle.block ]
br label %for.body20
for.cond37.preheader: ; preds = %for.body20, %middle.block
%cmp3886 = icmp sgt i32 %8, 1
br i1 %cmp3886, label %for.body39.lr.ph, label %for.end51
for.body39.lr.ph: ; preds = %for.cond37.preheader
%wide.trip.count102 = zext i32 %8 to i64
%28 = add nsw i64 %wide.trip.count102, -1
%xtraiter = and i64 %28, 1
%29 = icmp eq i32 %8, 2
br i1 %29, label %for.end51.loopexit.unr-lcssa, label %for.body39.lr.ph.new
for.body39.lr.ph.new: ; preds = %for.body39.lr.ph
%unroll_iter = and i64 %28, -2
br label %for.body39
for.body20: ; preds = %for.body20.preheader, %for.body20
%indvars.iv96 = phi i64 [ %indvars.iv.next97, %for.body20 ], [ %indvars.iv96.ph, %for.body20.preheader ]
%arrayidx24 = getelementptr inbounds [51 x i32], ptr %c, i64 0, i64 %indvars.iv96
%30 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%sub = sub nsw i32 %9, %30
%31 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%arrayidx28 = getelementptr inbounds [51 x i32], ptr %d, i64 0, i64 %indvars.iv96
%32 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%sub29 = sub nsw i32 %10, %32
%33 = call i32 @llvm.abs.i32(i32 %sub29, i1 true)
%add = add nuw nsw i32 %33, %31
%arrayidx33 = getelementptr inbounds [51 x [51 x i32]], ptr %dist, i64 0, i64 %indvars.iv104, i64 %indvars.iv96
store i32 %add, ptr %arrayidx33, align 4, !tbaa !5
%indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
%exitcond.not = icmp eq i64 %indvars.iv.next97, %wide.trip.count
br i1 %exitcond.not, label %for.cond37.preheader, label %for.body20, !llvm.loop !15
for.body39: ; preds = %for.body39, %for.body39.lr.ph.new
%indvars.iv99 = phi i64 [ 1, %for.body39.lr.ph.new ], [ %indvars.iv.next100.1, %for.body39 ]
%target.088 = phi i32 [ 0, %for.body39.lr.ph.new ], [ %spec.select.1, %for.body39 ]
%niter = phi i64 [ 0, %for.body39.lr.ph.new ], [ %niter.next.1, %for.body39 ]
%arrayidx43 = getelementptr inbounds [51 x [51 x i32]], ptr %dist, i64 0, i64 %indvars.iv104, i64 %indvars.iv99
%34 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%idxprom46 = sext i32 %target.088 to i64
%arrayidx47 = getelementptr inbounds [51 x [51 x i32]], ptr %dist, i64 0, i64 %indvars.iv104, i64 %idxprom46
%35 = load i32, ptr %arrayidx47, align 4, !tbaa !5
%cmp48 = icmp slt i32 %34, %35
%36 = trunc i64 %indvars.iv99 to i32
%spec.select = select i1 %cmp48, i32 %36, i32 %target.088
%indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
%arrayidx43.1 = getelementptr inbounds [51 x [51 x i32]], ptr %dist, i64 0, i64 %indvars.iv104, i64 %indvars.iv.next100
%37 = load i32, ptr %arrayidx43.1, align 4, !tbaa !5
%idxprom46.1 = sext i32 %spec.select to i64
%arrayidx47.1 = getelementptr inbounds [51 x [51 x i32]], ptr %dist, i64 0, i64 %indvars.iv104, i64 %idxprom46.1
%38 = load i32, ptr %arrayidx47.1, align 4, !tbaa !5
%cmp48.1 = icmp slt i32 %37, %38
%39 = trunc i64 %indvars.iv.next100 to i32
%spec.select.1 = select i1 %cmp48.1, i32 %39, i32 %spec.select
%indvars.iv.next100.1 = add nuw nsw i64 %indvars.iv99, 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.end51.loopexit.unr-lcssa, label %for.body39, !llvm.loop !16
for.end51.loopexit.unr-lcssa: ; preds = %for.body39, %for.body39.lr.ph
%spec.select.lcssa.ph = phi i32 [ undef, %for.body39.lr.ph ], [ %spec.select.1, %for.body39 ]
%indvars.iv99.unr = phi i64 [ 1, %for.body39.lr.ph ], [ %indvars.iv.next100.1, %for.body39 ]
%target.088.unr = phi i32 [ 0, %for.body39.lr.ph ], [ %spec.select.1, %for.body39 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end51, label %for.body39.epil
for.body39.epil: ; preds = %for.end51.loopexit.unr-lcssa
%arrayidx43.epil = getelementptr inbounds [51 x [51 x i32]], ptr %dist, i64 0, i64 %indvars.iv104, i64 %indvars.iv99.unr
%40 = load i32, ptr %arrayidx43.epil, align 4, !tbaa !5
%idxprom46.epil = sext i32 %target.088.unr to i64
%arrayidx47.epil = getelementptr inbounds [51 x [51 x i32]], ptr %dist, i64 0, i64 %indvars.iv104, i64 %idxprom46.epil
%41 = load i32, ptr %arrayidx47.epil, align 4, !tbaa !5
%cmp48.epil = icmp slt i32 %40, %41
%42 = trunc i64 %indvars.iv99.unr to i32
%spec.select.epil = select i1 %cmp48.epil, i32 %42, i32 %target.088.unr
br label %for.end51
for.end51: ; preds = %for.body39.epil, %for.end51.loopexit.unr-lcssa, %for.cond18.preheader, %for.cond37.preheader
%target.0.lcssa = phi i32 [ 0, %for.cond37.preheader ], [ 0, %for.cond18.preheader ], [ %spec.select.lcssa.ph, %for.end51.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body39.epil ]
%add52 = add nsw i32 %target.0.lcssa, 1
%call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add52)
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%43 = load i32, ptr %N, align 4, !tbaa !5
%44 = sext i32 %43 to i64
%cmp16 = icmp slt i64 %indvars.iv.next105, %44
br i1 %cmp16, label %for.cond18.preheader, label %for.end56, !llvm.loop !17
for.end56: ; preds = %for.end51, %for.cond15.preheader
call void @llvm.lifetime.end.p0(i64 10404, ptr nonnull %dist) #5
call void @llvm.lifetime.end.p0(i64 204, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 204, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 204, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 204, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
; Function Attrs: 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 <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define N 200010
#define MAX 1000000000000000000
#define MOD 1000000007
#include <stdio.h>
int main (void) {
int a, b, c, d, takahashi, aoki;
scanf("%d %d %d %d", &a, &b, &c, &d);
takahashi = (c + (b - 1)) / b;
aoki = (a + (d - 1)) / d;
if (takahashi <= aoki) {
puts("Yes");
} else {
puts("No");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138395/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138395/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %c, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = add i32 %0, -1
%add = add i32 %sub, %1
%div = sdiv i32 %add, %1
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %d, align 4, !tbaa !5
%sub1 = add i32 %2, -1
%add2 = add i32 %sub1, %3
%div3 = sdiv i32 %add2, %3
%cmp.not = icmp sgt i32 %div, %div3
%.str.2..str.1 = select i1 %cmp.not, ptr @.str.2, ptr @.str.1
%call5 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int a, b, c, d;
int taka, ao;
scanf("%d%d%d%d", &a, &b, &c, &d);
taka = a / d;
if (a % d)
taka++;
ao = c / b;
if(c % b)
ao++;
if (taka >= ao)
printf("Yes\n");
else
printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138438/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138438/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %d, align 4, !tbaa !5
%div = sdiv i32 %0, %1
%rem = srem i32 %0, %1
%tobool.not = icmp ne i32 %rem, 0
%inc = zext i1 %tobool.not to i32
%spec.select = add nsw i32 %div, %inc
%2 = load i32, ptr %c, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%div1 = sdiv i32 %2, %3
%rem2 = srem i32 %2, %3
%tobool3.not = icmp ne i32 %rem2, 0
%inc5 = zext i1 %tobool3.not to i32
%ao.0 = add nsw i32 %div1, %inc5
%cmp.not = icmp slt i32 %spec.select, %ao.0
%str.str.3 = select i1 %cmp.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int a,b,c,d,z,w;
scanf("%d %d %d %d",&a,&b,&c,&d);
z=0; w=0;
while(1){
a=a-d;
w++;
if(a<=0){
break;
}
}
while(1){
c=c-b;
z++;
if(c<=0){
break;
}
}
if(w<z){
printf("No\n");
}
else{
printf("Yes\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138481/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138481/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c"Yes\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %d, align 4, !tbaa !5
%a.promoted = load i32, ptr %a, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%sub17 = phi i32 [ %a.promoted, %entry ], [ %sub, %while.cond ]
%w.0 = phi i32 [ 0, %entry ], [ %inc, %while.cond ]
%sub = sub nsw i32 %sub17, %0
%inc = add nuw nsw i32 %w.0, 1
%cmp = icmp slt i32 %sub, 1
br i1 %cmp, label %while.cond1.preheader, label %while.cond
while.cond1.preheader: ; preds = %while.cond
store i32 %sub, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%c.promoted = load i32, ptr %c, align 4, !tbaa !5
br label %while.cond1
while.cond1: ; preds = %while.cond1.preheader, %while.cond1
%sub318 = phi i32 [ %sub3, %while.cond1 ], [ %c.promoted, %while.cond1.preheader ]
%z.0 = phi i32 [ %inc4, %while.cond1 ], [ 0, %while.cond1.preheader ]
%sub3 = sub nsw i32 %sub318, %1
%inc4 = add nuw nsw i32 %z.0, 1
%cmp5 = icmp slt i32 %sub3, 1
br i1 %cmp5, label %while.end8, label %while.cond1
while.end8: ; preds = %while.cond1
store i32 %sub3, ptr %c, align 4, !tbaa !5
%cmp9 = icmp ult i32 %w.0, %z.0
%str.3.str = select i1 %cmp9, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int tHP, tAT, aHP, aAT;
scanf("%d %d %d %d", &tHP, &tAT, &aHP, &aAT);
for(;;){
//前半ターン
aHP -= tAT;
if( aHP<=0 ){ printf("Yes\n"); return 0; }
//後半ターン
tHP -= aAT;
if( tHP<=0 ){ printf("No\n"); return 0; }
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138531/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138531/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%tHP = alloca i32, align 4
%tAT = alloca i32, align 4
%aHP = alloca i32, align 4
%aAT = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tHP) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tAT) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %aHP) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %aAT) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tHP, ptr noundef nonnull %tAT, ptr noundef nonnull %aHP, ptr noundef nonnull %aAT)
%0 = load i32, ptr %tAT, align 4, !tbaa !5
%aHP.promoted = load i32, ptr %aHP, align 4, !tbaa !5
%tHP.promoted = load i32, ptr %tHP, align 4, !tbaa !5
%1 = load i32, ptr %aAT, align 4
br label %for.cond
for.cond: ; preds = %if.end, %entry
%sub213 = phi i32 [ %sub2, %if.end ], [ %tHP.promoted, %entry ]
%sub11 = phi i32 [ %sub, %if.end ], [ %aHP.promoted, %entry ]
%sub = sub nsw i32 %sub11, %0
%cmp = icmp slt i32 %sub, 1
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %for.cond
%sub2 = sub nsw i32 %sub213, %1
store i32 %sub2, ptr %tHP, align 4, !tbaa !5
%cmp3 = icmp slt i32 %sub2, 1
br i1 %cmp3, label %cleanup, label %for.cond
cleanup: ; preds = %if.end, %for.cond
%str.sink = phi ptr [ @str.3, %for.cond ], [ @str, %if.end ]
store i32 %sub, ptr %aHP, align 4, !tbaa !5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %aAT) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %aHP) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tAT) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tHP) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
int thp,tak,ahp,aak;
(void)scanf("%d %d %d %d",&thp,&tak,&ahp,&aak);
while(thp>0){
ahp-=tak;
if(ahp<=0){
printf("Yes\n");
break;
}
thp-=aak;
}
if(thp<=0)printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138575/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138575/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c"Yes\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%thp = alloca i32, align 4
%tak = alloca i32, align 4
%ahp = alloca i32, align 4
%aak = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %thp) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tak) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ahp) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %aak) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %thp, ptr noundef nonnull %tak, ptr noundef nonnull %ahp, ptr noundef nonnull %aak)
%.pr = load i32, ptr %thp, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %.pr, 0
br i1 %cmp10, label %while.body.lr.ph, label %if.then5
while.body.lr.ph: ; preds = %entry
%ahp.promoted = load i32, ptr %ahp, align 4, !tbaa !5
%0 = load i32, ptr %tak, align 4, !tbaa !5
%1 = load i32, ptr %aak, align 4
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%2 = phi i32 [ %.pr, %while.body.lr.ph ], [ %sub3, %if.end ]
%sub911 = phi i32 [ %ahp.promoted, %while.body.lr.ph ], [ %sub, %if.end ]
%sub = sub nsw i32 %sub911, %0
%cmp1 = icmp slt i32 %sub, 1
br i1 %cmp1, label %while.end, label %if.end
if.end: ; preds = %while.body
%sub3 = sub nsw i32 %2, %1
store i32 %sub3, ptr %thp, align 4, !tbaa !5
%cmp = icmp sgt i32 %sub3, 0
br i1 %cmp, label %while.body, label %while.cond.while.end.loopexit_crit_edge, !llvm.loop !9
while.cond.while.end.loopexit_crit_edge: ; preds = %if.end
store i32 %sub, ptr %ahp, align 4, !tbaa !5
br label %if.then5
while.end: ; preds = %while.body
store i32 %sub, ptr %ahp, align 4, !tbaa !5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%.pre = load i32, ptr %thp, align 4, !tbaa !5
%3 = icmp slt i32 %.pre, 1
br i1 %3, label %if.then5, label %if.end7
if.then5: ; preds = %while.cond.while.end.loopexit_crit_edge, %entry, %while.end
%puts8 = call i32 @puts(ptr nonnull dereferenceable(1) @str.3)
br label %if.end7
if.end7: ; preds = %if.then5, %while.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %aak) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ahp) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tak) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %thp) #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"}
|
#include<stdio.h>
int main()
{
int a,b,c,d,c1=0,c2=0;
scanf("%d%d%d%d",&a,&b,&c,&d);
while(c>0)
{
c=c-b;
c1++;
}
while(a>0)
{
a=a-d;
c2++;
}
if(c1>c2)
{
printf("No\n");
}
else
{
printf("Yes\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138669/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138669/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%.pr = load i32, ptr %c, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %.pr, 0
br i1 %cmp15, label %while.body.lr.ph, label %while.cond1thread-pre-split
while.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %b, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%c1.016 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%1 = phi i32 [ %.pr, %while.body.lr.ph ], [ %sub, %while.body ]
%sub = sub nsw i32 %1, %0
%inc = add nuw nsw i32 %c1.016, 1
%cmp = icmp sgt i32 %sub, 0
br i1 %cmp, label %while.body, label %while.cond.while.cond1thread-pre-split_crit_edge, !llvm.loop !9
while.cond.while.cond1thread-pre-split_crit_edge: ; preds = %while.body
store i32 %sub, ptr %c, align 4, !tbaa !5
br label %while.cond1thread-pre-split
while.cond1thread-pre-split: ; preds = %while.cond.while.cond1thread-pre-split_crit_edge, %entry
%c1.0.lcssa = phi i32 [ %inc, %while.cond.while.cond1thread-pre-split_crit_edge ], [ 0, %entry ]
%.pr14 = load i32, ptr %a, align 4, !tbaa !5
%cmp217 = icmp sgt i32 %.pr14, 0
br i1 %cmp217, label %while.body3.lr.ph, label %while.end6
while.body3.lr.ph: ; preds = %while.cond1thread-pre-split
%2 = load i32, ptr %d, align 4, !tbaa !5
br label %while.body3
while.body3: ; preds = %while.body3.lr.ph, %while.body3
%c2.018 = phi i32 [ 0, %while.body3.lr.ph ], [ %inc5, %while.body3 ]
%3 = phi i32 [ %.pr14, %while.body3.lr.ph ], [ %sub4, %while.body3 ]
%sub4 = sub nsw i32 %3, %2
%inc5 = add nuw nsw i32 %c2.018, 1
%cmp2 = icmp sgt i32 %sub4, 0
br i1 %cmp2, label %while.body3, label %while.cond1.while.end6_crit_edge, !llvm.loop !11
while.cond1.while.end6_crit_edge: ; preds = %while.body3
store i32 %sub4, ptr %a, align 4, !tbaa !5
br label %while.end6
while.end6: ; preds = %while.cond1.while.end6_crit_edge, %while.cond1thread-pre-split
%c2.0.lcssa = phi i32 [ %inc5, %while.cond1.while.end6_crit_edge ], [ 0, %while.cond1thread-pre-split ]
%cmp7 = icmp ugt i32 %c1.0.lcssa, %c2.0.lcssa
%str.3.str = select i1 %cmp7, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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}
|
#include <stdio.h>
int main(void)
{
int a, b, c, d;
scanf("%d%d%d%d",&a,&b,&c,&d);
while(a>0){
a = a - d;
c = c - b;
}
if(c>0){
printf("No");
}
else{
printf("Yes");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138711/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138711/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%.pr = load i32, ptr %a, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %.pr, 0
%c.promoted = load i32, ptr %c, align 4, !tbaa !5
br i1 %cmp6, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %d, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%2 = phi i32 [ %.pr, %while.body.lr.ph ], [ %sub, %while.body ]
%sub157 = phi i32 [ %c.promoted, %while.body.lr.ph ], [ %sub1, %while.body ]
%sub = sub nsw i32 %2, %0
%sub1 = sub nsw i32 %sub157, %1
%cmp = icmp sgt i32 %sub, 0
br i1 %cmp, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 %sub, ptr %a, align 4, !tbaa !5
store i32 %sub1, ptr %c, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %entry, %while.cond.while.end_crit_edge
%3 = phi i32 [ %sub1, %while.cond.while.end_crit_edge ], [ %c.promoted, %entry ]
%cmp2 = icmp sgt i32 %3, 0
%.str.1..str.2 = select i1 %cmp2, ptr @.str.1, ptr @.str.2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
do{
c=c-b;
if(c<=0){
printf("Yes");
return 0;
}
a=a-d;
if(a<=0){
printf("No");
return 0;
}
}while(a>0||c>0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138755/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138755/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %b, align 4, !tbaa !5
%c.promoted = load i32, ptr %c, align 4, !tbaa !5
%a.promoted = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %d, align 4
br label %do.body
do.body: ; preds = %if.end, %entry
%sub214 = phi i32 [ %sub2, %if.end ], [ %a.promoted, %entry ]
%sub12 = phi i32 [ %sub, %if.end ], [ %c.promoted, %entry ]
%sub = sub nsw i32 %sub12, %0
%cmp = icmp slt i32 %sub, 1
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %do.body
%sub2 = sub nsw i32 %sub214, %1
store i32 %sub2, ptr %a, align 4, !tbaa !5
%cmp3 = icmp slt i32 %sub2, 1
br i1 %cmp3, label %cleanup, label %do.body
cleanup: ; preds = %if.end, %do.body
%.str.2.sink = phi ptr [ @.str.1, %do.body ], [ @.str.2, %if.end ]
store i32 %sub, ptr %c, align 4, !tbaa !5
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
int main()
{
float a,b,c,d,m,n;
scanf("%f%f%f%f",&a,&b,&c,&d);
m=ceil(a/d);//m+1ci A si
n=ceil(c/b);//n+1ci B si
if(m-n>=0)
{
printf("Yes");
}
else printf("No");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138799/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138799/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%f%f%f%f\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca float, align 4
%b = alloca float, align 4
%c = alloca float, align 4
%d = alloca float, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load float, ptr %a, align 4, !tbaa !5
%1 = load float, ptr %d, align 4, !tbaa !5
%2 = load float, ptr %c, align 4, !tbaa !5
%3 = load float, ptr %b, align 4, !tbaa !5
%4 = insertelement <2 x float> poison, float %0, i64 0
%5 = insertelement <2 x float> %4, float %2, i64 1
%6 = insertelement <2 x float> poison, float %1, i64 0
%7 = insertelement <2 x float> %6, float %3, i64 1
%8 = fdiv <2 x float> %5, %7
%9 = call <2 x float> @llvm.ceil.v2f32(<2 x float> %8)
%shift = shufflevector <2 x float> %9, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
%10 = fsub <2 x float> %9, %shift
%sub = extractelement <2 x float> %10, i64 0
%cmp = fcmp ult float %sub, 0.000000e+00
%.str.2..str.1 = select i1 %cmp, ptr @.str.2, ptr @.str.1
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree 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 <2 x float> @llvm.ceil.v2f32(<2 x float>) #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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
/* 164b.c */
#include <stdio.h>
int main(void){
int a,b,c,d=0;
int tak,aok=0;
scanf("%d %d %d %d",&a,&b,&c,&d);
aok=c-b;
tak=a-d;
if(aok<=0){
printf("Yes");
return 0;
}else if(tak<=0){
printf("No");
return 0;
}
for(int i=0; i<100;i++){
aok=aok-b;
tak=tak-d;
if(aok<=0){
printf("Yes");
return 0;
}else if(tak<=0){
printf("No");
return 0;
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138841/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138841/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
store i32 0, ptr %d, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %c, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %d, align 4, !tbaa !5
%cmp = icmp slt i32 %sub, 1
br i1 %cmp, label %cleanup19.sink.split, label %if.else
if.else: ; preds = %entry
%3 = load i32, ptr %a, align 4, !tbaa !5
%sub1 = sub nsw i32 %3, %2
%cmp3 = icmp slt i32 %sub1, 1
br i1 %cmp3, label %cleanup19.sink.split, label %for.body
for.cond: ; preds = %if.else13
%sub8.1 = sub nsw i32 %sub8, %1
%cmp10.1 = icmp slt i32 %sub8.1, 1
br i1 %cmp10.1, label %cleanup19.sink.split, label %if.else13.1
if.else13.1: ; preds = %for.cond
%sub9.1 = sub nsw i32 %sub9, %2
%cmp14.1 = icmp slt i32 %sub9.1, 1
br i1 %cmp14.1, label %cleanup19.sink.split, label %for.cond.1
for.cond.1: ; preds = %if.else13.1
%inc.1 = add nuw nsw i32 %i.033, 2
%exitcond.not.1 = icmp eq i32 %inc.1, 100
br i1 %exitcond.not.1, label %cleanup19, label %for.body, !llvm.loop !9
for.body: ; preds = %if.else, %for.cond.1
%i.033 = phi i32 [ %inc.1, %for.cond.1 ], [ 0, %if.else ]
%aok.032 = phi i32 [ %sub8.1, %for.cond.1 ], [ %sub, %if.else ]
%tak.031 = phi i32 [ %sub9.1, %for.cond.1 ], [ %sub1, %if.else ]
%sub8 = sub nsw i32 %aok.032, %1
%cmp10 = icmp slt i32 %sub8, 1
br i1 %cmp10, label %cleanup19.sink.split, label %if.else13
if.else13: ; preds = %for.body
%sub9 = sub nsw i32 %tak.031, %2
%cmp14 = icmp slt i32 %sub9, 1
br i1 %cmp14, label %cleanup19.sink.split, label %for.cond
cleanup19.sink.split: ; preds = %if.else13, %for.body, %for.cond, %if.else13.1, %if.else, %entry
%.str.1.sink = phi ptr [ @.str.1, %entry ], [ @.str.2, %if.else ], [ @.str.1, %for.body ], [ @.str.2, %if.else13 ], [ @.str.1, %for.cond ], [ @.str.2, %if.else13.1 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
br label %cleanup19
cleanup19: ; preds = %for.cond.1, %cleanup19.sink.split
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int a, b, c, d, i;
scanf("%d %d %d %d", &a, &b ,&c, &d);
i=0;
while(a > 0 && c > 0){
if(i % 2 != 0){
a -= d;
}else{
c -= b;
}
i++;
}
if(a > 0)
printf("Yes");
else
printf("No");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138885/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138885/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%a.promoted = load i32, ptr %a, align 4, !tbaa !5
%c.promoted = load i32, ptr %c, align 4
%cmp16 = icmp sgt i32 %a.promoted, 0
%cmp117 = icmp sgt i32 %c.promoted, 0
%0 = select i1 %cmp16, i1 %cmp117, i1 false
br i1 %0, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %d, align 4
%2 = load i32, ptr %b, align 4
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%i.020 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %if.end ]
%sub1319 = phi i32 [ %a.promoted, %while.body.lr.ph ], [ %sub12, %if.end ]
%sub31518 = phi i32 [ %c.promoted, %while.body.lr.ph ], [ %sub314, %if.end ]
%rem = and i32 %i.020, 1
%cmp2.not = icmp eq i32 %rem, 0
br i1 %cmp2.not, label %if.else, label %if.then
if.then: ; preds = %while.body
%sub = sub nsw i32 %sub1319, %1
store i32 %sub, ptr %a, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%sub3 = sub nsw i32 %sub31518, %2
store i32 %sub3, ptr %c, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%sub314 = phi i32 [ %sub3, %if.else ], [ %sub31518, %if.then ]
%sub12 = phi i32 [ %sub1319, %if.else ], [ %sub, %if.then ]
%inc = add nuw nsw i32 %i.020, 1
%cmp = icmp sgt i32 %sub12, 0
%cmp1 = icmp sgt i32 %sub314, 0
%3 = select i1 %cmp, i1 %cmp1, i1 false
br i1 %3, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %if.end, %entry
%cmp.lcssa = phi i1 [ %cmp16, %entry ], [ %cmp, %if.end ]
%.str.1..str.2 = select i1 %cmp.lcssa, ptr @.str.1, ptr @.str.2
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int a,b,c,d;
scanf("%d %d %d %d",&a,&b,&c,&d);
while(1){
c-=b;
if(c<=0){
printf("Yes");
return 0;
}else{
a-=d;
if(a<=0){
printf("No");
return 0;
}
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138928/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138928/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %b, align 4, !tbaa !5
%c.promoted = load i32, ptr %c, align 4, !tbaa !5
%a.promoted = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %d, align 4
br label %while.cond
while.cond: ; preds = %if.else, %entry
%sub212 = phi i32 [ %sub2, %if.else ], [ %a.promoted, %entry ]
%sub10 = phi i32 [ %sub, %if.else ], [ %c.promoted, %entry ]
%sub = sub nsw i32 %sub10, %0
%cmp = icmp slt i32 %sub, 1
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %while.cond
%sub2 = sub nsw i32 %sub212, %1
store i32 %sub2, ptr %a, align 4, !tbaa !5
%cmp3 = icmp slt i32 %sub2, 1
br i1 %cmp3, label %cleanup, label %while.cond
cleanup: ; preds = %if.else, %while.cond
%.str.2.sink = phi ptr [ @.str.1, %while.cond ], [ @.str.2, %if.else ]
store i32 %sub, ptr %c, align 4, !tbaa !5
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int a,b,c,d;
int flag1 = 0;
int flag2 = 0;
scanf("%d %d %d %d",&a,&b,&c,&d);
while(1){
c -= b;
if(c <= 0){
flag1 = 1;
break;
}
a -= d;
if(a <= 0){
flag2 = 1;
break;
}
}
if(flag1 == 1) printf("Yes\n");
else printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_138979/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_138979/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %b, align 4, !tbaa !5
%c.promoted = load i32, ptr %c, align 4, !tbaa !5
%a.promoted = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %d, align 4
br label %while.cond
while.cond: ; preds = %if.end, %entry
%sub113 = phi i32 [ %sub1, %if.end ], [ %a.promoted, %entry ]
%sub11 = phi i32 [ %sub, %if.end ], [ %c.promoted, %entry ]
%sub = sub nsw i32 %sub11, %0
%cmp = icmp slt i32 %sub, 1
br i1 %cmp, label %if.end9, label %if.end
if.end: ; preds = %while.cond
%sub1 = sub nsw i32 %sub113, %1
store i32 %sub1, ptr %a, align 4, !tbaa !5
%cmp2 = icmp slt i32 %sub1, 1
br i1 %cmp2, label %if.end9, label %while.cond
if.end9: ; preds = %if.end, %while.cond
%str.sink = phi ptr [ @str.3, %while.cond ], [ @str, %if.end ]
store i32 %sub, ptr %c, align 4, !tbaa !5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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"}
|
#pragma region kyopuro_templates
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
#include<assert.h>
#include<time.h>
#include<ctype.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<62)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 20)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
#define charsize 100005 //10^5+5
#define PI 3.141592653589793238
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}
void cin(ll *n){ scanf("%lld",&(*n)); }
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
double POW_d(double a, double b){double c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod_MOD1(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}
ll mod_p(ll n ,ll p){n+= n<0?((-n)/p+1)*p:0; return n%=p;}
ll change_into_num(char s[] , ll len, ll p){ return !p ? 0 : POW(10,p-1)*(s[len-p]-'0') + change_into_num(s,len,p-1); }
ll digits(ll a, ll b){return a/b?1+digits(a/b,b):1;}
ll base(ll n, ll a, ll i){return i==1?n%a:base(n/a,a,i-1);}
ll is_inArr1(ll x, ll n){ return ( x<0 || x>=n ) ? 0 : 1 ; }
ll is_inArr2(ll y, ll x, ll h, ll w){ return ( y<0 || y>=h || x<0 || x>=w ) ? 0 : 1 ; }
void lr_lower( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }
void lr_upper( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }
int cmp_lower( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a>=b ? 1 : 0 ) : ( a>b ? 1 : 0 ) ; }
int cmp_upper( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a<=b ? 1 : 0 ) : ( a<b ? 1 : 0 ) ; }
// return smallest p which meets a[p]==val :1 >=:2 >:3
ll lower_bound( ll a[], int l, int r, ll val , int type ){ while(r-l>1) lr_lower(&l,&r,a[ (l+r)/2 ],val,type); return cmp_lower(a[l],val,type) ? l : cmp_lower(a[r],val,type) ? r : -1; }
// return biggest p which meets a[p]==val :1 <=:2 <:3
ll upper_bound( ll a[], int l, int r, ll val , int type ){ while(r-l>1) lr_upper(&l,&r,a[ (l+r)/2 ],val,type); return cmp_upper(a[r],val,type) ? r : cmp_upper(a[l],val,type) ? l : -1; }
// count i which meets ai==x
ll count(ll a[], int l, int r, ll x){ int p = lower_bound(a,l,r,x,1); return p==-1 ? 0 : upper_bound(a,p,r,x,1)-p+1; }
ll *factors[2] , fac_cnt=0 , is_factor_prepared=0;
ll factor_pre(){ rep(i,0,1){ if(is_factor_prepared++) return 0; } ll tmp=(1e6)/2+1, fac_tmp[tmp]; rep(i,0,tmp){fac_tmp[i]=i?2*i+1:2;} rep(i,1,tmp){if(fac_tmp[i]){ repp(j,3,tmp/(2*i+1)+1,2 ){ if( j*(2*i+1)<tmp ) fac_tmp[ (j*(2*i+1)-1)/2 ]=0; } }else continue;} rep(i,0,tmp){if(fac_tmp[i]){ rep(j,0,2){ factors[j] = realloc( factors[j] , sizeof(ll)*( fac_cnt +1 ) ); factors[j][j?fac_cnt++:fac_cnt]=j?0:fac_tmp[i]; } } } return 0; }
ll factor(ll n, ll new_common_plus){ factor_pre(); rep(i,0,fac_cnt){ ll cnt=0; rep(j,0,1){ while( ( cnt+= n %factors[0][i]==0 ? 1 : 0 ) && (n/=factors[0][i]) %factors[0][i]==0 ) continue; } factors[1][i]= new_common_plus==1 ? cnt : new_common_plus==2 ? max2(factors[1][i],cnt) : factors[1][i]+cnt ; if( factors[0][i]> n ) break; } return n; }
ll judge_prime(ll n){ factor_pre(); rep(i,0,fac_cnt){ if(n<factors[0][i]*factors[0][i] || n==factors[0][i]) break; else if(n%factors[0][i]==0) n/=n; } return n==1?0:1; }
ll *mf_arr,*inv_arr,*finv_arr,is_minv_made=0,is_mf_made=0,num_of_inv=2*1e6+10;
ll makeinv(ll n , ll mod){ rep(i,0,1){if(is_minv_made++) return 0;} inv_arr = realloc(inv_arr, sizeof(ll)*2 ); finv_arr = realloc(finv_arr, sizeof(ll)*2 ); inv_arr[1]=1;finv_arr[0]=finv_arr[1]=1; rep(i,2,n+1){ inv_arr = realloc(inv_arr, sizeof(ll)*(i+1) ); finv_arr = realloc(finv_arr, sizeof(ll)*(i+1) ); inv_arr[i]= mod - inv_arr[mod%i] * (mod / i) % mod; finv_arr[i] = finv_arr[i - 1] * inv_arr[i] % mod; } return 0; }
ll make_mf(ll n, ll mod){ rep(i,0,1){ if(is_mf_made++) return 0; } mf_arr = realloc(mf_arr, sizeof(ll)*2 ); ll x=1; mf_arr[0]=mf_arr[1]=x; rep(i,2,n+1){ x=x*i%mod; mf_arr = realloc(mf_arr, sizeof(ll)*(i+1) ); mf_arr[i]=x; } return 0; }
ll m_inv(ll x, ll mod, ll is_fac ){ makeinv(num_of_inv,mod); return is_fac?finv_arr[x]:inv_arr[x]; }
ll m_f(ll x, ll mod){ make_mf(num_of_inv,mod); return mf_arr[x]; }
ll mod_nck(ll n, ll k, ll mod){ return m_f(n,mod)*m_inv(k,mod,1)%mod*m_inv(n-k,mod,1)%mod; }
ll m_p(ll r,ll n,ll mod){ ll t=1,s=r; while(n>0){ t = (n&1) ? t*s%mod : t; s=s*s%mod; n>>=1; } return r?t:0; }
ll m_mul2(ll a, ll b, ll mod){ return a*b%mod; }
ll m_mul3(ll a, ll b, ll c, ll mod){ return m_mul2(a*b%mod,c,mod); }
ll m_mul4(ll a, ll b, ll c, ll d, ll mod){ return m_mul3(a*b%mod,c,d,mod); }
ll m_mul5(ll a, ll b, ll c, ll d, ll e, ll mod){ return m_mul4(a*b%mod,c,d,e,mod); }
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
int cmp_string( const void * a , const void * b ) { return strcmp( (char *)a , (char *)b ); } // qsort((void*)s,n,sizeof(s[0]),int_sort );
int cmp_char(const void * a, const void * b) { return *(char *)a - *(char *)b;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
void sort_string(int n,int size,char s[][size]){ qsort( (void*)s , n , sizeof(s[0]) , cmp_string ); }
void sort_char(char *s){ qsort( (void *)s , strlen(s) , sizeof(char) , cmp_char ); }
ll unique_string(ll n ,ll size, char s[][size]){ ll ans=1; rep(i,1,n) if( strcmp(s[i],s[i-1]) ) ans++; return ans; }
ll unique_num(ll n , ll a[]){ ll ans=1; rep(i,1,n) if( a[i]!=a[i-1] ) ans++; return ans; }
typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}
#pragma region AVL
/*---------------------------AVL start--------------------------------*/
//https://qiita.com/mikecat_mixc/items/e9f8248de2ae7f7a0a29
typedef struct node_AVL_set{
ll val;
int diff;
int cnt;
struct node_AVL_set *child[2];
}AVL_set;
void AVL_set_inside_rotate(AVL_set **node, int is_right){
int l = is_right==false , r = is_right==true , sign = is_right ? 1 : -1;
if((*node)->child[l] != NULL){
AVL_set* left = (*node)->child[l];
int a= (*node)->diff * sign , b= left->diff * sign ,na,nb;
if(b+1){
na=a-1-b;
nb= (a-b) ? b-1 : a-2;
}else{
na=a-1;
nb= a ? b-1 : a+b-2;
}
(*node)->diff = na * sign;
left->diff = nb * sign;
/* rotate-> */
(*node)->child[l] = (*node)->child[l]->child[r];
left->child[r] = *node;
*node = left;
}
}
int AVL_set_inside_update(AVL_set **node, ll data, int add){
if(*node == NULL){
if(add==2){
*node = malloc(sizeof(AVL_set));
(*node)->val = data;
(*node)->cnt = 1;
(*node)->diff = 0;
(*node)->child[0] = NULL;
(*node)->child[1] = NULL;
}
return add==2 ? *node != NULL : 0;
}else{
int l, delta, delta_sign; AVL_set *next_node;
if(data == (*node)->val){
if(add==2){
(*node)->cnt++;
return 0;
}else{
if( add && (*node)->cnt > 1 ){
(*node)->cnt--; return 0;
}else{
if((*node)->child[1] == NULL){
next_node = (*node)->child[0];
free(*node);
*node = next_node;
return -1;
}else if((*node)->child[0] == NULL){
next_node = (*node)->child[1];
free(*node);
*node = next_node;
return -1;
}else{
for(next_node = (*node)->child[0];
next_node->child[1] != NULL;
next_node = next_node->child[1]);
(*node)->val = next_node->val;
l=0;
delta_sign=1;
delta = AVL_set_inside_update(&(*node)->child[l], next_node->val, add);
}
}
}
}else{
l = data >= (*node)->val ? 1 : 0;
delta_sign = data < (*node)->val ? 1 : -1;
delta = AVL_set_inside_update(&(*node)->child[l], data, add);
}
if( delta ){
int orig_diff = (*node)->diff;
int do_rotate = 0, rotate_l , diff_sign , rotate_right;
(*node)->diff += delta * delta_sign;
if((*node)->diff > 1){
do_rotate = 1;
rotate_l = 0;
diff_sign = 1;
rotate_right = 1;
}else if((*node)->diff < -1){
do_rotate = 1;
rotate_l = 1;
diff_sign = -1;
rotate_right = 0;
}
if(do_rotate){
int child_diff = (*node)->child[rotate_l]->diff;
if((*node)->child[rotate_l]->diff * diff_sign < 0){
AVL_set_inside_rotate(&(*node)->child[rotate_l], !rotate_right);
}
AVL_set_inside_rotate(node, rotate_right);
return delta < 0 && child_diff != 0 ? -1 : 0;
}
if (delta > 0 && orig_diff == 0) return 1;
else if(delta < 0 && orig_diff != 0) return -1;
else return 0;
}else{
return 0;
}
}
}
void AVL_set_inside_print(const AVL_set *node, int depth){
if(node == NULL) return;
AVL_set_inside_print(node->child[1], depth + 1);
printf("%lld %d\n", node->val,node->cnt);
AVL_set_inside_print(node->child[0], depth + 1);
}
void AVL_set_inside_free(AVL_set *node){
if(node == NULL) return;
AVL_set_inside_free(node->child[0]);
AVL_set_inside_free(node->child[1]);
free(node);
}
ll AVL_set_inside_count(AVL_set *root, ll val){
AVL_set *node; node = root;
while(node){
if (val < node->val) node = node->child[0];
else if(val > node->val) node = node->child[1];
else return node->cnt;
}
return 0;
}
ll AVL_set_inside_minmax(AVL_set *root, int type){
while(root->child[type] !=NULL) root= root->child[type];
return root->val;
}
void AVL_set_inside_swap(AVL_set **node1, AVL_set **node2){
AVL_set *tmp; tmp=*node1; *node1=*node2; *node2=tmp;
}
#define set_MAX_SIZE 514511
ll set_main( int command , int set_num , ll val ){
static bool set_is_init=false;
static AVL_set *set_pointer[set_MAX_SIZE];
static ll set_siz[set_MAX_SIZE];
if(!set_is_init){ set_is_init=true; rep(i,0,set_MAX_SIZE){ *(set_pointer+i) = NULL; set_siz[i]=0; } }
if(command==-1){ AVL_set_inside_print( set_pointer[set_num] ,0); }
if(command==1){ AVL_set_inside_count(set_pointer[set_num],val) ? 1 : set_siz[set_num]++; AVL_set_inside_update( &set_pointer[set_num] , val , 2 ); }
if(command==2){ return AVL_set_inside_count(set_pointer[set_num],val); }
if(command==3){ ( AVL_set_inside_count(set_pointer[set_num],val) > 1 ) ? 1 : set_siz[set_num]--; AVL_set_inside_update( &set_pointer[set_num] , val,1); }
if(command==4){ set_siz[set_num]--; AVL_set_inside_update( &set_pointer[set_num] , val , 0 ); }
if(command==5){ set_siz[set_num]=0; AVL_set_inside_free( set_pointer[set_num] ); set_pointer[set_num] = NULL; }
if(command==6){ return set_siz[set_num]; }
if(command==7){ return AVL_set_inside_minmax(set_pointer[set_num],1); }
if(command==8){ return AVL_set_inside_minmax(set_pointer[set_num],0); }
if(command==9){ AVL_set_inside_swap(&set_pointer[set_num],&set_pointer[val]); }
return 0;
}
void set_print(int set_num){ set_main(-1,set_num,0); }
void set_insert(int set_num, ll val){ set_main(1,set_num,val); }
ll set_count(int set_num, ll val){ return set_main(2,set_num,val); }
void set_erase(int set_num, ll val, int is_all){ if(is_all) set_main(4,set_num,val); else set_main(3,set_num,val); }
void set_clear(int set_num){ set_main(5,set_num,0); }
ll set_size(int set_num){ return set_main(6,set_num,0); }
ll set_max(int set_num){ return set_main(7,set_num,0); }
ll set_min(int set_num){ return set_main(8,set_num,0); }
void set_swap(ll set_num1, ll set_num2){ set_main(9,set_num1,set_num2); }
/*
insert *
size *
clear *
erase *
count *
max *
min *
swap *
begin
end
merge source の要素のキーと等価なキーの要素がある場合、その要素は source から抽出されない
lower_bound
upper_bound
*/
// ll map_main()
/*---------------------------AVL start--------------------------------*/
#pragma endregion AVLK
#pragma endregion kyopuro_templates
char s[1151154];
int main(void){
// fgets(s,sizeof(s),stdin);
ll h,w,a,b;
ll ans=0;
cin(&h);
cin(&w);
cin(&a);
cin(&b);
// scanf("%s",s);
// ll [n];
ans= mod_nck(h+w-2,h-1,MOD1);
// ll tot=0;
rep(i,0,a){
ll t=mod_nck( b-1+h-a+i , b-1 , MOD1 );
t*=mod_nck( w-b-1+a-1-i,a-1-i,MOD1 );
t%=MOD1;
ans+=mod_MOD1(-t);
ans%=MOD1;
}
printf("%lld\n",ans);
return 0;
}
/*
while (ng + 1 < ok) {
int p = ng + (ok - ng) / 2;
int cnt = 0;
for (i = 0; i < n; i++) {
cnt += (a[i] + p - 1) / p - 1;
}
if (cnt <= k) ok = p; else ng = p;
}
*/
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139020/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139020/source.c"
target datalayout = "e-m:e-p270: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.node_AVL_set = type { i64, i32, i32, [2 x ptr] }
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@fac_cnt = dso_local local_unnamed_addr global i64 0, align 8
@is_factor_prepared = dso_local local_unnamed_addr global i64 0, align 8
@factors = dso_local local_unnamed_addr global [2 x ptr] zeroinitializer, align 16
@is_minv_made = dso_local local_unnamed_addr global i64 0, align 8
@is_mf_made = dso_local local_unnamed_addr global i64 0, align 8
@num_of_inv = dso_local local_unnamed_addr global i64 2000010, align 8
@inv_arr = dso_local local_unnamed_addr global ptr null, align 8
@finv_arr = dso_local local_unnamed_addr global ptr null, align 8
@mf_arr = dso_local local_unnamed_addr global ptr null, align 8
@.str.1 = private unnamed_addr constant [9 x i8] c"%lld %d\0A\00", align 1
@set_main.set_is_init = internal unnamed_addr global i1 false, align 1
@set_main.set_pointer = internal global [514511 x ptr] zeroinitializer, align 16
@set_main.set_siz = internal unnamed_addr global [514511 x i64] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@s = dso_local local_unnamed_addr global [1151154 x i8] zeroinitializer, align 16
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
store i64 %1, ptr %b, align 8, !tbaa !5
store i64 %0, ptr %a, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @cin(ptr noundef %n) local_unnamed_addr #2 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %n)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #4 {
entry:
%cmp.not = icmp sgt i64 %a, %b
%cmp1.not = icmp sgt i64 %a, %c
%or.cond = or i1 %cmp.not, %cmp1.not
%cond = tail call i64 @llvm.smin.i64(i64 %b, i64 %c)
%cond6 = select i1 %or.cond, i64 %cond, i64 %a
ret i64 %cond6
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #4 {
entry:
%cmp.not = icmp slt i64 %a, %b
%cmp1.not = icmp slt i64 %a, %c
%or.cond = or i1 %cmp.not, %cmp1.not
%cond = tail call i64 @llvm.smax.i64(i64 %b, i64 %c)
%cond6 = select i1 %or.cond, i64 %cond, i64 %a
ret i64 %cond6
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @minn(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #5 {
entry:
%cmp4 = icmp sgt i64 %n, 0
br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 4611686018427387904, i64 4611686018427387904>, %vector.ph ], [ %2, %vector.body ]
%vec.phi7 = phi <2 x i64> [ <i64 4611686018427387904, i64 4611686018427387904>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %a, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load8 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%3 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi7, <2 x i64> %wide.load8)
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %2, <2 x i64> %3)
%5 = tail call i64 @llvm.vector.reduce.smin.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%i.06.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.05.ph = phi i64 [ 4611686018427387904, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.0.lcssa = phi i64 [ 4611686018427387904, %entry ], [ %5, %middle.block ], [ %cond.i, %for.body ]
ret i64 %b.0.lcssa
for.body: ; preds = %for.body.preheader9, %for.body
%i.06 = phi i64 [ %inc, %for.body ], [ %i.06.ph, %for.body.preheader9 ]
%b.05 = phi i64 [ %cond.i, %for.body ], [ %b.05.ph, %for.body.preheader9 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.06
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smin.i64(i64 %b.05, i64 %6)
%inc = add nuw nsw i64 %i.06, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !13
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @maxn(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #5 {
entry:
%cmp4 = icmp sgt i64 %n, 0
br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 -4611686018427387904, i64 -4611686018427387904>, %vector.ph ], [ %2, %vector.body ]
%vec.phi7 = phi <2 x i64> [ <i64 -4611686018427387904, i64 -4611686018427387904>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %a, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load8 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%3 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi7, <2 x i64> %wide.load8)
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %2, <2 x i64> %3)
%5 = tail call i64 @llvm.vector.reduce.smax.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%i.06.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.05.ph = phi i64 [ -4611686018427387904, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.0.lcssa = phi i64 [ -4611686018427387904, %entry ], [ %5, %middle.block ], [ %cond.i, %for.body ]
ret i64 %b.0.lcssa
for.body: ; preds = %for.body.preheader9, %for.body
%i.06 = phi i64 [ %inc, %for.body ], [ %i.06.ph, %for.body.preheader9 ]
%b.05 = phi i64 [ %cond.i, %for.body ], [ %b.05.ph, %for.body.preheader9 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.06
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smax.i64(i64 %b.05, i64 %6)
%inc = add nuw nsw i64 %i.06, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !15
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @POW(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%cmp3 = icmp sgt i64 %b, 0
br i1 %cmp3, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%c.04.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%c.04.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %c.04.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %c.04.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !16
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%c.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %c.0.lcssa
for.body: ; preds = %for.body, %for.body.preheader.new
%c.04 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %c.04, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !18
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local double @POW_d(double noundef %a, double noundef %b) local_unnamed_addr #6 {
entry:
%cmp4 = fcmp ogt double %b, 0.000000e+00
br i1 %cmp4, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%c.0.lcssa = phi double [ 1.000000e+00, %entry ], [ %mul, %for.body ]
ret double %c.0.lcssa
for.body: ; preds = %entry, %for.body
%i.06 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%c.05 = phi double [ %mul, %for.body ], [ 1.000000e+00, %entry ]
%mul = fmul double %c.05, %a
%inc = add nuw nsw i64 %i.06, 1
%conv = sitofp i64 %inc to double
%cmp = fcmp olt double %conv, %b
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !19
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %cond.end, label %cond.true
cond.true: ; preds = %entry, %cond.true
%b.tr6 = phi i64 [ %rem, %cond.true ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %cond.true ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %cond.end, label %cond.true
cond.end: ; preds = %cond.true, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %cond.true ]
ret i64 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%tobool.not4.i = icmp eq i64 %b, 0
br i1 %tobool.not4.i, label %gcd.exit, label %cond.true.i
cond.true.i: ; preds = %entry, %cond.true.i
%b.tr6.i = phi i64 [ %rem.i, %cond.true.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %cond.true.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %cond.true.i
gcd.exit: ; preds = %cond.true.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %cond.true.i ]
%div = sdiv i64 %a, %a.tr.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @mod_MOD1(i64 noundef %n) local_unnamed_addr #7 {
entry:
%cmp = icmp slt i64 %n, 0
br i1 %cmp, label %cond.true, label %cond.end
cond.true: ; preds = %entry
%n.nonneg = sub i64 0, %n
%0 = urem i64 %n.nonneg, 1000000007
%1 = add nsw i64 %0, %n
%mul = sub i64 1000000007, %1
br label %cond.end
cond.end: ; preds = %entry, %cond.true
%cond = phi i64 [ %mul, %cond.true ], [ 0, %entry ]
%add1 = add nsw i64 %cond, %n
%rem = srem i64 %add1, 1000000007
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @mod_p(i64 noundef %n, i64 noundef %p) local_unnamed_addr #7 {
entry:
%cmp = icmp slt i64 %n, 0
br i1 %cmp, label %cond.true, label %cond.end
cond.true: ; preds = %entry
%div7 = sdiv i64 %n, %p
%add = sub i64 1, %div7
%mul = mul nsw i64 %add, %p
br label %cond.end
cond.end: ; preds = %entry, %cond.true
%cond = phi i64 [ %mul, %cond.true ], [ 0, %entry ]
%add1 = add nsw i64 %cond, %n
%rem = srem i64 %add1, %p
ret i64 %rem
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @change_into_num(ptr nocapture noundef readonly %s, i64 noundef %len, i64 noundef %p) local_unnamed_addr #8 {
entry:
%tobool.not11 = icmp eq i64 %p, 0
br i1 %tobool.not11, label %cond.end, label %cond.false.preheader
cond.false.preheader: ; preds = %entry
%0 = add i64 %p, -2
br label %cond.false
cond.false: ; preds = %cond.false.preheader, %POW.exit
%indvar = phi i64 [ 0, %cond.false.preheader ], [ %indvar.next, %POW.exit ]
%p.tr13 = phi i64 [ %p, %cond.false.preheader ], [ %sub, %POW.exit ]
%accumulator.tr12 = phi i64 [ 0, %cond.false.preheader ], [ %add, %POW.exit ]
%1 = xor i64 %indvar, -1
%2 = add i64 %1, %p
%sub = add nsw i64 %p.tr13, -1
%cmp3.i = icmp sgt i64 %p.tr13, 1
br i1 %cmp3.i, label %for.body.i.preheader, label %POW.exit
for.body.i.preheader: ; preds = %cond.false
%3 = sub i64 %0, %indvar
%xtraiter = and i64 %2, 7
%4 = icmp ult i64 %3, 7
br i1 %4, label %POW.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %2, -8
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%c.04.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %mul.i.7, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.7, %for.body.i ]
%mul.i.7 = mul i64 %c.04.i, 100000000
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %POW.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !18
POW.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%mul.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %mul.i.7, %for.body.i ]
%c.04.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %mul.i.7, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %POW.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %POW.exit.loopexit.unr-lcssa, %for.body.i.epil
%c.04.i.epil = phi i64 [ %mul.i.epil, %for.body.i.epil ], [ %c.04.i.unr, %POW.exit.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %POW.exit.loopexit.unr-lcssa ]
%mul.i.epil = mul nsw i64 %c.04.i.epil, 10
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %POW.exit, label %for.body.i.epil, !llvm.loop !20
POW.exit: ; preds = %POW.exit.loopexit.unr-lcssa, %for.body.i.epil, %cond.false
%c.0.lcssa.i = phi i64 [ 1, %cond.false ], [ %mul.i.lcssa.ph, %POW.exit.loopexit.unr-lcssa ], [ %mul.i.epil, %for.body.i.epil ]
%sub1 = sub nsw i64 %len, %p.tr13
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %sub1
%5 = load i8, ptr %arrayidx, align 1, !tbaa !21
%conv = sext i8 %5 to i64
%sub2 = add nsw i64 %conv, -48
%mul = mul nsw i64 %sub2, %c.0.lcssa.i
%add = add nsw i64 %mul, %accumulator.tr12
%tobool.not = icmp eq i64 %sub, 0
%indvar.next = add i64 %indvar, 1
br i1 %tobool.not, label %cond.end, label %cond.false
cond.end: ; preds = %POW.exit, %entry
%accumulator.tr.lcssa = phi i64 [ 0, %entry ], [ %add, %POW.exit ]
ret i64 %accumulator.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @digits(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse, %entry
%accumulator.tr = phi i64 [ 0, %entry ], [ %add, %tailrecurse ]
%a.tr = phi i64 [ %a, %entry ], [ %div, %tailrecurse ]
%div = sdiv i64 %a.tr, %b
%tobool.not = icmp eq i64 %div, 0
%add = add nuw nsw i64 %accumulator.tr, 1
br i1 %tobool.not, label %cond.end, label %tailrecurse
cond.end: ; preds = %tailrecurse
ret i64 %add
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @base(i64 noundef %n, i64 noundef %a, i64 noundef %i) local_unnamed_addr #6 {
entry:
%cmp5 = icmp eq i64 %i, 1
br i1 %cmp5, label %cond.true, label %cond.false.preheader
cond.false.preheader: ; preds = %entry
%0 = add i64 %i, 3
%1 = add i64 %i, -2
%xtraiter = and i64 %0, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %cond.false.prol.loopexit, label %cond.false.prol
cond.false.prol: ; preds = %cond.false.preheader, %cond.false.prol
%i.tr7.prol = phi i64 [ %sub.prol, %cond.false.prol ], [ %i, %cond.false.preheader ]
%n.tr6.prol = phi i64 [ %div.prol, %cond.false.prol ], [ %n, %cond.false.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %cond.false.prol ], [ 0, %cond.false.preheader ]
%div.prol = sdiv i64 %n.tr6.prol, %a
%sub.prol = add nsw i64 %i.tr7.prol, -1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %cond.false.prol.loopexit, label %cond.false.prol, !llvm.loop !22
cond.false.prol.loopexit: ; preds = %cond.false.prol, %cond.false.preheader
%div.lcssa.unr = phi i64 [ undef, %cond.false.preheader ], [ %div.prol, %cond.false.prol ]
%i.tr7.unr = phi i64 [ %i, %cond.false.preheader ], [ %sub.prol, %cond.false.prol ]
%n.tr6.unr = phi i64 [ %n, %cond.false.preheader ], [ %div.prol, %cond.false.prol ]
%2 = icmp ult i64 %1, 3
br i1 %2, label %cond.true, label %cond.false
cond.true: ; preds = %cond.false.prol.loopexit, %cond.false, %entry
%n.tr.lcssa = phi i64 [ %n, %entry ], [ %div.lcssa.unr, %cond.false.prol.loopexit ], [ %div.3, %cond.false ]
%rem = srem i64 %n.tr.lcssa, %a
ret i64 %rem
cond.false: ; preds = %cond.false.prol.loopexit, %cond.false
%i.tr7 = phi i64 [ %sub.3, %cond.false ], [ %i.tr7.unr, %cond.false.prol.loopexit ]
%n.tr6 = phi i64 [ %div.3, %cond.false ], [ %n.tr6.unr, %cond.false.prol.loopexit ]
%div = sdiv i64 %n.tr6, %a
%div.1 = sdiv i64 %div, %a
%div.2 = sdiv i64 %div.1, %a
%div.3 = sdiv i64 %div.2, %a
%sub.3 = add nsw i64 %i.tr7, -4
%cmp.3 = icmp eq i64 %sub.3, 1
br i1 %cmp.3, label %cond.true, label %cond.false
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @is_inArr1(i64 noundef %x, i64 noundef %n) local_unnamed_addr #7 {
entry:
%cmp = icmp sgt i64 %x, -1
%cmp1 = icmp slt i64 %x, %n
%.not = and i1 %cmp, %cmp1
%conv = zext i1 %.not to i64
ret i64 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @is_inArr2(i64 noundef %y, i64 noundef %x, i64 noundef %h, i64 noundef %w) local_unnamed_addr #7 {
entry:
%cmp = icmp slt i64 %y, 0
br i1 %cmp, label %lor.end, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%cmp1 = icmp sge i64 %y, %h
%cmp3 = icmp slt i64 %x, 0
%or.cond = or i1 %cmp3, %cmp1
br i1 %or.cond, label %lor.end, label %lor.rhs
lor.rhs: ; preds = %lor.lhs.false
%cmp4 = icmp slt i64 %x, %w
%0 = zext i1 %cmp4 to i64
br label %lor.end
lor.end: ; preds = %lor.rhs, %lor.lhs.false, %entry
%not. = phi i64 [ 0, %lor.lhs.false ], [ 0, %entry ], [ %0, %lor.rhs ]
ret i64 %not.
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @lr_lower(ptr nocapture noundef %l, ptr nocapture noundef %r, i64 noundef %am, i64 noundef %val, i32 noundef %type) local_unnamed_addr #9 {
entry:
%cmp = icmp slt i32 %type, 3
%0 = load i32, ptr %l, align 4, !tbaa !23
%1 = load i32, ptr %r, align 4, !tbaa !23
%add = add nsw i32 %1, %0
%div = sdiv i32 %add, 2
%cmp1 = icmp slt i64 %am, %val
%l.r = select i1 %cmp1, ptr %l, ptr %r
%cmp6.not = icmp sgt i64 %am, %val
%r.l = select i1 %cmp6.not, ptr %r, ptr %l
%l.sink = select i1 %cmp, ptr %l.r, ptr %r.l
store i32 %div, ptr %l.sink, align 4, !tbaa !23
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @lr_upper(ptr nocapture noundef %l, ptr nocapture noundef %r, i64 noundef %am, i64 noundef %val, i32 noundef %type) local_unnamed_addr #9 {
entry:
%cmp = icmp slt i32 %type, 3
%0 = load i32, ptr %l, align 4, !tbaa !23
%1 = load i32, ptr %r, align 4, !tbaa !23
%add3 = add nsw i32 %1, %0
%div4 = sdiv i32 %add3, 2
%cmp1.not = icmp sgt i64 %am, %val
%r.l = select i1 %cmp1.not, ptr %r, ptr %l
%cmp6 = icmp slt i64 %am, %val
%l.r = select i1 %cmp6, ptr %l, ptr %r
%l.sink = select i1 %cmp, ptr %r.l, ptr %l.r
store i32 %div4, ptr %l.sink, align 4, !tbaa !23
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @cmp_lower(i64 noundef %a, i64 noundef %b, i32 noundef %type) local_unnamed_addr #7 {
entry:
switch i32 %type, label %cond.false6 [
i32 1, label %cond.true
i32 2, label %cond.true3
]
cond.true: ; preds = %entry
%cmp1 = icmp eq i64 %a, %b
br label %cond.end10
cond.true3: ; preds = %entry
%cmp4.not = icmp sge i64 %a, %b
br label %cond.end10
cond.false6: ; preds = %entry
%cmp7 = icmp sgt i64 %a, %b
br label %cond.end10
cond.end10: ; preds = %cond.true3, %cond.false6, %cond.true
%cond11.in = phi i1 [ %cmp1, %cond.true ], [ %cmp4.not, %cond.true3 ], [ %cmp7, %cond.false6 ]
%cond11 = zext i1 %cond11.in to i32
ret i32 %cond11
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @cmp_upper(i64 noundef %a, i64 noundef %b, i32 noundef %type) local_unnamed_addr #7 {
entry:
switch i32 %type, label %cond.false6 [
i32 1, label %cond.true
i32 2, label %cond.true3
]
cond.true: ; preds = %entry
%cmp1 = icmp eq i64 %a, %b
br label %cond.end10
cond.true3: ; preds = %entry
%cmp4.not = icmp sle i64 %a, %b
br label %cond.end10
cond.false6: ; preds = %entry
%cmp7 = icmp slt i64 %a, %b
br label %cond.end10
cond.end10: ; preds = %cond.true3, %cond.false6, %cond.true
%cond11.in = phi i1 [ %cmp1, %cond.true ], [ %cmp4.not, %cond.true3 ], [ %cmp7, %cond.false6 ]
%cond11 = zext i1 %cond11.in to i32
ret i32 %cond11
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @lower_bound(ptr nocapture noundef readonly %a, i32 noundef %l, i32 noundef %r, i64 noundef %val, i32 noundef %type) local_unnamed_addr #8 {
entry:
%sub34 = sub nsw i32 %r, %l
%cmp35 = icmp sgt i32 %sub34, 1
br i1 %cmp35, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%cmp.i = icmp slt i32 %type, 3
br i1 %cmp.i, label %while.body.us, label %while.body
while.body.us: ; preds = %while.body.lr.ph, %while.body.us
%l.addr.0 = phi i32 [ %spec.select, %while.body.us ], [ %l, %while.body.lr.ph ]
%r.addr.0 = phi i32 [ %spec.select51, %while.body.us ], [ %r, %while.body.lr.ph ]
%add.us = add nsw i32 %l.addr.0, %r.addr.0
%div.us = sdiv i32 %add.us, 2
%idxprom.us = sext i32 %div.us to i64
%arrayidx.us = getelementptr inbounds i64, ptr %a, i64 %idxprom.us
%0 = load i64, ptr %arrayidx.us, align 8, !tbaa !5
%cmp1.i.us = icmp slt i64 %0, %val
%spec.select = select i1 %cmp1.i.us, i32 %div.us, i32 %l.addr.0
%spec.select51 = select i1 %cmp1.i.us, i32 %r.addr.0, i32 %div.us
%sub.us = sub nsw i32 %spec.select51, %spec.select
%cmp.us = icmp sgt i32 %sub.us, 1
br i1 %cmp.us, label %while.body.us, label %while.end, !llvm.loop !25
while.body: ; preds = %while.body.lr.ph, %while.body
%l.addr.2 = phi i32 [ %spec.select52, %while.body ], [ %l, %while.body.lr.ph ]
%r.addr.2 = phi i32 [ %spec.select53, %while.body ], [ %r, %while.body.lr.ph ]
%add = add nsw i32 %l.addr.2, %r.addr.2
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %idxprom
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp6.not.i = icmp sgt i64 %1, %val
%spec.select52 = select i1 %cmp6.not.i, i32 %l.addr.2, i32 %div
%spec.select53 = select i1 %cmp6.not.i, i32 %div, i32 %r.addr.2
%sub = sub nsw i32 %spec.select53, %spec.select52
%cmp = icmp sgt i32 %sub, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !25
while.end: ; preds = %while.body, %while.body.us, %entry
%r.addr.0..lcssa = phi i32 [ %r, %entry ], [ %spec.select51, %while.body.us ], [ %spec.select53, %while.body ]
%l.addr.0..lcssa = phi i32 [ %l, %entry ], [ %spec.select, %while.body.us ], [ %spec.select52, %while.body ]
%idxprom1 = sext i32 %l.addr.0..lcssa to i64
%arrayidx2 = getelementptr inbounds i64, ptr %a, i64 %idxprom1
%2 = load i64, ptr %arrayidx2, align 8, !tbaa !5
switch i32 %type, label %cmp_lower.exit [
i32 1, label %cond.true.i
i32 2, label %cond.true3.i
]
cond.true.i: ; preds = %while.end
%cmp1.i17 = icmp eq i64 %2, %val
br i1 %cmp1.i17, label %cond.end9, label %cond.false.thread
cond.false.thread: ; preds = %cond.true.i
%idxprom345 = sext i32 %r.addr.0..lcssa to i64
%arrayidx446 = getelementptr inbounds i64, ptr %a, i64 %idxprom345
%3 = load i64, ptr %arrayidx446, align 8, !tbaa !5
%cmp1.i23 = icmp eq i64 %3, %val
br label %cmp_lower.exit26
cond.true3.i: ; preds = %while.end
%cmp4.not.i.not = icmp slt i64 %2, %val
br i1 %cmp4.not.i.not, label %cond.false.thread47, label %cond.end9
cond.false.thread47: ; preds = %cond.true3.i
%idxprom348 = sext i32 %r.addr.0..lcssa to i64
%arrayidx449 = getelementptr inbounds i64, ptr %a, i64 %idxprom348
%4 = load i64, ptr %arrayidx449, align 8, !tbaa !5
%cmp4.not.i19 = icmp sge i64 %4, %val
br label %cmp_lower.exit26
cmp_lower.exit: ; preds = %while.end
%cmp7.i = icmp sgt i64 %2, %val
br i1 %cmp7.i, label %cond.end9, label %cond.false
cond.false: ; preds = %cmp_lower.exit
%idxprom3 = sext i32 %r.addr.0..lcssa to i64
%arrayidx4 = getelementptr inbounds i64, ptr %a, i64 %idxprom3
%5 = load i64, ptr %arrayidx4, align 8, !tbaa !5
%cmp7.i25 = icmp sgt i64 %5, %val
br label %cmp_lower.exit26
cmp_lower.exit26: ; preds = %cond.false.thread, %cond.false.thread47, %cond.false
%cond11.in.i20 = phi i1 [ %cmp1.i23, %cond.false.thread ], [ %cmp4.not.i19, %cond.false.thread47 ], [ %cmp7.i25, %cond.false ]
%6 = sext i32 %r.addr.0..lcssa to i64
%.pre = select i1 %cond11.in.i20, i64 %6, i64 -1
br label %cond.end9
cond.end9: ; preds = %cond.true3.i, %cond.true.i, %cmp_lower.exit, %cmp_lower.exit26
%conv.pre-phi = phi i64 [ %idxprom1, %cmp_lower.exit ], [ %.pre, %cmp_lower.exit26 ], [ %idxprom1, %cond.true.i ], [ %idxprom1, %cond.true3.i ]
ret i64 %conv.pre-phi
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @upper_bound(ptr nocapture noundef readonly %a, i32 noundef %l, i32 noundef %r, i64 noundef %val, i32 noundef %type) local_unnamed_addr #8 {
entry:
%sub33 = sub nsw i32 %r, %l
%cmp34 = icmp sgt i32 %sub33, 1
br i1 %cmp34, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%cmp.i = icmp slt i32 %type, 3
br i1 %cmp.i, label %while.body.us, label %while.body
while.body.us: ; preds = %while.body.lr.ph, %while.body.us
%l.addr.0 = phi i32 [ %spec.select, %while.body.us ], [ %l, %while.body.lr.ph ]
%r.addr.0 = phi i32 [ %spec.select50, %while.body.us ], [ %r, %while.body.lr.ph ]
%add.us = add nsw i32 %l.addr.0, %r.addr.0
%div.us = sdiv i32 %add.us, 2
%idxprom.us = sext i32 %div.us to i64
%arrayidx.us = getelementptr inbounds i64, ptr %a, i64 %idxprom.us
%0 = load i64, ptr %arrayidx.us, align 8, !tbaa !5
%cmp1.not.i.us = icmp sgt i64 %0, %val
%spec.select = select i1 %cmp1.not.i.us, i32 %l.addr.0, i32 %div.us
%spec.select50 = select i1 %cmp1.not.i.us, i32 %div.us, i32 %r.addr.0
%sub.us = sub nsw i32 %spec.select50, %spec.select
%cmp.us = icmp sgt i32 %sub.us, 1
br i1 %cmp.us, label %while.body.us, label %while.end, !llvm.loop !26
while.body: ; preds = %while.body.lr.ph, %while.body
%l.addr.2 = phi i32 [ %spec.select51, %while.body ], [ %l, %while.body.lr.ph ]
%r.addr.2 = phi i32 [ %spec.select52, %while.body ], [ %r, %while.body.lr.ph ]
%add = add nsw i32 %l.addr.2, %r.addr.2
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %idxprom
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp6.i = icmp slt i64 %1, %val
%spec.select51 = select i1 %cmp6.i, i32 %div, i32 %l.addr.2
%spec.select52 = select i1 %cmp6.i, i32 %r.addr.2, i32 %div
%sub = sub nsw i32 %spec.select52, %spec.select51
%cmp = icmp sgt i32 %sub, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !26
while.end: ; preds = %while.body, %while.body.us, %entry
%r.addr.0..lcssa = phi i32 [ %r, %entry ], [ %spec.select50, %while.body.us ], [ %spec.select52, %while.body ]
%l.addr.0..lcssa = phi i32 [ %l, %entry ], [ %spec.select, %while.body.us ], [ %spec.select51, %while.body ]
%idxprom1 = sext i32 %r.addr.0..lcssa to i64
%arrayidx2 = getelementptr inbounds i64, ptr %a, i64 %idxprom1
%2 = load i64, ptr %arrayidx2, align 8, !tbaa !5
switch i32 %type, label %cmp_upper.exit [
i32 1, label %cond.true.i
i32 2, label %cond.true3.i
]
cond.true.i: ; preds = %while.end
%cmp1.i = icmp eq i64 %2, %val
br i1 %cmp1.i, label %cond.end9, label %cond.false.thread
cond.false.thread: ; preds = %cond.true.i
%idxprom344 = sext i32 %l.addr.0..lcssa to i64
%arrayidx445 = getelementptr inbounds i64, ptr %a, i64 %idxprom344
%3 = load i64, ptr %arrayidx445, align 8, !tbaa !5
%cmp1.i22 = icmp eq i64 %3, %val
br label %cmp_upper.exit25
cond.true3.i: ; preds = %while.end
%cmp4.not.i.not = icmp sgt i64 %2, %val
br i1 %cmp4.not.i.not, label %cond.false.thread46, label %cond.end9
cond.false.thread46: ; preds = %cond.true3.i
%idxprom347 = sext i32 %l.addr.0..lcssa to i64
%arrayidx448 = getelementptr inbounds i64, ptr %a, i64 %idxprom347
%4 = load i64, ptr %arrayidx448, align 8, !tbaa !5
%cmp4.not.i18 = icmp sle i64 %4, %val
br label %cmp_upper.exit25
cmp_upper.exit: ; preds = %while.end
%cmp7.i = icmp slt i64 %2, %val
br i1 %cmp7.i, label %cond.end9, label %cond.false
cond.false: ; preds = %cmp_upper.exit
%idxprom3 = sext i32 %l.addr.0..lcssa to i64
%arrayidx4 = getelementptr inbounds i64, ptr %a, i64 %idxprom3
%5 = load i64, ptr %arrayidx4, align 8, !tbaa !5
%cmp7.i24 = icmp slt i64 %5, %val
br label %cmp_upper.exit25
cmp_upper.exit25: ; preds = %cond.false.thread, %cond.false.thread46, %cond.false
%cond11.in.i19 = phi i1 [ %cmp1.i22, %cond.false.thread ], [ %cmp4.not.i18, %cond.false.thread46 ], [ %cmp7.i24, %cond.false ]
%6 = sext i32 %l.addr.0..lcssa to i64
%.pre = select i1 %cond11.in.i19, i64 %6, i64 -1
br label %cond.end9
cond.end9: ; preds = %cond.true3.i, %cond.true.i, %cmp_upper.exit, %cmp_upper.exit25
%conv.pre-phi = phi i64 [ %idxprom1, %cmp_upper.exit ], [ %.pre, %cmp_upper.exit25 ], [ %idxprom1, %cond.true.i ], [ %idxprom1, %cond.true3.i ]
ret i64 %conv.pre-phi
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @count(ptr nocapture noundef readonly %a, i32 noundef %l, i32 noundef %r, i64 noundef %x) local_unnamed_addr #8 {
entry:
%sub34.i = sub nsw i32 %r, %l
%cmp35.i = icmp sgt i32 %sub34.i, 1
br i1 %cmp35.i, label %while.body.us.i, label %while.end.i
while.body.us.i: ; preds = %entry, %while.body.us.i
%l.addr.0.i = phi i32 [ %spec.select.i, %while.body.us.i ], [ %l, %entry ]
%r.addr.0.i = phi i32 [ %spec.select51.i, %while.body.us.i ], [ %r, %entry ]
%add.us.i = add nsw i32 %r.addr.0.i, %l.addr.0.i
%div.us.i = sdiv i32 %add.us.i, 2
%idxprom.us.i = sext i32 %div.us.i to i64
%arrayidx.us.i = getelementptr inbounds i64, ptr %a, i64 %idxprom.us.i
%0 = load i64, ptr %arrayidx.us.i, align 8, !tbaa !5
%cmp1.i.us.i = icmp slt i64 %0, %x
%spec.select.i = select i1 %cmp1.i.us.i, i32 %div.us.i, i32 %l.addr.0.i
%spec.select51.i = select i1 %cmp1.i.us.i, i32 %r.addr.0.i, i32 %div.us.i
%sub.us.i = sub nsw i32 %spec.select51.i, %spec.select.i
%cmp.us.i = icmp sgt i32 %sub.us.i, 1
br i1 %cmp.us.i, label %while.body.us.i, label %while.end.i, !llvm.loop !25
while.end.i: ; preds = %while.body.us.i, %entry
%r.addr.0..lcssa.i = phi i32 [ %r, %entry ], [ %spec.select51.i, %while.body.us.i ]
%l.addr.0..lcssa.i = phi i32 [ %l, %entry ], [ %spec.select.i, %while.body.us.i ]
%idxprom1.i = sext i32 %l.addr.0..lcssa.i to i64
%arrayidx2.i = getelementptr inbounds i64, ptr %a, i64 %idxprom1.i
%1 = load i64, ptr %arrayidx2.i, align 8, !tbaa !5
%cmp1.i17.i = icmp eq i64 %1, %x
br i1 %cmp1.i17.i, label %lower_bound.exit, label %cond.false.thread.i
cond.false.thread.i: ; preds = %while.end.i
%idxprom345.i = sext i32 %r.addr.0..lcssa.i to i64
%arrayidx446.i = getelementptr inbounds i64, ptr %a, i64 %idxprom345.i
%2 = load i64, ptr %arrayidx446.i, align 8, !tbaa !5
%cmp1.i23.i = icmp eq i64 %2, %x
%.pre.i = select i1 %cmp1.i23.i, i64 %idxprom345.i, i64 -1
br label %lower_bound.exit
lower_bound.exit: ; preds = %while.end.i, %cond.false.thread.i
%conv.pre-phi.i = phi i64 [ %.pre.i, %cond.false.thread.i ], [ %idxprom1.i, %while.end.i ]
%conv = trunc i64 %conv.pre-phi.i to i32
%cmp = icmp eq i32 %conv, -1
br i1 %cmp, label %cond.end, label %cond.false
cond.false: ; preds = %lower_bound.exit
%sub33.i = sub nsw i32 %r, %conv
%cmp34.i = icmp sgt i32 %sub33.i, 1
br i1 %cmp34.i, label %while.body.us.i18, label %while.end.i9
while.body.us.i18: ; preds = %cond.false, %while.body.us.i18
%l.addr.0.i19 = phi i32 [ %spec.select.i25, %while.body.us.i18 ], [ %conv, %cond.false ]
%r.addr.0.i20 = phi i32 [ %spec.select50.i, %while.body.us.i18 ], [ %r, %cond.false ]
%add.us.i21 = add nsw i32 %r.addr.0.i20, %l.addr.0.i19
%div.us.i22 = sdiv i32 %add.us.i21, 2
%idxprom.us.i23 = sext i32 %div.us.i22 to i64
%arrayidx.us.i24 = getelementptr inbounds i64, ptr %a, i64 %idxprom.us.i23
%3 = load i64, ptr %arrayidx.us.i24, align 8, !tbaa !5
%cmp1.not.i.us.i = icmp sgt i64 %3, %x
%spec.select.i25 = select i1 %cmp1.not.i.us.i, i32 %l.addr.0.i19, i32 %div.us.i22
%spec.select50.i = select i1 %cmp1.not.i.us.i, i32 %div.us.i22, i32 %r.addr.0.i20
%sub.us.i26 = sub nsw i32 %spec.select50.i, %spec.select.i25
%cmp.us.i27 = icmp sgt i32 %sub.us.i26, 1
br i1 %cmp.us.i27, label %while.body.us.i18, label %while.end.i9, !llvm.loop !26
while.end.i9: ; preds = %while.body.us.i18, %cond.false
%r.addr.0..lcssa.i10 = phi i32 [ %r, %cond.false ], [ %spec.select50.i, %while.body.us.i18 ]
%l.addr.0..lcssa.i11 = phi i32 [ %conv, %cond.false ], [ %spec.select.i25, %while.body.us.i18 ]
%idxprom1.i12 = sext i32 %r.addr.0..lcssa.i10 to i64
%arrayidx2.i13 = getelementptr inbounds i64, ptr %a, i64 %idxprom1.i12
%4 = load i64, ptr %arrayidx2.i13, align 8, !tbaa !5
%cmp1.i.i = icmp eq i64 %4, %x
br i1 %cmp1.i.i, label %upper_bound.exit, label %cond.false.thread.i14
cond.false.thread.i14: ; preds = %while.end.i9
%idxprom344.i = sext i32 %l.addr.0..lcssa.i11 to i64
%arrayidx445.i = getelementptr inbounds i64, ptr %a, i64 %idxprom344.i
%5 = load i64, ptr %arrayidx445.i, align 8, !tbaa !5
%cmp1.i22.i = icmp eq i64 %5, %x
%.pre.i15 = select i1 %cmp1.i22.i, i64 %idxprom344.i, i64 -1
br label %upper_bound.exit
upper_bound.exit: ; preds = %while.end.i9, %cond.false.thread.i14
%conv.pre-phi.i16 = phi i64 [ %.pre.i15, %cond.false.thread.i14 ], [ %idxprom1.i12, %while.end.i9 ]
%reass.sub = sub nsw i64 %conv.pre-phi.i16, %conv.pre-phi.i
%add = add nsw i64 %reass.sub, 1
br label %cond.end
cond.end: ; preds = %lower_bound.exit, %upper_bound.exit
%cond = phi i64 [ %add, %upper_bound.exit ], [ 0, %lower_bound.exit ]
ret i64 %cond
}
; Function Attrs: nounwind uwtable
define dso_local i64 @factor_pre() local_unnamed_addr #10 {
entry:
%0 = load i64, ptr @is_factor_prepared, align 8, !tbaa !5
%inc = add nsw i64 %0, 1
store i64 %inc, ptr @is_factor_prepared, align 8, !tbaa !5
%tobool.not = icmp eq i64 %0, 0
br i1 %tobool.not, label %for.body6.peel.next, label %return
for.body6.peel.next: ; preds = %entry
%1 = tail call ptr @llvm.stacksave.p0()
%vla116 = alloca [500001 x i64], align 16
store i64 2, ptr %vla116, align 16, !tbaa !5
br label %vector.body
vector.body: ; preds = %vector.body, %for.body6.peel.next
%index = phi i64 [ 0, %for.body6.peel.next ], [ %index.next.1, %vector.body ]
%vec.ind = phi <2 x i64> [ <i64 1, i64 2>, %for.body6.peel.next ], [ %vec.ind.next.1, %vector.body ]
%offset.idx = or i64 %index, 1
%2 = shl nuw nsw <2 x i64> %vec.ind, <i64 1, i64 1>
%step.add = shl <2 x i64> %vec.ind, <i64 1, i64 1>
%3 = or <2 x i64> %2, <i64 1, i64 1>
%4 = add <2 x i64> %step.add, <i64 5, i64 5>
%5 = getelementptr inbounds i64, ptr %vla116, i64 %offset.idx
store <2 x i64> %3, ptr %5, align 8, !tbaa !5
%6 = getelementptr inbounds i64, ptr %5, i64 2
store <2 x i64> %4, ptr %6, align 8, !tbaa !5
%vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
%offset.idx.1 = or i64 %index, 5
%7 = shl nuw nsw <2 x i64> %vec.ind.next, <i64 1, i64 1>
%step.add.1 = shl <2 x i64> %vec.ind.next, <i64 1, i64 1>
%8 = or <2 x i64> %7, <i64 1, i64 1>
%9 = add <2 x i64> %step.add.1, <i64 5, i64 5>
%10 = getelementptr inbounds i64, ptr %vla116, i64 %offset.idx.1
store <2 x i64> %8, ptr %10, align 8, !tbaa !5
%11 = getelementptr inbounds i64, ptr %10, i64 2
store <2 x i64> %9, ptr %11, align 8, !tbaa !5
%index.next.1 = add nuw nsw i64 %index, 8
%vec.ind.next.1 = add <2 x i64> %vec.ind, <i64 8, i64 8>
%12 = icmp eq i64 %index.next.1, 500000
br i1 %12, label %for.body16, label %vector.body, !llvm.loop !27
for.body16: ; preds = %vector.body, %for.inc43
%i12.0124 = phi i64 [ %inc44, %for.inc43 ], [ 1, %vector.body ]
%arrayidx17 = getelementptr inbounds i64, ptr %vla116, i64 %i12.0124
%13 = load i64, ptr %arrayidx17, align 8, !tbaa !5
%tobool18.not = icmp eq i64 %13, 0
br i1 %tobool18.not, label %for.inc43, label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.body16
%mul21 = shl nuw nsw i64 %i12.0124, 1
%add22 = or i64 %mul21, 1
%div = udiv i64 500001, %add22
%cmp24.not122 = icmp ugt i64 %add22, 166667
br i1 %cmp24.not122, label %for.inc43, label %for.body26
for.body26: ; preds = %for.cond20.preheader, %for.inc38
%j.0123 = phi i64 [ %add39, %for.inc38 ], [ 3, %for.cond20.preheader ]
%mul29 = mul nuw nsw i64 %j.0123, %add22
%cmp30 = icmp ult i64 %mul29, 500001
br i1 %cmp30, label %if.then31, label %for.inc38
if.then31: ; preds = %for.body26
%14 = trunc i64 %mul29 to i32
%div35.lhs.trunc = add nsw i32 %14, -1
%div35120 = sdiv i32 %div35.lhs.trunc, 2
%div35.sext = zext i32 %div35120 to i64
%arrayidx36 = getelementptr inbounds i64, ptr %vla116, i64 %div35.sext
store i64 0, ptr %arrayidx36, align 8, !tbaa !5
br label %for.inc38
for.inc38: ; preds = %for.body26, %if.then31
%add39 = add nuw nsw i64 %j.0123, 2
%cmp24.not = icmp ugt i64 %add39, %div
br i1 %cmp24.not, label %for.inc43, label %for.body26, !llvm.loop !29
for.inc43: ; preds = %for.inc38, %for.cond20.preheader, %for.body16
%inc44 = add nuw nsw i64 %i12.0124, 1
%exitcond128.not = icmp eq i64 %inc44, 500001
br i1 %exitcond128.not, label %for.body51, label %for.body16, !llvm.loop !30
for.cond.cleanup50: ; preds = %for.inc83
tail call void @llvm.stackrestore.p0(ptr %1)
br label %return
for.body51: ; preds = %for.inc43, %for.inc83
%i47.0126 = phi i64 [ %inc84, %for.inc83 ], [ 0, %for.inc43 ]
%arrayidx52 = getelementptr inbounds i64, ptr %vla116, i64 %i47.0126
%15 = load i64, ptr %arrayidx52, align 8, !tbaa !5
%tobool53.not = icmp eq i64 %15, 0
br i1 %tobool53.not, label %for.inc83, label %cond.end75.1
cond.end75.1: ; preds = %for.body51
%16 = load ptr, ptr @factors, align 16, !tbaa !31
%17 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%add61 = shl i64 %17, 3
%mul62 = add i64 %add61, 8
%call = tail call ptr @realloc(ptr noundef %16, i64 noundef %mul62) #26
store ptr %call, ptr @factors, align 16, !tbaa !31
%18 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%arrayidx77 = getelementptr inbounds i64, ptr %call, i64 %18
store i64 %15, ptr %arrayidx77, align 8, !tbaa !5
%19 = load ptr, ptr getelementptr inbounds ([2 x ptr], ptr @factors, i64 0, i64 1), align 8, !tbaa !31
%add61.1 = shl i64 %18, 3
%mul62.1 = add i64 %add61.1, 8
%call.1 = tail call ptr @realloc(ptr noundef %19, i64 noundef %mul62.1) #26
store ptr %call.1, ptr getelementptr inbounds ([2 x ptr], ptr @factors, i64 0, i64 1), align 8, !tbaa !31
%20 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%inc73.1 = add nsw i64 %20, 1
store i64 %inc73.1, ptr @fac_cnt, align 8, !tbaa !5
%arrayidx77.1 = getelementptr inbounds i64, ptr %call.1, i64 %20
store i64 0, ptr %arrayidx77.1, align 8, !tbaa !5
br label %for.inc83
for.inc83: ; preds = %cond.end75.1, %for.body51
%inc84 = add nuw nsw i64 %i47.0126, 1
%exitcond129.not = icmp eq i64 %inc84, 500001
br i1 %exitcond129.not, label %for.cond.cleanup50, label %for.body51, !llvm.loop !33
return: ; preds = %entry, %for.cond.cleanup50
ret i64 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #11
; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #12
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #11
; Function Attrs: nounwind uwtable
define dso_local i64 @factor(i64 noundef %n, i64 noundef %new_common_plus) local_unnamed_addr #10 {
entry:
%call = tail call i64 @factor_pre()
%0 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%cmp52 = icmp sgt i64 %0, 0
br i1 %cmp52, label %for.cond1.preheader.lr.ph, label %cleanup30
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load ptr, ptr @factors, align 16, !tbaa !31
%2 = load ptr, ptr getelementptr inbounds ([2 x ptr], ptr @factors, i64 0, i64 1), align 8
br label %for.cond1.preheader
for.cond: ; preds = %cond.end22
%inc29 = add nuw nsw i64 %i.054, 1
%3 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%cmp = icmp slt i64 %inc29, %3
br i1 %cmp, label %for.cond1.preheader, label %cleanup30, !llvm.loop !34
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond
%i.054 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %inc29, %for.cond ]
%n.addr.053 = phi i64 [ %n, %for.cond1.preheader.lr.ph ], [ %n.addr.3, %for.cond ]
%arrayidx = getelementptr inbounds i64, ptr %1, i64 %i.054
%4 = load i64, ptr %arrayidx, align 8, !tbaa !5
br label %while.cond
while.cond: ; preds = %for.cond1.preheader, %land.rhs
%n.addr.2 = phi i64 [ %div, %land.rhs ], [ %n.addr.053, %for.cond1.preheader ]
%cnt.1 = phi i64 [ %add, %land.rhs ], [ 0, %for.cond1.preheader ]
%rem = srem i64 %n.addr.2, %4
%div = sdiv i64 %n.addr.2, %4
%cmp5 = icmp eq i64 %rem, 0
%conv = zext i1 %cmp5 to i64
%add = add nuw nsw i64 %cnt.1, %conv
%tobool.not = icmp eq i64 %add, 0
br i1 %tobool.not, label %for.inc, label %land.rhs
land.rhs: ; preds = %while.cond
%rem8 = srem i64 %div, %4
%cmp9 = icmp eq i64 %rem8, 0
br i1 %cmp9, label %while.cond, label %for.inc, !llvm.loop !35
for.inc: ; preds = %land.rhs, %while.cond
%n.addr.3 = phi i64 [ %div, %land.rhs ], [ %n.addr.2, %while.cond ]
switch i64 %new_common_plus, label %cond.false18 [
i64 1, label %cond.end22
i64 2, label %cond.true15
]
cond.true15: ; preds = %for.inc
%arrayidx16 = getelementptr inbounds i64, ptr %2, i64 %i.054
%5 = load i64, ptr %arrayidx16, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smax.i64(i64 %5, i64 %add)
br label %cond.end22
cond.false18: ; preds = %for.inc
%arrayidx19 = getelementptr inbounds i64, ptr %2, i64 %i.054
%6 = load i64, ptr %arrayidx19, align 8, !tbaa !5
%add20 = add nsw i64 %6, %add
br label %cond.end22
cond.end22: ; preds = %for.inc, %cond.true15, %cond.false18
%cond23 = phi i64 [ %cond.i, %cond.true15 ], [ %add20, %cond.false18 ], [ %add, %for.inc ]
%arrayidx24 = getelementptr inbounds i64, ptr %2, i64 %i.054
store i64 %cond23, ptr %arrayidx24, align 8, !tbaa !5
%7 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp26.not = icmp sgt i64 %7, %n.addr.3
br i1 %cmp26.not, label %cleanup30, label %for.cond
cleanup30: ; preds = %cond.end22, %for.cond, %entry
%n.addr.4 = phi i64 [ %n, %entry ], [ %n.addr.3, %for.cond ], [ %n.addr.3, %cond.end22 ]
ret i64 %n.addr.4
}
; Function Attrs: nounwind uwtable
define dso_local i64 @judge_prime(i64 noundef %n) local_unnamed_addr #10 {
entry:
%call = tail call i64 @factor_pre()
%0 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%cmp20 = icmp sgt i64 %0, 0
br i1 %cmp20, label %for.body.lr.ph, label %cleanup
for.body.lr.ph: ; preds = %entry
%1 = load ptr, ptr @factors, align 16, !tbaa !31
br label %for.body
for.body: ; preds = %for.body.lr.ph, %if.else
%i.022 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %if.else ]
%n.addr.021 = phi i64 [ %n, %for.body.lr.ph ], [ %spec.select, %if.else ]
%arrayidx = getelementptr inbounds i64, ptr %1, i64 %i.022
%2 = load i64, ptr %arrayidx, align 8, !tbaa !5
%mul = mul nsw i64 %2, %2
%cmp2 = icmp slt i64 %n.addr.021, %mul
%cmp4 = icmp eq i64 %n.addr.021, %2
%or.cond = or i1 %cmp4, %cmp2
br i1 %or.cond, label %cleanup, label %if.else
if.else: ; preds = %for.body
%rem = srem i64 %n.addr.021, %2
%cmp6 = icmp eq i64 %rem, 0
%spec.select = select i1 %cmp6, i64 1, i64 %n.addr.021
%inc = add nuw nsw i64 %i.022, 1
%exitcond.not = icmp eq i64 %inc, %0
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !36
cleanup: ; preds = %if.else, %for.body, %entry
%n.addr.0.lcssa = phi i64 [ %n, %entry ], [ %n.addr.021, %for.body ], [ %spec.select, %if.else ]
%cmp9 = icmp ne i64 %n.addr.0.lcssa, 1
%conv = zext i1 %cmp9 to i64
ret i64 %conv
}
; Function Attrs: nounwind uwtable
define dso_local i64 @makeinv(i64 noundef %n, i64 noundef %mod) local_unnamed_addr #10 {
entry:
%0 = load i64, ptr @is_minv_made, align 8, !tbaa !5
%inc = add nsw i64 %0, 1
store i64 %inc, ptr @is_minv_made, align 8, !tbaa !5
%tobool.not = icmp eq i64 %0, 0
br i1 %tobool.not, label %for.end, label %return
for.end: ; preds = %entry
%1 = load ptr, ptr @inv_arr, align 8, !tbaa !31
%call = tail call dereferenceable_or_null(16) ptr @realloc(ptr noundef %1, i64 noundef 16) #26
store ptr %call, ptr @inv_arr, align 8, !tbaa !31
%2 = load ptr, ptr @finv_arr, align 8, !tbaa !31
%call2 = tail call dereferenceable_or_null(16) ptr @realloc(ptr noundef %2, i64 noundef 16) #26
store ptr %call2, ptr @finv_arr, align 8, !tbaa !31
%3 = load ptr, ptr @inv_arr, align 8, !tbaa !31
%arrayidx = getelementptr inbounds i64, ptr %3, i64 1
store i64 1, ptr %arrayidx, align 8, !tbaa !5
%arrayidx3 = getelementptr inbounds i64, ptr %call2, i64 1
store i64 1, ptr %arrayidx3, align 8, !tbaa !5
store i64 1, ptr %call2, align 8, !tbaa !5
%cmp7.not43 = icmp slt i64 %n, 2
br i1 %cmp7.not43, label %return, label %for.body9
for.body9: ; preds = %for.end, %for.body9
%4 = phi ptr [ %6, %for.body9 ], [ %3, %for.end ]
%i5.044 = phi i64 [ %add10, %for.body9 ], [ 2, %for.end ]
%add10 = add nuw nsw i64 %i5.044, 1
%mul = shl i64 %add10, 3
%call11 = tail call ptr @realloc(ptr noundef nonnull %4, i64 noundef %mul) #26
store ptr %call11, ptr @inv_arr, align 8, !tbaa !31
%5 = load ptr, ptr @finv_arr, align 8, !tbaa !31
%call14 = tail call ptr @realloc(ptr noundef %5, i64 noundef %mul) #26
store ptr %call14, ptr @finv_arr, align 8, !tbaa !31
%6 = load ptr, ptr @inv_arr, align 8, !tbaa !31
%rem = srem i64 %mod, %i5.044
%arrayidx15 = getelementptr inbounds i64, ptr %6, i64 %rem
%7 = load i64, ptr %arrayidx15, align 8, !tbaa !5
%div = sdiv i64 %mod, %i5.044
%mul16 = mul nsw i64 %div, %7
%rem17 = srem i64 %mul16, %mod
%sub = sub nsw i64 %mod, %rem17
%arrayidx18 = getelementptr inbounds i64, ptr %6, i64 %i5.044
store i64 %sub, ptr %arrayidx18, align 8, !tbaa !5
%8 = getelementptr i64, ptr %call14, i64 %i5.044
%arrayidx20 = getelementptr i64, ptr %8, i64 -1
%9 = load i64, ptr %arrayidx20, align 8, !tbaa !5
%mul22 = mul nsw i64 %9, %sub
%rem23 = srem i64 %mul22, %mod
store i64 %rem23, ptr %8, align 8, !tbaa !5
%exitcond.not = icmp eq i64 %i5.044, %n
br i1 %exitcond.not, label %return, label %for.body9, !llvm.loop !37
return: ; preds = %for.body9, %for.end, %entry
ret i64 0
}
; Function Attrs: nounwind uwtable
define dso_local i64 @make_mf(i64 noundef %n, i64 noundef %mod) local_unnamed_addr #10 {
entry:
%0 = load i64, ptr @is_mf_made, align 8, !tbaa !5
%inc = add nsw i64 %0, 1
store i64 %inc, ptr @is_mf_made, align 8, !tbaa !5
%tobool.not = icmp eq i64 %0, 0
br i1 %tobool.not, label %for.end, label %return
for.end: ; preds = %entry
%1 = load ptr, ptr @mf_arr, align 8, !tbaa !31
%call = tail call dereferenceable_or_null(16) ptr @realloc(ptr noundef %1, i64 noundef 16) #26
store ptr %call, ptr @mf_arr, align 8, !tbaa !31
%arrayidx = getelementptr inbounds i64, ptr %call, i64 1
store i64 1, ptr %arrayidx, align 8, !tbaa !5
store i64 1, ptr %call, align 8, !tbaa !5
%cmp5.not24 = icmp slt i64 %n, 2
br i1 %cmp5.not24, label %return, label %for.body7
for.body7: ; preds = %for.end, %for.body7
%2 = phi ptr [ %call10, %for.body7 ], [ %call, %for.end ]
%i3.026 = phi i64 [ %add8, %for.body7 ], [ 2, %for.end ]
%x.025 = phi i64 [ %rem, %for.body7 ], [ 1, %for.end ]
%mul = mul nsw i64 %i3.026, %x.025
%rem = srem i64 %mul, %mod
%add8 = add nuw nsw i64 %i3.026, 1
%mul9 = shl i64 %add8, 3
%call10 = tail call ptr @realloc(ptr noundef nonnull %2, i64 noundef %mul9) #26
%arrayidx11 = getelementptr inbounds i64, ptr %call10, i64 %i3.026
store i64 %rem, ptr %arrayidx11, align 8, !tbaa !5
%exitcond.not = icmp eq i64 %i3.026, %n
br i1 %exitcond.not, label %return.loopexit, label %for.body7, !llvm.loop !38
return.loopexit: ; preds = %for.body7
store ptr %call10, ptr @mf_arr, align 8, !tbaa !31
br label %return
return: ; preds = %return.loopexit, %for.end, %entry
ret i64 0
}
; Function Attrs: nounwind uwtable
define dso_local i64 @m_inv(i64 noundef %x, i64 noundef %mod, i64 noundef %is_fac) local_unnamed_addr #10 {
entry:
%0 = load i64, ptr @num_of_inv, align 8, !tbaa !5
%call = tail call i64 @makeinv(i64 noundef %0, i64 noundef %mod)
%tobool.not = icmp eq i64 %is_fac, 0
%inv_arr.val = load ptr, ptr @inv_arr, align 8
%finv_arr.val = load ptr, ptr @finv_arr, align 8
%.pn = select i1 %tobool.not, ptr %inv_arr.val, ptr %finv_arr.val
%cond.in = getelementptr inbounds i64, ptr %.pn, i64 %x
%cond = load i64, ptr %cond.in, align 8, !tbaa !5
ret i64 %cond
}
; Function Attrs: nounwind uwtable
define dso_local i64 @m_f(i64 noundef %x, i64 noundef %mod) local_unnamed_addr #10 {
entry:
%0 = load i64, ptr @num_of_inv, align 8, !tbaa !5
%1 = load i64, ptr @is_mf_made, align 8, !tbaa !5
%inc.i = add nsw i64 %1, 1
store i64 %inc.i, ptr @is_mf_made, align 8, !tbaa !5
%tobool.not.i = icmp eq i64 %1, 0
%.pre = load ptr, ptr @mf_arr, align 8, !tbaa !31
br i1 %tobool.not.i, label %for.end.i, label %make_mf.exit
for.end.i: ; preds = %entry
%call.i = tail call dereferenceable_or_null(16) ptr @realloc(ptr noundef %.pre, i64 noundef 16) #26
store ptr %call.i, ptr @mf_arr, align 8, !tbaa !31
%arrayidx.i = getelementptr inbounds i64, ptr %call.i, i64 1
store i64 1, ptr %arrayidx.i, align 8, !tbaa !5
store i64 1, ptr %call.i, align 8, !tbaa !5
%cmp5.not24.i = icmp slt i64 %0, 2
br i1 %cmp5.not24.i, label %make_mf.exit, label %for.body7.i
for.body7.i: ; preds = %for.end.i, %for.body7.i
%2 = phi ptr [ %call10.i, %for.body7.i ], [ %call.i, %for.end.i ]
%i3.026.i = phi i64 [ %add8.i, %for.body7.i ], [ 2, %for.end.i ]
%x.025.i = phi i64 [ %rem.i, %for.body7.i ], [ 1, %for.end.i ]
%mul.i = mul nsw i64 %x.025.i, %i3.026.i
%rem.i = srem i64 %mul.i, %mod
%add8.i = add nuw nsw i64 %i3.026.i, 1
%mul9.i = shl i64 %add8.i, 3
%call10.i = tail call ptr @realloc(ptr noundef nonnull %2, i64 noundef %mul9.i) #26
%arrayidx11.i = getelementptr inbounds i64, ptr %call10.i, i64 %i3.026.i
store i64 %rem.i, ptr %arrayidx11.i, align 8, !tbaa !5
%exitcond.not.i = icmp eq i64 %i3.026.i, %0
br i1 %exitcond.not.i, label %return.loopexit.i, label %for.body7.i, !llvm.loop !38
return.loopexit.i: ; preds = %for.body7.i
store ptr %call10.i, ptr @mf_arr, align 8, !tbaa !31
br label %make_mf.exit
make_mf.exit: ; preds = %entry, %for.end.i, %return.loopexit.i
%3 = phi ptr [ %.pre, %entry ], [ %call.i, %for.end.i ], [ %call10.i, %return.loopexit.i ]
%arrayidx = getelementptr inbounds i64, ptr %3, i64 %x
%4 = load i64, ptr %arrayidx, align 8, !tbaa !5
ret i64 %4
}
; Function Attrs: nounwind uwtable
define dso_local i64 @mod_nck(i64 noundef %n, i64 noundef %k, i64 noundef %mod) local_unnamed_addr #10 {
entry:
%0 = load i64, ptr @num_of_inv, align 8, !tbaa !5
%1 = load i64, ptr @is_mf_made, align 8, !tbaa !5
%inc.i.i = add nsw i64 %1, 1
store i64 %inc.i.i, ptr @is_mf_made, align 8, !tbaa !5
%tobool.not.i.i = icmp eq i64 %1, 0
%.pre.i = load ptr, ptr @mf_arr, align 8, !tbaa !31
br i1 %tobool.not.i.i, label %for.end.i.i, label %m_f.exit
for.end.i.i: ; preds = %entry
%call.i.i = tail call dereferenceable_or_null(16) ptr @realloc(ptr noundef %.pre.i, i64 noundef 16) #26
store ptr %call.i.i, ptr @mf_arr, align 8, !tbaa !31
%arrayidx.i.i = getelementptr inbounds i64, ptr %call.i.i, i64 1
store i64 1, ptr %arrayidx.i.i, align 8, !tbaa !5
store i64 1, ptr %call.i.i, align 8, !tbaa !5
%cmp5.not24.i.i = icmp slt i64 %0, 2
br i1 %cmp5.not24.i.i, label %m_f.exit, label %for.body7.i.i
for.body7.i.i: ; preds = %for.end.i.i, %for.body7.i.i
%2 = phi ptr [ %call10.i.i, %for.body7.i.i ], [ %call.i.i, %for.end.i.i ]
%i3.026.i.i = phi i64 [ %add8.i.i, %for.body7.i.i ], [ 2, %for.end.i.i ]
%x.025.i.i = phi i64 [ %rem.i.i, %for.body7.i.i ], [ 1, %for.end.i.i ]
%mul.i.i = mul nsw i64 %x.025.i.i, %i3.026.i.i
%rem.i.i = srem i64 %mul.i.i, %mod
%add8.i.i = add nuw nsw i64 %i3.026.i.i, 1
%mul9.i.i = shl i64 %add8.i.i, 3
%call10.i.i = tail call ptr @realloc(ptr noundef nonnull %2, i64 noundef %mul9.i.i) #26
%arrayidx11.i.i = getelementptr inbounds i64, ptr %call10.i.i, i64 %i3.026.i.i
store i64 %rem.i.i, ptr %arrayidx11.i.i, align 8, !tbaa !5
%exitcond.not.i.i = icmp eq i64 %i3.026.i.i, %0
br i1 %exitcond.not.i.i, label %return.loopexit.i.i, label %for.body7.i.i, !llvm.loop !38
return.loopexit.i.i: ; preds = %for.body7.i.i
store ptr %call10.i.i, ptr @mf_arr, align 8, !tbaa !31
br label %m_f.exit
m_f.exit: ; preds = %entry, %for.end.i.i, %return.loopexit.i.i
%3 = phi ptr [ %.pre.i, %entry ], [ %call.i.i, %for.end.i.i ], [ %call10.i.i, %return.loopexit.i.i ]
%arrayidx.i = getelementptr inbounds i64, ptr %3, i64 %n
%4 = load i64, ptr %arrayidx.i, align 8, !tbaa !5
%5 = load i64, ptr @num_of_inv, align 8, !tbaa !5
%call.i = tail call i64 @makeinv(i64 noundef %5, i64 noundef %mod)
%finv_arr.val.i = load ptr, ptr @finv_arr, align 8
%cond.in.i = getelementptr inbounds i64, ptr %finv_arr.val.i, i64 %k
%cond.i = load i64, ptr %cond.in.i, align 8, !tbaa !5
%mul = mul nsw i64 %cond.i, %4
%rem = srem i64 %mul, %mod
%sub = sub nsw i64 %n, %k
%6 = load i64, ptr @num_of_inv, align 8, !tbaa !5
%call.i11 = tail call i64 @makeinv(i64 noundef %6, i64 noundef %mod)
%finv_arr.val.i13 = load ptr, ptr @finv_arr, align 8
%cond.in.i14 = getelementptr inbounds i64, ptr %finv_arr.val.i13, i64 %sub
%cond.i15 = load i64, ptr %cond.in.i14, align 8, !tbaa !5
%mul3 = mul nsw i64 %cond.i15, %rem
%rem4 = srem i64 %mul3, %mod
ret i64 %rem4
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @m_p(i64 noundef %r, i64 noundef %n, i64 noundef %mod) local_unnamed_addr #6 {
entry:
%cmp16 = icmp sgt i64 %n, 0
br i1 %cmp16, label %while.body, label %while.end
while.body: ; preds = %entry, %cond.end
%s.019 = phi i64 [ %rem2, %cond.end ], [ %r, %entry ]
%t.018 = phi i64 [ %cond, %cond.end ], [ 1, %entry ]
%n.addr.017 = phi i64 [ %shr, %cond.end ], [ %n, %entry ]
%and = and i64 %n.addr.017, 1
%tobool.not = icmp eq i64 %and, 0
br i1 %tobool.not, label %cond.end, label %cond.true
cond.true: ; preds = %while.body
%mul = mul nsw i64 %s.019, %t.018
%rem = srem i64 %mul, %mod
br label %cond.end
cond.end: ; preds = %while.body, %cond.true
%cond = phi i64 [ %rem, %cond.true ], [ %t.018, %while.body ]
%mul1 = mul nsw i64 %s.019, %s.019
%rem2 = srem i64 %mul1, %mod
%shr = lshr i64 %n.addr.017, 1
%cmp.not = icmp ult i64 %n.addr.017, 2
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !39
while.end: ; preds = %cond.end, %entry
%t.0.lcssa = phi i64 [ 1, %entry ], [ %cond, %cond.end ]
%tobool3.not = icmp eq i64 %r, 0
%cond7 = select i1 %tobool3.not, i64 0, i64 %t.0.lcssa
ret i64 %cond7
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @m_mul2(i64 noundef %a, i64 noundef %b, i64 noundef %mod) local_unnamed_addr #7 {
entry:
%mul = mul nsw i64 %b, %a
%rem = srem i64 %mul, %mod
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @m_mul3(i64 noundef %a, i64 noundef %b, i64 noundef %c, i64 noundef %mod) local_unnamed_addr #7 {
entry:
%mul = mul nsw i64 %b, %a
%rem = srem i64 %mul, %mod
%mul.i = mul nsw i64 %rem, %c
%rem.i = srem i64 %mul.i, %mod
ret i64 %rem.i
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @m_mul4(i64 noundef %a, i64 noundef %b, i64 noundef %c, i64 noundef %d, i64 noundef %mod) local_unnamed_addr #7 {
entry:
%mul = mul nsw i64 %b, %a
%rem = srem i64 %mul, %mod
%mul.i = mul nsw i64 %rem, %c
%rem.i = srem i64 %mul.i, %mod
%mul.i.i = mul nsw i64 %rem.i, %d
%rem.i.i = srem i64 %mul.i.i, %mod
ret i64 %rem.i.i
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @m_mul5(i64 noundef %a, i64 noundef %b, i64 noundef %c, i64 noundef %d, i64 noundef %e, i64 noundef %mod) local_unnamed_addr #7 {
entry:
%mul = mul nsw i64 %b, %a
%rem = srem i64 %mul, %mod
%mul.i = mul nsw i64 %rem, %c
%rem.i = srem i64 %mul.i, %mod
%mul.i.i = mul nsw i64 %rem.i, %d
%rem.i.i = srem i64 %mul.i.i, %mod
%mul.i.i.i = mul nsw i64 %rem.i.i, %e
%rem.i.i.i = srem i64 %mul.i.i.i, %mod
ret i64 %rem.i.i.i
}
; 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) #13 {
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) #13 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = sext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_string(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #14 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #27
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #15
; 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) #13 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !21
%conv = sext i8 %0 to i32
%1 = load i8, ptr %b, align 1, !tbaa !21
%conv1 = sext i8 %1 to i32
%sub = sub nsw i32 %conv, %conv1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #28
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #16
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @downll) #28
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sort_string(i32 noundef %n, i32 noundef %size, ptr noundef %s) local_unnamed_addr #2 {
entry:
%0 = zext i32 %size to i64
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %s, i64 noundef %conv, i64 noundef %0, ptr noundef nonnull @cmp_string) #28
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sort_char(ptr noundef %s) local_unnamed_addr #2 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #27
tail call void @qsort(ptr noundef %s, i64 noundef %call, i64 noundef 1, ptr noundef nonnull @cmp_char) #28
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #15
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @unique_string(i64 noundef %n, i64 noundef %size, ptr nocapture noundef readonly %s) local_unnamed_addr #17 {
entry:
%cmp8 = icmp sgt i64 %n, 1
br i1 %cmp8, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %spec.select, %for.body ]
ret i64 %ans.0.lcssa
for.body: ; preds = %entry, %for.body
%i.010 = phi i64 [ %inc2, %for.body ], [ 1, %entry ]
%ans.09 = phi i64 [ %spec.select, %for.body ], [ 1, %entry ]
%0 = mul nsw i64 %i.010, %size
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %0
%sub = add nsw i64 %i.010, -1
%1 = mul nsw i64 %sub, %size
%arrayidx1 = getelementptr inbounds i8, ptr %s, i64 %1
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %arrayidx1) #27
%tobool.not = icmp ne i32 %call, 0
%inc = zext i1 %tobool.not to i64
%spec.select = add nuw nsw i64 %ans.09, %inc
%inc2 = add nuw nsw i64 %i.010, 1
%exitcond.not = icmp eq i64 %inc2, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !40
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @unique_num(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #8 {
entry:
%cmp9 = icmp sgt i64 %n, 1
br i1 %cmp9, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = add i64 %n, -1
%min.iters.check = icmp ult i64 %n, 5
br i1 %min.iters.check, label %for.body.preheader16, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %0, -4
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 1, i64 0>, %vector.ph ], [ %9, %vector.body ]
%vec.phi12 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds i64, ptr %a, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = getelementptr inbounds i64, ptr %1, i64 2
%wide.load13 = load <2 x i64>, ptr %2, align 8, !tbaa !5
%3 = getelementptr i64, ptr %1, i64 -1
%wide.load14 = load <2 x i64>, ptr %3, align 8, !tbaa !5
%4 = getelementptr i64, ptr %1, i64 1
%wide.load15 = load <2 x i64>, ptr %4, align 8, !tbaa !5
%5 = icmp ne <2 x i64> %wide.load, %wide.load14
%6 = icmp ne <2 x i64> %wide.load13, %wide.load15
%7 = zext <2 x i1> %5 to <2 x i64>
%8 = zext <2 x i1> %6 to <2 x i64>
%9 = add <2 x i64> %vec.phi, %7
%10 = add <2 x i64> %vec.phi12, %8
%index.next = add nuw i64 %index, 4
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !41
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %10, %9
%12 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %0, %n.vec
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader16
for.body.preheader16: ; preds = %for.body.preheader, %middle.block
%i.011.ph = phi i64 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
%ans.010.ph = phi i64 [ 1, %for.body.preheader ], [ %12, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %12, %middle.block ], [ %spec.select, %for.body ]
ret i64 %ans.0.lcssa
for.body: ; preds = %for.body.preheader16, %for.body
%i.011 = phi i64 [ %inc3, %for.body ], [ %i.011.ph, %for.body.preheader16 ]
%ans.010 = phi i64 [ %spec.select, %for.body ], [ %ans.010.ph, %for.body.preheader16 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.011
%13 = load i64, ptr %arrayidx, align 8, !tbaa !5
%arrayidx1 = getelementptr i64, ptr %arrayidx, i64 -1
%14 = load i64, ptr %arrayidx1, align 8, !tbaa !5
%cmp2.not = icmp ne i64 %13, %14
%inc = zext i1 %cmp2.not to i64
%spec.select = add nuw nsw i64 %ans.010, %inc
%inc3 = add nuw nsw i64 %i.011, 1
%exitcond.not = icmp eq i64 %inc3, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !42
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp1(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #13 {
entry:
%0 = load i64, ptr %p, align 8, !tbaa !43
%1 = load i64, ptr %q, align 8, !tbaa !43
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp2(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #13 {
entry:
%0 = load i64, ptr %q, align 8, !tbaa !43
%1 = load i64, ptr %p, align 8, !tbaa !43
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @strsortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 16, ptr noundef nonnull @cmp1) #28
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @strsortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 16, ptr noundef nonnull @cmp2) #28
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @AVL_set_inside_rotate(ptr nocapture noundef %node, i32 noundef %is_right) local_unnamed_addr #18 {
entry:
%cmp = icmp eq i32 %is_right, 0
%cmp1 = icmp eq i32 %is_right, 1
%cond = select i1 %cmp, i32 -1, i32 1
%0 = load ptr, ptr %node, align 8, !tbaa !31
%idxprom = zext i1 %cmp to i64
%arrayidx = getelementptr inbounds %struct.node_AVL_set, ptr %0, i64 0, i32 3, i64 %idxprom
%1 = load ptr, ptr %arrayidx, align 8, !tbaa !31
%cmp3.not = icmp eq ptr %1, null
br i1 %cmp3.not, label %if.end43, label %if.then
if.then: ; preds = %entry
%diff = getelementptr inbounds %struct.node_AVL_set, ptr %0, i64 0, i32 1
%2 = load i32, ptr %diff, align 8, !tbaa !45
%mul = mul nsw i32 %2, %cond
%diff8 = getelementptr inbounds %struct.node_AVL_set, ptr %1, i64 0, i32 1
%3 = load i32, ptr %diff8, align 8, !tbaa !45
%mul9 = mul nsw i32 %3, %cond
%tobool10.not = icmp eq i32 %mul9, -1
br i1 %tobool10.not, label %if.else, label %if.then11
if.then11: ; preds = %if.then
%4 = xor i32 %mul9, -1
%tobool14.not = icmp eq i32 %2, %3
%sub15 = add nsw i32 %mul9, -1
%sub16 = add nsw i32 %mul, -2
%cond17 = select i1 %tobool14.not, i32 %sub16, i32 %sub15
br label %if.end
if.else: ; preds = %if.then
%tobool19.not = icmp eq i32 %2, 0
%cond26 = select i1 %tobool19.not, i32 -3, i32 -2
br label %if.end
if.end: ; preds = %if.else, %if.then11
%.pn = phi i32 [ %4, %if.then11 ], [ -1, %if.else ]
%nb.0 = phi i32 [ %cond17, %if.then11 ], [ %cond26, %if.else ]
%na.0 = add i32 %.pn, %mul
%mul27 = mul nsw i32 %na.0, %cond
store i32 %mul27, ptr %diff, align 8, !tbaa !45
%mul29 = mul nsw i32 %nb.0, %cond
store i32 %mul29, ptr %diff8, align 8, !tbaa !45
%idxprom35 = zext i1 %cmp1 to i64
%arrayidx36 = getelementptr inbounds %struct.node_AVL_set, ptr %1, i64 0, i32 3, i64 %idxprom35
%5 = load ptr, ptr %arrayidx36, align 8, !tbaa !31
store ptr %5, ptr %arrayidx, align 8, !tbaa !31
%6 = load ptr, ptr %node, align 8, !tbaa !31
store ptr %6, ptr %arrayidx36, align 8, !tbaa !31
store ptr %1, ptr %node, align 8, !tbaa !31
br label %if.end43
if.end43: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @AVL_set_inside_update(ptr nocapture noundef %node, i64 noundef %data, i32 noundef %add) local_unnamed_addr #10 {
entry:
%0 = load ptr, ptr %node, align 8, !tbaa !31
%cmp = icmp eq ptr %0, null
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%cmp1 = icmp eq i32 %add, 2
br i1 %cmp1, label %if.then2, label %return
if.then2: ; preds = %if.then
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #29
store ptr %call, ptr %node, align 8, !tbaa !31
store i64 %data, ptr %call, align 8, !tbaa !47
%cnt = getelementptr inbounds %struct.node_AVL_set, ptr %call, i64 0, i32 2
store i32 1, ptr %cnt, align 4, !tbaa !48
%diff = getelementptr inbounds %struct.node_AVL_set, ptr %call, i64 0, i32 1
store i32 0, ptr %diff, align 8, !tbaa !45
%child = getelementptr inbounds %struct.node_AVL_set, ptr %call, i64 0, i32 3
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %child, i8 0, i64 16, i1 false)
br label %return
if.else: ; preds = %entry
%1 = load i64, ptr %0, align 8, !tbaa !47
%cmp8 = icmp eq i64 %1, %data
br i1 %cmp8, label %if.then10, label %if.else56
if.then10: ; preds = %if.else
switch i32 %add, label %land.lhs.true [
i32 2, label %if.then13
i32 0, label %if.else21
]
if.then13: ; preds = %if.then10
%cnt14 = getelementptr inbounds %struct.node_AVL_set, ptr %0, i64 0, i32 2
%2 = load i32, ptr %cnt14, align 4, !tbaa !48
%inc = add nsw i32 %2, 1
store i32 %inc, ptr %cnt14, align 4, !tbaa !48
br label %return
land.lhs.true: ; preds = %if.then10
%cnt16 = getelementptr inbounds %struct.node_AVL_set, ptr %0, i64 0, i32 2
%3 = load i32, ptr %cnt16, align 4, !tbaa !48
%cmp17 = icmp sgt i32 %3, 1
br i1 %cmp17, label %if.then19, label %if.else21
if.then19: ; preds = %land.lhs.true
%dec = add nsw i32 %3, -1
store i32 %dec, ptr %cnt16, align 4, !tbaa !48
br label %return
if.else21: ; preds = %if.then10, %land.lhs.true
%child22 = getelementptr inbounds %struct.node_AVL_set, ptr %0, i64 0, i32 3
%arrayidx23 = getelementptr inbounds %struct.node_AVL_set, ptr %0, i64 0, i32 3, i64 1
%4 = load ptr, ptr %arrayidx23, align 8, !tbaa !31
%cmp24 = icmp eq ptr %4, null
%5 = load ptr, ptr %child22, align 8, !tbaa !31
br i1 %cmp24, label %if.then26, label %if.else29
if.then26: ; preds = %if.else21
tail call void @free(ptr noundef nonnull %0) #28
store ptr %5, ptr %node, align 8, !tbaa !31
br label %return
if.else29: ; preds = %if.else21
%cmp32 = icmp eq ptr %5, null
br i1 %cmp32, label %if.then34, label %for.cond
if.then34: ; preds = %if.else29
tail call void @free(ptr noundef nonnull %0) #28
store ptr %4, ptr %node, align 8, !tbaa !31
br label %return
for.cond: ; preds = %if.else29, %for.cond
%next_node.0 = phi ptr [ %6, %for.cond ], [ %5, %if.else29 ]
%arrayidx41 = getelementptr inbounds %struct.node_AVL_set, ptr %next_node.0, i64 0, i32 3, i64 1
%6 = load ptr, ptr %arrayidx41, align 8, !tbaa !31
%cmp42.not = icmp eq ptr %6, null
br i1 %cmp42.not, label %for.end, label %for.cond, !llvm.loop !49
for.end: ; preds = %for.cond
%7 = load i64, ptr %next_node.0, align 8, !tbaa !47
store i64 %7, ptr %0, align 8, !tbaa !47
%8 = load i64, ptr %next_node.0, align 8, !tbaa !47
%call51 = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %child22, i64 noundef %8, i32 noundef %add), !range !50
br label %if.end69
if.else56: ; preds = %if.else
%cmp58.not = icmp sle i64 %1, %data
%cmp62 = icmp sgt i64 %1, %data
%cond64 = select i1 %cmp62, i32 1, i32 -1
%idxprom66 = zext i1 %cmp58.not to i64
%arrayidx67 = getelementptr inbounds %struct.node_AVL_set, ptr %0, i64 0, i32 3, i64 %idxprom66
%call68 = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %arrayidx67, i64 noundef %data, i32 noundef %add), !range !50
br label %if.end69
if.end69: ; preds = %if.else56, %for.end
%delta.0 = phi i32 [ %call51, %for.end ], [ %call68, %if.else56 ]
%delta_sign.0 = phi i32 [ 1, %for.end ], [ %cond64, %if.else56 ]
%tobool70.not = icmp eq i32 %delta.0, 0
br i1 %tobool70.not, label %return, label %if.then71
if.then71: ; preds = %if.end69
%9 = load ptr, ptr %node, align 8, !tbaa !31
%diff72 = getelementptr inbounds %struct.node_AVL_set, ptr %9, i64 0, i32 1
%10 = load i32, ptr %diff72, align 8, !tbaa !45
%mul = mul nsw i32 %delta_sign.0, %delta.0
%add74 = add nsw i32 %10, %mul
store i32 %add74, ptr %diff72, align 8, !tbaa !45
%cmp76 = icmp sgt i32 %add74, 1
br i1 %cmp76, label %if.then87, label %if.else79
if.else79: ; preds = %if.then71
%cmp81 = icmp slt i32 %add74, -1
br i1 %cmp81, label %if.then87, label %if.end110
if.then87: ; preds = %if.else79, %if.then71
%rotate_l.0.ph = phi i64 [ 0, %if.then71 ], [ 1, %if.else79 ]
%diff_sign.0.ph = phi i32 [ 1, %if.then71 ], [ -1, %if.else79 ]
%cmp.i197 = xor i1 %cmp76, true
%arrayidx90 = getelementptr inbounds %struct.node_AVL_set, ptr %9, i64 0, i32 3, i64 %rotate_l.0.ph
%11 = load ptr, ptr %arrayidx90, align 8, !tbaa !31
%diff91 = getelementptr inbounds %struct.node_AVL_set, ptr %11, i64 0, i32 1
%12 = load i32, ptr %diff91, align 8, !tbaa !45
%mul96 = mul nsw i32 %12, %diff_sign.0.ph
%cmp97 = icmp slt i32 %mul96, 0
br i1 %cmp97, label %if.then99, label %if.end104
if.then99: ; preds = %if.then87
%cond.i = select i1 %cmp76, i32 -1, i32 1
%idxprom.i = zext i1 %cmp76 to i64
%arrayidx.i = getelementptr inbounds %struct.node_AVL_set, ptr %11, i64 0, i32 3, i64 %idxprom.i
%13 = load ptr, ptr %arrayidx.i, align 8, !tbaa !31
%cmp3.not.i = icmp eq ptr %13, null
br i1 %cmp3.not.i, label %if.end104, label %if.then.i
if.then.i: ; preds = %if.then99
%mul.i = mul nsw i32 %12, %cond.i
%diff8.i = getelementptr inbounds %struct.node_AVL_set, ptr %13, i64 0, i32 1
%14 = load i32, ptr %diff8.i, align 8, !tbaa !45
%mul9.i = mul nsw i32 %14, %cond.i
%tobool10.not.i = icmp eq i32 %mul9.i, -1
br i1 %tobool10.not.i, label %if.else.i, label %if.then11.i
if.then11.i: ; preds = %if.then.i
%15 = xor i32 %mul9.i, -1
%tobool14.not.i = icmp eq i32 %12, %14
%sub15.i = add nsw i32 %mul9.i, -1
%sub16.i = add nsw i32 %mul.i, -2
%cond17.i = select i1 %tobool14.not.i, i32 %sub16.i, i32 %sub15.i
br label %if.end.i
if.else.i: ; preds = %if.then.i
%tobool19.not.i = icmp eq i32 %12, 0
%cond26.i = select i1 %tobool19.not.i, i32 -3, i32 -2
br label %if.end.i
if.end.i: ; preds = %if.else.i, %if.then11.i
%.pn.i = phi i32 [ %15, %if.then11.i ], [ -1, %if.else.i ]
%nb.0.i = phi i32 [ %cond17.i, %if.then11.i ], [ %cond26.i, %if.else.i ]
%na.0.i = add i32 %.pn.i, %mul.i
%mul27.i = mul nsw i32 %na.0.i, %cond.i
store i32 %mul27.i, ptr %diff91, align 8, !tbaa !45
%mul29.i = mul nsw i32 %nb.0.i, %cond.i
store i32 %mul29.i, ptr %diff8.i, align 8, !tbaa !45
%idxprom35.i = zext i1 %cmp.i197 to i64
%arrayidx36.i = getelementptr inbounds %struct.node_AVL_set, ptr %13, i64 0, i32 3, i64 %idxprom35.i
%16 = load ptr, ptr %arrayidx36.i, align 8, !tbaa !31
store ptr %16, ptr %arrayidx.i, align 8, !tbaa !31
%17 = load ptr, ptr %arrayidx90, align 8, !tbaa !31
store ptr %17, ptr %arrayidx36.i, align 8, !tbaa !31
store ptr %13, ptr %arrayidx90, align 8, !tbaa !31
%.pre = load ptr, ptr %node, align 8, !tbaa !31
br label %if.end104
if.end104: ; preds = %if.end.i, %if.then99, %if.then87
%18 = phi ptr [ %.pre, %if.end.i ], [ %9, %if.then99 ], [ %9, %if.then87 ]
%cond.i199 = select i1 %cmp76, i32 1, i32 -1
%idxprom.i200 = zext i1 %cmp.i197 to i64
%arrayidx.i201 = getelementptr inbounds %struct.node_AVL_set, ptr %18, i64 0, i32 3, i64 %idxprom.i200
%19 = load ptr, ptr %arrayidx.i201, align 8, !tbaa !31
%cmp3.not.i202 = icmp eq ptr %19, null
br i1 %cmp3.not.i202, label %AVL_set_inside_rotate.exit225, label %if.then.i203
if.then.i203: ; preds = %if.end104
%diff.i204 = getelementptr inbounds %struct.node_AVL_set, ptr %18, i64 0, i32 1
%20 = load i32, ptr %diff.i204, align 8, !tbaa !45
%mul.i205 = mul nsw i32 %20, %cond.i199
%diff8.i206 = getelementptr inbounds %struct.node_AVL_set, ptr %19, i64 0, i32 1
%21 = load i32, ptr %diff8.i206, align 8, !tbaa !45
%mul9.i207 = mul nsw i32 %21, %cond.i199
%tobool10.not.i208 = icmp eq i32 %mul9.i207, -1
br i1 %tobool10.not.i208, label %if.else.i222, label %if.then11.i209
if.then11.i209: ; preds = %if.then.i203
%22 = xor i32 %mul9.i207, -1
%tobool14.not.i210 = icmp eq i32 %20, %21
%sub15.i211 = add nsw i32 %mul9.i207, -1
%sub16.i212 = add nsw i32 %mul.i205, -2
%cond17.i213 = select i1 %tobool14.not.i210, i32 %sub16.i212, i32 %sub15.i211
br label %if.end.i214
if.else.i222: ; preds = %if.then.i203
%tobool19.not.i223 = icmp eq i32 %20, 0
%cond26.i224 = select i1 %tobool19.not.i223, i32 -3, i32 -2
br label %if.end.i214
if.end.i214: ; preds = %if.else.i222, %if.then11.i209
%.pn.i215 = phi i32 [ %22, %if.then11.i209 ], [ -1, %if.else.i222 ]
%nb.0.i216 = phi i32 [ %cond17.i213, %if.then11.i209 ], [ %cond26.i224, %if.else.i222 ]
%na.0.i217 = add i32 %.pn.i215, %mul.i205
%mul27.i218 = mul nsw i32 %na.0.i217, %cond.i199
store i32 %mul27.i218, ptr %diff.i204, align 8, !tbaa !45
%mul29.i219 = mul nsw i32 %nb.0.i216, %cond.i199
store i32 %mul29.i219, ptr %diff8.i206, align 8, !tbaa !45
%idxprom35.i220 = zext i1 %cmp76 to i64
%arrayidx36.i221 = getelementptr inbounds %struct.node_AVL_set, ptr %19, i64 0, i32 3, i64 %idxprom35.i220
%23 = load ptr, ptr %arrayidx36.i221, align 8, !tbaa !31
store ptr %23, ptr %arrayidx.i201, align 8, !tbaa !31
%24 = load ptr, ptr %node, align 8, !tbaa !31
store ptr %24, ptr %arrayidx36.i221, align 8, !tbaa !31
store ptr %19, ptr %node, align 8, !tbaa !31
br label %AVL_set_inside_rotate.exit225
AVL_set_inside_rotate.exit225: ; preds = %if.end104, %if.end.i214
%cmp105 = icmp slt i32 %delta.0, 0
%cmp107 = icmp ne i32 %12, 0
%25 = and i1 %cmp105, %cmp107
%cond109 = sext i1 %25 to i32
br label %return
if.end110: ; preds = %if.else79
%cmp111 = icmp sgt i32 %delta.0, 0
%cmp114 = icmp eq i32 %10, 0
%or.cond = and i1 %cmp111, %cmp114
br i1 %or.cond, label %return, label %if.else117
if.else117: ; preds = %if.end110
%cmp118 = icmp slt i32 %delta.0, 0
%cmp121 = icmp ne i32 %10, 0
%or.cond134 = and i1 %cmp118, %cmp121
%. = sext i1 %or.cond134 to i32
br label %return
return: ; preds = %if.then13, %if.then19, %if.then26, %if.then34, %if.else117, %if.end110, %AVL_set_inside_rotate.exit225, %if.end69, %if.then2, %if.then
%retval.2 = phi i32 [ 1, %if.then2 ], [ 0, %if.then ], [ 0, %if.then13 ], [ 0, %if.then19 ], [ -1, %if.then26 ], [ -1, %if.then34 ], [ %cond109, %AVL_set_inside_rotate.exit225 ], [ 1, %if.end110 ], [ %., %if.else117 ], [ 0, %if.end69 ]
ret i32 %retval.2
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #19
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #20
; Function Attrs: nofree nounwind uwtable
define dso_local void @AVL_set_inside_print(ptr noundef readonly %node, i32 noundef %depth) local_unnamed_addr #2 {
entry:
%cmp9 = icmp eq ptr %node, null
br i1 %cmp9, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%depth.tr11 = phi i32 [ %add, %if.end ], [ %depth, %entry ]
%node.tr10 = phi ptr [ %3, %if.end ], [ %node, %entry ]
%child = getelementptr inbounds %struct.node_AVL_set, ptr %node.tr10, i64 0, i32 3
%arrayidx = getelementptr inbounds %struct.node_AVL_set, ptr %node.tr10, i64 0, i32 3, i64 1
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !31
%add = add nsw i32 %depth.tr11, 1
tail call void @AVL_set_inside_print(ptr noundef %0, i32 noundef %add)
%1 = load i64, ptr %node.tr10, align 8, !tbaa !47
%cnt = getelementptr inbounds %struct.node_AVL_set, ptr %node.tr10, i64 0, i32 2
%2 = load i32, ptr %cnt, align 4, !tbaa !48
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %1, i32 noundef %2)
%3 = load ptr, ptr %child, align 8, !tbaa !31
%cmp = icmp eq ptr %3, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nounwind uwtable
define dso_local void @AVL_set_inside_free(ptr noundef %node) local_unnamed_addr #10 {
entry:
%cmp = icmp eq ptr %node, null
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%child = getelementptr inbounds %struct.node_AVL_set, ptr %node, i64 0, i32 3
%0 = load ptr, ptr %child, align 8, !tbaa !31
tail call void @AVL_set_inside_free(ptr noundef %0)
%arrayidx2 = getelementptr inbounds %struct.node_AVL_set, ptr %node, i64 0, i32 3, i64 1
%1 = load ptr, ptr %arrayidx2, align 8, !tbaa !31
tail call void @AVL_set_inside_free(ptr noundef %1)
tail call void @free(ptr noundef nonnull %node) #28
br label %common.ret6
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i64 @AVL_set_inside_count(ptr noundef readonly %root, i64 noundef %val) local_unnamed_addr #21 {
entry:
%tobool.not16 = icmp eq ptr %root, null
br i1 %tobool.not16, label %cleanup, label %while.body
while.body: ; preds = %entry, %if.end8
%node.017 = phi ptr [ %node.1, %if.end8 ], [ %root, %entry ]
%0 = load i64, ptr %node.017, align 8, !tbaa !47
%cmp = icmp sgt i64 %0, %val
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %while.body
%child = getelementptr inbounds %struct.node_AVL_set, ptr %node.017, i64 0, i32 3
br label %if.end8
if.else: ; preds = %while.body
%cmp3 = icmp slt i64 %0, %val
br i1 %cmp3, label %if.then4, label %if.else7
if.then4: ; preds = %if.else
%arrayidx6 = getelementptr inbounds %struct.node_AVL_set, ptr %node.017, i64 0, i32 3, i64 1
br label %if.end8
if.else7: ; preds = %if.else
%cnt = getelementptr inbounds %struct.node_AVL_set, ptr %node.017, i64 0, i32 2
%1 = load i32, ptr %cnt, align 4, !tbaa !48
%conv = sext i32 %1 to i64
br label %cleanup
if.end8: ; preds = %if.then4, %if.then
%node.1.in = phi ptr [ %child, %if.then ], [ %arrayidx6, %if.then4 ]
%node.1 = load ptr, ptr %node.1.in, align 8, !tbaa !31
%tobool.not = icmp eq ptr %node.1, null
br i1 %tobool.not, label %cleanup, label %while.body, !llvm.loop !51
cleanup: ; preds = %if.end8, %entry, %if.else7
%retval.0 = phi i64 [ %conv, %if.else7 ], [ 0, %entry ], [ 0, %if.end8 ]
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i64 @AVL_set_inside_minmax(ptr nocapture noundef readonly %root, i32 noundef %type) local_unnamed_addr #21 {
entry:
%idxprom = sext i32 %type to i64
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%root.addr.0 = phi ptr [ %root, %entry ], [ %0, %while.cond ]
%arrayidx = getelementptr inbounds %struct.node_AVL_set, ptr %root.addr.0, i64 0, i32 3, i64 %idxprom
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !31
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !52
while.end: ; preds = %while.cond
%1 = load i64, ptr %root.addr.0, align 8, !tbaa !47
ret i64 %1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @AVL_set_inside_swap(ptr nocapture noundef %node1, ptr nocapture noundef %node2) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr %node1, align 8, !tbaa !31
%1 = load ptr, ptr %node2, align 8, !tbaa !31
store ptr %1, ptr %node1, align 8, !tbaa !31
store ptr %0, ptr %node2, align 8, !tbaa !31
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i64 @set_main(i32 noundef %command, i32 noundef %set_num, i64 noundef %val) local_unnamed_addr #10 {
entry:
%.b114 = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b114, label %if.end, label %if.then
if.then: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !31
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
switch i32 %command, label %return [
i32 -1, label %if.then2
i32 1, label %if.then6
i32 2, label %if.then18
i32 3, label %if.then24
i32 4, label %if.end.if.then40_crit_edge
i32 5, label %if.end.if.then49_crit_edge
i32 6, label %if.end.if.then58_crit_edge
i32 7, label %if.end.if.then63_crit_edge
i32 8, label %if.end.if.then69_crit_edge
i32 9, label %if.end.if.then75_crit_edge
]
if.end.if.then40_crit_edge: ; preds = %if.end
%.pre170 = sext i32 %set_num to i64
br label %if.then40
if.end.if.then49_crit_edge: ; preds = %if.end
%.pre171 = sext i32 %set_num to i64
br label %if.then49
if.end.if.then58_crit_edge: ; preds = %if.end
%.pre172 = sext i32 %set_num to i64
br label %if.then58
if.end.if.then63_crit_edge: ; preds = %if.end
%.pre173 = sext i32 %set_num to i64
br label %if.then63
if.end.if.then69_crit_edge: ; preds = %if.end
%.pre174 = sext i32 %set_num to i64
br label %if.then69
if.end.if.then75_crit_edge: ; preds = %if.end
%.pre175 = sext i32 %set_num to i64
br label %if.then75
if.then2: ; preds = %if.end
%idxprom = sext i32 %set_num to i64
%arrayidx3 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom
%0 = load ptr, ptr %arrayidx3, align 8, !tbaa !31
tail call void @AVL_set_inside_print(ptr noundef %0, i32 noundef 0)
br label %return
if.then6: ; preds = %if.end
%idxprom7 = sext i32 %set_num to i64
%arrayidx8 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom7
%1 = load ptr, ptr %arrayidx8, align 8, !tbaa !31
%tobool.not16.i = icmp eq ptr %1, null
br i1 %tobool.not16.i, label %cond.false, label %while.body.i
while.body.i: ; preds = %if.then6, %if.end8.i
%node.017.i = phi ptr [ %node.1.i, %if.end8.i ], [ %1, %if.then6 ]
%2 = load i64, ptr %node.017.i, align 8, !tbaa !47
%cmp.i = icmp sgt i64 %2, %val
br i1 %cmp.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %while.body.i
%child.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i, i64 0, i32 3
br label %if.end8.i
if.else.i: ; preds = %while.body.i
%cmp3.i = icmp slt i64 %2, %val
br i1 %cmp3.i, label %if.then4.i, label %AVL_set_inside_count.exit
if.then4.i: ; preds = %if.else.i
%arrayidx6.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i, i64 0, i32 3, i64 1
br label %if.end8.i
if.end8.i: ; preds = %if.then4.i, %if.then.i
%node.1.in.i = phi ptr [ %child.i, %if.then.i ], [ %arrayidx6.i, %if.then4.i ]
%node.1.i = load ptr, ptr %node.1.in.i, align 8, !tbaa !31
%tobool.not.i = icmp eq ptr %node.1.i, null
br i1 %tobool.not.i, label %cond.false, label %while.body.i, !llvm.loop !51
AVL_set_inside_count.exit: ; preds = %if.else.i
%cnt.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i, i64 0, i32 2
%3 = load i32, ptr %cnt.i, align 4, !tbaa !48
%tobool9.not = icmp eq i32 %3, 0
br i1 %tobool9.not, label %cond.false, label %cond.end
cond.false: ; preds = %if.end8.i, %if.then6, %AVL_set_inside_count.exit
%arrayidx11 = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %idxprom7
%4 = load i64, ptr %arrayidx11, align 8, !tbaa !5
%inc12 = add nsw i64 %4, 1
store i64 %inc12, ptr %arrayidx11, align 8, !tbaa !5
br label %cond.end
cond.end: ; preds = %AVL_set_inside_count.exit, %cond.false
%call15 = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %arrayidx8, i64 noundef %val, i32 noundef 2), !range !50
br label %return
if.then18: ; preds = %if.end
%.pre = sext i32 %set_num to i64
%arrayidx20 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre
%5 = load ptr, ptr %arrayidx20, align 8, !tbaa !31
%tobool.not16.i115 = icmp eq ptr %5, null
br i1 %tobool.not16.i115, label %return, label %while.body.i116
while.body.i116: ; preds = %if.then18, %if.end8.i127
%node.017.i117 = phi ptr [ %node.1.i129, %if.end8.i127 ], [ %5, %if.then18 ]
%6 = load i64, ptr %node.017.i117, align 8, !tbaa !47
%cmp.i118 = icmp sgt i64 %6, %val
br i1 %cmp.i118, label %if.then.i131, label %if.else.i119
if.then.i131: ; preds = %while.body.i116
%child.i132 = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i117, i64 0, i32 3
br label %if.end8.i127
if.else.i119: ; preds = %while.body.i116
%cmp3.i120 = icmp slt i64 %6, %val
br i1 %cmp3.i120, label %if.then4.i125, label %if.else7.i121
if.then4.i125: ; preds = %if.else.i119
%arrayidx6.i126 = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i117, i64 0, i32 3, i64 1
br label %if.end8.i127
if.else7.i121: ; preds = %if.else.i119
%cnt.i122 = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i117, i64 0, i32 2
%7 = load i32, ptr %cnt.i122, align 4, !tbaa !48
%conv.i123 = sext i32 %7 to i64
br label %return
if.end8.i127: ; preds = %if.then4.i125, %if.then.i131
%node.1.in.i128 = phi ptr [ %child.i132, %if.then.i131 ], [ %arrayidx6.i126, %if.then4.i125 ]
%node.1.i129 = load ptr, ptr %node.1.in.i128, align 8, !tbaa !31
%tobool.not.i130 = icmp eq ptr %node.1.i129, null
br i1 %tobool.not.i130, label %return, label %while.body.i116, !llvm.loop !51
if.then24: ; preds = %if.end
%.pre169 = sext i32 %set_num to i64
%arrayidx26 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre169
%8 = load ptr, ptr %arrayidx26, align 8, !tbaa !31
%tobool.not16.i134 = icmp eq ptr %8, null
br i1 %tobool.not16.i134, label %cond.false30, label %while.body.i135
while.body.i135: ; preds = %if.then24, %if.end8.i146
%node.017.i136 = phi ptr [ %node.1.i148, %if.end8.i146 ], [ %8, %if.then24 ]
%9 = load i64, ptr %node.017.i136, align 8, !tbaa !47
%cmp.i137 = icmp sgt i64 %9, %val
br i1 %cmp.i137, label %if.then.i150, label %if.else.i138
if.then.i150: ; preds = %while.body.i135
%child.i151 = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i136, i64 0, i32 3
br label %if.end8.i146
if.else.i138: ; preds = %while.body.i135
%cmp3.i139 = icmp slt i64 %9, %val
br i1 %cmp3.i139, label %if.then4.i144, label %AVL_set_inside_count.exit152
if.then4.i144: ; preds = %if.else.i138
%arrayidx6.i145 = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i136, i64 0, i32 3, i64 1
br label %if.end8.i146
if.end8.i146: ; preds = %if.then4.i144, %if.then.i150
%node.1.in.i147 = phi ptr [ %child.i151, %if.then.i150 ], [ %arrayidx6.i145, %if.then4.i144 ]
%node.1.i148 = load ptr, ptr %node.1.in.i147, align 8, !tbaa !31
%tobool.not.i149 = icmp eq ptr %node.1.i148, null
br i1 %tobool.not.i149, label %cond.false30, label %while.body.i135, !llvm.loop !51
AVL_set_inside_count.exit152: ; preds = %if.else.i138
%cnt.i141 = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i136, i64 0, i32 2
%10 = load i32, ptr %cnt.i141, align 4, !tbaa !48
%cmp28 = icmp sgt i32 %10, 1
br i1 %cmp28, label %cond.end33, label %cond.false30
cond.false30: ; preds = %if.end8.i146, %if.then24, %AVL_set_inside_count.exit152
%arrayidx32 = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %.pre169
%11 = load i64, ptr %arrayidx32, align 8, !tbaa !5
%dec = add nsw i64 %11, -1
store i64 %dec, ptr %arrayidx32, align 8, !tbaa !5
br label %cond.end33
cond.end33: ; preds = %AVL_set_inside_count.exit152, %cond.false30
%call37 = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %arrayidx26, i64 noundef %val, i32 noundef 1), !range !50
switch i32 %command, label %return [
i32 4, label %if.then40
i32 5, label %if.then49
i32 6, label %if.then58
i32 7, label %if.then63
i32 8, label %if.then69
i32 9, label %if.then75
]
if.then40: ; preds = %if.end.if.then40_crit_edge, %cond.end33
%idxprom41.pre-phi = phi i64 [ %.pre170, %if.end.if.then40_crit_edge ], [ %.pre169, %cond.end33 ]
%arrayidx42 = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %idxprom41.pre-phi
%12 = load i64, ptr %arrayidx42, align 8, !tbaa !5
%dec43 = add nsw i64 %12, -1
store i64 %dec43, ptr %arrayidx42, align 8, !tbaa !5
%arrayidx45 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom41.pre-phi
%call46 = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %arrayidx45, i64 noundef %val, i32 noundef 0), !range !50
br label %return
if.then49: ; preds = %if.end.if.then49_crit_edge, %cond.end33
%idxprom50.pre-phi = phi i64 [ %.pre171, %if.end.if.then49_crit_edge ], [ %.pre169, %cond.end33 ]
%arrayidx51 = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %idxprom50.pre-phi
store i64 0, ptr %arrayidx51, align 8, !tbaa !5
%arrayidx53 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom50.pre-phi
%13 = load ptr, ptr %arrayidx53, align 8, !tbaa !31
tail call void @AVL_set_inside_free(ptr noundef %13)
store ptr null, ptr %arrayidx53, align 8, !tbaa !31
br label %return
if.then58: ; preds = %if.end.if.then58_crit_edge, %cond.end33
%idxprom59.pre-phi = phi i64 [ %.pre172, %if.end.if.then58_crit_edge ], [ %.pre169, %cond.end33 ]
%arrayidx60 = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %idxprom59.pre-phi
%14 = load i64, ptr %arrayidx60, align 8, !tbaa !5
br label %return
if.then63: ; preds = %if.end.if.then63_crit_edge, %cond.end33
%idxprom64.pre-phi = phi i64 [ %.pre173, %if.end.if.then63_crit_edge ], [ %.pre169, %cond.end33 ]
%arrayidx65 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom64.pre-phi
%15 = load ptr, ptr %arrayidx65, align 8, !tbaa !31
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %if.then63
%root.addr.0.i = phi ptr [ %15, %if.then63 ], [ %16, %while.cond.i ]
%arrayidx.i = getelementptr inbounds %struct.node_AVL_set, ptr %root.addr.0.i, i64 0, i32 3, i64 1
%16 = load ptr, ptr %arrayidx.i, align 8, !tbaa !31
%cmp.not.i = icmp eq ptr %16, null
br i1 %cmp.not.i, label %AVL_set_inside_minmax.exit, label %while.cond.i, !llvm.loop !52
AVL_set_inside_minmax.exit: ; preds = %while.cond.i
%17 = load i64, ptr %root.addr.0.i, align 8, !tbaa !47
br label %return
if.then69: ; preds = %if.end.if.then69_crit_edge, %cond.end33
%idxprom70.pre-phi = phi i64 [ %.pre174, %if.end.if.then69_crit_edge ], [ %.pre169, %cond.end33 ]
%arrayidx71 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom70.pre-phi
%18 = load ptr, ptr %arrayidx71, align 8, !tbaa !31
br label %while.cond.i153
while.cond.i153: ; preds = %while.cond.i153, %if.then69
%root.addr.0.i154 = phi ptr [ %18, %if.then69 ], [ %19, %while.cond.i153 ]
%arrayidx.i155 = getelementptr inbounds %struct.node_AVL_set, ptr %root.addr.0.i154, i64 0, i32 3, i64 0
%19 = load ptr, ptr %arrayidx.i155, align 8, !tbaa !31
%cmp.not.i156 = icmp eq ptr %19, null
br i1 %cmp.not.i156, label %AVL_set_inside_minmax.exit157, label %while.cond.i153, !llvm.loop !52
AVL_set_inside_minmax.exit157: ; preds = %while.cond.i153
%20 = load i64, ptr %root.addr.0.i154, align 8, !tbaa !47
br label %return
if.then75: ; preds = %if.end.if.then75_crit_edge, %cond.end33
%idxprom76.pre-phi = phi i64 [ %.pre175, %if.end.if.then75_crit_edge ], [ %.pre169, %cond.end33 ]
%arrayidx77 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom76.pre-phi
%arrayidx78 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %val
%21 = load ptr, ptr %arrayidx77, align 8, !tbaa !31
%22 = load ptr, ptr %arrayidx78, align 8, !tbaa !31
store ptr %22, ptr %arrayidx77, align 8, !tbaa !31
store ptr %21, ptr %arrayidx78, align 8, !tbaa !31
br label %return
return: ; preds = %if.end8.i127, %cond.end, %if.then49, %if.then40, %if.else7.i121, %if.then18, %if.then2, %if.then75, %cond.end33, %if.end, %AVL_set_inside_minmax.exit157, %AVL_set_inside_minmax.exit, %if.then58
%retval.0 = phi i64 [ %14, %if.then58 ], [ %17, %AVL_set_inside_minmax.exit ], [ %20, %AVL_set_inside_minmax.exit157 ], [ 0, %if.end ], [ 0, %if.then2 ], [ 0, %cond.end ], [ 0, %cond.end33 ], [ 0, %if.then40 ], [ 0, %if.then49 ], [ 0, %if.then75 ], [ %conv.i123, %if.else7.i121 ], [ 0, %if.then18 ], [ 0, %if.end8.i127 ]
ret i64 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @set_print(i32 noundef %set_num) local_unnamed_addr #2 {
entry:
%.b114.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b114.i, label %set_main.exit, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !31
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %set_main.exit
set_main.exit: ; preds = %entry, %if.then.i
%idxprom.i = sext i32 %set_num to i64
%arrayidx3.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom.i
%0 = load ptr, ptr %arrayidx3.i, align 8, !tbaa !31
tail call void @AVL_set_inside_print(ptr noundef %0, i32 noundef 0)
ret void
}
; Function Attrs: nounwind uwtable
define dso_local void @set_insert(i32 noundef %set_num, i64 noundef %val) local_unnamed_addr #10 {
entry:
%.b114.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b114.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !31
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %if.end.i
if.end.i: ; preds = %if.then.i, %entry
%idxprom7.i = sext i32 %set_num to i64
%arrayidx8.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom7.i
%0 = load ptr, ptr %arrayidx8.i, align 8, !tbaa !31
%tobool.not16.i.i = icmp eq ptr %0, null
br i1 %tobool.not16.i.i, label %cond.false.i, label %while.body.i.i
while.body.i.i: ; preds = %if.end.i, %if.end8.i.i
%node.017.i.i = phi ptr [ %node.1.i.i, %if.end8.i.i ], [ %0, %if.end.i ]
%1 = load i64, ptr %node.017.i.i, align 8, !tbaa !47
%cmp.i.i = icmp sgt i64 %1, %val
br i1 %cmp.i.i, label %if.then.i.i, label %if.else.i.i
if.then.i.i: ; preds = %while.body.i.i
%child.i.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i.i, i64 0, i32 3
br label %if.end8.i.i
if.else.i.i: ; preds = %while.body.i.i
%cmp3.i.i = icmp slt i64 %1, %val
br i1 %cmp3.i.i, label %if.then4.i.i, label %AVL_set_inside_count.exit.i
if.then4.i.i: ; preds = %if.else.i.i
%arrayidx6.i.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i.i, i64 0, i32 3, i64 1
br label %if.end8.i.i
if.end8.i.i: ; preds = %if.then4.i.i, %if.then.i.i
%node.1.in.i.i = phi ptr [ %child.i.i, %if.then.i.i ], [ %arrayidx6.i.i, %if.then4.i.i ]
%node.1.i.i = load ptr, ptr %node.1.in.i.i, align 8, !tbaa !31
%tobool.not.i.i = icmp eq ptr %node.1.i.i, null
br i1 %tobool.not.i.i, label %cond.false.i, label %while.body.i.i, !llvm.loop !51
AVL_set_inside_count.exit.i: ; preds = %if.else.i.i
%cnt.i.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i.i, i64 0, i32 2
%2 = load i32, ptr %cnt.i.i, align 4, !tbaa !48
%tobool9.not.i = icmp eq i32 %2, 0
br i1 %tobool9.not.i, label %cond.false.i, label %set_main.exit
cond.false.i: ; preds = %if.end8.i.i, %AVL_set_inside_count.exit.i, %if.end.i
%arrayidx11.i = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %idxprom7.i
%3 = load i64, ptr %arrayidx11.i, align 8, !tbaa !5
%inc12.i = add nsw i64 %3, 1
store i64 %inc12.i, ptr %arrayidx11.i, align 8, !tbaa !5
br label %set_main.exit
set_main.exit: ; preds = %AVL_set_inside_count.exit.i, %cond.false.i
%call15.i = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %arrayidx8.i, i64 noundef %val, i32 noundef 2), !range !50
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i64 @set_count(i32 noundef %set_num, i64 noundef %val) local_unnamed_addr #22 {
entry:
%.b114.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b114.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !31
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %if.end.i
if.end.i: ; preds = %if.then.i, %entry
%.pre.i = sext i32 %set_num to i64
%arrayidx20.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre.i
%0 = load ptr, ptr %arrayidx20.i, align 8, !tbaa !31
%tobool.not16.i115.i = icmp eq ptr %0, null
br i1 %tobool.not16.i115.i, label %set_main.exit, label %while.body.i116.i
while.body.i116.i: ; preds = %if.end.i, %if.end8.i127.i
%node.017.i117.i = phi ptr [ %node.1.i129.i, %if.end8.i127.i ], [ %0, %if.end.i ]
%1 = load i64, ptr %node.017.i117.i, align 8, !tbaa !47
%cmp.i118.i = icmp sgt i64 %1, %val
br i1 %cmp.i118.i, label %if.then.i131.i, label %if.else.i119.i
if.then.i131.i: ; preds = %while.body.i116.i
%child.i132.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i117.i, i64 0, i32 3
br label %if.end8.i127.i
if.else.i119.i: ; preds = %while.body.i116.i
%cmp3.i120.i = icmp slt i64 %1, %val
br i1 %cmp3.i120.i, label %if.then4.i125.i, label %if.else7.i121.i
if.then4.i125.i: ; preds = %if.else.i119.i
%arrayidx6.i126.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i117.i, i64 0, i32 3, i64 1
br label %if.end8.i127.i
if.else7.i121.i: ; preds = %if.else.i119.i
%cnt.i122.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i117.i, i64 0, i32 2
%2 = load i32, ptr %cnt.i122.i, align 4, !tbaa !48
%conv.i123.i = sext i32 %2 to i64
br label %set_main.exit
if.end8.i127.i: ; preds = %if.then4.i125.i, %if.then.i131.i
%node.1.in.i128.i = phi ptr [ %child.i132.i, %if.then.i131.i ], [ %arrayidx6.i126.i, %if.then4.i125.i ]
%node.1.i129.i = load ptr, ptr %node.1.in.i128.i, align 8, !tbaa !31
%tobool.not.i130.i = icmp eq ptr %node.1.i129.i, null
br i1 %tobool.not.i130.i, label %set_main.exit, label %while.body.i116.i, !llvm.loop !51
set_main.exit: ; preds = %if.end8.i127.i, %if.end.i, %if.else7.i121.i
%retval.0.i = phi i64 [ %conv.i123.i, %if.else7.i121.i ], [ 0, %if.end.i ], [ 0, %if.end8.i127.i ]
ret i64 %retval.0.i
}
; Function Attrs: nounwind uwtable
define dso_local void @set_erase(i32 noundef %set_num, i64 noundef %val, i32 noundef %is_all) local_unnamed_addr #10 {
entry:
%tobool.not = icmp eq i32 %is_all, 0
%.b114.i4 = load i1, ptr @set_main.set_is_init, align 1
br i1 %tobool.not, label %if.else, label %if.then
if.then: ; preds = %entry
br i1 %.b114.i4, label %set_main.exit, label %if.then.i
if.then.i: ; preds = %if.then
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !31
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %set_main.exit
set_main.exit: ; preds = %if.then, %if.then.i
%.pre170.i = sext i32 %set_num to i64
%arrayidx42.i = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %.pre170.i
%0 = load i64, ptr %arrayidx42.i, align 8, !tbaa !5
%dec43.i = add nsw i64 %0, -1
store i64 %dec43.i, ptr %arrayidx42.i, align 8, !tbaa !5
%arrayidx45.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre170.i
%call46.i = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %arrayidx45.i, i64 noundef %val, i32 noundef 0), !range !50
br label %if.end
if.else: ; preds = %entry
br i1 %.b114.i4, label %if.end.i, label %if.then.i5
if.then.i5: ; preds = %if.else
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !31
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %if.end.i
if.end.i: ; preds = %if.then.i5, %if.else
%.pre169.i = sext i32 %set_num to i64
%arrayidx26.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre169.i
%1 = load ptr, ptr %arrayidx26.i, align 8, !tbaa !31
%tobool.not16.i134.i = icmp eq ptr %1, null
br i1 %tobool.not16.i134.i, label %cond.false30.i, label %while.body.i135.i
while.body.i135.i: ; preds = %if.end.i, %if.end8.i146.i
%node.017.i136.i = phi ptr [ %node.1.i148.i, %if.end8.i146.i ], [ %1, %if.end.i ]
%2 = load i64, ptr %node.017.i136.i, align 8, !tbaa !47
%cmp.i137.i = icmp sgt i64 %2, %val
br i1 %cmp.i137.i, label %if.then.i150.i, label %if.else.i138.i
if.then.i150.i: ; preds = %while.body.i135.i
%child.i151.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i136.i, i64 0, i32 3
br label %if.end8.i146.i
if.else.i138.i: ; preds = %while.body.i135.i
%cmp3.i139.i = icmp slt i64 %2, %val
br i1 %cmp3.i139.i, label %if.then4.i144.i, label %AVL_set_inside_count.exit152.i
if.then4.i144.i: ; preds = %if.else.i138.i
%arrayidx6.i145.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i136.i, i64 0, i32 3, i64 1
br label %if.end8.i146.i
if.end8.i146.i: ; preds = %if.then4.i144.i, %if.then.i150.i
%node.1.in.i147.i = phi ptr [ %child.i151.i, %if.then.i150.i ], [ %arrayidx6.i145.i, %if.then4.i144.i ]
%node.1.i148.i = load ptr, ptr %node.1.in.i147.i, align 8, !tbaa !31
%tobool.not.i149.i = icmp eq ptr %node.1.i148.i, null
br i1 %tobool.not.i149.i, label %cond.false30.i, label %while.body.i135.i, !llvm.loop !51
AVL_set_inside_count.exit152.i: ; preds = %if.else.i138.i
%cnt.i141.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i136.i, i64 0, i32 2
%3 = load i32, ptr %cnt.i141.i, align 4, !tbaa !48
%cmp28.i = icmp sgt i32 %3, 1
br i1 %cmp28.i, label %set_main.exit6, label %cond.false30.i
cond.false30.i: ; preds = %if.end8.i146.i, %AVL_set_inside_count.exit152.i, %if.end.i
%arrayidx32.i = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %.pre169.i
%4 = load i64, ptr %arrayidx32.i, align 8, !tbaa !5
%dec.i = add nsw i64 %4, -1
store i64 %dec.i, ptr %arrayidx32.i, align 8, !tbaa !5
br label %set_main.exit6
set_main.exit6: ; preds = %AVL_set_inside_count.exit152.i, %cond.false30.i
%call37.i = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %arrayidx26.i, i64 noundef %val, i32 noundef 1), !range !50
br label %if.end
if.end: ; preds = %set_main.exit6, %set_main.exit
ret void
}
; Function Attrs: nounwind uwtable
define dso_local void @set_clear(i32 noundef %set_num) local_unnamed_addr #10 {
entry:
%.b114.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b114.i, label %set_main.exit, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !31
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %set_main.exit
set_main.exit: ; preds = %entry, %if.then.i
%.pre171.i = sext i32 %set_num to i64
%arrayidx51.i = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %.pre171.i
store i64 0, ptr %arrayidx51.i, align 8, !tbaa !5
%arrayidx53.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre171.i
%0 = load ptr, ptr %arrayidx53.i, align 8, !tbaa !31
tail call void @AVL_set_inside_free(ptr noundef %0)
store ptr null, ptr %arrayidx53.i, align 8, !tbaa !31
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @set_size(i32 noundef %set_num) local_unnamed_addr #23 {
entry:
%.b114.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b114.i, label %set_main.exit, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !31
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %set_main.exit
set_main.exit: ; preds = %entry, %if.then.i
%.pre172.i = sext i32 %set_num to i64
%arrayidx60.i = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %.pre172.i
%0 = load i64, ptr %arrayidx60.i, align 8, !tbaa !5
ret i64 %0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i64 @set_max(i32 noundef %set_num) local_unnamed_addr #22 {
entry:
%.b114.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b114.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !31
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %if.end.i
if.end.i: ; preds = %if.then.i, %entry
%.pre173.i = sext i32 %set_num to i64
%arrayidx65.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre173.i
%0 = load ptr, ptr %arrayidx65.i, align 8, !tbaa !31
br label %while.cond.i.i
while.cond.i.i: ; preds = %while.cond.i.i, %if.end.i
%root.addr.0.i.i = phi ptr [ %0, %if.end.i ], [ %1, %while.cond.i.i ]
%arrayidx.i.i = getelementptr inbounds %struct.node_AVL_set, ptr %root.addr.0.i.i, i64 0, i32 3, i64 1
%1 = load ptr, ptr %arrayidx.i.i, align 8, !tbaa !31
%cmp.not.i.i = icmp eq ptr %1, null
br i1 %cmp.not.i.i, label %set_main.exit, label %while.cond.i.i, !llvm.loop !52
set_main.exit: ; preds = %while.cond.i.i
%2 = load i64, ptr %root.addr.0.i.i, align 8, !tbaa !47
ret i64 %2
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i64 @set_min(i32 noundef %set_num) local_unnamed_addr #22 {
entry:
%.b114.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b114.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !31
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %if.end.i
if.end.i: ; preds = %if.then.i, %entry
%.pre174.i = sext i32 %set_num to i64
%arrayidx71.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre174.i
%0 = load ptr, ptr %arrayidx71.i, align 8, !tbaa !31
br label %while.cond.i153.i
while.cond.i153.i: ; preds = %while.cond.i153.i, %if.end.i
%root.addr.0.i154.i = phi ptr [ %0, %if.end.i ], [ %1, %while.cond.i153.i ]
%arrayidx.i155.i = getelementptr inbounds %struct.node_AVL_set, ptr %root.addr.0.i154.i, i64 0, i32 3, i64 0
%1 = load ptr, ptr %arrayidx.i155.i, align 8, !tbaa !31
%cmp.not.i156.i = icmp eq ptr %1, null
br i1 %cmp.not.i156.i, label %set_main.exit, label %while.cond.i153.i, !llvm.loop !52
set_main.exit: ; preds = %while.cond.i153.i
%2 = load i64, ptr %root.addr.0.i154.i, align 8, !tbaa !47
ret i64 %2
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @set_swap(i64 noundef %set_num1, i64 noundef %set_num2) local_unnamed_addr #23 {
entry:
%.b114.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b114.i, label %set_main.exit, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !31
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %set_main.exit
set_main.exit: ; preds = %entry, %if.then.i
%sext = shl i64 %set_num1, 32
%.pre175.i = ashr exact i64 %sext, 32
%arrayidx77.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre175.i
%arrayidx78.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %set_num2
%0 = load ptr, ptr %arrayidx77.i, align 8, !tbaa !31
%1 = load ptr, ptr %arrayidx78.i, align 8, !tbaa !31
store ptr %1, ptr %arrayidx77.i, align 8, !tbaa !31
store ptr %0, ptr %arrayidx78.i, align 8, !tbaa !31
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #10 {
entry:
%h = alloca i64, align 8
%w = alloca i64, align 8
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #28
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %w) #28
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #28
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #28
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h)
%call.i29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%call.i30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call.i31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i64, ptr %h, align 8, !tbaa !5
%1 = load i64, ptr %w, align 8, !tbaa !5
%add = add i64 %0, -2
%sub = add i64 %add, %1
%sub1 = add nsw i64 %0, -1
%call = call i64 @mod_nck(i64 noundef %sub, i64 noundef %sub1, i64 noundef 1000000007)
%2 = load i64, ptr %a, align 8, !tbaa !5
%cmp34 = icmp sgt i64 %2, 0
br i1 %cmp34, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%ans.0.lcssa = phi i64 [ %call, %entry ], [ %rem19, %for.body ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #28
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #28
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %w) #28
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #28
ret i32 0
for.body: ; preds = %entry, %for.body
%3 = phi i64 [ %11, %for.body ], [ %2, %entry ]
%ans.036 = phi i64 [ %rem19, %for.body ], [ %call, %entry ]
%i.035 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%4 = load i64, ptr %b, align 8, !tbaa !5
%sub2 = add nsw i64 %4, -1
%5 = load i64, ptr %h, align 8, !tbaa !5
%add3 = sub i64 %i.035, %3
%sub4 = add i64 %add3, %5
%add5 = add i64 %sub4, %sub2
%call7 = call i64 @mod_nck(i64 noundef %add5, i64 noundef %sub2, i64 noundef 1000000007)
%6 = load i64, ptr %w, align 8, !tbaa !5
%7 = load i64, ptr %b, align 8, !tbaa !5
%8 = xor i64 %7, -1
%9 = load i64, ptr %a, align 8, !tbaa !5
%10 = xor i64 %i.035, -1
%sub9 = add i64 %9, %10
%add10 = add i64 %sub9, %6
%sub12 = add i64 %add10, %8
%call15 = call i64 @mod_nck(i64 noundef %sub12, i64 noundef %sub9, i64 noundef 1000000007)
%mul = mul nsw i64 %call15, %call7
%rem = srem i64 %mul, 1000000007
%cmp.i = icmp sgt i64 %rem, 0
%cond.i = select i1 %cmp.i, i64 1000000007, i64 0
%add1.i = sub nsw i64 %cond.i, %rem
%rem.i = srem i64 %add1.i, 1000000007
%add18 = add nsw i64 %rem.i, %ans.036
%rem19 = srem i64 %add18, 1000000007
%inc = add nuw nsw i64 %i.035, 1
%11 = load i64, ptr %a, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %11
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !53
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #24
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #24
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #25
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smin.v2i64(<2 x i64>, <2 x i64>) #24
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smin.v2i64(<2 x i64>) #24
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x i64>) #24
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smax.v2i64(<2 x i64>) #24
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #24
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) 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 #13 = { 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 #14 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #15 = { 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 #16 = { 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 #17 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #18 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #19 = { 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 #20 = { 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 #21 = { nofree norecurse nosync nounwind 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 #22 = { nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #23 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #24 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #25 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #26 = { nounwind allocsize(1) }
attributes #27 = { nounwind willreturn memory(read) }
attributes #28 = { nounwind }
attributes #29 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !17}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !17}
!23 = !{!24, !24, i64 0}
!24 = !{!"int", !7, i64 0}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10, !28, !11, !12}
!28 = !{!"llvm.loop.peeled.count", i32 1}
!29 = distinct !{!29, !10}
!30 = distinct !{!30, !10}
!31 = !{!32, !32, i64 0}
!32 = !{!"any pointer", !7, i64 0}
!33 = distinct !{!33, !10}
!34 = distinct !{!34, !10}
!35 = distinct !{!35, !10}
!36 = distinct !{!36, !10}
!37 = distinct !{!37, !10}
!38 = distinct !{!38, !10}
!39 = distinct !{!39, !10}
!40 = distinct !{!40, !10}
!41 = distinct !{!41, !10, !11, !12}
!42 = distinct !{!42, !10, !12, !11}
!43 = !{!44, !6, i64 0}
!44 = !{!"", !6, i64 0, !6, i64 8}
!45 = !{!46, !24, i64 8}
!46 = !{!"node_AVL_set", !6, i64 0, !24, i64 8, !24, i64 12, !7, i64 16}
!47 = !{!46, !6, i64 0}
!48 = !{!46, !24, i64 12}
!49 = distinct !{!49, !10}
!50 = !{i32 -1, i32 2}
!51 = distinct !{!51, !10}
!52 = distinct !{!52, !10}
!53 = distinct !{!53, !10}
|
#include <stdio.h>
static const int monthDays[13]={
0,31,59,90,120,151,181,212,243,273,304,334,365
};
static long long getDays(int year) {
long long result;
if(year<0)return -getDays(-year)-366+365;
else if(year==0)return 0;
result=(long long)year*365;
result+=year/4;
result-=year/100;
result+=year/400;
return result;
}
static long long getDays2(int fromYear,int toYear) {
return getDays(toYear)-getDays(fromYear);
}
static int getLeapYearNum(int year) {
int result;
if(year<0)return -getLeapYearNum(-year)-1;
else if(year==0)return 0;
result=year/4;
result-=year/100;
result+=year/400;
return result;
}
static int getLeapYearNum2(int fromYear,int toYear) {
return getLeapYearNum(toYear)-getLeapYearNum(fromYear);
}
static int isLeapYear(int year) {
return (year%400==0 || (year%4==0 && year%100!=0));
}
long long date2dayCount(int year,int month,int date) {
long long result;
if(month<1 || month>12)return 0;
result=getDays2(1969,year-1);
result+=monthDays[month-1];
if(isLeapYear(year)) {
if(month>=3)result++;
}
result+=date-1;
return result;
}
void dayCount2date(int* year,int* month,int* date,long long days) {
int i;
int yearNum;
int amariDays;
int daySeconds;
int hoseiYear;
int is2_29;
if(days>=0) {
yearNum=1970+(int)(days/365);
amariDays=(int)(days%365);
} else {
days=-days;
yearNum=1970-(int)(days/365)-1;
amariDays=365-(int)(days%365);
}
amariDays-=getLeapYearNum2(1969,yearNum-1);
while(1) {
if((amariDays>=0 && amariDays<365) ||
(amariDays==365 && isLeapYear(yearNum)))break;
if(amariDays<0) {
hoseiYear=(-amariDays)/365+1;
amariDays+=hoseiYear*365;
amariDays+=getLeapYearNum(yearNum-1)-
getLeapYearNum(yearNum-hoseiYear-1);
yearNum-=hoseiYear;
} else if(amariDays>=365) {
hoseiYear=amariDays/365;
amariDays=amariDays%365;
amariDays-=getLeapYearNum(yearNum+hoseiYear-1)-
getLeapYearNum(yearNum-1);
yearNum+=hoseiYear;
} else break;
}
is2_29=0;
if(isLeapYear(yearNum) && amariDays>=59) {
if(amariDays==59)is2_29=1;
amariDays--;
}
for(i=1;i<=12;i++) {
if(amariDays>=monthDays[i-1] && amariDays<monthDays[i])break;
}
amariDays-=monthDays[i-1];
if(is2_29)amariDays++;
*year=yearNum;
*month=i;
*date=amariDays+1;
}
int main(void) {
char input[1024];
long long days_origin=date2dayCount(2012,12,21);
while(fgets(input,sizeof(input),stdin)) {
long long days;
int b,ka,t,w,ki;
int y,m,d;
int sscret;
sscret=sscanf(input,"%d.%d.%d.%d.%d",&b,&ka,&t,&w,&ki);
if(sscret==5) {
/* maya -> seireki */
days=b;
days=days*20+ka;
days=days*20+t;
days=days*18+w;
days=days*20+ki;
dayCount2date(&y,&m,&d,days+days_origin);
printf("%d.%d.%d\n",y,m,d);
} else if(sscret==3) {
/* seireki -> maya */
y=b;m=ka;d=t;
days=date2dayCount(y,m,d)-days_origin;
ki=days%20;days/=20;
w=days%18;days/=18;
t=days%20;days/=20;
ka=days%20;days/=20;
b=days%13;
printf("%d.%d.%d.%d.%d\n",b,ka,t,w,ki);
} else break;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139064/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139064/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@monthDays = internal unnamed_addr constant [13 x i32] [i32 0, i32 31, i32 59, i32 90, i32 120, i32 151, i32 181, i32 212, i32 243, i32 273, i32 304, i32 334, i32 365], align 16
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [15 x i8] c"%d.%d.%d.%d.%d\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%d.%d.%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [16 x i8] c"%d.%d.%d.%d.%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @date2dayCount(i32 noundef %year, i32 noundef %month, i32 noundef %date) local_unnamed_addr #0 {
entry:
%0 = add i32 %month, -13
%or.cond = icmp ult i32 %0, -12
br i1 %or.cond, label %cleanup, label %if.end
if.end: ; preds = %entry
%sub = add nsw i32 %year, -1
%cmp24.i.i = icmp slt i32 %year, 1
br i1 %cmp24.i.i, label %if.then.i.i, label %if.else.i.i
if.then.i.i: ; preds = %if.end, %if.then.i.i
%year.tr26.i.i = phi i32 [ %sub.i.i, %if.then.i.i ], [ %sub, %if.end ]
%accumulator.tr25.i.i = phi i64 [ %add.i.i, %if.then.i.i ], [ 0, %if.end ]
%sub.i.i = sub nsw i32 0, %year.tr26.i.i
%add.i.i = xor i64 %accumulator.tr25.i.i, -1
%cmp.i.i = icmp sgt i32 %year.tr26.i.i, 0
br i1 %cmp.i.i, label %if.then.i.i, label %if.else.i.i
if.else.i.i: ; preds = %if.then.i.i, %if.end
%accumulator.tr.lcssa.i.i = phi i64 [ 0, %if.end ], [ %add.i.i, %if.then.i.i ]
%year.tr.lcssa.i.i = phi i32 [ %sub, %if.end ], [ %sub.i.i, %if.then.i.i ]
%cmp3.i.i = icmp eq i32 %year.tr.lcssa.i.i, 0
br i1 %cmp3.i.i, label %getDays2.exit, label %if.end5.i.i
if.end5.i.i: ; preds = %if.else.i.i
%conv.i.i = zext i32 %year.tr.lcssa.i.i to i64
%mul.i.i = mul nuw nsw i64 %conv.i.i, 365
%div23.i.i = lshr i32 %year.tr.lcssa.i.i, 2
%conv6.i.i = zext i32 %div23.i.i to i64
%add7.i.i = add nuw nsw i64 %mul.i.i, %conv6.i.i
%div8.i.i = udiv i32 %year.tr.lcssa.i.i, 100
%conv9.i.i = zext i32 %div8.i.i to i64
%sub10.i.i = sub nsw i64 %add7.i.i, %conv9.i.i
%div11.i.i = udiv i32 %year.tr.lcssa.i.i, 400
%conv12.i.i = zext i32 %div11.i.i to i64
%add13.i.i = add nsw i64 %sub10.i.i, %conv12.i.i
br label %getDays2.exit
getDays2.exit: ; preds = %if.else.i.i, %if.end5.i.i
%retval.0.i.i = phi i64 [ %add13.i.i, %if.end5.i.i ], [ 0, %if.else.i.i ]
%accumulator.ret.tr.i.i = xor i64 %retval.0.i.i, %accumulator.tr.lcssa.i.i
%sub2 = add nsw i32 %month, -1
%idxprom = zext i32 %sub2 to i64
%arrayidx = getelementptr inbounds [13 x i32], ptr @monthDays, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%conv = sext i32 %1 to i64
%rem.i = srem i32 %year, 400
%cmp.i = icmp eq i32 %rem.i, 0
br i1 %cmp.i, label %isLeapYear.exit, label %lor.rhs.i
lor.rhs.i: ; preds = %getDays2.exit
%2 = and i32 %year, 3
%cmp2.i = icmp eq i32 %2, 0
br i1 %cmp2.i, label %land.rhs.i, label %isLeapYear.exit
land.rhs.i: ; preds = %lor.rhs.i
%rem3.i = srem i32 %year, 100
%cmp4.i = icmp ne i32 %rem3.i, 0
br label %isLeapYear.exit
isLeapYear.exit: ; preds = %getDays2.exit, %lor.rhs.i, %land.rhs.i
%lor.ext.i = phi i1 [ true, %getDays2.exit ], [ false, %lor.rhs.i ], [ %cmp4.i, %land.rhs.i ]
%cmp5 = icmp sgt i32 %month, 2
%or.cond13 = and i1 %cmp5, %lor.ext.i
%inc = zext i1 %or.cond13 to i64
%3 = sext i32 %date to i64
%sub.i = add nsw i64 %3, -719163
%add = add i64 %sub.i, %accumulator.ret.tr.i.i
%spec.select = add i64 %add, %conv
%add12 = add i64 %spec.select, %inc
br label %cleanup
cleanup: ; preds = %entry, %isLeapYear.exit
%retval.0 = phi i64 [ %add12, %isLeapYear.exit ], [ 0, %entry ]
ret i64 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: write) uwtable
define dso_local void @dayCount2date(ptr nocapture noundef writeonly %year, ptr nocapture noundef writeonly %month, ptr nocapture noundef writeonly %date, i64 noundef %days) local_unnamed_addr #2 {
entry:
%cmp = icmp sgt i64 %days, -1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%div = udiv i64 %days, 365
%conv = trunc i64 %div to i32
%add = add nsw i32 %conv, 1970
%rem = urem i64 %days, 365
%conv1 = trunc i64 %rem to i32
br label %if.end
if.else: ; preds = %entry
%days.nonneg = sub i64 0, %days
%div2.neg206 = udiv i64 %days.nonneg, 365
%0 = trunc i64 %div2.neg206 to i32
%sub5 = sub i32 1969, %0
%1 = urem i64 %days.nonneg, 365
%2 = trunc i64 %1 to i32
%sub8 = sub nuw nsw i32 365, %2
br label %if.end
if.end: ; preds = %if.else, %if.then
%yearNum.0 = phi i32 [ %add, %if.then ], [ %sub5, %if.else ]
%amariDays.0 = phi i32 [ %conv1, %if.then ], [ %sub8, %if.else ]
%sub9 = add nsw i32 %yearNum.0, -1
%cmp17.i.i = icmp slt i32 %yearNum.0, 1
br i1 %cmp17.i.i, label %if.then.i.i, label %if.else.i.i
if.then.i.i: ; preds = %if.end, %if.then.i.i
%year.tr19.i.i = phi i32 [ %sub.i.i, %if.then.i.i ], [ %sub9, %if.end ]
%accumulator.tr18.i.i = phi i32 [ %sub2.i.i, %if.then.i.i ], [ 0, %if.end ]
%sub.i.i = sub nsw i32 0, %year.tr19.i.i
%sub2.i.i = xor i32 %accumulator.tr18.i.i, -1
%cmp.i.i = icmp sgt i32 %year.tr19.i.i, 0
br i1 %cmp.i.i, label %if.then.i.i, label %if.else.i.i
if.else.i.i: ; preds = %if.then.i.i, %if.end
%accumulator.tr.lcssa.i.i = phi i32 [ 0, %if.end ], [ %sub2.i.i, %if.then.i.i ]
%year.tr.lcssa.i.i = phi i32 [ %sub9, %if.end ], [ %sub.i.i, %if.then.i.i ]
%cmp3.i.i = icmp eq i32 %year.tr.lcssa.i.i, 0
br i1 %cmp3.i.i, label %getLeapYearNum2.exit, label %if.end5.i.i
if.end5.i.i: ; preds = %if.else.i.i
%div16.i.i = lshr i32 %year.tr.lcssa.i.i, 2
%div6.i.i = udiv i32 %year.tr.lcssa.i.i, 100
%sub7.i.i = sub nsw i32 %div16.i.i, %div6.i.i
%div8.i.i = udiv i32 %year.tr.lcssa.i.i, 400
%add.i.i = add nsw i32 %sub7.i.i, %div8.i.i
br label %getLeapYearNum2.exit
getLeapYearNum2.exit: ; preds = %if.else.i.i, %if.end5.i.i
%retval.0.i.i = phi i32 [ %add.i.i, %if.end5.i.i ], [ 0, %if.else.i.i ]
%accumulator.ret.tr.i.i = xor i32 %retval.0.i.i, %accumulator.tr.lcssa.i.i
%sub.i.neg = add nuw nsw i32 %amariDays.0, 477
%sub10 = sub i32 %sub.i.neg, %accumulator.ret.tr.i.i
%or.cond209 = icmp ult i32 %sub10, 365
br i1 %or.cond209, label %while.end, label %lor.lhs.false
lor.lhs.false: ; preds = %getLeapYearNum2.exit, %if.end52
%amariDays.1211 = phi i32 [ %amariDays.2, %if.end52 ], [ %sub10, %getLeapYearNum2.exit ]
%yearNum.1210 = phi i32 [ %yearNum.2, %if.end52 ], [ %yearNum.0, %getLeapYearNum2.exit ]
%cmp15 = icmp eq i32 %amariDays.1211, 365
br i1 %cmp15, label %land.lhs.true17, label %if.end20
land.lhs.true17: ; preds = %lor.lhs.false
%rem.i = srem i32 %yearNum.1210, 400
%cmp.i = icmp eq i32 %rem.i, 0
br i1 %cmp.i, label %while.end, label %lor.rhs.i
lor.rhs.i: ; preds = %land.lhs.true17
%3 = and i32 %yearNum.1210, 3
%cmp2.i = icmp ne i32 %3, 0
%rem3.i = srem i32 %yearNum.1210, 100
%cmp4.i.not = icmp eq i32 %rem3.i, 0
%or.cond208 = or i1 %cmp2.i, %cmp4.i.not
br i1 %or.cond208, label %if.then39, label %while.end
if.end20: ; preds = %lor.lhs.false
%cmp21 = icmp slt i32 %amariDays.1211, 0
br i1 %cmp21, label %if.then23, label %if.then39
if.then23: ; preds = %if.end20
%amariDays.1.nonneg = sub i32 0, %amariDays.1211
%div25205 = udiv i32 %amariDays.1.nonneg, 365
%add26 = add nuw nsw i32 %div25205, 1
%mul = mul nuw nsw i32 %add26, 365
%sub28 = add nsw i32 %yearNum.1210, -1
%cmp17.i = icmp slt i32 %yearNum.1210, 1
br i1 %cmp17.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %if.then23, %if.then.i
%year.tr19.i = phi i32 [ %sub.i128, %if.then.i ], [ %sub28, %if.then23 ]
%accumulator.tr18.i = phi i32 [ %sub2.i, %if.then.i ], [ 0, %if.then23 ]
%sub.i128 = sub nsw i32 0, %year.tr19.i
%sub2.i = xor i32 %accumulator.tr18.i, -1
%cmp.i129 = icmp sgt i32 %year.tr19.i, 0
br i1 %cmp.i129, label %if.then.i, label %if.else.i
if.else.i: ; preds = %if.then.i, %if.then23
%accumulator.tr.lcssa.i = phi i32 [ 0, %if.then23 ], [ %sub2.i, %if.then.i ]
%year.tr.lcssa.i = phi i32 [ %sub28, %if.then23 ], [ %sub.i128, %if.then.i ]
%cmp3.i = icmp eq i32 %year.tr.lcssa.i, 0
br i1 %cmp3.i, label %getLeapYearNum.exit, label %if.end5.i
if.end5.i: ; preds = %if.else.i
%div16.i = lshr i32 %year.tr.lcssa.i, 2
%div6.i = udiv i32 %year.tr.lcssa.i, 100
%sub7.i = sub nsw i32 %div16.i, %div6.i
%div8.i = udiv i32 %year.tr.lcssa.i, 400
%add.i = add nsw i32 %sub7.i, %div8.i
br label %getLeapYearNum.exit
getLeapYearNum.exit: ; preds = %if.else.i, %if.end5.i
%retval.0.i = phi i32 [ %add.i, %if.end5.i ], [ 0, %if.else.i ]
%accumulator.ret.tr.i = xor i32 %retval.0.i, %accumulator.tr.lcssa.i
%sub30 = sub nsw i32 %yearNum.1210, %add26
%sub31 = add nsw i32 %sub30, -1
%cmp17.i130 = icmp slt i32 %sub30, 1
br i1 %cmp17.i130, label %if.then.i143, label %if.else.i131
if.then.i143: ; preds = %getLeapYearNum.exit, %if.then.i143
%year.tr19.i144 = phi i32 [ %sub.i146, %if.then.i143 ], [ %sub31, %getLeapYearNum.exit ]
%accumulator.tr18.i145 = phi i32 [ %sub2.i147, %if.then.i143 ], [ 0, %getLeapYearNum.exit ]
%sub.i146 = sub nsw i32 0, %year.tr19.i144
%sub2.i147 = xor i32 %accumulator.tr18.i145, -1
%cmp.i148 = icmp sgt i32 %year.tr19.i144, 0
br i1 %cmp.i148, label %if.then.i143, label %if.else.i131
if.else.i131: ; preds = %if.then.i143, %getLeapYearNum.exit
%accumulator.tr.lcssa.i132 = phi i32 [ 0, %getLeapYearNum.exit ], [ %sub2.i147, %if.then.i143 ]
%year.tr.lcssa.i133 = phi i32 [ %sub31, %getLeapYearNum.exit ], [ %sub.i146, %if.then.i143 ]
%cmp3.i134 = icmp eq i32 %year.tr.lcssa.i133, 0
br i1 %cmp3.i134, label %getLeapYearNum.exit149, label %if.end5.i135
if.end5.i135: ; preds = %if.else.i131
%div16.i136 = lshr i32 %year.tr.lcssa.i133, 2
%div6.i137 = udiv i32 %year.tr.lcssa.i133, 100
%sub7.i138 = sub nsw i32 %div16.i136, %div6.i137
%div8.i139 = udiv i32 %year.tr.lcssa.i133, 400
%add.i140 = add nsw i32 %sub7.i138, %div8.i139
br label %getLeapYearNum.exit149
getLeapYearNum.exit149: ; preds = %if.else.i131, %if.end5.i135
%retval.0.i141 = phi i32 [ %add.i140, %if.end5.i135 ], [ 0, %if.else.i131 ]
%accumulator.ret.tr.i142 = xor i32 %retval.0.i141, %accumulator.tr.lcssa.i132
%sub33 = add i32 %mul, %amariDays.1211
%add27 = add i32 %sub33, %accumulator.ret.tr.i
%add34 = sub i32 %add27, %accumulator.ret.tr.i142
br label %if.end52
if.then39: ; preds = %lor.rhs.i, %if.end20
%div40 = udiv i32 %amariDays.1211, 365
%rem41 = urem i32 %amariDays.1211, 365
%add42 = add nsw i32 %div40, %yearNum.1210
%sub43 = add nsw i32 %add42, -1
%cmp17.i150 = icmp slt i32 %add42, 1
br i1 %cmp17.i150, label %if.then.i163, label %if.else.i151
if.then.i163: ; preds = %if.then39, %if.then.i163
%year.tr19.i164 = phi i32 [ %sub.i166, %if.then.i163 ], [ %sub43, %if.then39 ]
%accumulator.tr18.i165 = phi i32 [ %sub2.i167, %if.then.i163 ], [ 0, %if.then39 ]
%sub.i166 = sub nsw i32 0, %year.tr19.i164
%sub2.i167 = xor i32 %accumulator.tr18.i165, -1
%cmp.i168 = icmp sgt i32 %year.tr19.i164, 0
br i1 %cmp.i168, label %if.then.i163, label %if.else.i151
if.else.i151: ; preds = %if.then.i163, %if.then39
%accumulator.tr.lcssa.i152 = phi i32 [ 0, %if.then39 ], [ %sub2.i167, %if.then.i163 ]
%year.tr.lcssa.i153 = phi i32 [ %sub43, %if.then39 ], [ %sub.i166, %if.then.i163 ]
%cmp3.i154 = icmp eq i32 %year.tr.lcssa.i153, 0
br i1 %cmp3.i154, label %getLeapYearNum.exit169, label %if.end5.i155
if.end5.i155: ; preds = %if.else.i151
%div16.i156 = lshr i32 %year.tr.lcssa.i153, 2
%div6.i157 = udiv i32 %year.tr.lcssa.i153, 100
%sub7.i158 = sub nsw i32 %div16.i156, %div6.i157
%div8.i159 = udiv i32 %year.tr.lcssa.i153, 400
%add.i160 = add nsw i32 %sub7.i158, %div8.i159
br label %getLeapYearNum.exit169
getLeapYearNum.exit169: ; preds = %if.else.i151, %if.end5.i155
%retval.0.i161 = phi i32 [ %add.i160, %if.end5.i155 ], [ 0, %if.else.i151 ]
%accumulator.ret.tr.i162 = xor i32 %retval.0.i161, %accumulator.tr.lcssa.i152
%sub45 = add nsw i32 %yearNum.1210, -1
%cmp17.i170 = icmp slt i32 %yearNum.1210, 1
br i1 %cmp17.i170, label %if.then.i183, label %if.else.i171
if.then.i183: ; preds = %getLeapYearNum.exit169, %if.then.i183
%year.tr19.i184 = phi i32 [ %sub.i186, %if.then.i183 ], [ %sub45, %getLeapYearNum.exit169 ]
%accumulator.tr18.i185 = phi i32 [ %sub2.i187, %if.then.i183 ], [ 0, %getLeapYearNum.exit169 ]
%sub.i186 = sub nsw i32 0, %year.tr19.i184
%sub2.i187 = xor i32 %accumulator.tr18.i185, -1
%cmp.i188 = icmp sgt i32 %year.tr19.i184, 0
br i1 %cmp.i188, label %if.then.i183, label %if.else.i171
if.else.i171: ; preds = %if.then.i183, %getLeapYearNum.exit169
%accumulator.tr.lcssa.i172 = phi i32 [ 0, %getLeapYearNum.exit169 ], [ %sub2.i187, %if.then.i183 ]
%year.tr.lcssa.i173 = phi i32 [ %sub45, %getLeapYearNum.exit169 ], [ %sub.i186, %if.then.i183 ]
%cmp3.i174 = icmp eq i32 %year.tr.lcssa.i173, 0
br i1 %cmp3.i174, label %getLeapYearNum.exit189, label %if.end5.i175
if.end5.i175: ; preds = %if.else.i171
%div16.i176 = lshr i32 %year.tr.lcssa.i173, 2
%div6.i177 = udiv i32 %year.tr.lcssa.i173, 100
%sub7.i178 = sub nsw i32 %div16.i176, %div6.i177
%div8.i179 = udiv i32 %year.tr.lcssa.i173, 400
%add.i180 = add nsw i32 %sub7.i178, %div8.i179
br label %getLeapYearNum.exit189
getLeapYearNum.exit189: ; preds = %if.else.i171, %if.end5.i175
%retval.0.i181 = phi i32 [ %add.i180, %if.end5.i175 ], [ 0, %if.else.i171 ]
%accumulator.ret.tr.i182 = xor i32 %retval.0.i181, %accumulator.tr.lcssa.i172
%sub47.neg = sub i32 %rem41, %accumulator.ret.tr.i162
%sub48 = add i32 %sub47.neg, %accumulator.ret.tr.i182
br label %if.end52
if.end52: ; preds = %getLeapYearNum.exit189, %getLeapYearNum.exit149
%yearNum.2 = phi i32 [ %sub30, %getLeapYearNum.exit149 ], [ %add42, %getLeapYearNum.exit189 ]
%amariDays.2 = phi i32 [ %add34, %getLeapYearNum.exit149 ], [ %sub48, %getLeapYearNum.exit189 ]
%or.cond = icmp ult i32 %amariDays.2, 365
br i1 %or.cond, label %while.end, label %lor.lhs.false
while.end: ; preds = %if.end52, %land.lhs.true17, %lor.rhs.i, %getLeapYearNum2.exit
%yearNum.1.lcssa = phi i32 [ %yearNum.0, %getLeapYearNum2.exit ], [ %yearNum.1210, %lor.rhs.i ], [ %yearNum.1210, %land.lhs.true17 ], [ %yearNum.2, %if.end52 ]
%amariDays.1.lcssa = phi i32 [ %sub10, %getLeapYearNum2.exit ], [ 365, %lor.rhs.i ], [ 365, %land.lhs.true17 ], [ %amariDays.2, %if.end52 ]
%rem.i190 = srem i32 %yearNum.1.lcssa, 400
%cmp.i191 = icmp eq i32 %rem.i190, 0
br i1 %cmp.i191, label %isLeapYear.exit198, label %lor.rhs.i192
lor.rhs.i192: ; preds = %while.end
%4 = and i32 %yearNum.1.lcssa, 3
%cmp2.i193 = icmp eq i32 %4, 0
br i1 %cmp2.i193, label %land.rhs.i195, label %isLeapYear.exit198
land.rhs.i195: ; preds = %lor.rhs.i192
%rem3.i196 = srem i32 %yearNum.1.lcssa, 100
%cmp4.i197 = icmp ne i32 %rem3.i196, 0
br label %isLeapYear.exit198
isLeapYear.exit198: ; preds = %while.end, %lor.rhs.i192, %land.rhs.i195
%lor.ext.i194 = phi i1 [ true, %while.end ], [ false, %lor.rhs.i192 ], [ %cmp4.i197, %land.rhs.i195 ]
%cmp56 = icmp ugt i32 %amariDays.1.lcssa, 58
%or.cond85 = and i1 %cmp56, %lor.ext.i194
%dec = sext i1 %or.cond85 to i32
%amariDays.3 = add nsw i32 %amariDays.1.lcssa, %dec
%cmp67.not = icmp slt i32 %amariDays.3, 0
br i1 %cmp67.not, label %for.inc.11, label %land.lhs.true69
land.lhs.true69: ; preds = %isLeapYear.exit198
%cmp72 = icmp ult i32 %amariDays.3, 31
br i1 %cmp72, label %for.end, label %land.lhs.true69.1
land.lhs.true69.1: ; preds = %land.lhs.true69
%cmp72.1 = icmp ult i32 %amariDays.3, 59
br i1 %cmp72.1, label %for.end, label %land.lhs.true69.2
land.lhs.true69.2: ; preds = %land.lhs.true69.1
%cmp72.2 = icmp ult i32 %amariDays.3, 90
br i1 %cmp72.2, label %for.end, label %land.lhs.true69.3
land.lhs.true69.3: ; preds = %land.lhs.true69.2
%cmp72.3 = icmp ult i32 %amariDays.3, 120
br i1 %cmp72.3, label %for.end, label %land.lhs.true69.4
land.lhs.true69.4: ; preds = %land.lhs.true69.3
%cmp72.4 = icmp ult i32 %amariDays.3, 151
br i1 %cmp72.4, label %for.end, label %land.lhs.true69.5
land.lhs.true69.5: ; preds = %land.lhs.true69.4
%cmp72.5 = icmp ult i32 %amariDays.3, 181
br i1 %cmp72.5, label %for.end, label %land.lhs.true69.6
land.lhs.true69.6: ; preds = %land.lhs.true69.5
%cmp72.6 = icmp ult i32 %amariDays.3, 212
br i1 %cmp72.6, label %for.end, label %land.lhs.true69.7
land.lhs.true69.7: ; preds = %land.lhs.true69.6
%cmp72.7 = icmp ult i32 %amariDays.3, 243
br i1 %cmp72.7, label %for.end, label %land.lhs.true69.8
land.lhs.true69.8: ; preds = %land.lhs.true69.7
%cmp72.8 = icmp ult i32 %amariDays.3, 273
br i1 %cmp72.8, label %for.end, label %land.lhs.true69.9
land.lhs.true69.9: ; preds = %land.lhs.true69.8
%cmp72.9 = icmp ult i32 %amariDays.3, 304
br i1 %cmp72.9, label %for.end, label %land.lhs.true69.10
land.lhs.true69.10: ; preds = %land.lhs.true69.9
%cmp72.10 = icmp ult i32 %amariDays.3, 334
br i1 %cmp72.10, label %for.end, label %land.lhs.true69.11
land.lhs.true69.11: ; preds = %land.lhs.true69.10
%cmp72.11 = icmp ult i32 %amariDays.3, 365
br i1 %cmp72.11, label %for.end, label %for.inc.11
for.inc.11: ; preds = %isLeapYear.exit198, %land.lhs.true69.11
br label %for.end
for.end: ; preds = %for.inc.11, %land.lhs.true69.11, %land.lhs.true69.10, %land.lhs.true69.9, %land.lhs.true69.8, %land.lhs.true69.7, %land.lhs.true69.6, %land.lhs.true69.5, %land.lhs.true69.4, %land.lhs.true69.3, %land.lhs.true69.2, %land.lhs.true69.1, %land.lhs.true69
%i.0.lcssa = phi i32 [ 1, %land.lhs.true69 ], [ 2, %land.lhs.true69.1 ], [ 3, %land.lhs.true69.2 ], [ 4, %land.lhs.true69.3 ], [ 5, %land.lhs.true69.4 ], [ 6, %land.lhs.true69.5 ], [ 7, %land.lhs.true69.6 ], [ 8, %land.lhs.true69.7 ], [ 9, %land.lhs.true69.8 ], [ 10, %land.lhs.true69.9 ], [ 11, %land.lhs.true69.10 ], [ 12, %land.lhs.true69.11 ], [ 13, %for.inc.11 ]
%cmp59 = icmp eq i32 %amariDays.1.lcssa, 59
%is2_29.1.not = and i1 %cmp59, %lor.ext.i194
%sub76 = add nsw i32 %i.0.lcssa, -1
%idxprom77 = zext i32 %sub76 to i64
%arrayidx78 = getelementptr inbounds [13 x i32], ptr @monthDays, i64 0, i64 %idxprom77
%5 = load i32, ptr %arrayidx78, align 4, !tbaa !5
store i32 %yearNum.1.lcssa, ptr %year, align 4, !tbaa !5
store i32 %i.0.lcssa, ptr %month, align 4, !tbaa !5
%sub79 = select i1 %is2_29.1.not, i32 2, i32 1
%spec.select = add nsw i32 %sub79, %amariDays.3
%add84 = sub i32 %spec.select, %5
store i32 %add84, ptr %date, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%input = alloca [1024 x i8], align 16
%b = alloca i32, align 4
%ka = alloca i32, align 4
%t = alloca i32, align 4
%w = alloca i32, align 4
%ki = alloca i32, align 4
%y = alloca i32, align 4
%m = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %input) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !9
%call168 = call ptr @fgets(ptr noundef nonnull %input, i32 noundef 1024, ptr noundef %0)
%tobool.not69 = icmp eq ptr %call168, null
br i1 %tobool.not69, label %while.end, label %while.body
while.body: ; preds = %entry, %cleanup
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ka) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ki) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5
%call3 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %input, ptr noundef nonnull @.str, ptr noundef nonnull %b, ptr noundef nonnull %ka, ptr noundef nonnull %t, ptr noundef nonnull %w, ptr noundef nonnull %ki) #5
switch i32 %call3, label %cleanup.thread [
i32 5, label %if.then
i32 3, label %if.then18
]
cleanup.thread: ; preds = %while.body
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ki) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ka) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
br label %while.end
if.then: ; preds = %while.body
%1 = load i32, ptr %b, align 4, !tbaa !5
%conv = sext i32 %1 to i64
%mul = mul nsw i64 %conv, 20
%2 = load i32, ptr %ka, align 4, !tbaa !5
%conv4 = sext i32 %2 to i64
%add = add nsw i64 %mul, %conv4
%mul5 = mul nsw i64 %add, 20
%3 = load i32, ptr %t, align 4, !tbaa !5
%conv6 = sext i32 %3 to i64
%add7 = add nsw i64 %mul5, %conv6
%mul8 = mul nsw i64 %add7, 18
%4 = load i32, ptr %w, align 4, !tbaa !5
%conv9 = sext i32 %4 to i64
%add10 = add nsw i64 %mul8, %conv9
%mul11 = mul nsw i64 %add10, 20
%5 = load i32, ptr %ki, align 4, !tbaa !5
%conv12 = sext i32 %5 to i64
%add13 = add nsw i64 %conv12, 15695
%add14 = add nsw i64 %add13, %mul11
call void @dayCount2date(ptr noundef nonnull %y, ptr noundef nonnull %m, ptr noundef nonnull %d, i64 noundef %add14)
%6 = load i32, ptr %y, align 4, !tbaa !5
%7 = load i32, ptr %m, align 4, !tbaa !5
%8 = load i32, ptr %d, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6, i32 noundef %7, i32 noundef %8)
br label %cleanup
if.then18: ; preds = %while.body
%9 = load i32, ptr %b, align 4, !tbaa !5
%10 = load i32, ptr %ka, align 4, !tbaa !5
%11 = load i32, ptr %t, align 4, !tbaa !5
%12 = add i32 %10, -13
%or.cond.i = icmp ult i32 %12, -12
br i1 %or.cond.i, label %date2dayCount.exit, label %if.end.i
if.end.i: ; preds = %if.then18
%sub.i = add nsw i32 %9, -1
%cmp24.i.i.i = icmp slt i32 %9, 1
br i1 %cmp24.i.i.i, label %if.then.i.i.i, label %if.else.i.i.i
if.then.i.i.i: ; preds = %if.end.i, %if.then.i.i.i
%year.tr26.i.i.i = phi i32 [ %sub.i.i.i, %if.then.i.i.i ], [ %sub.i, %if.end.i ]
%accumulator.tr25.i.i.i = phi i64 [ %add.i.i.i, %if.then.i.i.i ], [ 0, %if.end.i ]
%sub.i.i.i = sub nsw i32 0, %year.tr26.i.i.i
%add.i.i.i = xor i64 %accumulator.tr25.i.i.i, -1
%cmp.i.i.i = icmp sgt i32 %year.tr26.i.i.i, 0
br i1 %cmp.i.i.i, label %if.then.i.i.i, label %if.else.i.i.i
if.else.i.i.i: ; preds = %if.then.i.i.i, %if.end.i
%accumulator.tr.lcssa.i.i.i = phi i64 [ 0, %if.end.i ], [ %add.i.i.i, %if.then.i.i.i ]
%year.tr.lcssa.i.i.i = phi i32 [ %sub.i, %if.end.i ], [ %sub.i.i.i, %if.then.i.i.i ]
%cmp3.i.i.i = icmp eq i32 %year.tr.lcssa.i.i.i, 0
br i1 %cmp3.i.i.i, label %getDays2.exit.i, label %if.end5.i.i.i
if.end5.i.i.i: ; preds = %if.else.i.i.i
%conv.i.i.i = zext i32 %year.tr.lcssa.i.i.i to i64
%mul.i.i.i = mul nuw nsw i64 %conv.i.i.i, 365
%div23.i.i.i = lshr i32 %year.tr.lcssa.i.i.i, 2
%conv6.i.i.i = zext i32 %div23.i.i.i to i64
%add7.i.i.i = add nuw nsw i64 %mul.i.i.i, %conv6.i.i.i
%div8.i.i.i = udiv i32 %year.tr.lcssa.i.i.i, 100
%conv9.i.i.i = zext i32 %div8.i.i.i to i64
%sub10.i.i.i = sub nsw i64 %add7.i.i.i, %conv9.i.i.i
%div11.i.i.i = udiv i32 %year.tr.lcssa.i.i.i, 400
%conv12.i.i.i = zext i32 %div11.i.i.i to i64
%add13.i.i.i61 = add nsw i64 %sub10.i.i.i, %conv12.i.i.i
br label %getDays2.exit.i
getDays2.exit.i: ; preds = %if.end5.i.i.i, %if.else.i.i.i
%retval.0.i.i.i = phi i64 [ %add13.i.i.i61, %if.end5.i.i.i ], [ 0, %if.else.i.i.i ]
%accumulator.ret.tr.i.i.i = xor i64 %retval.0.i.i.i, %accumulator.tr.lcssa.i.i.i
%sub2.i = add nsw i32 %10, -1
%idxprom.i = zext i32 %sub2.i to i64
%arrayidx.i = getelementptr inbounds [13 x i32], ptr @monthDays, i64 0, i64 %idxprom.i
%13 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%conv.i = sext i32 %13 to i64
%rem.i.i = srem i32 %9, 400
%cmp.i.i = icmp eq i32 %rem.i.i, 0
br i1 %cmp.i.i, label %isLeapYear.exit.i, label %lor.rhs.i.i
lor.rhs.i.i: ; preds = %getDays2.exit.i
%14 = and i32 %9, 3
%cmp2.i.i = icmp eq i32 %14, 0
br i1 %cmp2.i.i, label %land.rhs.i.i, label %isLeapYear.exit.i
land.rhs.i.i: ; preds = %lor.rhs.i.i
%rem3.i.i = srem i32 %9, 100
%cmp4.i.i = icmp ne i32 %rem3.i.i, 0
br label %isLeapYear.exit.i
isLeapYear.exit.i: ; preds = %land.rhs.i.i, %lor.rhs.i.i, %getDays2.exit.i
%lor.ext.i.i = phi i1 [ true, %getDays2.exit.i ], [ false, %lor.rhs.i.i ], [ %cmp4.i.i, %land.rhs.i.i ]
%cmp5.i = icmp sgt i32 %10, 2
%or.cond13.i = and i1 %cmp5.i, %lor.ext.i.i
%inc.i62 = zext i1 %or.cond13.i to i64
%15 = sext i32 %11 to i64
%sub.i.i = add nsw i64 %15, -719163
%add.i63 = add i64 %sub.i.i, %accumulator.ret.tr.i.i.i
%spec.select.i64 = add i64 %add.i63, %conv.i
%add12.i65 = add i64 %spec.select.i64, %inc.i62
br label %date2dayCount.exit
date2dayCount.exit: ; preds = %if.then18, %isLeapYear.exit.i
%retval.0.i = phi i64 [ %add12.i65, %isLeapYear.exit.i ], [ 0, %if.then18 ]
%sub = add nsw i64 %retval.0.i, -15695
%rem = srem i64 %sub, 20
%conv20 = trunc i64 %rem to i32
store i32 %conv20, ptr %ki, align 4, !tbaa !5
%div = sdiv i64 %sub, 20
%rem21 = srem i64 %div, 18
%conv22 = trunc i64 %rem21 to i32
store i32 %conv22, ptr %w, align 4, !tbaa !5
%div23 = sdiv i64 %sub, 360
%rem24 = srem i64 %div23, 20
%conv25 = trunc i64 %rem24 to i32
store i32 %conv25, ptr %t, align 4, !tbaa !5
%div26 = sdiv i64 %sub, 7200
%rem27 = srem i64 %div26, 20
%conv28 = trunc i64 %rem27 to i32
store i32 %conv28, ptr %ka, align 4, !tbaa !5
%div29 = sdiv i64 %sub, 144000
%rem30 = srem i64 %div29, 13
%conv31 = trunc i64 %rem30 to i32
store i32 %conv31, ptr %b, align 4, !tbaa !5
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv31, i32 noundef %conv28, i32 noundef %conv25, i32 noundef %conv22, i32 noundef %conv20)
br label %cleanup
cleanup: ; preds = %if.then, %date2dayCount.exit
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ki) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ka) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
%16 = load ptr, ptr @stdin, align 8, !tbaa !9
%call1 = call ptr @fgets(ptr noundef nonnull %input, i32 noundef 1024, ptr noundef %16)
%tobool.not = icmp eq ptr %call1, null
br i1 %tobool.not, label %while.end, label %while.body
while.end: ; preds = %cleanup, %entry, %cleanup.thread
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %input) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, 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 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 norecurse nosync nounwind memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
|
#include<stdio.h>
int main()
{
int N,i=1,q=3,reminder;
scanf("%d",&N);
for(i=1;i<=q;i++)
{
reminder=N%10;
N=N/10;
if(reminder==7)
{
printf("Yes\n");
break;
}
}
if(reminder!=7)
{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139107/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139107/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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)
%N.promoted = load i32, ptr %N, align 4, !tbaa !5
%rem = srem i32 %N.promoted, 10
%div = sdiv i32 %N.promoted, 10
%cmp1 = icmp eq i32 %rem, 7
br i1 %cmp1, label %for.end.thread, label %for.cond
for.cond: ; preds = %entry
%rem.1 = srem i32 %div, 10
%div.1 = sdiv i32 %N.promoted, 100
%cmp1.1 = icmp eq i32 %rem.1, 7
br i1 %cmp1.1, label %for.end.thread, label %for.cond.1
for.cond.1: ; preds = %for.cond
%rem.2 = srem i32 %div.1, 10
%div.2 = sdiv i32 %N.promoted, 1000
%cmp1.2 = icmp eq i32 %rem.2, 7
br i1 %cmp1.2, label %for.end.thread, label %if.end6
for.end.thread: ; preds = %for.cond.1, %for.cond, %entry
%div.lcssa = phi i32 [ %div, %entry ], [ %div.1, %for.cond ], [ %div.2, %for.cond.1 ]
br label %if.end6
if.end6: ; preds = %for.cond.1, %for.end.thread
%storemerge = phi i32 [ %div.lcssa, %for.end.thread ], [ %div.2, %for.cond.1 ]
%str.sink = phi ptr [ @str, %for.end.thread ], [ @str.3, %for.cond.1 ]
store i32 %storemerge, ptr %N, align 4, !tbaa !5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int N;
scanf("%d",&N);
if(N / 100 == 7) {
printf("Yes\n");
} else if( N%100 >= 70 && N%100 < 80) {
printf("Yes\n");
} else if(N % 10 == 7) {
printf("Yes\n");
} else {
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139150/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139150/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
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
%.off = add i32 %0, -700
%cmp = icmp ult i32 %.off, 100
br i1 %cmp, label %if.end15, label %if.else
if.else: ; preds = %entry
%rem = srem i32 %0, 100
%1 = add nsw i32 %rem, -70
%or.cond = icmp ult i32 %1, 10
br i1 %or.cond, label %if.end15, label %if.else7
if.else7: ; preds = %if.else
%rem8 = srem i32 %0, 10
%cmp9 = icmp eq i32 %rem8, 7
%str.3.str = select i1 %cmp9, ptr @str.5, ptr @str
br label %if.end15
if.end15: ; preds = %if.else7, %if.else, %entry
%str.4.sink = phi ptr [ @str.5, %entry ], [ @str.5, %if.else ], [ %str.3.str, %if.else7 ]
%puts17 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
char n[3];
int i = 0;
scanf("%s",n);
if (n[0] == '7')
i++;
if (n[1] == '7')
i++;
if (n[2] == '7')
i++;
if (i > 0)
printf("Yes");
else
printf("No");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139194/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139194/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i8, ptr %n, align 1, !tbaa !5
%cmp = icmp ne i8 %0, 55
%arrayidx2 = getelementptr inbounds [3 x i8], ptr %n, i64 0, i64 1
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp4 = icmp ne i8 %1, 55
%arrayidx9 = getelementptr inbounds [3 x i8], ptr %n, i64 0, i64 2
%2 = load i8, ptr %arrayidx9, align 1, !tbaa !5
%cmp11 = icmp ne i8 %2, 55
%.not = and i1 %cmp, %cmp11
%cmp16.not = select i1 %cmp4, i1 %.not, i1 false
%.str.2..str.1 = select i1 %cmp16.not, ptr @.str.2, ptr @.str.1
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
call void @llvm.lifetime.end.p0(i64 3, 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int N, a, b, c, cnt = 0;
scanf("%d", &N);
a = N / 100;
N = N%100;
b = N/10;
c = N%10;
if(a == 7 || b == 7 || c == 7){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139237/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139237/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
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
%rem = srem i32 %0, 100
store i32 %rem, ptr %N, align 4, !tbaa !5
%rem2.lhs.trunc = trunc i32 %rem to i8
%rem210 = srem i8 %rem2.lhs.trunc, 10
%.off = add i32 %0, -700
%cmp = icmp ult i32 %.off, 100
%rem.off = add nsw i32 %rem, -70
%cmp3 = icmp ult i32 %rem.off, 10
%or.cond = select i1 %cmp, i1 true, i1 %cmp3
%cmp5 = icmp eq i8 %rem210, 7
%or.cond8 = or i1 %or.cond, %cmp5
%str.3.str = select i1 %or.cond8, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int N=0;
int N1=0,N2=0,N3=0;
scanf("%d",&N);
N1=N/100;
N2=(N%100)/10;
N3=(N%100)%10;
if(N1==7){
puts("Yes");
}else if(N2==7){
puts("Yes");
}else if(N3==7){
puts("Yes");
}else{
puts("No");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139280/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139280/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
store i32 0, ptr %N, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%rem = srem i32 %0, 100
%rem3.lhs.trunc = trunc i32 %rem to i8
%rem316 = srem i8 %rem3.lhs.trunc, 10
%.off = add i32 %0, -700
%cmp = icmp ult i32 %.off, 100
%rem.off = add nsw i32 %rem, -70
%cmp5 = icmp ult i32 %rem.off, 10
%or.cond = select i1 %cmp, i1 true, i1 %cmp5
%cmp9 = icmp eq i8 %rem316, 7
%1 = or i1 %or.cond, %cmp9
%.str.1.sink = select i1 %1, ptr @.str.1, ptr @.str.2
%call7 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
char line[4];
scanf("%s",line);
for(int i = 0;i < 3;i ++){
if(line[i] == '7'){
printf("Yes");
return 0;
}
}
printf("No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139323/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139323/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%line = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %line) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %line)
%0 = load i8, ptr %line, align 1, !tbaa !5
%cmp1 = icmp eq i8 %0, 55
%arrayidx.1 = getelementptr inbounds [4 x i8], ptr %line, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1
%cmp1.1 = icmp eq i8 %1, 55
%or.cond = select i1 %cmp1, i1 true, i1 %cmp1.1
%arrayidx.2 = getelementptr inbounds [4 x i8], ptr %line, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1
%cmp1.2 = icmp eq i8 %2, 55
%or.cond10 = select i1 %or.cond, i1 true, i1 %cmp1.2
%.str.1..str.2 = select i1 %or.cond10, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %line) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
/* A - Lucky7 */
#include <stdio.h>
int main(void){
int N, count = 0;
scanf("%d", &N);
while(count == 0 && N > 0){
if(N % 10 == 7){
count += 1;
break;
}else{
N /= 10;
}
}
if(count > 0){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139374/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139374/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
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)
%.pr = load i32, ptr %N, align 4
%cmp112 = icmp sgt i32 %.pr, 0
br i1 %cmp112, label %while.body, label %if.end8
while.body: ; preds = %entry, %if.else
%0 = phi i32 [ %div, %if.else ], [ %.pr, %entry ]
%rem = urem i32 %0, 10
%div = udiv i32 %0, 10
%cmp2 = icmp eq i32 %rem, 7
br i1 %cmp2, label %if.end8, label %if.else
if.else: ; preds = %while.body
store i32 %div, ptr %N, align 4, !tbaa !5
%cmp1.not = icmp ult i32 %0, 10
br i1 %cmp1.not, label %if.end8, label %while.body, !llvm.loop !9
if.end8: ; preds = %if.else, %while.body, %entry
%str.sink = phi ptr [ @str, %entry ], [ @str.3, %while.body ], [ @str, %if.else ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int n,a,b,c;
scanf("%d", &n);
a = n/100;
b = n/10%10;
c = n%10;
if(a == 7 || b == 7 || c == 7)
printf("Yes");
else
printf("No");
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139460/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139460/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
%div1 = sdiv i32 %0, 10
%rem = srem i32 %div1, 10
%rem2 = srem i32 %0, 10
%.off = add i32 %0, -700
%cmp = icmp ult i32 %.off, 100
%cmp3 = icmp eq i32 %rem, 7
%or.cond = or i1 %cmp, %cmp3
%cmp5 = icmp eq i32 %rem2, 7
%or.cond8 = or i1 %cmp5, %or.cond
%.str.1..str.2 = select i1 %or.cond8, ptr @.str.1, ptr @.str.2
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
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"}
|
#include<stdio.h>
int main()
{
char N[3];
scanf("%s",&N);
if(N[0]=='7' || N[1]=='7' || N[2]=='7'){
printf("Yes\n");
}
else
printf("No\n") ;
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139503/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139503/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i8, ptr %N, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 55
%arrayidx2 = getelementptr inbounds [3 x i8], ptr %N, i64 0, i64 1
%1 = load i8, ptr %arrayidx2, align 1
%cmp4 = icmp eq i8 %1, 55
%or.cond = select i1 %cmp, i1 true, i1 %cmp4
%arrayidx7 = getelementptr inbounds [3 x i8], ptr %N, i64 0, i64 2
%2 = load i8, ptr %arrayidx7, align 1
%cmp9 = icmp eq i8 %2, 55
%or.cond13 = select i1 %or.cond, i1 true, i1 %cmp9
%str.3.str = select i1 %or.cond13, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main()
{
char N[3];
int i;
scanf("%s",&N);
for(i=0;i<3;i++)
{
if(N[i]=='7')
{
printf("Yes");
return 0;
}
}
printf("No");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139547/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139547/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i8, ptr %N, align 1, !tbaa !5
%cmp1 = icmp eq i8 %0, 55
%arrayidx.1 = getelementptr inbounds [3 x i8], ptr %N, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1
%cmp1.1 = icmp eq i8 %1, 55
%or.cond = select i1 %cmp1, i1 true, i1 %cmp1.1
%arrayidx.2 = getelementptr inbounds [3 x i8], ptr %N, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1
%cmp1.2 = icmp eq i8 %2, 55
%or.cond10 = select i1 %or.cond, i1 true, i1 %cmp1.2
%.str.1..str.2 = select i1 %or.cond10, ptr @.str.1, ptr @.str.2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 3, 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main() {
int N;
int x = scanf("%d", &N);
while (N) {
if (N%10 == 7) {
printf("Yes\n");
return 0;
}
N /= 10;
}
printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139590/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139590/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
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)
%.pr = load i32, ptr %N, align 4, !tbaa !5
%tobool.not5 = icmp eq i32 %.pr, 0
br i1 %tobool.not5, label %cleanup, label %while.body
while.body: ; preds = %entry, %if.end
%0 = phi i32 [ %div, %if.end ], [ %.pr, %entry ]
%rem = srem i32 %0, 10
%div = sdiv i32 %0, 10
%cmp = icmp eq i32 %rem, 7
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %while.body
store i32 %div, ptr %N, align 4, !tbaa !5
%.off = add i32 %0, 9
%tobool.not = icmp ult i32 %.off, 19
br i1 %tobool.not, label %cleanup, label %while.body, !llvm.loop !9
cleanup: ; preds = %if.end, %while.body, %entry
%str.sink = phi ptr [ @str, %entry ], [ @str.3, %while.body ], [ @str, %if.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int x;
scanf("%d",&x);
if((x/100)%10==7 || (x/10)%10==7 || x%10==7){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139640/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139640/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%div = sdiv i32 %0, 100
%rem = srem i32 %div, 10
%cmp = icmp eq i32 %rem, 7
br i1 %cmp, label %if.end, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%div1 = sdiv i32 %0, 10
%rem2 = srem i32 %div1, 10
%cmp3 = icmp eq i32 %rem2, 7
%rem5 = srem i32 %0, 10
%cmp6 = icmp eq i32 %rem5, 7
%or.cond = or i1 %cmp6, %cmp3
%spec.select = select i1 %or.cond, ptr @str.3, ptr @str
br label %if.end
if.end: ; preds = %lor.lhs.false, %entry
%str.sink = phi ptr [ @str.3, %entry ], [ %spec.select, %lor.lhs.false ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int N;
scanf("%d",&N);
int i;
for(i=0;i<3;i++)
{
if(N%10==7)
{
printf("Yes");return 0;
}
else
{
N=N/10;
}
}
printf("No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139684/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139684/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%N.promoted = load i32, ptr %N, align 4, !tbaa !5
%rem = srem i32 %N.promoted, 10
%div = sdiv i32 %N.promoted, 10
%cmp1 = icmp eq i32 %rem, 7
br i1 %cmp1, label %cleanup, label %if.else
if.else: ; preds = %entry
store i32 %div, ptr %N, align 4, !tbaa !5
%rem.1 = srem i32 %div, 10
%cmp1.1 = icmp eq i32 %rem.1, 7
br i1 %cmp1.1, label %cleanup, label %if.else.1
if.else.1: ; preds = %if.else
%div.1 = sdiv i32 %N.promoted, 100
store i32 %div.1, ptr %N, align 4, !tbaa !5
%rem.2 = srem i32 %div.1, 10
%cmp1.2 = icmp eq i32 %rem.2, 7
br i1 %cmp1.2, label %cleanup, label %if.else.2
if.else.2: ; preds = %if.else.1
%div.2 = sdiv i32 %N.promoted, 1000
store i32 %div.2, ptr %N, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %entry, %if.else, %if.else.1, %if.else.2
%.str.2.sink = phi ptr [ @.str.2, %if.else.2 ], [ @.str.1, %if.else.1 ], [ @.str.1, %if.else ], [ @.str.1, %entry ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main (void){
int N;
int flag=0;
scanf("%d",&N);
if(N%10==7){
flag=1;
}else if((N/10)%10==7){
flag=1;
}else if(N/100==7){
flag=1;
}
if(flag==1){
printf("Yes");
}else{
printf("No");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139727/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139727/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
%rem = srem i32 %0, 10
%div = sdiv i32 %0, 10
%cmp = icmp eq i32 %rem, 7
br i1 %cmp, label %if.end15, label %if.else
if.else: ; preds = %entry
%rem1 = srem i32 %div, 10
%cmp2 = icmp eq i32 %rem1, 7
%.off = add i32 %0, -700
%cmp6 = icmp ult i32 %.off, 100
%or.cond = or i1 %cmp6, %cmp2
%spec.select = select i1 %or.cond, ptr @.str.1, ptr @.str.2
br label %if.end15
if.end15: ; preds = %if.else, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ %spec.select, %if.else ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int N;
scanf("%d",&N);
int a,b,c,d,e;
a=N/100;
b=N-a*100;
c=b/10;
d=b-c*10;
if(a==7){
printf("Yes");
}
else if(c==7){
printf("Yes");
}
else if(d==7){
printf("Yes");
}
else{
printf("No");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139770/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139770/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
%.fr = freeze i32 %0
%1 = srem i32 %.fr, 100
%.lhs.trunc = trunc i32 %1 to i8
%2 = srem i8 %.lhs.trunc, 10
%.off = add i32 %.fr, -700
%cmp = icmp ult i32 %.off, 100
%.off19 = add nsw i32 %1, -70
%cmp5 = icmp ult i32 %.off19, 10
%or.cond = select i1 %cmp, i1 true, i1 %cmp5
%cmp9 = icmp eq i8 %2, 7
%3 = or i1 %or.cond, %cmp9
%.str.1.sink = select i1 %3, ptr @.str.1, ptr @.str.2
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef long long ll;
int main()
{
int n,a;
scanf("%d",&n);
if(n%10==7)
{
printf("Yes\n");
}
else
{
n=n/10;
if(n%10==7)
{
printf("Yes\n");
}
else
{
n=n/10;
if(n==7)
{
printf("Yes\n");
}
else
{
printf("No\n");
}
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139813/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139813/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
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
%rem = srem i32 %0, 10
%div = sdiv i32 %0, 10
%cmp = icmp eq i32 %rem, 7
br i1 %cmp, label %if.end14, label %if.else
if.else: ; preds = %entry
store i32 %div, ptr %n, align 4, !tbaa !5
%rem2 = srem i32 %div, 10
%cmp3 = icmp eq i32 %rem2, 7
br i1 %cmp3, label %if.end14, label %if.else6
if.else6: ; preds = %if.else
%div7 = sdiv i32 %0, 100
store i32 %div7, ptr %n, align 4, !tbaa !5
%.off = add i32 %0, -700
%cmp8 = icmp ult i32 %.off, 100
%str.3.str = select i1 %cmp8, ptr @str.5, ptr @str
br label %if.end14
if.end14: ; preds = %if.else6, %if.else, %entry
%str.4.sink = phi ptr [ @str.5, %entry ], [ @str.5, %if.else ], [ %str.3.str, %if.else6 ]
%puts16 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
int main()
{
char s[3];
scanf("%s", &s);
if (strchr(s, '7') == NULL)
{
printf("No");
}
else {
printf("Yes");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139864/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139864/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call1 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %s, i32 noundef 55) #5
%cmp = icmp eq ptr %call1, null
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strchr(ptr noundef, i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
int main(void){
int n;
scanf("%d",&n);
int sosu[1001] = {0};
int flag = 0;
for(int i = 2;i <= n;i ++){
int temp = i;
for(int j = 2;j <= i;j ++){
flag = 0;
while(flag == 0){
if(temp%j == 0){
sosu[j] ++;
temp /= j;
}
else{
flag = 1;
}
}
}
}
long long ans = 1;
for(int i = 1;i < 1000;i ++){
ans *= (sosu[i]+1);
if(ans > 1000000007){
ans %= 1000000007;
}
}
printf("%lld\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139914/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139914/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%sosu = alloca [1001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %sosu) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4004) %sosu, i8 0, i64 4004, i1 false)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not44 = icmp slt i32 %0, 2
br i1 %cmp.not44, label %for.body15.preheader, label %for.cond1.preheader.preheader
for.body15.preheader: ; preds = %for.cond.cleanup3, %entry
br label %for.body15
for.cond1.preheader.preheader: ; preds = %entry
%1 = add nuw i32 %0, 2
%wide.trip.count54 = zext i32 %1 to i64
br label %while.cond.preheader.preheader
while.cond.preheader.preheader: ; preds = %for.cond.cleanup3, %for.cond1.preheader.preheader
%indvars.iv51 = phi i64 [ 3, %for.cond1.preheader.preheader ], [ %indvars.iv.next52, %for.cond.cleanup3 ]
%i.045 = phi i32 [ 2, %for.cond1.preheader.preheader ], [ %inc9, %for.cond.cleanup3 ]
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.cond.preheader.preheader, %for.inc
%indvars.iv = phi i64 [ 2, %while.cond.preheader.preheader ], [ %indvars.iv.next, %for.inc ]
%temp.042 = phi i32 [ %i.045, %while.cond.preheader.preheader ], [ %temp.140.lcssa, %for.inc ]
%arrayidx = getelementptr inbounds [1001 x i32], ptr %sosu, i64 0, i64 %indvars.iv
%2 = trunc i64 %indvars.iv to i32
%rem62 = srem i32 %temp.042, %2
%cmp663 = icmp eq i32 %rem62, 0
br i1 %cmp663, label %if.end.preheader, label %for.inc
if.end.preheader: ; preds = %while.cond.preheader
%arrayidx.promoted = load i32, ptr %arrayidx, align 4, !tbaa !5
br label %if.end
for.cond.cleanup3: ; preds = %for.inc
%inc9 = add nuw nsw i32 %i.045, 1
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%exitcond55.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count54
br i1 %exitcond55.not, label %for.body15.preheader, label %while.cond.preheader.preheader, !llvm.loop !9
if.end: ; preds = %if.end.preheader, %if.end
%inc65 = phi i32 [ %inc, %if.end ], [ %arrayidx.promoted, %if.end.preheader ]
%temp.14064 = phi i32 [ %div, %if.end ], [ %temp.042, %if.end.preheader ]
%inc = add nsw i32 %inc65, 1
%div = sdiv i32 %temp.14064, %2
%rem = srem i32 %div, %2
%cmp6 = icmp eq i32 %rem, 0
br i1 %cmp6, label %if.end, label %for.inc.loopexit, !llvm.loop !11
for.inc.loopexit: ; preds = %if.end
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.inc.loopexit, %while.cond.preheader
%temp.140.lcssa = phi i32 [ %temp.042, %while.cond.preheader ], [ %div, %for.inc.loopexit ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv51
br i1 %exitcond.not, label %for.cond.cleanup3, label %while.cond.preheader, !llvm.loop !12
for.cond.cleanup14: ; preds = %for.body15
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.1)
call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %sosu) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body15: ; preds = %for.body15.1, %for.body15.preheader
%indvars.iv56 = phi i64 [ 1, %for.body15.preheader ], [ %indvars.iv.next57.1, %for.body15.1 ]
%ans.046 = phi i64 [ 1, %for.body15.preheader ], [ %ans.1.1, %for.body15.1 ]
%arrayidx17 = getelementptr inbounds [1001 x i32], ptr %sosu, i64 0, i64 %indvars.iv56
%3 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%add = add nsw i32 %3, 1
%conv = sext i32 %add to i64
%mul = mul nsw i64 %ans.046, %conv
%cmp18 = icmp sgt i64 %mul, 1000000007
%rem21 = urem i64 %mul, 1000000007
%ans.1 = select i1 %cmp18, i64 %rem21, i64 %mul
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%exitcond59.not = icmp eq i64 %indvars.iv.next57, 1000
br i1 %exitcond59.not, label %for.cond.cleanup14, label %for.body15.1, !llvm.loop !13
for.body15.1: ; preds = %for.body15
%arrayidx17.1 = getelementptr inbounds [1001 x i32], ptr %sosu, i64 0, i64 %indvars.iv.next57
%4 = load i32, ptr %arrayidx17.1, align 4, !tbaa !5
%add.1 = add nsw i32 %4, 1
%conv.1 = sext i32 %add.1 to i64
%mul.1 = mul nsw i64 %ans.1, %conv.1
%cmp18.1 = icmp sgt i64 %mul.1, 1000000007
%rem21.1 = urem i64 %mul.1, 1000000007
%ans.1.1 = select i1 %cmp18.1, i64 %rem21.1, i64 %mul.1
%indvars.iv.next57.1 = add nuw nsw i64 %indvars.iv56, 2
br label %for.body15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#include<stdlib.h>
void run(void){
char *s=(char *)malloc(sizeof(char)*(100000+1));
scanf("%s",s);
int p=0;
int cnt=0;
int i;
for(i=0;s[i]!='\0';i++){
if(p>0){
if(s[i]=='g') cnt++;
p--;
} else {
if(s[i]=='p') cnt--;
p++;
}
}
printf("%d\n",cnt);
}
int main(void){
run();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_139958/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_139958/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(100001) ptr @malloc(i64 noundef 100001) #3
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %call)
%0 = load i8, ptr %call, align 1, !tbaa !5
%cmp.not34 = icmp eq i8 %0, 0
br i1 %cmp.not34, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%1 = phi i8 [ %2, %for.body ], [ %0, %entry ]
%cnt.036 = phi i32 [ %cnt.3, %for.body ], [ 0, %entry ]
%p.035 = phi i32 [ %p.1, %for.body ], [ 0, %entry ]
%cmp3.not = icmp eq i32 %p.035, 0
%cmp8 = icmp eq i8 %1, 103
%inc = zext i1 %cmp8 to i32
%cmp14 = icmp eq i8 %1, 112
%dec17 = sext i1 %cmp14 to i32
%p.1 = xor i32 %p.035, 1
%inc.pn = select i1 %cmp3.not, i32 %dec17, i32 %inc
%cnt.3 = add nsw i32 %inc.pn, %cnt.036
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds i8, ptr %call, i64 %indvars.iv.next
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %2, 0
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.body, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %cnt.3, %for.body ]
%call22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call.i = tail call noalias dereferenceable_or_null(100001) ptr @malloc(i64 noundef 100001) #3
%call1.i = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %call.i)
%0 = load i8, ptr %call.i, align 1, !tbaa !5
%cmp.not34.i = icmp eq i8 %0, 0
br i1 %cmp.not34.i, label %run.exit, label %for.body.i
for.body.i: ; preds = %entry, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ 0, %entry ]
%1 = phi i8 [ %2, %for.body.i ], [ %0, %entry ]
%cnt.036.i = phi i32 [ %cnt.3.i, %for.body.i ], [ 0, %entry ]
%p.035.i = phi i32 [ %p.1.i, %for.body.i ], [ 0, %entry ]
%cmp3.not.i = icmp eq i32 %p.035.i, 0
%cmp8.i = icmp eq i8 %1, 103
%inc.i = zext i1 %cmp8.i to i32
%cmp14.i = icmp eq i8 %1, 112
%dec17.i = sext i1 %cmp14.i to i32
%p.1.i = xor i32 %p.035.i, 1
%inc.pn.i = select i1 %cmp3.not.i, i32 %dec17.i, i32 %inc.i
%cnt.3.i = add nsw i32 %inc.pn.i, %cnt.036.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds i8, ptr %call.i, i64 %indvars.iv.next.i
%2 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%cmp.not.i = icmp eq i8 %2, 0
br i1 %cmp.not.i, label %run.exit, label %for.body.i, !llvm.loop !8
run.exit: ; preds = %for.body.i, %entry
%cnt.0.lcssa.i = phi i32 [ 0, %entry ], [ %cnt.3.i, %for.body.i ]
%call22.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa.i)
ret i32 0
}
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 #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 allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int cmp(const void *a, const void *b){
return *(int*)a - *(int*)b;
}
int main(void){
int count = 0;
int n;
scanf("%d", &n);
int *a = malloc(sizeof(int) * n);
for(int i = 0; i < n; i++){
scanf("%d", a + i);
if(a[i] < 0){
count++;
a[i] *= -1;
}
}
qsort(a, n, sizeof(int), cmp);
long sum = 0;
int i = 0;
if(count % 2){
sum -= a[i];
i++;
}
for(; i < n; i++){
sum += a[i];
}
printf("%ld\n", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140006/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140006/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%ld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #8
%cmp46 = icmp sgt i32 %0, 0
br i1 %cmp46, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
call void @qsort(ptr noundef %call1, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @cmp) #7
br label %if.end17
for.cond.cleanup: ; preds = %for.inc
%1 = and i32 %count.1, 1
%2 = icmp eq i32 %1, 0
call void @qsort(ptr noundef nonnull %call1, i64 noundef %5, i64 noundef 4, ptr noundef nonnull @cmp) #7
br i1 %2, label %if.end17, label %if.then12
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%count.047 = phi i32 [ %count.1, %for.inc ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr)
%3 = load i32, ptr %add.ptr, align 4, !tbaa !5
%cmp4 = icmp slt i32 %3, 0
br i1 %cmp4, label %if.then, label %for.inc
if.then: ; preds = %for.body
%inc = add nsw i32 %count.047, 1
%mul8 = sub nsw i32 0, %3
store i32 %mul8, ptr %add.ptr, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%count.1 = phi i32 [ %inc, %if.then ], [ %count.047, %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 = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
if.then12: ; preds = %for.cond.cleanup
%6 = load i32, ptr %call1, align 4, !tbaa !5
%conv15 = sext i32 %6 to i64
%sub = sub nsw i64 0, %conv15
br label %if.end17
if.end17: ; preds = %for.cond.cleanup.thread, %if.then12, %for.cond.cleanup
%sum.0 = phi i64 [ %sub, %if.then12 ], [ 0, %for.cond.cleanup ], [ 0, %for.cond.cleanup.thread ]
%i11.0 = phi i32 [ 1, %if.then12 ], [ 0, %for.cond.cleanup ], [ 0, %for.cond.cleanup.thread ]
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp1950 = icmp slt i32 %i11.0, %7
br i1 %cmp1950, label %for.body21.preheader, label %for.end27
for.body21.preheader: ; preds = %if.end17
%8 = zext i32 %i11.0 to i64
%wide.trip.count = zext i32 %7 to i64
%9 = sub nsw i64 %wide.trip.count, %8
%min.iters.check = icmp ult i64 %9, 4
br i1 %min.iters.check, label %for.body21.preheader63, label %vector.ph
vector.ph: ; preds = %for.body21.preheader
%n.vec = and i64 %9, -4
%ind.end = or i64 %n.vec, %8
%10 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %sum.0, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ %10, %vector.ph ], [ %15, %vector.body ]
%vec.phi61 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %16, %vector.body ]
%offset.idx = or i64 %index, %8
%11 = getelementptr inbounds i32, ptr %call1, i64 %offset.idx
%wide.load = load <2 x i32>, ptr %11, align 4, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 2
%wide.load62 = load <2 x i32>, ptr %12, align 4, !tbaa !5
%13 = sext <2 x i32> %wide.load to <2 x i64>
%14 = sext <2 x i32> %wide.load62 to <2 x i64>
%15 = add <2 x i64> %vec.phi, %13
%16 = add <2 x i64> %vec.phi61, %14
%index.next = add nuw i64 %index, 4
%17 = icmp eq i64 %index.next, %n.vec
br i1 %17, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %16, %15
%18 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %9, %n.vec
br i1 %cmp.n, label %for.end27, label %for.body21.preheader63
for.body21.preheader63: ; preds = %for.body21.preheader, %middle.block
%indvars.iv56.ph = phi i64 [ %8, %for.body21.preheader ], [ %ind.end, %middle.block ]
%sum.151.ph = phi i64 [ %sum.0, %for.body21.preheader ], [ %18, %middle.block ]
br label %for.body21
for.body21: ; preds = %for.body21.preheader63, %for.body21
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body21 ], [ %indvars.iv56.ph, %for.body21.preheader63 ]
%sum.151 = phi i64 [ %add, %for.body21 ], [ %sum.151.ph, %for.body21.preheader63 ]
%arrayidx23 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv56
%19 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%conv24 = sext i32 %19 to i64
%add = add nsw i64 %sum.151, %conv24
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%exitcond.not = icmp eq i64 %indvars.iv.next57, %wide.trip.count
br i1 %exitcond.not, label %for.end27, label %for.body21, !llvm.loop !14
for.end27: ; preds = %for.body21, %middle.block, %if.end17
%sum.1.lcssa = phi i64 [ %sum.0, %if.end17 ], [ %18, %middle.block ], [ %add, %for.body21 ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sum.1.lcssa)
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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree "no-trapping-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 }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
|
#include <stdio.h>
#include <stdlib.h>
int main ( )
{
int N, i, min, cnt;
long sum;
long A[ 100000 ];
scanf ( "%d", &N );
sum = 0;
min = 1000000000;
cnt = 0;
for ( i = 0 ; i < N ; i++ )
{
scanf ( "%ld", &A[ i ] );
if ( A[ i ] < 0 )
{
cnt++;
A[ i ] = abs ( A[ i ] );
}
if ( min > A[ i ] )
min = A[ i ];
sum += A[ i ];
}
if ( cnt % 2 )
sum -= min * 2;
printf ( "%ld\n", sum );
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140057/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140057/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [100000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 800000, 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
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body, label %for.end
for.body: ; preds = %entry, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %entry ]
%sum.044 = phi i64 [ %add, %if.end ], [ 0, %entry ]
%cnt.043 = phi i32 [ %cnt.1, %if.end ], [ 0, %entry ]
%min.042 = phi i32 [ %spec.select, %if.end ], [ 1000000000, %entry ]
%arrayidx = getelementptr inbounds [100000 x i64], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%1 = load i64, ptr %arrayidx, align 8, !tbaa !9
%cmp4 = icmp slt i64 %1, 0
br i1 %cmp4, label %if.then, label %if.end
if.then: ; preds = %for.body
%inc = add nsw i32 %cnt.043, 1
%conv = trunc i64 %1 to i32
%2 = call i32 @llvm.abs.i32(i32 %conv, i1 true)
%conv7 = zext i32 %2 to i64
store i64 %conv7, ptr %arrayidx, align 8, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body
%3 = phi i64 [ %conv7, %if.then ], [ %1, %for.body ]
%cnt.1 = phi i32 [ %inc, %if.then ], [ %cnt.043, %for.body ]
%conv10 = sext i32 %min.042 to i64
%cmp13 = icmp slt i64 %3, %conv10
%conv18 = trunc i64 %3 to i32
%spec.select = select i1 %cmp13, i32 %conv18, i32 %min.042
%add = add nuw nsw i64 %3, %sum.044
%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.loopexit, !llvm.loop !11
for.end.loopexit: ; preds = %if.end
%6 = and i32 %cnt.1, 1
%7 = icmp eq i32 %6, 0
%8 = shl nsw i32 %spec.select, 1
%9 = select i1 %7, i32 0, i32 %8
%10 = sext i32 %9 to i64
%11 = sub nsw i64 %add, %10
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%sum.1 = phi i64 [ 0, %entry ], [ %11, %for.end.loopexit ]
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sum.1)
call void @llvm.lifetime.end.p0(i64 800000, 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 speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, 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 nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int t;
scanf("%d", &t);
while(t>0){
int n;
scanf("%d", &n);
int arr[n];
for(int i=0;i<n;i++){
scanf("%d", &arr[i]);
}
int tf=0;
for(int i=0;i<n-1;i++){
if(arr[i] >arr[i+1]){
printf("YES\n");
tf++;
break;
}
}
if(tf!=1){
printf("NO\n");
}
t=t-1;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14010/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14010/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = 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 !5
%cmp33 = icmp sgt i32 %0, 0
br i1 %cmp33, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end22
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = zext i32 %1 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %2, align 16
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp231 = icmp sgt i32 %4, 0
br i1 %cmp231, label %for.body, label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.body, %while.body
%.lcssa = phi i32 [ %4, %while.body ], [ %6, %for.body ]
%5 = call i32 @llvm.smax.i32(i32 %.lcssa, i32 1)
%smax = add nsw i32 %5, -1
%wide.trip.count = zext i32 %smax to i64
br label %for.cond5
for.body: ; preds = %while.body, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %while.body ]
%arrayidx = getelementptr inbounds i32, ptr %vla, 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
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp2, label %for.body, label %for.cond5.preheader, !llvm.loop !9
for.cond5: ; preds = %for.cond5.preheader, %for.body8
%indvars.iv36 = phi i64 [ 0, %for.cond5.preheader ], [ %indvars.iv.next37, %for.body8 ]
%exitcond.not = icmp eq i64 %indvars.iv36, %wide.trip.count
br i1 %exitcond.not, label %if.end22, label %for.body8
for.body8: ; preds = %for.cond5
%arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv36
%8 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
%arrayidx12 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next37
%9 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13 = icmp sgt i32 %8, %9
br i1 %cmp13, label %if.end22, label %for.cond5, !llvm.loop !11
if.end22: ; preds = %for.cond5, %for.body8
%str.sink = phi ptr [ @str, %for.body8 ], [ @str.3, %for.cond5 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%10 = load i32, ptr %t, align 4, !tbaa !5
%sub23 = add nsw i32 %10, -1
store i32 %sub23, ptr %t, align 4, !tbaa !5
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
%11 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp sgt i32 %11, 0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !12
while.end: ; preds = %if.end22, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-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 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}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(){
int w,h,n,i;
scanf("%d%d%d",&w,&h,&n);
int mass[n+1][3];
int left=0,right=w,up=h,down=0;
for(i=0;i<n;i++){
scanf("%d%d%d",&mass[i][0],&mass[i][1],&mass[i][2]);
if(mass[i][2]==1){
if(left<mass[i][0])
left=mass[i][0];
}
else if(mass[i][2]==2){
if(right>mass[i][0])
right=mass[i][0];
}
else if(mass[i][2]==3){
if(down<mass[i][1])
down=mass[i][1];
}
else{
if(up>mass[i][1])
up=mass[i][1];
}
}
if(up-down<0 || right-left<0)
puts("0");
else
printf("%d\n",(up-down)*(right-left));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140150/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140150/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"0\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:
%w = alloca i32, align 4
%h = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%1 = zext i32 %add to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca [3 x i32], i64 %1, align 16
%3 = load i32, ptr %w, align 4, !tbaa !5
%4 = load i32, ptr %h, align 4, !tbaa !5
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp103 = icmp sgt i32 %5, 0
br i1 %cmp103, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%down.0108 = phi i32 [ %down.1, %for.inc ], [ 0, %entry ]
%up.0107 = phi i32 [ %up.1, %for.inc ], [ %4, %entry ]
%right.0106 = phi i32 [ %right.1, %for.inc ], [ %3, %entry ]
%left.0105 = phi i32 [ %left.1, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv, i64 1
%arrayidx7 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv, i64 2
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx7)
%6 = load i32, ptr %arrayidx7, align 4, !tbaa !5
switch i32 %6, label %if.else50 [
i32 1, label %if.then
i32 2, label %if.then25
i32 3, label %if.then40
]
if.then: ; preds = %for.body
%7 = load i32, ptr %arrayidx, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %left.0105, i32 %7)
br label %for.inc
if.then25: ; preds = %for.body
%8 = load i32, ptr %arrayidx, align 4, !tbaa !5
%spec.select100 = call i32 @llvm.smin.i32(i32 %right.0106, i32 %8)
br label %for.inc
if.then40: ; preds = %for.body
%9 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%spec.select101 = call i32 @llvm.smax.i32(i32 %down.0108, i32 %9)
br label %for.inc
if.else50: ; preds = %for.body
%10 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%spec.select102 = call i32 @llvm.smin.i32(i32 %up.0107, i32 %10)
br label %for.inc
for.inc: ; preds = %if.else50, %if.then40, %if.then25, %if.then
%left.1 = phi i32 [ %spec.select, %if.then ], [ %left.0105, %if.then25 ], [ %left.0105, %if.then40 ], [ %left.0105, %if.else50 ]
%right.1 = phi i32 [ %right.0106, %if.then ], [ %spec.select100, %if.then25 ], [ %right.0106, %if.then40 ], [ %right.0106, %if.else50 ]
%up.1 = phi i32 [ %up.0107, %if.then ], [ %up.0107, %if.then25 ], [ %up.0107, %if.then40 ], [ %spec.select102, %if.else50 ]
%down.1 = phi i32 [ %down.0108, %if.then ], [ %down.0108, %if.then25 ], [ %spec.select101, %if.then40 ], [ %down.0108, %if.else50 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp = icmp slt i64 %indvars.iv.next, %12
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%left.0.lcssa = phi i32 [ 0, %entry ], [ %left.1, %for.inc ]
%right.0.lcssa = phi i32 [ %3, %entry ], [ %right.1, %for.inc ]
%up.0.lcssa = phi i32 [ %4, %entry ], [ %up.1, %for.inc ]
%down.0.lcssa = phi i32 [ 0, %entry ], [ %down.1, %for.inc ]
%sub = sub nsw i32 %up.0.lcssa, %down.0.lcssa
%cmp63 = icmp slt i32 %sub, 0
br i1 %cmp63, label %if.then66, label %lor.lhs.false
lor.lhs.false: ; preds = %for.end
%sub64 = sub nsw i32 %right.0.lcssa, %left.0.lcssa
%cmp65 = icmp slt i32 %sub64, 0
br i1 %cmp65, label %if.then66, label %if.else68
if.then66: ; preds = %lor.lhs.false, %for.end
%call67 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end72
if.else68: ; preds = %lor.lhs.false
%mul = mul nsw i32 %sub, %sub64
%call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %mul)
br label %if.end72
if.end72: ; preds = %if.else68, %if.then66
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int max(int a, int b){
if( a > b) return a;
return b;
}
int min(int a, int b){
if( a < b) return a;
return b;
}
int main(int argc, char const *argv[]) {
int weight, height,i=0;
int x1,x2,y1,y2;
int num;
int a[101]={};
int x[101]={}, y[101]={};
scanf("%d %d %d",&weight, &height, &num );
x1=0;x2=weight;y1=0;y2=height;
for(i=0;i<num;i++)scanf("%d %d %d",&x[i], &y[i], &a[i] );
for(i=0;i<num;i++){
switch (a[i]) {
case 1://x<xi
x1 = max(x1, x[i]);
break;
case 2://x > xi
x2 = min(x2, x[i]);
break;
case 3://y < yi
y1 = max(y1,y[i]);
break;
case 4://y > yi
y2 = min(y2,y[i]);
break;
default:
break;
}
}
if( (weight=(x2-x1)) < 0)weight = 0;
if( (height=(y2-y1)) < 0)height = 0;
printf("%d\n", weight*height);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140194/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140194/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: 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: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #1 {
entry:
%weight = alloca i32, align 4
%height = alloca i32, align 4
%num = alloca i32, align 4
%a = alloca [101 x i32], align 16
%x = alloca [101 x i32], align 16
%y = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %weight) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %height) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #6
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %a) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) %a, i8 0, i64 404, i1 false)
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %x) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) %x, i8 0, i64 404, i1 false)
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %y) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) %y, i8 0, i64 404, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %weight, ptr noundef nonnull %height, ptr noundef nonnull %num)
%0 = load i32, ptr %weight, align 4, !tbaa !5
%1 = load i32, ptr %height, align 4, !tbaa !5
%2 = load i32, ptr %num, align 4, !tbaa !5
%cmp54 = icmp sgt i32 %2, 0
br i1 %cmp54, label %for.body, label %for.end28
for.cond6.preheader: ; preds = %for.body
%cmp756 = icmp sgt i32 %3, 0
br i1 %cmp756, label %for.body8.preheader, label %for.end28
for.body8.preheader: ; preds = %for.cond6.preheader
%wide.trip.count = zext i32 %3 to i64
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x i32], ptr %x, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [101 x i32], ptr %y, i64 0, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx4)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %num, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !9
for.body8: ; preds = %for.body8.preheader, %for.inc26
%indvars.iv68 = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next69, %for.inc26 ]
%y2.061 = phi i32 [ %1, %for.body8.preheader ], [ %y2.1, %for.inc26 ]
%y1.060 = phi i32 [ 0, %for.body8.preheader ], [ %y1.1, %for.inc26 ]
%x2.059 = phi i32 [ %0, %for.body8.preheader ], [ %x2.1, %for.inc26 ]
%x1.058 = phi i32 [ 0, %for.body8.preheader ], [ %x1.1, %for.inc26 ]
%arrayidx10 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv68
%5 = load i32, ptr %arrayidx10, align 4, !tbaa !5
switch i32 %5, label %for.inc26 [
i32 1, label %sw.bb
i32 2, label %sw.bb14
i32 3, label %sw.bb18
i32 4, label %sw.bb22
]
sw.bb: ; preds = %for.body8
%arrayidx12 = getelementptr inbounds [101 x i32], ptr %x, i64 0, i64 %indvars.iv68
%6 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%a.b.i = call i32 @llvm.smax.i32(i32 %x1.058, i32 %6)
br label %for.inc26
sw.bb14: ; preds = %for.body8
%arrayidx16 = getelementptr inbounds [101 x i32], ptr %x, i64 0, i64 %indvars.iv68
%7 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%a.b.i51 = call i32 @llvm.smin.i32(i32 %x2.059, i32 %7)
br label %for.inc26
sw.bb18: ; preds = %for.body8
%arrayidx20 = getelementptr inbounds [101 x i32], ptr %y, i64 0, i64 %indvars.iv68
%8 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%a.b.i52 = call i32 @llvm.smax.i32(i32 %y1.060, i32 %8)
br label %for.inc26
sw.bb22: ; preds = %for.body8
%arrayidx24 = getelementptr inbounds [101 x i32], ptr %y, i64 0, i64 %indvars.iv68
%9 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%a.b.i53 = call i32 @llvm.smin.i32(i32 %y2.061, i32 %9)
br label %for.inc26
for.inc26: ; preds = %sw.bb, %sw.bb14, %sw.bb18, %sw.bb22, %for.body8
%x1.1 = phi i32 [ %x1.058, %for.body8 ], [ %x1.058, %sw.bb22 ], [ %x1.058, %sw.bb18 ], [ %x1.058, %sw.bb14 ], [ %a.b.i, %sw.bb ]
%x2.1 = phi i32 [ %x2.059, %for.body8 ], [ %x2.059, %sw.bb22 ], [ %x2.059, %sw.bb18 ], [ %a.b.i51, %sw.bb14 ], [ %x2.059, %sw.bb ]
%y1.1 = phi i32 [ %y1.060, %for.body8 ], [ %y1.060, %sw.bb22 ], [ %a.b.i52, %sw.bb18 ], [ %y1.060, %sw.bb14 ], [ %y1.060, %sw.bb ]
%y2.1 = phi i32 [ %y2.061, %for.body8 ], [ %a.b.i53, %sw.bb22 ], [ %y2.061, %sw.bb18 ], [ %y2.061, %sw.bb14 ], [ %y2.061, %sw.bb ]
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%exitcond.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count
br i1 %exitcond.not, label %for.end28, label %for.body8, !llvm.loop !11
for.end28: ; preds = %for.inc26, %entry, %for.cond6.preheader
%x1.0.lcssa = phi i32 [ 0, %for.cond6.preheader ], [ 0, %entry ], [ %x1.1, %for.inc26 ]
%x2.0.lcssa = phi i32 [ %0, %for.cond6.preheader ], [ %0, %entry ], [ %x2.1, %for.inc26 ]
%y1.0.lcssa = phi i32 [ 0, %for.cond6.preheader ], [ 0, %entry ], [ %y1.1, %for.inc26 ]
%y2.0.lcssa = phi i32 [ %1, %for.cond6.preheader ], [ %1, %entry ], [ %y2.1, %for.inc26 ]
%sub = sub nsw i32 %x2.0.lcssa, %x1.0.lcssa
%spec.store.select = call i32 @llvm.smax.i32(i32 %sub, i32 0)
store i32 %spec.store.select, ptr %weight, align 4
%sub30 = sub nsw i32 %y2.0.lcssa, %y1.0.lcssa
%spec.store.select35 = call i32 @llvm.smax.i32(i32 %sub30, i32 0)
store i32 %spec.store.select35, ptr %height, align 4
%mul = mul nsw i32 %spec.store.select35, %spec.store.select
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %y) #6
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %x) #6
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %height) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %weight) #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: 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 @__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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <math.h>
int main(void){
int w, h, n;
scanf("%d %d %d", &w, &h, &n);
int i;
int x, y, a;
int xmin = 0;
int xmax = w;
int ymin = 0;
int ymax = h;
for(i = 1 ; i <= n; i++){
scanf("%d %d %d", &x, &y, &a);
if(a == 1){
if(x > xmin){
xmin = x;
}
}else if(a == 2){
if(x < xmax){
xmax = x;
}
}else if(a == 3){
if(y > ymin){
ymin = y;
}
}else if(a == 4){
if(y < ymax){
ymax = y;
}
}
}
if(xmin < xmax && ymin < ymax){
printf("%d\n", (xmax - xmin)*(ymax - ymin));
}else{
printf("0\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140237/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140237/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@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:
%w = alloca i32, align 4
%h = alloca i32, align 4
%n = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h, ptr noundef nonnull %n)
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 %a) #5
%0 = load i32, ptr %w, align 4, !tbaa !5
%1 = load i32, ptr %h, align 4, !tbaa !5
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not50 = icmp slt i32 %2, 1
br i1 %cmp.not50, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%ymax.055 = phi i32 [ %ymax.1, %for.inc ], [ %1, %entry ]
%ymin.054 = phi i32 [ %ymin.1, %for.inc ], [ 0, %entry ]
%xmax.053 = phi i32 [ %xmax.1, %for.inc ], [ %0, %entry ]
%xmin.052 = phi i32 [ %xmin.1, %for.inc ], [ 0, %entry ]
%i.051 = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %a)
%3 = load i32, ptr %a, align 4, !tbaa !5
switch i32 %3, label %for.inc [
i32 1, label %if.then
i32 2, label %if.then6
i32 3, label %if.then12
i32 4, label %if.then18
]
if.then: ; preds = %for.body
%4 = load i32, ptr %x, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %4, i32 %xmin.052)
br label %for.inc
if.then6: ; preds = %for.body
%5 = load i32, ptr %x, align 4, !tbaa !5
%spec.select47 = call i32 @llvm.smin.i32(i32 %5, i32 %xmax.053)
br label %for.inc
if.then12: ; preds = %for.body
%6 = load i32, ptr %y, align 4, !tbaa !5
%spec.select48 = call i32 @llvm.smax.i32(i32 %6, i32 %ymin.054)
br label %for.inc
if.then18: ; preds = %for.body
%7 = load i32, ptr %y, align 4, !tbaa !5
%spec.select49 = call i32 @llvm.smin.i32(i32 %7, i32 %ymax.055)
br label %for.inc
for.inc: ; preds = %if.then18, %if.then12, %if.then6, %if.then, %for.body
%xmin.1 = phi i32 [ %spec.select, %if.then ], [ %xmin.052, %if.then6 ], [ %xmin.052, %if.then12 ], [ %xmin.052, %for.body ], [ %xmin.052, %if.then18 ]
%xmax.1 = phi i32 [ %xmax.053, %if.then ], [ %spec.select47, %if.then6 ], [ %xmax.053, %if.then12 ], [ %xmax.053, %for.body ], [ %xmax.053, %if.then18 ]
%ymin.1 = phi i32 [ %ymin.054, %if.then ], [ %ymin.054, %if.then6 ], [ %spec.select48, %if.then12 ], [ %ymin.054, %for.body ], [ %ymin.054, %if.then18 ]
%ymax.1 = phi i32 [ %ymax.055, %if.then ], [ %ymax.055, %if.then6 ], [ %ymax.055, %if.then12 ], [ %ymax.055, %for.body ], [ %spec.select49, %if.then18 ]
%inc = add nuw nsw i32 %i.051, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.051, %8
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%xmin.0.lcssa = phi i32 [ 0, %entry ], [ %xmin.1, %for.inc ]
%xmax.0.lcssa = phi i32 [ %0, %entry ], [ %xmax.1, %for.inc ]
%ymin.0.lcssa = phi i32 [ 0, %entry ], [ %ymin.1, %for.inc ]
%ymax.0.lcssa = phi i32 [ %1, %entry ], [ %ymax.1, %for.inc ]
%cmp26 = icmp slt i32 %xmin.0.lcssa, %xmax.0.lcssa
%cmp27 = icmp slt i32 %ymin.0.lcssa, %ymax.0.lcssa
%or.cond = select i1 %cmp26, i1 %cmp27, i1 false
br i1 %or.cond, label %if.then28, label %if.else31
if.then28: ; preds = %for.end
%sub = sub nsw i32 %xmax.0.lcssa, %xmin.0.lcssa
%sub29 = sub nsw i32 %ymax.0.lcssa, %ymin.0.lcssa
%mul = mul nsw i32 %sub29, %sub
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
br label %if.end33
if.else31: ; preds = %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end33
if.end33: ; preds = %if.else31, %if.then28
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #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 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #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 i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int w,h,n,left,bot,right,top,i,ans;
int x[110],y[110],a[110];
scanf("%d %d %d",&w,&h,&n);
left=bot=0,right=w,top=h;
for(i=0;i<n;i++){
scanf("%d %d %d",&x[i],&y[i],&a[i]);
if(a[i]==1){
if(left<x[i]) left=x[i];
}else if(a[i]==2){
if(right>x[i]) right=x[i];
}else if(a[i]==3){
if(bot<y[i]) bot=y[i];
}else if(a[i]==4){
if(top>y[i]) top=y[i];
}
}
if(left>=right || bot>=top){
printf("0\n");
}else{
ans=(top-bot)*(right-left);
printf("%d\n",ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140280/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140280/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.2 = 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:
%w = alloca i32, align 4
%h = alloca i32, align 4
%n = alloca i32, align 4
%x = alloca [110 x i32], align 16
%y = alloca [110 x i32], align 16
%a = alloca [110 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %y) #5
call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %a) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h, ptr noundef nonnull %n)
%0 = load i32, ptr %w, align 4, !tbaa !5
%1 = load i32, ptr %h, align 4, !tbaa !5
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp93 = icmp sgt i32 %2, 0
br i1 %cmp93, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%left.098 = phi i32 [ %left.1, %for.inc ], [ 0, %entry ]
%top.096 = phi i32 [ %top.1, %for.inc ], [ %1, %entry ]
%right.095 = phi i32 [ %right.1, %for.inc ], [ %0, %entry ]
%bot.094 = phi i32 [ %bot.1, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [110 x i32], ptr %x, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [110 x i32], ptr %y, i64 0, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [110 x i32], ptr %a, i64 0, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx4)
%3 = load i32, ptr %arrayidx4, align 4, !tbaa !5
switch i32 %3, label %for.inc [
i32 1, label %if.then
i32 2, label %if.then18
i32 3, label %if.then30
i32 4, label %if.then42
]
if.then: ; preds = %for.body
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %left.098, i32 %4)
br label %for.inc
if.then18: ; preds = %for.body
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%spec.select90 = call i32 @llvm.smin.i32(i32 %right.095, i32 %5)
br label %for.inc
if.then30: ; preds = %for.body
%6 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%spec.select91 = call i32 @llvm.smax.i32(i32 %bot.094, i32 %6)
br label %for.inc
if.then42: ; preds = %for.body
%7 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%spec.select92 = call i32 @llvm.smin.i32(i32 %top.096, i32 %7)
br label %for.inc
for.inc: ; preds = %if.then42, %if.then30, %if.then18, %if.then, %for.body
%bot.1 = phi i32 [ %bot.094, %if.then ], [ %bot.094, %if.then18 ], [ %spec.select91, %if.then30 ], [ %bot.094, %for.body ], [ %bot.094, %if.then42 ]
%right.1 = phi i32 [ %right.095, %if.then ], [ %spec.select90, %if.then18 ], [ %right.095, %if.then30 ], [ %right.095, %for.body ], [ %right.095, %if.then42 ]
%top.1 = phi i32 [ %top.096, %if.then ], [ %top.096, %if.then18 ], [ %top.096, %if.then30 ], [ %top.096, %for.body ], [ %spec.select92, %if.then42 ]
%left.1 = phi i32 [ %spec.select, %if.then ], [ %left.098, %if.then18 ], [ %left.098, %if.then30 ], [ %left.098, %for.body ], [ %left.098, %if.then42 ]
%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.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%bot.0.lcssa = phi i32 [ 0, %entry ], [ %bot.1, %for.inc ]
%right.0.lcssa = phi i32 [ %0, %entry ], [ %right.1, %for.inc ]
%top.0.lcssa = phi i32 [ %1, %entry ], [ %top.1, %for.inc ]
%left.0.lcssa = phi i32 [ 0, %entry ], [ %left.1, %for.inc ]
%cmp54.not = icmp slt i32 %left.0.lcssa, %right.0.lcssa
%cmp55.not = icmp slt i32 %bot.0.lcssa, %top.0.lcssa
%or.cond = select i1 %cmp54.not, i1 %cmp55.not, i1 false
br i1 %or.cond, label %if.else58, label %if.then56
if.then56: ; preds = %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end61
if.else58: ; preds = %for.end
%sub = sub nsw i32 %top.0.lcssa, %bot.0.lcssa
%sub59 = sub nsw i32 %right.0.lcssa, %left.0.lcssa
%mul = mul nsw i32 %sub59, %sub
%call60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %mul)
br label %if.end61
if.end61: ; preds = %if.else58, %if.then56
call void @llvm.lifetime.end.p0(i64 440, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 440, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 440, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #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 i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
typedef struct {
long long key, id, pref, city;
} data;
void merge_sort(data x[], int n)
{
static data y[200001] = {};
if (n == 1) return;
merge_sort(&(x[0]), n/2);
merge_sort(&(x[n/2]), (n+1)/2);
int i, p, q;
for (i = 0, p = 0, q = n/2; i < n; i++) {
if (p >= n/2) y[i] = x[q++];
else if (q >= n) y[i] = x[p++];
else y[i] = (x[p].key < x[q].key)? x[p++]: x[q++];
}
for (i = 0; i < n; i++) x[i] = y[i];
}
int main()
{
int i, N, M;
long long P[100001], Y[100001];
scanf("%d %d", &N, &M);
for (i = 0; i < M; i++) scanf("%lld %lld", &(P[i]), &(Y[i]));
data X[100001];
for (i = 0; i < M; i++) {
X[i].key = Y[i];
X[i].pref = P[i];
X[i].city = i;
}
merge_sort(X, M);
int p[100001] = {};
for (i = 0; i < M; i++) {
X[i].id = X[i].pref * 1000000 + (++p[X[i].pref]);
X[i].key = X[i].city;
}
merge_sort(X, M);
for (i = 0; i < M; i++) printf("%012lld\n", X[i].id);
fflush(stdout);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140323/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140323/source.c"
target datalayout = "e-m:e-p270: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, i64, i64 }
@merge_sort.y = internal unnamed_addr global [200001 x %struct.data] zeroinitializer, align 16
@.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 [9 x i8] c"%012lld\0A\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge_sort(ptr noundef %x, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %n, 1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%div = sdiv i32 %n, 2
tail call void @merge_sort(ptr noundef %x, i32 noundef %div)
%idxprom = sext i32 %div to i64
%arrayidx2 = getelementptr inbounds %struct.data, ptr %x, i64 %idxprom
%add = add nsw i32 %n, 1
%div3 = sdiv i32 %add, 2
tail call void @merge_sort(ptr noundef %arrayidx2, i32 noundef %div3)
%cmp578 = icmp sgt i32 %n, 0
br i1 %cmp578, label %for.body.preheader, label %return
for.body.preheader: ; preds = %if.end
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond38.preheader: ; preds = %for.inc
br i1 %cmp578, label %for.body40.preheader, label %return
for.body40.preheader: ; preds = %for.cond38.preheader
%0 = zext i32 %n to i64
%1 = shl nuw nsw i64 %0, 5
tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %x, ptr nonnull align 16 @merge_sort.y, i64 %1, i1 false)
br label %return
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%q.081 = phi i32 [ %div, %for.body.preheader ], [ %q.1, %for.inc ]
%p.080 = phi i32 [ 0, %for.body.preheader ], [ %p.1, %for.inc ]
%cmp7.not = icmp slt i32 %p.080, %div
br i1 %cmp7.not, label %if.else, label %if.then8
if.then8: ; preds = %for.body
%arrayidx10 = getelementptr inbounds [200001 x %struct.data], ptr @merge_sort.y, i64 0, i64 %indvars.iv
%inc = add nsw i32 %q.081, 1
%idxprom11 = sext i32 %q.081 to i64
%arrayidx12 = getelementptr inbounds %struct.data, ptr %x, i64 %idxprom11
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %arrayidx10, ptr noundef nonnull align 8 dereferenceable(32) %arrayidx12, i64 32, i1 false), !tbaa.struct !5
br label %for.inc
if.else: ; preds = %for.body
%cmp13.not = icmp slt i32 %q.081, %n
%arrayidx22 = getelementptr inbounds [200001 x %struct.data], ptr @merge_sort.y, i64 0, i64 %indvars.iv
br i1 %cmp13.not, label %if.else20, label %if.then14
if.then14: ; preds = %if.else
%inc17 = add nsw i32 %p.080, 1
%idxprom18 = sext i32 %p.080 to i64
%arrayidx19 = getelementptr inbounds %struct.data, ptr %x, i64 %idxprom18
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %arrayidx22, ptr noundef nonnull align 8 dereferenceable(32) %arrayidx19, i64 32, i1 false), !tbaa.struct !5
br label %for.inc
if.else20: ; preds = %if.else
%idxprom23 = sext i32 %p.080 to i64
%arrayidx24 = getelementptr inbounds %struct.data, ptr %x, i64 %idxprom23
%2 = load i64, ptr %arrayidx24, align 8, !tbaa !10
%idxprom25 = sext i32 %q.081 to i64
%arrayidx26 = getelementptr inbounds %struct.data, ptr %x, i64 %idxprom25
%3 = load i64, ptr %arrayidx26, align 8, !tbaa !10
%cmp28 = icmp slt i64 %2, %3
br i1 %cmp28, label %cond.true, label %cond.false
cond.true: ; preds = %if.else20
%inc29 = add nsw i32 %p.080, 1
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %arrayidx22, ptr noundef nonnull align 8 dereferenceable(32) %arrayidx24, i64 32, i1 false), !tbaa.struct !5
br label %for.inc
cond.false: ; preds = %if.else20
%inc32 = add nsw i32 %q.081, 1
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %arrayidx22, ptr noundef nonnull align 8 dereferenceable(32) %arrayidx26, i64 32, i1 false), !tbaa.struct !5
br label %for.inc
for.inc: ; preds = %if.then8, %cond.true, %cond.false, %if.then14
%p.1 = phi i32 [ %p.080, %if.then8 ], [ %inc17, %if.then14 ], [ %inc29, %cond.true ], [ %p.080, %cond.false ]
%q.1 = phi i32 [ %inc, %if.then8 ], [ %q.081, %if.then14 ], [ %q.081, %cond.true ], [ %inc32, %cond.false ]
%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.cond38.preheader, label %for.body, !llvm.loop !12
return: ; preds = %if.end, %for.body40.preheader, %for.cond38.preheader, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%N = alloca i32, align 4
%M = alloca i32, align 4
%P = alloca [100001 x i64], align 16
%Y = alloca [100001 x i64], align 16
%X = alloca [100001 x %struct.data], align 16
%p = alloca [100001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #6
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %P) #6
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %Y) #6
%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 !14
%cmp80 = icmp sgt i32 %0, 0
br i1 %cmp80, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 3200032, ptr nonnull %X) #6
br label %for.end19
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100001 x i64], ptr %P, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [100001 x i64], ptr %Y, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %M, align 4, !tbaa !14
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !16
for.end: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 3200032, ptr nonnull %X) #6
%cmp582 = icmp sgt i32 %1, 0
br i1 %cmp582, label %for.body6.preheader, label %for.end19
for.body6.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %1 to i64
%xtraiter = and i64 %wide.trip.count, 1
%3 = icmp eq i32 %1, 1
br i1 %3, label %for.end19.loopexit.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body6
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv90 = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next91.1, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ]
%arrayidx8 = getelementptr inbounds [100001 x i64], ptr %Y, i64 0, i64 %indvars.iv90
%4 = load i64, ptr %arrayidx8, align 16, !tbaa !6
%arrayidx10 = getelementptr inbounds [100001 x %struct.data], ptr %X, i64 0, i64 %indvars.iv90
store i64 %4, ptr %arrayidx10, align 16, !tbaa !10
%arrayidx12 = getelementptr inbounds [100001 x i64], ptr %P, i64 0, i64 %indvars.iv90
%5 = load i64, ptr %arrayidx12, align 16, !tbaa !6
%pref = getelementptr inbounds [100001 x %struct.data], ptr %X, i64 0, i64 %indvars.iv90, i32 2
store i64 %5, ptr %pref, align 16, !tbaa !17
%city = getelementptr inbounds [100001 x %struct.data], ptr %X, i64 0, i64 %indvars.iv90, i32 3
store i64 %indvars.iv90, ptr %city, align 8, !tbaa !18
%indvars.iv.next91 = or i64 %indvars.iv90, 1
%arrayidx8.1 = getelementptr inbounds [100001 x i64], ptr %Y, i64 0, i64 %indvars.iv.next91
%6 = load i64, ptr %arrayidx8.1, align 8, !tbaa !6
%arrayidx10.1 = getelementptr inbounds [100001 x %struct.data], ptr %X, i64 0, i64 %indvars.iv.next91
store i64 %6, ptr %arrayidx10.1, align 16, !tbaa !10
%arrayidx12.1 = getelementptr inbounds [100001 x i64], ptr %P, i64 0, i64 %indvars.iv.next91
%7 = load i64, ptr %arrayidx12.1, align 8, !tbaa !6
%pref.1 = getelementptr inbounds [100001 x %struct.data], ptr %X, i64 0, i64 %indvars.iv.next91, i32 2
store i64 %7, ptr %pref.1, align 16, !tbaa !17
%city.1 = getelementptr inbounds [100001 x %struct.data], ptr %X, i64 0, i64 %indvars.iv.next91, i32 3
store i64 %indvars.iv.next91, ptr %city.1, align 8, !tbaa !18
%indvars.iv.next91.1 = add nuw nsw i64 %indvars.iv90, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end19.loopexit.unr-lcssa, label %for.body6, !llvm.loop !19
for.end19.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%indvars.iv90.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next91.1, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end19, label %for.body6.epil
for.body6.epil: ; preds = %for.end19.loopexit.unr-lcssa
%arrayidx8.epil = getelementptr inbounds [100001 x i64], ptr %Y, i64 0, i64 %indvars.iv90.unr
%8 = load i64, ptr %arrayidx8.epil, align 8, !tbaa !6
%arrayidx10.epil = getelementptr inbounds [100001 x %struct.data], ptr %X, i64 0, i64 %indvars.iv90.unr
store i64 %8, ptr %arrayidx10.epil, align 16, !tbaa !10
%arrayidx12.epil = getelementptr inbounds [100001 x i64], ptr %P, i64 0, i64 %indvars.iv90.unr
%9 = load i64, ptr %arrayidx12.epil, align 8, !tbaa !6
%pref.epil = getelementptr inbounds [100001 x %struct.data], ptr %X, i64 0, i64 %indvars.iv90.unr, i32 2
store i64 %9, ptr %pref.epil, align 16, !tbaa !17
%city.epil = getelementptr inbounds [100001 x %struct.data], ptr %X, i64 0, i64 %indvars.iv90.unr, i32 3
store i64 %indvars.iv90.unr, ptr %city.epil, align 8, !tbaa !18
br label %for.end19
for.end19: ; preds = %for.body6.epil, %for.end19.loopexit.unr-lcssa, %for.end.thread, %for.end
%.lcssa79103 = phi i32 [ %0, %for.end.thread ], [ %1, %for.end ], [ %1, %for.end19.loopexit.unr-lcssa ], [ %1, %for.body6.epil ]
call void @merge_sort(ptr noundef nonnull %X, i32 noundef %.lcssa79103)
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %p) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400004) %p, i8 0, i64 400004, i1 false)
%10 = load i32, ptr %M, align 4, !tbaa !14
%cmp2184 = icmp sgt i32 %10, 0
br i1 %cmp2184, label %for.body23.preheader, label %for.end43
for.body23.preheader: ; preds = %for.end19
%wide.trip.count96 = zext i32 %10 to i64
br label %for.body23
for.body23: ; preds = %for.body23.preheader, %for.body23
%indvars.iv93 = phi i64 [ 0, %for.body23.preheader ], [ %indvars.iv.next94, %for.body23 ]
%arrayidx25 = getelementptr inbounds [100001 x %struct.data], ptr %X, i64 0, i64 %indvars.iv93
%pref26 = getelementptr inbounds [100001 x %struct.data], ptr %X, i64 0, i64 %indvars.iv93, i32 2
%11 = load i64, ptr %pref26, align 16, !tbaa !17
%mul = mul nsw i64 %11, 1000000
%arrayidx30 = getelementptr inbounds [100001 x i32], ptr %p, i64 0, i64 %11
%12 = load i32, ptr %arrayidx30, align 4, !tbaa !14
%inc31 = add nsw i32 %12, 1
store i32 %inc31, ptr %arrayidx30, align 4, !tbaa !14
%conv32 = sext i32 %inc31 to i64
%add = add nsw i64 %mul, %conv32
%id = getelementptr inbounds [100001 x %struct.data], ptr %X, i64 0, i64 %indvars.iv93, i32 1
store i64 %add, ptr %id, align 8, !tbaa !20
%city37 = getelementptr inbounds [100001 x %struct.data], ptr %X, i64 0, i64 %indvars.iv93, i32 3
%13 = load i64, ptr %city37, align 8, !tbaa !18
store i64 %13, ptr %arrayidx25, align 16, !tbaa !10
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%exitcond97.not = icmp eq i64 %indvars.iv.next94, %wide.trip.count96
br i1 %exitcond97.not, label %for.end43, label %for.body23, !llvm.loop !21
for.end43: ; preds = %for.body23, %for.end19
call void @merge_sort(ptr noundef nonnull %X, i32 noundef %10)
%14 = load i32, ptr %M, align 4, !tbaa !14
%cmp4687 = icmp sgt i32 %14, 0
br i1 %cmp4687, label %for.body48, label %for.end55
for.body48: ; preds = %for.end43, %for.body48
%indvars.iv98 = phi i64 [ %indvars.iv.next99, %for.body48 ], [ 0, %for.end43 ]
%id51 = getelementptr inbounds [100001 x %struct.data], ptr %X, i64 0, i64 %indvars.iv98, i32 1
%15 = load i64, ptr %id51, align 8, !tbaa !20
%call52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %15)
%indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
%16 = load i32, ptr %M, align 4, !tbaa !14
%17 = sext i32 %16 to i64
%cmp46 = icmp slt i64 %indvars.iv.next99, %17
br i1 %cmp46, label %for.body48, label %for.end55, !llvm.loop !22
for.end55: ; preds = %for.body48, %for.end43
%18 = load ptr, ptr @stdout, align 8, !tbaa !23
%call56 = call i32 @fflush(ptr noundef %18)
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %p) #6
call void @llvm.lifetime.end.p0(i64 3200032, ptr nonnull %X) #6
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %Y) #6
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %P) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #4
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress 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 = !{i64 0, i64 8, !6, i64 8, i64 8, !6, i64 16, i64 8, !6, i64 24, i64 8, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !7, i64 0}
!11 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !8, i64 0}
!16 = distinct !{!16, !13}
!17 = !{!11, !7, i64 16}
!18 = !{!11, !7, i64 24}
!19 = distinct !{!19, !13}
!20 = !{!11, !7, i64 8}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}
!23 = !{!24, !24, i64 0}
!24 = !{!"any pointer", !8, i64 0}
|
#include<stdio.h>
#include<stdlib.h>
struct city{
int num,pref,year;
char nums[13];
};
int comp1(const void *p1,const void *p2){
struct city n1=*(const struct city *)p1;
struct city n2=*(const struct city *)p2;
return (n1.pref!=n2.pref) ? (n1.pref-n2.pref) : (n1.year-n2.year) ;
}
int comp2(const void *p1,const void *p2){
struct city n1=*(const struct city *)p1;
struct city n2=*(const struct city *)p2;
return n1.num-n2.num;
}
int main(void){
int N,M;
int i,j,k=1;
scanf("%d%d",&N,&M);
struct city *cities;
cities=(struct city *)calloc(M,sizeof(struct city));
for(i=0;i<M;i++){
cities[i].num=i;
scanf("%d%d",&cities[i].pref,&cities[i].year);
}
qsort(cities,M,sizeof(struct city),comp1);
int p;
for(i=0,p=-1;i<M;i++){
if(p!=cities[i].pref){
p=cities[i].pref;
k=1;
}
sprintf(cities[i].nums,"%06d%06d",cities[i].pref,k);
++k;
}
qsort(cities,M,sizeof(struct city),comp2);
for(i=0;i<M;i++) printf("%s\n",cities[i].nums);
free(cities);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140374/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140374/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.city = type { i32, i32, i32, [13 x i8] }
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%06d%06d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comp1(ptr nocapture noundef readonly %p1, ptr nocapture noundef readonly %p2) #0 {
entry:
%n1.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %p1, i64 4
%n1.sroa.3.0.copyload = load i32, ptr %n1.sroa.3.0..sroa_idx, align 4, !tbaa.struct !5
%n2.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %p2, i64 4
%n2.sroa.3.0.copyload = load i32, ptr %n2.sroa.3.0..sroa_idx, align 4, !tbaa.struct !5
%cmp.not = icmp eq i32 %n1.sroa.3.0.copyload, %n2.sroa.3.0.copyload
br i1 %cmp.not, label %cond.false, label %cond.true
cond.true: ; preds = %entry
%sub = sub nsw i32 %n1.sroa.3.0.copyload, %n2.sroa.3.0.copyload
br label %cond.end
cond.false: ; preds = %entry
%n2.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %p2, i64 8
%n2.sroa.5.0.copyload = load i32, ptr %n2.sroa.5.0..sroa_idx, align 4, !tbaa.struct !11
%n1.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %p1, i64 8
%n1.sroa.5.0.copyload = load i32, ptr %n1.sroa.5.0..sroa_idx, align 4, !tbaa.struct !11
%sub5 = sub nsw i32 %n1.sroa.5.0.copyload, %n2.sroa.5.0.copyload
br label %cond.end
cond.end: ; preds = %cond.false, %cond.true
%cond = phi i32 [ %sub, %cond.true ], [ %sub5, %cond.false ]
ret i32 %cond
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comp2(ptr nocapture noundef readonly %p1, ptr nocapture noundef readonly %p2) #0 {
entry:
%n1.sroa.0.0.copyload = load i32, ptr %p1, align 4, !tbaa.struct !12
%n2.sroa.0.0.copyload = load i32, ptr %p2, align 4, !tbaa.struct !12
%sub = sub nsw i32 %n1.sroa.0.0.copyload, %n2.sroa.0.0.copyload
ret i32 %sub
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%N = alloca i32, align 4
%M = 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 = 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 !6
%conv = sext i32 %0 to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 28) #9
%cmp73 = icmp sgt i32 %0, 0
br i1 %cmp73, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.city, ptr %call1, i64 %indvars.iv
%1 = trunc i64 %indvars.iv to i32
store i32 %1, ptr %arrayidx, align 4, !tbaa !13
%pref = getelementptr inbounds %struct.city, ptr %call1, i64 %indvars.iv, i32 1
%year = getelementptr inbounds %struct.city, ptr %call1, i64 %indvars.iv, i32 2
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %pref, ptr noundef nonnull %year)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %M, align 4, !tbaa !6
%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 !15
for.end: ; preds = %for.body, %entry
%conv8.pre-phi = phi i64 [ %conv, %entry ], [ %3, %for.body ]
call void @qsort(ptr noundef %call1, i64 noundef %conv8.pre-phi, i64 noundef 28, ptr noundef nonnull @comp1) #8
%4 = load i32, ptr %M, align 4, !tbaa !6
%cmp1075 = icmp sgt i32 %4, 0
br i1 %cmp1075, label %for.body12, label %for.end.for.end30_crit_edge
for.end.for.end30_crit_edge: ; preds = %for.end
%.pre = sext i32 %4 to i64
br label %for.end30
for.body12: ; preds = %for.end, %for.body12
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.body12 ], [ 0, %for.end ]
%p.078 = phi i32 [ %5, %for.body12 ], [ -1, %for.end ]
%k.076 = phi i32 [ %inc27, %for.body12 ], [ 1, %for.end ]
%pref15 = getelementptr inbounds %struct.city, ptr %call1, i64 %indvars.iv85, i32 1
%5 = load i32, ptr %pref15, align 4, !tbaa !17
%cmp16.not = icmp eq i32 %p.078, %5
%spec.select = select i1 %cmp16.not, i32 %k.076, i32 1
%nums = getelementptr inbounds %struct.city, ptr %call1, i64 %indvars.iv85, i32 3
%call26 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %nums, ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %spec.select) #8
%inc27 = add nsw i32 %spec.select, 1
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%6 = load i32, ptr %M, align 4, !tbaa !6
%7 = sext i32 %6 to i64
%cmp10 = icmp slt i64 %indvars.iv.next86, %7
br i1 %cmp10, label %for.body12, label %for.end30, !llvm.loop !18
for.end30: ; preds = %for.body12, %for.end.for.end30_crit_edge
%conv31.pre-phi = phi i64 [ %.pre, %for.end.for.end30_crit_edge ], [ %7, %for.body12 ]
call void @qsort(ptr noundef %call1, i64 noundef %conv31.pre-phi, i64 noundef 28, ptr noundef nonnull @comp2) #8
%8 = load i32, ptr %M, align 4, !tbaa !6
%cmp3380 = icmp sgt i32 %8, 0
br i1 %cmp3380, label %for.body35, label %for.end43
for.body35: ; preds = %for.end30, %for.body35
%indvars.iv88 = phi i64 [ %indvars.iv.next89, %for.body35 ], [ 0, %for.end30 ]
%nums38 = getelementptr inbounds %struct.city, ptr %call1, i64 %indvars.iv88, i32 3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %nums38)
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%9 = load i32, ptr %M, align 4, !tbaa !6
%10 = sext i32 %9 to i64
%cmp33 = icmp slt i64 %indvars.iv.next89, %10
br i1 %cmp33, label %for.body35, label %for.end43, !llvm.loop !19
for.end43: ; preds = %for.body35, %for.end30
call void @free(ptr noundef %call1) #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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #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 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-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,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { 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 #7 = { nofree nounwind }
attributes #8 = { nounwind }
attributes #9 = { nounwind allocsize(0,1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{i64 0, i64 4, !6, i64 4, i64 4, !6, i64 8, i64 13, !10}
!6 = !{!7, !7, i64 0}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!8, !8, i64 0}
!11 = !{i64 0, i64 4, !6, i64 4, i64 13, !10}
!12 = !{i64 0, i64 4, !6, i64 4, i64 4, !6, i64 8, i64 4, !6, i64 12, i64 13, !10}
!13 = !{!14, !7, i64 0}
!14 = !{!"city", !7, i64 0, !7, i64 4, !7, i64 8, !8, i64 12}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!14, !7, i64 4}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}
|
#include <stdio.h>
int main()
{
int n, q, x, ans = 0;
int S[10001];
int T[500];
scanf("%d", &n);
for(int i = 0; i < n; ++i) { scanf("%d", &S[i]); }
scanf("%d", &q);
for(int i = 0; i < q; ++i) { scanf("%d", &T[i]); }
for(int i = 0; i < q; ++i)
{
// 番兵設定
S[n] = T[i];
// 線形探索
x = 0;
while(S[x] != T[i])
{
++x;
}
// 番兵でなければカウント
if(x != n)
{
++ans;
}
}
printf("%d\n", ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140417/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140417/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%S = alloca [10001 x i32], align 16
%T = alloca [500 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %T) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp45 = icmp sgt i32 %0, 0
br i1 %cmp45, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%1 = load i32, ptr %q, align 4, !tbaa !5
%cmp547 = icmp sgt i32 %1, 0
br i1 %cmp547, label %for.body7, label %for.cond.cleanup17
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond15.preheader: ; preds = %for.body7
%cmp1649 = icmp sgt i32 %6, 0
br i1 %cmp1649, label %for.body18.lr.ph, label %for.cond.cleanup17
for.body18.lr.ph: ; preds = %for.cond15.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%idxprom21 = sext i32 %4 to i64
%arrayidx22 = getelementptr inbounds [10001 x i32], ptr %S, i64 0, i64 %idxprom21
%wide.trip.count = zext i32 %6 to i64
%xtraiter = and i64 %wide.trip.count, 1
%5 = icmp eq i32 %6, 1
br i1 %5, label %for.cond.cleanup17.loopexit.unr-lcssa, label %for.body18.lr.ph.new
for.body18.lr.ph.new: ; preds = %for.body18.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body18
for.body7: ; preds = %for.cond.cleanup, %for.body7
%indvars.iv55 = phi i64 [ %indvars.iv.next56, %for.body7 ], [ 0, %for.cond.cleanup ]
%arrayidx9 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv55
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx9)
%indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
%6 = load i32, ptr %q, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp5 = icmp slt i64 %indvars.iv.next56, %7
br i1 %cmp5, label %for.body7, label %for.cond15.preheader, !llvm.loop !11
for.cond.cleanup17.loopexit.unr-lcssa: ; preds = %while.end.1, %for.body18.lr.ph
%spec.select.lcssa.ph = phi i32 [ undef, %for.body18.lr.ph ], [ %spec.select.1, %while.end.1 ]
%indvars.iv61.unr = phi i64 [ 0, %for.body18.lr.ph ], [ %indvars.iv.next62.1, %while.end.1 ]
%ans.050.unr = phi i32 [ 0, %for.body18.lr.ph ], [ %spec.select.1, %while.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup17, label %for.body18.epil
for.body18.epil: ; preds = %for.cond.cleanup17.loopexit.unr-lcssa
%arrayidx20.epil = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv61.unr
%8 = load i32, ptr %arrayidx20.epil, align 4, !tbaa !5
store i32 %8, ptr %arrayidx22, align 4, !tbaa !5
br label %while.cond.epil
while.cond.epil: ; preds = %while.cond.epil, %for.body18.epil
%indvars.iv58.epil = phi i64 [ %indvars.iv.next59.epil, %while.cond.epil ], [ 0, %for.body18.epil ]
%arrayidx24.epil = getelementptr inbounds [10001 x i32], ptr %S, i64 0, i64 %indvars.iv58.epil
%9 = load i32, ptr %arrayidx24.epil, align 4, !tbaa !5
%cmp27.not.epil = icmp eq i32 %9, %8
%indvars.iv.next59.epil = add nuw i64 %indvars.iv58.epil, 1
br i1 %cmp27.not.epil, label %while.end.epil, label %while.cond.epil, !llvm.loop !12
while.end.epil: ; preds = %while.cond.epil
%10 = trunc i64 %indvars.iv58.epil to i32
%cmp29.not.epil = icmp ne i32 %4, %10
%inc30.epil = zext i1 %cmp29.not.epil to i32
%spec.select.epil = add nuw nsw i32 %ans.050.unr, %inc30.epil
br label %for.cond.cleanup17
for.cond.cleanup17: ; preds = %while.end.epil, %for.cond.cleanup17.loopexit.unr-lcssa, %for.cond.cleanup, %for.cond15.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond15.preheader ], [ 0, %for.cond.cleanup ], [ %spec.select.lcssa.ph, %for.cond.cleanup17.loopexit.unr-lcssa ], [ %spec.select.epil, %while.end.epil ]
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %S) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
for.body18: ; preds = %while.end.1, %for.body18.lr.ph.new
%indvars.iv61 = phi i64 [ 0, %for.body18.lr.ph.new ], [ %indvars.iv.next62.1, %while.end.1 ]
%ans.050 = phi i32 [ 0, %for.body18.lr.ph.new ], [ %spec.select.1, %while.end.1 ]
%niter = phi i64 [ 0, %for.body18.lr.ph.new ], [ %niter.next.1, %while.end.1 ]
%arrayidx20 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv61
%11 = load i32, ptr %arrayidx20, align 8, !tbaa !5
store i32 %11, ptr %arrayidx22, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %for.body18
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %while.cond ], [ 0, %for.body18 ]
%arrayidx24 = getelementptr inbounds [10001 x i32], ptr %S, i64 0, i64 %indvars.iv58
%12 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%cmp27.not = icmp eq i32 %12, %11
%indvars.iv.next59 = add nuw i64 %indvars.iv58, 1
br i1 %cmp27.not, label %while.end, label %while.cond, !llvm.loop !12
while.end: ; preds = %while.cond
%13 = trunc i64 %indvars.iv58 to i32
%cmp29.not = icmp ne i32 %4, %13
%inc30 = zext i1 %cmp29.not to i32
%spec.select = add nuw nsw i32 %ans.050, %inc30
%indvars.iv.next62 = or i64 %indvars.iv61, 1
%arrayidx20.1 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv.next62
%14 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5
store i32 %14, ptr %arrayidx22, align 4, !tbaa !5
br label %while.cond.1
while.cond.1: ; preds = %while.cond.1, %while.end
%indvars.iv58.1 = phi i64 [ %indvars.iv.next59.1, %while.cond.1 ], [ 0, %while.end ]
%arrayidx24.1 = getelementptr inbounds [10001 x i32], ptr %S, i64 0, i64 %indvars.iv58.1
%15 = load i32, ptr %arrayidx24.1, align 4, !tbaa !5
%cmp27.not.1 = icmp eq i32 %15, %14
%indvars.iv.next59.1 = add nuw i64 %indvars.iv58.1, 1
br i1 %cmp27.not.1, label %while.end.1, label %while.cond.1, !llvm.loop !12
while.end.1: ; preds = %while.cond.1
%16 = trunc i64 %indvars.iv58.1 to i32
%cmp29.not.1 = icmp ne i32 %4, %16
%inc30.1 = zext i1 %cmp29.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc30.1
%indvars.iv.next62.1 = add nuw nsw i64 %indvars.iv61, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup17.loopexit.unr-lcssa, label %for.body18, !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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main()
{
int n, q, t[1000000], s[1000000];
int count = 0, i, j;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &s[i]);
}
scanf("%d", &q);
for(i = 0; i < q; i++){
scanf("%d", &t[i]);
}
for(i = 0; i < q; i++){
for(j = 0; j < n; j++){
if(t[i] == s[j]){
count++;
break;
}
}
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140460/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140460/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%t = alloca [1000000 x i32], align 16
%s = alloca [1000000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000000 x i32], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp444 = icmp sgt i32 %3, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %10, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1646 = icmp sgt i32 %4, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%count.049.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %count.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx19.us = getelementptr inbounds [1000000 x i32], ptr %t, i64 0, i64 %indvars.iv62
%6 = load i32, ptr %arrayidx19.us, align 8, !tbaa !5
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !11
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx21.us = getelementptr inbounds [1000000 x i32], ptr %s, i64 0, i64 %indvars.iv59
%7 = load i32, ptr %arrayidx21.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %6, %7
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %count.049.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%count.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %count.049.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx19.us.1 = getelementptr inbounds [1000000 x i32], ptr %t, i64 0, i64 %indvars.iv.next63
%8 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !5
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx21.us.1 = getelementptr inbounds [1000000 x i32], ptr %s, i64 0, i64 %indvars.iv59.1
%9 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !5
%cmp22.us.1 = icmp eq i32 %8, %9
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %count.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%count.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %count.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [1000000 x i32], ptr %t, i64 0, i64 %indvars.iv56
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%10 = load i32, ptr %q, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%count.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %count.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%count.049.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %count.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx19.us.epil = getelementptr inbounds [1000000 x i32], ptr %t, i64 0, i64 %indvars.iv62.unr
%12 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !5
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx21.us.epil = getelementptr inbounds [1000000 x i32], ptr %s, i64 0, i64 %indvars.iv59.epil
%13 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp eq i32 %12, %13
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %count.049.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %count.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %count.049.us.unr, %for.cond15.us.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(){
int i, j, k, n, q, S[100000], T[100000];
k = 0;
scanf("%d", &n);
for(i = 0; i < n; i++) scanf("%d", &S[i]);
scanf("%d", &q);
for(i = 0; i < q; i++) scanf("%d", &T[i]);
for(i = 0; i < q; i++){
for(j = 0; j < n; j++){
if(T[i] == S[j]){
k++;
break;
}
}
}
printf("%d\n", k);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140518/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140518/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%S = alloca [100000 x i32], align 16
%T = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %T) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp444 = icmp sgt i32 %3, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %10, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1646 = icmp sgt i32 %4, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%k.051.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %k.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx19.us = getelementptr inbounds [100000 x i32], ptr %T, i64 0, i64 %indvars.iv62
%6 = load i32, ptr %arrayidx19.us, align 8, !tbaa !5
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !11
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx21.us = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv59
%7 = load i32, ptr %arrayidx21.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %6, %7
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %k.051.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%k.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %k.051.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx19.us.1 = getelementptr inbounds [100000 x i32], ptr %T, i64 0, i64 %indvars.iv.next63
%8 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !5
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx21.us.1 = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv59.1
%9 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !5
%cmp22.us.1 = icmp eq i32 %8, %9
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %k.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%k.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %k.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [100000 x i32], ptr %T, i64 0, i64 %indvars.iv56
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%10 = load i32, ptr %q, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%k.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %k.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%k.051.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %k.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx19.us.epil = getelementptr inbounds [100000 x i32], ptr %T, i64 0, i64 %indvars.iv62.unr
%12 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !5
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx21.us.epil = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv59.epil
%13 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp eq i32 %12, %13
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %k.051.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%k.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %k.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %k.051.us.unr, %for.cond15.us.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %k.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#include<stdlib.h>
int main(){
int i,j,nS,nT,q,count;
int S[10000];
scanf("%d",&nS);
for(i=0;i<nS;i++){
scanf("%d",&S[i]);
}
scanf("%d",&nT);
count = 0;
for(i=0;i<nT;i++){
scanf("%d",&q);
j = 0;
while(S[j] != q && j<nS){
j++;
}
if( S[j] == q){
count++;
}
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140569/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140569/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%nS = alloca i32, align 4
%nT = alloca i32, align 4
%q = alloca i32, align 4
%S = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %nS) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %nT) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %nS)
%0 = load i32, ptr %nS, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %0, 0
br i1 %cmp29, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %nS, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %nT)
%3 = load i32, ptr %nT, align 4, !tbaa !5
%cmp431 = icmp sgt i32 %3, 0
br i1 %cmp431, label %for.body5, label %for.end18
for.body5: ; preds = %for.end, %while.end
%count.033 = phi i32 [ %spec.select, %while.end ], [ 0, %for.end ]
%i.132 = phi i32 [ %inc17, %while.end ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%4 = load i32, ptr %q, align 4, !tbaa !5
%5 = load i32, ptr %nS, align 4
%6 = sext i32 %5 to i64
br label %while.cond
while.cond: ; preds = %while.cond, %for.body5
%indvars.iv35 = phi i64 [ %indvars.iv.next36, %while.cond ], [ 0, %for.body5 ]
%arrayidx8 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv35
%7 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9 = icmp ne i32 %7, %4
%cmp10 = icmp slt i64 %indvars.iv35, %6
%8 = select i1 %cmp9, i1 %cmp10, i1 false
%indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
br i1 %8, label %while.cond, label %while.end, !llvm.loop !11
while.end: ; preds = %while.cond
%cmp14 = icmp eq i32 %7, %4
%inc15 = zext i1 %cmp14 to i32
%spec.select = add nuw nsw i32 %count.033, %inc15
%inc17 = add nuw nsw i32 %i.132, 1
%9 = load i32, ptr %nT, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc17, %9
br i1 %cmp4, label %for.body5, label %for.end18, !llvm.loop !12
for.end18: ; preds = %while.end, %for.end
%count.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %while.end ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %nT) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %nS) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#define N 100001
#define Q 1000
int linear(int);
int n;
int S[N];
int main(){
int q, i, c=0, flag;
int T[Q]={};
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%d",&S[i]);
}
scanf("%d",&q);
for(i=0; i<q; i++){
scanf("%d",&T[i]);
}
for(i=0; i<q; i++){
flag = linear(T[i]);
if(flag == 1){
c++;
}
}
printf("%d\n",c);
return 0;
}
int linear(int key){
int i=0;
S[n]=key;
while(S[i] != key){
i++;
if(i == n){
return 0;
}
}
return 1;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140611/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140611/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@S = dso_local global [100001 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%q = alloca i32, align 4
%T = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %T) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000) %T, i8 0, i64 4000, i1 false)
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp36 = icmp sgt i32 %0, 0
br i1 %cmp36, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100001 x i32], ptr @S, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp438 = icmp sgt i32 %3, 0
br i1 %cmp438, label %for.body5, label %for.end22
for.cond12.preheader: ; preds = %for.body5
%cmp1340 = icmp sgt i32 %6, 0
br i1 %cmp1340, label %for.body14.lr.ph, label %for.end22
for.body14.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr @n, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100001 x i32], ptr @S, i64 0, i64 %idxprom.i
%5 = zext i32 %4 to i64
%wide.trip.count = zext i32 %6 to i64
br label %for.body14
for.body5: ; preds = %for.end, %for.body5
%indvars.iv47 = phi i64 [ %indvars.iv.next48, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [1000 x i32], ptr %T, i64 0, i64 %indvars.iv47
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
%6 = load i32, ptr %q, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp4 = icmp slt i64 %indvars.iv.next48, %7
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !11
for.body14: ; preds = %for.body14.lr.ph, %for.cond12
%indvars.iv50 = phi i64 [ 0, %for.body14.lr.ph ], [ %indvars.iv.next51, %for.cond12 ]
%c.041 = phi i32 [ 0, %for.body14.lr.ph ], [ %10, %for.cond12 ]
%arrayidx16 = getelementptr inbounds [1000 x i32], ptr %T, i64 0, i64 %indvars.iv50
%8 = load i32, ptr %arrayidx16, align 4, !tbaa !5
store i32 %8, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.body.i, %for.body14
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.body.i ], [ 0, %for.body14 ]
%arrayidx2.i = getelementptr inbounds [100001 x i32], ptr @S, i64 0, i64 %indvars.iv.i
%9 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %9, %8
br i1 %cmp.not.i, label %linear.exit, label %while.body.i
while.body.i: ; preds = %while.cond.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%cmp3.i = icmp eq i64 %indvars.iv.next.i, %5
br i1 %cmp3.i, label %for.cond12, label %while.cond.i, !llvm.loop !12
linear.exit: ; preds = %while.cond.i
%inc19 = add nsw i32 %c.041, 1
br label %for.cond12
for.cond12: ; preds = %while.body.i, %linear.exit
%10 = phi i32 [ %inc19, %linear.exit ], [ %c.041, %while.body.i ]
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count
br i1 %exitcond.not, label %for.end22, label %for.body14, !llvm.loop !13
for.end22: ; preds = %for.cond12, %for.end, %for.cond12.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.end ], [ %10, %for.cond12 ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %T) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @linear(i32 noundef %key) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100001 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
%1 = zext i32 %0 to i64
br label %while.cond
while.cond: ; preds = %while.body, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds [100001 x i32], ptr @S, i64 0, i64 %indvars.iv
%2 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %2, %key
br i1 %cmp.not, label %cleanup, label %while.body
while.body: ; preds = %while.cond
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%cmp3 = icmp eq i64 %indvars.iv.next, %1
br i1 %cmp3, label %cleanup, label %while.cond, !llvm.loop !12
cleanup: ; preds = %while.cond, %while.body
%retval.0 = phi i32 [ 0, %while.body ], [ 1, %while.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { 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 #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 Max 10000
int main()
{
int i,j,h,n,q,S[Max],T[Max];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&S[i]);
scanf("%d",&q);
for(i=0;i<q;i++)
scanf("%d",&T[i]);
h=0;
for(i=0;i<q;i++)
{
S[n]=T[i];
for(j=0;j<=n;j++)
{
if(j==n) break;
else if(S[j]==T[i]){
h++;
break;
}
}
}
printf("%d\n",h);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140655/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140655/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%S = alloca [10000 x i32], align 16
%T = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %T) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp51 = icmp sgt i32 %0, 0
br i1 %cmp51, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp453 = icmp sgt i32 %3, 0
br i1 %cmp453, label %for.body5, label %for.end36
for.cond12.preheader: ; preds = %for.body5
%cmp1357 = icmp sgt i32 %9, 0
br i1 %cmp1357, label %for.body14.lr.ph, label %for.end36
for.body14.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%idxprom17 = sext i32 %4 to i64
%arrayidx18 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %idxprom17
%or.cond.not55 = icmp sgt i32 %4, 0
br i1 %or.cond.not55, label %for.body14.us.preheader, label %for.body14.preheader
for.body14.preheader: ; preds = %for.body14.lr.ph
%5 = add nsw i32 %9, -1
%idxprom15.le = zext i32 %5 to i64
%arrayidx16.le = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %idxprom15.le
%6 = load i32, ptr %arrayidx16.le, align 4, !tbaa !5
store i32 %6, ptr %arrayidx18, align 4, !tbaa !5
br label %for.end36
for.body14.us.preheader: ; preds = %for.body14.lr.ph
%wide.trip.count73 = zext i32 %9 to i64
%wide.trip.count = zext i32 %4 to i64
br label %for.body14.us
for.body14.us: ; preds = %for.body14.us.preheader, %for.inc34.us
%indvars.iv70 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next71, %for.inc34.us ]
%h.059.us = phi i32 [ 0, %for.body14.us.preheader ], [ %h.1.us, %for.inc34.us ]
%arrayidx16.us = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %indvars.iv70
%7 = load i32, ptr %arrayidx16.us, align 4, !tbaa !5
store i32 %7, ptr %arrayidx18, align 4, !tbaa !5
br label %if.else.us
for.cond19.us: ; preds = %if.else.us
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
%exitcond.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count
br i1 %exitcond.not, label %for.inc34.us, label %if.else.us, !llvm.loop !11
if.else.us: ; preds = %for.body14.us, %for.cond19.us
%indvars.iv67 = phi i64 [ 0, %for.body14.us ], [ %indvars.iv.next68, %for.cond19.us ]
%arrayidx24.us = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv67
%8 = load i32, ptr %arrayidx24.us, align 4, !tbaa !5
%cmp27.us = icmp eq i32 %8, %7
br i1 %cmp27.us, label %if.then28.us, label %for.cond19.us
if.then28.us: ; preds = %if.else.us
%inc29.us = add nsw i32 %h.059.us, 1
br label %for.inc34.us
for.inc34.us: ; preds = %for.cond19.us, %if.then28.us
%h.1.us = phi i32 [ %inc29.us, %if.then28.us ], [ %h.059.us, %for.cond19.us ]
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
%exitcond74.not = icmp eq i64 %indvars.iv.next71, %wide.trip.count73
br i1 %exitcond74.not, label %for.end36, label %for.body14.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv64 = phi i64 [ %indvars.iv.next65, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [10000 x i32], ptr %T, i64 0, i64 %indvars.iv64
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
%9 = load i32, ptr %q, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp4 = icmp slt i64 %indvars.iv.next65, %10
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end36: ; preds = %for.inc34.us, %for.end, %for.body14.preheader, %for.cond12.preheader
%h.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.preheader ], [ 0, %for.end ], [ %h.1.us, %for.inc34.us ]
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %h.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int linearSearch(int, int, int*);
int main() {
int n, q, i, count = 0;
int s[10001], t;
scanf("%d",&n);
for(i = 0;i < n;i++) scanf("%d",&s[i]);
scanf("%d",&q);
for(i = 0;i < q;i++) {
scanf("%d",&t);
count += linearSearch(n,t,s);
}
printf("%d\n",count);
return 0;
}
int linearSearch(int n, int key, int s[]) {
int i = 0;
s[n] = key;
while(s[i] != key) {
i++;
}
if(i != n) return 1;
else return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140699/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140699/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%s = alloca [10001 x i32], align 16
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 x i32], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp419 = icmp sgt i32 %3, 0
br i1 %cmp419, label %for.body5, label %for.end10
for.body5: ; preds = %for.end, %linearSearch.exit
%count.021 = phi i32 [ %add, %linearSearch.exit ], [ 0, %for.end ]
%i.120 = phi i32 [ %inc9, %linearSearch.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %t, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %s, i64 %idxprom.i
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %for.body5
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %for.body5 ]
%arrayidx2.i = getelementptr inbounds i32, ptr %s, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %6, %5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %linearSearch.exit, label %while.cond.i, !llvm.loop !11
linearSearch.exit: ; preds = %while.cond.i
%7 = trunc i64 %indvars.iv.i to i32
%cmp3.not.i = icmp ne i32 %4, %7
%..i = zext i1 %cmp3.not.i to i32
%add = add nuw nsw i32 %count.021, %..i
%inc9 = add nuw nsw i32 %i.120, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc9, %8
br i1 %cmp4, label %for.body5, label %for.end10, !llvm.loop !12
for.end10: ; preds = %linearSearch.exit, %for.end
%count.0.lcssa = phi i32 [ 0, %for.end ], [ %add, %linearSearch.exit ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @linearSearch(i32 noundef %n, i32 noundef %key, ptr nocapture noundef %s) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds i32, ptr %s, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %s, i64 %indvars.iv
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %key
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !11
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
%cmp3.not = icmp ne i32 %1, %n
%. = zext i1 %cmp3.not to i32
ret i32 %.
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#define n 5
int main() {
int includeNumber[10000] = { 0 };
int searchNumber[500] = { 0 };
int needIN, needSN;
int count;
int i, j;
count = 0;
scanf("%d", &needIN);
for (i = 0; i < needIN; i++) {
scanf("%d", &includeNumber[i]);
}
scanf("%d", &needSN);
for (i = 0; i < needSN; i++) {
scanf("%d", &searchNumber[i]);
}
for (i = 0; i < needIN; i++) {
for (j = 0; j < needSN; j++) {
if (includeNumber[i] == searchNumber[j]) {
searchNumber[j] = -1;
count++;
}
}
}
printf("%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140749/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140749/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%includeNumber = alloca [10000 x i32], align 16
%searchNumber = alloca [500 x i32], align 16
%needIN = alloca i32, align 4
%needSN = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %includeNumber) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40000) %includeNumber, i8 0, i64 40000, i1 false)
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %searchNumber) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2000) %searchNumber, i8 0, i64 2000, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %needIN) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %needSN) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %needIN)
%0 = load i32, ptr %needIN, align 4, !tbaa !5
%cmp45 = icmp sgt i32 %0, 0
br i1 %cmp45, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %includeNumber, 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 %needIN, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %needSN)
%3 = load i32, ptr %needSN, align 4, !tbaa !5
%cmp447 = icmp sgt i32 %3, 0
br i1 %cmp447, label %for.body5, label %for.cond12.preheader
for.cond12.preheader: ; preds = %for.body5, %for.end
%.lcssa = phi i32 [ %3, %for.end ], [ %39, %for.body5 ]
%4 = load i32, ptr %needIN, align 4, !tbaa !5
%cmp1353 = icmp sgt i32 %4, 0
%cmp1649 = icmp sgt i32 %.lcssa, 0
%or.cond = and i1 %cmp1353, %cmp1649
br i1 %or.cond, label %for.cond15.preheader.us.preheader, label %for.end31
for.cond15.preheader.us.preheader: ; preds = %for.cond12.preheader
%wide.trip.count69 = zext i32 %4 to i64
%wide.trip.count = zext i32 %.lcssa to i64
%min.iters.check = icmp ult i32 %.lcssa, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.cond15.preheader.us.preheader, %for.cond15.for.inc29_crit_edge.us
%indvars.iv66 = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next67, %for.cond15.for.inc29_crit_edge.us ]
%count.054.us = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %count.2.us.lcssa, %for.cond15.for.inc29_crit_edge.us ]
%arrayidx19.us = getelementptr inbounds [10000 x i32], ptr %includeNumber, i64 0, i64 %indvars.iv66
%5 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
br i1 %min.iters.check, label %for.body17.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond15.preheader.us
%6 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.054.us, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %5, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %pred.store.continue88, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue88 ]
%vec.phi = phi <4 x i32> [ %6, %vector.ph ], [ %predphi, %pred.store.continue88 ]
%vec.phi73 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi89, %pred.store.continue88 ]
%7 = or i64 %index, 4
%8 = getelementptr inbounds [500 x i32], ptr %searchNumber, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load74 = load <4 x i32>, ptr %9, align 16, !tbaa !5
%10 = icmp eq <4 x i32> %broadcast.splat, %wide.load
%11 = icmp eq <4 x i32> %broadcast.splat, %wide.load74
%12 = extractelement <4 x i1> %10, i64 0
br i1 %12, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body
%13 = getelementptr inbounds [500 x i32], ptr %searchNumber, i64 0, i64 %index
store i32 -1, ptr %13, align 16, !tbaa !5
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body
%14 = extractelement <4 x i1> %10, i64 1
br i1 %14, label %pred.store.if75, label %pred.store.continue76
pred.store.if75: ; preds = %pred.store.continue
%15 = or i64 %index, 1
%16 = getelementptr inbounds [500 x i32], ptr %searchNumber, i64 0, i64 %15
store i32 -1, ptr %16, align 4, !tbaa !5
br label %pred.store.continue76
pred.store.continue76: ; preds = %pred.store.if75, %pred.store.continue
%17 = extractelement <4 x i1> %10, i64 2
br i1 %17, label %pred.store.if77, label %pred.store.continue78
pred.store.if77: ; preds = %pred.store.continue76
%18 = or i64 %index, 2
%19 = getelementptr inbounds [500 x i32], ptr %searchNumber, i64 0, i64 %18
store i32 -1, ptr %19, align 8, !tbaa !5
br label %pred.store.continue78
pred.store.continue78: ; preds = %pred.store.if77, %pred.store.continue76
%20 = extractelement <4 x i1> %10, i64 3
br i1 %20, label %pred.store.if79, label %pred.store.continue80
pred.store.if79: ; preds = %pred.store.continue78
%21 = or i64 %index, 3
%22 = getelementptr inbounds [500 x i32], ptr %searchNumber, i64 0, i64 %21
store i32 -1, ptr %22, align 4, !tbaa !5
br label %pred.store.continue80
pred.store.continue80: ; preds = %pred.store.if79, %pred.store.continue78
%23 = extractelement <4 x i1> %11, i64 0
br i1 %23, label %pred.store.if81, label %pred.store.continue82
pred.store.if81: ; preds = %pred.store.continue80
%24 = getelementptr inbounds [500 x i32], ptr %searchNumber, i64 0, i64 %7
store i32 -1, ptr %24, align 16, !tbaa !5
br label %pred.store.continue82
pred.store.continue82: ; preds = %pred.store.if81, %pred.store.continue80
%25 = extractelement <4 x i1> %11, i64 1
br i1 %25, label %pred.store.if83, label %pred.store.continue84
pred.store.if83: ; preds = %pred.store.continue82
%26 = or i64 %index, 5
%27 = getelementptr inbounds [500 x i32], ptr %searchNumber, i64 0, i64 %26
store i32 -1, ptr %27, align 4, !tbaa !5
br label %pred.store.continue84
pred.store.continue84: ; preds = %pred.store.if83, %pred.store.continue82
%28 = extractelement <4 x i1> %11, i64 2
br i1 %28, label %pred.store.if85, label %pred.store.continue86
pred.store.if85: ; preds = %pred.store.continue84
%29 = or i64 %index, 6
%30 = getelementptr inbounds [500 x i32], ptr %searchNumber, i64 0, i64 %29
store i32 -1, ptr %30, align 8, !tbaa !5
br label %pred.store.continue86
pred.store.continue86: ; preds = %pred.store.if85, %pred.store.continue84
%31 = extractelement <4 x i1> %11, i64 3
br i1 %31, label %pred.store.if87, label %pred.store.continue88
pred.store.if87: ; preds = %pred.store.continue86
%32 = or i64 %index, 7
%33 = getelementptr inbounds [500 x i32], ptr %searchNumber, i64 0, i64 %32
store i32 -1, ptr %33, align 4, !tbaa !5
br label %pred.store.continue88
pred.store.continue88: ; preds = %pred.store.if87, %pred.store.continue86
%34 = zext <4 x i1> %10 to <4 x i32>
%predphi = add <4 x i32> %vec.phi, %34
%35 = zext <4 x i1> %11 to <4 x i32>
%predphi89 = add <4 x i32> %vec.phi73, %35
%index.next = add nuw i64 %index, 8
%36 = icmp eq i64 %index.next, %n.vec
br i1 %36, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %pred.store.continue88
%bin.rdx = add <4 x i32> %predphi89, %predphi
%37 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond15.for.inc29_crit_edge.us, label %for.body17.us.preheader
for.body17.us.preheader: ; preds = %for.cond15.preheader.us, %middle.block
%indvars.iv63.ph = phi i64 [ 0, %for.cond15.preheader.us ], [ %n.vec, %middle.block ]
%count.150.us.ph = phi i32 [ %count.054.us, %for.cond15.preheader.us ], [ %37, %middle.block ]
br label %for.body17.us
for.body17.us: ; preds = %for.body17.us.preheader, %for.inc26.us
%indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.inc26.us ], [ %indvars.iv63.ph, %for.body17.us.preheader ]
%count.150.us = phi i32 [ %count.2.us, %for.inc26.us ], [ %count.150.us.ph, %for.body17.us.preheader ]
%arrayidx21.us = getelementptr inbounds [500 x i32], ptr %searchNumber, i64 0, i64 %indvars.iv63
%38 = load i32, ptr %arrayidx21.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %5, %38
br i1 %cmp22.us, label %if.then.us, label %for.inc26.us
if.then.us: ; preds = %for.body17.us
store i32 -1, ptr %arrayidx21.us, align 4, !tbaa !5
%inc25.us = add nsw i32 %count.150.us, 1
br label %for.inc26.us
for.inc26.us: ; preds = %if.then.us, %for.body17.us
%count.2.us = phi i32 [ %inc25.us, %if.then.us ], [ %count.150.us, %for.body17.us ]
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%exitcond.not = icmp eq i64 %indvars.iv.next64, %wide.trip.count
br i1 %exitcond.not, label %for.cond15.for.inc29_crit_edge.us, label %for.body17.us, !llvm.loop !14
for.cond15.for.inc29_crit_edge.us: ; preds = %for.inc26.us, %middle.block
%count.2.us.lcssa = phi i32 [ %37, %middle.block ], [ %count.2.us, %for.inc26.us ]
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond70.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count69
br i1 %exitcond70.not, label %for.end31, label %for.cond15.preheader.us, !llvm.loop !15
for.body5: ; preds = %for.end, %for.body5
%indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %searchNumber, i64 0, i64 %indvars.iv60
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
%39 = load i32, ptr %needSN, align 4, !tbaa !5
%40 = sext i32 %39 to i64
%cmp4 = icmp slt i64 %indvars.iv.next61, %40
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !16
for.end31: ; preds = %for.cond15.for.inc29_crit_edge.us, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ %count.2.us.lcssa, %for.cond15.for.inc29_crit_edge.us ]
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %needSN) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %needIN) #5
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %searchNumber) #5
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %includeNumber) #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: 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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#define N 10000
#define Q 500
int linearSearch();
int i,j,n,q,S[N],T[Q],c=0;
int main(){
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&S[i]);
scanf("%d",&q);
for(i=0;i<q;i++) scanf("%d",&T[i]);
printf("%d\n",linearSearch());
return 0;
}
int linearSearch(){
for(i=0;i<q;i++){
for(j=0;j<n;j++){
if(T[i]==S[j]){
c++;
break;
}
}
}
return c;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140792/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140792/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@c = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@S = dso_local global [10000 x i32] zeroinitializer, align 16
@q = dso_local global i32 0, align 4
@T = dso_local global [500 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@j = dso_local local_unnamed_addr global i32 0, align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
store i32 0, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%storemerge18 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%idxprom = sext i32 %storemerge18 to i64
%arrayidx = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr @i, align 4, !tbaa !5
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @i, align 4, !tbaa !5
%2 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @q)
store i32 0, ptr @i, align 4, !tbaa !5
%3 = load i32, ptr @q, align 4, !tbaa !5
%cmp419 = icmp sgt i32 %3, 0
br i1 %cmp419, label %for.body5, label %entry.for.end10_crit_edge.i
for.body5: ; preds = %for.end, %for.body5
%storemerge1520 = phi i32 [ %inc10, %for.body5 ], [ 0, %for.end ]
%idxprom6 = sext i32 %storemerge1520 to i64
%arrayidx7 = getelementptr inbounds [500 x i32], ptr @T, i64 0, i64 %idxprom6
%call8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%4 = load i32, ptr @i, align 4, !tbaa !5
%inc10 = add nsw i32 %4, 1
store i32 %inc10, ptr @i, align 4, !tbaa !5
%5 = load i32, ptr @q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %5
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !11
for.end11: ; preds = %for.body5
%cmp17.i = icmp sgt i32 %5, 0
br i1 %cmp17.i, label %for.cond1.preheader.lr.ph.i, label %entry.for.end10_crit_edge.i
entry.for.end10_crit_edge.i: ; preds = %for.end, %for.end11
%.pre.i = load i32, ptr @c, align 4, !tbaa !5
br label %linearSearch.exit
for.cond1.preheader.lr.ph.i: ; preds = %for.end11
%c.promoted.i = load i32, ptr @c, align 4, !tbaa !5
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp213.i = icmp sgt i32 %6, 0
br i1 %cmp213.i, label %for.cond1.preheader.us.preheader.i, label %for.cond1.preheader.lr.ph.split.i
for.cond1.preheader.us.preheader.i: ; preds = %for.cond1.preheader.lr.ph.i
%wide.trip.count28.i = zext i32 %5 to i64
%wide.trip.count.i = zext i32 %6 to i64
br label %for.cond1.preheader.us.i
for.cond1.preheader.us.i: ; preds = %for.inc8.us.i, %for.cond1.preheader.us.preheader.i
%indvars.iv25.i = phi i64 [ 0, %for.cond1.preheader.us.preheader.i ], [ %indvars.iv.next26.i, %for.inc8.us.i ]
%inc1618.us.i = phi i32 [ %c.promoted.i, %for.cond1.preheader.us.preheader.i ], [ %inc15.us.i, %for.inc8.us.i ]
%arrayidx.us.i = getelementptr inbounds [500 x i32], ptr @T, i64 0, i64 %indvars.iv25.i
%7 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %for.body3.us.i
for.body3.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 ]
%arrayidx5.us.i = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv.i
%8 = load i32, ptr %arrayidx5.us.i, align 4, !tbaa !5
%cmp6.us.i = icmp eq i32 %7, %8
br i1 %cmp6.us.i, label %if.then.us.i, label %for.inc.us.i
for.inc.us.i: ; preds = %for.body3.us.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %for.cond1.for.inc8.loopexit_crit_edge.us.i, label %for.body3.us.i, !llvm.loop !12
if.then.us.i: ; preds = %for.body3.us.i
%9 = trunc i64 %indvars.iv.i to i32
store i32 %9, ptr @j, align 4, !tbaa !5
%inc.us.i = add nsw i32 %inc1618.us.i, 1
store i32 %inc.us.i, ptr @c, align 4, !tbaa !5
br label %for.inc8.us.i
for.inc8.us.i: ; preds = %for.cond1.for.inc8.loopexit_crit_edge.us.i, %if.then.us.i
%inc15.us.i = phi i32 [ %inc1618.us.i, %for.cond1.for.inc8.loopexit_crit_edge.us.i ], [ %inc.us.i, %if.then.us.i ]
%indvars.iv.next26.i = add nuw nsw i64 %indvars.iv25.i, 1
%exitcond29.not.i = icmp eq i64 %indvars.iv.next26.i, %wide.trip.count28.i
br i1 %exitcond29.not.i, label %linearSearch.exit, label %for.cond1.preheader.us.i, !llvm.loop !13
for.cond1.for.inc8.loopexit_crit_edge.us.i: ; preds = %for.inc.us.i
store i32 %6, ptr @j, align 4, !tbaa !5
br label %for.inc8.us.i
for.cond1.preheader.lr.ph.split.i: ; preds = %for.cond1.preheader.lr.ph.i
store i32 0, ptr @j, align 4, !tbaa !5
br label %linearSearch.exit
linearSearch.exit: ; preds = %for.inc8.us.i, %entry.for.end10_crit_edge.i, %for.cond1.preheader.lr.ph.split.i
%10 = phi i32 [ %.pre.i, %entry.for.end10_crit_edge.i ], [ %c.promoted.i, %for.cond1.preheader.lr.ph.split.i ], [ %inc15.us.i, %for.inc8.us.i ]
%storemerge.lcssa.i = phi i32 [ 0, %entry.for.end10_crit_edge.i ], [ %5, %for.cond1.preheader.lr.ph.split.i ], [ %5, %for.inc8.us.i ]
store i32 %storemerge.lcssa.i, ptr @i, align 4, !tbaa !5
%call13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @linearSearch() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @q, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
%c.promoted = load i32, ptr @c, align 4, !tbaa !5
br i1 %cmp17, label %for.cond1.preheader.lr.ph, label %for.end10
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp213 = icmp sgt i32 %1, 0
br i1 %cmp213, label %for.cond1.preheader.us.preheader, label %for.cond1.preheader.lr.ph.split
for.cond1.preheader.us.preheader: ; preds = %for.cond1.preheader.lr.ph
%wide.trip.count28 = zext i32 %0 to i64
%wide.trip.count = zext i32 %1 to i64
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.inc8.us
%indvars.iv25 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next26, %for.inc8.us ]
%inc1618.us = phi i32 [ %c.promoted, %for.cond1.preheader.us.preheader ], [ %inc15.us, %for.inc8.us ]
%arrayidx.us = getelementptr inbounds [500 x i32], ptr @T, i64 0, i64 %indvars.iv25
%2 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %for.body3.us
for.body3.us: ; preds = %for.cond1.preheader.us, %for.inc.us
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.us ], [ %indvars.iv.next, %for.inc.us ]
%arrayidx5.us = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv
%3 = load i32, ptr %arrayidx5.us, align 4, !tbaa !5
%cmp6.us = icmp eq i32 %2, %3
br i1 %cmp6.us, label %if.then.us, label %for.inc.us
for.inc.us: ; preds = %for.body3.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond1.for.inc8.loopexit_crit_edge.us, label %for.body3.us, !llvm.loop !12
if.then.us: ; preds = %for.body3.us
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr @j, align 4, !tbaa !5
%inc.us = add nsw i32 %inc1618.us, 1
store i32 %inc.us, ptr @c, align 4, !tbaa !5
br label %for.inc8.us
for.inc8.us: ; preds = %for.cond1.for.inc8.loopexit_crit_edge.us, %if.then.us
%inc15.us = phi i32 [ %inc1618.us, %for.cond1.for.inc8.loopexit_crit_edge.us ], [ %inc.us, %if.then.us ]
%indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
%exitcond29.not = icmp eq i64 %indvars.iv.next26, %wide.trip.count28
br i1 %exitcond29.not, label %for.end10, label %for.cond1.preheader.us, !llvm.loop !13
for.cond1.for.inc8.loopexit_crit_edge.us: ; preds = %for.inc.us
store i32 %1, ptr @j, align 4, !tbaa !5
br label %for.inc8.us
for.cond1.preheader.lr.ph.split: ; preds = %for.cond1.preheader.lr.ph
store i32 0, ptr @j, align 4, !tbaa !5
br label %for.end10
for.end10: ; preds = %for.inc8.us, %entry, %for.cond1.preheader.lr.ph.split
%5 = phi i32 [ %c.promoted, %for.cond1.preheader.lr.ph.split ], [ %c.promoted, %entry ], [ %inc15.us, %for.inc8.us ]
%storemerge.lcssa = phi i32 [ %0, %for.cond1.preheader.lr.ph.split ], [ 0, %entry ], [ %0, %for.inc8.us ]
store i32 %storemerge.lcssa, ptr @i, align 4, !tbaa !5
ret 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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#define N 10000
#define Q 500
int main()
{
int S[N], T[Q], i, j, n, q, count=0;
scanf("%d", &n);
for( i = 0 ; i < n ; i++){
scanf("%d", &S[i]);
}
scanf("%d", &q);
for( i = 0 ; i < q ; i++){
scanf("%d", &T[i]);
}
for( i = 0 ; i < q ; i++){
j = 0;
S[n] = T[i];
while(S[j] != T[i]){
j++;
}
if(j != n){
count++;
}
}
printf("%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140842/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140842/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [10000 x i32], align 16
%T = alloca [500 x i32], align 16
%n = alloca i32, align 4
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %T) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp43 = icmp sgt i32 %0, 0
br i1 %cmp43, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp445 = icmp sgt i32 %3, 0
br i1 %cmp445, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1347 = icmp sgt i32 %6, 0
br i1 %cmp1347, label %for.body14.lr.ph, label %for.end29
for.body14.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%idxprom17 = sext i32 %4 to i64
%arrayidx18 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %idxprom17
%wide.trip.count = zext i32 %6 to i64
%xtraiter = and i64 %wide.trip.count, 1
%5 = icmp eq i32 %6, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.body14.lr.ph.new
for.body14.lr.ph.new: ; preds = %for.body14.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body14
for.body5: ; preds = %for.end, %for.body5
%indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv53
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
%6 = load i32, ptr %q, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp4 = icmp slt i64 %indvars.iv.next54, %7
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !11
for.body14: ; preds = %while.end.1, %for.body14.lr.ph.new
%indvars.iv59 = phi i64 [ 0, %for.body14.lr.ph.new ], [ %indvars.iv.next60.1, %while.end.1 ]
%count.049 = phi i32 [ 0, %for.body14.lr.ph.new ], [ %spec.select.1, %while.end.1 ]
%niter = phi i64 [ 0, %for.body14.lr.ph.new ], [ %niter.next.1, %while.end.1 ]
%arrayidx16 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv59
%8 = load i32, ptr %arrayidx16, align 8, !tbaa !5
store i32 %8, ptr %arrayidx18, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %for.body14
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %while.cond ], [ 0, %for.body14 ]
%arrayidx20 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv56
%9 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp23.not = icmp eq i32 %9, %8
%indvars.iv.next57 = add nuw i64 %indvars.iv56, 1
br i1 %cmp23.not, label %while.end, label %while.cond, !llvm.loop !12
while.end: ; preds = %while.cond
%10 = trunc i64 %indvars.iv56 to i32
%cmp25.not = icmp ne i32 %4, %10
%inc26 = zext i1 %cmp25.not to i32
%spec.select = add nuw nsw i32 %count.049, %inc26
%indvars.iv.next60 = or i64 %indvars.iv59, 1
%arrayidx16.1 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv.next60
%11 = load i32, ptr %arrayidx16.1, align 4, !tbaa !5
store i32 %11, ptr %arrayidx18, align 4, !tbaa !5
br label %while.cond.1
while.cond.1: ; preds = %while.cond.1, %while.end
%indvars.iv56.1 = phi i64 [ %indvars.iv.next57.1, %while.cond.1 ], [ 0, %while.end ]
%arrayidx20.1 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv56.1
%12 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5
%cmp23.not.1 = icmp eq i32 %12, %11
%indvars.iv.next57.1 = add nuw i64 %indvars.iv56.1, 1
br i1 %cmp23.not.1, label %while.end.1, label %while.cond.1, !llvm.loop !12
while.end.1: ; preds = %while.cond.1
%13 = trunc i64 %indvars.iv56.1 to i32
%cmp25.not.1 = icmp ne i32 %4, %13
%inc26.1 = zext i1 %cmp25.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc26.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end29.loopexit.unr-lcssa, label %for.body14, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %while.end.1, %for.body14.lr.ph
%spec.select.lcssa.ph = phi i32 [ undef, %for.body14.lr.ph ], [ %spec.select.1, %while.end.1 ]
%indvars.iv59.unr = phi i64 [ 0, %for.body14.lr.ph ], [ %indvars.iv.next60.1, %while.end.1 ]
%count.049.unr = phi i32 [ 0, %for.body14.lr.ph ], [ %spec.select.1, %while.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.body14.epil
for.body14.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx16.epil = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv59.unr
%14 = load i32, ptr %arrayidx16.epil, align 4, !tbaa !5
store i32 %14, ptr %arrayidx18, align 4, !tbaa !5
br label %while.cond.epil
while.cond.epil: ; preds = %while.cond.epil, %for.body14.epil
%indvars.iv56.epil = phi i64 [ %indvars.iv.next57.epil, %while.cond.epil ], [ 0, %for.body14.epil ]
%arrayidx20.epil = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv56.epil
%15 = load i32, ptr %arrayidx20.epil, align 4, !tbaa !5
%cmp23.not.epil = icmp eq i32 %15, %14
%indvars.iv.next57.epil = add nuw i64 %indvars.iv56.epil, 1
br i1 %cmp23.not.epil, label %while.end.epil, label %while.cond.epil, !llvm.loop !12
while.end.epil: ; preds = %while.cond.epil
%16 = trunc i64 %indvars.iv56.epil to i32
%cmp25.not.epil = icmp ne i32 %4, %16
%inc26.epil = zext i1 %cmp25.not.epil to i32
%spec.select.epil = add nuw nsw i32 %count.049.unr, %inc26.epil
br label %for.end29
for.end29: ; preds = %while.end.epil, %for.end29.loopexit.unr-lcssa, %for.end, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.end ], [ %spec.select.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %spec.select.epil, %while.end.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %S) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#define N 10000
#define Q 500
int linearSearch(int);
int n,S[N];
int main() {
int i,q,c=0,T[Q],k;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&S[i]);
}
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&T[i]);
}
for(i=0;i<q;i++) {
k=linearSearch(T[i]);
if(k > 0) c++;
}
printf("%d\n",c);
return 0;
}
int linearSearch(int key){
int i;
i=0;
S[n]=key;
while(S[i] != key) {
i++;
if(i == n) return 0;
}
return 1;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140893/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140893/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@S = dso_local global [10000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%q = alloca i32, align 4
%T = alloca [500 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %T) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp36 = icmp sgt i32 %0, 0
br i1 %cmp36, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp438 = icmp sgt i32 %3, 0
br i1 %cmp438, label %for.body5, label %for.end22
for.cond12.preheader: ; preds = %for.body5
%cmp1340 = icmp sgt i32 %6, 0
br i1 %cmp1340, label %for.body14.lr.ph, label %for.end22
for.body14.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr @n, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom.i
%5 = zext i32 %4 to i64
%wide.trip.count = zext i32 %6 to i64
br label %for.body14
for.body5: ; preds = %for.end, %for.body5
%indvars.iv47 = phi i64 [ %indvars.iv.next48, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv47
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
%6 = load i32, ptr %q, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp4 = icmp slt i64 %indvars.iv.next48, %7
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !11
for.body14: ; preds = %for.body14.lr.ph, %for.cond12
%indvars.iv50 = phi i64 [ 0, %for.body14.lr.ph ], [ %indvars.iv.next51, %for.cond12 ]
%c.041 = phi i32 [ 0, %for.body14.lr.ph ], [ %10, %for.cond12 ]
%arrayidx16 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv50
%8 = load i32, ptr %arrayidx16, align 4, !tbaa !5
store i32 %8, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.body.i, %for.body14
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.body.i ], [ 0, %for.body14 ]
%arrayidx2.i = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv.i
%9 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %9, %8
br i1 %cmp.not.i, label %linearSearch.exit, label %while.body.i
while.body.i: ; preds = %while.cond.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%cmp3.i = icmp eq i64 %indvars.iv.next.i, %5
br i1 %cmp3.i, label %for.cond12, label %while.cond.i, !llvm.loop !12
linearSearch.exit: ; preds = %while.cond.i
%inc19 = add nsw i32 %c.041, 1
br label %for.cond12
for.cond12: ; preds = %while.body.i, %linearSearch.exit
%10 = phi i32 [ %inc19, %linearSearch.exit ], [ %c.041, %while.body.i ]
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count
br i1 %exitcond.not, label %for.end22, label %for.body14, !llvm.loop !13
for.end22: ; preds = %for.cond12, %for.end, %for.cond12.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.end ], [ %10, %for.cond12 ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %T) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @linearSearch(i32 noundef %key) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
%1 = zext i32 %0 to i64
br label %while.cond
while.cond: ; preds = %while.body, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv
%2 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %2, %key
br i1 %cmp.not, label %cleanup, label %while.body
while.body: ; preds = %while.cond
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%cmp3 = icmp eq i64 %indvars.iv.next, %1
br i1 %cmp3, label %cleanup, label %while.cond, !llvm.loop !12
cleanup: ; preds = %while.cond, %while.body
%retval.0 = phi i32 [ 0, %while.body ], [ 1, %while.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#define N 10000
#define Q 500
int main () {
int i, j, n, q, c=0;
int s[N], t[Q];
scanf("%d", &n);
for(i=0;i<n;i++){
scanf("%d", &s[i]);
}
scanf("%d", &q);
for(i=0;i<q;i++){
scanf("%d", &t[i]);
for(j=0;j<n;j++){
if(t[i]==s[j]){
c++;
break;
}
}
}
printf("%d\n", c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_140936/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_140936/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%s = alloca [10000 x i32], align 16
%t = alloca [500 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp34 = icmp sgt i32 %0, 0
br i1 %cmp34, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp438 = icmp sgt i32 %3, 0
br i1 %cmp438, label %for.body5, label %for.end23
for.body5: ; preds = %for.end, %for.inc21
%indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.inc21 ], [ 0, %for.end ]
%c.040 = phi i32 [ %c.1, %for.inc21 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %t, i64 0, i64 %indvars.iv45
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1036 = icmp sgt i32 %4, 0
br i1 %cmp1036, label %for.body11.lr.ph, label %for.inc21
for.body11.lr.ph: ; preds = %for.body5
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%wide.trip.count = zext i32 %4 to i64
br label %for.body11
for.cond9: ; preds = %for.body11
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%exitcond.not = icmp eq i64 %indvars.iv.next43, %wide.trip.count
br i1 %exitcond.not, label %for.inc21, label %for.body11, !llvm.loop !11
for.body11: ; preds = %for.body11.lr.ph, %for.cond9
%indvars.iv42 = phi i64 [ 0, %for.body11.lr.ph ], [ %indvars.iv.next43, %for.cond9 ]
%arrayidx15 = getelementptr inbounds [10000 x i32], ptr %s, i64 0, i64 %indvars.iv42
%6 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%cmp16 = icmp eq i32 %5, %6
br i1 %cmp16, label %if.then, label %for.cond9
if.then: ; preds = %for.body11
%inc17 = add nsw i32 %c.040, 1
br label %for.inc21
for.inc21: ; preds = %for.cond9, %for.body5, %if.then
%c.1 = phi i32 [ %inc17, %if.then ], [ %c.040, %for.body5 ], [ %c.040, %for.cond9 ]
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%7 = load i32, ptr %q, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp4 = icmp slt i64 %indvars.iv.next46, %8
br i1 %cmp4, label %for.body5, label %for.end23, !llvm.loop !12
for.end23: ; preds = %for.inc21, %for.end
%c.0.lcssa = phi i32 [ 0, %for.end ], [ %c.1, %for.inc21 ]
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <string.h>
char str[100860];
int main() {
int n, a = 0, d = 0;
scanf("%d", &n);
scanf("%s", str);
for (int i = 0; i < n; ++i) {
if (str[i] == 'A') ++a;
else if (str[i] == 'D') ++d;
}
if (a > d) printf("Anton");
else if (a < d) printf("Danik");
else printf("Friendship");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14098/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14098/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = dso_local global [100860 x i8] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [6 x i8] c"Anton\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"Danik\00", align 1
@.str.4 = private unnamed_addr constant [11 x i8] c"Friendship\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @str)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp33 = icmp sgt i32 %0, 0
br i1 %cmp33, label %for.body.preheader, label %if.else22
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %0, 1
br i1 %1, label %for.cond.cleanup.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.cond.cleanup.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%a.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %a.1.1, %for.inc.1 ]
%d.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %d.1.1, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%d.035.unr = phi i32 [ 0, %for.body.preheader ], [ %d.1.1, %for.inc.1 ]
%a.034.unr = phi i32 [ 0, %for.body.preheader ], [ %a.1.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.unr-lcssa
%arrayidx.epil = getelementptr inbounds [100860 x i8], ptr @str, i64 0, i64 %indvars.iv.unr
%2 = load i8, ptr %arrayidx.epil, align 1, !tbaa !9
switch i8 %2, label %for.cond.cleanup [
i8 65, label %if.then.epil
i8 68, label %if.then9.epil
]
if.then9.epil: ; preds = %for.body.epil
%inc10.epil = add nsw i32 %d.035.unr, 1
br label %for.cond.cleanup
if.then.epil: ; preds = %for.body.epil
%inc.epil = add nsw i32 %a.034.unr, 1
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body.epil, %if.then9.epil, %if.then.epil, %for.cond.cleanup.unr-lcssa
%a.1.lcssa = phi i32 [ %a.1.lcssa.ph, %for.cond.cleanup.unr-lcssa ], [ %inc.epil, %if.then.epil ], [ %a.034.unr, %if.then9.epil ], [ %a.034.unr, %for.body.epil ]
%d.1.lcssa = phi i32 [ %d.1.lcssa.ph, %for.cond.cleanup.unr-lcssa ], [ %d.035.unr, %if.then.epil ], [ %inc10.epil, %if.then9.epil ], [ %d.035.unr, %for.body.epil ]
%cmp13 = icmp sgt i32 %a.1.lcssa, %d.1.lcssa
br i1 %cmp13, label %if.end25, label %if.else17
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%d.035 = phi i32 [ 0, %for.body.preheader.new ], [ %d.1.1, %for.inc.1 ]
%a.034 = phi i32 [ 0, %for.body.preheader.new ], [ %a.1.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [100860 x i8], ptr @str, i64 0, i64 %indvars.iv
%3 = load i8, ptr %arrayidx, align 2, !tbaa !9
switch i8 %3, label %for.inc [
i8 65, label %if.then
i8 68, label %if.then9
]
if.then: ; preds = %for.body
%inc = add nsw i32 %a.034, 1
br label %for.inc
if.then9: ; preds = %for.body
%inc10 = add nsw i32 %d.035, 1
br label %for.inc
for.inc: ; preds = %for.body, %if.then, %if.then9
%a.1 = phi i32 [ %inc, %if.then ], [ %a.034, %if.then9 ], [ %a.034, %for.body ]
%d.1 = phi i32 [ %d.035, %if.then ], [ %inc10, %if.then9 ], [ %d.035, %for.body ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [100860 x i8], ptr @str, i64 0, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx.1, align 1, !tbaa !9
switch i8 %4, label %for.inc.1 [
i8 65, label %if.then.1
i8 68, label %if.then9.1
]
if.then9.1: ; preds = %for.inc
%inc10.1 = add nsw i32 %d.1, 1
br label %for.inc.1
if.then.1: ; preds = %for.inc
%inc.1 = add nsw i32 %a.1, 1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %if.then9.1, %for.inc
%a.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ %a.1, %if.then9.1 ], [ %a.1, %for.inc ]
%d.1.1 = phi i32 [ %d.1, %if.then.1 ], [ %inc10.1, %if.then9.1 ], [ %d.1, %for.inc ]
%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.unr-lcssa, label %for.body, !llvm.loop !10
if.else17: ; preds = %for.cond.cleanup
%cmp18 = icmp slt i32 %a.1.lcssa, %d.1.lcssa
br i1 %cmp18, label %if.end25, label %if.else22
if.else22: ; preds = %entry, %if.else17
br label %if.end25
if.end25: ; preds = %if.else17, %for.cond.cleanup, %if.else22
%.str.3.sink = phi ptr [ @.str.4, %if.else22 ], [ @.str.2, %for.cond.cleanup ], [ @.str.3, %if.else17 ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int linearSearch(int a[],int n,int key){
int i;
for(i=0;i<n-1;i++){
if(a[i]==key){
return 1;
}
}
return 0;
}
int main(void)
{
int i,n,a[10001],q,key,ans;
ans=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&key);
if(linearSearch(a,n,key)){
ans++;
}
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141021/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141021/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @linearSearch(ptr nocapture noundef readonly %a, i32 noundef %n, i32 noundef %key) local_unnamed_addr #0 {
entry:
%cmp4 = icmp sgt i32 %n, 1
br i1 %cmp4, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
%wide.trip.count = zext i32 %sub to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !7
%cmp1 = icmp eq i32 %0, %key
br i1 %cmp1, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%a = alloca [10001 x i32], align 16
%q = alloca i32, align 4
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !7
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !7
%cmp423 = icmp sgt i32 %3, 0
br i1 %cmp423, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %for.cond3
%ans.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ]
%i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %n, align 4, !tbaa !7
%5 = load i32, ptr %key, align 4, !tbaa !7
%cmp4.i = icmp sgt i32 %4, 1
br i1 %cmp4.i, label %for.body.preheader.i, label %for.cond3
for.body.preheader.i: ; preds = %for.body5
%sub.i = add nsw i32 %4, -1
%wide.trip.count.i = zext i32 %sub.i to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %for.cond3, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.cond.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !7
%cmp1.i = icmp eq i32 %6, %5
br i1 %cmp1.i, label %linearSearch.exit, label %for.cond.i
linearSearch.exit: ; preds = %for.body.i
%inc8 = add nsw i32 %ans.025, 1
br label %for.cond3
for.cond3: ; preds = %for.cond.i, %for.body5, %linearSearch.exit
%7 = phi i32 [ %inc8, %linearSearch.exit ], [ %ans.025, %for.body5 ], [ %ans.025, %for.cond.i ]
%inc10 = add nuw nsw i32 %i.124, 1
%8 = load i32, ptr %q, align 4, !tbaa !7
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %for.cond3, %for.end
%ans.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
|
#include <stdio.h>
#include <stdlib.h>
typedef struct _elem {
struct _elem *next;
int data;
} elem;
elem head = { &head, -1 };
void insert(int data) {
elem *new;
new = (elem *)malloc(sizeof(elem));
new->data = data;
new->next = head.next;
head.next = new;
}
int search(int data) {
elem *p;
p = head.next;
head.data = data;
while(p->data != data)
p = p->next;
return p != &head;
}
int main() {
int n, q, i, tmp, cnt;
cnt = 0;
scanf("%d", &n);
for(i = 0;i < n;i++) {
scanf("%d", &tmp);
insert(tmp);
}
scanf("%d", &q);
for(i = 0;i < q;i++) {
scanf("%d", &tmp);
if(search(tmp))
cnt++;
}
printf("%d\n", cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141072/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141072/source.c"
target datalayout = "e-m:e-p270: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._elem = type { ptr, i32 }
@head = dso_local global %struct._elem { ptr @head, i32 -1 }, align 8
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(readwrite, argmem: none) uwtable
define dso_local void @insert(i32 noundef %data) local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #6
%data1 = getelementptr inbounds %struct._elem, ptr %call, i64 0, i32 1
store i32 %data, ptr %data1, align 8, !tbaa !5
%0 = load ptr, ptr @head, align 8, !tbaa !11
store ptr %0, ptr %call, align 8, !tbaa !11
store ptr %call, ptr @head, align 8, !tbaa !11
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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @search(i32 noundef %data) local_unnamed_addr #3 {
entry:
%0 = load ptr, ptr @head, align 8, !tbaa !11
store i32 %data, ptr getelementptr inbounds (%struct._elem, ptr @head, i64 0, i32 1), align 8, !tbaa !5
%data16 = getelementptr inbounds %struct._elem, ptr %0, i64 0, i32 1
%1 = load i32, ptr %data16, align 8, !tbaa !5
%cmp.not7 = icmp eq i32 %1, %data
br i1 %cmp.not7, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%p.08 = phi ptr [ %2, %while.body ], [ %0, %entry ]
%2 = load ptr, ptr %p.08, align 8, !tbaa !11
%data1 = getelementptr inbounds %struct._elem, ptr %2, i64 0, i32 1
%3 = load i32, ptr %data1, align 8, !tbaa !5
%cmp.not = icmp eq i32 %3, %data
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %while.body, %entry
%p.0.lcssa = phi ptr [ %0, %entry ], [ %2, %while.body ]
%cmp2 = icmp ne ptr %p.0.lcssa, @head
%conv = zext i1 %cmp2 to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%tmp = 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 %q) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tmp) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !14
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.019 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tmp)
%1 = load i32, ptr %tmp, align 4, !tbaa !14
%call.i = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #6
%data1.i = getelementptr inbounds %struct._elem, ptr %call.i, i64 0, i32 1
store i32 %1, ptr %data1.i, align 8, !tbaa !5
%2 = load ptr, ptr @head, align 8, !tbaa !11
store ptr %2, ptr %call.i, align 8, !tbaa !11
store ptr %call.i, ptr @head, align 8, !tbaa !11
%inc = add nuw nsw i32 %i.019, 1
%3 = load i32, ptr %n, align 4, !tbaa !14
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !15
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%4 = load i32, ptr %q, align 4, !tbaa !14
%cmp420 = icmp sgt i32 %4, 0
br i1 %cmp420, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %search.exit
%cnt.022 = phi i32 [ %spec.select, %search.exit ], [ 0, %for.end ]
%i.121 = phi i32 [ %inc10, %search.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tmp)
%5 = load i32, ptr %tmp, align 4, !tbaa !14
%6 = load ptr, ptr @head, align 8, !tbaa !11
store i32 %5, ptr getelementptr inbounds (%struct._elem, ptr @head, i64 0, i32 1), align 8, !tbaa !5
%data16.i = getelementptr inbounds %struct._elem, ptr %6, i64 0, i32 1
%7 = load i32, ptr %data16.i, align 8, !tbaa !5
%cmp.not7.i = icmp eq i32 %7, %5
br i1 %cmp.not7.i, label %search.exit, label %while.body.i
while.body.i: ; preds = %for.body5, %while.body.i
%p.08.i = phi ptr [ %8, %while.body.i ], [ %6, %for.body5 ]
%8 = load ptr, ptr %p.08.i, align 8, !tbaa !11
%data1.i17 = getelementptr inbounds %struct._elem, ptr %8, i64 0, i32 1
%9 = load i32, ptr %data1.i17, align 8, !tbaa !5
%cmp.not.i = icmp eq i32 %9, %5
br i1 %cmp.not.i, label %search.exit, label %while.body.i, !llvm.loop !12
search.exit: ; preds = %while.body.i, %for.body5
%p.0.lcssa.i = phi ptr [ %6, %for.body5 ], [ %8, %while.body.i ]
%cmp2.i.not = icmp ne ptr %p.0.lcssa.i, @head
%inc8 = zext i1 %cmp2.i.not to i32
%spec.select = add nuw nsw i32 %cnt.022, %inc8
%inc10 = add nuw nsw i32 %i.121, 1
%10 = load i32, ptr %q, align 4, !tbaa !14
%cmp4 = icmp slt i32 %inc10, %10
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !16
for.end11: ; preds = %search.exit, %for.end
%cnt.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %search.exit ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tmp) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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
attributes #0 = { mustprogress nofree nounwind willreturn memory(readwrite, argmem: 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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nounwind allocsize(0) }
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, !10, i64 8}
!6 = !{!"_elem", !7, i64 0, !10, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !10, i64 0}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
|
#include<stdio.h>
#include<stdlib.h>
int main(){
int *S, *T,n,N,C,i,j;
scanf("%d",&n);
S = (int *)malloc(sizeof(int)*n);
for(i=0; i<=n-1; i++){
scanf("%d",&S[i]);
}
scanf("%d",&N);
T = (int *)malloc(sizeof(int)*N);
for(i=0; i<=N-1; i++){
scanf("%d",&T[i]);
}
C=0;
for(j=0; j<=N-1; j++){
for(i=0; i<=n-1; i++){
if(S[i]==T[j]){
C++;
break;
}
}
}
printf("%d\n",C);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141122/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141122/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%N = 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 %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
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #5
%cmp.not.not56 = icmp sgt i32 %0, 0
br i1 %cmp.not.not56, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %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.not.not = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%3 = load i32, ptr %N, align 4, !tbaa !5
%conv5 = sext i32 %3 to i64
%mul6 = shl nsw i64 %conv5, 2
%call7 = call noalias ptr @malloc(i64 noundef %mul6) #5
%cmp10.not.not58 = icmp sgt i32 %3, 0
br i1 %cmp10.not.not58, label %for.body12, label %for.end41
for.cond19.preheader: ; preds = %for.body12
%cmp21.not.not62 = icmp sgt i32 %10, 0
br i1 %cmp21.not.not62, label %for.cond24.preheader.lr.ph, label %for.end41
for.cond24.preheader.lr.ph: ; preds = %for.cond19.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp26.not.not60 = icmp sgt i32 %4, 0
br i1 %cmp26.not.not60, label %for.cond24.preheader.us.preheader, label %for.end41
for.cond24.preheader.us.preheader: ; preds = %for.cond24.preheader.lr.ph
%wide.trip.count79 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count79, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end41.loopexit.unr-lcssa, label %for.cond24.preheader.us.preheader.new
for.cond24.preheader.us.preheader.new: ; preds = %for.cond24.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count79, 4294967294
br label %for.cond24.preheader.us
for.cond24.preheader.us: ; preds = %for.inc39.us.1, %for.cond24.preheader.us.preheader.new
%indvars.iv76 = phi i64 [ 0, %for.cond24.preheader.us.preheader.new ], [ %indvars.iv.next77.1, %for.inc39.us.1 ]
%C.063.us = phi i32 [ 0, %for.cond24.preheader.us.preheader.new ], [ %C.1.us.1, %for.inc39.us.1 ]
%niter = phi i64 [ 0, %for.cond24.preheader.us.preheader.new ], [ %niter.next.1, %for.inc39.us.1 ]
%arrayidx32.us = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv76
%6 = load i32, ptr %arrayidx32.us, align 4, !tbaa !5
br label %for.body28.us
for.cond24.us: ; preds = %for.body28.us
%indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
%exitcond.not = icmp eq i64 %indvars.iv.next74, %wide.trip.count
br i1 %exitcond.not, label %for.inc39.us, label %for.body28.us, !llvm.loop !11
for.body28.us: ; preds = %for.cond24.preheader.us, %for.cond24.us
%indvars.iv73 = phi i64 [ 0, %for.cond24.preheader.us ], [ %indvars.iv.next74, %for.cond24.us ]
%arrayidx30.us = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv73
%7 = load i32, ptr %arrayidx30.us, align 4, !tbaa !5
%cmp33.us = icmp eq i32 %7, %6
br i1 %cmp33.us, label %if.then.us, label %for.cond24.us
if.then.us: ; preds = %for.body28.us
%inc35.us = add nsw i32 %C.063.us, 1
br label %for.inc39.us
for.inc39.us: ; preds = %for.cond24.us, %if.then.us
%C.1.us = phi i32 [ %inc35.us, %if.then.us ], [ %C.063.us, %for.cond24.us ]
%indvars.iv.next77 = or i64 %indvars.iv76, 1
%arrayidx32.us.1 = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv.next77
%8 = load i32, ptr %arrayidx32.us.1, align 4, !tbaa !5
br label %for.body28.us.1
for.body28.us.1: ; preds = %for.cond24.us.1, %for.inc39.us
%indvars.iv73.1 = phi i64 [ 0, %for.inc39.us ], [ %indvars.iv.next74.1, %for.cond24.us.1 ]
%arrayidx30.us.1 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv73.1
%9 = load i32, ptr %arrayidx30.us.1, align 4, !tbaa !5
%cmp33.us.1 = icmp eq i32 %9, %8
br i1 %cmp33.us.1, label %if.then.us.1, label %for.cond24.us.1
for.cond24.us.1: ; preds = %for.body28.us.1
%indvars.iv.next74.1 = add nuw nsw i64 %indvars.iv73.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next74.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc39.us.1, label %for.body28.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body28.us.1
%inc35.us.1 = add nsw i32 %C.1.us, 1
br label %for.inc39.us.1
for.inc39.us.1: ; preds = %for.cond24.us.1, %if.then.us.1
%C.1.us.1 = phi i32 [ %inc35.us.1, %if.then.us.1 ], [ %C.1.us, %for.cond24.us.1 ]
%indvars.iv.next77.1 = add nuw nsw i64 %indvars.iv76, 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.end41.loopexit.unr-lcssa, label %for.cond24.preheader.us, !llvm.loop !12
for.body12: ; preds = %for.end, %for.body12
%indvars.iv70 = phi i64 [ %indvars.iv.next71, %for.body12 ], [ 0, %for.end ]
%arrayidx14 = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv70
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx14)
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
%10 = load i32, ptr %N, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp10.not.not = icmp slt i64 %indvars.iv.next71, %11
br i1 %cmp10.not.not, label %for.body12, label %for.cond19.preheader, !llvm.loop !13
for.end41.loopexit.unr-lcssa: ; preds = %for.inc39.us.1, %for.cond24.preheader.us.preheader
%C.1.us.lcssa.ph = phi i32 [ undef, %for.cond24.preheader.us.preheader ], [ %C.1.us.1, %for.inc39.us.1 ]
%indvars.iv76.unr = phi i64 [ 0, %for.cond24.preheader.us.preheader ], [ %indvars.iv.next77.1, %for.inc39.us.1 ]
%C.063.us.unr = phi i32 [ 0, %for.cond24.preheader.us.preheader ], [ %C.1.us.1, %for.inc39.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end41, label %for.cond24.preheader.us.epil
for.cond24.preheader.us.epil: ; preds = %for.end41.loopexit.unr-lcssa
%arrayidx32.us.epil = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv76.unr
%12 = load i32, ptr %arrayidx32.us.epil, align 4, !tbaa !5
br label %for.body28.us.epil
for.body28.us.epil: ; preds = %for.cond24.us.epil, %for.cond24.preheader.us.epil
%indvars.iv73.epil = phi i64 [ 0, %for.cond24.preheader.us.epil ], [ %indvars.iv.next74.epil, %for.cond24.us.epil ]
%arrayidx30.us.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv73.epil
%13 = load i32, ptr %arrayidx30.us.epil, align 4, !tbaa !5
%cmp33.us.epil = icmp eq i32 %13, %12
br i1 %cmp33.us.epil, label %if.then.us.epil, label %for.cond24.us.epil
for.cond24.us.epil: ; preds = %for.body28.us.epil
%indvars.iv.next74.epil = add nuw nsw i64 %indvars.iv73.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next74.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end41, label %for.body28.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body28.us.epil
%inc35.us.epil = add nsw i32 %C.063.us.unr, 1
br label %for.end41
for.end41: ; preds = %for.end41.loopexit.unr-lcssa, %for.cond24.us.epil, %if.then.us.epil, %for.end, %for.cond24.preheader.lr.ph, %for.cond19.preheader
%C.0.lcssa = phi i32 [ 0, %for.cond19.preheader ], [ 0, %for.cond24.preheader.lr.ph ], [ 0, %for.end ], [ %C.1.us.lcssa.ph, %for.end41.loopexit.unr-lcssa ], [ %inc35.us.epil, %if.then.us.epil ], [ %C.063.us.unr, %for.cond24.us.epil ]
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %C.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#define N 10000
int linearSearch(int S[], int key, int n){
int i;
for( i = 0 ; i < n-1 ; i++ ){
if(S[i] == key) return 1;
}
return 0;
}
int main(){
int i, n, S[N], q, key, cont = 0;
scanf("%d", &n);
for( i = 0 ; i < n ; i++ ){
scanf("%d", &S[i]);
}
scanf("%d", &q);
for( i = 0 ; i < q ; i++ ){
scanf("%d", &key);
if( linearSearch(S, key, n) == 1 ) cont++;
}
printf("%d\n", cont);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141166/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141166/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @linearSearch(ptr nocapture noundef readonly %S, i32 noundef %key, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp4 = icmp sgt i32 %n, 1
br i1 %cmp4, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
%wide.trip.count = zext i32 %sub to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i32, ptr %S, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !7
%cmp1 = icmp eq i32 %0, %key
br i1 %cmp1, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.0
}
; Function Attrs: 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
%S = alloca [10000 x i32], align 16
%q = alloca i32, align 4
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !7
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !7
%cmp424 = icmp sgt i32 %3, 0
br i1 %cmp424, label %for.body5, label %for.end12
for.body5: ; preds = %for.end, %for.cond3
%cont.026 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ]
%i.125 = phi i32 [ %inc11, %for.cond3 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %key, align 4, !tbaa !7
%5 = load i32, ptr %n, align 4, !tbaa !7
%cmp4.i = icmp sgt i32 %5, 1
br i1 %cmp4.i, label %for.body.preheader.i, label %for.cond3
for.body.preheader.i: ; preds = %for.body5
%sub.i = add nsw i32 %5, -1
%wide.trip.count.i = zext i32 %sub.i to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %for.cond3, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.cond.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %S, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !7
%cmp1.i = icmp eq i32 %6, %4
br i1 %cmp1.i, label %linearSearch.exit, label %for.cond.i
linearSearch.exit: ; preds = %for.body.i
%inc9 = add nsw i32 %cont.026, 1
br label %for.cond3
for.cond3: ; preds = %for.cond.i, %for.body5, %linearSearch.exit
%7 = phi i32 [ %inc9, %linearSearch.exit ], [ %cont.026, %for.body5 ], [ %cont.026, %for.cond.i ]
%inc11 = add nuw nsw i32 %i.125, 1
%8 = load i32, ptr %q, align 4, !tbaa !7
%cmp4 = icmp slt i32 %inc11, %8
br i1 %cmp4, label %for.body5, label %for.end12, !llvm.loop !12
for.end12: ; preds = %for.cond3, %for.end
%cont.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cont.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %S) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
|
#include<stdio.h>
#define N 100000
int Search(int *, int, int);
int main(){
int loop1,loop2;
int retu1[N],retu2[N];
int i,count=0;
scanf("%d",&loop1);
for(i=0;i<loop1;i++){
scanf(" %d",&retu1[i]);
}
scanf("%d",&loop2);
for(i=0;i<loop2;i++){
scanf(" %d",&retu2[i]);
}
for(i=0;i<loop2;i++){
count+=Search(retu1,retu2[i],loop1);
}
printf("%d\n",count);
return 0;
}
int Search(int *x,int y,int length){
int i;
for(i=0;i<length;i++){
if(x[i]==y) return 1;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141209/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141209/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%loop1 = alloca i32, align 4
%loop2 = alloca i32, align 4
%retu1 = alloca [100000 x i32], align 16
%retu2 = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %loop1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %loop2) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %retu1) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %retu2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %loop1)
%0 = load i32, ptr %loop1, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %retu1, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %loop1, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %loop2)
%3 = load i32, ptr %loop2, align 4, !tbaa !5
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %for.body5, label %for.end20
for.cond12.preheader: ; preds = %for.body5
%cmp1335 = icmp sgt i32 %10, 0
br i1 %cmp1335, label %for.body14.lr.ph, label %for.end20
for.body14.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %loop1, align 4, !tbaa !5
%cmp4.i = icmp sgt i32 %4, 0
%wide.trip.count.i = zext i32 %4 to i64
br i1 %cmp4.i, label %for.body14.us.preheader, label %for.end20
for.body14.us.preheader: ; preds = %for.body14.lr.ph
%wide.trip.count = zext i32 %10 to i64
%xtraiter = and i64 %wide.trip.count, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end20.loopexit.unr-lcssa, label %for.body14.us.preheader.new
for.body14.us.preheader.new: ; preds = %for.body14.us.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body14.us
for.body14.us: ; preds = %Search.exit.loopexit.us.1, %for.body14.us.preheader.new
%indvars.iv45 = phi i64 [ 0, %for.body14.us.preheader.new ], [ %indvars.iv.next46.1, %Search.exit.loopexit.us.1 ]
%count.037.us = phi i32 [ 0, %for.body14.us.preheader.new ], [ %add.us.1, %Search.exit.loopexit.us.1 ]
%niter = phi i64 [ 0, %for.body14.us.preheader.new ], [ %niter.next.1, %Search.exit.loopexit.us.1 ]
%arrayidx16.us = getelementptr inbounds [100000 x i32], ptr %retu2, i64 0, i64 %indvars.iv45
%6 = load i32, ptr %arrayidx16.us, align 8, !tbaa !5
br label %for.body.i.us
for.body.i.us: ; preds = %for.cond.i.us, %for.body14.us
%indvars.iv.i.us = phi i64 [ 0, %for.body14.us ], [ %indvars.iv.next.i.us, %for.cond.i.us ]
%arrayidx.i.us = getelementptr inbounds i32, ptr %retu1, i64 %indvars.iv.i.us
%7 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%cmp1.i.us = icmp eq i32 %7, %6
br i1 %cmp1.i.us, label %Search.exit.loopexit.us, label %for.cond.i.us
for.cond.i.us: ; preds = %for.body.i.us
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %Search.exit.loopexit.us, label %for.body.i.us, !llvm.loop !11
Search.exit.loopexit.us: ; preds = %for.cond.i.us, %for.body.i.us
%retval.0.i.ph.us = phi i32 [ 1, %for.body.i.us ], [ 0, %for.cond.i.us ]
%add.us = add nuw nsw i32 %retval.0.i.ph.us, %count.037.us
%indvars.iv.next46 = or i64 %indvars.iv45, 1
%arrayidx16.us.1 = getelementptr inbounds [100000 x i32], ptr %retu2, i64 0, i64 %indvars.iv.next46
%8 = load i32, ptr %arrayidx16.us.1, align 4, !tbaa !5
br label %for.body.i.us.1
for.body.i.us.1: ; preds = %for.cond.i.us.1, %Search.exit.loopexit.us
%indvars.iv.i.us.1 = phi i64 [ 0, %Search.exit.loopexit.us ], [ %indvars.iv.next.i.us.1, %for.cond.i.us.1 ]
%arrayidx.i.us.1 = getelementptr inbounds i32, ptr %retu1, i64 %indvars.iv.i.us.1
%9 = load i32, ptr %arrayidx.i.us.1, align 4, !tbaa !5
%cmp1.i.us.1 = icmp eq i32 %9, %8
br i1 %cmp1.i.us.1, label %Search.exit.loopexit.us.1, label %for.cond.i.us.1
for.cond.i.us.1: ; preds = %for.body.i.us.1
%indvars.iv.next.i.us.1 = add nuw nsw i64 %indvars.iv.i.us.1, 1
%exitcond.not.i.us.1 = icmp eq i64 %indvars.iv.next.i.us.1, %wide.trip.count.i
br i1 %exitcond.not.i.us.1, label %Search.exit.loopexit.us.1, label %for.body.i.us.1, !llvm.loop !11
Search.exit.loopexit.us.1: ; preds = %for.cond.i.us.1, %for.body.i.us.1
%retval.0.i.ph.us.1 = phi i32 [ 1, %for.body.i.us.1 ], [ 0, %for.cond.i.us.1 ]
%add.us.1 = add nuw nsw i32 %retval.0.i.ph.us.1, %add.us
%indvars.iv.next46.1 = add nuw nsw i64 %indvars.iv45, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end20.loopexit.unr-lcssa, label %for.body14.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [100000 x i32], ptr %retu2, i64 0, i64 %indvars.iv42
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx7)
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%10 = load i32, ptr %loop2, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next43, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end20.loopexit.unr-lcssa: ; preds = %Search.exit.loopexit.us.1, %for.body14.us.preheader
%add.us.lcssa.ph = phi i32 [ undef, %for.body14.us.preheader ], [ %add.us.1, %Search.exit.loopexit.us.1 ]
%indvars.iv45.unr = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next46.1, %Search.exit.loopexit.us.1 ]
%count.037.us.unr = phi i32 [ 0, %for.body14.us.preheader ], [ %add.us.1, %Search.exit.loopexit.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end20, label %for.body14.us.epil
for.body14.us.epil: ; preds = %for.end20.loopexit.unr-lcssa
%arrayidx16.us.epil = getelementptr inbounds [100000 x i32], ptr %retu2, i64 0, i64 %indvars.iv45.unr
%12 = load i32, ptr %arrayidx16.us.epil, align 4, !tbaa !5
br label %for.body.i.us.epil
for.body.i.us.epil: ; preds = %for.cond.i.us.epil, %for.body14.us.epil
%indvars.iv.i.us.epil = phi i64 [ 0, %for.body14.us.epil ], [ %indvars.iv.next.i.us.epil, %for.cond.i.us.epil ]
%arrayidx.i.us.epil = getelementptr inbounds i32, ptr %retu1, i64 %indvars.iv.i.us.epil
%13 = load i32, ptr %arrayidx.i.us.epil, align 4, !tbaa !5
%cmp1.i.us.epil = icmp eq i32 %13, %12
br i1 %cmp1.i.us.epil, label %Search.exit.loopexit.us.epil, label %for.cond.i.us.epil
for.cond.i.us.epil: ; preds = %for.body.i.us.epil
%indvars.iv.next.i.us.epil = add nuw nsw i64 %indvars.iv.i.us.epil, 1
%exitcond.not.i.us.epil = icmp eq i64 %indvars.iv.next.i.us.epil, %wide.trip.count.i
br i1 %exitcond.not.i.us.epil, label %Search.exit.loopexit.us.epil, label %for.body.i.us.epil, !llvm.loop !11
Search.exit.loopexit.us.epil: ; preds = %for.cond.i.us.epil, %for.body.i.us.epil
%retval.0.i.ph.us.epil = phi i32 [ 1, %for.body.i.us.epil ], [ 0, %for.cond.i.us.epil ]
%add.us.epil = add nuw nsw i32 %retval.0.i.ph.us.epil, %count.037.us.unr
br label %for.end20
for.end20: ; preds = %Search.exit.loopexit.us.epil, %for.end20.loopexit.unr-lcssa, %for.end, %for.body14.lr.ph, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %add.us.lcssa.ph, %for.end20.loopexit.unr-lcssa ], [ %add.us.epil, %Search.exit.loopexit.us.epil ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %retu2) #4
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %retu1) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %loop2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %loop1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @Search(ptr nocapture noundef readonly %x, i32 noundef %y, i32 noundef %length) local_unnamed_addr #3 {
entry:
%cmp4 = icmp sgt i32 %length, 0
br i1 %cmp4, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %length to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !11
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i32, ptr %x, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, %y
br i1 %cmp1, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#include<string.h>
int N,N2;
int main(){
int i,j,c=0;
scanf("%d",&N);
int s[N];
for(i=0;i<N;i++){
scanf("%d",&s[i]);
}
scanf("%d",&N2);
int s2[N2];
for(i=0;i<N2;i++){
scanf("%d",&s2[i]);
}
for(i=0;i<N2;i++){
for(j=0;j<N;j++){
if(s2[i]==s[j]){
c++;
break;
}
}
}
printf("%d\n",c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141252/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141252/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@N2 = dso_local global i32 0, align 4
@.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:
%call = tail 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
%vla = alloca i32, i64 %1, align 16
%cmp43 = icmp sgt i32 %0, 0
br i1 %cmp43, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds 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
%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, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N2)
%4 = load i32, ptr @N2, align 4, !tbaa !5
%5 = zext i32 %4 to i64
%vla3 = alloca i32, i64 %5, align 16
%cmp545 = icmp sgt i32 %4, 0
br i1 %cmp545, label %for.body6, label %for.end30
for.cond13.preheader: ; preds = %for.body6
%cmp1449 = icmp sgt i32 %12, 0
br i1 %cmp1449, label %for.cond16.preheader.lr.ph, label %for.end30
for.cond16.preheader.lr.ph: ; preds = %for.cond13.preheader
%6 = load i32, ptr @N, align 4, !tbaa !5
%cmp1747 = icmp sgt i32 %6, 0
br i1 %cmp1747, label %for.cond16.preheader.us.preheader, label %for.end30
for.cond16.preheader.us.preheader: ; preds = %for.cond16.preheader.lr.ph
%wide.trip.count66 = zext i32 %12 to i64
%wide.trip.count = zext i32 %6 to i64
%xtraiter = and i64 %wide.trip.count66, 1
%7 = icmp eq i32 %12, 1
br i1 %7, label %for.end30.loopexit.unr-lcssa, label %for.cond16.preheader.us.preheader.new
for.cond16.preheader.us.preheader.new: ; preds = %for.cond16.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count66, 4294967294
br label %for.cond16.preheader.us
for.cond16.preheader.us: ; preds = %for.inc28.us.1, %for.cond16.preheader.us.preheader.new
%indvars.iv63 = phi i64 [ 0, %for.cond16.preheader.us.preheader.new ], [ %indvars.iv.next64.1, %for.inc28.us.1 ]
%c.050.us = phi i32 [ 0, %for.cond16.preheader.us.preheader.new ], [ %c.1.us.1, %for.inc28.us.1 ]
%niter = phi i64 [ 0, %for.cond16.preheader.us.preheader.new ], [ %niter.next.1, %for.inc28.us.1 ]
%arrayidx20.us = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv63
%8 = load i32, ptr %arrayidx20.us, align 8, !tbaa !5
br label %for.body18.us
for.cond16.us: ; preds = %for.body18.us
%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.inc28.us, label %for.body18.us, !llvm.loop !11
for.body18.us: ; preds = %for.cond16.preheader.us, %for.cond16.us
%indvars.iv60 = phi i64 [ 0, %for.cond16.preheader.us ], [ %indvars.iv.next61, %for.cond16.us ]
%arrayidx22.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv60
%9 = load i32, ptr %arrayidx22.us, align 4, !tbaa !5
%cmp23.us = icmp eq i32 %8, %9
br i1 %cmp23.us, label %if.then.us, label %for.cond16.us
if.then.us: ; preds = %for.body18.us
%inc24.us = add nsw i32 %c.050.us, 1
br label %for.inc28.us
for.inc28.us: ; preds = %for.cond16.us, %if.then.us
%c.1.us = phi i32 [ %inc24.us, %if.then.us ], [ %c.050.us, %for.cond16.us ]
%indvars.iv.next64 = or i64 %indvars.iv63, 1
%arrayidx20.us.1 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv.next64
%10 = load i32, ptr %arrayidx20.us.1, align 4, !tbaa !5
br label %for.body18.us.1
for.body18.us.1: ; preds = %for.cond16.us.1, %for.inc28.us
%indvars.iv60.1 = phi i64 [ 0, %for.inc28.us ], [ %indvars.iv.next61.1, %for.cond16.us.1 ]
%arrayidx22.us.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv60.1
%11 = load i32, ptr %arrayidx22.us.1, align 4, !tbaa !5
%cmp23.us.1 = icmp eq i32 %10, %11
br i1 %cmp23.us.1, label %if.then.us.1, label %for.cond16.us.1
for.cond16.us.1: ; preds = %for.body18.us.1
%indvars.iv.next61.1 = add nuw nsw i64 %indvars.iv60.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next61.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc28.us.1, label %for.body18.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body18.us.1
%inc24.us.1 = add nsw i32 %c.1.us, 1
br label %for.inc28.us.1
for.inc28.us.1: ; preds = %for.cond16.us.1, %if.then.us.1
%c.1.us.1 = phi i32 [ %inc24.us.1, %if.then.us.1 ], [ %c.1.us, %for.cond16.us.1 ]
%indvars.iv.next64.1 = add nuw nsw i64 %indvars.iv63, 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.end30.loopexit.unr-lcssa, label %for.cond16.preheader.us, !llvm.loop !12
for.body6: ; preds = %for.end, %for.body6
%indvars.iv57 = phi i64 [ %indvars.iv.next58, %for.body6 ], [ 0, %for.end ]
%arrayidx8 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv57
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8)
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%12 = load i32, ptr @N2, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp5 = icmp slt i64 %indvars.iv.next58, %13
br i1 %cmp5, label %for.body6, label %for.cond13.preheader, !llvm.loop !13
for.end30.loopexit.unr-lcssa: ; preds = %for.inc28.us.1, %for.cond16.preheader.us.preheader
%c.1.us.lcssa.ph = phi i32 [ undef, %for.cond16.preheader.us.preheader ], [ %c.1.us.1, %for.inc28.us.1 ]
%indvars.iv63.unr = phi i64 [ 0, %for.cond16.preheader.us.preheader ], [ %indvars.iv.next64.1, %for.inc28.us.1 ]
%c.050.us.unr = phi i32 [ 0, %for.cond16.preheader.us.preheader ], [ %c.1.us.1, %for.inc28.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end30, label %for.cond16.preheader.us.epil
for.cond16.preheader.us.epil: ; preds = %for.end30.loopexit.unr-lcssa
%arrayidx20.us.epil = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv63.unr
%14 = load i32, ptr %arrayidx20.us.epil, align 4, !tbaa !5
br label %for.body18.us.epil
for.body18.us.epil: ; preds = %for.cond16.us.epil, %for.cond16.preheader.us.epil
%indvars.iv60.epil = phi i64 [ 0, %for.cond16.preheader.us.epil ], [ %indvars.iv.next61.epil, %for.cond16.us.epil ]
%arrayidx22.us.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv60.epil
%15 = load i32, ptr %arrayidx22.us.epil, align 4, !tbaa !5
%cmp23.us.epil = icmp eq i32 %14, %15
br i1 %cmp23.us.epil, label %if.then.us.epil, label %for.cond16.us.epil
for.cond16.us.epil: ; preds = %for.body18.us.epil
%indvars.iv.next61.epil = add nuw nsw i64 %indvars.iv60.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next61.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end30, label %for.body18.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body18.us.epil
%inc24.us.epil = add nsw i32 %c.050.us.unr, 1
br label %for.end30
for.end30: ; preds = %for.end30.loopexit.unr-lcssa, %for.cond16.us.epil, %if.then.us.epil, %for.end, %for.cond16.preheader.lr.ph, %for.cond13.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond13.preheader ], [ 0, %for.cond16.preheader.lr.ph ], [ 0, %for.end ], [ %c.1.us.lcssa.ph, %for.end30.loopexit.unr-lcssa ], [ %inc24.us.epil, %if.then.us.epil ], [ %c.050.us.unr, %for.cond16.us.epil ]
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int S(int T[],int n, int key);
int main(){
int i,n,T[10000+1],q,key,sum =0;
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&T[i]);
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&key);
if(S(T,n,key))sum++;
}
printf("%d\n",sum);
return 0;
}
int S(int T[], int n, int key){
int i = 0;
T[n] = key;
while(T[i] != key)i++;
return i !=n;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141296/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141296/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%T = alloca [10001 x i32], align 16
%q = alloca i32, align 4
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %T) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 x i32], ptr %T, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp420 = icmp sgt i32 %3, 0
br i1 %cmp420, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %S.exit
%sum.022 = phi i32 [ %spec.select, %S.exit ], [ 0, %for.end ]
%i.121 = phi i32 [ %inc10, %S.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %key, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %T, i64 %idxprom.i
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %for.body5
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %for.body5 ]
%arrayidx2.i = getelementptr inbounds i32, ptr %T, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %6, %5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %S.exit, label %while.cond.i, !llvm.loop !11
S.exit: ; preds = %while.cond.i
%7 = trunc i64 %indvars.iv.i to i32
%cmp3.i.not = icmp ne i32 %4, %7
%inc8 = zext i1 %cmp3.i.not to i32
%spec.select = add nuw nsw i32 %sum.022, %inc8
%inc10 = add nuw nsw i32 %i.121, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %S.exit, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %S.exit ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %T) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @S(ptr nocapture noundef %T, i32 noundef %n, i32 noundef %key) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds i32, ptr %T, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %T, i64 %indvars.iv
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %key
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !11
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
%cmp3 = icmp ne i32 %1, %n
%conv = zext i1 %cmp3 to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#define N 10000
#define Q 500
int main(){
int i,j,x,y;
int s[N],t[Q],a=0;
scanf("%d",&x);
for(i=0;i<x;i++){
scanf("%d",&s[i]);
}
scanf("%d",&y);
for(j=0;j<y;j++){
scanf("%d",&t[j]);
}
for(j=0;j<y;j++){
for(i=0;i<x;i++){
if(s[i]==t[j]){
a++;
break;
}
}
}
printf("%d\n",a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141346/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141346/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%s = alloca [10000 x i32], align 16
%t = alloca [500 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %x, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %y)
%3 = load i32, ptr %y, align 4, !tbaa !5
%cmp444 = icmp sgt i32 %3, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %10, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %x, align 4, !tbaa !5
%cmp1646 = icmp sgt i32 %4, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%a.051.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %a.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx21.us = getelementptr inbounds [500 x i32], ptr %t, i64 0, i64 %indvars.iv62
%6 = load i32, ptr %arrayidx21.us, align 8, !tbaa !5
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !11
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx19.us = getelementptr inbounds [10000 x i32], ptr %s, i64 0, i64 %indvars.iv59
%7 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %7, %6
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %a.051.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%a.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %a.051.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx21.us.1 = getelementptr inbounds [500 x i32], ptr %t, i64 0, i64 %indvars.iv.next63
%8 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !5
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx19.us.1 = getelementptr inbounds [10000 x i32], ptr %s, i64 0, i64 %indvars.iv59.1
%9 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !5
%cmp22.us.1 = icmp eq i32 %9, %8
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %a.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%a.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %a.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %t, i64 0, i64 %indvars.iv56
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%10 = load i32, ptr %y, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%a.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %a.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%a.051.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %a.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx21.us.epil = getelementptr inbounds [500 x i32], ptr %t, i64 0, i64 %indvars.iv62.unr
%12 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx19.us.epil = getelementptr inbounds [10000 x i32], ptr %s, i64 0, i64 %indvars.iv59.epil
%13 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp eq i32 %13, %12
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %a.051.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%a.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %a.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %a.051.us.unr, %for.cond15.us.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define N 10000
#define Q 500
int main(){
int i,n,q,j,S[N],T[Q],AI=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&S[i]);
}
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&T[i]);
}
for(i=0;i<q;i++){
for(j=0;j<n;j++){
if(S[j]==T[i]){
AI++;
break;
}
}
}
printf("%d\n",AI);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141410/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141410/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%S = alloca [10000 x i32], align 16
%T = alloca [500 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %T) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp444 = icmp sgt i32 %3, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %10, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1646 = icmp sgt i32 %4, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%AI.051.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %AI.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx21.us = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv62
%6 = load i32, ptr %arrayidx21.us, align 8, !tbaa !5
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !11
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx19.us = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv59
%7 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %7, %6
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %AI.051.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%AI.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %AI.051.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx21.us.1 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv.next63
%8 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !5
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx19.us.1 = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv59.1
%9 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !5
%cmp22.us.1 = icmp eq i32 %9, %8
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %AI.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%AI.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %AI.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv56
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%10 = load i32, ptr %q, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%AI.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %AI.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%AI.051.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %AI.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx21.us.epil = getelementptr inbounds [500 x i32], ptr %T, i64 0, i64 %indvars.iv62.unr
%12 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx19.us.epil = getelementptr inbounds [10000 x i32], ptr %S, i64 0, i64 %indvars.iv59.epil
%13 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp eq i32 %13, %12
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %AI.051.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%AI.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %AI.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %AI.051.us.unr, %for.cond15.us.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %AI.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %S) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int a[10001],n,m,x,sum=0,i,j;
int main(){
scanf("%d",&n);
for ( i = 0; i < n; ++i) scanf("%d",&a[i]);
scanf("%d",&m);
for (i = 0; i < m; ++i) {
scanf("%d",&x);
for ( j = 0; j < n; ++j)
if(x==a[j]){
sum++;
break;
}
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141490/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141490/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@sum = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@a = dso_local global [10001 x i32] zeroinitializer, align 16
@m = dso_local global i32 0, align 4
@x = dso_local global i32 0, align 4
@j = dso_local local_unnamed_addr global i32 0, align 4
@.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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
store i32 0, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp24 = icmp sgt i32 %0, 0
br i1 %cmp24, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%storemerge25 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%idxprom = sext i32 %storemerge25 to i64
%arrayidx = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %idxprom
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr @i, align 4, !tbaa !5
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @i, align 4, !tbaa !5
%2 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
store i32 0, ptr @i, align 4, !tbaa !5
%3 = load i32, ptr @m, align 4, !tbaa !5
%cmp429 = icmp sgt i32 %3, 0
br i1 %cmp429, label %for.body5, label %for.end19
for.body5: ; preds = %for.end, %for.inc17
%call6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
%4 = load i32, ptr @n, align 4, !tbaa !5
%cmp827 = icmp sgt i32 %4, 0
br i1 %cmp827, label %for.body9.lr.ph, label %for.inc17.loopexit
for.body9.lr.ph: ; preds = %for.body5
%5 = load i32, ptr @x, align 4, !tbaa !5
%wide.trip.count = zext i32 %4 to i64
br label %for.body9
for.body9: ; preds = %for.body9.lr.ph, %for.inc14
%indvars.iv = phi i64 [ 0, %for.body9.lr.ph ], [ %indvars.iv.next, %for.inc14 ]
%arrayidx11 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %indvars.iv
%6 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp eq i32 %5, %6
br i1 %cmp12, label %if.then, label %for.inc14
if.then: ; preds = %for.body9
%7 = trunc i64 %indvars.iv to i32
store i32 %7, ptr @j, align 4, !tbaa !5
%8 = load i32, ptr @sum, align 4, !tbaa !5
%inc13 = add nsw i32 %8, 1
store i32 %inc13, ptr @sum, align 4, !tbaa !5
br label %for.inc17
for.inc14: ; preds = %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.inc17.loopexit, label %for.body9, !llvm.loop !11
for.inc17.loopexit: ; preds = %for.inc14, %for.body5
%storemerge23.lcssa = phi i32 [ 0, %for.body5 ], [ %4, %for.inc14 ]
store i32 %storemerge23.lcssa, ptr @j, align 4, !tbaa !5
br label %for.inc17
for.inc17: ; preds = %for.inc17.loopexit, %if.then
%9 = load i32, ptr @i, align 4, !tbaa !5
%inc18 = add nsw i32 %9, 1
store i32 %inc18, ptr @i, align 4, !tbaa !5
%10 = load i32, ptr @m, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc18, %10
br i1 %cmp4, label %for.body5, label %for.end19, !llvm.loop !12
for.end19: ; preds = %for.inc17, %for.end
%11 = load i32, ptr @sum, align 4, !tbaa !5
%call20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
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 = !{!"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}
|
//linear search
#include<stdio.h>
#define N 10000
#define M 500
//int sear(int);
int n1 = 0;
int n2 = 0;
int main()
{
int i,j;
int arr1[N];
int arr2[M];
int count = 0;
int res = 0;
//input data(be searched)
scanf("%d",&n1);
for(i = 0;i < n1; i++)
{
scanf(" %d",&arr1[i]);
}
//input data(search data)
scanf("%d",&n2);
for(j = 0;j < n2; j++)
{
scanf(" %d",&arr2[j]);
}
//search time
for(j = 0; j < n2;)
{
for(i = 0; i < n1;)
{
if(arr1[i] == arr2[j])
{
count++;
j++;
break;
}
else if(arr1[i] != arr2[j])
{
i++;
}
if(i == n1) j++;
}
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141533/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141533/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n1 = dso_local global i32 0, align 4
@n2 = 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 [4 x i8] c" %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%arr1 = alloca [10000 x i32], align 16
%arr2 = alloca [500 x i32], align 16
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %arr1) #3
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %arr2) #3
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n1)
%0 = load i32, ptr @n1, align 4, !tbaa !5
%cmp56 = icmp sgt i32 %0, 0
br i1 %cmp56, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %arr1, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n1, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n2)
%3 = load i32, ptr @n2, align 4, !tbaa !5
%cmp458 = icmp sgt i32 %3, 0
br i1 %cmp458, label %for.body5, label %for.end38
for.cond12.preheader: ; preds = %for.body5
%cmp1364 = icmp sgt i32 %8, 0
br i1 %cmp1364, label %for.cond15.preheader.lr.ph, label %for.end38
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr @n1, align 4, !tbaa !5
%cmp1660 = icmp sgt i32 %4, 0
br i1 %cmp1660, label %for.cond15.preheader.us.preheader, label %for.cond15.preheader
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%5 = zext i32 %4 to i64
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.cond15.preheader.us.preheader, %for.end37.us
%count.066.us = phi i32 [ %count.1.us, %for.end37.us ], [ 0, %for.cond15.preheader.us.preheader ]
%j.165.us = phi i32 [ %j.4.us, %for.end37.us ], [ 0, %for.cond15.preheader.us.preheader ]
br label %for.body17.us
for.body17.us: ; preds = %for.cond15.preheader.us, %if.then30.us
%indvars.iv74 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next75, %if.then30.us ]
%j.261.us = phi i32 [ %j.165.us, %for.cond15.preheader.us ], [ %j.3.us, %if.then30.us ]
%arrayidx19.us = getelementptr inbounds [10000 x i32], ptr %arr1, i64 0, i64 %indvars.iv74
%6 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
%idxprom20.us = sext i32 %j.261.us to i64
%arrayidx21.us = getelementptr inbounds [500 x i32], ptr %arr2, i64 0, i64 %idxprom20.us
%7 = load i32, ptr %arrayidx21.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %6, %7
br i1 %cmp22.us, label %if.then.us, label %if.then30.us
if.then30.us: ; preds = %for.body17.us
%indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
%cmp33.us = icmp eq i64 %indvars.iv.next75, %5
%inc35.us = zext i1 %cmp33.us to i32
%j.3.us = add nsw i32 %j.261.us, %inc35.us
%exitcond.not = icmp eq i64 %indvars.iv.next75, %5
br i1 %exitcond.not, label %for.end37.us, label %for.body17.us, !llvm.loop !11
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %count.066.us, 1
%inc24.us = add nsw i32 %j.261.us, 1
br label %for.end37.us
for.end37.us: ; preds = %if.then30.us, %if.then.us
%j.4.us = phi i32 [ %inc24.us, %if.then.us ], [ %j.3.us, %if.then30.us ]
%count.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %count.066.us, %if.then30.us ]
%cmp13.us = icmp slt i32 %j.4.us, %8
br i1 %cmp13.us, label %for.cond15.preheader.us, label %for.end38, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %arr2, i64 0, i64 %indvars.iv71
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx7)
%indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
%8 = load i32, ptr @n2, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp4 = icmp slt i64 %indvars.iv.next72, %9
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.cond15.preheader: ; preds = %for.cond15.preheader.lr.ph, %for.cond15.preheader
br label %for.cond15.preheader
for.end38: ; preds = %for.end37.us, %for.end, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.end ], [ %count.1.us, %for.end37.us ]
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %arr2) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %arr1) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main()
{
int n[10000];
int q[500];
int i=0,k,a,b,count=0;
//入力
scanf("%d",&a);
for(k=0;k<a;k++)
{
scanf("%d",&n[k]);
}
scanf("%d",&i);
for(k=0;k<i;k++)
{
scanf("%d",&q[k]);
}
//数値の探索
for(k=0;k<i;k++)
{
for(b=0;b<a;b++)
{
if(q[k]==n[b])
{
count++;
break;
}
}
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141577/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141577/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10000 x i32], align 16
%q = alloca [500 x i32], align 16
%i = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #3
store i32 0, ptr %i, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %n, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%3 = load i32, ptr %i, align 4, !tbaa !5
%cmp444 = icmp sgt i32 %3, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %10, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %a, align 4, !tbaa !5
%cmp1646 = icmp sgt i32 %4, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%count.051.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %count.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx19.us = getelementptr inbounds [500 x i32], ptr %q, i64 0, i64 %indvars.iv62
%6 = load i32, ptr %arrayidx19.us, align 8, !tbaa !5
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !11
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx21.us = getelementptr inbounds [10000 x i32], ptr %n, i64 0, i64 %indvars.iv59
%7 = load i32, ptr %arrayidx21.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %6, %7
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %count.051.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%count.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %count.051.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx19.us.1 = getelementptr inbounds [500 x i32], ptr %q, i64 0, i64 %indvars.iv.next63
%8 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !5
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx21.us.1 = getelementptr inbounds [10000 x i32], ptr %n, i64 0, i64 %indvars.iv59.1
%9 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !5
%cmp22.us.1 = icmp eq i32 %8, %9
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %count.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%count.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %count.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %q, i64 0, i64 %indvars.iv56
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%10 = load i32, ptr %i, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%count.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %count.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%count.051.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %count.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx19.us.epil = getelementptr inbounds [500 x i32], ptr %q, i64 0, i64 %indvars.iv62.unr
%12 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !5
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx21.us.epil = getelementptr inbounds [10000 x i32], ptr %n, i64 0, i64 %indvars.iv59.epil
%13 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp eq i32 %12, %13
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %count.051.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %count.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %count.051.us.unr, %for.cond15.us.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #3
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main ()
{
unsigned int k2;
unsigned int k3;
unsigned int k5;
unsigned int k6;
unsigned int c256;
unsigned int c32;
scanf ("%u %u %u %u",&k2,&k3,&k5,&k6);
if (k2 <= k5 && k2 <= k6)
c256 = k2;
else if (k5 <= k2 && k5 <= k6)
c256 = k5;
else
c256 = k6;
k2 -= c256;
if (k2 <= k3)
c32 = k2;
else
c32 = k3;
printf ("%u\n",c256*256+c32*32);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14162/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14162/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%u %u %u %u\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%u\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k2 = alloca i32, align 4
%k3 = alloca i32, align 4
%k5 = alloca i32, align 4
%k6 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k3) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k5) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k6) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k2, ptr noundef nonnull %k3, ptr noundef nonnull %k5, ptr noundef nonnull %k6)
%0 = load i32, ptr %k2, align 4, !tbaa !5
%1 = load i32, ptr %k5, align 4, !tbaa !5
%cmp.not = icmp ugt i32 %0, %1
%2 = load i32, ptr %k6, align 4
%cmp1.not = icmp ugt i32 %0, %2
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp1.not
%cmp2.not = icmp ugt i32 %1, %0
%cmp4.not = icmp ugt i32 %1, %2
%or.cond17 = select i1 %cmp2.not, i1 true, i1 %cmp4.not
%spec.select = select i1 %or.cond17, i32 %2, i32 %1
%c256.0 = select i1 %or.cond, i32 %spec.select, i32 %0
%sub = sub i32 %0, %c256.0
store i32 %sub, ptr %k2, align 4, !tbaa !5
%3 = load i32, ptr %k3, align 4, !tbaa !5
%.sub = call i32 @llvm.umin.i32(i32 %sub, i32 %3)
%mul = shl i32 %c256.0, 8
%mul12 = shl i32 %.sub, 5
%add = add i32 %mul12, %mul
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k6) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k5) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k3) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k2) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.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 <stdlib.h>
#include <stdio.h>
int search(int *,int *,int,int);
int main(){
int i,n,q,*S,*T,count;
scanf("%d",&n);
S=(int *)malloc((n+1)*sizeof(int));
for(i=0;i<n;i++){
scanf("%d",&S[i]);
}
scanf("%d",&q);
T=(int *)malloc(q*sizeof(int));
for(i=0;i<q;i++){
scanf("%d",&T[i]);
}
count=search(S,T,n,q);
printf("%d\n",count);
free(S);
free(T);
return 0;
}
int search(int *S,int *T,int n,int q){
int i, j=n,count=0;
for(i=0;i<q;i++){
if(j!=n){
count++;
}
j=0;
S[n]=T[i];
while(S[j]!=S[n]){
j++;
if(j==n) break;
}
}
if(j!=n){
count++;
}
return count;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141663/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141663/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp30 = icmp sgt i32 %0, 0
br i1 %cmp30, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%conv5 = sext i32 %3 to i64
%mul6 = shl nsw i64 %conv5, 2
%call7 = call noalias ptr @malloc(i64 noundef %mul6) #7
%cmp932 = icmp sgt i32 %3, 0
br i1 %cmp932, label %for.body11, label %for.end17.thread
for.end17.thread: ; preds = %for.end
%4 = load i32, ptr %n, align 4, !tbaa !5
br label %search.exit
for.body11: ; preds = %for.end, %for.body11
%indvars.iv36 = phi i64 [ %indvars.iv.next37, %for.body11 ], [ 0, %for.end ]
%arrayidx13 = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv36
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx13)
%indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
%.pr = load i32, ptr %q, align 4, !tbaa !5
%5 = sext i32 %.pr to i64
%cmp9 = icmp slt i64 %indvars.iv.next37, %5
br i1 %cmp9, label %for.body11, label %for.end17, !llvm.loop !11
for.end17: ; preds = %for.body11
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp34.i = icmp sgt i32 %.pr, 0
br i1 %cmp34.i, label %for.body.lr.ph.i, label %search.exit
for.body.lr.ph.i: ; preds = %for.end17
%idxprom2.i = sext i32 %6 to i64
%arrayidx3.i = getelementptr inbounds i32, ptr %call1, i64 %idxprom2.i
%7 = zext i32 %6 to i64
%wide.trip.count.i = zext i32 %.pr to i64
br label %for.body.i
for.body.i: ; preds = %for.inc.i, %for.body.lr.ph.i
%indvars.iv40.i = phi i64 [ 0, %for.body.lr.ph.i ], [ %indvars.iv.next41.i, %for.inc.i ]
%count.037.i = phi i32 [ 0, %for.body.lr.ph.i ], [ %spec.select.i, %for.inc.i ]
%j.036.i = phi i32 [ %6, %for.body.lr.ph.i ], [ %j.2.i, %for.inc.i ]
%cmp1.not.i = icmp ne i32 %j.036.i, %6
%inc.i = zext i1 %cmp1.not.i to i32
%spec.select.i = add nuw nsw i32 %count.037.i, %inc.i
%arrayidx.i = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv40.i
%8 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
store i32 %8, ptr %arrayidx3.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.body.i, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.body.i ], [ 0, %for.body.i ]
%arrayidx5.i = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.i
%9 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp8.not.i = icmp eq i32 %9, %8
br i1 %cmp8.not.i, label %for.inc.split.loop.exit.i, label %while.body.i
while.body.i: ; preds = %while.cond.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%cmp10.i = icmp eq i64 %indvars.iv.next.i, %7
br i1 %cmp10.i, label %for.inc.i, label %while.cond.i, !llvm.loop !12
for.inc.split.loop.exit.i: ; preds = %while.cond.i
%10 = trunc i64 %indvars.iv.i to i32
br label %for.inc.i
for.inc.i: ; preds = %while.body.i, %for.inc.split.loop.exit.i
%j.2.i = phi i32 [ %10, %for.inc.split.loop.exit.i ], [ %6, %while.body.i ]
%indvars.iv.next41.i = add nuw nsw i64 %indvars.iv40.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next41.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %search.exit, label %for.body.i, !llvm.loop !13
search.exit: ; preds = %for.inc.i, %for.end17.thread, %for.end17
%11 = phi i32 [ %6, %for.end17 ], [ %4, %for.end17.thread ], [ %6, %for.inc.i ]
%j.0.lcssa.i = phi i32 [ %6, %for.end17 ], [ %4, %for.end17.thread ], [ %j.2.i, %for.inc.i ]
%count.0.lcssa.i = phi i32 [ 0, %for.end17 ], [ 0, %for.end17.thread ], [ %spec.select.i, %for.inc.i ]
%cmp14.not.i = icmp ne i32 %j.0.lcssa.i, %11
%inc16.i = zext i1 %cmp14.not.i to i32
%spec.select33.i = add nsw i32 %count.0.lcssa.i, %inc16.i
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select33.i)
call void @free(ptr noundef %call1) #6
call void @free(ptr noundef %call7) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @search(ptr nocapture noundef %S, ptr nocapture noundef readonly %T, i32 noundef %n, i32 noundef %q) local_unnamed_addr #4 {
entry:
%cmp34 = icmp sgt i32 %q, 0
br i1 %cmp34, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%idxprom2 = sext i32 %n to i64
%arrayidx3 = getelementptr inbounds i32, ptr %S, i64 %idxprom2
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %q to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv40 = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next41, %for.inc ]
%count.037 = phi i32 [ 0, %for.body.lr.ph ], [ %spec.select, %for.inc ]
%j.036 = phi i32 [ %n, %for.body.lr.ph ], [ %j.2, %for.inc ]
%cmp1.not = icmp ne i32 %j.036, %n
%inc = zext i1 %cmp1.not to i32
%spec.select = add nuw nsw i32 %count.037, %inc
%arrayidx = getelementptr inbounds i32, ptr %T, i64 %indvars.iv40
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
store i32 %1, ptr %arrayidx3, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.body, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %for.body ]
%arrayidx5 = getelementptr inbounds i32, ptr %S, i64 %indvars.iv
%2 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp8.not = icmp eq i32 %2, %1
br i1 %cmp8.not, label %for.inc.split.loop.exit, label %while.body
while.body: ; preds = %while.cond
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%cmp10 = icmp eq i64 %indvars.iv.next, %0
br i1 %cmp10, label %for.inc, label %while.cond, !llvm.loop !12
for.inc.split.loop.exit: ; preds = %while.cond
%3 = trunc i64 %indvars.iv to i32
br label %for.inc
for.inc: ; preds = %while.body, %for.inc.split.loop.exit
%j.2 = phi i32 [ %3, %for.inc.split.loop.exit ], [ %n, %while.body ]
%indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
%exitcond.not = icmp eq i64 %indvars.iv.next41, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.inc, %entry
%j.0.lcssa = phi i32 [ %n, %entry ], [ %j.2, %for.inc ]
%count.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.inc ]
%cmp14.not = icmp ne i32 %j.0.lcssa, %n
%inc16 = zext i1 %cmp14.not to i32
%spec.select33 = add nsw i32 %count.0.lcssa, %inc16
ret i32 %spec.select33
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#define N 10000
int main(){
int n1,n2,i,j,c=0;
int in[N],serch[N];
scanf("%d",&n1);
for(i=0;i<n1;i++){
scanf("%d",&in[i]);
}
scanf("%d",&n2);
for(i=0;i<n2;i++){
scanf("%d",&serch[i]);
}
for(i=0;i<n2;i++){
for(j=0;j<n1;j++){
if( in[j]==serch[i]){
c++;
break;
}
}
}
printf("%d\n",c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141706/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141706/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%n1 = alloca i32, align 4
%n2 = alloca i32, align 4
%in = alloca [10000 x i32], align 16
%serch = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n2) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %in) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %serch) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n1)
%0 = load i32, ptr %n1, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %in, 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 %n1, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n2)
%3 = load i32, ptr %n2, align 4, !tbaa !5
%cmp444 = icmp sgt i32 %3, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %10, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %n1, align 4, !tbaa !5
%cmp1646 = icmp sgt i32 %4, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%c.051.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %c.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx21.us = getelementptr inbounds [10000 x i32], ptr %serch, i64 0, i64 %indvars.iv62
%6 = load i32, ptr %arrayidx21.us, align 8, !tbaa !5
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !11
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx19.us = getelementptr inbounds [10000 x i32], ptr %in, i64 0, i64 %indvars.iv59
%7 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %7, %6
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %c.051.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%c.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %c.051.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx21.us.1 = getelementptr inbounds [10000 x i32], ptr %serch, i64 0, i64 %indvars.iv.next63
%8 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !5
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx19.us.1 = getelementptr inbounds [10000 x i32], ptr %in, i64 0, i64 %indvars.iv59.1
%9 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !5
%cmp22.us.1 = icmp eq i32 %9, %8
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %c.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%c.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %c.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [10000 x i32], ptr %serch, i64 0, i64 %indvars.iv56
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%10 = load i32, ptr %n2, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%c.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %c.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%c.051.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %c.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx21.us.epil = getelementptr inbounds [10000 x i32], ptr %serch, i64 0, i64 %indvars.iv62.unr
%12 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx19.us.epil = getelementptr inbounds [10000 x i32], ptr %in, i64 0, i64 %indvars.iv59.epil
%13 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp eq i32 %13, %12
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %c.051.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %c.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %c.051.us.unr, %for.cond15.us.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %serch) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %in) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n1) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main()
{
int i,sum=0,a[4],min=10000000;
for(i=0;i<4;i++)
{
scanf("%d",&a[i]);
if(i!=1 && a[i]<min)
min=a[i];
}
sum=256*min;
a[0]=a[0]-min;
while(a[0]!=0 && a[1]!=0)
{
sum=sum+32;
a[0]--; a[1]--;
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14175/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14175/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 {
for.inc.3:
%a = alloca [4 x i32], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 16, !tbaa !5
%arrayidx.1 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%arrayidx.2 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%1 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%spec.select = call i32 @llvm.smin.i32(i32 %0, i32 %1)
%arrayidx.3 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 3
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3)
%2 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%spec.select.2 = call i32 @llvm.smin.i32(i32 %spec.select, i32 %2)
%spec.select.3 = call i32 @llvm.smin.i32(i32 %spec.select.2, i32 10000000)
%mul = shl i32 %spec.select.3, 8
%3 = load i32, ptr %a, align 16, !tbaa !5
%sub = sub nsw i32 %3, %spec.select.3
store i32 %sub, ptr %a, align 16, !tbaa !5
%arrayidx11.promoted = load i32, ptr %arrayidx.1, align 4
%arrayidx11.promoted.fr = freeze i32 %arrayidx11.promoted
%cmp1030 = icmp ne i32 %3, %spec.select.3
%cmp1231 = icmp ne i32 %arrayidx11.promoted.fr, 0
%4 = and i1 %cmp1030, %cmp1231
br i1 %4, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %for.inc.3
%5 = add i32 %arrayidx11.promoted.fr, -1
%6 = xor i32 %spec.select.3, -1
%7 = add i32 %3, %6
%umin = call i32 @llvm.umin.i32(i32 %5, i32 %7)
%8 = shl i32 %umin, 5
%9 = add i32 %mul, %8
%10 = add i32 %9, 32
%11 = sub i32 %7, %umin
%12 = sub i32 %5, %umin
store i32 %11, ptr %a, align 16, !tbaa !5
store i32 %12, ptr %arrayidx.1, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.body.preheader, %for.inc.3
%sum.0.lcssa = phi i32 [ %10, %while.body.preheader ], [ %mul, %for.inc.3 ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 16, 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.smin.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.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 linearSearch(int A[], int n, int key) {
int i;
int cnt = 0;
for (i = 0; i < n; i++) {
if (A[i] == key) return 1;
}
return 0;
}
int main() {
int i;
int n, q;
int S[10005], T[505];
int ans = 0;
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d", &S[i]);
}
scanf("%d", &q);
for (i = 0; i < q; i++) {
scanf("%d", &T[i]);
if (linearSearch(S, n, T[i]) == 1) ans++;
}
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141793/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141793/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @linearSearch(ptr nocapture noundef readonly %A, i32 noundef %n, i32 noundef %key) local_unnamed_addr #0 {
entry:
%cmp5 = icmp sgt i32 %n, 0
br i1 %cmp5, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !7
%cmp1 = icmp eq i32 %0, %key
br i1 %cmp1, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%S = alloca [10005 x i32], align 16
%T = alloca [505 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 40020, ptr nonnull %S) #4
call void @llvm.lifetime.start.p0(i64 2020, ptr nonnull %T) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp28 = icmp sgt i32 %0, 0
br i1 %cmp28, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10005 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !7
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !7
%cmp430 = icmp sgt i32 %3, 0
br i1 %cmp430, label %for.body5, label %for.end16
for.body5: ; preds = %for.end, %for.cond3
%indvars.iv34 = phi i64 [ %indvars.iv.next35, %for.cond3 ], [ 0, %for.end ]
%ans.032 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [505 x i32], ptr %T, i64 0, i64 %indvars.iv34
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%4 = load i32, ptr %n, align 4, !tbaa !7
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !7
%cmp5.i = icmp sgt i32 %4, 0
br i1 %cmp5.i, label %for.body.preheader.i, label %for.cond3
for.body.preheader.i: ; preds = %for.body5
%wide.trip.count.i = zext i32 %4 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %for.cond3, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.cond.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %S, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !7
%cmp1.i = icmp eq i32 %6, %5
br i1 %cmp1.i, label %linearSearch.exit, label %for.cond.i
linearSearch.exit: ; preds = %for.body.i
%inc13 = add nsw i32 %ans.032, 1
br label %for.cond3
for.cond3: ; preds = %for.cond.i, %for.body5, %linearSearch.exit
%7 = phi i32 [ %inc13, %linearSearch.exit ], [ %ans.032, %for.body5 ], [ %ans.032, %for.cond.i ]
%indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
%8 = load i32, ptr %q, align 4, !tbaa !7
%9 = sext i32 %8 to i64
%cmp4 = icmp slt i64 %indvars.iv.next35, %9
br i1 %cmp4, label %for.body5, label %for.end16, !llvm.loop !12
for.end16: ; preds = %for.cond3, %for.end
%ans.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2020, ptr nonnull %T) #4
call void @llvm.lifetime.end.p0(i64 40020, ptr nonnull %S) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
|
#include <stdio.h>
int search(int A[], int n, int key) {
int i = 0; A[n] = key;
while(A[i] != key) i++;
return i != n;
}
int main(void) {
int i, n, A[10000+1], q, key, sum = 0;
scanf("%d",&n);
for(i=0; i<n; i++) scanf("%d", &A[i]);
scanf("%d",&q);
for(i=0; i<q; i++) {
scanf("%d", &key);
if(search(A, n, key))sum++;
}
printf("%d\n", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141836/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141836/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @search(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %key) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %key
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !9
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
%cmp3 = icmp ne i32 %1, %n
%conv = zext i1 %cmp3 to i32
ret i32 %conv
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%A = alloca [10001 x i32], align 16
%q = alloca i32, align 4
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp420 = icmp sgt i32 %3, 0
br i1 %cmp420, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %search.exit
%sum.022 = phi i32 [ %spec.select, %search.exit ], [ 0, %for.end ]
%i.121 = phi i32 [ %inc10, %search.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %key, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %idxprom.i
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %for.body5
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %for.body5 ]
%arrayidx2.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %6, %5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %search.exit, label %while.cond.i, !llvm.loop !9
search.exit: ; preds = %while.cond.i
%7 = trunc i64 %indvars.iv.i to i32
%cmp3.i.not = icmp ne i32 %4, %7
%inc8 = zext i1 %cmp3.i.not to i32
%spec.select = add nuw nsw i32 %sum.022, %inc8
%inc10 = add nuw nsw i32 %i.121, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %search.exit, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %search.exit ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main()
{
long long a,b,c,d,e,f,min;
scanf("%I64d %I64d %I64d %I64d",&a,&b,&c,&d);
if(a<d)
min=a;
else
min=d;
if(min>c)
min=c;
e=min*256;
a=a-min;
c=c-min;
d=d-min;
if(a<b)
f=a;
else
f=b;
e=e+f*32;
printf("%I64d\n",e);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14188/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14188/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%I64d %I64d %I64d %I64d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%I64d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
%d = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %d, align 8, !tbaa !5
%. = call i64 @llvm.smin.i64(i64 %0, i64 %1)
%2 = load i64, ptr %c, align 8, !tbaa !5
%min.1 = call i64 @llvm.smin.i64(i64 %., i64 %2)
%sub = sub nsw i64 %0, %min.1
store i64 %sub, ptr %a, align 8, !tbaa !5
%sub4 = sub nsw i64 %2, %min.1
store i64 %sub4, ptr %c, align 8, !tbaa !5
%sub5 = sub nsw i64 %1, %min.1
store i64 %sub5, ptr %d, align 8, !tbaa !5
%3 = load i64, ptr %b, align 8, !tbaa !5
%f.0 = call i64 @llvm.smin.i64(i64 %sub, i64 %3)
%mul = shl nsw i64 %min.1, 8
%mul10 = shl nsw i64 %f.0, 5
%add = add nsw i64 %mul10, %mul
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, 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 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<stdio.h>
int linearSearch(int *, int, int);
int main(){
int i,n,q,S[10000+1],key,cnt=0;
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d",&S[i]);
}
scanf("%d",&q);
for(i=0; i<q; i++){
scanf("%d",&key);
if(linearSearch(S, n, key)) cnt++;
}
printf("%d\n",cnt);
return 0;
}
int linearSearch(int A[], int n, int key){
int i = 0;
A[n] = key;
while(A[i] != key) i++;
return i != n;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141922/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141922/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%S = alloca [10001 x i32], align 16
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %S) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp420 = icmp sgt i32 %3, 0
br i1 %cmp420, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %linearSearch.exit
%cnt.022 = phi i32 [ %spec.select, %linearSearch.exit ], [ 0, %for.end ]
%i.121 = phi i32 [ %inc10, %linearSearch.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %key, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %S, i64 %idxprom.i
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %for.body5
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %for.body5 ]
%arrayidx2.i = getelementptr inbounds i32, ptr %S, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %6, %5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %linearSearch.exit, label %while.cond.i, !llvm.loop !11
linearSearch.exit: ; preds = %while.cond.i
%7 = trunc i64 %indvars.iv.i to i32
%cmp3.i.not = icmp ne i32 %4, %7
%inc8 = zext i1 %cmp3.i.not to i32
%spec.select = add nuw nsw i32 %cnt.022, %inc8
%inc10 = add nuw nsw i32 %i.121, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %linearSearch.exit, %for.end
%cnt.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %linearSearch.exit ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %S) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @linearSearch(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %key) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %key
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !11
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
%cmp3 = icmp ne i32 %1, %n
%conv = zext i1 %cmp3 to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int search(int *, int, int);
int main(){
int i, n, A[10000+1], q, key, sum = 0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d", &key);
if(search(A, n, key)) sum++;
}
printf("%d\n",sum);
return 0;
}
int search(int A[], int n, int key){
int i=0;
A[n] = key;
while(A[i] != key) i++;
return i != n;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_141966/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_141966/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10001 x i32], align 16
%q = alloca i32, align 4
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp420 = icmp sgt i32 %3, 0
br i1 %cmp420, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %search.exit
%sum.022 = phi i32 [ %spec.select, %search.exit ], [ 0, %for.end ]
%i.121 = phi i32 [ %inc10, %search.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %key, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %idxprom.i
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %for.body5
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %for.body5 ]
%arrayidx2.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %6, %5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %search.exit, label %while.cond.i, !llvm.loop !11
search.exit: ; preds = %while.cond.i
%7 = trunc i64 %indvars.iv.i to i32
%cmp3.i.not = icmp ne i32 %4, %7
%inc8 = zext i1 %cmp3.i.not to i32
%spec.select = add nuw nsw i32 %sum.022, %inc8
%inc10 = add nuw nsw i32 %i.121, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %search.exit, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %search.exit ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @search(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %key) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
store i32 %key, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, %key
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !11
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
%cmp3 = icmp ne i32 %1, %n
%conv = zext i1 %cmp3 to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(){
int n,m,i,j,c=0;
scanf("%d",&n);
int S[n];
for(i=0; i < n; i++){
scanf("%d",&S[i]);
}
scanf("%d",&m);
int T[m];
for(i=0; i < n; i++){
scanf("%d",&T[i]);
}
for(i=0; i < n; i++){
for(j=0; j < m; j++){
if(S[i] == T[j]){
T[j] = -1;
c++;
}
}
}
printf("%d\n",c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142015/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142015/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
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)
%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
%cmp46 = icmp sgt i32 %3, 0
br i1 %cmp46, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%6 = load i32, ptr %m, align 4, !tbaa !5
%7 = zext i32 %6 to i64
%vla3 = alloca i32, i64 %7, align 16
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp548 = icmp sgt i32 %8, 0
br i1 %cmp548, label %for.body6, label %for.end32
for.cond13.preheader: ; preds = %for.body6
%cmp1454 = icmp sgt i32 %44, 0
br i1 %cmp1454, label %for.cond16.preheader.lr.ph, label %for.end32
for.cond16.preheader.lr.ph: ; preds = %for.cond13.preheader
%9 = load i32, ptr %m, align 4, !tbaa !5
%cmp1750 = icmp sgt i32 %9, 0
br i1 %cmp1750, label %for.cond16.preheader.us.preheader, label %for.end32
for.cond16.preheader.us.preheader: ; preds = %for.cond16.preheader.lr.ph
%wide.trip.count70 = zext i32 %44 to i64
%wide.trip.count = zext i32 %9 to i64
%min.iters.check = icmp ult i32 %9, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.cond16.preheader.us
for.cond16.preheader.us: ; preds = %for.cond16.preheader.us.preheader, %for.cond16.for.inc30_crit_edge.us
%indvars.iv67 = phi i64 [ 0, %for.cond16.preheader.us.preheader ], [ %indvars.iv.next68, %for.cond16.for.inc30_crit_edge.us ]
%c.055.us = phi i32 [ 0, %for.cond16.preheader.us.preheader ], [ %c.2.us.lcssa, %for.cond16.for.inc30_crit_edge.us ]
%arrayidx20.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv67
%10 = load i32, ptr %arrayidx20.us, align 4, !tbaa !5
br i1 %min.iters.check, label %for.body18.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond16.preheader.us
%11 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %c.055.us, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %10, 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 = %pred.store.continue89, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue89 ]
%vec.phi = phi <4 x i32> [ %11, %vector.ph ], [ %predphi, %pred.store.continue89 ]
%vec.phi74 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi90, %pred.store.continue89 ]
%12 = or i64 %index, 4
%13 = getelementptr inbounds i32, ptr %vla3, i64 %index
%wide.load = load <4 x i32>, ptr %13, align 16, !tbaa !5
%14 = getelementptr inbounds i32, ptr %13, i64 4
%wide.load75 = load <4 x i32>, ptr %14, align 16, !tbaa !5
%15 = icmp eq <4 x i32> %broadcast.splat, %wide.load
%16 = icmp eq <4 x i32> %broadcast.splat, %wide.load75
%17 = extractelement <4 x i1> %15, i64 0
br i1 %17, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body
%18 = getelementptr inbounds i32, ptr %vla3, i64 %index
store i32 -1, ptr %18, align 16, !tbaa !5
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body
%19 = extractelement <4 x i1> %15, i64 1
br i1 %19, label %pred.store.if76, label %pred.store.continue77
pred.store.if76: ; preds = %pred.store.continue
%20 = or i64 %index, 1
%21 = getelementptr inbounds i32, ptr %vla3, i64 %20
store i32 -1, ptr %21, align 4, !tbaa !5
br label %pred.store.continue77
pred.store.continue77: ; preds = %pred.store.if76, %pred.store.continue
%22 = extractelement <4 x i1> %15, i64 2
br i1 %22, label %pred.store.if78, label %pred.store.continue79
pred.store.if78: ; preds = %pred.store.continue77
%23 = or i64 %index, 2
%24 = getelementptr inbounds i32, ptr %vla3, i64 %23
store i32 -1, ptr %24, align 8, !tbaa !5
br label %pred.store.continue79
pred.store.continue79: ; preds = %pred.store.if78, %pred.store.continue77
%25 = extractelement <4 x i1> %15, i64 3
br i1 %25, label %pred.store.if80, label %pred.store.continue81
pred.store.if80: ; preds = %pred.store.continue79
%26 = or i64 %index, 3
%27 = getelementptr inbounds i32, ptr %vla3, i64 %26
store i32 -1, ptr %27, align 4, !tbaa !5
br label %pred.store.continue81
pred.store.continue81: ; preds = %pred.store.if80, %pred.store.continue79
%28 = extractelement <4 x i1> %16, i64 0
br i1 %28, label %pred.store.if82, label %pred.store.continue83
pred.store.if82: ; preds = %pred.store.continue81
%29 = getelementptr inbounds i32, ptr %vla3, i64 %12
store i32 -1, ptr %29, align 16, !tbaa !5
br label %pred.store.continue83
pred.store.continue83: ; preds = %pred.store.if82, %pred.store.continue81
%30 = extractelement <4 x i1> %16, i64 1
br i1 %30, label %pred.store.if84, label %pred.store.continue85
pred.store.if84: ; preds = %pred.store.continue83
%31 = or i64 %index, 5
%32 = getelementptr inbounds i32, ptr %vla3, i64 %31
store i32 -1, ptr %32, align 4, !tbaa !5
br label %pred.store.continue85
pred.store.continue85: ; preds = %pred.store.if84, %pred.store.continue83
%33 = extractelement <4 x i1> %16, i64 2
br i1 %33, label %pred.store.if86, label %pred.store.continue87
pred.store.if86: ; preds = %pred.store.continue85
%34 = or i64 %index, 6
%35 = getelementptr inbounds i32, ptr %vla3, i64 %34
store i32 -1, ptr %35, align 8, !tbaa !5
br label %pred.store.continue87
pred.store.continue87: ; preds = %pred.store.if86, %pred.store.continue85
%36 = extractelement <4 x i1> %16, i64 3
br i1 %36, label %pred.store.if88, label %pred.store.continue89
pred.store.if88: ; preds = %pred.store.continue87
%37 = or i64 %index, 7
%38 = getelementptr inbounds i32, ptr %vla3, i64 %37
store i32 -1, ptr %38, align 4, !tbaa !5
br label %pred.store.continue89
pred.store.continue89: ; preds = %pred.store.if88, %pred.store.continue87
%39 = zext <4 x i1> %15 to <4 x i32>
%predphi = add <4 x i32> %vec.phi, %39
%40 = zext <4 x i1> %16 to <4 x i32>
%predphi90 = add <4 x i32> %vec.phi74, %40
%index.next = add nuw i64 %index, 8
%41 = icmp eq i64 %index.next, %n.vec
br i1 %41, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %pred.store.continue89
%bin.rdx = add <4 x i32> %predphi90, %predphi
%42 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond16.for.inc30_crit_edge.us, label %for.body18.us.preheader
for.body18.us.preheader: ; preds = %for.cond16.preheader.us, %middle.block
%indvars.iv64.ph = phi i64 [ 0, %for.cond16.preheader.us ], [ %n.vec, %middle.block ]
%c.151.us.ph = phi i32 [ %c.055.us, %for.cond16.preheader.us ], [ %42, %middle.block ]
br label %for.body18.us
for.body18.us: ; preds = %for.body18.us.preheader, %for.inc27.us
%indvars.iv64 = phi i64 [ %indvars.iv.next65, %for.inc27.us ], [ %indvars.iv64.ph, %for.body18.us.preheader ]
%c.151.us = phi i32 [ %c.2.us, %for.inc27.us ], [ %c.151.us.ph, %for.body18.us.preheader ]
%arrayidx22.us = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv64
%43 = load i32, ptr %arrayidx22.us, align 4, !tbaa !5
%cmp23.us = icmp eq i32 %10, %43
br i1 %cmp23.us, label %if.then.us, label %for.inc27.us
if.then.us: ; preds = %for.body18.us
store i32 -1, ptr %arrayidx22.us, align 4, !tbaa !5
%inc26.us = add nsw i32 %c.151.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %if.then.us, %for.body18.us
%c.2.us = phi i32 [ %inc26.us, %if.then.us ], [ %c.151.us, %for.body18.us ]
%indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
%exitcond.not = icmp eq i64 %indvars.iv.next65, %wide.trip.count
br i1 %exitcond.not, label %for.cond16.for.inc30_crit_edge.us, label %for.body18.us, !llvm.loop !14
for.cond16.for.inc30_crit_edge.us: ; preds = %for.inc27.us, %middle.block
%c.2.us.lcssa = phi i32 [ %42, %middle.block ], [ %c.2.us, %for.inc27.us ]
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
%exitcond71.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count70
br i1 %exitcond71.not, label %for.end32, label %for.cond16.preheader.us, !llvm.loop !15
for.body6: ; preds = %for.end, %for.body6
%indvars.iv61 = phi i64 [ %indvars.iv.next62, %for.body6 ], [ 0, %for.end ]
%arrayidx8 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv61
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8)
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%44 = load i32, ptr %n, align 4, !tbaa !5
%45 = sext i32 %44 to i64
%cmp5 = icmp slt i64 %indvars.iv.next62, %45
br i1 %cmp5, label %for.body6, label %for.cond13.preheader, !llvm.loop !16
for.end32: ; preds = %for.cond16.for.inc30_crit_edge.us, %for.end, %for.cond16.preheader.lr.ph, %for.cond13.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond13.preheader ], [ 0, %for.cond16.preheader.lr.ph ], [ 0, %for.end ], [ %c.2.us.lcssa, %for.cond16.for.inc30_crit_edge.us ]
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
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 nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = 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}
|
#include <stdio.h>
#include <math.h>
int main(void)
{
int num = 0, numa, numb, key, i, j;
int a[20000], b[600];
scanf("%d", &numa);
for (i = 0; i < numa; i++) {
scanf("%d", &a[i]);
}
scanf("%d", &numb);
for (i = 0; i < numb; i++) {
scanf("%d", &b[i]);
}
for (j = 0; j < numb; j++) {
i = 0;
key = b[j];
a[numa] = key;
while (a[i] != key) {
i++;
}
if (i != numa) {
num++;
}
}
printf("%d\n", num);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142059/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142059/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%numa = alloca i32, align 4
%numb = alloca i32, align 4
%a = alloca [20000 x i32], align 16
%b = alloca [600 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %numa) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %numb) #3
call void @llvm.lifetime.start.p0(i64 80000, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 2400, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %numa)
%0 = load i32, ptr %numa, align 4, !tbaa !5
%cmp41 = icmp sgt i32 %0, 0
br i1 %cmp41, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %numa, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %numb)
%3 = load i32, ptr %numb, align 4, !tbaa !5
%cmp443 = icmp sgt i32 %3, 0
br i1 %cmp443, label %for.body5, label %for.end27
for.cond12.preheader: ; preds = %for.body5
%cmp1345 = icmp sgt i32 %6, 0
br i1 %cmp1345, label %for.body14.lr.ph, label %for.end27
for.body14.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %numa, align 4, !tbaa !5
%idxprom17 = sext i32 %4 to i64
%arrayidx18 = getelementptr inbounds [20000 x i32], ptr %a, i64 0, i64 %idxprom17
%wide.trip.count = zext i32 %6 to i64
%xtraiter = and i64 %wide.trip.count, 1
%5 = icmp eq i32 %6, 1
br i1 %5, label %for.end27.loopexit.unr-lcssa, label %for.body14.lr.ph.new
for.body14.lr.ph.new: ; preds = %for.body14.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body14
for.body5: ; preds = %for.end, %for.body5
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [600 x i32], ptr %b, i64 0, i64 %indvars.iv51
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%6 = load i32, ptr %numb, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp4 = icmp slt i64 %indvars.iv.next52, %7
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !11
for.body14: ; preds = %while.end.1, %for.body14.lr.ph.new
%indvars.iv57 = phi i64 [ 0, %for.body14.lr.ph.new ], [ %indvars.iv.next58.1, %while.end.1 ]
%num.046 = phi i32 [ 0, %for.body14.lr.ph.new ], [ %spec.select.1, %while.end.1 ]
%niter = phi i64 [ 0, %for.body14.lr.ph.new ], [ %niter.next.1, %while.end.1 ]
%arrayidx16 = getelementptr inbounds [600 x i32], ptr %b, i64 0, i64 %indvars.iv57
%8 = load i32, ptr %arrayidx16, align 8, !tbaa !5
store i32 %8, ptr %arrayidx18, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %for.body14
%indvars.iv54 = phi i64 [ %indvars.iv.next55, %while.cond ], [ 0, %for.body14 ]
%arrayidx20 = getelementptr inbounds [20000 x i32], ptr %a, i64 0, i64 %indvars.iv54
%9 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.not = icmp eq i32 %9, %8
%indvars.iv.next55 = add nuw i64 %indvars.iv54, 1
br i1 %cmp21.not, label %while.end, label %while.cond, !llvm.loop !12
while.end: ; preds = %while.cond
%10 = trunc i64 %indvars.iv54 to i32
%cmp23.not = icmp ne i32 %4, %10
%inc24 = zext i1 %cmp23.not to i32
%spec.select = add nuw nsw i32 %num.046, %inc24
%indvars.iv.next58 = or i64 %indvars.iv57, 1
%arrayidx16.1 = getelementptr inbounds [600 x i32], ptr %b, i64 0, i64 %indvars.iv.next58
%11 = load i32, ptr %arrayidx16.1, align 4, !tbaa !5
store i32 %11, ptr %arrayidx18, align 4, !tbaa !5
br label %while.cond.1
while.cond.1: ; preds = %while.cond.1, %while.end
%indvars.iv54.1 = phi i64 [ %indvars.iv.next55.1, %while.cond.1 ], [ 0, %while.end ]
%arrayidx20.1 = getelementptr inbounds [20000 x i32], ptr %a, i64 0, i64 %indvars.iv54.1
%12 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5
%cmp21.not.1 = icmp eq i32 %12, %11
%indvars.iv.next55.1 = add nuw i64 %indvars.iv54.1, 1
br i1 %cmp21.not.1, label %while.end.1, label %while.cond.1, !llvm.loop !12
while.end.1: ; preds = %while.cond.1
%13 = trunc i64 %indvars.iv54.1 to i32
%cmp23.not.1 = icmp ne i32 %4, %13
%inc24.1 = zext i1 %cmp23.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc24.1
%indvars.iv.next58.1 = add nuw nsw i64 %indvars.iv57, 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.end27.loopexit.unr-lcssa, label %for.body14, !llvm.loop !13
for.end27.loopexit.unr-lcssa: ; preds = %while.end.1, %for.body14.lr.ph
%spec.select.lcssa.ph = phi i32 [ undef, %for.body14.lr.ph ], [ %spec.select.1, %while.end.1 ]
%indvars.iv57.unr = phi i64 [ 0, %for.body14.lr.ph ], [ %indvars.iv.next58.1, %while.end.1 ]
%num.046.unr = phi i32 [ 0, %for.body14.lr.ph ], [ %spec.select.1, %while.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end27, label %for.body14.epil
for.body14.epil: ; preds = %for.end27.loopexit.unr-lcssa
%arrayidx16.epil = getelementptr inbounds [600 x i32], ptr %b, i64 0, i64 %indvars.iv57.unr
%14 = load i32, ptr %arrayidx16.epil, align 4, !tbaa !5
store i32 %14, ptr %arrayidx18, align 4, !tbaa !5
br label %while.cond.epil
while.cond.epil: ; preds = %while.cond.epil, %for.body14.epil
%indvars.iv54.epil = phi i64 [ %indvars.iv.next55.epil, %while.cond.epil ], [ 0, %for.body14.epil ]
%arrayidx20.epil = getelementptr inbounds [20000 x i32], ptr %a, i64 0, i64 %indvars.iv54.epil
%15 = load i32, ptr %arrayidx20.epil, align 4, !tbaa !5
%cmp21.not.epil = icmp eq i32 %15, %14
%indvars.iv.next55.epil = add nuw i64 %indvars.iv54.epil, 1
br i1 %cmp21.not.epil, label %while.end.epil, label %while.cond.epil, !llvm.loop !12
while.end.epil: ; preds = %while.cond.epil
%16 = trunc i64 %indvars.iv54.epil to i32
%cmp23.not.epil = icmp ne i32 %4, %16
%inc24.epil = zext i1 %cmp23.not.epil to i32
%spec.select.epil = add nuw nsw i32 %num.046.unr, %inc24.epil
br label %for.end27
for.end27: ; preds = %while.end.epil, %for.end27.loopexit.unr-lcssa, %for.end, %for.cond12.preheader
%num.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.end ], [ %spec.select.lcssa.ph, %for.end27.loopexit.unr-lcssa ], [ %spec.select.epil, %while.end.epil ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %num.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2400, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 80000, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %numb) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %numa) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main()
{
int n,k;
scanf("%d %d", &n, &k);
int result = 1;
for(int i = 0; i < n; i++)
{
if(result < k) result *= 2;
else result += k;
}
printf("%d\n", result);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142101/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142101/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %0, 0
br i1 %cmp7, label %for.body.lr.ph, label %for.cond.cleanup
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %k, align 4, !tbaa !5
%xtraiter = and i32 %0, 3
%2 = icmp ult i32 %0, 4
br i1 %2, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %0, -4
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%result.1.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %result.1.3, %for.body ]
%result.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %result.1.3, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%result.08.epil = phi i32 [ %result.1.epil, %for.body.epil ], [ %result.08.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%cmp1.epil = icmp slt i32 %result.08.epil, %1
%mul.epil = shl nsw i32 %result.08.epil, 1
%add.epil = add nsw i32 %1, %result.08.epil
%result.1.epil = select i1 %cmp1.epil, i32 %mul.epil, i32 %add.epil
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%result.0.lcssa = phi i32 [ 1, %entry ], [ %result.1.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %result.1.epil, %for.body.epil ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %result.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
for.body: ; preds = %for.body, %for.body.lr.ph.new
%result.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %result.1.3, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.body ]
%cmp1 = icmp slt i32 %result.08, %1
%mul = shl nsw i32 %result.08, 1
%add = add nsw i32 %1, %result.08
%result.1 = select i1 %cmp1, i32 %mul, i32 %add
%cmp1.1 = icmp slt i32 %result.1, %1
%mul.1 = shl nsw i32 %result.1, 1
%add.1 = add nsw i32 %1, %result.1
%result.1.1 = select i1 %cmp1.1, i32 %mul.1, i32 %add.1
%cmp1.2 = icmp slt i32 %result.1.1, %1
%mul.2 = shl nsw i32 %result.1.1, 1
%add.2 = add nsw i32 %1, %result.1.1
%result.1.2 = select i1 %cmp1.2, i32 %mul.2, i32 %add.2
%cmp1.3 = icmp slt i32 %result.1.2, %1
%mul.3 = shl nsw i32 %result.1.2, 1
%add.3 = add nsw i32 %1, %result.1.2
%result.1.3 = select i1 %cmp1.3, i32 %mul.3, i32 %add.3
%niter.next.3 = add i32 %niter, 4
%niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int n,k,i=0,m=1,t,w;
scanf("%d%d",&n,&k);
while(i!=n)
{
t=m*2;
w=m+k;
if(t>w)
{
m=m+k;
i++;
}
else
{
m=m*2;
i++;
}
}
printf("%d\n",m);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142145/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142145/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not12 = icmp eq i32 %0, 0
br i1 %cmp.not12, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %k, align 4, !tbaa !5
%xtraiter = and i32 %0, 3
%2 = icmp ult i32 %0, 4
br i1 %2, label %while.end.loopexit.unr-lcssa, label %while.body.lr.ph.new
while.body.lr.ph.new: ; preds = %while.body.lr.ph
%unroll_iter = and i32 %0, -4
br label %while.body
while.body: ; preds = %while.body, %while.body.lr.ph.new
%m.013 = phi i32 [ 1, %while.body.lr.ph.new ], [ %add.mul.3, %while.body ]
%niter = phi i32 [ 0, %while.body.lr.ph.new ], [ %niter.next.3, %while.body ]
%mul = shl nsw i32 %m.013, 1
%add = add nsw i32 %1, %m.013
%add.mul = call i32 @llvm.smin.i32(i32 %mul, i32 %add)
%mul.1 = shl nsw i32 %add.mul, 1
%add.1 = add nsw i32 %1, %add.mul
%add.mul.1 = call i32 @llvm.smin.i32(i32 %mul.1, i32 %add.1)
%mul.2 = shl nsw i32 %add.mul.1, 1
%add.2 = add nsw i32 %1, %add.mul.1
%add.mul.2 = call i32 @llvm.smin.i32(i32 %mul.2, i32 %add.2)
%mul.3 = shl nsw i32 %add.mul.2, 1
%add.3 = add nsw i32 %1, %add.mul.2
%add.mul.3 = call i32 @llvm.smin.i32(i32 %mul.3, i32 %add.3)
%niter.next.3 = add i32 %niter, 4
%niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %while.end.loopexit.unr-lcssa, label %while.body, !llvm.loop !9
while.end.loopexit.unr-lcssa: ; preds = %while.body, %while.body.lr.ph
%add.mul.lcssa.ph = phi i32 [ undef, %while.body.lr.ph ], [ %add.mul.3, %while.body ]
%m.013.unr = phi i32 [ 1, %while.body.lr.ph ], [ %add.mul.3, %while.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.end, label %while.body.epil
while.body.epil: ; preds = %while.end.loopexit.unr-lcssa, %while.body.epil
%m.013.epil = phi i32 [ %add.mul.epil, %while.body.epil ], [ %m.013.unr, %while.end.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %while.body.epil ], [ 0, %while.end.loopexit.unr-lcssa ]
%mul.epil = shl nsw i32 %m.013.epil, 1
%add.epil = add nsw i32 %1, %m.013.epil
%add.mul.epil = call i32 @llvm.smin.i32(i32 %mul.epil, i32 %add.epil)
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %while.end, label %while.body.epil, !llvm.loop !11
while.end: ; preds = %while.end.loopexit.unr-lcssa, %while.body.epil, %entry
%m.0.lcssa = phi i32 [ 1, %entry ], [ %add.mul.lcssa.ph, %while.end.loopexit.unr-lcssa ], [ %add.mul.epil, %while.body.epil ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %m.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
int main(){
int T, plus;
scanf("%d %d", &T, &plus);
int hasil = 1;
for(int i=1; i<=T; i++){
int x = hasil*2;
int y = hasil + plus;
if(x<=y){
hasil = x;
}
else{
hasil = y;
}
}
printf("%d\n", hasil);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142189/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142189/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%T = alloca i32, align 4
%plus = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %plus) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T, ptr noundef nonnull %plus)
%0 = load i32, ptr %T, align 4, !tbaa !5
%cmp.not8 = icmp slt i32 %0, 1
br i1 %cmp.not8, label %for.cond.cleanup, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %plus, align 4, !tbaa !5
%xtraiter = and i32 %0, 3
%2 = icmp ult i32 %0, 4
br i1 %2, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %0, -4
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%add.mul.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %add.mul.3, %for.body ]
%hasil.010.unr = phi i32 [ 1, %for.body.lr.ph ], [ %add.mul.3, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%hasil.010.epil = phi i32 [ %add.mul.epil, %for.body.epil ], [ %hasil.010.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%mul.epil = shl nsw i32 %hasil.010.epil, 1
%add.epil = add nsw i32 %1, %hasil.010.epil
%add.mul.epil = call i32 @llvm.smin.i32(i32 %mul.epil, i32 %add.epil)
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%hasil.0.lcssa = phi i32 [ 1, %entry ], [ %add.mul.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %add.mul.epil, %for.body.epil ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %hasil.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %plus) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #4
ret i32 0
for.body: ; preds = %for.body, %for.body.lr.ph.new
%hasil.010 = phi i32 [ 1, %for.body.lr.ph.new ], [ %add.mul.3, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.body ]
%mul = shl nsw i32 %hasil.010, 1
%add = add nsw i32 %1, %hasil.010
%add.mul = call i32 @llvm.smin.i32(i32 %mul, i32 %add)
%mul.1 = shl nsw i32 %add.mul, 1
%add.1 = add nsw i32 %1, %add.mul
%add.mul.1 = call i32 @llvm.smin.i32(i32 %mul.1, i32 %add.1)
%mul.2 = shl nsw i32 %add.mul.1, 1
%add.2 = add nsw i32 %1, %add.mul.1
%add.mul.2 = call i32 @llvm.smin.i32(i32 %mul.2, i32 %add.2)
%mul.3 = shl nsw i32 %add.mul.2, 1
%add.3 = add nsw i32 %1, %add.mul.2
%add.mul.3 = call i32 @llvm.smin.i32(i32 %mul.3, i32 %add.3)
%niter.next.3 = add i32 %niter, 4
%niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main() {
int i, N, K, ans = 1;
scanf("%d%d", &N, &K);
for(i = 0; i < N; ++i){
if(ans * 2 <= ans + K)
ans *= 2;
else
ans += K;
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142231/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142231/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %K, align 4, !tbaa !5
%xtraiter = and i32 %0, 3
%2 = icmp ult i32 %0, 4
br i1 %2, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %0, -4
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%ans.012 = phi i32 [ 1, %for.body.lr.ph.new ], [ %add.mul.3, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.body ]
%mul = shl nsw i32 %ans.012, 1
%add = add nsw i32 %1, %ans.012
%add.mul = call i32 @llvm.smin.i32(i32 %mul, i32 %add)
%mul.1 = shl nsw i32 %add.mul, 1
%add.1 = add nsw i32 %1, %add.mul
%add.mul.1 = call i32 @llvm.smin.i32(i32 %mul.1, i32 %add.1)
%mul.2 = shl nsw i32 %add.mul.1, 1
%add.2 = add nsw i32 %1, %add.mul.1
%add.mul.2 = call i32 @llvm.smin.i32(i32 %mul.2, i32 %add.2)
%mul.3 = shl nsw i32 %add.mul.2, 1
%add.3 = add nsw i32 %1, %add.mul.2
%add.mul.3 = call i32 @llvm.smin.i32(i32 %mul.3, i32 %add.3)
%niter.next.3 = add i32 %niter, 4
%niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%add.mul.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %add.mul.3, %for.body ]
%ans.012.unr = phi i32 [ 1, %for.body.lr.ph ], [ %add.mul.3, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%ans.012.epil = phi i32 [ %add.mul.epil, %for.body.epil ], [ %ans.012.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = shl nsw i32 %ans.012.epil, 1
%add.epil = add nsw i32 %1, %ans.012.epil
%add.mul.epil = call i32 @llvm.smin.i32(i32 %mul.epil, i32 %add.epil)
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%ans.0.lcssa = phi i32 [ 1, %entry ], [ %add.mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.mul.epil, %for.body.epil ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #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.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
int n,k;
int ans=1000000;
void dfs(int val,int cost){
if(val==n){
if(cost<ans)ans=cost;
return;
}
dfs(val+1,cost*2);
dfs(val+1,cost+k);
}
int main()
{
scanf("%d",&n);
scanf("%d",&k);
dfs(0,1);
printf("%d\n",ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142282/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142282/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@ans = dso_local local_unnamed_addr global i32 1000000, align 4
@n = dso_local global i32 0, align 4
@k = 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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @dfs(i32 noundef %val, i32 noundef %cost) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp11 = icmp eq i32 %0, %val
br i1 %cmp11, label %if.then, label %if.end3
if.then: ; preds = %if.end3, %entry
%cost.tr.lcssa = phi i32 [ %cost, %entry ], [ %add5, %if.end3 ]
%1 = load i32, ptr @ans, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %1, %cost.tr.lcssa
br i1 %cmp1, label %if.then2, label %return
if.then2: ; preds = %if.then
store i32 %cost.tr.lcssa, ptr @ans, align 4, !tbaa !5
br label %return
if.end3: ; preds = %entry, %if.end3
%cost.tr13 = phi i32 [ %add5, %if.end3 ], [ %cost, %entry ]
%val.tr12 = phi i32 [ %add, %if.end3 ], [ %val, %entry ]
%add = add nsw i32 %val.tr12, 1
%mul = shl nsw i32 %cost.tr13, 1
tail call void @dfs(i32 noundef %add, i32 noundef %mul)
%2 = load i32, ptr @k, align 4, !tbaa !5
%add5 = add nsw i32 %2, %cost.tr13
%3 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp eq i32 %3, %add
br i1 %cmp, label %if.then, label %if.end3
return: ; preds = %if.then, %if.then2
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @k)
tail call void @dfs(i32 noundef 0, i32 noundef 1)
%0 = load i32, ptr @ans, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int N, K, i;
int n = 1;
scanf("%d", &N);
scanf("%d", &K);
for (i = 0; i < N; i++) {
if (2 * n < n + K) {
n = 2 * n;
} else {
n += K;
}
}
printf("%d", n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142332/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142332/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %K)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %K, align 4, !tbaa !5
%xtraiter = and i32 %0, 3
%2 = icmp ult i32 %0, 4
br i1 %2, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %0, -4
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%n.013 = phi i32 [ 1, %for.body.lr.ph.new ], [ %mul.add.3, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.body ]
%mul = shl nsw i32 %n.013, 1
%add = add nsw i32 %1, %n.013
%mul.add = call i32 @llvm.smin.i32(i32 %mul, i32 %add)
%mul.1 = shl nsw i32 %mul.add, 1
%add.1 = add nsw i32 %1, %mul.add
%mul.add.1 = call i32 @llvm.smin.i32(i32 %mul.1, i32 %add.1)
%mul.2 = shl nsw i32 %mul.add.1, 1
%add.2 = add nsw i32 %1, %mul.add.1
%mul.add.2 = call i32 @llvm.smin.i32(i32 %mul.2, i32 %add.2)
%mul.3 = shl nsw i32 %mul.add.2, 1
%add.3 = add nsw i32 %1, %mul.add.2
%mul.add.3 = call i32 @llvm.smin.i32(i32 %mul.3, i32 %add.3)
%niter.next.3 = add i32 %niter, 4
%niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%mul.add.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %mul.add.3, %for.body ]
%n.013.unr = phi i32 [ 1, %for.body.lr.ph ], [ %mul.add.3, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%n.013.epil = phi i32 [ %mul.add.epil, %for.body.epil ], [ %n.013.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = shl nsw i32 %n.013.epil, 1
%add.epil = add nsw i32 %1, %n.013.epil
%mul.add.epil = call i32 @llvm.smin.i32(i32 %mul.epil, i32 %add.epil)
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%n.0.lcssa = phi i32 [ 1, %entry ], [ %mul.add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.add.epil, %for.body.epil ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %n.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
|
#include<stdio.h>
int main(){
int x, y;
scanf("%d %d", &x, &y);
int tx=0, ty=0, a=1, b=1, ans=0;
while(1){
if(tx==x && ty==y) break;
b += a;
tx += b-1;
ans++;
if(tx-a<x && x<=tx && ty<=y && y<ty+a) break;
a += b;
ty += a-1;
ans++;
if(tx-b<x && x<=tx && ty-b<y && y<=ty) break;
b += a;
tx -= b-1;
ans++;
if(tx<=x && x<tx+a && ty-a<y && y<=ty) break;
a += b;
ty -= a-1;
ans++;
if(tx<=x && x<tx+b && ty<=y && y<ty+b) break;
}
printf("%d\n", ans%3+1);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142376/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142376/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4
%cmp128 = icmp eq i32 %0, 0
%cmp1129 = icmp eq i32 %1, 0
%or.cond130 = select i1 %cmp128, i1 %cmp1129, i1 false
br i1 %or.cond130, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end58
%ans.0135 = phi i32 [ %inc47, %if.end58 ], [ 0, %entry ]
%b.0134 = phi i32 [ %add29, %if.end58 ], [ 1, %entry ]
%a.0133 = phi i32 [ %add44, %if.end58 ], [ 1, %entry ]
%ty.0132 = phi i32 [ %sub46, %if.end58 ], [ 0, %entry ]
%tx.0131 = phi i32 [ %sub31, %if.end58 ], [ 0, %entry ]
%add = add nsw i32 %b.0134, %a.0133
%sub = add i32 %tx.0131, -1
%add2 = add i32 %sub, %add
%sub3 = sub nsw i32 %add2, %a.0133
%cmp4 = icmp sge i32 %sub3, %0
%cmp6.not = icmp sgt i32 %0, %add2
%or.cond110 = or i1 %cmp6.not, %cmp4
br i1 %or.cond110, label %if.end13, label %land.lhs.true7
land.lhs.true7: ; preds = %if.end
%cmp8.not = icmp sle i32 %ty.0132, %1
%add10 = add nsw i32 %a.0133, %ty.0132
%cmp11 = icmp slt i32 %1, %add10
%or.cond111 = select i1 %cmp8.not, i1 %cmp11, i1 false
br i1 %or.cond111, label %while.end.split.loop.exit122, label %if.end13
if.end13: ; preds = %land.lhs.true7, %if.end
%add14 = add nsw i32 %add, %a.0133
%sub15 = add i32 %ty.0132, -1
%add16 = add i32 %sub15, %add14
%cmp19 = icmp sge i32 %sub, %0
%or.cond112 = or i1 %cmp6.not, %cmp19
br i1 %or.cond112, label %if.end28, label %land.lhs.true22
land.lhs.true22: ; preds = %if.end13
%sub23 = sub nsw i32 %add16, %add
%cmp24 = icmp sge i32 %sub23, %1
%cmp26.not = icmp sgt i32 %1, %add16
%or.cond113 = or i1 %cmp26.not, %cmp24
br i1 %or.cond113, label %if.end28, label %while.end.split.loop.exit120
if.end28: ; preds = %land.lhs.true22, %if.end13
%add29 = add nsw i32 %add14, %add
%reass.sub = sub i32 %add2, %add29
%sub31 = add i32 %reass.sub, 1
%cmp33.not = icmp sle i32 %sub31, %0
%add35 = add nsw i32 %sub31, %add14
%cmp36 = icmp slt i32 %0, %add35
%or.cond114 = select i1 %cmp33.not, i1 %cmp36, i1 false
br i1 %or.cond114, label %land.lhs.true37, label %if.end43
land.lhs.true37: ; preds = %if.end28
%cmp39 = icmp sge i32 %sub15, %1
%cmp41.not = icmp sgt i32 %1, %add16
%or.cond115 = or i1 %cmp41.not, %cmp39
br i1 %or.cond115, label %if.end43, label %while.end.split.loop.exit118
if.end43: ; preds = %land.lhs.true37, %if.end28
%add44 = add nsw i32 %add29, %add14
%reass.sub136 = sub i32 %add16, %add44
%sub46 = add i32 %reass.sub136, 1
%inc47 = add nuw nsw i32 %ans.0135, 4
%add50 = add i32 %tx.0131, %add
%cmp51 = icmp slt i32 %0, %add50
%or.cond116 = and i1 %cmp33.not, %cmp51
br i1 %or.cond116, label %land.lhs.true52, label %if.end58
land.lhs.true52: ; preds = %if.end43
%cmp53.not = icmp sle i32 %sub46, %1
%add55 = add nsw i32 %sub46, %add29
%cmp56 = icmp slt i32 %1, %add55
%or.cond117 = select i1 %cmp53.not, i1 %cmp56, i1 false
br i1 %or.cond117, label %while.end, label %if.end58
if.end58: ; preds = %land.lhs.true52, %if.end43
%cmp = icmp eq i32 %sub31, %0
%cmp1 = icmp eq i32 %sub46, %1
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %if.end
while.end.split.loop.exit118: ; preds = %land.lhs.true37
%inc32.le = or i32 %ans.0135, 3
br label %while.end
while.end.split.loop.exit120: ; preds = %land.lhs.true22
%inc17.le = or i32 %ans.0135, 2
br label %while.end
while.end.split.loop.exit122: ; preds = %land.lhs.true7
%inc.le = or i32 %ans.0135, 1
br label %while.end
while.end: ; preds = %if.end58, %land.lhs.true52, %entry, %while.end.split.loop.exit122, %while.end.split.loop.exit120, %while.end.split.loop.exit118
%ans.1 = phi i32 [ %inc32.le, %while.end.split.loop.exit118 ], [ %inc17.le, %while.end.split.loop.exit120 ], [ %inc.le, %while.end.split.loop.exit122 ], [ 0, %entry ], [ %inc47, %land.lhs.true52 ], [ %inc47, %if.end58 ]
%rem = srem i32 %ans.1, 3
%add59 = add nsw i32 %rem, 1
%call60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add59)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)
#define MOD 1000000007
typedef struct{
long x;
long y;
}data;
int main(void){
int N,K;
scanf("%d%d",&N,&K);
//A[0]~A[N-1]に格納する
data* A;
NEW(A,N);
for(int i=0;i<N;i++){
scanf("%ld%ld",&A[i].x,&A[i].y);
}
long ans=1e18*4;
for(int a=0;a<N;a++){
for(int b=0;b<N;b++){
for(int c=0;c<N;c++){
for(int d=0;d<N;d++){
long x0=MIN(A[a].x, A[b].x);
long x1=MAX(A[a].x, A[b].x);
long y0=MIN(A[c].y, A[d].y);
long y1=MAX(A[c].y, A[d].y);
int tmp=0;
for(int i=0;i<N;i++){
if(x0<=A[i].x && A[i].x<=x1 && y0<=A[i].y && A[i].y<=y1) tmp++;
}
if(tmp>=K) ans=MIN(ans,(x1-x0)*(y1-y0));
}
}
}
}
printf("%ld\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142419/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142419/source.c"
target datalayout = "e-m:e-p270: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 [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%ld%ld\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
@str = private unnamed_addr constant [18 x i8] c"not enough memory\00", align 1
; Function Attrs: 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) #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)
%0 = load i32, ptr %N, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 4
%call1 = call noalias ptr @malloc(i64 noundef %mul) #8
%cmp = icmp eq ptr %call1, null
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp4230 = icmp sgt i32 %0, 0
br i1 %cmp4230, label %for.body, label %for.cond.cleanup12
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #9
unreachable
for.cond9.preheader: ; preds = %for.body
%cmp10261 = icmp sgt i32 %8, 0
br i1 %cmp10261, label %for.cond14.preheader.lr.ph, label %for.cond.cleanup12
for.cond14.preheader.lr.ph: ; preds = %for.cond9.preheader
%1 = load i32, ptr %K, align 4
%wide.trip.count288 = zext i32 %8 to i64
br label %for.cond14.preheader.us
for.cond14.preheader.us: ; preds = %for.cond14.for.cond.cleanup17_crit_edge.split.us.us, %for.cond14.preheader.lr.ph
%indvars.iv285 = phi i64 [ %indvars.iv.next286, %for.cond14.for.cond.cleanup17_crit_edge.split.us.us ], [ 0, %for.cond14.preheader.lr.ph ]
%ans.0263.us = phi i64 [ %ans.4.us.us.us.us, %for.cond14.for.cond.cleanup17_crit_edge.split.us.us ], [ 4000000000000000000, %for.cond14.preheader.lr.ph ]
%arrayidx30.us = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv285
%2 = load i64, ptr %arrayidx30.us, align 8, !tbaa !9
br label %for.cond19.preheader.us.us
for.cond19.preheader.us.us: ; preds = %for.cond19.for.cond.cleanup22_crit_edge.split.us.us.us, %for.cond14.preheader.us
%indvars.iv280 = phi i64 [ %indvars.iv.next281, %for.cond19.for.cond.cleanup22_crit_edge.split.us.us.us ], [ 0, %for.cond14.preheader.us ]
%ans.1259.us.us = phi i64 [ %ans.4.us.us.us.us, %for.cond19.for.cond.cleanup22_crit_edge.split.us.us.us ], [ %ans.0263.us, %for.cond14.preheader.us ]
%arrayidx33.us.us = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv280
%3 = load i64, ptr %arrayidx33.us.us, align 8, !tbaa !9
%..us.us.us = call i64 @llvm.smin.i64(i64 %2, i64 %3)
%cond60.us.us.us = call i64 @llvm.smax.i64(i64 %2, i64 %3)
%sub.us.us.us = sub nsw i64 %cond60.us.us.us, %..us.us.us
br label %for.cond24.preheader.us.us.us
for.cond24.preheader.us.us.us: ; preds = %for.cond24.for.cond.cleanup27_crit_edge.split.us.us.us.us, %for.cond19.preheader.us.us
%indvars.iv275 = phi i64 [ %indvars.iv.next276, %for.cond24.for.cond.cleanup27_crit_edge.split.us.us.us.us ], [ 0, %for.cond19.preheader.us.us ]
%ans.2255.us.us.us = phi i64 [ %ans.4.us.us.us.us, %for.cond24.for.cond.cleanup27_crit_edge.split.us.us.us.us ], [ %ans.1259.us.us, %for.cond19.preheader.us.us ]
%y63.us.us.us = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv275, i32 1
%4 = load i64, ptr %y63.us.us.us, align 8, !tbaa !12
br label %for.body28.us.us.us.us
for.body28.us.us.us.us: ; preds = %if.end145.us.us.us.us, %for.cond24.preheader.us.us.us
%indvars.iv270 = phi i64 [ %indvars.iv.next271, %if.end145.us.us.us.us ], [ 0, %for.cond24.preheader.us.us.us ]
%ans.3238.us.us.us.us = phi i64 [ %ans.4.us.us.us.us, %if.end145.us.us.us.us ], [ %ans.2255.us.us.us, %for.cond24.preheader.us.us.us ]
%y66.us.us.us.us = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv270, i32 1
%5 = load i64, ptr %y66.us.us.us.us, align 8, !tbaa !12
%cond78.us.us.us.us = call i64 @llvm.smin.i64(i64 %4, i64 %5)
%cond96.us.us.us.us = call i64 @llvm.smax.i64(i64 %4, i64 %5)
br label %for.body102.us.us.us.us
if.then133.us.us.us.us: ; preds = %for.cond98.for.cond.cleanup101_crit_edge.us.us.us.us
%sub134.us.us.us.us = sub nsw i64 %cond96.us.us.us.us, %cond78.us.us.us.us
%mul135.us.us.us.us = mul nsw i64 %sub134.us.us.us.us, %sub.us.us.us
%ans.3.mul135.us.us.us.us = call i64 @llvm.smin.i64(i64 %ans.3238.us.us.us.us, i64 %mul135.us.us.us.us)
br label %if.end145.us.us.us.us
if.end145.us.us.us.us: ; preds = %for.cond98.for.cond.cleanup101_crit_edge.us.us.us.us, %if.then133.us.us.us.us
%ans.4.us.us.us.us = phi i64 [ %ans.3.mul135.us.us.us.us, %if.then133.us.us.us.us ], [ %ans.3238.us.us.us.us, %for.cond98.for.cond.cleanup101_crit_edge.us.us.us.us ]
%indvars.iv.next271 = add nuw nsw i64 %indvars.iv270, 1
%exitcond274.not = icmp eq i64 %indvars.iv.next271, %wide.trip.count288
br i1 %exitcond274.not, label %for.cond24.for.cond.cleanup27_crit_edge.split.us.us.us.us, label %for.body28.us.us.us.us, !llvm.loop !13
for.body102.us.us.us.us: ; preds = %for.inc128.us.us.us.us, %for.body28.us.us.us.us
%indvars.iv267 = phi i64 [ %indvars.iv.next268, %for.inc128.us.us.us.us ], [ 0, %for.body28.us.us.us.us ]
%tmp.0233.us.us.us.us = phi i32 [ %tmp.1.us.us.us.us, %for.inc128.us.us.us.us ], [ 0, %for.body28.us.us.us.us ]
%arrayidx104.us.us.us.us = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv267
%6 = load i64, ptr %arrayidx104.us.us.us.us, align 8, !tbaa !9
%cmp106.not.us.us.us.us = icmp sgt i64 %..us.us.us, %6
%cmp111.not.us.us.us.us = icmp sgt i64 %6, %cond60.us.us.us
%or.cond.us.us.us.us = select i1 %cmp106.not.us.us.us.us, i1 true, i1 %cmp111.not.us.us.us.us
br i1 %or.cond.us.us.us.us, label %for.inc128.us.us.us.us, label %land.lhs.true113.us.us.us.us
land.lhs.true113.us.us.us.us: ; preds = %for.body102.us.us.us.us
%y116.us.us.us.us = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv267, i32 1
%7 = load i64, ptr %y116.us.us.us.us, align 8, !tbaa !12
%cmp117.not.us.us.us.us = icmp sle i64 %cond78.us.us.us.us, %7
%cmp123.not.us.us.us.us = icmp sle i64 %7, %cond96.us.us.us.us
%or.cond229.not.us.us.us.us = select i1 %cmp117.not.us.us.us.us, i1 %cmp123.not.us.us.us.us, i1 false
%inc126.us.us.us.us = zext i1 %or.cond229.not.us.us.us.us to i32
%spec.select.us.us.us.us = add nsw i32 %tmp.0233.us.us.us.us, %inc126.us.us.us.us
br label %for.inc128.us.us.us.us
for.inc128.us.us.us.us: ; preds = %land.lhs.true113.us.us.us.us, %for.body102.us.us.us.us
%tmp.1.us.us.us.us = phi i32 [ %tmp.0233.us.us.us.us, %for.body102.us.us.us.us ], [ %spec.select.us.us.us.us, %land.lhs.true113.us.us.us.us ]
%indvars.iv.next268 = add nuw nsw i64 %indvars.iv267, 1
%exitcond.not = icmp eq i64 %indvars.iv.next268, %wide.trip.count288
br i1 %exitcond.not, label %for.cond98.for.cond.cleanup101_crit_edge.us.us.us.us, label %for.body102.us.us.us.us, !llvm.loop !15
for.cond98.for.cond.cleanup101_crit_edge.us.us.us.us: ; preds = %for.inc128.us.us.us.us
%cmp131.not.us.us.us.us = icmp slt i32 %tmp.1.us.us.us.us, %1
br i1 %cmp131.not.us.us.us.us, label %if.end145.us.us.us.us, label %if.then133.us.us.us.us
for.cond24.for.cond.cleanup27_crit_edge.split.us.us.us.us: ; preds = %if.end145.us.us.us.us
%indvars.iv.next276 = add nuw nsw i64 %indvars.iv275, 1
%exitcond279.not = icmp eq i64 %indvars.iv.next276, %wide.trip.count288
br i1 %exitcond279.not, label %for.cond19.for.cond.cleanup22_crit_edge.split.us.us.us, label %for.cond24.preheader.us.us.us, !llvm.loop !16
for.cond19.for.cond.cleanup22_crit_edge.split.us.us.us: ; preds = %for.cond24.for.cond.cleanup27_crit_edge.split.us.us.us.us
%indvars.iv.next281 = add nuw nsw i64 %indvars.iv280, 1
%exitcond284.not = icmp eq i64 %indvars.iv.next281, %wide.trip.count288
br i1 %exitcond284.not, label %for.cond14.for.cond.cleanup17_crit_edge.split.us.us, label %for.cond19.preheader.us.us, !llvm.loop !17
for.cond14.for.cond.cleanup17_crit_edge.split.us.us: ; preds = %for.cond19.for.cond.cleanup22_crit_edge.split.us.us.us
%indvars.iv.next286 = add nuw nsw i64 %indvars.iv285, 1
%exitcond289.not = icmp eq i64 %indvars.iv.next286, %wide.trip.count288
br i1 %exitcond289.not, label %for.cond.cleanup12, label %for.cond14.preheader.us, !llvm.loop !18
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv
%y = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv, i32 1
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx, ptr noundef nonnull %y)
%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
%cmp4 = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp4, label %for.body, label %for.cond9.preheader, !llvm.loop !19
for.cond.cleanup12: ; preds = %for.cond14.for.cond.cleanup17_crit_edge.split.us.us, %for.cond.preheader, %for.cond9.preheader
%ans.0.lcssa = phi i64 [ 4000000000000000000, %for.cond9.preheader ], [ 4000000000000000000, %for.cond.preheader ], [ %ans.4.us.us.us.us, %for.cond14.for.cond.cleanup17_crit_edge.split.us.us ]
%call158 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #6
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { 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, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 8}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
|
#include<stdio.h>
int main()
{
long long int k5,k2,k3,k6,n=0,m=0,sum;
while (scanf("%lld%lld%lld%lld",&k2,&k3,&k5,&k6)==4)
{
if (k2>=k5 && k6>=k5)
n=k5;
else if (k2<=k5 && k2<=k6)
n=k2;
else if (k6<=k5 && k6<=k2)
n=k6;
k2=k2-n;
if (k2>0 && k3>0)
{
if (k2>k3)
m=k3;
else
m=k2;
}
sum=256*n+32*m;
printf("%lld\n",sum);
m=0;
n=0;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14247/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14247/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [17 x i8] c"%lld%lld%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k5 = alloca i64, align 8
%k2 = alloca i64, align 8
%k3 = alloca i64, align 8
%k6 = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k5) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k3) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k6) #4
%call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k2, ptr noundef nonnull %k3, ptr noundef nonnull %k5, ptr noundef nonnull %k6)
%cmp33 = icmp eq i32 %call32, 4
br i1 %cmp33, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end13
%0 = load i64, ptr %k2, align 8
%1 = load i64, ptr %k5, align 8, !tbaa !5
%cmp1.not = icmp slt i64 %0, %1
%2 = load i64, ptr %k6, align 8
%cmp2.not = icmp slt i64 %2, %1
%or.cond29 = select i1 %cmp1.not, i1 true, i1 %cmp2.not
br i1 %or.cond29, label %if.else, label %if.end13
if.else: ; preds = %while.body
%cmp3.not = icmp sgt i64 %0, %1
%cmp5.not = icmp sgt i64 %0, %2
%or.cond30 = select i1 %cmp3.not, i1 true, i1 %cmp5.not
br i1 %or.cond30, label %if.else7, label %if.end13
if.else7: ; preds = %if.else
%cmp8.not = icmp sgt i64 %2, %1
%cmp10.not = icmp sgt i64 %2, %0
%or.cond31 = or i1 %cmp8.not, %cmp10.not
%spec.select = select i1 %or.cond31, i64 0, i64 %2
br label %if.end13
if.end13: ; preds = %if.else7, %if.else, %while.body
%n.1 = phi i64 [ %1, %while.body ], [ %0, %if.else ], [ %spec.select, %if.else7 ]
%sub = sub nsw i64 %0, %n.1
store i64 %sub, ptr %k2, align 8, !tbaa !5
%cmp14 = icmp sgt i64 %sub, 0
%3 = load i64, ptr %k3, align 8
%cmp16 = icmp sgt i64 %3, 0
%or.cond = select i1 %cmp14, i1 %cmp16, i1 false
%.sub = call i64 @llvm.smin.i64(i64 %sub, i64 %3)
%4 = shl nsw i64 %.sub, 5
%mul = shl nsw i64 %n.1, 8
%mul23 = select i1 %or.cond, i64 %4, i64 0
%add = add nsw i64 %mul23, %mul
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k2, ptr noundef nonnull %k3, ptr noundef nonnull %k5, ptr noundef nonnull %k6)
%cmp = icmp eq i32 %call, 4
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %if.end13, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k6) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k3) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k5) #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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
int d;
d=a+b+c;
if(d>=22){
printf("bust");
}
else{
printf("win");
return 0;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142541/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142541/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"bust\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"win\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %c, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add1, 21
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a+b+c>=22){printf("bust");}
if(a+b+c<22){printf("win");}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142592/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142592/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"bust\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"win\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %c, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add1, 21
br i1 %cmp, label %if.end, label %if.then6
if.end: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre9 = load i32, ptr %b, align 4, !tbaa !5
%.pre10 = load i32, ptr %c, align 4, !tbaa !5
%.pre11 = add nsw i32 %.pre9, %.pre
%.pre12 = add nsw i32 %.pre11, %.pre10
%3 = icmp slt i32 %.pre12, 22
br i1 %3, label %if.then6, label %if.end8
if.then6: ; preds = %entry, %if.end
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end8
if.end8: ; preds = %if.then6, %if.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if(a+b+c>=22) printf("bust");
else printf("win");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142635/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142635/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"bust\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"win\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %c, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add1, 21
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a+b+c>=22){
printf("bust\n");
}
else{
printf("win\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142686/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142686/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"win\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"bust\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %c, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add1, 21
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int A,B,C;
scanf("%d %d %d",&A,&B,&C);
if(A+B+C>=22)
printf("bust");
else
printf("win");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142736/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142736/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"bust\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"win\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %C, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add1, 21
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int A1,A2,A3,sum;
scanf("%d %d %d", &A1,&A2,&A3);
if((A1+A2+A3)>=22) {
printf("bust");
}
else {
printf("win");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_142787/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_142787/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"bust\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"win\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A1 = alloca i32, align 4
%A2 = alloca i32, align 4
%A3 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A2) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A3) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A1, ptr noundef nonnull %A2, ptr noundef nonnull %A3)
%0 = load i32, ptr %A1, align 4, !tbaa !5
%1 = load i32, ptr %A2, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %A3, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%cmp = icmp sgt i32 %add1, 21
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A3) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A1) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|