Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
int main(void){
int n;
int c =0,max =0;
scanf("%d",&n);
int h[20];
for(int i=0;i<n;i++ ){
scanf("%d",&h[i]);
}
while(1<=max<=100){
for(int i=0;i<n;i++ ){
if(h[i]>= max){
max = h[i];
c = c+1;
}
}
printf("%d\n",c);
break;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275425/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275425/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%h = alloca [20 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 80, ptr nonnull %h) #4
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %0, 0
br i1 %cmp29, label %for.body, label %for.cond.cleanup9
for.cond6.preheader: ; preds = %for.body
%cmp731 = icmp sgt i32 %2, 0
br i1 %cmp731, label %for.body10.preheader, label %for.cond.cleanup9
for.body10.preheader: ; preds = %for.cond6.preheader
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %2, 1
br i1 %1, label %for.cond.cleanup9.loopexit.unr-lcssa, label %for.body10.preheader.new
for.body10.preheader.new: ; preds = %for.body10.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x i32], ptr %h, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !9
for.cond.cleanup9.loopexit.unr-lcssa: ; preds = %for.body10, %for.body10.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body10.preheader ], [ %spec.select.1, %for.body10 ]
%indvars.iv38.unr = phi i64 [ 0, %for.body10.preheader ], [ %indvars.iv.next39.1, %for.body10 ]
%max.033.unr = phi i32 [ 0, %for.body10.preheader ], [ %spec.select28.1, %for.body10 ]
%c.032.unr = phi i32 [ 0, %for.body10.preheader ], [ %spec.select.1, %for.body10 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup9, label %for.body10.epil
for.body10.epil: ; preds = %for.cond.cleanup9.loopexit.unr-lcssa
%arrayidx12.epil = getelementptr inbounds [20 x i32], ptr %h, i64 0, i64 %indvars.iv38.unr
%4 = load i32, ptr %arrayidx12.epil, align 4, !tbaa !5
%cmp13.not.epil = icmp sge i32 %4, %max.033.unr
%add.epil = zext i1 %cmp13.not.epil to i32
%spec.select.epil = add nuw nsw i32 %c.032.unr, %add.epil
br label %for.cond.cleanup9
for.cond.cleanup9: ; preds = %for.body10.epil, %for.cond.cleanup9.loopexit.unr-lcssa, %entry, %for.cond6.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond6.preheader ], [ 0, %entry ], [ %spec.select.lcssa.ph, %for.cond.cleanup9.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body10.epil ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body10: ; preds = %for.body10, %for.body10.preheader.new
%indvars.iv38 = phi i64 [ 0, %for.body10.preheader.new ], [ %indvars.iv.next39.1, %for.body10 ]
%max.033 = phi i32 [ 0, %for.body10.preheader.new ], [ %spec.select28.1, %for.body10 ]
%c.032 = phi i32 [ 0, %for.body10.preheader.new ], [ %spec.select.1, %for.body10 ]
%niter = phi i64 [ 0, %for.body10.preheader.new ], [ %niter.next.1, %for.body10 ]
%arrayidx12 = getelementptr inbounds [20 x i32], ptr %h, i64 0, i64 %indvars.iv38
%5 = load i32, ptr %arrayidx12, align 8, !tbaa !5
%cmp13.not = icmp sge i32 %5, %max.033
%add = zext i1 %cmp13.not to i32
%spec.select = add nuw nsw i32 %c.032, %add
%spec.select28 = call i32 @llvm.smax.i32(i32 %5, i32 %max.033)
%indvars.iv.next39 = or i64 %indvars.iv38, 1
%arrayidx12.1 = getelementptr inbounds [20 x i32], ptr %h, i64 0, i64 %indvars.iv.next39
%6 = load i32, ptr %arrayidx12.1, align 4, !tbaa !5
%cmp13.not.1 = icmp sge i32 %6, %spec.select28
%add.1 = zext i1 %cmp13.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %add.1
%spec.select28.1 = call i32 @llvm.smax.i32(i32 %6, i32 %spec.select28)
%indvars.iv.next39.1 = add nuw nsw i64 %indvars.iv38, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup9.loopexit.unr-lcssa, label %for.body10, !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.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void){
int N, i, k;
int H[20];
int count = 1;
int defference[20];
int c = 0;
scanf("%d", &N);
for(i = 0; i < N; i++){
scanf("%d", &H[i]);
}
for(k = 1; k < N; k++){
c = 0;
for(i = 0; i < k; i++){
defference[i] = H[k] - H[i];
if(defference[i] < 0){
c = 1;
}
}
if(c == 0){
count += 1;
}
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275469/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275469/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%H = alloca [20 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %H) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body, label %for.end25
for.cond2.preheader: ; preds = %for.body
%cmp343 = icmp sgt i32 %1, 1
br i1 %cmp343, label %for.cond5.preheader.preheader, label %for.end25
for.cond5.preheader.preheader: ; preds = %for.cond2.preheader
%wide.trip.count55 = zext i32 %1 to i64
br label %for.cond5.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x i32], ptr %H, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond5.preheader.preheader, %for.end19
%indvars.iv52 = phi i64 [ 1, %for.cond5.preheader.preheader ], [ %indvars.iv.next53, %for.end19 ]
%count.045 = phi i32 [ 1, %for.cond5.preheader.preheader ], [ %spec.select38, %for.end19 ]
%arrayidx9 = getelementptr inbounds [20 x i32], ptr %H, i64 0, i64 %indvars.iv52
%3 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %indvars.iv52, 8
br i1 %min.iters.check, label %for.body7.preheader, label %vector.ph
vector.ph: ; preds = %for.cond5.preheader
%n.vec = and i64 %indvars.iv52, 9223372036854775800
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %3, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%vec.phi59 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%4 = getelementptr inbounds [20 x i32], ptr %H, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load60 = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = icmp slt <4 x i32> %broadcast.splat, %wide.load
%7 = icmp slt <4 x i32> %broadcast.splat, %wide.load60
%8 = select <4 x i1> %6, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi
%9 = select <4 x i1> %7, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi59
%index.next = add nuw i64 %index, 8
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%rdx.select.cmp.not = icmp ne <4 x i32> %8, zeroinitializer
%rdx.select.cmp6163 = icmp ne <4 x i32> %9, zeroinitializer
%rdx.select.cmp61 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp6163
%11 = bitcast <4 x i1> %rdx.select.cmp61 to i4
%.not = icmp ne i4 %11, 0
%rdx.select62 = zext i1 %.not to i32
%cmp.n = icmp eq i64 %indvars.iv52, %n.vec
br i1 %cmp.n, label %for.end19, label %for.body7.preheader
for.body7.preheader: ; preds = %for.cond5.preheader, %middle.block
%indvars.iv49.ph = phi i64 [ 0, %for.cond5.preheader ], [ %n.vec, %middle.block ]
%c.042.ph = phi i32 [ 0, %for.cond5.preheader ], [ %rdx.select62, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%indvars.iv49 = phi i64 [ %indvars.iv.next50, %for.body7 ], [ %indvars.iv49.ph, %for.body7.preheader ]
%c.042 = phi i32 [ %spec.select, %for.body7 ], [ %c.042.ph, %for.body7.preheader ]
%arrayidx11 = getelementptr inbounds [20 x i32], ptr %H, i64 0, i64 %indvars.iv49
%12 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp16 = icmp slt i32 %3, %12
%spec.select = select i1 %cmp16, i32 1, i32 %c.042
%indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
%exitcond.not = icmp eq i64 %indvars.iv.next50, %indvars.iv52
br i1 %exitcond.not, label %for.end19, label %for.body7, !llvm.loop !14
for.end19: ; preds = %for.body7, %middle.block
%spec.select.lcssa = phi i32 [ %rdx.select62, %middle.block ], [ %spec.select, %for.body7 ]
%cmp20 = icmp eq i32 %spec.select.lcssa, 0
%add = zext i1 %cmp20 to i32
%spec.select38 = add nuw nsw i32 %count.045, %add
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%exitcond56.not = icmp eq i64 %indvars.iv.next53, %wide.trip.count55
br i1 %exitcond56.not, label %for.end25, label %for.cond5.preheader, !llvm.loop !15
for.end25: ; preds = %for.end19, %entry, %for.cond2.preheader
%count.0.lcssa = phi i32 [ 1, %for.cond2.preheader ], [ 1, %entry ], [ %spec.select38, %for.end19 ]
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %H) #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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
#include<string.h>
int main()
{
int a,d,sum,i,flag;
int b[100]={};
int c;
a=0;
c=0;
sum=1;
// スペース区切りの整数の入力
scanf("%d",&a);
for(d=0;d<a;d++){
scanf("%d",&c);
b[d]=c;
}
for(d=1;d<a;d++){
flag=1;
for(i=0;i<d;i++){
if(b[i]>b[d]){
flag=0;
break;
}
}
sum += flag;
}
// 出力
printf("%d",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275511/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275511/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca [100 x i32], align 16
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %b) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %b, i8 0, i64 400, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
store i32 0, ptr %a, align 4, !tbaa !5
store i32 0, ptr %c, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %0, 0
br i1 %cmp29, label %for.body, label %for.end18
for.cond2.preheader: ; preds = %for.body
%cmp332 = icmp sgt i32 %4, 1
br i1 %cmp332, label %for.cond5.preheader.preheader, label %for.end18
for.cond5.preheader.preheader: ; preds = %for.cond2.preheader
%wide.trip.count44 = zext i32 %4 to i64
%1 = add nsw i64 %wide.trip.count44, -1
%xtraiter = and i64 %1, 1
%2 = icmp eq i32 %4, 2
br i1 %2, label %for.end18.loopexit.unr-lcssa, label %for.cond5.preheader.preheader.new
for.cond5.preheader.preheader.new: ; preds = %for.cond5.preheader.preheader
%unroll_iter = and i64 %1, -2
br label %for.cond5.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%3 = load i32, ptr %c, align 4, !tbaa !5
%arrayidx = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv
store i32 %3, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %a, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.end15.1, %for.cond5.preheader.preheader.new
%indvars.iv41 = phi i64 [ 1, %for.cond5.preheader.preheader.new ], [ %indvars.iv.next42.1, %for.end15.1 ]
%sum.034 = phi i32 [ 1, %for.cond5.preheader.preheader.new ], [ %add.1, %for.end15.1 ]
%niter = phi i64 [ 0, %for.cond5.preheader.preheader.new ], [ %niter.next.1, %for.end15.1 ]
%arrayidx11 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv41
%6 = load i32, ptr %arrayidx11, align 4, !tbaa !5
br label %for.body7
for.cond5: ; preds = %for.body7
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%exitcond.not = icmp eq i64 %indvars.iv.next39, %indvars.iv41
br i1 %exitcond.not, label %for.end15, label %for.body7, !llvm.loop !11
for.body7: ; preds = %for.cond5.preheader, %for.cond5
%indvars.iv38 = phi i64 [ 0, %for.cond5.preheader ], [ %indvars.iv.next39, %for.cond5 ]
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv38
%7 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %7, %6
br i1 %cmp12, label %for.end15, label %for.cond5
for.end15: ; preds = %for.body7, %for.cond5
%flag.0 = phi i32 [ 1, %for.cond5 ], [ 0, %for.body7 ]
%add = add nuw nsw i32 %flag.0, %sum.034
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%arrayidx11.1 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv.next42
%8 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5
br label %for.body7.1
for.body7.1: ; preds = %for.cond5.1, %for.end15
%indvars.iv38.1 = phi i64 [ 0, %for.end15 ], [ %indvars.iv.next39.1, %for.cond5.1 ]
%arrayidx9.1 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv38.1
%9 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5
%cmp12.1 = icmp sgt i32 %9, %8
br i1 %cmp12.1, label %for.end15.1, label %for.cond5.1
for.cond5.1: ; preds = %for.body7.1
%indvars.iv.next39.1 = add nuw nsw i64 %indvars.iv38.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv38.1, %indvars.iv41
br i1 %exitcond.not.1, label %for.end15.1, label %for.body7.1, !llvm.loop !11
for.end15.1: ; preds = %for.cond5.1, %for.body7.1
%flag.0.1 = phi i32 [ 1, %for.cond5.1 ], [ 0, %for.body7.1 ]
%add.1 = add nuw nsw i32 %flag.0.1, %add
%indvars.iv.next42.1 = add nuw nsw i64 %indvars.iv41, 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.end18.loopexit.unr-lcssa, label %for.cond5.preheader, !llvm.loop !12
for.end18.loopexit.unr-lcssa: ; preds = %for.end15.1, %for.cond5.preheader.preheader
%add.lcssa.ph = phi i32 [ undef, %for.cond5.preheader.preheader ], [ %add.1, %for.end15.1 ]
%indvars.iv41.unr = phi i64 [ 1, %for.cond5.preheader.preheader ], [ %indvars.iv.next42.1, %for.end15.1 ]
%sum.034.unr = phi i32 [ 1, %for.cond5.preheader.preheader ], [ %add.1, %for.end15.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end18, label %for.cond5.preheader.epil
for.cond5.preheader.epil: ; preds = %for.end18.loopexit.unr-lcssa
%arrayidx11.epil = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv41.unr
%10 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5
br label %for.body7.epil
for.body7.epil: ; preds = %for.cond5.epil, %for.cond5.preheader.epil
%indvars.iv38.epil = phi i64 [ 0, %for.cond5.preheader.epil ], [ %indvars.iv.next39.epil, %for.cond5.epil ]
%arrayidx9.epil = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv38.epil
%11 = load i32, ptr %arrayidx9.epil, align 4, !tbaa !5
%cmp12.epil = icmp sgt i32 %11, %10
br i1 %cmp12.epil, label %for.end15.epil, label %for.cond5.epil
for.cond5.epil: ; preds = %for.body7.epil
%indvars.iv.next39.epil = add nuw nsw i64 %indvars.iv38.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next39.epil, %indvars.iv41.unr
br i1 %exitcond.not.epil, label %for.end15.epil, label %for.body7.epil, !llvm.loop !11
for.end15.epil: ; preds = %for.cond5.epil, %for.body7.epil
%flag.0.epil = phi i32 [ 1, %for.cond5.epil ], [ 0, %for.body7.epil ]
%add.epil = add nuw nsw i32 %flag.0.epil, %sum.034.unr
br label %for.end18
for.end18: ; preds = %for.end15.epil, %for.end18.loopexit.unr-lcssa, %entry, %for.cond2.preheader
%sum.0.lcssa = phi i32 [ 1, %for.cond2.preheader ], [ 1, %entry ], [ %add.lcssa.ph, %for.end18.loopexit.unr-lcssa ], [ %add.epil, %for.end15.epil ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 400, 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(){
int x,i,j,k,N,H[101],count=1;
x = 1;
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%d", &H[i]);
}
for (j = 1; j < N; j++) {
for (k = j - 1; k >=0; k--) {
if (H[j] < H[k]) {
x = 0;
break;
}
}
if(x==1)
count += 1;
x = 1;
}
printf("%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275555/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275555/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%H = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %H) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %0, 0
br i1 %cmp30, label %for.body, label %for.end20
for.cond2.preheader: ; preds = %for.body
%cmp332 = icmp sgt i32 %3, 1
br i1 %cmp332, label %for.cond5.preheader.preheader, label %for.end20
for.cond5.preheader.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %3 to i64
%1 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %1, 1
%2 = icmp eq i32 %3, 2
br i1 %2, label %for.end20.loopexit.unr-lcssa, label %for.cond5.preheader.preheader.new
for.cond5.preheader.preheader.new: ; preds = %for.cond5.preheader.preheader
%unroll_iter = and i64 %1, -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 [101 x i32], ptr %H, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.end14.1, %for.cond5.preheader.preheader.new
%indvars.iv38 = phi i64 [ 1, %for.cond5.preheader.preheader.new ], [ %indvars.iv.next39.1, %for.end14.1 ]
%count.034 = phi i32 [ 1, %for.cond5.preheader.preheader.new ], [ %spec.select.1, %for.end14.1 ]
%niter = phi i64 [ 0, %for.cond5.preheader.preheader.new ], [ %niter.next.1, %for.end14.1 ]
%arrayidx9 = getelementptr inbounds [101 x i32], ptr %H, i64 0, i64 %indvars.iv38
br label %for.cond5
for.cond5: ; preds = %for.cond5.preheader, %for.body7
%indvars.iv40 = phi i64 [ %indvars.iv38, %for.cond5.preheader ], [ %6, %for.body7 ]
%5 = icmp slt i64 %indvars.iv40, 1
br i1 %5, label %for.end14, label %for.body7
for.body7: ; preds = %for.cond5
%6 = add nsw i64 %indvars.iv40, -1
%7 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [101 x i32], ptr %H, i64 0, i64 %6
%8 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp slt i32 %7, %8
br i1 %cmp12, label %for.end14, label %for.cond5, !llvm.loop !11
for.end14: ; preds = %for.body7, %for.cond5
%add = zext i1 %5 to i32
%spec.select = add nuw nsw i32 %count.034, %add
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%arrayidx9.1 = getelementptr inbounds [101 x i32], ptr %H, i64 0, i64 %indvars.iv.next39
br label %for.cond5.1
for.cond5.1: ; preds = %for.body7.1, %for.end14
%indvars.iv40.1 = phi i64 [ %indvars.iv.next39, %for.end14 ], [ %10, %for.body7.1 ]
%9 = icmp slt i64 %indvars.iv40.1, 1
br i1 %9, label %for.end14.1, label %for.body7.1
for.body7.1: ; preds = %for.cond5.1
%10 = add nsw i64 %indvars.iv40.1, -1
%11 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [101 x i32], ptr %H, i64 0, i64 %10
%12 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5
%cmp12.1 = icmp slt i32 %11, %12
br i1 %cmp12.1, label %for.end14.1, label %for.cond5.1, !llvm.loop !11
for.end14.1: ; preds = %for.body7.1, %for.cond5.1
%add.1 = zext i1 %9 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %add.1
%indvars.iv.next39.1 = add nuw nsw i64 %indvars.iv38, 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.cond5.preheader, !llvm.loop !12
for.end20.loopexit.unr-lcssa: ; preds = %for.end14.1, %for.cond5.preheader.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.cond5.preheader.preheader ], [ %spec.select.1, %for.end14.1 ]
%indvars.iv38.unr = phi i64 [ 1, %for.cond5.preheader.preheader ], [ %indvars.iv.next39.1, %for.end14.1 ]
%count.034.unr = phi i32 [ 1, %for.cond5.preheader.preheader ], [ %spec.select.1, %for.end14.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end20, label %for.cond5.preheader.epil
for.cond5.preheader.epil: ; preds = %for.end20.loopexit.unr-lcssa
%arrayidx9.epil = getelementptr inbounds [101 x i32], ptr %H, i64 0, i64 %indvars.iv38.unr
br label %for.cond5.epil
for.cond5.epil: ; preds = %for.body7.epil, %for.cond5.preheader.epil
%indvars.iv40.epil = phi i64 [ %indvars.iv38.unr, %for.cond5.preheader.epil ], [ %14, %for.body7.epil ]
%13 = icmp slt i64 %indvars.iv40.epil, 1
br i1 %13, label %for.end14.epil, label %for.body7.epil
for.body7.epil: ; preds = %for.cond5.epil
%14 = add nsw i64 %indvars.iv40.epil, -1
%15 = load i32, ptr %arrayidx9.epil, align 4, !tbaa !5
%arrayidx11.epil = getelementptr inbounds [101 x i32], ptr %H, i64 0, i64 %14
%16 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5
%cmp12.epil = icmp slt i32 %15, %16
br i1 %cmp12.epil, label %for.end14.epil, label %for.cond5.epil, !llvm.loop !11
for.end14.epil: ; preds = %for.body7.epil, %for.cond5.epil
%add.epil = zext i1 %13 to i32
%spec.select.epil = add nuw nsw i32 %count.034.unr, %add.epil
br label %for.end20
for.end20: ; preds = %for.end14.epil, %for.end20.loopexit.unr-lcssa, %entry, %for.cond2.preheader
%count.0.lcssa = phi i32 [ 1, %for.cond2.preheader ], [ 1, %entry ], [ %spec.select.lcssa.ph, %for.end20.loopexit.unr-lcssa ], [ %spec.select.epil, %for.end14.epil ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %H) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n, m=0, ans=0;
int *hs;
scanf("%d", &n);
hs = malloc(sizeof(int)*n);
for(int i=0;i<n;i++) scanf("%d", hs+i);
m = hs[0];
for(int i=0;i<n;i++){
if(hs[i] >= m){
ans++;
m = hs[i];
}
}
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275599/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275599/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%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) #6
%cmp30 = icmp sgt i32 %0, 0
br i1 %cmp30, label %for.body, label %for.cond.cleanup8
for.cond.cleanup: ; preds = %for.body
%cmp632 = icmp sgt i32 %2, 0
br i1 %cmp632, label %for.body9.preheader, label %for.cond.cleanup8
for.body9.preheader: ; preds = %for.cond.cleanup
%.pre = load i32, ptr %call1, align 4, !tbaa !5
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %2, 1
br i1 %1, label %for.cond.cleanup8.loopexit.unr-lcssa, label %for.body9.preheader.new
for.body9.preheader.new: ; preds = %for.body9.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 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)
%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.loopexit.unr-lcssa: ; preds = %for.body9, %for.body9.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body9.preheader ], [ %spec.select.1, %for.body9 ]
%indvars.iv39.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next40.1, %for.body9 ]
%m.034.unr = phi i32 [ %.pre, %for.body9.preheader ], [ %spec.select29.1, %for.body9 ]
%ans.033.unr = phi i32 [ 0, %for.body9.preheader ], [ %spec.select.1, %for.body9 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup8, label %for.body9.epil
for.body9.epil: ; preds = %for.cond.cleanup8.loopexit.unr-lcssa
%arrayidx10.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv39.unr
%4 = load i32, ptr %arrayidx10.epil, align 4, !tbaa !5
%cmp11.not.epil = icmp sge i32 %4, %m.034.unr
%inc13.epil = zext i1 %cmp11.not.epil to i32
%spec.select.epil = add nuw nsw i32 %ans.033.unr, %inc13.epil
br label %for.cond.cleanup8
for.cond.cleanup8: ; preds = %for.body9.epil, %for.cond.cleanup8.loopexit.unr-lcssa, %entry, %for.cond.cleanup
%ans.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ 0, %entry ], [ %spec.select.lcssa.ph, %for.cond.cleanup8.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body9.epil ]
%call19 = 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 %n) #5
ret i32 0
for.body9: ; preds = %for.body9, %for.body9.preheader.new
%indvars.iv39 = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next40.1, %for.body9 ]
%m.034 = phi i32 [ %.pre, %for.body9.preheader.new ], [ %spec.select29.1, %for.body9 ]
%ans.033 = phi i32 [ 0, %for.body9.preheader.new ], [ %spec.select.1, %for.body9 ]
%niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.1, %for.body9 ]
%arrayidx10 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv39
%5 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11.not = icmp sge i32 %5, %m.034
%inc13 = zext i1 %cmp11.not to i32
%spec.select = add nuw nsw i32 %ans.033, %inc13
%spec.select29 = call i32 @llvm.smax.i32(i32 %5, i32 %m.034)
%indvars.iv.next40 = or i64 %indvars.iv39, 1
%arrayidx10.1 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next40
%6 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%cmp11.not.1 = icmp sge i32 %6, %spec.select29
%inc13.1 = zext i1 %cmp11.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc13.1
%spec.select29.1 = call i32 @llvm.smax.i32(i32 %6, i32 %spec.select29)
%indvars.iv.next40.1 = add nuw nsw i64 %indvars.iv39, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup8.loopexit.unr-lcssa, label %for.body9, !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 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: 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.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(int argc, char const *argv[]) {
int N,H,count=0,maxH=0;
scanf("%d\n",&N);
while (N > 0) {
scanf("%d",&H);
if (maxH <= H) {
maxH = H;
count++;
}
N--;
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275641/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275641/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%H = 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 %H) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%.pr = load i32, ptr %N, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %.pr, 0
br i1 %cmp6, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%maxH.08 = phi i32 [ %spec.select5, %while.body ], [ 0, %entry ]
%count.07 = phi i32 [ %spec.select, %while.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %H)
%0 = load i32, ptr %H, align 4, !tbaa !5
%cmp2.not = icmp sle i32 %maxH.08, %0
%inc = zext i1 %cmp2.not to i32
%spec.select = add nuw nsw i32 %count.07, %inc
%spec.select5 = call i32 @llvm.smax.i32(i32 %maxH.08, i32 %0)
%1 = load i32, ptr %N, align 4, !tbaa !5
%dec = add nsw i32 %1, -1
store i32 %dec, ptr %N, align 4, !tbaa !5
%cmp = icmp sgt i32 %1, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %while.body ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int n,max,ans=0;
scanf("%d",&n);
int h[n],i;
for(i=0;i<n;i++) scanf("%d",&h[i]);
max=h[0];
for(i=0;i<n;i++){
if(max<=h[i]){
ans++;
max=h[i];
}
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275692/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275692/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #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
%cmp24 = icmp sgt i32 %3, 0
br i1 %cmp24, label %for.body, label %for.end14
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
%cmp426 = icmp sgt i32 %4, 0
br i1 %cmp426, label %for.body5.preheader, label %for.end14
for.body5.preheader: ; preds = %for.end
%.pre = load i32, ptr %vla, align 16, !tbaa !5
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count, 1
%6 = icmp eq i32 %4, 1
br i1 %6, label %for.end14.loopexit.unr-lcssa, label %for.body5.preheader.new
for.body5.preheader.new: ; preds = %for.body5.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body5
for.body5: ; preds = %for.body5, %for.body5.preheader.new
%indvars.iv33 = phi i64 [ 0, %for.body5.preheader.new ], [ %indvars.iv.next34.1, %for.body5 ]
%max.028 = phi i32 [ %.pre, %for.body5.preheader.new ], [ %spec.select23.1, %for.body5 ]
%ans.027 = phi i32 [ 0, %for.body5.preheader.new ], [ %spec.select.1, %for.body5 ]
%niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.1, %for.body5 ]
%arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv33
%7 = load i32, ptr %arrayidx7, align 8, !tbaa !5
%cmp8.not = icmp sle i32 %max.028, %7
%inc9 = zext i1 %cmp8.not to i32
%spec.select = add nuw nsw i32 %ans.027, %inc9
%spec.select23 = call i32 @llvm.smax.i32(i32 %max.028, i32 %7)
%indvars.iv.next34 = or i64 %indvars.iv33, 1
%arrayidx7.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next34
%8 = load i32, ptr %arrayidx7.1, align 4, !tbaa !5
%cmp8.not.1 = icmp sle i32 %spec.select23, %8
%inc9.1 = zext i1 %cmp8.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc9.1
%spec.select23.1 = call i32 @llvm.smax.i32(i32 %spec.select23, i32 %8)
%indvars.iv.next34.1 = add nuw nsw i64 %indvars.iv33, 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.end14.loopexit.unr-lcssa, label %for.body5, !llvm.loop !11
for.end14.loopexit.unr-lcssa: ; preds = %for.body5, %for.body5.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body5.preheader ], [ %spec.select.1, %for.body5 ]
%indvars.iv33.unr = phi i64 [ 0, %for.body5.preheader ], [ %indvars.iv.next34.1, %for.body5 ]
%max.028.unr = phi i32 [ %.pre, %for.body5.preheader ], [ %spec.select23.1, %for.body5 ]
%ans.027.unr = phi i32 [ 0, %for.body5.preheader ], [ %spec.select.1, %for.body5 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end14, label %for.body5.epil
for.body5.epil: ; preds = %for.end14.loopexit.unr-lcssa
%arrayidx7.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv33.unr
%9 = load i32, ptr %arrayidx7.epil, align 4, !tbaa !5
%cmp8.not.epil = icmp sle i32 %max.028.unr, %9
%inc9.epil = zext i1 %cmp8.not.epil to i32
%spec.select.epil = add nuw nsw i32 %ans.027.unr, %inc9.epil
br label %for.end14
for.end14: ; preds = %for.body5.epil, %for.end14.loopexit.unr-lcssa, %entry, %for.end
%ans.0.lcssa = phi i32 [ 0, %for.end ], [ 0, %entry ], [ %spec.select.lcssa.ph, %for.end14.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body5.epil ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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}
|
#define TEST_SNO 1
#define TEST_ENO 1
#define ll long long
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
typedef struct data {
int a;
int b;
} data;
FILE *in, *ans;
int tno;
int out(const char *s) {
#ifdef TEST
char buf[8192];
fgets(buf, sizeof(buf), ans);
if (strcmp(buf, s)) {
printf("err\n");
}
#else
printf(s);
#endif
return 0;
}
int outi(int i) {
char s[128];
sprintf(s, "%d\n", i);
out(s);
return 0;
}
int outll(ll l) {
char s[128];
sprintf(s, "%lld\n", l);
out(s);
return 0;
}
int geti() {
int i;
fscanf(in, "%d", &i);
return i;
}
ll getll() {
ll l;
fscanf(in, "%lld", &l);
return l;
}
int getstr(char *s) {
fscanf(in, "%s", s);
return 0;
}
int fnc() {
int i;
int n = geti();
int m = geti();
int w = 1;
for (i = 1; i < n; i++) {
int v = geti();
if (v >= m) {
m = v;
w++;
}
}
outi(w);
return 0;
}
int main() {
#ifdef TEST
for (tno = TEST_SNO; tno <= TEST_ENO; tno++) {
char str[128];
sprintf(str, "test%d.txt", tno);
in = fopen(str, "r");
sprintf(str, "ans%d.txt", tno);
ans = fopen(str, "r");
fnc();
fclose(in);
fclose(ans);
}
printf("end\n");
#else
in = stdin;
fnc();
#endif
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275735/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275735/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@in = dso_local local_unnamed_addr global ptr null, align 8
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@ans = dso_local local_unnamed_addr global ptr null, align 8
@tno = dso_local local_unnamed_addr global i32 0, align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @out(ptr nocapture noundef readonly %s) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %s)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @outi(i32 noundef %i) local_unnamed_addr #0 {
entry:
%s = alloca [128 x i8], align 16
call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %s) #6
%call = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i) #6
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %s)
call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %s) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @outll(i64 noundef %l) local_unnamed_addr #0 {
entry:
%s = alloca [128 x i8], align 16
call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %s) #6
%call = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %l) #6
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %s)
call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %s) #6
ret i32 0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @geti() local_unnamed_addr #3 {
entry:
%i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #6
%0 = load ptr, ptr @in, align 8, !tbaa !5
%call = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str.2, ptr noundef nonnull %i) #6
%1 = load i32, ptr %i, align 4, !tbaa !9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #6
ret i32 %1
}
declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #4
; Function Attrs: nounwind uwtable
define dso_local i64 @getll() local_unnamed_addr #3 {
entry:
%l = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %l) #6
%0 = load ptr, ptr @in, align 8, !tbaa !5
%call = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str.3, ptr noundef nonnull %l) #6
%1 = load i64, ptr %l, align 8, !tbaa !11
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %l) #6
ret i64 %1
}
; Function Attrs: nounwind uwtable
define dso_local i32 @getstr(ptr noundef %s) local_unnamed_addr #3 {
entry:
%0 = load ptr, ptr @in, align 8, !tbaa !5
%call = tail call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str.4, ptr noundef %s) #6
ret i32 0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @fnc() local_unnamed_addr #3 {
entry:
%s.i = alloca [128 x i8], align 16
%i.i12 = alloca i32, align 4
%i.i10 = alloca i32, align 4
%i.i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i) #6
%0 = load ptr, ptr @in, align 8, !tbaa !5
%call.i = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str.2, ptr noundef nonnull %i.i) #6
%1 = load i32, ptr %i.i, align 4, !tbaa !9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i10) #6
%2 = load ptr, ptr @in, align 8, !tbaa !5
%call.i11 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %2, ptr noundef nonnull @.str.2, ptr noundef nonnull %i.i10) #6
%3 = load i32, ptr %i.i10, align 4, !tbaa !9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i10) #6
%cmp15 = icmp sgt i32 %1, 1
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.018 = phi i32 [ %inc4, %for.body ], [ 1, %entry ]
%w.017 = phi i32 [ %spec.select9, %for.body ], [ 1, %entry ]
%m.016 = phi i32 [ %spec.select, %for.body ], [ %3, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i12) #6
%4 = load ptr, ptr @in, align 8, !tbaa !5
%call.i13 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %4, ptr noundef nonnull @.str.2, ptr noundef nonnull %i.i12) #6
%5 = load i32, ptr %i.i12, align 4, !tbaa !9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i12) #6
%cmp3.not = icmp sge i32 %5, %m.016
%spec.select = call i32 @llvm.smax.i32(i32 %5, i32 %m.016)
%inc = zext i1 %cmp3.not to i32
%spec.select9 = add nuw nsw i32 %w.017, %inc
%inc4 = add nuw nsw i32 %i.018, 1
%exitcond.not = icmp eq i32 %inc4, %1
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %entry
%w.0.lcssa = phi i32 [ 1, %entry ], [ %spec.select9, %for.body ]
call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %s.i) #6
%call.i14 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %s.i, ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %w.0.lcssa) #6
%call.i.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %s.i)
call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %s.i) #6
ret i32 0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
store ptr %0, ptr @in, align 8, !tbaa !5
%call = tail call i32 @fnc()
ret i32 0
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int w,h;
int map[50][50];
void rec(int x, int y){
int i,j;
map[x][y]=0;
for(i=-1;i<2;i++){
for(j=-1;j<2;j++){
if(x+i>=0&&x+i<h&&y+j>=0&&y+j<w){
if(map[x+i][y+j]){
rec(x+i, y+j);
}
}
}
}
return;
}
int main(void){
int i,j,count;
while(scanf("%d %d",&w,&h),w||h){
for(i=0;i<h;i++){
for(j=0;j<w;j++){
scanf("%d",&map[i][j]);
}
}
count=0;
for(i=0;i<h;i++){
for(j=0;j<w;j++){
if(map[i][j]){
count++;
rec(i,j);
}
}
}
printf("%d\n",count);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275779/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275779/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@map = dso_local global [50 x [50 x i32]] zeroinitializer, align 16
@h = dso_local global i32 0, align 4
@w = dso_local global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @rec(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.then.2.2, %entry
%x.tr = phi i32 [ %x, %entry ], [ %add.290, %if.then.2.2 ]
%y.tr = phi i32 [ %y, %entry ], [ %add10.2.2, %if.then.2.2 ]
%idxprom = sext i32 %x.tr to i64
%idxprom1 = sext i32 %y.tr to i64
%arrayidx2 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %idxprom, i64 %idxprom1
store i32 0, ptr %arrayidx2, align 4, !tbaa !5
%add = add i32 %x.tr, -1
%cmp6 = icmp sgt i32 %add, -1
%idxprom16 = zext i32 %add to i64
br i1 %cmp6, label %for.cond3.preheader.split, label %for.inc25
for.cond3.preheader.split: ; preds = %tailrecurse
%0 = load i32, ptr @h, align 4
%1 = icmp slt i32 %add, %0
br i1 %1, label %land.lhs.true9, label %for.inc25
land.lhs.true9: ; preds = %for.cond3.preheader.split
%add10 = add nsw i32 %y.tr, -1
%cmp11 = icmp sgt i32 %y.tr, 0
%2 = load i32, ptr @w, align 4
%cmp14 = icmp sge i32 %2, %y.tr
%or.cond46 = select i1 %cmp11, i1 %cmp14, i1 false
br i1 %or.cond46, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true9
%idxprom19 = zext i32 %add10 to i64
%arrayidx20 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %idxprom16, i64 %idxprom19
%3 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%tobool.not = icmp eq i32 %3, 0
br i1 %tobool.not, label %for.inc, label %if.then21
if.then21: ; preds = %if.then
tail call void @rec(i32 noundef %add, i32 noundef %add10)
%.pre = load i32, ptr @h, align 4
br label %for.inc
for.inc: ; preds = %land.lhs.true9, %if.then21, %if.then
%4 = phi i32 [ %0, %land.lhs.true9 ], [ %.pre, %if.then21 ], [ %0, %if.then ]
%cmp8.1 = icmp slt i32 %add, %4
br i1 %cmp8.1, label %land.lhs.true9.1, label %for.inc.1
land.lhs.true9.1: ; preds = %for.inc
%cmp11.1 = icmp sgt i32 %y.tr, -1
%5 = load i32, ptr @w, align 4
%cmp14.1 = icmp sgt i32 %5, %y.tr
%or.cond46.1 = select i1 %cmp11.1, i1 %cmp14.1, i1 false
br i1 %or.cond46.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %land.lhs.true9.1
%idxprom19.1 = zext i32 %y.tr to i64
%arrayidx20.1 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %idxprom16, i64 %idxprom19.1
%6 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5
%tobool.not.1 = icmp eq i32 %6, 0
br i1 %tobool.not.1, label %for.inc.1, label %if.then21.1
if.then21.1: ; preds = %if.then.1
tail call void @rec(i32 noundef %add, i32 noundef %y.tr)
%.pre79 = load i32, ptr @h, align 4
br label %for.inc.1
for.inc.1: ; preds = %if.then21.1, %if.then.1, %land.lhs.true9.1, %for.inc
%7 = phi i32 [ %.pre79, %if.then21.1 ], [ %4, %if.then.1 ], [ %4, %land.lhs.true9.1 ], [ %4, %for.inc ]
%cmp8.2 = icmp slt i32 %add, %7
br i1 %cmp8.2, label %land.lhs.true9.2, label %for.cond3.preheader.split.1
land.lhs.true9.2: ; preds = %for.inc.1
%add10.2 = add nsw i32 %y.tr, 1
%cmp11.2 = icmp sgt i32 %y.tr, -2
%8 = load i32, ptr @w, align 4
%cmp14.2 = icmp slt i32 %add10.2, %8
%or.cond46.2 = select i1 %cmp11.2, i1 %cmp14.2, i1 false
br i1 %or.cond46.2, label %if.then.2, label %for.cond3.preheader.split.1
if.then.2: ; preds = %land.lhs.true9.2
%idxprom19.2 = zext i32 %add10.2 to i64
%arrayidx20.2 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %idxprom16, i64 %idxprom19.2
%9 = load i32, ptr %arrayidx20.2, align 4, !tbaa !5
%tobool.not.2 = icmp eq i32 %9, 0
br i1 %tobool.not.2, label %for.cond3.preheader.split.1, label %if.then21.2
if.then21.2: ; preds = %if.then.2
tail call void @rec(i32 noundef %add, i32 noundef %add10.2)
br label %for.cond3.preheader.split.1
for.inc25: ; preds = %for.cond3.preheader.split, %tailrecurse
%cmp6.1 = icmp sgt i32 %x.tr, -1
br i1 %cmp6.1, label %for.cond3.preheader.split.1, label %for.inc25.1
for.cond3.preheader.split.1: ; preds = %if.then21.2, %if.then.2, %land.lhs.true9.2, %for.inc.1, %for.inc25
%idxprom16.186 = zext i32 %x.tr to i64
%10 = load i32, ptr @h, align 4
%11 = icmp sgt i32 %10, %x.tr
br i1 %11, label %land.lhs.true9.160, label %for.inc25.1
land.lhs.true9.160: ; preds = %for.cond3.preheader.split.1
%add10.1 = add nsw i32 %y.tr, -1
%cmp11.157 = icmp sgt i32 %y.tr, 0
%12 = load i32, ptr @w, align 4
%cmp14.158 = icmp sge i32 %12, %y.tr
%or.cond46.159 = select i1 %cmp11.157, i1 %cmp14.158, i1 false
br i1 %or.cond46.159, label %if.then.164, label %for.inc.166
if.then.164: ; preds = %land.lhs.true9.160
%idxprom19.161 = zext i32 %add10.1 to i64
%arrayidx20.162 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %idxprom16.186, i64 %idxprom19.161
%13 = load i32, ptr %arrayidx20.162, align 4, !tbaa !5
%tobool.not.163 = icmp eq i32 %13, 0
br i1 %tobool.not.163, label %for.inc.166, label %if.then21.165
if.then21.165: ; preds = %if.then.164
tail call void @rec(i32 noundef %x.tr, i32 noundef %add10.1)
%.pre80 = load i32, ptr @h, align 4
br label %for.inc.166
for.inc.166: ; preds = %if.then21.165, %if.then.164, %land.lhs.true9.160
%14 = phi i32 [ %.pre80, %if.then21.165 ], [ %10, %if.then.164 ], [ %10, %land.lhs.true9.160 ]
%cmp8.1.1 = icmp sgt i32 %14, %x.tr
br i1 %cmp8.1.1, label %land.lhs.true9.1.1, label %for.inc.1.1
land.lhs.true9.1.1: ; preds = %for.inc.166
%cmp11.1.1 = icmp sgt i32 %y.tr, -1
%15 = load i32, ptr @w, align 4
%cmp14.1.1 = icmp sgt i32 %15, %y.tr
%or.cond46.1.1 = select i1 %cmp11.1.1, i1 %cmp14.1.1, i1 false
br i1 %or.cond46.1.1, label %if.then.1.1, label %for.inc.1.1
if.then.1.1: ; preds = %land.lhs.true9.1.1
%idxprom19.1.1 = zext i32 %y.tr to i64
%arrayidx20.1.1 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %idxprom16.186, i64 %idxprom19.1.1
%16 = load i32, ptr %arrayidx20.1.1, align 4, !tbaa !5
%tobool.not.1.1 = icmp eq i32 %16, 0
br i1 %tobool.not.1.1, label %for.inc.1.1, label %if.then21.1.1
if.then21.1.1: ; preds = %if.then.1.1
tail call void @rec(i32 noundef %x.tr, i32 noundef %y.tr)
%.pre81 = load i32, ptr @h, align 4
br label %for.inc.1.1
for.inc.1.1: ; preds = %if.then21.1.1, %if.then.1.1, %land.lhs.true9.1.1, %for.inc.166
%17 = phi i32 [ %.pre81, %if.then21.1.1 ], [ %14, %if.then.1.1 ], [ %14, %land.lhs.true9.1.1 ], [ %14, %for.inc.166 ]
%cmp8.2.1 = icmp sgt i32 %17, %x.tr
br i1 %cmp8.2.1, label %land.lhs.true9.2.1, label %for.inc25.1.thread
land.lhs.true9.2.1: ; preds = %for.inc.1.1
%add10.2.1 = add nsw i32 %y.tr, 1
%cmp11.2.1 = icmp sgt i32 %y.tr, -2
%18 = load i32, ptr @w, align 4
%cmp14.2.1 = icmp slt i32 %add10.2.1, %18
%or.cond46.2.1 = select i1 %cmp11.2.1, i1 %cmp14.2.1, i1 false
br i1 %or.cond46.2.1, label %if.then.2.1, label %for.inc25.1.thread
if.then.2.1: ; preds = %land.lhs.true9.2.1
%idxprom19.2.1 = zext i32 %add10.2.1 to i64
%arrayidx20.2.1 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %idxprom16.186, i64 %idxprom19.2.1
%19 = load i32, ptr %arrayidx20.2.1, align 4, !tbaa !5
%tobool.not.2.1 = icmp eq i32 %19, 0
br i1 %tobool.not.2.1, label %for.inc25.1.thread, label %if.then21.2.1
if.then21.2.1: ; preds = %if.then.2.1
tail call void @rec(i32 noundef %x.tr, i32 noundef %add10.2.1)
br label %for.inc25.1.thread
for.inc25.1.thread: ; preds = %for.inc.1.1, %land.lhs.true9.2.1, %if.then.2.1, %if.then21.2.1
%add.287 = add nuw nsw i32 %x.tr, 1
br label %for.cond3.preheader.split.2
for.inc25.1: ; preds = %for.cond3.preheader.split.1, %for.inc25
%add.2 = add i32 %x.tr, 1
%cmp6.2 = icmp sgt i32 %add.2, -1
br i1 %cmp6.2, label %for.cond3.preheader.split.2, label %for.inc25.2
for.cond3.preheader.split.2: ; preds = %for.inc25.1.thread, %for.inc25.1
%add.290 = phi i32 [ %add.287, %for.inc25.1.thread ], [ %add.2, %for.inc25.1 ]
%idxprom16.291 = zext i32 %add.290 to i64
%20 = load i32, ptr @h, align 4
%21 = icmp slt i32 %add.290, %20
br i1 %21, label %land.lhs.true9.272, label %for.inc25.2
land.lhs.true9.272: ; preds = %for.cond3.preheader.split.2
%add10.268 = add nsw i32 %y.tr, -1
%cmp11.269 = icmp sgt i32 %y.tr, 0
%22 = load i32, ptr @w, align 4
%cmp14.270 = icmp sge i32 %22, %y.tr
%or.cond46.271 = select i1 %cmp11.269, i1 %cmp14.270, i1 false
br i1 %or.cond46.271, label %if.then.276, label %for.inc.278
if.then.276: ; preds = %land.lhs.true9.272
%idxprom19.273 = zext i32 %add10.268 to i64
%arrayidx20.274 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %idxprom16.291, i64 %idxprom19.273
%23 = load i32, ptr %arrayidx20.274, align 4, !tbaa !5
%tobool.not.275 = icmp eq i32 %23, 0
br i1 %tobool.not.275, label %for.inc.278, label %if.then21.277
if.then21.277: ; preds = %if.then.276
tail call void @rec(i32 noundef %add.290, i32 noundef %add10.268)
%.pre82 = load i32, ptr @h, align 4
br label %for.inc.278
for.inc.278: ; preds = %if.then21.277, %if.then.276, %land.lhs.true9.272
%24 = phi i32 [ %.pre82, %if.then21.277 ], [ %20, %if.then.276 ], [ %20, %land.lhs.true9.272 ]
%cmp8.1.2 = icmp slt i32 %add.290, %24
br i1 %cmp8.1.2, label %land.lhs.true9.1.2, label %for.inc.1.2
land.lhs.true9.1.2: ; preds = %for.inc.278
%cmp11.1.2 = icmp sgt i32 %y.tr, -1
%25 = load i32, ptr @w, align 4
%cmp14.1.2 = icmp sgt i32 %25, %y.tr
%or.cond46.1.2 = select i1 %cmp11.1.2, i1 %cmp14.1.2, i1 false
br i1 %or.cond46.1.2, label %if.then.1.2, label %for.inc.1.2
if.then.1.2: ; preds = %land.lhs.true9.1.2
%idxprom19.1.2 = zext i32 %y.tr to i64
%arrayidx20.1.2 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %idxprom16.291, i64 %idxprom19.1.2
%26 = load i32, ptr %arrayidx20.1.2, align 4, !tbaa !5
%tobool.not.1.2 = icmp eq i32 %26, 0
br i1 %tobool.not.1.2, label %for.inc.1.2, label %if.then21.1.2
if.then21.1.2: ; preds = %if.then.1.2
tail call void @rec(i32 noundef %add.290, i32 noundef %y.tr)
%.pre83 = load i32, ptr @h, align 4
br label %for.inc.1.2
for.inc.1.2: ; preds = %if.then21.1.2, %if.then.1.2, %land.lhs.true9.1.2, %for.inc.278
%27 = phi i32 [ %.pre83, %if.then21.1.2 ], [ %24, %if.then.1.2 ], [ %24, %land.lhs.true9.1.2 ], [ %24, %for.inc.278 ]
%cmp8.2.2 = icmp slt i32 %add.290, %27
br i1 %cmp8.2.2, label %land.lhs.true9.2.2, label %for.inc25.2
land.lhs.true9.2.2: ; preds = %for.inc.1.2
%add10.2.2 = add nsw i32 %y.tr, 1
%cmp11.2.2 = icmp sgt i32 %y.tr, -2
%28 = load i32, ptr @w, align 4
%cmp14.2.2 = icmp slt i32 %add10.2.2, %28
%or.cond46.2.2 = select i1 %cmp11.2.2, i1 %cmp14.2.2, i1 false
br i1 %or.cond46.2.2, label %if.then.2.2, label %for.inc25.2
if.then.2.2: ; preds = %land.lhs.true9.2.2
%idxprom19.2.2 = zext i32 %add10.2.2 to i64
%arrayidx20.2.2 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %idxprom16.291, i64 %idxprom19.2.2
%29 = load i32, ptr %arrayidx20.2.2, align 4, !tbaa !5
%tobool.not.2.2 = icmp eq i32 %29, 0
br i1 %tobool.not.2.2, label %for.inc25.2, label %tailrecurse
for.inc25.2: ; preds = %for.inc.1.2, %land.lhs.true9.2.2, %if.then.2.2, %for.cond3.preheader.split.2, %for.inc25.1
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call54 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @w, ptr noundef nonnull @h)
%0 = load i32, ptr @w, align 4, !tbaa !5
%tobool55 = icmp ne i32 %0, 0
%1 = load i32, ptr @h, align 4
%tobool156 = icmp ne i32 %1, 0
%2 = select i1 %tobool55, i1 true, i1 %tobool156
br i1 %2, label %for.cond.preheader, label %while.end
for.cond.preheader: ; preds = %entry, %for.end28
%3 = phi i32 [ %27, %for.end28 ], [ %0, %entry ]
%4 = phi i32 [ %28, %for.end28 ], [ %1, %entry ]
%cmp45 = icmp sgt i32 %4, 0
%5 = icmp sgt i32 %3, 0
%or.cond = and i1 %cmp45, %5
br i1 %or.cond, label %for.cond2.preheader, label %for.end28
for.cond11.preheader: ; preds = %for.inc8
%cmp1250 = icmp sgt i32 %11, 0
%6 = icmp sgt i32 %12, 0
%or.cond77 = and i1 %cmp1250, %6
br i1 %or.cond77, label %for.cond14.preheader, label %for.end28
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc8
%7 = phi i32 [ %11, %for.inc8 ], [ %4, %for.cond.preheader ]
%8 = phi i32 [ %12, %for.inc8 ], [ %3, %for.cond.preheader ]
%indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.inc8 ], [ 0, %for.cond.preheader ]
%cmp343 = icmp sgt i32 %8, 0
br i1 %cmp343, label %for.body4, label %for.inc8
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %indvars.iv60, i64 %indvars.iv
%call7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr @w, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp3 = icmp slt i64 %indvars.iv.next, %10
br i1 %cmp3, label %for.body4, label %for.inc8.loopexit, !llvm.loop !9
for.inc8.loopexit: ; preds = %for.body4
%.pre = load i32, ptr @h, align 4, !tbaa !5
br label %for.inc8
for.inc8: ; preds = %for.inc8.loopexit, %for.cond2.preheader
%11 = phi i32 [ %.pre, %for.inc8.loopexit ], [ %7, %for.cond2.preheader ]
%12 = phi i32 [ %9, %for.inc8.loopexit ], [ %8, %for.cond2.preheader ]
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
%13 = sext i32 %11 to i64
%cmp = icmp slt i64 %indvars.iv.next61, %13
br i1 %cmp, label %for.cond2.preheader, label %for.cond11.preheader, !llvm.loop !11
for.cond14.preheader: ; preds = %for.cond11.preheader, %for.inc26
%14 = phi i32 [ %23, %for.inc26 ], [ %11, %for.cond11.preheader ]
%15 = phi i32 [ %24, %for.inc26 ], [ %12, %for.cond11.preheader ]
%16 = phi i32 [ %25, %for.inc26 ], [ %12, %for.cond11.preheader ]
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.inc26 ], [ 0, %for.cond11.preheader ]
%count.052 = phi i32 [ %count.1.lcssa, %for.inc26 ], [ 0, %for.cond11.preheader ]
%cmp1547 = icmp sgt i32 %16, 0
br i1 %cmp1547, label %for.body16.lr.ph, label %for.inc26
for.body16.lr.ph: ; preds = %for.cond14.preheader
%17 = trunc i64 %indvars.iv66 to i32
br label %for.body16
for.body16: ; preds = %for.body16.lr.ph, %for.inc23
%18 = phi i32 [ %15, %for.body16.lr.ph ], [ %21, %for.inc23 ]
%indvars.iv63 = phi i64 [ 0, %for.body16.lr.ph ], [ %indvars.iv.next64, %for.inc23 ]
%count.149 = phi i32 [ %count.052, %for.body16.lr.ph ], [ %count.2, %for.inc23 ]
%arrayidx20 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %indvars.iv66, i64 %indvars.iv63
%19 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%tobool21.not = icmp eq i32 %19, 0
br i1 %tobool21.not, label %for.inc23, label %if.then
if.then: ; preds = %for.body16
%inc22 = add nsw i32 %count.149, 1
%20 = trunc i64 %indvars.iv63 to i32
tail call void @rec(i32 noundef %17, i32 noundef %20)
%.pre69 = load i32, ptr @w, align 4, !tbaa !5
br label %for.inc23
for.inc23: ; preds = %for.body16, %if.then
%21 = phi i32 [ %.pre69, %if.then ], [ %18, %for.body16 ]
%count.2 = phi i32 [ %inc22, %if.then ], [ %count.149, %for.body16 ]
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%22 = sext i32 %21 to i64
%cmp15 = icmp slt i64 %indvars.iv.next64, %22
br i1 %cmp15, label %for.body16, label %for.inc26.loopexit, !llvm.loop !13
for.inc26.loopexit: ; preds = %for.inc23
%.pre70 = load i32, ptr @h, align 4, !tbaa !5
br label %for.inc26
for.inc26: ; preds = %for.inc26.loopexit, %for.cond14.preheader
%23 = phi i32 [ %14, %for.cond14.preheader ], [ %.pre70, %for.inc26.loopexit ]
%24 = phi i32 [ %15, %for.cond14.preheader ], [ %21, %for.inc26.loopexit ]
%25 = phi i32 [ %16, %for.cond14.preheader ], [ %21, %for.inc26.loopexit ]
%count.1.lcssa = phi i32 [ %count.052, %for.cond14.preheader ], [ %count.2, %for.inc26.loopexit ]
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%26 = sext i32 %23 to i64
%cmp12 = icmp slt i64 %indvars.iv.next67, %26
br i1 %cmp12, label %for.cond14.preheader, label %for.end28, !llvm.loop !14
for.end28: ; preds = %for.inc26, %for.cond.preheader, %for.cond11.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond11.preheader ], [ 0, %for.cond.preheader ], [ %count.1.lcssa, %for.inc26 ]
%call29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa)
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @w, ptr noundef nonnull @h)
%27 = load i32, ptr @w, align 4, !tbaa !5
%tobool = icmp ne i32 %27, 0
%28 = load i32, ptr @h, align 4
%tobool1 = icmp ne i32 %28, 0
%29 = select i1 %tobool, i1 true, i1 %tobool1
br i1 %29, label %for.cond.preheader, label %while.end, !llvm.loop !15
while.end: ; preds = %for.end28, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int w, h;
int t[52][52];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
void solve(int x, int y){
int i;
int nx, ny;
t[y][x] = 0;
for(i = 0; i < 8; i++){
nx = x + dx[i];
ny = y + dy[i];
if(nx < 0 || w <= nx || ny < 0 || h <= ny || t[ny][nx] == 0) continue;
solve(nx, ny);
}
}
int main(void){
int i, j;
int ans = 0;
while(scanf("%d %d", &w, &h), w || h){
for(i = 0; i < h; i++){
for(j = 0; j < w; j++){
scanf("%d", &t[i][j]);
}
}
ans = 0;
for(i = 0; i < h; i++){
for(j = 0; j < w; j++){
if(t[i][j] == 1){
solve(j, i);
ans++;
}
}
}
printf("%d\n", ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275829/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275829/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@dx = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 0, i32 1, i32 -1, i32 1, i32 -1, i32 0, i32 1], align 16
@dy = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 -1, i32 -1, i32 0, i32 0, i32 1, i32 1, i32 1], align 16
@t = dso_local global [52 x [52 x i32]] zeroinitializer, align 16
@w = dso_local global i32 0, align 4
@h = dso_local global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @solve(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %lor.lhs.false14.7, %entry
%x.tr = phi i32 [ %x, %entry ], [ %add.7, %lor.lhs.false14.7 ]
%y.tr = phi i32 [ %y, %entry ], [ %add7.7, %lor.lhs.false14.7 ]
%idxprom = sext i32 %y.tr to i64
%idxprom1 = sext i32 %x.tr to i64
%arrayidx2 = getelementptr inbounds [52 x [52 x i32]], ptr @t, i64 0, i64 %idxprom, i64 %idxprom1
store i32 0, ptr %arrayidx2, align 4, !tbaa !5
%0 = load i32, ptr @dx, align 16, !tbaa !5
%add = add nsw i32 %0, %x.tr
%1 = load i32, ptr @dy, align 16, !tbaa !5
%add7 = add nsw i32 %1, %y.tr
%cmp8 = icmp slt i32 %add, 0
br i1 %cmp8, label %for.inc, label %lor.lhs.false
lor.lhs.false: ; preds = %tailrecurse
%2 = load i32, ptr @w, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %2, %add
%cmp11 = icmp sgt i32 %add7, -1
%or.cond.not32 = select i1 %cmp9, i1 %cmp11, i1 false
%3 = load i32, ptr @h, align 4
%cmp13.not = icmp sgt i32 %3, %add7
%or.cond31 = select i1 %or.cond.not32, i1 %cmp13.not, i1 false
br i1 %or.cond31, label %lor.lhs.false14, label %for.inc
lor.lhs.false14: ; preds = %lor.lhs.false
%idxprom15 = zext i32 %add7 to i64
%idxprom17 = zext i32 %add to i64
%arrayidx18 = getelementptr inbounds [52 x [52 x i32]], ptr @t, i64 0, i64 %idxprom15, i64 %idxprom17
%4 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%cmp19 = icmp eq i32 %4, 0
br i1 %cmp19, label %for.inc, label %if.end
if.end: ; preds = %lor.lhs.false14
tail call void @solve(i32 noundef %add, i32 noundef %add7)
br label %for.inc
for.inc: ; preds = %tailrecurse, %lor.lhs.false, %lor.lhs.false14, %if.end
%5 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @dx, i64 0, i64 1), align 4, !tbaa !5
%add.1 = add nsw i32 %5, %x.tr
%6 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @dy, i64 0, i64 1), align 4, !tbaa !5
%add7.1 = add nsw i32 %6, %y.tr
%cmp8.1 = icmp slt i32 %add.1, 0
br i1 %cmp8.1, label %for.inc.1, label %lor.lhs.false.1
lor.lhs.false.1: ; preds = %for.inc
%7 = load i32, ptr @w, align 4, !tbaa !5
%cmp9.1 = icmp sgt i32 %7, %add.1
%cmp11.1 = icmp sgt i32 %add7.1, -1
%or.cond.not32.1 = select i1 %cmp9.1, i1 %cmp11.1, i1 false
%8 = load i32, ptr @h, align 4
%cmp13.not.1 = icmp sgt i32 %8, %add7.1
%or.cond31.1 = select i1 %or.cond.not32.1, i1 %cmp13.not.1, i1 false
br i1 %or.cond31.1, label %lor.lhs.false14.1, label %for.inc.1
lor.lhs.false14.1: ; preds = %lor.lhs.false.1
%idxprom15.1 = zext i32 %add7.1 to i64
%idxprom17.1 = zext i32 %add.1 to i64
%arrayidx18.1 = getelementptr inbounds [52 x [52 x i32]], ptr @t, i64 0, i64 %idxprom15.1, i64 %idxprom17.1
%9 = load i32, ptr %arrayidx18.1, align 4, !tbaa !5
%cmp19.1 = icmp eq i32 %9, 0
br i1 %cmp19.1, label %for.inc.1, label %if.end.1
if.end.1: ; preds = %lor.lhs.false14.1
tail call void @solve(i32 noundef %add.1, i32 noundef %add7.1)
br label %for.inc.1
for.inc.1: ; preds = %if.end.1, %lor.lhs.false14.1, %lor.lhs.false.1, %for.inc
%10 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @dx, i64 0, i64 2), align 8, !tbaa !5
%add.2 = add nsw i32 %10, %x.tr
%11 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @dy, i64 0, i64 2), align 8, !tbaa !5
%add7.2 = add nsw i32 %11, %y.tr
%cmp8.2 = icmp slt i32 %add.2, 0
br i1 %cmp8.2, label %for.inc.2, label %lor.lhs.false.2
lor.lhs.false.2: ; preds = %for.inc.1
%12 = load i32, ptr @w, align 4, !tbaa !5
%cmp9.2 = icmp sgt i32 %12, %add.2
%cmp11.2 = icmp sgt i32 %add7.2, -1
%or.cond.not32.2 = select i1 %cmp9.2, i1 %cmp11.2, i1 false
%13 = load i32, ptr @h, align 4
%cmp13.not.2 = icmp sgt i32 %13, %add7.2
%or.cond31.2 = select i1 %or.cond.not32.2, i1 %cmp13.not.2, i1 false
br i1 %or.cond31.2, label %lor.lhs.false14.2, label %for.inc.2
lor.lhs.false14.2: ; preds = %lor.lhs.false.2
%idxprom15.2 = zext i32 %add7.2 to i64
%idxprom17.2 = zext i32 %add.2 to i64
%arrayidx18.2 = getelementptr inbounds [52 x [52 x i32]], ptr @t, i64 0, i64 %idxprom15.2, i64 %idxprom17.2
%14 = load i32, ptr %arrayidx18.2, align 4, !tbaa !5
%cmp19.2 = icmp eq i32 %14, 0
br i1 %cmp19.2, label %for.inc.2, label %if.end.2
if.end.2: ; preds = %lor.lhs.false14.2
tail call void @solve(i32 noundef %add.2, i32 noundef %add7.2)
br label %for.inc.2
for.inc.2: ; preds = %if.end.2, %lor.lhs.false14.2, %lor.lhs.false.2, %for.inc.1
%15 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @dx, i64 0, i64 3), align 4, !tbaa !5
%add.3 = add nsw i32 %15, %x.tr
%16 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @dy, i64 0, i64 3), align 4, !tbaa !5
%add7.3 = add nsw i32 %16, %y.tr
%cmp8.3 = icmp slt i32 %add.3, 0
br i1 %cmp8.3, label %for.inc.3, label %lor.lhs.false.3
lor.lhs.false.3: ; preds = %for.inc.2
%17 = load i32, ptr @w, align 4, !tbaa !5
%cmp9.3 = icmp sgt i32 %17, %add.3
%cmp11.3 = icmp sgt i32 %add7.3, -1
%or.cond.not32.3 = select i1 %cmp9.3, i1 %cmp11.3, i1 false
%18 = load i32, ptr @h, align 4
%cmp13.not.3 = icmp sgt i32 %18, %add7.3
%or.cond31.3 = select i1 %or.cond.not32.3, i1 %cmp13.not.3, i1 false
br i1 %or.cond31.3, label %lor.lhs.false14.3, label %for.inc.3
lor.lhs.false14.3: ; preds = %lor.lhs.false.3
%idxprom15.3 = zext i32 %add7.3 to i64
%idxprom17.3 = zext i32 %add.3 to i64
%arrayidx18.3 = getelementptr inbounds [52 x [52 x i32]], ptr @t, i64 0, i64 %idxprom15.3, i64 %idxprom17.3
%19 = load i32, ptr %arrayidx18.3, align 4, !tbaa !5
%cmp19.3 = icmp eq i32 %19, 0
br i1 %cmp19.3, label %for.inc.3, label %if.end.3
if.end.3: ; preds = %lor.lhs.false14.3
tail call void @solve(i32 noundef %add.3, i32 noundef %add7.3)
br label %for.inc.3
for.inc.3: ; preds = %if.end.3, %lor.lhs.false14.3, %lor.lhs.false.3, %for.inc.2
%20 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @dx, i64 0, i64 4), align 16, !tbaa !5
%add.4 = add nsw i32 %20, %x.tr
%21 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @dy, i64 0, i64 4), align 16, !tbaa !5
%add7.4 = add nsw i32 %21, %y.tr
%cmp8.4 = icmp slt i32 %add.4, 0
br i1 %cmp8.4, label %for.inc.4, label %lor.lhs.false.4
lor.lhs.false.4: ; preds = %for.inc.3
%22 = load i32, ptr @w, align 4, !tbaa !5
%cmp9.4 = icmp sgt i32 %22, %add.4
%cmp11.4 = icmp sgt i32 %add7.4, -1
%or.cond.not32.4 = select i1 %cmp9.4, i1 %cmp11.4, i1 false
%23 = load i32, ptr @h, align 4
%cmp13.not.4 = icmp sgt i32 %23, %add7.4
%or.cond31.4 = select i1 %or.cond.not32.4, i1 %cmp13.not.4, i1 false
br i1 %or.cond31.4, label %lor.lhs.false14.4, label %for.inc.4
lor.lhs.false14.4: ; preds = %lor.lhs.false.4
%idxprom15.4 = zext i32 %add7.4 to i64
%idxprom17.4 = zext i32 %add.4 to i64
%arrayidx18.4 = getelementptr inbounds [52 x [52 x i32]], ptr @t, i64 0, i64 %idxprom15.4, i64 %idxprom17.4
%24 = load i32, ptr %arrayidx18.4, align 4, !tbaa !5
%cmp19.4 = icmp eq i32 %24, 0
br i1 %cmp19.4, label %for.inc.4, label %if.end.4
if.end.4: ; preds = %lor.lhs.false14.4
tail call void @solve(i32 noundef %add.4, i32 noundef %add7.4)
br label %for.inc.4
for.inc.4: ; preds = %if.end.4, %lor.lhs.false14.4, %lor.lhs.false.4, %for.inc.3
%25 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @dx, i64 0, i64 5), align 4, !tbaa !5
%add.5 = add nsw i32 %25, %x.tr
%26 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @dy, i64 0, i64 5), align 4, !tbaa !5
%add7.5 = add nsw i32 %26, %y.tr
%cmp8.5 = icmp slt i32 %add.5, 0
br i1 %cmp8.5, label %for.inc.5, label %lor.lhs.false.5
lor.lhs.false.5: ; preds = %for.inc.4
%27 = load i32, ptr @w, align 4, !tbaa !5
%cmp9.5 = icmp sgt i32 %27, %add.5
%cmp11.5 = icmp sgt i32 %add7.5, -1
%or.cond.not32.5 = select i1 %cmp9.5, i1 %cmp11.5, i1 false
%28 = load i32, ptr @h, align 4
%cmp13.not.5 = icmp sgt i32 %28, %add7.5
%or.cond31.5 = select i1 %or.cond.not32.5, i1 %cmp13.not.5, i1 false
br i1 %or.cond31.5, label %lor.lhs.false14.5, label %for.inc.5
lor.lhs.false14.5: ; preds = %lor.lhs.false.5
%idxprom15.5 = zext i32 %add7.5 to i64
%idxprom17.5 = zext i32 %add.5 to i64
%arrayidx18.5 = getelementptr inbounds [52 x [52 x i32]], ptr @t, i64 0, i64 %idxprom15.5, i64 %idxprom17.5
%29 = load i32, ptr %arrayidx18.5, align 4, !tbaa !5
%cmp19.5 = icmp eq i32 %29, 0
br i1 %cmp19.5, label %for.inc.5, label %if.end.5
if.end.5: ; preds = %lor.lhs.false14.5
tail call void @solve(i32 noundef %add.5, i32 noundef %add7.5)
br label %for.inc.5
for.inc.5: ; preds = %if.end.5, %lor.lhs.false14.5, %lor.lhs.false.5, %for.inc.4
%30 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @dx, i64 0, i64 6), align 8, !tbaa !5
%add.6 = add nsw i32 %30, %x.tr
%31 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @dy, i64 0, i64 6), align 8, !tbaa !5
%add7.6 = add nsw i32 %31, %y.tr
%cmp8.6 = icmp slt i32 %add.6, 0
br i1 %cmp8.6, label %for.inc.6, label %lor.lhs.false.6
lor.lhs.false.6: ; preds = %for.inc.5
%32 = load i32, ptr @w, align 4, !tbaa !5
%cmp9.6 = icmp sgt i32 %32, %add.6
%cmp11.6 = icmp sgt i32 %add7.6, -1
%or.cond.not32.6 = select i1 %cmp9.6, i1 %cmp11.6, i1 false
%33 = load i32, ptr @h, align 4
%cmp13.not.6 = icmp sgt i32 %33, %add7.6
%or.cond31.6 = select i1 %or.cond.not32.6, i1 %cmp13.not.6, i1 false
br i1 %or.cond31.6, label %lor.lhs.false14.6, label %for.inc.6
lor.lhs.false14.6: ; preds = %lor.lhs.false.6
%idxprom15.6 = zext i32 %add7.6 to i64
%idxprom17.6 = zext i32 %add.6 to i64
%arrayidx18.6 = getelementptr inbounds [52 x [52 x i32]], ptr @t, i64 0, i64 %idxprom15.6, i64 %idxprom17.6
%34 = load i32, ptr %arrayidx18.6, align 4, !tbaa !5
%cmp19.6 = icmp eq i32 %34, 0
br i1 %cmp19.6, label %for.inc.6, label %if.end.6
if.end.6: ; preds = %lor.lhs.false14.6
tail call void @solve(i32 noundef %add.6, i32 noundef %add7.6)
br label %for.inc.6
for.inc.6: ; preds = %if.end.6, %lor.lhs.false14.6, %lor.lhs.false.6, %for.inc.5
%35 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @dx, i64 0, i64 7), align 4, !tbaa !5
%add.7 = add nsw i32 %35, %x.tr
%36 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @dy, i64 0, i64 7), align 4, !tbaa !5
%add7.7 = add nsw i32 %36, %y.tr
%cmp8.7 = icmp slt i32 %add.7, 0
br i1 %cmp8.7, label %for.inc.7, label %lor.lhs.false.7
lor.lhs.false.7: ; preds = %for.inc.6
%37 = load i32, ptr @w, align 4, !tbaa !5
%cmp9.7 = icmp sgt i32 %37, %add.7
%cmp11.7 = icmp sgt i32 %add7.7, -1
%or.cond.not32.7 = select i1 %cmp9.7, i1 %cmp11.7, i1 false
%38 = load i32, ptr @h, align 4
%cmp13.not.7 = icmp sgt i32 %38, %add7.7
%or.cond31.7 = select i1 %or.cond.not32.7, i1 %cmp13.not.7, i1 false
br i1 %or.cond31.7, label %lor.lhs.false14.7, label %for.inc.7
lor.lhs.false14.7: ; preds = %lor.lhs.false.7
%idxprom15.7 = zext i32 %add7.7 to i64
%idxprom17.7 = zext i32 %add.7 to i64
%arrayidx18.7 = getelementptr inbounds [52 x [52 x i32]], ptr @t, i64 0, i64 %idxprom15.7, i64 %idxprom17.7
%39 = load i32, ptr %arrayidx18.7, align 4, !tbaa !5
%cmp19.7 = icmp eq i32 %39, 0
br i1 %cmp19.7, label %for.inc.7, label %tailrecurse
for.inc.7: ; preds = %lor.lhs.false14.7, %lor.lhs.false.7, %for.inc.6
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call54 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @w, ptr noundef nonnull @h)
%0 = load i32, ptr @w, align 4, !tbaa !5
%tobool55 = icmp ne i32 %0, 0
%1 = load i32, ptr @h, align 4
%tobool156 = icmp ne i32 %1, 0
%2 = select i1 %tobool55, i1 true, i1 %tobool156
br i1 %2, label %for.cond.preheader, label %while.end
for.cond.preheader: ; preds = %entry, %for.end28
%3 = phi i32 [ %27, %for.end28 ], [ %0, %entry ]
%4 = phi i32 [ %28, %for.end28 ], [ %1, %entry ]
%cmp45 = icmp sgt i32 %4, 0
%5 = icmp sgt i32 %3, 0
%or.cond = and i1 %cmp45, %5
br i1 %or.cond, label %for.cond2.preheader, label %for.end28
for.cond11.preheader: ; preds = %for.inc8
%cmp1250 = icmp sgt i32 %11, 0
%6 = icmp sgt i32 %12, 0
%or.cond77 = and i1 %cmp1250, %6
br i1 %or.cond77, label %for.cond14.preheader, label %for.end28
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc8
%7 = phi i32 [ %11, %for.inc8 ], [ %4, %for.cond.preheader ]
%8 = phi i32 [ %12, %for.inc8 ], [ %3, %for.cond.preheader ]
%indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.inc8 ], [ 0, %for.cond.preheader ]
%cmp343 = icmp sgt i32 %8, 0
br i1 %cmp343, label %for.body4, label %for.inc8
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [52 x [52 x i32]], ptr @t, i64 0, i64 %indvars.iv60, i64 %indvars.iv
%call7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr @w, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp3 = icmp slt i64 %indvars.iv.next, %10
br i1 %cmp3, label %for.body4, label %for.inc8.loopexit, !llvm.loop !9
for.inc8.loopexit: ; preds = %for.body4
%.pre = load i32, ptr @h, align 4, !tbaa !5
br label %for.inc8
for.inc8: ; preds = %for.inc8.loopexit, %for.cond2.preheader
%11 = phi i32 [ %.pre, %for.inc8.loopexit ], [ %7, %for.cond2.preheader ]
%12 = phi i32 [ %9, %for.inc8.loopexit ], [ %8, %for.cond2.preheader ]
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
%13 = sext i32 %11 to i64
%cmp = icmp slt i64 %indvars.iv.next61, %13
br i1 %cmp, label %for.cond2.preheader, label %for.cond11.preheader, !llvm.loop !11
for.cond14.preheader: ; preds = %for.cond11.preheader, %for.inc26
%14 = phi i32 [ %23, %for.inc26 ], [ %11, %for.cond11.preheader ]
%15 = phi i32 [ %24, %for.inc26 ], [ %12, %for.cond11.preheader ]
%16 = phi i32 [ %25, %for.inc26 ], [ %12, %for.cond11.preheader ]
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.inc26 ], [ 0, %for.cond11.preheader ]
%ans.052 = phi i32 [ %ans.1.lcssa, %for.inc26 ], [ 0, %for.cond11.preheader ]
%cmp1547 = icmp sgt i32 %16, 0
br i1 %cmp1547, label %for.body16.lr.ph, label %for.inc26
for.body16.lr.ph: ; preds = %for.cond14.preheader
%17 = trunc i64 %indvars.iv66 to i32
br label %for.body16
for.body16: ; preds = %for.body16.lr.ph, %for.inc23
%18 = phi i32 [ %15, %for.body16.lr.ph ], [ %21, %for.inc23 ]
%indvars.iv63 = phi i64 [ 0, %for.body16.lr.ph ], [ %indvars.iv.next64, %for.inc23 ]
%ans.149 = phi i32 [ %ans.052, %for.body16.lr.ph ], [ %ans.2, %for.inc23 ]
%arrayidx20 = getelementptr inbounds [52 x [52 x i32]], ptr @t, i64 0, i64 %indvars.iv66, i64 %indvars.iv63
%19 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21 = icmp eq i32 %19, 1
br i1 %cmp21, label %if.then, label %for.inc23
if.then: ; preds = %for.body16
%20 = trunc i64 %indvars.iv63 to i32
tail call void @solve(i32 noundef %20, i32 noundef %17)
%inc22 = add nsw i32 %ans.149, 1
%.pre69 = load i32, ptr @w, align 4, !tbaa !5
br label %for.inc23
for.inc23: ; preds = %for.body16, %if.then
%21 = phi i32 [ %.pre69, %if.then ], [ %18, %for.body16 ]
%ans.2 = phi i32 [ %inc22, %if.then ], [ %ans.149, %for.body16 ]
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%22 = sext i32 %21 to i64
%cmp15 = icmp slt i64 %indvars.iv.next64, %22
br i1 %cmp15, label %for.body16, label %for.inc26.loopexit, !llvm.loop !13
for.inc26.loopexit: ; preds = %for.inc23
%.pre70 = load i32, ptr @h, align 4, !tbaa !5
br label %for.inc26
for.inc26: ; preds = %for.inc26.loopexit, %for.cond14.preheader
%23 = phi i32 [ %14, %for.cond14.preheader ], [ %.pre70, %for.inc26.loopexit ]
%24 = phi i32 [ %15, %for.cond14.preheader ], [ %21, %for.inc26.loopexit ]
%25 = phi i32 [ %16, %for.cond14.preheader ], [ %21, %for.inc26.loopexit ]
%ans.1.lcssa = phi i32 [ %ans.052, %for.cond14.preheader ], [ %ans.2, %for.inc26.loopexit ]
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%26 = sext i32 %23 to i64
%cmp12 = icmp slt i64 %indvars.iv.next67, %26
br i1 %cmp12, label %for.cond14.preheader, label %for.end28, !llvm.loop !14
for.end28: ; preds = %for.inc26, %for.cond.preheader, %for.cond11.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond11.preheader ], [ 0, %for.cond.preheader ], [ %ans.1.lcssa, %for.inc26 ]
%call29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @w, ptr noundef nonnull @h)
%27 = load i32, ptr @w, align 4, !tbaa !5
%tobool = icmp ne i32 %27, 0
%28 = load i32, ptr @h, align 4
%tobool1 = icmp ne i32 %28, 0
%29 = select i1 %tobool, i1 true, i1 %tobool1
br i1 %29, label %for.cond.preheader, label %while.end, !llvm.loop !15
while.end: ; preds = %for.end28, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int main()
{
char x;int i,j;
char s[100],a[]="qwertyuiop",b[]="asdfghjkl;",c[]="zxcvbnm,./";
scanf("%c",&x);
scanf("%s",s);
for(i=0;s[i]!='\0';i++)
{
if(x=='R')
{
for(j=0;j<10;j++)
{
if(s[i]==a[j])
printf("%c",a[j-1]);
else if(s[i]==b[j])
printf("%c",b[j-1]);
else if(s[i]==c[j])
printf("%c",c[j-1]);
}
}
if(x=='L')
{
for(j=0;j<10;j++)
{
if(s[i]==a[j])
printf("%c",a[j+1]);
else if(s[i]==b[j])
printf("%c",b[j+1]);
else if(s[i]==c[j])
printf("%c",c[j+1]);
}
}
}
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27588/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27588/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@switch.table.main = private unnamed_addr constant [3 x i32] [i32 120, i32 115, i32 119], align 4
@switch.table.main.3 = private unnamed_addr constant [3 x i32] [i32 118, i32 102, i32 114], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i8, align 1
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 16, !tbaa !5
%cmp.not147 = icmp eq i8 %0, 0
br i1 %cmp.not147, label %for.end115, label %for.body
for.body: ; preds = %entry, %for.inc113
%1 = phi i8 [ %27, %for.inc113 ], [ %0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc113 ], [ 0, %entry ]
%arrayidx149 = phi ptr [ %arrayidx, %for.inc113 ], [ %s, %entry ]
%2 = load i8, ptr %x, align 1, !tbaa !5
%cmp4 = icmp eq i8 %2, 82
br i1 %cmp4, label %for.body9.preheader, label %if.end54
for.body9.preheader: ; preds = %for.body
switch i8 %1, label %for.inc [
i8 113, label %for.inc.sink.split
i8 97, label %for.inc.sink.split
i8 122, label %for.inc.sink.split
]
for.inc.sink.split: ; preds = %for.body9.preheader, %for.body9.preheader, %for.body9.preheader
%putchar144 = call i32 @putchar(i32 poison)
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %for.body9.preheader
%3 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %3, label %for.inc.1 [
i8 119, label %if.then18.1
i8 115, label %if.then31.1
i8 120, label %for.inc.1.sink.split
]
if.then31.1: ; preds = %for.inc
br label %for.inc.1.sink.split
if.then18.1: ; preds = %for.inc
br label %for.inc.1.sink.split
for.inc.1.sink.split: ; preds = %for.inc, %if.then31.1, %if.then18.1
%.sink = phi i32 [ 113, %if.then18.1 ], [ 97, %if.then31.1 ], [ 122, %for.inc ]
%putchar144.1 = call i32 @putchar(i32 %.sink)
br label %for.inc.1
for.inc.1: ; preds = %for.inc.1.sink.split, %for.inc
%4 = load i8, ptr %arrayidx149, align 1, !tbaa !5
%switch.tableidx = add i8 %4, -99
%5 = icmp ult i8 %switch.tableidx, 3
br i1 %5, label %switch.lookup, label %for.inc.2
switch.lookup: ; preds = %for.inc.1
%6 = sext i8 %switch.tableidx to i64
%switch.gep = getelementptr inbounds [3 x i32], ptr @switch.table.main, i64 0, i64 %6
%switch.load = load i32, ptr %switch.gep, align 4
%putchar144.2 = call i32 @putchar(i32 %switch.load)
br label %for.inc.2
for.inc.2: ; preds = %for.inc.1, %switch.lookup
%7 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %7, label %for.inc.3 [
i8 114, label %if.then18.3
i8 102, label %if.then31.3
i8 118, label %for.inc.3.sink.split
]
if.then31.3: ; preds = %for.inc.2
br label %for.inc.3.sink.split
if.then18.3: ; preds = %for.inc.2
br label %for.inc.3.sink.split
for.inc.3.sink.split: ; preds = %for.inc.2, %if.then31.3, %if.then18.3
%.sink160 = phi i32 [ 101, %if.then18.3 ], [ 100, %if.then31.3 ], [ 99, %for.inc.2 ]
%putchar144.3 = call i32 @putchar(i32 %.sink160)
br label %for.inc.3
for.inc.3: ; preds = %for.inc.3.sink.split, %for.inc.2
%8 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %8, label %for.inc.4 [
i8 116, label %if.then18.4
i8 103, label %if.then31.4
i8 98, label %for.inc.4.sink.split
]
if.then31.4: ; preds = %for.inc.3
br label %for.inc.4.sink.split
if.then18.4: ; preds = %for.inc.3
br label %for.inc.4.sink.split
for.inc.4.sink.split: ; preds = %for.inc.3, %if.then31.4, %if.then18.4
%.sink161 = phi i32 [ 114, %if.then18.4 ], [ 102, %if.then31.4 ], [ 118, %for.inc.3 ]
%putchar144.4 = call i32 @putchar(i32 %.sink161)
br label %for.inc.4
for.inc.4: ; preds = %for.inc.4.sink.split, %for.inc.3
%9 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %9, label %for.inc.5 [
i8 121, label %if.then18.5
i8 104, label %if.then31.5
i8 110, label %for.inc.5.sink.split
]
if.then31.5: ; preds = %for.inc.4
br label %for.inc.5.sink.split
if.then18.5: ; preds = %for.inc.4
br label %for.inc.5.sink.split
for.inc.5.sink.split: ; preds = %for.inc.4, %if.then31.5, %if.then18.5
%.sink162 = phi i32 [ 116, %if.then18.5 ], [ 103, %if.then31.5 ], [ 98, %for.inc.4 ]
%putchar144.5 = call i32 @putchar(i32 %.sink162)
br label %for.inc.5
for.inc.5: ; preds = %for.inc.5.sink.split, %for.inc.4
%10 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %10, label %for.inc.6 [
i8 117, label %if.then18.6
i8 106, label %if.then31.6
i8 109, label %for.inc.6.sink.split
]
if.then31.6: ; preds = %for.inc.5
br label %for.inc.6.sink.split
if.then18.6: ; preds = %for.inc.5
br label %for.inc.6.sink.split
for.inc.6.sink.split: ; preds = %for.inc.5, %if.then31.6, %if.then18.6
%.sink163 = phi i32 [ 121, %if.then18.6 ], [ 104, %if.then31.6 ], [ 110, %for.inc.5 ]
%putchar144.6 = call i32 @putchar(i32 %.sink163)
br label %for.inc.6
for.inc.6: ; preds = %for.inc.6.sink.split, %for.inc.5
%11 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %11, label %for.inc.7 [
i8 105, label %if.then18.7
i8 107, label %if.then31.7
i8 44, label %for.inc.7.sink.split
]
if.then31.7: ; preds = %for.inc.6
br label %for.inc.7.sink.split
if.then18.7: ; preds = %for.inc.6
br label %for.inc.7.sink.split
for.inc.7.sink.split: ; preds = %for.inc.6, %if.then31.7, %if.then18.7
%.sink164 = phi i32 [ 117, %if.then18.7 ], [ 106, %if.then31.7 ], [ 109, %for.inc.6 ]
%putchar144.7 = call i32 @putchar(i32 %.sink164)
br label %for.inc.7
for.inc.7: ; preds = %for.inc.7.sink.split, %for.inc.6
%12 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %12, label %for.inc.8 [
i8 111, label %if.then18.8
i8 108, label %if.then31.8
i8 46, label %for.inc.8.sink.split
]
if.then31.8: ; preds = %for.inc.7
br label %for.inc.8.sink.split
if.then18.8: ; preds = %for.inc.7
br label %for.inc.8.sink.split
for.inc.8.sink.split: ; preds = %for.inc.7, %if.then31.8, %if.then18.8
%.sink165 = phi i32 [ 105, %if.then18.8 ], [ 107, %if.then31.8 ], [ 44, %for.inc.7 ]
%putchar144.8 = call i32 @putchar(i32 %.sink165)
br label %for.inc.8
for.inc.8: ; preds = %for.inc.8.sink.split, %for.inc.7
%13 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %13, label %for.inc.9 [
i8 112, label %if.then18.9
i8 59, label %if.then31.9
i8 47, label %for.inc.9.sink.split
]
if.then31.9: ; preds = %for.inc.8
br label %for.inc.9.sink.split
if.then18.9: ; preds = %for.inc.8
br label %for.inc.9.sink.split
for.inc.9.sink.split: ; preds = %for.inc.8, %if.then31.9, %if.then18.9
%.sink166 = phi i32 [ 111, %if.then18.9 ], [ 108, %if.then31.9 ], [ 46, %for.inc.8 ]
%putchar144.9 = call i32 @putchar(i32 %.sink166)
br label %for.inc.9
for.inc.9: ; preds = %for.inc.9.sink.split, %for.inc.8
%.pr = load i8, ptr %x, align 1, !tbaa !5
br label %if.end54
if.end54: ; preds = %for.inc.9, %for.body
%14 = phi i8 [ %.pr, %for.inc.9 ], [ %2, %for.body ]
%cmp56 = icmp eq i8 %14, 76
br i1 %cmp56, label %for.body62.preheader, label %for.inc113
for.body62.preheader: ; preds = %if.end54
%15 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %15, label %for.inc109 [
i8 113, label %for.inc109.sink.split
i8 97, label %if.then85
i8 122, label %if.then100
]
if.then85: ; preds = %for.body62.preheader
br label %for.inc109.sink.split
if.then100: ; preds = %for.body62.preheader
br label %for.inc109.sink.split
for.inc109.sink.split: ; preds = %for.body62.preheader, %if.then85, %if.then100
%.sink167 = phi i32 [ 120, %if.then100 ], [ 115, %if.then85 ], [ 119, %for.body62.preheader ]
%putchar141 = call i32 @putchar(i32 %.sink167)
br label %for.inc109
for.inc109: ; preds = %for.inc109.sink.split, %for.body62.preheader
%16 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %16, label %for.inc109.1 [
i8 119, label %if.then71.1
i8 115, label %if.then85.1
i8 120, label %for.inc109.1.sink.split
]
if.then85.1: ; preds = %for.inc109
br label %for.inc109.1.sink.split
if.then71.1: ; preds = %for.inc109
br label %for.inc109.1.sink.split
for.inc109.1.sink.split: ; preds = %for.inc109, %if.then85.1, %if.then71.1
%.sink168 = phi i32 [ 101, %if.then71.1 ], [ 100, %if.then85.1 ], [ 99, %for.inc109 ]
%putchar141.1 = call i32 @putchar(i32 %.sink168)
br label %for.inc109.1
for.inc109.1: ; preds = %for.inc109.1.sink.split, %for.inc109
%17 = load i8, ptr %arrayidx149, align 1, !tbaa !5
%switch.tableidx177 = add i8 %17, -99
%18 = icmp ult i8 %switch.tableidx177, 3
br i1 %18, label %switch.lookup176, label %for.inc109.2
switch.lookup176: ; preds = %for.inc109.1
%19 = sext i8 %switch.tableidx177 to i64
%switch.gep178 = getelementptr inbounds [3 x i32], ptr @switch.table.main.3, i64 0, i64 %19
%switch.load179 = load i32, ptr %switch.gep178, align 4
%putchar141.2 = call i32 @putchar(i32 %switch.load179)
br label %for.inc109.2
for.inc109.2: ; preds = %for.inc109.1, %switch.lookup176
%20 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %20, label %for.inc109.3 [
i8 114, label %if.then71.3
i8 102, label %if.then85.3
i8 118, label %for.inc109.3.sink.split
]
if.then85.3: ; preds = %for.inc109.2
br label %for.inc109.3.sink.split
if.then71.3: ; preds = %for.inc109.2
br label %for.inc109.3.sink.split
for.inc109.3.sink.split: ; preds = %for.inc109.2, %if.then85.3, %if.then71.3
%.sink170 = phi i32 [ 116, %if.then71.3 ], [ 103, %if.then85.3 ], [ 98, %for.inc109.2 ]
%putchar141.3 = call i32 @putchar(i32 %.sink170)
br label %for.inc109.3
for.inc109.3: ; preds = %for.inc109.3.sink.split, %for.inc109.2
%21 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %21, label %for.inc109.4 [
i8 116, label %if.then71.4
i8 103, label %if.then85.4
i8 98, label %for.inc109.4.sink.split
]
if.then85.4: ; preds = %for.inc109.3
br label %for.inc109.4.sink.split
if.then71.4: ; preds = %for.inc109.3
br label %for.inc109.4.sink.split
for.inc109.4.sink.split: ; preds = %for.inc109.3, %if.then85.4, %if.then71.4
%.sink171 = phi i32 [ 121, %if.then71.4 ], [ 104, %if.then85.4 ], [ 110, %for.inc109.3 ]
%putchar141.4 = call i32 @putchar(i32 %.sink171)
br label %for.inc109.4
for.inc109.4: ; preds = %for.inc109.4.sink.split, %for.inc109.3
%22 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %22, label %for.inc109.5 [
i8 121, label %if.then71.5
i8 104, label %if.then85.5
i8 110, label %for.inc109.5.sink.split
]
if.then85.5: ; preds = %for.inc109.4
br label %for.inc109.5.sink.split
if.then71.5: ; preds = %for.inc109.4
br label %for.inc109.5.sink.split
for.inc109.5.sink.split: ; preds = %for.inc109.4, %if.then85.5, %if.then71.5
%.sink172 = phi i32 [ 117, %if.then71.5 ], [ 106, %if.then85.5 ], [ 109, %for.inc109.4 ]
%putchar141.5 = call i32 @putchar(i32 %.sink172)
br label %for.inc109.5
for.inc109.5: ; preds = %for.inc109.5.sink.split, %for.inc109.4
%23 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %23, label %for.inc109.6 [
i8 117, label %if.then71.6
i8 106, label %if.then85.6
i8 109, label %for.inc109.6.sink.split
]
if.then85.6: ; preds = %for.inc109.5
br label %for.inc109.6.sink.split
if.then71.6: ; preds = %for.inc109.5
br label %for.inc109.6.sink.split
for.inc109.6.sink.split: ; preds = %for.inc109.5, %if.then85.6, %if.then71.6
%.sink173 = phi i32 [ 105, %if.then71.6 ], [ 107, %if.then85.6 ], [ 44, %for.inc109.5 ]
%putchar141.6 = call i32 @putchar(i32 %.sink173)
br label %for.inc109.6
for.inc109.6: ; preds = %for.inc109.6.sink.split, %for.inc109.5
%24 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %24, label %for.inc109.7 [
i8 105, label %if.then71.7
i8 107, label %if.then85.7
i8 44, label %for.inc109.7.sink.split
]
if.then85.7: ; preds = %for.inc109.6
br label %for.inc109.7.sink.split
if.then71.7: ; preds = %for.inc109.6
br label %for.inc109.7.sink.split
for.inc109.7.sink.split: ; preds = %for.inc109.6, %if.then85.7, %if.then71.7
%.sink174 = phi i32 [ 111, %if.then71.7 ], [ 108, %if.then85.7 ], [ 46, %for.inc109.6 ]
%putchar141.7 = call i32 @putchar(i32 %.sink174)
br label %for.inc109.7
for.inc109.7: ; preds = %for.inc109.7.sink.split, %for.inc109.6
%25 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %25, label %for.inc109.8 [
i8 111, label %if.then71.8
i8 108, label %if.then85.8
i8 46, label %for.inc109.8.sink.split
]
if.then85.8: ; preds = %for.inc109.7
br label %for.inc109.8.sink.split
if.then71.8: ; preds = %for.inc109.7
br label %for.inc109.8.sink.split
for.inc109.8.sink.split: ; preds = %for.inc109.7, %if.then85.8, %if.then71.8
%.sink175 = phi i32 [ 112, %if.then71.8 ], [ 59, %if.then85.8 ], [ 47, %for.inc109.7 ]
%putchar141.8 = call i32 @putchar(i32 %.sink175)
br label %for.inc109.8
for.inc109.8: ; preds = %for.inc109.8.sink.split, %for.inc109.7
%26 = load i8, ptr %arrayidx149, align 1, !tbaa !5
switch i8 %26, label %for.inc113 [
i8 112, label %for.inc113.sink.split
i8 59, label %for.inc113.sink.split
i8 47, label %for.inc113.sink.split
]
for.inc113.sink.split: ; preds = %for.inc109.8, %for.inc109.8, %for.inc109.8
%putchar139.9 = call i32 @putchar(i32 0)
br label %for.inc113
for.inc113: ; preds = %for.inc113.sink.split, %for.inc109.8, %if.end54
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [100 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%27 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %27, 0
br i1 %cmp.not, label %for.end115, label %for.body, !llvm.loop !8
for.end115: ; preds = %for.inc113, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
int i,j;
double n,x,q;
for(;scanf("%lf",&n)&&n+1;){
q=n;x=q/2.0;
for(;1;){
x=x-((x*x*x-q)/(3.0*x*x));
if(fabs(x*x*x-q)<0.00001*q){
printf("%lf\n",x);break;
}
}
}
exit(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275922/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275922/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: noreturn nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
%call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool27 = icmp ne i32 %call26, 0
%0 = load double, ptr %n, align 8
%add28 = fadd double %0, 1.000000e+00
%tobool129 = fcmp une double %add28, 0.000000e+00
%1 = select i1 %tobool27, i1 %tobool129, i1 false
br i1 %1, label %for.body, label %for.end13
for.body: ; preds = %entry, %if.then
%2 = phi double [ %6, %if.then ], [ %0, %entry ]
%div = fmul double %2, 5.000000e-01
%neg = fneg double %2
%mul11 = fmul double %2, 1.000000e-05
br label %for.cond2
for.cond2: ; preds = %for.cond2, %for.body
%x.0 = phi double [ %div, %for.body ], [ %sub, %for.cond2 ]
%mul = fmul double %x.0, %x.0
%3 = call double @llvm.fmuladd.f64(double %mul, double %x.0, double %neg)
%mul5 = fmul double %x.0, 3.000000e+00
%mul6 = fmul double %x.0, %mul5
%div7 = fdiv double %3, %mul6
%sub = fsub double %x.0, %div7
%mul8 = fmul double %sub, %sub
%4 = call double @llvm.fmuladd.f64(double %mul8, double %sub, double %neg)
%5 = call double @llvm.fabs.f64(double %4)
%cmp = fcmp olt double %5, %mul11
br i1 %cmp, label %if.then, label %for.cond2
if.then: ; preds = %for.cond2
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sub)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool = icmp ne i32 %call, 0
%6 = load double, ptr %n, align 8
%add = fadd double %6, 1.000000e+00
%tobool1 = fcmp une double %add, 0.000000e+00
%7 = select i1 %tobool, i1 %tobool1, i1 false
br i1 %7, label %for.body, label %for.end13, !llvm.loop !5
for.end13: ; preds = %if.then, %entry
call void @exit(i32 noundef 0) #6
unreachable
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #3
; Function Attrs: 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
attributes #0 = { noreturn nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { 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 = { nounwind }
attributes #6 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int main() {
double q;
while (1) {
scanf("%lf", &q);
if (q == -1) break;
double d, x = q / 2.0;
while(1) {
d = x * x * x - q;
if (fabs(d) < (0.00001 * q)) break;
x -= d / 3 / x / x;
}
printf("%lf\n", x);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275966/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275966/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%q = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %q) #4
%call23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%0 = load double, ptr %q, align 8, !tbaa !5
%cmp24 = fcmp oeq double %0, -1.000000e+00
br i1 %cmp24, label %while.end12, label %if.end
if.end: ; preds = %entry, %while.end
%1 = phi double [ %7, %while.end ], [ %0, %entry ]
%div = fmul double %1, 5.000000e-01
%neg = fneg double %1
%mul4 = fmul double %1, 1.000000e-05
%mul20 = fmul double %div, %div
%2 = call double @llvm.fmuladd.f64(double %mul20, double %div, double %neg)
%3 = call double @llvm.fabs.f64(double %2)
%cmp521 = fcmp olt double %3, %mul4
br i1 %cmp521, label %while.end, label %if.end7
if.end7: ; preds = %if.end, %if.end7
%4 = phi double [ %5, %if.end7 ], [ %2, %if.end ]
%x.022 = phi double [ %sub, %if.end7 ], [ %div, %if.end ]
%div8 = fdiv double %4, 3.000000e+00
%div9 = fdiv double %div8, %x.022
%div10 = fdiv double %div9, %x.022
%sub = fsub double %x.022, %div10
%mul = fmul double %sub, %sub
%5 = call double @llvm.fmuladd.f64(double %mul, double %sub, double %neg)
%6 = call double @llvm.fabs.f64(double %5)
%cmp5 = fcmp olt double %6, %mul4
br i1 %cmp5, label %while.end, label %if.end7
while.end: ; preds = %if.end7, %if.end
%x.0.lcssa = phi double [ %div, %if.end ], [ %sub, %if.end7 ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %x.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%7 = load double, ptr %q, align 8, !tbaa !5
%cmp = fcmp oeq double %7, -1.000000e+00
br i1 %cmp, label %while.end12, label %if.end
while.end12: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 8, 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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #3
; Function Attrs: 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
long long int a, b, c, d;
while(2==scanf("%lld %lld", &a, &b)){
if(b>a){
c=a;
a=b;
b=c;
}
while(a%b!=0){
d=a%b;
a=b;
b=d;
}
printf("%lld\n", b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276015/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276015/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp15 = icmp eq i32 %call14, 2
br i1 %cmp15, label %while.body, label %while.end7
while.body: ; preds = %entry, %while.end
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
%cmp1 = icmp sgt i64 %0, %1
br i1 %cmp1, label %if.then, label %if.end
if.then: ; preds = %while.body
store i64 %0, ptr %a, align 8, !tbaa !5
store i64 %1, ptr %b, align 8, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %while.body
%b.promoted = phi i64 [ %1, %if.then ], [ %0, %while.body ]
%a.promoted = phi i64 [ %0, %if.then ], [ %1, %while.body ]
%rem10 = srem i64 %a.promoted, %b.promoted
%cmp3.not11 = icmp eq i64 %rem10, 0
br i1 %cmp3.not11, label %while.end, label %while.body4
while.body4: ; preds = %if.end, %while.body4
%rem13 = phi i64 [ %rem, %while.body4 ], [ %rem10, %if.end ]
%rem912 = phi i64 [ %rem13, %while.body4 ], [ %b.promoted, %if.end ]
%rem = srem i64 %rem912, %rem13
%cmp3.not = icmp eq i64 %rem, 0
br i1 %cmp3.not, label %while.cond2.while.end_crit_edge, label %while.body4, !llvm.loop !9
while.cond2.while.end_crit_edge: ; preds = %while.body4
store i64 %rem912, ptr %a, align 8, !tbaa !5
store i64 %rem13, ptr %b, align 8, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond2.while.end_crit_edge, %if.end
%.lcssa = phi i64 [ %rem13, %while.cond2.while.end_crit_edge ], [ %b.promoted, %if.end ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp = icmp eq i32 %call, 2
br i1 %cmp, label %while.body, label %while.end7, !llvm.loop !11
while.end7: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int getGCD(int a,int b){
int r;
while(1){
r = a % b;
if(r <= 0){return b;}
a = b;
b = r;
}
}
int main(void){
int a,b;
while(scanf("%d%d",&a,&b) != EOF){
printf("%d\n",getGCD(a,b));
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276059/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276059/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @getGCD(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%b.addr.0 = phi i32 [ %b, %entry ], [ %rem, %while.cond ]
%a.addr.0 = phi i32 [ %a, %entry ], [ %b.addr.0, %while.cond ]
%rem = srem i32 %a.addr.0, %b.addr.0
%cmp = icmp slt i32 %rem, 1
br i1 %cmp, label %if.then, label %while.cond
if.then: ; preds = %while.cond
ret i32 %b.addr.0
}
; 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:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not4 = icmp eq i32 %call3, -1
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %getGCD.exit
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %while.body
%b.addr.0.i = phi i32 [ %1, %while.body ], [ %rem.i, %while.cond.i ]
%a.addr.0.i = phi i32 [ %0, %while.body ], [ %b.addr.0.i, %while.cond.i ]
%rem.i = srem i32 %a.addr.0.i, %b.addr.0.i
%cmp.i = icmp slt i32 %rem.i, 1
br i1 %cmp.i, label %getGCD.exit, label %while.cond.i
getGCD.exit: ; preds = %while.cond.i
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %b.addr.0.i)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %getGCD.exit, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!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){
char S[10];
scanf("%s", S);
int a = S[0] - '0';
int b = S[1] - '0';
int c = S[2] - '0';
int sum = a+b+c;
printf("%d", sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276123/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276123/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %S) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%0 = load i8, ptr %S, align 1, !tbaa !5
%conv = sext i8 %0 to i32
%arrayidx1 = getelementptr inbounds [10 x i8], ptr %S, i64 0, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%conv2 = sext i8 %1 to i32
%arrayidx4 = getelementptr inbounds [10 x i8], ptr %S, i64 0, i64 2
%2 = load i8, ptr %arrayidx4, align 1, !tbaa !5
%conv5 = sext i8 %2 to i32
%sub3 = add nsw i32 %conv, -144
%sub6 = add nsw i32 %sub3, %conv2
%add7 = add nsw i32 %sub6, %conv5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add7)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %S) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
char s[3];
int i;
int t=0;
scanf("%s",s);
for(i=0;i<3;i++){
if(s[i]=='1') t++;
}
printf("%d\n",t);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276174/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276174/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 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) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp1 = icmp eq i8 %0, 49
%inc = zext i1 %cmp1 to i32
%arrayidx.1 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp1.1 = icmp eq i8 %1, 49
%inc.1 = zext i1 %cmp1.1 to i32
%spec.select.1 = add nuw nsw i32 %inc, %inc.1
%arrayidx.2 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%cmp1.2 = icmp eq i8 %2, 49
%inc.2 = zext i1 %cmp1.2 to i32
%spec.select.2 = add nuw nsw i32 %spec.select.1, %inc.2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select.2)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main(void)
{
int c=0;
char s[4];
scanf("%s",s);
if(s[0]=='1')
c++;
if(s[1]=='1')
c++;
if(s[2]=='1')
c++;
printf("%d\n",c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276217/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276217/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 49
%spec.select = zext i1 %cmp to i32
%arrayidx2 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp4 = icmp eq i8 %1, 49
%inc7 = select i1 %cmp, i32 2, i32 1
%c.1 = select i1 %cmp4, i32 %inc7, i32 %spec.select
%arrayidx9 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx9, align 1, !tbaa !5
%cmp11 = icmp eq i8 %2, 49
%inc14 = zext i1 %cmp11 to i32
%c.2 = add nuw nsw i32 %c.1, %inc14
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
char str[4];
int a = 0;
scanf("%s", str);
if(str[0] == '1') a++;
if(str[1] == '1') a++;
if(str[2] == '1') a++;
printf("%d\n", a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276268/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276268/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %str) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load i8, ptr %str, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 49
%spec.select = zext i1 %cmp to i32
%arrayidx2 = getelementptr inbounds [4 x i8], ptr %str, i64 0, i64 1
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp4 = icmp eq i8 %1, 49
%inc7 = select i1 %cmp, i32 2, i32 1
%a.1 = select i1 %cmp4, i32 %inc7, i32 %spec.select
%arrayidx9 = getelementptr inbounds [4 x i8], ptr %str, i64 0, i64 2
%2 = load i8, ptr %arrayidx9, align 1, !tbaa !5
%cmp11 = icmp eq i8 %2, 49
%inc14 = zext i1 %cmp11 to i32
%a.2 = add nuw nsw i32 %a.1, %inc14
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %str) #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 i;
int counter = 0;
char s[2];
scanf("%s", s );
for(i = 0 ; i<3 ; i++ ){
if(s[i] == '1'){
counter++;
}
}
printf("%d\n",counter);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276310/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276310/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [2 x i8], align 1
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp1 = icmp eq i8 %0, 49
%inc = zext i1 %cmp1 to i32
%arrayidx.1 = getelementptr inbounds [2 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp1.1 = icmp eq i8 %1, 49
%inc.1 = zext i1 %cmp1.1 to i32
%spec.select.1 = add nuw nsw i32 %inc, %inc.1
%arrayidx.2 = getelementptr inbounds [2 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%cmp1.2 = icmp eq i8 %2, 49
%inc.2 = zext i1 %cmp1.2 to i32
%spec.select.2 = add nuw nsw i32 %spec.select.1, %inc.2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select.2)
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
char s1,s2,s3;
scanf("%c",&s1);
scanf("%c",&s2);
scanf("%c",&s3);
int x = 0;
if (s1 == '1') {
x++;
}
if (s2 == '1') {
x++;
}
if (s3 == '1') {
x++;
}
printf("%d\n",x);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276354/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276354/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s1 = alloca i8, align 1
%s2 = alloca i8, align 1
%s3 = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %s1) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %s2) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %s3) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s2)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s3)
%0 = load i8, ptr %s1, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 49
%spec.select = zext i1 %cmp to i32
%1 = load i8, ptr %s2, align 1, !tbaa !5
%cmp5 = icmp eq i8 %1, 49
%inc8 = select i1 %cmp, i32 2, i32 1
%x.1 = select i1 %cmp5, i32 %inc8, i32 %spec.select
%2 = load i8, ptr %s3, align 1, !tbaa !5
%cmp11 = icmp eq i8 %2, 49
%inc14 = zext i1 %cmp11 to i32
%x.2 = add nuw nsw i32 %x.1, %inc14
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %x.2)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %s3) #3
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %s2) #3
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %s1) #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 sum=0;
char b[5];
scanf("%s",b);
for(int i=0;i<3;i++){
if(b[i]=='1'){
sum++;
}
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276398/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276398/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 i32 @main() local_unnamed_addr #0 {
entry:
%b = alloca [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i8, ptr %b, align 1, !tbaa !5
%cmp1 = icmp eq i8 %0, 49
%inc = zext i1 %cmp1 to i32
%arrayidx.1 = getelementptr inbounds [5 x i8], ptr %b, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp1.1 = icmp eq i8 %1, 49
%inc.1 = zext i1 %cmp1.1 to i32
%spec.select.1 = add nuw nsw i32 %inc, %inc.1
%arrayidx.2 = getelementptr inbounds [5 x i8], ptr %b, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%cmp1.2 = icmp eq i8 %2, 49
%inc.2 = zext i1 %cmp1.2 to i32
%spec.select.2 = add nuw nsw i32 %spec.select.1, %inc.2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select.2)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %b) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
char S[3];
int ans = 0;
scanf("%s",S);
if(S[0] == '1') ans++;
if(S[1] == '1') ans++;
if(S[2] == '1') ans++;
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276455/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276455/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 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) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%0 = load i8, ptr %S, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 49
%spec.select = zext i1 %cmp to i32
%arrayidx2 = getelementptr inbounds [3 x i8], ptr %S, i64 0, i64 1
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp4 = icmp eq i8 %1, 49
%inc7 = select i1 %cmp, i32 2, i32 1
%ans.1 = select i1 %cmp4, i32 %inc7, i32 %spec.select
%arrayidx9 = getelementptr inbounds [3 x i8], ptr %S, i64 0, i64 2
%2 = load i8, ptr %arrayidx9, align 1, !tbaa !5
%cmp11 = icmp eq i8 %2, 49
%inc14 = zext i1 %cmp11 to i32
%ans.2 = add nuw nsw i32 %ans.1, %inc14
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.2)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %S) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
static size_t A[100000];
int compare_f(const void *a, const void *b) {
return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}
static size_t comb(const size_t n, const size_t r) {
size_t result = 1;
for (size_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
int main(void) {
char s[4];
scanf("%s", s);
size_t count = 0;
for (size_t idx = 0; idx < strlen(s); idx++) {
if (s[idx] == '1') {
count++;
}
}
printf("%zu\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276499/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276499/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"%zu\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_f(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp ult i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #7
%cmp10.not = icmp eq i64 %call2, 0
br i1 %cmp10.not, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %call2, 4
br i1 %min.iters.check, label %for.body.preheader15, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %call2, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%vec.phi13 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%0 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 %index
%wide.load = load <2 x i8>, ptr %0, align 1, !tbaa !9
%1 = getelementptr inbounds i8, ptr %0, i64 2
%wide.load14 = load <2 x i8>, ptr %1, align 1, !tbaa !9
%2 = icmp eq <2 x i8> %wide.load, <i8 49, i8 49>
%3 = icmp eq <2 x i8> %wide.load14, <i8 49, i8 49>
%4 = zext <2 x i1> %2 to <2 x i64>
%5 = zext <2 x i1> %3 to <2 x i64>
%6 = add <2 x i64> %vec.phi, %4
%7 = add <2 x i64> %vec.phi13, %5
%index.next = add nuw i64 %index, 4
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %7, %6
%9 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %call2, %n.vec
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader15
for.body.preheader15: ; preds = %for.body.preheader, %middle.block
%idx.012.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%count.011.ph = phi i64 [ 0, %for.body.preheader ], [ %9, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%count.0.lcssa = phi i64 [ 0, %entry ], [ %9, %middle.block ], [ %spec.select, %for.body ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #6
ret i32 0
for.body: ; preds = %for.body.preheader15, %for.body
%idx.012 = phi i64 [ %inc5, %for.body ], [ %idx.012.ph, %for.body.preheader15 ]
%count.011 = phi i64 [ %spec.select, %for.body ], [ %count.011.ph, %for.body.preheader15 ]
%arrayidx = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 %idx.012
%10 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp3 = icmp eq i8 %10, 49
%inc = zext i1 %cmp3 to i64
%spec.select = add i64 %count.011, %inc
%inc5 = add nuw i64 %idx.012, 1
%exitcond.not = icmp eq i64 %inc5, %call2
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !14
}
; 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 memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
|
#include <stdio.h>
int main() {
char input[3];
int index = 0;
if ( scanf("%s", input) ) {
for (int i = 0; i < 3; ++i) {
char c = input[i];
if (c == '1') {
index++;
}
}
printf("%d\n", index);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276541/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276541/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 i32 @main() local_unnamed_addr #0 {
entry:
%input = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %input) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %if.end6, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = load i8, ptr %input, align 1, !tbaa !5
%cmp1 = icmp eq i8 %0, 49
%inc = zext i1 %cmp1 to i32
%arrayidx.1 = getelementptr inbounds [3 x i8], ptr %input, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp1.1 = icmp eq i8 %1, 49
%inc.1 = zext i1 %cmp1.1 to i32
%spec.select.1 = add nuw nsw i32 %inc, %inc.1
%arrayidx.2 = getelementptr inbounds [3 x i8], ptr %input, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%cmp1.2 = icmp eq i8 %2, 49
%inc.2 = zext i1 %cmp1.2 to i32
%spec.select.2 = add nuw nsw i32 %spec.select.1, %inc.2
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select.2)
br label %if.end6
if.end6: ; preds = %for.body.preheader, %entry
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %input) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
// AOJ 0349: Cyclic Sugoroku
// 2017.10.26 bal4u@uu
// 2017.11.14
#include <stdio.h>
int q[100002], top, end;
int a[100002], f[100002];
char buf[1100005], *p;
int getint()
{
int n = 0;
while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
return n;
}
int main()
{
int n, i, t, ans;
// scanf("%d", &n);
fgets(p=buf, 10, stdin), n = getint();
fgets(p=buf, sizeof(buf), stdin);
for (i = 0; i < n; i++) {
t = i + getint(), p++;
if (t >= n) t %= n;
a[i] = t, f[t]++;
}
ans = 0, top = end = 0;
for (i = 0; i < n; i++) if (!f[i]) q[end++] = i;
while (top < end) {
ans++;
t = a[q[top++]];
if (!--f[t]) q[end++] = t;
}
printf("%d\n", n - ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276635/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276635/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@p = dso_local local_unnamed_addr global ptr null, align 8
@buf = dso_local global [1100005 x i8] zeroinitializer, align 16
@stdin = external local_unnamed_addr global ptr, align 8
@a = dso_local local_unnamed_addr global [100002 x i32] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [100002 x i32] zeroinitializer, align 16
@end = dso_local local_unnamed_addr global i32 0, align 4
@top = dso_local local_unnamed_addr global i32 0, align 4
@q = dso_local local_unnamed_addr global [100002 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @getint() local_unnamed_addr #0 {
entry:
%p.promoted = load ptr, ptr @p, align 8, !tbaa !5
%0 = load i8, ptr %p.promoted, align 1, !tbaa !9
%cmp8 = icmp sgt i8 %0, 47
br i1 %cmp8, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%n.010 = phi i32 [ %add4, %while.body ], [ 0, %entry ]
%incdec.ptr79 = phi ptr [ %incdec.ptr, %while.body ], [ %p.promoted, %entry ]
%add = mul i32 %n.010, 10
%incdec.ptr = getelementptr inbounds i8, ptr %incdec.ptr79, i64 1
store ptr %incdec.ptr, ptr @p, align 8, !tbaa !5
%1 = load i8, ptr %incdec.ptr79, align 1, !tbaa !9
%2 = and i8 %1, 15
%and = zext i8 %2 to i32
%add4 = add nsw i32 %add, %and
%3 = load i8, ptr %incdec.ptr, align 1, !tbaa !9
%cmp = icmp sgt i8 %3, 47
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !10
while.end: ; preds = %while.body, %entry
%n.0.lcssa = phi i32 [ 0, %entry ], [ %add4, %while.body ]
ret i32 %n.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
store ptr @buf, ptr @p, align 8, !tbaa !5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = tail call ptr @fgets(ptr noundef nonnull @buf, i32 noundef 10, ptr noundef %0)
%p.promoted.i = load ptr, ptr @p, align 8, !tbaa !5
%1 = load i8, ptr %p.promoted.i, align 1, !tbaa !9
%cmp8.i = icmp sgt i8 %1, 47
br i1 %cmp8.i, label %while.body.i, label %getint.exit
while.body.i: ; preds = %entry, %while.body.i
%n.010.i = phi i32 [ %add4.i, %while.body.i ], [ 0, %entry ]
%incdec.ptr79.i = phi ptr [ %incdec.ptr.i, %while.body.i ], [ %p.promoted.i, %entry ]
%add.i = mul i32 %n.010.i, 10
%incdec.ptr.i = getelementptr inbounds i8, ptr %incdec.ptr79.i, i64 1
store ptr %incdec.ptr.i, ptr @p, align 8, !tbaa !5
%2 = load i8, ptr %incdec.ptr79.i, align 1, !tbaa !9
%3 = and i8 %2, 15
%and.i = zext i8 %3 to i32
%add4.i = add nsw i32 %add.i, %and.i
%4 = load i8, ptr %incdec.ptr.i, align 1, !tbaa !9
%cmp.i = icmp sgt i8 %4, 47
br i1 %cmp.i, label %while.body.i, label %getint.exit, !llvm.loop !10
getint.exit: ; preds = %while.body.i, %entry
%n.0.lcssa.i = phi i32 [ 0, %entry ], [ %add4.i, %while.body.i ]
store ptr @buf, ptr @p, align 8, !tbaa !5
%5 = load ptr, ptr @stdin, align 8, !tbaa !5
%call2 = tail call ptr @fgets(ptr noundef nonnull @buf, i32 noundef 1100005, ptr noundef %5)
%cmp68 = icmp sgt i32 %n.0.lcssa.i, 0
br i1 %cmp68, label %for.body.preheader, label %for.end.thread
for.end.thread: ; preds = %getint.exit
store i32 0, ptr @end, align 4, !tbaa !12
br label %while.end.sink.split
for.body.preheader: ; preds = %getint.exit
%p.promoted = load ptr, ptr @p, align 8, !tbaa !5
%wide.trip.count = zext i32 %n.0.lcssa.i to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %if.end
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %if.end ]
%incdec.ptr.i616669 = phi ptr [ %p.promoted, %for.body.preheader ], [ %incdec.ptr, %if.end ]
%6 = load i8, ptr %incdec.ptr.i616669, align 1, !tbaa !9
%cmp8.i55 = icmp sgt i8 %6, 47
br i1 %cmp8.i55, label %while.body.i57, label %getint.exit65
while.body.i57: ; preds = %for.body, %while.body.i57
%n.010.i58 = phi i32 [ %add4.i63, %while.body.i57 ], [ 0, %for.body ]
%incdec.ptr79.i59 = phi ptr [ %incdec.ptr.i61, %while.body.i57 ], [ %incdec.ptr.i616669, %for.body ]
%add.i60 = mul i32 %n.010.i58, 10
%incdec.ptr.i61 = getelementptr inbounds i8, ptr %incdec.ptr79.i59, i64 1
store ptr %incdec.ptr.i61, ptr @p, align 8, !tbaa !5
%7 = load i8, ptr %incdec.ptr79.i59, align 1, !tbaa !9
%8 = and i8 %7, 15
%and.i62 = zext i8 %8 to i32
%add4.i63 = add nsw i32 %add.i60, %and.i62
%9 = load i8, ptr %incdec.ptr.i61, align 1, !tbaa !9
%cmp.i64 = icmp sgt i8 %9, 47
br i1 %cmp.i64, label %while.body.i57, label %getint.exit65, !llvm.loop !10
getint.exit65: ; preds = %while.body.i57, %for.body
%incdec.ptr.i6167 = phi ptr [ %incdec.ptr.i616669, %for.body ], [ %incdec.ptr.i61, %while.body.i57 ]
%n.0.lcssa.i56 = phi i32 [ 0, %for.body ], [ %add4.i63, %while.body.i57 ]
%10 = trunc i64 %indvars.iv to i32
%add = add nsw i32 %n.0.lcssa.i56, %10
%incdec.ptr = getelementptr inbounds i8, ptr %incdec.ptr.i6167, i64 1
store ptr %incdec.ptr, ptr @p, align 8, !tbaa !5
%cmp4.not = icmp slt i32 %add, %n.0.lcssa.i
br i1 %cmp4.not, label %if.end, label %if.then
if.then: ; preds = %getint.exit65
%rem = srem i32 %add, %n.0.lcssa.i
br label %if.end
if.end: ; preds = %if.then, %getint.exit65
%t.0 = phi i32 [ %rem, %if.then ], [ %add, %getint.exit65 ]
%arrayidx = getelementptr inbounds [100002 x i32], ptr @a, i64 0, i64 %indvars.iv
store i32 %t.0, ptr %arrayidx, align 4, !tbaa !12
%idxprom5 = sext i32 %t.0 to i64
%arrayidx6 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %idxprom5
%11 = load i32, ptr %arrayidx6, align 4, !tbaa !12
%inc = add nsw i32 %11, 1
store i32 %inc, ptr %arrayidx6, align 4, !tbaa !12
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !14
for.end: ; preds = %if.end
store i32 0, ptr @end, align 4, !tbaa !12
store i32 0, ptr @top, align 4, !tbaa !12
br i1 %cmp68, label %for.body10.preheader, label %while.end
for.body10.preheader: ; preds = %for.end
%xtraiter = and i64 %wide.trip.count, 1
%12 = icmp eq i32 %n.0.lcssa.i, 1
br i1 %12, label %while.cond.preheader.unr-lcssa, label %for.body10.preheader.new
for.body10.preheader.new: ; preds = %for.body10.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body10
while.cond.preheader.unr-lcssa: ; preds = %for.inc18.1, %for.body10.preheader
%inc1471.lcssa.ph = phi i32 [ undef, %for.body10.preheader ], [ %inc1471.1, %for.inc18.1 ]
%indvars.iv85.unr = phi i64 [ 0, %for.body10.preheader ], [ %indvars.iv.next86.1, %for.inc18.1 ]
%inc147274.unr = phi i32 [ 0, %for.body10.preheader ], [ %inc1471.1, %for.inc18.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.cond.preheader, label %for.body10.epil
for.body10.epil: ; preds = %while.cond.preheader.unr-lcssa
%arrayidx12.epil = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %indvars.iv85.unr
%13 = load i32, ptr %arrayidx12.epil, align 4, !tbaa !12
%tobool.not.epil = icmp eq i32 %13, 0
br i1 %tobool.not.epil, label %if.then13.epil, label %while.cond.preheader
if.then13.epil: ; preds = %for.body10.epil
%inc14.epil = add nsw i32 %inc147274.unr, 1
store i32 %inc14.epil, ptr @end, align 4, !tbaa !12
%idxprom15.epil = sext i32 %inc147274.unr to i64
%arrayidx16.epil = getelementptr inbounds [100002 x i32], ptr @q, i64 0, i64 %idxprom15.epil
%14 = trunc i64 %indvars.iv85.unr to i32
store i32 %14, ptr %arrayidx16.epil, align 4, !tbaa !12
br label %while.cond.preheader
while.cond.preheader: ; preds = %for.body10.epil, %if.then13.epil, %while.cond.preheader.unr-lcssa
%inc1471.lcssa = phi i32 [ %inc1471.lcssa.ph, %while.cond.preheader.unr-lcssa ], [ %inc147274.unr, %for.body10.epil ], [ %inc14.epil, %if.then13.epil ]
%cmp2180 = icmp sgt i32 %inc1471.lcssa, 0
br i1 %cmp2180, label %while.body, label %while.end
for.body10: ; preds = %for.inc18.1, %for.body10.preheader.new
%indvars.iv85 = phi i64 [ 0, %for.body10.preheader.new ], [ %indvars.iv.next86.1, %for.inc18.1 ]
%inc147274 = phi i32 [ 0, %for.body10.preheader.new ], [ %inc1471.1, %for.inc18.1 ]
%niter = phi i64 [ 0, %for.body10.preheader.new ], [ %niter.next.1, %for.inc18.1 ]
%arrayidx12 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %indvars.iv85
%15 = load i32, ptr %arrayidx12, align 8, !tbaa !12
%tobool.not = icmp eq i32 %15, 0
br i1 %tobool.not, label %if.then13, label %for.inc18
if.then13: ; preds = %for.body10
%inc14 = add nsw i32 %inc147274, 1
store i32 %inc14, ptr @end, align 4, !tbaa !12
%idxprom15 = sext i32 %inc147274 to i64
%arrayidx16 = getelementptr inbounds [100002 x i32], ptr @q, i64 0, i64 %idxprom15
%16 = trunc i64 %indvars.iv85 to i32
store i32 %16, ptr %arrayidx16, align 4, !tbaa !12
br label %for.inc18
for.inc18: ; preds = %for.body10, %if.then13
%inc1471 = phi i32 [ %inc147274, %for.body10 ], [ %inc14, %if.then13 ]
%indvars.iv.next86 = or i64 %indvars.iv85, 1
%arrayidx12.1 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %indvars.iv.next86
%17 = load i32, ptr %arrayidx12.1, align 4, !tbaa !12
%tobool.not.1 = icmp eq i32 %17, 0
br i1 %tobool.not.1, label %if.then13.1, label %for.inc18.1
if.then13.1: ; preds = %for.inc18
%inc14.1 = add nsw i32 %inc1471, 1
store i32 %inc14.1, ptr @end, align 4, !tbaa !12
%idxprom15.1 = sext i32 %inc1471 to i64
%arrayidx16.1 = getelementptr inbounds [100002 x i32], ptr @q, i64 0, i64 %idxprom15.1
%18 = trunc i64 %indvars.iv.next86 to i32
store i32 %18, ptr %arrayidx16.1, align 4, !tbaa !12
br label %for.inc18.1
for.inc18.1: ; preds = %if.then13.1, %for.inc18
%inc1471.1 = phi i32 [ %inc1471, %for.inc18 ], [ %inc14.1, %if.then13.1 ]
%indvars.iv.next86.1 = add nuw nsw i64 %indvars.iv85, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %while.cond.preheader.unr-lcssa, label %for.body10, !llvm.loop !15
while.body: ; preds = %while.cond.preheader, %if.end35
%indvars.iv90 = phi i64 [ %indvars.iv.next91, %if.end35 ], [ 0, %while.cond.preheader ]
%ans.083 = phi i32 [ %inc22, %if.end35 ], [ 0, %while.cond.preheader ]
%inc327981 = phi i32 [ %inc3278, %if.end35 ], [ %inc1471.lcssa, %while.cond.preheader ]
%inc22 = add nuw nsw i32 %ans.083, 1
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%arrayidx25 = getelementptr inbounds [100002 x i32], ptr @q, i64 0, i64 %indvars.iv90
%19 = load i32, ptr %arrayidx25, align 4, !tbaa !12
%idxprom26 = sext i32 %19 to i64
%arrayidx27 = getelementptr inbounds [100002 x i32], ptr @a, i64 0, i64 %idxprom26
%20 = load i32, ptr %arrayidx27, align 4, !tbaa !12
%idxprom28 = sext i32 %20 to i64
%arrayidx29 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %idxprom28
%21 = load i32, ptr %arrayidx29, align 4, !tbaa !12
%dec = add nsw i32 %21, -1
store i32 %dec, ptr %arrayidx29, align 4, !tbaa !12
%tobool30.not = icmp eq i32 %dec, 0
br i1 %tobool30.not, label %if.then31, label %if.end35
if.then31: ; preds = %while.body
%inc32 = add nsw i32 %inc327981, 1
store i32 %inc32, ptr @end, align 4, !tbaa !12
%idxprom33 = sext i32 %inc327981 to i64
%arrayidx34 = getelementptr inbounds [100002 x i32], ptr @q, i64 0, i64 %idxprom33
store i32 %20, ptr %arrayidx34, align 4, !tbaa !12
br label %if.end35
if.end35: ; preds = %if.then31, %while.body
%inc3278 = phi i32 [ %inc32, %if.then31 ], [ %inc327981, %while.body ]
%22 = sext i32 %inc3278 to i64
%cmp21 = icmp slt i64 %indvars.iv.next91, %22
br i1 %cmp21, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !16
while.cond.while.end_crit_edge: ; preds = %if.end35
%23 = trunc i64 %indvars.iv.next91 to i32
br label %while.end.sink.split
while.end.sink.split: ; preds = %while.cond.while.end_crit_edge, %for.end.thread
%.sink = phi i32 [ 0, %for.end.thread ], [ %23, %while.cond.while.end_crit_edge ]
%ans.0.lcssa.ph = phi i32 [ 0, %for.end.thread ], [ %inc22, %while.cond.while.end_crit_edge ]
store i32 %.sink, ptr @top, align 4, !tbaa !12
br label %while.end
while.end: ; preds = %while.end.sink.split, %for.end, %while.cond.preheader
%ans.0.lcssa = phi i32 [ 0, %while.cond.preheader ], [ 0, %for.end ], [ %ans.0.lcssa.ph, %while.end.sink.split ]
%sub = sub nsw i32 %n.0.lcssa.i, %ans.0.lcssa
%call36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
|
#include <stdio.h>
typedef struct {
int key, id;
} data;
typedef struct {
data obj[400001];
int size;
} min_heap;
void push(data x, min_heap* h)
{
int i = ++(h->size), j = i >> 1;
data tmp;
h->obj[i] = x;
while (j > 0) {
if (h->obj[i].key < h->obj[j].key) {
tmp = h->obj[j];
h->obj[j] = h->obj[i];
h->obj[i] = tmp;
i = j;
j >>= 1;
} else break;
}
}
data pop(min_heap* h)
{
int i = 1, j = 2;
data output = h->obj[1], tmp;
h->obj[1] = h->obj[(h->size)--];
while (j <= h->size) {
if (j < h->size && h->obj[j^1].key < h->obj[j].key) j ^= 1;
if (h->obj[j].key < h->obj[i].key) {
tmp = h->obj[j];
h->obj[j] = h->obj[i];
h->obj[i] = tmp;
i = j;
j <<= 1;
} else break;
}
return output;
}
void add_BIT(int N, int BIT[], int i, int k)
{
while (i <= N) {
BIT[i] += k;
i += (i & -i);
}
}
int sum_BIT(int BIT[], int r)
{
int sum = 0;
while (r > 0) {
sum += BIT[r];
r -= (r & -r);
}
return sum;
}
int main()
{
int i, H, W, A, B;
scanf("%d %d", &H, &W);
int j, k, s[200002], left[200002], right[200002], BIT[200001] = {}, L, R, M, tmp;
data d;
min_heap h;
h.size = 0;
for (i = 0; i <= W + 1; i++) {
s[i] = i;
left[i] = i - 1;
right[i] = i + 1;
}
for (i = 1, d.key = 0; i <= W; i++) {
d.id = i;
push(d, &h);
add_BIT(W, BIT, i, 1);
}
for (i = 1; i <= H; i++) {
scanf("%d %d", &A, &B);
tmp = sum_BIT(BIT, A - 1);
if (sum_BIT(BIT, B) == tmp) {
printf("%d\n", h.obj[1].key + i);
continue;
}
L = A;
R = B++;
while (L < R) {
M = (L + R) / 2;
if (sum_BIT(BIT, M) > tmp) R = M;
else L = M + 1;
}
left[B] = left[L];
right[left[L]] = B;
if (s[B] < 0) add_BIT(W, BIT, B, 1);
for (j = L; j < B; j = right[j]) {
if (s[j] > s[B]) s[B] = s[j];
s[j] = -1;
add_BIT(W, BIT, j, -1);
}
if (j != B) {
left[j] = B;
right[B] = j;
}
if (B <= W) {
d.key = B - s[B];
d.id = B;
push(d, &h);
}
while (h.size > 0 && s[h.obj[1].id] < h.obj[1].id - h.obj[1].key) pop(&h);
if (h.size > 0) printf("%d\n", h.obj[1].key + i);
else break;
}
for (; i <= H; i++) printf("-1\n");
fflush(stdout);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276679/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276679/source.c"
target datalayout = "e-m:e-p270: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.min_heap = type { [400001 x %struct.data], i32 }
%struct.data = 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
@stdout = external local_unnamed_addr global ptr, align 8
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @push(i64 %x.coerce, ptr nocapture noundef %h) local_unnamed_addr #0 {
entry:
%size = getelementptr inbounds %struct.min_heap, ptr %h, i64 0, i32 1
%0 = load i32, ptr %size, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr %size, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom
store i64 %x.coerce, ptr %arrayidx, align 4, !tbaa.struct !10
%cmp38 = icmp sgt i32 %0, 0
br i1 %cmp38, label %while.body, label %while.end
while.body: ; preds = %entry, %if.then
%i.039 = phi i32 [ %j.040, %if.then ], [ %inc, %entry ]
%j.040 = lshr i32 %i.039, 1
%idxprom2 = sext i32 %i.039 to i64
%arrayidx3 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom2
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !12
%idxprom5 = zext i32 %j.040 to i64
%arrayidx6 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom5
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !12
%cmp8 = icmp slt i32 %1, %2
br i1 %cmp8, label %if.then, label %while.end
if.then: ; preds = %while.body
%3 = load i64, ptr %arrayidx6, align 4
%4 = load i64, ptr %arrayidx3, align 4
store i64 %4, ptr %arrayidx6, align 4
store i64 %3, ptr %arrayidx3, align 4
%cmp.not = icmp ult i32 %i.039, 4
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %if.then, %while.body, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i64 @pop(ptr nocapture noundef %h) local_unnamed_addr #0 {
entry:
%arrayidx = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 1
%retval.sroa.0.0.copyload = load i64, ptr %arrayidx, align 4, !tbaa.struct !10
%size = getelementptr inbounds %struct.min_heap, ptr %h, i64 0, i32 1
%0 = load i32, ptr %size, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr %size, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx4 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom
%1 = load i64, ptr %arrayidx4, align 4
store i64 %1, ptr %arrayidx, align 4
%cmp.not65 = icmp slt i32 %0, 3
br i1 %cmp.not65, label %while.end, label %while.body
while.body: ; preds = %entry, %if.then26
%2 = phi i32 [ %9, %if.then26 ], [ %dec, %entry ]
%j.067 = phi i32 [ %shl, %if.then26 ], [ 2, %entry ]
%i.066 = phi i32 [ %j.1, %if.then26 ], [ 1, %entry ]
%cmp7 = icmp slt i32 %j.067, %2
br i1 %cmp7, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %while.body
%xor64 = or i32 %j.067, 1
%idxprom9 = sext i32 %xor64 to i64
%arrayidx10 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom9
%3 = load i32, ptr %arrayidx10, align 4, !tbaa !12
%idxprom12 = sext i32 %j.067 to i64
%arrayidx13 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom12
%4 = load i32, ptr %arrayidx13, align 4, !tbaa !12
%cmp15 = icmp slt i32 %3, %4
%spec.select = select i1 %cmp15, i32 %xor64, i32 %j.067
br label %if.end
if.end: ; preds = %land.lhs.true, %while.body
%j.1 = phi i32 [ %j.067, %while.body ], [ %spec.select, %land.lhs.true ]
%idxprom18 = sext i32 %j.1 to i64
%arrayidx19 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom18
%5 = load i32, ptr %arrayidx19, align 4, !tbaa !12
%idxprom22 = sext i32 %i.066 to i64
%arrayidx23 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom22
%6 = load i32, ptr %arrayidx23, align 4, !tbaa !12
%cmp25 = icmp slt i32 %5, %6
br i1 %cmp25, label %if.then26, label %while.end
if.then26: ; preds = %if.end
%7 = load i64, ptr %arrayidx19, align 4
%8 = load i64, ptr %arrayidx23, align 4
store i64 %8, ptr %arrayidx19, align 4
store i64 %7, ptr %arrayidx23, align 4
%shl = shl i32 %j.1, 1
%9 = load i32, ptr %size, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %shl, %9
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %if.then26, %if.end, %entry
ret i64 %retval.sroa.0.0.copyload
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @add_BIT(i32 noundef %N, ptr nocapture noundef %BIT, i32 noundef %i, i32 noundef %k) local_unnamed_addr #0 {
entry:
%cmp.not6 = icmp sgt i32 %i, %N
br i1 %cmp.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%i.addr.07 = phi i32 [ %add1, %while.body ], [ %i, %entry ]
%idxprom = sext i32 %i.addr.07 to i64
%arrayidx = getelementptr inbounds i32, ptr %BIT, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !11
%add = add nsw i32 %0, %k
store i32 %add, ptr %arrayidx, align 4, !tbaa !11
%sub = sub nsw i32 0, %i.addr.07
%and = and i32 %i.addr.07, %sub
%add1 = add nsw i32 %and, %i.addr.07
%cmp.not = icmp sgt i32 %add1, %N
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !17
while.end: ; preds = %while.body, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @sum_BIT(ptr nocapture noundef readonly %BIT, i32 noundef %r) local_unnamed_addr #2 {
entry:
%cmp7 = icmp sgt i32 %r, 0
br i1 %cmp7, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%sum.09 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%r.addr.08 = phi i32 [ %sub1, %while.body ], [ %r, %entry ]
%idxprom = zext i32 %r.addr.08 to i64
%arrayidx = getelementptr inbounds i32, ptr %BIT, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !11
%add = add nsw i32 %0, %sum.09
%sub.not = add nsw i32 %r.addr.08, -1
%sub1 = and i32 %sub.not, %r.addr.08
%cmp.not = icmp eq i32 %sub1, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %while.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %sum.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
%A = alloca i32, align 4
%B = alloca i32, align 4
%s = alloca [200002 x i32], align 16
%left = alloca [200002 x i32], align 16
%right = alloca [200002 x i32], align 16
%BIT = alloca [200001 x i32], align 16
%h = alloca %struct.min_heap, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %s) #8
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %left) #8
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %right) #8
call void @llvm.lifetime.start.p0(i64 800004, ptr nonnull %BIT) #8
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800004) %BIT, i8 0, i64 800004, i1 false)
call void @llvm.lifetime.start.p0(i64 3200012, ptr nonnull %h) #8
%size = getelementptr inbounds %struct.min_heap, ptr %h, i64 0, i32 1
store i32 0, ptr %size, align 4, !tbaa !5
%0 = load i32, ptr %W, align 4, !tbaa !11
%cmp.not250 = icmp slt i32 %0, -1
br i1 %cmp.not250, label %for.cond12.preheader, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = add i32 %0, 2
%wide.trip.count = zext i32 %1 to i64
%min.iters.check = icmp ult i32 %1, 8
br i1 %min.iters.check, label %for.body.preheader300, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.ind288 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next291, %vector.body ]
%vec.ind292 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next295, %vector.body ]
%step.add289 = add <4 x i32> %vec.ind288, <i32 4, i32 4, i32 4, i32 4>
%2 = getelementptr inbounds [200002 x i32], ptr %s, i64 0, i64 %index
store <4 x i32> %vec.ind288, ptr %2, align 16, !tbaa !11
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> %step.add289, ptr %3, align 16, !tbaa !11
%4 = getelementptr inbounds [200002 x i32], ptr %left, i64 0, i64 %index
%5 = add <4 x i32> %vec.ind292, <i32 -1, i32 -1, i32 -1, i32 -1>
%6 = add <4 x i32> %vec.ind292, <i32 3, i32 3, i32 3, i32 3>
store <4 x i32> %5, ptr %4, align 16, !tbaa !11
%7 = getelementptr inbounds i32, ptr %4, i64 4
store <4 x i32> %6, ptr %7, align 16, !tbaa !11
%8 = getelementptr inbounds [200002 x i32], ptr %right, i64 0, i64 %index
%9 = trunc <4 x i64> %vec.ind to <4 x i32>
%10 = add <4 x i32> %9, <i32 1, i32 1, i32 1, i32 1>
%11 = trunc <4 x i64> %vec.ind to <4 x i32>
%12 = add <4 x i32> %11, <i32 5, i32 5, i32 5, i32 5>
store <4 x i32> %10, ptr %8, align 16, !tbaa !11
%13 = getelementptr inbounds i32, ptr %8, i64 4
store <4 x i32> %12, ptr %13, align 16, !tbaa !11
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%vec.ind.next291 = add <4 x i32> %vec.ind288, <i32 8, i32 8, i32 8, i32 8>
%vec.ind.next295 = add <4 x i32> %vec.ind292, <i32 8, i32 8, i32 8, i32 8>
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !19
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond6.preheader, label %for.body.preheader300
for.body.preheader300: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond6.preheader: ; preds = %for.body, %middle.block
%cmp7.not252 = icmp slt i32 %0, 1
br i1 %cmp7.not252, label %for.cond12.preheader, label %for.body8.preheader
for.body8.preheader: ; preds = %for.cond6.preheader
%15 = add nuw i32 %0, 1
%wide.trip.count276 = zext i32 %15 to i64
br label %for.body8
for.body: ; preds = %for.body.preheader300, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader300 ]
%arrayidx = getelementptr inbounds [200002 x i32], ptr %s, i64 0, i64 %indvars.iv
%16 = trunc i64 %indvars.iv to i32
store i32 %16, ptr %arrayidx, align 4, !tbaa !11
%arrayidx2 = getelementptr inbounds [200002 x i32], ptr %left, i64 0, i64 %indvars.iv
%17 = trunc i64 %indvars.iv to i32
%18 = add i32 %17, -1
store i32 %18, ptr %arrayidx2, align 4, !tbaa !11
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx5 = getelementptr inbounds [200002 x i32], ptr %right, i64 0, i64 %indvars.iv
%19 = trunc i64 %indvars.iv.next to i32
store i32 %19, ptr %arrayidx5, align 4, !tbaa !11
%exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond, label %for.cond6.preheader, label %for.body, !llvm.loop !22
for.cond12.preheader: ; preds = %add_BIT.exit, %entry, %for.cond6.preheader
%20 = load i32, ptr %H, align 4, !tbaa !11
%cmp13.not264 = icmp slt i32 %20, 1
br i1 %cmp13.not264, label %for.end116, label %for.body14.lr.ph
for.body14.lr.ph: ; preds = %for.cond12.preheader
%arrayidx89 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 1
%id90 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 1, i32 1
br label %for.body14
for.body8: ; preds = %for.body8.preheader, %add_BIT.exit
%indvars.iv273 = phi i64 [ 1, %for.body8.preheader ], [ %indvars.iv.next274, %add_BIT.exit ]
%d.sroa.6.0.insert.shift = shl nuw nsw i64 %indvars.iv273, 32
%21 = load i32, ptr %size, align 4, !tbaa !5
%inc.i = add nsw i32 %21, 1
store i32 %inc.i, ptr %size, align 4, !tbaa !5
%idxprom.i = sext i32 %inc.i to i64
%arrayidx.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom.i
store i64 %d.sroa.6.0.insert.shift, ptr %arrayidx.i, align 4, !tbaa.struct !10
%cmp38.i = icmp sgt i32 %21, 0
br i1 %cmp38.i, label %while.body.i, label %push.exit
while.body.i: ; preds = %for.body8, %if.then.i
%i.039.i = phi i32 [ %j.040.i, %if.then.i ], [ %inc.i, %for.body8 ]
%j.040.i = lshr i32 %i.039.i, 1
%idxprom2.i = zext i32 %i.039.i to i64
%arrayidx3.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom2.i
%22 = load i32, ptr %arrayidx3.i, align 4, !tbaa !12
%idxprom5.i = zext i32 %j.040.i to i64
%arrayidx6.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom5.i
%23 = load i32, ptr %arrayidx6.i, align 4, !tbaa !12
%cmp8.i = icmp slt i32 %22, %23
br i1 %cmp8.i, label %if.then.i, label %push.exit
if.then.i: ; preds = %while.body.i
%24 = load i64, ptr %arrayidx6.i, align 4
%25 = load i64, ptr %arrayidx3.i, align 4
store i64 %25, ptr %arrayidx6.i, align 4
store i64 %24, ptr %arrayidx3.i, align 4
%cmp.not.i = icmp ult i32 %i.039.i, 4
br i1 %cmp.not.i, label %push.exit, label %while.body.i, !llvm.loop !14
push.exit: ; preds = %while.body.i, %if.then.i, %for.body8
%26 = trunc i64 %indvars.iv273 to i32
br label %while.body.i169
while.body.i169: ; preds = %push.exit, %while.body.i169
%i.addr.07.i = phi i32 [ %add1.i, %while.body.i169 ], [ %26, %push.exit ]
%idxprom.i170 = sext i32 %i.addr.07.i to i64
%arrayidx.i171 = getelementptr inbounds i32, ptr %BIT, i64 %idxprom.i170
%27 = load i32, ptr %arrayidx.i171, align 4, !tbaa !11
%add.i = add nsw i32 %27, 1
store i32 %add.i, ptr %arrayidx.i171, align 4, !tbaa !11
%sub.i = sub nsw i32 0, %i.addr.07.i
%and.i = and i32 %i.addr.07.i, %sub.i
%add1.i = add nsw i32 %and.i, %i.addr.07.i
%cmp.not.i172 = icmp sgt i32 %add1.i, %0
br i1 %cmp.not.i172, label %add_BIT.exit, label %while.body.i169, !llvm.loop !17
add_BIT.exit: ; preds = %while.body.i169
%indvars.iv.next274 = add nuw nsw i64 %indvars.iv273, 1
%exitcond277.not = icmp eq i64 %indvars.iv.next274, %wide.trip.count276
br i1 %exitcond277.not, label %for.cond12.preheader, label %for.body8, !llvm.loop !23
for.body14: ; preds = %for.body14.lr.ph, %for.inc114
%i.2265 = phi i32 [ 1, %for.body14.lr.ph ], [ %inc115, %for.inc114 ]
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%28 = load i32, ptr %A, align 4, !tbaa !11
%cmp7.i = icmp sgt i32 %28, 1
br i1 %cmp7.i, label %while.body.i173.preheader, label %sum_BIT.exit
while.body.i173.preheader: ; preds = %for.body14
%sub17 = add nsw i32 %28, -1
br label %while.body.i173
while.body.i173: ; preds = %while.body.i173.preheader, %while.body.i173
%sum.09.i = phi i32 [ %add.i176, %while.body.i173 ], [ 0, %while.body.i173.preheader ]
%r.addr.08.i = phi i32 [ %sub1.i, %while.body.i173 ], [ %sub17, %while.body.i173.preheader ]
%idxprom.i174 = zext i32 %r.addr.08.i to i64
%arrayidx.i175 = getelementptr inbounds i32, ptr %BIT, i64 %idxprom.i174
%29 = load i32, ptr %arrayidx.i175, align 4, !tbaa !11
%add.i176 = add nsw i32 %29, %sum.09.i
%sub.not.i = add nsw i32 %r.addr.08.i, -1
%sub1.i = and i32 %sub.not.i, %r.addr.08.i
%cmp.not.i177 = icmp eq i32 %sub1.i, 0
br i1 %cmp.not.i177, label %sum_BIT.exit, label %while.body.i173, !llvm.loop !18
sum_BIT.exit: ; preds = %while.body.i173, %for.body14
%sum.0.lcssa.i = phi i32 [ 0, %for.body14 ], [ %add.i176, %while.body.i173 ]
%30 = load i32, ptr %B, align 4, !tbaa !11
%cmp7.i178 = icmp sgt i32 %30, 0
br i1 %cmp7.i178, label %while.body.i180, label %sum_BIT.exit189
while.body.i180: ; preds = %sum_BIT.exit, %while.body.i180
%sum.09.i181 = phi i32 [ %add.i185, %while.body.i180 ], [ 0, %sum_BIT.exit ]
%r.addr.08.i182 = phi i32 [ %sub1.i187, %while.body.i180 ], [ %30, %sum_BIT.exit ]
%idxprom.i183 = zext i32 %r.addr.08.i182 to i64
%arrayidx.i184 = getelementptr inbounds i32, ptr %BIT, i64 %idxprom.i183
%31 = load i32, ptr %arrayidx.i184, align 4, !tbaa !11
%add.i185 = add nsw i32 %31, %sum.09.i181
%sub.not.i186 = add nsw i32 %r.addr.08.i182, -1
%sub1.i187 = and i32 %sub.not.i186, %r.addr.08.i182
%cmp.not.i188 = icmp eq i32 %sub1.i187, 0
br i1 %cmp.not.i188, label %sum_BIT.exit189, label %while.body.i180, !llvm.loop !18
sum_BIT.exit189: ; preds = %while.body.i180, %sum_BIT.exit
%sum.0.lcssa.i179 = phi i32 [ 0, %sum_BIT.exit ], [ %add.i185, %while.body.i180 ]
%cmp21 = icmp eq i32 %sum.0.lcssa.i179, %sum.0.lcssa.i
br i1 %cmp21, label %if.then, label %if.end
if.then: ; preds = %sum_BIT.exit189
%32 = load i32, ptr %arrayidx89, align 4, !tbaa !12
br label %for.inc114
if.end: ; preds = %sum_BIT.exit189
%inc26 = add nsw i32 %30, 1
store i32 %inc26, ptr %B, align 4, !tbaa !11
%cmp27254 = icmp slt i32 %28, %30
br i1 %cmp27254, label %while.body, label %while.end
while.body: ; preds = %if.end, %sum_BIT.exit201
%L.0256 = phi i32 [ %L.1, %sum_BIT.exit201 ], [ %28, %if.end ]
%R.0255 = phi i32 [ %R.1, %sum_BIT.exit201 ], [ %30, %if.end ]
%add28 = add nsw i32 %L.0256, %R.0255
%div = sdiv i32 %add28, 2
%cmp7.i190 = icmp sgt i32 %add28, 1
br i1 %cmp7.i190, label %while.body.i192, label %sum_BIT.exit201
while.body.i192: ; preds = %while.body, %while.body.i192
%sum.09.i193 = phi i32 [ %add.i197, %while.body.i192 ], [ 0, %while.body ]
%r.addr.08.i194 = phi i32 [ %sub1.i199, %while.body.i192 ], [ %div, %while.body ]
%idxprom.i195 = zext i32 %r.addr.08.i194 to i64
%arrayidx.i196 = getelementptr inbounds i32, ptr %BIT, i64 %idxprom.i195
%33 = load i32, ptr %arrayidx.i196, align 4, !tbaa !11
%add.i197 = add nsw i32 %33, %sum.09.i193
%sub.not.i198 = add nsw i32 %r.addr.08.i194, -1
%sub1.i199 = and i32 %sub.not.i198, %r.addr.08.i194
%cmp.not.i200 = icmp eq i32 %sub1.i199, 0
br i1 %cmp.not.i200, label %sum_BIT.exit201, label %while.body.i192, !llvm.loop !18
sum_BIT.exit201: ; preds = %while.body.i192, %while.body
%sum.0.lcssa.i191 = phi i32 [ 0, %while.body ], [ %add.i197, %while.body.i192 ]
%cmp31 = icmp sgt i32 %sum.0.lcssa.i191, %sum.0.lcssa.i
%add33 = add nsw i32 %div, 1
%R.1 = select i1 %cmp31, i32 %div, i32 %R.0255
%L.1 = select i1 %cmp31, i32 %L.0256, i32 %add33
%cmp27 = icmp slt i32 %L.1, %R.1
br i1 %cmp27, label %while.body, label %while.end, !llvm.loop !24
while.end: ; preds = %sum_BIT.exit201, %if.end
%L.0.lcssa = phi i32 [ %28, %if.end ], [ %L.1, %sum_BIT.exit201 ]
%idxprom35 = sext i32 %L.0.lcssa to i64
%arrayidx36 = getelementptr inbounds [200002 x i32], ptr %left, i64 0, i64 %idxprom35
%34 = load i32, ptr %arrayidx36, align 4, !tbaa !11
%idxprom37 = sext i32 %inc26 to i64
%arrayidx38 = getelementptr inbounds [200002 x i32], ptr %left, i64 0, i64 %idxprom37
store i32 %34, ptr %arrayidx38, align 4, !tbaa !11
%35 = load i32, ptr %arrayidx36, align 4, !tbaa !11
%idxprom41 = sext i32 %35 to i64
%arrayidx42 = getelementptr inbounds [200002 x i32], ptr %right, i64 0, i64 %idxprom41
store i32 %inc26, ptr %arrayidx42, align 4, !tbaa !11
%arrayidx44 = getelementptr inbounds [200002 x i32], ptr %s, i64 0, i64 %idxprom37
%36 = load i32, ptr %arrayidx44, align 4, !tbaa !11
%cmp45 = icmp slt i32 %36, 0
br i1 %cmp45, label %if.then46, label %if.end48
if.then46: ; preds = %while.end
%37 = load i32, ptr %W, align 4, !tbaa !11
%cmp.not6.i202.not = icmp slt i32 %30, %37
br i1 %cmp.not6.i202.not, label %while.body.i203, label %if.end48
while.body.i203: ; preds = %if.then46, %while.body.i203
%i.addr.07.i204 = phi i32 [ %add1.i210, %while.body.i203 ], [ %inc26, %if.then46 ]
%idxprom.i205 = sext i32 %i.addr.07.i204 to i64
%arrayidx.i206 = getelementptr inbounds i32, ptr %BIT, i64 %idxprom.i205
%38 = load i32, ptr %arrayidx.i206, align 4, !tbaa !11
%add.i207 = add nsw i32 %38, 1
store i32 %add.i207, ptr %arrayidx.i206, align 4, !tbaa !11
%sub.i208 = sub nsw i32 0, %i.addr.07.i204
%and.i209 = and i32 %i.addr.07.i204, %sub.i208
%add1.i210 = add nsw i32 %and.i209, %i.addr.07.i204
%cmp.not.i211 = icmp sgt i32 %add1.i210, %37
br i1 %cmp.not.i211, label %if.end48, label %while.body.i203, !llvm.loop !17
if.end48: ; preds = %while.body.i203, %if.then46, %while.end
%cmp50.not258 = icmp sgt i32 %L.0.lcssa, %30
br i1 %cmp50.not258, label %for.end69, label %for.body51.lr.ph
for.body51.lr.ph: ; preds = %if.end48
%39 = load i32, ptr %W, align 4, !tbaa !11
br label %for.body51
for.body51: ; preds = %for.body51.lr.ph, %add_BIT.exit223
%j.0259 = phi i32 [ %L.0.lcssa, %for.body51.lr.ph ], [ %43, %add_BIT.exit223 ]
%idxprom52 = sext i32 %j.0259 to i64
%arrayidx53 = getelementptr inbounds [200002 x i32], ptr %s, i64 0, i64 %idxprom52
%40 = load i32, ptr %arrayidx53, align 4, !tbaa !11
%41 = load i32, ptr %arrayidx44, align 4, !tbaa !11
%spec.store.select = call i32 @llvm.smax.i32(i32 %40, i32 %41)
store i32 %spec.store.select, ptr %arrayidx44, align 4
store i32 -1, ptr %arrayidx53, align 4, !tbaa !11
%cmp.not6.i213 = icmp sgt i32 %j.0259, %39
br i1 %cmp.not6.i213, label %add_BIT.exit223, label %while.body.i214
while.body.i214: ; preds = %for.body51, %while.body.i214
%i.addr.07.i215 = phi i32 [ %add1.i221, %while.body.i214 ], [ %j.0259, %for.body51 ]
%idxprom.i216 = sext i32 %i.addr.07.i215 to i64
%arrayidx.i217 = getelementptr inbounds i32, ptr %BIT, i64 %idxprom.i216
%42 = load i32, ptr %arrayidx.i217, align 4, !tbaa !11
%add.i218 = add nsw i32 %42, -1
store i32 %add.i218, ptr %arrayidx.i217, align 4, !tbaa !11
%sub.i219 = sub nsw i32 0, %i.addr.07.i215
%and.i220 = and i32 %i.addr.07.i215, %sub.i219
%add1.i221 = add nsw i32 %and.i220, %i.addr.07.i215
%cmp.not.i222 = icmp sgt i32 %add1.i221, %39
br i1 %cmp.not.i222, label %add_BIT.exit223, label %while.body.i214, !llvm.loop !17
add_BIT.exit223: ; preds = %while.body.i214, %for.body51
%arrayidx68 = getelementptr inbounds [200002 x i32], ptr %right, i64 0, i64 %idxprom52
%43 = load i32, ptr %arrayidx68, align 4, !tbaa !11
%cmp50.not = icmp sgt i32 %43, %30
br i1 %cmp50.not, label %for.end69, label %for.body51, !llvm.loop !25
for.end69: ; preds = %add_BIT.exit223, %if.end48
%j.0.lcssa = phi i32 [ %L.0.lcssa, %if.end48 ], [ %43, %add_BIT.exit223 ]
%cmp70.not = icmp eq i32 %j.0.lcssa, %inc26
br i1 %cmp70.not, label %if.end76, label %if.then71
if.then71: ; preds = %for.end69
%idxprom72 = sext i32 %j.0.lcssa to i64
%arrayidx73 = getelementptr inbounds [200002 x i32], ptr %left, i64 0, i64 %idxprom72
store i32 %inc26, ptr %arrayidx73, align 4, !tbaa !11
%arrayidx75 = getelementptr inbounds [200002 x i32], ptr %right, i64 0, i64 %idxprom37
store i32 %j.0.lcssa, ptr %arrayidx75, align 4, !tbaa !11
br label %if.end76
if.end76: ; preds = %if.then71, %for.end69
%44 = load i32, ptr %W, align 4, !tbaa !11
%cmp77.not.not = icmp slt i32 %30, %44
br i1 %cmp77.not.not, label %if.then78, label %if.end84
if.then78: ; preds = %if.end76
%45 = load i32, ptr %arrayidx44, align 4, !tbaa !11
%sub81 = sub nsw i32 %inc26, %45
%d.sroa.6.0.insert.ext130 = zext i32 %inc26 to i64
%d.sroa.6.0.insert.shift131 = shl nuw i64 %d.sroa.6.0.insert.ext130, 32
%d.sroa.0.0.insert.ext126 = zext i32 %sub81 to i64
%d.sroa.0.0.insert.insert128 = or i64 %d.sroa.6.0.insert.shift131, %d.sroa.0.0.insert.ext126
%46 = load i32, ptr %size, align 4, !tbaa !5
%inc.i225 = add nsw i32 %46, 1
store i32 %inc.i225, ptr %size, align 4, !tbaa !5
%idxprom.i226 = sext i32 %inc.i225 to i64
%arrayidx.i227 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom.i226
store i64 %d.sroa.0.0.insert.insert128, ptr %arrayidx.i227, align 4, !tbaa.struct !10
%cmp38.i228 = icmp sgt i32 %46, 0
br i1 %cmp38.i228, label %while.body.i230, label %if.end84
while.body.i230: ; preds = %if.then78, %if.then.i238
%i.039.i231 = phi i32 [ %j.040.i232, %if.then.i238 ], [ %inc.i225, %if.then78 ]
%j.040.i232 = lshr i32 %i.039.i231, 1
%idxprom2.i233 = zext i32 %i.039.i231 to i64
%arrayidx3.i234 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom2.i233
%47 = load i32, ptr %arrayidx3.i234, align 4, !tbaa !12
%idxprom5.i235 = zext i32 %j.040.i232 to i64
%arrayidx6.i236 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom5.i235
%48 = load i32, ptr %arrayidx6.i236, align 4, !tbaa !12
%cmp8.i237 = icmp slt i32 %47, %48
br i1 %cmp8.i237, label %if.then.i238, label %if.end84
if.then.i238: ; preds = %while.body.i230
%49 = load i64, ptr %arrayidx6.i236, align 4
%50 = load i64, ptr %arrayidx3.i234, align 4
store i64 %50, ptr %arrayidx6.i236, align 4
store i64 %49, ptr %arrayidx3.i234, align 4
%cmp.not.i239 = icmp ult i32 %i.039.i231, 4
br i1 %cmp.not.i239, label %if.end84, label %while.body.i230, !llvm.loop !14
if.end84: ; preds = %if.then.i238, %while.body.i230, %if.then78, %if.end76
%51 = load i32, ptr %size, align 4, !tbaa !5
%cmp87261 = icmp sgt i32 %51, 0
br i1 %cmp87261, label %land.rhs, label %for.end116
land.rhs: ; preds = %if.end84, %pop.exit
%52 = phi i32 [ %65, %pop.exit ], [ %51, %if.end84 ]
%53 = load i32, ptr %id90, align 4, !tbaa !26
%idxprom91 = sext i32 %53 to i64
%arrayidx92 = getelementptr inbounds [200002 x i32], ptr %s, i64 0, i64 %idxprom91
%54 = load i32, ptr %arrayidx92, align 4, !tbaa !11
%55 = load i32, ptr %arrayidx89, align 4, !tbaa !12
%sub99 = sub nsw i32 %53, %55
%cmp100 = icmp slt i32 %54, %sub99
br i1 %cmp100, label %while.body101, label %for.inc114
while.body101: ; preds = %land.rhs
%dec.i = add nsw i32 %52, -1
store i32 %dec.i, ptr %size, align 4, !tbaa !5
%idxprom.i243 = zext i32 %52 to i64
%arrayidx4.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom.i243
%56 = load i64, ptr %arrayidx4.i, align 4
store i64 %56, ptr %arrayidx89, align 4
%cmp.not65.i = icmp ult i32 %52, 3
br i1 %cmp.not65.i, label %pop.exit, label %while.body.i244
while.body.i244: ; preds = %while.body101, %if.then26.i
%57 = phi i32 [ %64, %if.then26.i ], [ %dec.i, %while.body101 ]
%j.067.i = phi i32 [ %shl.i, %if.then26.i ], [ 2, %while.body101 ]
%i.066.i = phi i32 [ %j.1.i, %if.then26.i ], [ 1, %while.body101 ]
%cmp7.i245 = icmp slt i32 %j.067.i, %57
br i1 %cmp7.i245, label %land.lhs.true.i, label %if.end.i
land.lhs.true.i: ; preds = %while.body.i244
%xor64.i = or i32 %j.067.i, 1
%idxprom9.i = sext i32 %xor64.i to i64
%arrayidx10.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom9.i
%58 = load i32, ptr %arrayidx10.i, align 4, !tbaa !12
%idxprom12.i = sext i32 %j.067.i to i64
%arrayidx13.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom12.i
%59 = load i32, ptr %arrayidx13.i, align 4, !tbaa !12
%cmp15.i = icmp slt i32 %58, %59
%spec.select.i = select i1 %cmp15.i, i32 %xor64.i, i32 %j.067.i
br label %if.end.i
if.end.i: ; preds = %land.lhs.true.i, %while.body.i244
%j.1.i = phi i32 [ %j.067.i, %while.body.i244 ], [ %spec.select.i, %land.lhs.true.i ]
%idxprom18.i = sext i32 %j.1.i to i64
%arrayidx19.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom18.i
%60 = load i32, ptr %arrayidx19.i, align 4, !tbaa !12
%idxprom22.i = sext i32 %i.066.i to i64
%arrayidx23.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom22.i
%61 = load i32, ptr %arrayidx23.i, align 4, !tbaa !12
%cmp25.i = icmp slt i32 %60, %61
br i1 %cmp25.i, label %if.then26.i, label %pop.exit
if.then26.i: ; preds = %if.end.i
%62 = load i64, ptr %arrayidx19.i, align 4
%63 = load i64, ptr %arrayidx23.i, align 4
store i64 %63, ptr %arrayidx19.i, align 4
store i64 %62, ptr %arrayidx23.i, align 4
%shl.i = shl i32 %j.1.i, 1
%64 = load i32, ptr %size, align 4, !tbaa !5
%cmp.not.i246 = icmp sgt i32 %shl.i, %64
br i1 %cmp.not.i246, label %pop.exit, label %while.body.i244, !llvm.loop !16
pop.exit: ; preds = %if.end.i, %if.then26.i, %while.body101
%65 = phi i32 [ %dec.i, %while.body101 ], [ %57, %if.end.i ], [ %64, %if.then26.i ]
%cmp87 = icmp sgt i32 %65, 0
br i1 %cmp87, label %land.rhs, label %for.end116, !llvm.loop !27
for.inc114: ; preds = %land.rhs, %if.then
%.lcssa280.sink = phi i32 [ %32, %if.then ], [ %55, %land.rhs ]
%add110 = add nsw i32 %.lcssa280.sink, %i.2265
%call111 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add110)
%inc115 = add nuw nsw i32 %i.2265, 1
%66 = load i32, ptr %H, align 4, !tbaa !11
%cmp13.not.not = icmp slt i32 %i.2265, %66
br i1 %cmp13.not.not, label %for.body14, label %for.end116, !llvm.loop !28
for.end116: ; preds = %for.inc114, %if.end84, %pop.exit, %for.cond12.preheader
%i.2249 = phi i32 [ 1, %for.cond12.preheader ], [ %i.2265, %pop.exit ], [ %i.2265, %if.end84 ], [ %inc115, %for.inc114 ]
%67 = load i32, ptr %H, align 4, !tbaa !11
%cmp118.not267 = icmp sgt i32 %i.2249, %67
br i1 %cmp118.not267, label %for.end123, label %for.body119
for.body119: ; preds = %for.end116, %for.body119
%i.3268 = phi i32 [ %inc122, %for.body119 ], [ %i.2249, %for.end116 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%inc122 = add nuw nsw i32 %i.3268, 1
%68 = load i32, ptr %H, align 4, !tbaa !11
%cmp118.not.not = icmp slt i32 %i.3268, %68
br i1 %cmp118.not.not, label %for.body119, label %for.end123, !llvm.loop !29
for.end123: ; preds = %for.body119, %for.end116
%69 = load ptr, ptr @stdout, align 8, !tbaa !30
%call124 = call i32 @fflush(ptr noundef %69)
call void @llvm.lifetime.end.p0(i64 3200012, ptr nonnull %h) #8
call void @llvm.lifetime.end.p0(i64 800004, ptr nonnull %BIT) #8
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %right) #8
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %left) #8
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %s) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #8
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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #7
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 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 #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 = { nofree nounwind }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !9, i64 3200008}
!6 = !{!"", !7, i64 0, !9, i64 3200008}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{i64 0, i64 4, !11, i64 4, i64 4, !11}
!11 = !{!9, !9, i64 0}
!12 = !{!13, !9, i64 0}
!13 = !{!"", !9, i64 0, !9, i64 4}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}
!19 = distinct !{!19, !15, !20, !21}
!20 = !{!"llvm.loop.isvectorized", i32 1}
!21 = !{!"llvm.loop.unroll.runtime.disable"}
!22 = distinct !{!22, !15, !21, !20}
!23 = distinct !{!23, !15}
!24 = distinct !{!24, !15}
!25 = distinct !{!25, !15}
!26 = !{!13, !9, i64 4}
!27 = distinct !{!27, !15}
!28 = distinct !{!28, !15}
!29 = distinct !{!29, !15}
!30 = !{!31, !31, i64 0}
!31 = !{!"any pointer", !7, i64 0}
|
#include <stdio.h>
int ceiling(int a, int b) {
return (a % b > 0) ? a / b + 1 : a / b;
}
int main() {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
int x = c / (7 * a + b) * 7,
y = c % (7 * a + b);
printf("%d\n", x + ((y > 7 * a) ? 7 : ceiling(y, a)));
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276721/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276721/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ceiling(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%rem = srem i32 %a, %b
%cmp = icmp sgt i32 %rem, 0
%div = sdiv i32 %a, %b
%add = zext i1 %cmp to i32
%cond = add nsw i32 %div, %add
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %c, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %1, 7
%2 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %mul, %2
%rem = srem i32 %0, %add
%div = sdiv i32 %0, %add
%cmp = icmp sgt i32 %rem, %mul
br i1 %cmp, label %cond.end, label %cond.false
cond.false: ; preds = %entry
%rem.i = srem i32 %rem, %1
%cmp.i = icmp sgt i32 %rem.i, 0
%div.i = sdiv i32 %rem, %1
%add.i = zext i1 %cmp.i to i32
%cond.i = add nsw i32 %div.i, %add.i
br label %cond.end
cond.end: ; preds = %entry, %cond.false
%cond = phi i32 [ %cond.i, %cond.false ], [ 7, %entry ]
%mul1 = mul nsw i32 %div, 7
%add6 = add nsw i32 %mul1, %cond
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add6)
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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
/* A1562.c
*/
#include <stdio.h>
int ans[]={0,1,2,4,6,16,12,64,24,36,48,1024,60};
int main()
{ int n;
scanf("%d",&n);
printf("%d\n",ans[n]);
return(0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276765/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276765/source.c"
target datalayout = "e-m:e-p270: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 [13 x i32] [i32 0, i32 1, i32 2, i32 4, i32 6, i32 16, i32 12, i32 64, i32 24, i32 36, i32 48, i32 1024, i32 60], align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [13 x i32], ptr @ans, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
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 <string.h>
#include <stdlib.h>
#include <math.h>
int max(int a, int b) { return a > b ? a : b; }
int main(void){
int n,m,i,j,k,ans=0;
int a,b,c[100001],h[100001],flag[100001],group[100001][100001];
scanf("%d %d\n",&n,&m);
for(i=0; i<n; i++){
scanf("%d ",&h[i]);
flag[i]=0;
}for(i=0; i<m; i++){
scanf("%d %d\n",&a,&b);
flag[a-1]=max(flag[a-1],h[b-1]);
flag[b-1]=max(flag[b-1],h[a-1]);
}
for(i=0; i<n; i++){
if(h[i]>flag[i])ans++;
}
printf("%d",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276808/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276808/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%h = alloca [100001 x i32], align 16
%flag = alloca [100001 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 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %flag) #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.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
%cmp556 = icmp sgt i32 %2, 0
br i1 %cmp556, label %for.body6, label %for.cond30.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100001 x i32], ptr %h, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%arrayidx3 = getelementptr inbounds [100001 x i32], ptr %flag, i64 0, i64 %indvars.iv
store i32 0, ptr %arrayidx3, align 4, !tbaa !5
%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.cond30.preheader.loopexit: ; preds = %for.body6
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond30.preheader
for.cond30.preheader: ; preds = %for.cond30.preheader.loopexit, %for.cond4.preheader
%5 = phi i32 [ %.pre, %for.cond30.preheader.loopexit ], [ %1, %for.cond4.preheader ]
%cmp3158 = icmp sgt i32 %5, 0
br i1 %cmp3158, label %for.body32.preheader, label %for.end41
for.body32.preheader: ; preds = %for.cond30.preheader
%wide.trip.count = zext i32 %5 to i64
%min.iters.check = icmp ult i32 %5, 8
br i1 %min.iters.check, label %for.body32.preheader69, label %vector.ph
vector.ph: ; preds = %for.body32.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%vec.phi65 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %15, %vector.body ]
%6 = getelementptr inbounds [100001 x i32], ptr %h, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
%wide.load66 = load <4 x i32>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds [100001 x i32], ptr %flag, i64 0, i64 %index
%wide.load67 = load <4 x i32>, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load68 = load <4 x i32>, ptr %9, align 16, !tbaa !5
%10 = icmp sgt <4 x i32> %wide.load, %wide.load67
%11 = icmp sgt <4 x i32> %wide.load66, %wide.load68
%12 = zext <4 x i1> %10 to <4 x i32>
%13 = zext <4 x i1> %11 to <4 x i32>
%14 = add <4 x i32> %vec.phi, %12
%15 = add <4 x i32> %vec.phi65, %13
%index.next = add nuw i64 %index, 8
%16 = icmp eq i64 %index.next, %n.vec
br i1 %16, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %15, %14
%17 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end41, label %for.body32.preheader69
for.body32.preheader69: ; preds = %for.body32.preheader, %middle.block
%indvars.iv62.ph = phi i64 [ 0, %for.body32.preheader ], [ %n.vec, %middle.block ]
%ans.059.ph = phi i32 [ 0, %for.body32.preheader ], [ %17, %middle.block ]
br label %for.body32
for.body6: ; preds = %for.cond4.preheader, %for.body6
%i.157 = phi i32 [ %inc28, %for.body6 ], [ 0, %for.cond4.preheader ]
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%18 = load i32, ptr %a, align 4, !tbaa !5
%sub = add nsw i32 %18, -1
%idxprom8 = sext i32 %sub to i64
%arrayidx9 = getelementptr inbounds [100001 x i32], ptr %flag, i64 0, i64 %idxprom8
%19 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%20 = load i32, ptr %b, align 4, !tbaa !5
%sub10 = add nsw i32 %20, -1
%idxprom11 = sext i32 %sub10 to i64
%arrayidx12 = getelementptr inbounds [100001 x i32], ptr %h, i64 0, i64 %idxprom11
%21 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cond.i = call i32 @llvm.smax.i32(i32 %19, i32 %21)
store i32 %cond.i, ptr %arrayidx9, align 4, !tbaa !5
%arrayidx19 = getelementptr inbounds [100001 x i32], ptr %flag, i64 0, i64 %idxprom11
%22 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%arrayidx22 = getelementptr inbounds [100001 x i32], ptr %h, i64 0, i64 %idxprom8
%23 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cond.i53 = call i32 @llvm.smax.i32(i32 %22, i32 %23)
store i32 %cond.i53, ptr %arrayidx19, align 4, !tbaa !5
%inc28 = add nuw nsw i32 %i.157, 1
%24 = load i32, ptr %m, align 4, !tbaa !5
%cmp5 = icmp slt i32 %inc28, %24
br i1 %cmp5, label %for.body6, label %for.cond30.preheader.loopexit, !llvm.loop !14
for.body32: ; preds = %for.body32.preheader69, %for.body32
%indvars.iv62 = phi i64 [ %indvars.iv.next63, %for.body32 ], [ %indvars.iv62.ph, %for.body32.preheader69 ]
%ans.059 = phi i32 [ %spec.select, %for.body32 ], [ %ans.059.ph, %for.body32.preheader69 ]
%arrayidx34 = getelementptr inbounds [100001 x i32], ptr %h, i64 0, i64 %indvars.iv62
%25 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%arrayidx36 = getelementptr inbounds [100001 x i32], ptr %flag, i64 0, i64 %indvars.iv62
%26 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%cmp37 = icmp sgt i32 %25, %26
%inc38 = zext i1 %cmp37 to i32
%spec.select = add nuw nsw i32 %ans.059, %inc38
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%exitcond.not = icmp eq i64 %indvars.iv.next63, %wide.trip.count
br i1 %exitcond.not, label %for.end41, label %for.body32, !llvm.loop !15
for.end41: ; preds = %for.body32, %middle.block, %for.cond30.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond30.preheader ], [ %17, %middle.block ], [ %spec.select, %for.body32 ]
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %flag) #5
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %h) #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
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x 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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !13, !12}
|
#include <stdio.h>
int max(int x,int y)
{
return x>y?x:y;
}
int main()
{
int n,m;
scanf("%d%d",&n,&m);
int i;
int h[n];
int count_zero[100001]={};
for(i=0;i<n;i++)
{
scanf("%d",&h[i]);
}
int a[m],b[m];
int l[n];
for(i=0;i<n;i++)
{
l[i]=0;
}
for(i=0;i<m;i++)
{
scanf("%d%d",&a[i],&b[i]);
l[a[i]-1]=max(l[a[i]-1],h[b[i]-1]);
l[b[i]-1]=max(l[b[i]-1],h[a[i]-1]);
}
int ans=0;
for(i=0;i<n;i++)
{
if(l[i]<h[i])
{
ans++;
}
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276859/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276859/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %x, i32 %y)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %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
%cmp89 = icmp sgt i32 %3, 0
br i1 %cmp89, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
%4 = load i32, ptr %m, align 4, !tbaa !5
%5 = zext i32 %4 to i64
%vla2111 = alloca i32, i64 %5, align 16
%vla3112 = alloca i32, i64 %5, align 16
%6 = zext i32 %3 to i64
%vla4113 = alloca i32, i64 %6, align 16
br label %for.cond13.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.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %n, 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.end, !llvm.loop !9
for.end: ; preds = %for.body
%9 = load i32, ptr %m, align 4, !tbaa !5
%10 = zext i32 %9 to i64
%vla2 = alloca i32, i64 %10, align 16
%vla3 = alloca i32, i64 %10, align 16
%11 = zext i32 %7 to i64
%vla4 = alloca i32, i64 %11, align 16
%cmp691 = icmp sgt i32 %7, 0
br i1 %cmp691, label %for.body7.preheader, label %for.cond13.preheader
for.body7.preheader: ; preds = %for.end
%12 = shl nuw nsw i64 %11, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla4, i8 0, i64 %12, i1 false), !tbaa !5
br label %for.cond13.preheader
for.cond13.preheader: ; preds = %for.end.thread, %for.body7.preheader, %for.end
%vla4118 = phi ptr [ %vla4113, %for.end.thread ], [ %vla4, %for.body7.preheader ], [ %vla4, %for.end ]
%vla3117 = phi ptr [ %vla3112, %for.end.thread ], [ %vla3, %for.body7.preheader ], [ %vla3, %for.end ]
%vla2116 = phi ptr [ %vla2111, %for.end.thread ], [ %vla2, %for.body7.preheader ], [ %vla2, %for.end ]
%13 = phi i32 [ %4, %for.end.thread ], [ %9, %for.body7.preheader ], [ %9, %for.end ]
%.lcssa115 = phi i32 [ %3, %for.end.thread ], [ %7, %for.body7.preheader ], [ %7, %for.end ]
%cmp1493 = icmp sgt i32 %13, 0
br i1 %cmp1493, label %for.body15, label %for.cond55.preheader
for.cond55.preheader.loopexit: ; preds = %for.body15
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond55.preheader
for.cond55.preheader: ; preds = %for.cond55.preheader.loopexit, %for.cond13.preheader
%14 = phi i32 [ %.pre, %for.cond55.preheader.loopexit ], [ %.lcssa115, %for.cond13.preheader ]
%cmp5695 = icmp sgt i32 %14, 0
br i1 %cmp5695, label %for.body57.preheader, label %for.end66
for.body57.preheader: ; preds = %for.cond55.preheader
%wide.trip.count = zext i32 %14 to i64
%min.iters.check = icmp ult i32 %14, 8
br i1 %min.iters.check, label %for.body57.preheader123, label %vector.ph
vector.ph: ; preds = %for.body57.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %23, %vector.body ]
%vec.phi119 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %24, %vector.body ]
%15 = getelementptr inbounds i32, ptr %vla4118, i64 %index
%wide.load = load <4 x i32>, ptr %15, align 16, !tbaa !5
%16 = getelementptr inbounds i32, ptr %15, i64 4
%wide.load120 = load <4 x i32>, ptr %16, align 16, !tbaa !5
%17 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load121 = load <4 x i32>, ptr %17, align 16, !tbaa !5
%18 = getelementptr inbounds i32, ptr %17, i64 4
%wide.load122 = load <4 x i32>, ptr %18, align 16, !tbaa !5
%19 = icmp slt <4 x i32> %wide.load, %wide.load121
%20 = icmp slt <4 x i32> %wide.load120, %wide.load122
%21 = zext <4 x i1> %19 to <4 x i32>
%22 = zext <4 x i1> %20 to <4 x i32>
%23 = add <4 x i32> %vec.phi, %21
%24 = add <4 x i32> %vec.phi119, %22
%index.next = add nuw i64 %index, 8
%25 = icmp eq i64 %index.next, %n.vec
br i1 %25, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %24, %23
%26 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end66, label %for.body57.preheader123
for.body57.preheader123: ; preds = %for.body57.preheader, %middle.block
%indvars.iv107.ph = phi i64 [ 0, %for.body57.preheader ], [ %n.vec, %middle.block ]
%ans.097.ph = phi i32 [ 0, %for.body57.preheader ], [ %26, %middle.block ]
br label %for.body57
for.body15: ; preds = %for.cond13.preheader, %for.body15
%indvars.iv104 = phi i64 [ %indvars.iv.next105, %for.body15 ], [ 0, %for.cond13.preheader ]
%arrayidx17 = getelementptr inbounds i32, ptr %vla2116, i64 %indvars.iv104
%arrayidx19 = getelementptr inbounds i32, ptr %vla3117, i64 %indvars.iv104
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx17, ptr noundef nonnull %arrayidx19)
%27 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%sub = add nsw i32 %27, -1
%idxprom23 = sext i32 %sub to i64
%arrayidx24 = getelementptr inbounds i32, ptr %vla4118, i64 %idxprom23
%28 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%29 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%sub27 = add nsw i32 %29, -1
%idxprom28 = sext i32 %sub27 to i64
%arrayidx29 = getelementptr inbounds i32, ptr %vla, i64 %idxprom28
%30 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cond.i = call i32 @llvm.smax.i32(i32 %28, i32 %30)
store i32 %cond.i, ptr %arrayidx24, align 4, !tbaa !5
%arrayidx40 = getelementptr inbounds i32, ptr %vla4118, i64 %idxprom28
%31 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%arrayidx45 = getelementptr inbounds i32, ptr %vla, i64 %idxprom23
%32 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%cond.i88 = call i32 @llvm.smax.i32(i32 %31, i32 %32)
store i32 %cond.i88, ptr %arrayidx40, align 4, !tbaa !5
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%33 = load i32, ptr %m, align 4, !tbaa !5
%34 = sext i32 %33 to i64
%cmp14 = icmp slt i64 %indvars.iv.next105, %34
br i1 %cmp14, label %for.body15, label %for.cond55.preheader.loopexit, !llvm.loop !14
for.body57: ; preds = %for.body57.preheader123, %for.body57
%indvars.iv107 = phi i64 [ %indvars.iv.next108, %for.body57 ], [ %indvars.iv107.ph, %for.body57.preheader123 ]
%ans.097 = phi i32 [ %spec.select, %for.body57 ], [ %ans.097.ph, %for.body57.preheader123 ]
%arrayidx59 = getelementptr inbounds i32, ptr %vla4118, i64 %indvars.iv107
%35 = load i32, ptr %arrayidx59, align 4, !tbaa !5
%arrayidx61 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv107
%36 = load i32, ptr %arrayidx61, align 4, !tbaa !5
%cmp62 = icmp slt i32 %35, %36
%inc63 = zext i1 %cmp62 to i32
%spec.select = add nuw nsw i32 %ans.097, %inc63
%indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
%exitcond.not = icmp eq i64 %indvars.iv.next108, %wide.trip.count
br i1 %exitcond.not, label %for.end66, label %for.body57, !llvm.loop !15
for.end66: ; preds = %for.body57, %middle.block, %for.cond55.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond55.preheader ], [ %26, %middle.block ], [ %spec.select, %for.body57 ]
%call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: mustprogress nocallback nofree 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 #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: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !13, !12}
|
#include <stdio.h>
#include <string.h>
int main(void) {
int n = 0, m = 0;
int i, j;
int height[100000];
int is_good[100000];
scanf("%d %d", &n, &m);
for(i = 0; i < n; i++) {
is_good[i] = 1;
}
for(i = 0; i < n; i++) {
scanf("%d", &height[i]);
}
for(i = 0; i < m; i++) {
int path_a = 0, path_b = 0;
scanf("%d %d", &path_a, &path_b);
path_a--;
path_b--;
if(height[path_a] <= height[path_b]) {
is_good[path_a] = 0;
}
if(height[path_a] >= height[path_b]) {
is_good[path_b] = 0;
}
/*
for(j = 0; j < n; j++) {
printf("%d ", is_good[j]);
}
printf("\n");
*/
}
int number_of_good = 0;
for(i = 0; i < n; i++) {
// printf("%d ", is_good[i]);
if(is_good[i] == 1) number_of_good++;
}
// printf("\n");
printf("%d\n", number_of_good);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276901/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276901/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%height = alloca [100000 x i32], align 16
%is_good = alloca [100000 x i32], align 16
%path_a = alloca i32, align 4
%path_b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
store i32 0, ptr %n, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
store i32 0, ptr %m, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %height) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %is_good) #4
%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
%cmp58 = icmp sgt i32 %0, 0
br i1 %cmp58, label %for.body.preheader, label %for.cond10.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader92, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%1 = getelementptr inbounds [100000 x i32], ptr %is_good, i64 0, i64 %index
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader92
for.body.preheader92: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond1.preheader: ; preds = %for.body, %middle.block
br i1 %cmp58, label %for.body3, label %for.cond10.preheader
for.body: ; preds = %for.body.preheader92, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader92 ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %is_good, i64 0, i64 %indvars.iv
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !13
for.cond10.preheader: ; preds = %for.body3, %entry, %for.cond1.preheader
%4 = phi i32 [ %0, %for.cond1.preheader ], [ %0, %entry ], [ %6, %for.body3 ]
%5 = load i32, ptr %m, align 4, !tbaa !5
%cmp1162 = icmp sgt i32 %5, 0
br i1 %cmp1162, label %for.body12, label %for.cond34.preheader
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv68 = phi i64 [ %indvars.iv.next69, %for.body3 ], [ 0, %for.cond1.preheader ]
%arrayidx5 = getelementptr inbounds [100000 x i32], ptr %height, i64 0, i64 %indvars.iv68
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5)
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp2 = icmp slt i64 %indvars.iv.next69, %7
br i1 %cmp2, label %for.body3, label %for.cond10.preheader, !llvm.loop !14
for.cond34.preheader.loopexit: ; preds = %if.end30
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond34.preheader
for.cond34.preheader: ; preds = %for.cond34.preheader.loopexit, %for.cond10.preheader
%8 = phi i32 [ %.pre, %for.cond34.preheader.loopexit ], [ %4, %for.cond10.preheader ]
%cmp3564 = icmp sgt i32 %8, 0
br i1 %cmp3564, label %for.body36.preheader, label %for.end45
for.body36.preheader: ; preds = %for.cond34.preheader
%wide.trip.count74 = zext i32 %8 to i64
%min.iters.check78 = icmp ult i32 %8, 8
br i1 %min.iters.check78, label %for.body36.preheader89, label %vector.ph79
vector.ph79: ; preds = %for.body36.preheader
%n.vec81 = and i64 %wide.trip.count74, 4294967288
br label %vector.body84
vector.body84: ; preds = %vector.body84, %vector.ph79
%index85 = phi i64 [ 0, %vector.ph79 ], [ %index.next88, %vector.body84 ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph79 ], [ %15, %vector.body84 ]
%vec.phi86 = phi <4 x i32> [ zeroinitializer, %vector.ph79 ], [ %16, %vector.body84 ]
%9 = getelementptr inbounds [100000 x i32], ptr %is_good, i64 0, i64 %index85
%wide.load = load <4 x i32>, ptr %9, align 16, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
%wide.load87 = load <4 x i32>, ptr %10, align 16, !tbaa !5
%11 = icmp eq <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%12 = icmp eq <4 x i32> %wide.load87, <i32 1, i32 1, i32 1, i32 1>
%13 = zext <4 x i1> %11 to <4 x i32>
%14 = zext <4 x i1> %12 to <4 x i32>
%15 = add <4 x i32> %vec.phi, %13
%16 = add <4 x i32> %vec.phi86, %14
%index.next88 = add nuw i64 %index85, 8
%17 = icmp eq i64 %index.next88, %n.vec81
br i1 %17, label %middle.block76, label %vector.body84, !llvm.loop !15
middle.block76: ; preds = %vector.body84
%bin.rdx = add <4 x i32> %16, %15
%18 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n83 = icmp eq i64 %n.vec81, %wide.trip.count74
br i1 %cmp.n83, label %for.end45, label %for.body36.preheader89
for.body36.preheader89: ; preds = %for.body36.preheader, %middle.block76
%indvars.iv71.ph = phi i64 [ 0, %for.body36.preheader ], [ %n.vec81, %middle.block76 ]
%number_of_good.066.ph = phi i32 [ 0, %for.body36.preheader ], [ %18, %middle.block76 ]
br label %for.body36
for.body12: ; preds = %for.cond10.preheader, %if.end30
%i.263 = phi i32 [ %inc32, %if.end30 ], [ 0, %for.cond10.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %path_a) #4
store i32 0, ptr %path_a, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %path_b) #4
store i32 0, ptr %path_b, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %path_a, ptr noundef nonnull %path_b)
%19 = load i32, ptr %path_a, align 4, !tbaa !5
%dec = add nsw i32 %19, -1
%20 = load i32, ptr %path_b, align 4, !tbaa !5
%dec14 = add nsw i32 %20, -1
%idxprom15 = sext i32 %dec to i64
%arrayidx16 = getelementptr inbounds [100000 x i32], ptr %height, i64 0, i64 %idxprom15
%21 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %dec14 to i64
%arrayidx18 = getelementptr inbounds [100000 x i32], ptr %height, i64 0, i64 %idxprom17
%22 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%cmp19.not = icmp sgt i32 %21, %22
br i1 %cmp19.not, label %if.end, label %if.then
if.then: ; preds = %for.body12
%arrayidx21 = getelementptr inbounds [100000 x i32], ptr %is_good, i64 0, i64 %idxprom15
store i32 0, ptr %arrayidx21, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %for.body12
%cmp26.not = icmp slt i32 %21, %22
br i1 %cmp26.not, label %if.end30, label %if.then27
if.then27: ; preds = %if.end
%arrayidx29 = getelementptr inbounds [100000 x i32], ptr %is_good, i64 0, i64 %idxprom17
store i32 0, ptr %arrayidx29, align 4, !tbaa !5
br label %if.end30
if.end30: ; preds = %if.then27, %if.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %path_b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %path_a) #4
%inc32 = add nuw nsw i32 %i.263, 1
%23 = load i32, ptr %m, align 4, !tbaa !5
%cmp11 = icmp slt i32 %inc32, %23
br i1 %cmp11, label %for.body12, label %for.cond34.preheader.loopexit, !llvm.loop !16
for.body36: ; preds = %for.body36.preheader89, %for.body36
%indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.body36 ], [ %indvars.iv71.ph, %for.body36.preheader89 ]
%number_of_good.066 = phi i32 [ %spec.select, %for.body36 ], [ %number_of_good.066.ph, %for.body36.preheader89 ]
%arrayidx38 = getelementptr inbounds [100000 x i32], ptr %is_good, i64 0, i64 %indvars.iv71
%24 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%cmp39 = icmp eq i32 %24, 1
%inc41 = zext i1 %cmp39 to i32
%spec.select = add nuw nsw i32 %number_of_good.066, %inc41
%indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
%exitcond75.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count74
br i1 %exitcond75.not, label %for.end45, label %for.body36, !llvm.loop !17
for.end45: ; preds = %for.body36, %middle.block76, %for.cond34.preheader
%number_of_good.0.lcssa = phi i32 [ 0, %for.cond34.preheader ], [ %18, %middle.block76 ], [ %spec.select, %for.body36 ]
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %number_of_good.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %is_good) #4
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %height) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !12, !11}
|
#include<stdio.h>
int h[100001],ans[100001];
//int ab[100001][100001];
int main(void){
int n,m,i,a,b,j,saf,sum=0;
for(i=0;i<100001;i++){
/*for(j=0;j<100001;j++){
ab[i][j]=0;
}*/
ans[i]=1;
}
scanf("%d%d",&n,&m);
for(i=0;i<n;i++){
scanf("%d",&h[i]);
}
for(i=0;i<m;i++){
scanf("%d%d",&a,&b);
a--;
b--;
if(h[a]<h[b]){
ans[a]=0;
}else if(h[a]>h[b]){
ans[b]=0;
}else{
ans[a]=0;
ans[b]=0;
}
//ab[a][b]=1;
//ab[b][a]=1;
}
/* for(i=0;i<n;i++){
saf=0;
for(j=0;j<n;j++){
if(ab[i][j]==1&&h[i]<=h[j]){
saf=1;
break;
}
}
if(saf==0){
sum++;
}
}*/
for(i=0;i<n;i++){
if(ans[i]==1){
sum++;
}
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276945/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276945/source.c"
target datalayout = "e-m:e-p270: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 [100001 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@h = dso_local global [100001 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #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
br label %vector.body
vector.body: ; preds = %vector.body, %entry
%index = phi i64 [ 0, %entry ], [ %index.next.4, %vector.body ]
%0 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %index
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 16, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 16, !tbaa !5
%index.next = add nuw nsw i64 %index, 8
%2 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %index.next
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 16, !tbaa !5
%index.next.1 = add nuw nsw i64 %index, 16
%4 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %index.next.1
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 16, !tbaa !5
%index.next.2 = add nuw nsw i64 %index, 24
%6 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %index.next.2
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 16, !tbaa !5
%index.next.3 = add nuw nsw i64 %index, 32
%8 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %index.next.3
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 16, !tbaa !5
%index.next.4 = add nuw nsw i64 %index, 40
%10 = icmp eq i64 %index.next.4, 100000
br i1 %10, label %for.body, label %vector.body, !llvm.loop !9
for.body: ; preds = %vector.body
store i32 1, ptr getelementptr inbounds ([100001 x i32], ptr @ans, i64 0, i64 100000), align 16, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%11 = load i32, ptr %n, align 4, !tbaa !5
%cmp265 = icmp sgt i32 %11, 0
br i1 %cmp265, label %for.body3, label %for.cond10.preheader
for.cond10.preheader: ; preds = %for.body3, %for.body
%12 = phi i32 [ %11, %for.body ], [ %14, %for.body3 ]
%13 = load i32, ptr %m, align 4, !tbaa !5
%cmp1167 = icmp sgt i32 %13, 0
br i1 %cmp1167, label %for.body12, label %for.cond39.preheader
for.body3: ; preds = %for.body, %for.body3
%indvars.iv73 = phi i64 [ %indvars.iv.next74, %for.body3 ], [ 0, %for.body ]
%arrayidx5 = getelementptr inbounds [100001 x i32], ptr @h, i64 0, i64 %indvars.iv73
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5)
%indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
%14 = load i32, ptr %n, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp2 = icmp slt i64 %indvars.iv.next74, %15
br i1 %cmp2, label %for.body3, label %for.cond10.preheader, !llvm.loop !13
for.cond39.preheader.loopexit: ; preds = %for.inc36
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond39.preheader
for.cond39.preheader: ; preds = %for.cond39.preheader.loopexit, %for.cond10.preheader
%16 = phi i32 [ %.pre, %for.cond39.preheader.loopexit ], [ %12, %for.cond10.preheader ]
%cmp4069 = icmp sgt i32 %16, 0
br i1 %cmp4069, label %for.body41.preheader, label %for.end50
for.body41.preheader: ; preds = %for.cond39.preheader
%wide.trip.count = zext i32 %16 to i64
%min.iters.check = icmp ult i32 %16, 8
br i1 %min.iters.check, label %for.body41.preheader89, label %vector.ph82
vector.ph82: ; preds = %for.body41.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body84
vector.body84: ; preds = %vector.body84, %vector.ph82
%index85 = phi i64 [ 0, %vector.ph82 ], [ %index.next88, %vector.body84 ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph82 ], [ %23, %vector.body84 ]
%vec.phi86 = phi <4 x i32> [ zeroinitializer, %vector.ph82 ], [ %24, %vector.body84 ]
%17 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %index85
%wide.load = load <4 x i32>, ptr %17, align 16, !tbaa !5
%18 = getelementptr inbounds i32, ptr %17, i64 4
%wide.load87 = load <4 x i32>, ptr %18, align 16, !tbaa !5
%19 = icmp eq <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%20 = icmp eq <4 x i32> %wide.load87, <i32 1, i32 1, i32 1, i32 1>
%21 = zext <4 x i1> %19 to <4 x i32>
%22 = zext <4 x i1> %20 to <4 x i32>
%23 = add <4 x i32> %vec.phi, %21
%24 = add <4 x i32> %vec.phi86, %22
%index.next88 = add nuw i64 %index85, 8
%25 = icmp eq i64 %index.next88, %n.vec
br i1 %25, label %middle.block80, label %vector.body84, !llvm.loop !14
middle.block80: ; preds = %vector.body84
%bin.rdx = add <4 x i32> %24, %23
%26 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end50, label %for.body41.preheader89
for.body41.preheader89: ; preds = %for.body41.preheader, %middle.block80
%indvars.iv76.ph = phi i64 [ 0, %for.body41.preheader ], [ %n.vec, %middle.block80 ]
%sum.071.ph = phi i32 [ 0, %for.body41.preheader ], [ %26, %middle.block80 ]
br label %for.body41
for.body12: ; preds = %for.cond10.preheader, %for.inc36
%i.268 = phi i32 [ %inc37, %for.inc36 ], [ 0, %for.cond10.preheader ]
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%27 = load i32, ptr %a, align 4, !tbaa !5
%dec = add nsw i32 %27, -1
store i32 %dec, ptr %a, align 4, !tbaa !5
%28 = load i32, ptr %b, align 4, !tbaa !5
%dec14 = add nsw i32 %28, -1
store i32 %dec14, ptr %b, align 4, !tbaa !5
%idxprom15 = sext i32 %dec to i64
%arrayidx16 = getelementptr inbounds [100001 x i32], ptr @h, i64 0, i64 %idxprom15
%29 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %dec14 to i64
%arrayidx18 = getelementptr inbounds [100001 x i32], ptr @h, i64 0, i64 %idxprom17
%30 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%cmp19 = icmp slt i32 %29, %30
br i1 %cmp19, label %for.inc36, label %if.else
if.else: ; preds = %for.body12
%cmp26 = icmp sgt i32 %29, %30
br i1 %cmp26, label %for.inc36, label %if.else30
if.else30: ; preds = %if.else
%arrayidx32 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %idxprom15
store i32 0, ptr %arrayidx32, align 4, !tbaa !5
br label %for.inc36
for.inc36: ; preds = %if.else, %for.body12, %if.else30
%idxprom15.sink = phi i64 [ %idxprom17, %if.else30 ], [ %idxprom15, %for.body12 ], [ %idxprom17, %if.else ]
%arrayidx21 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %idxprom15.sink
store i32 0, ptr %arrayidx21, align 4, !tbaa !5
%inc37 = add nuw nsw i32 %i.268, 1
%31 = load i32, ptr %m, align 4, !tbaa !5
%cmp11 = icmp slt i32 %inc37, %31
br i1 %cmp11, label %for.body12, label %for.cond39.preheader.loopexit, !llvm.loop !15
for.body41: ; preds = %for.body41.preheader89, %for.body41
%indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.body41 ], [ %indvars.iv76.ph, %for.body41.preheader89 ]
%sum.071 = phi i32 [ %spec.select, %for.body41 ], [ %sum.071.ph, %for.body41.preheader89 ]
%arrayidx43 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %indvars.iv76
%32 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%cmp44 = icmp eq i32 %32, 1
%inc46 = zext i1 %cmp44 to i32
%spec.select = add nuw nsw i32 %sum.071, %inc46
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%exitcond79.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count
br i1 %exitcond79.not, label %for.end50, label %for.body41, !llvm.loop !16
for.end50: ; preds = %for.body41, %middle.block80, %for.cond39.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond39.preheader ], [ %26, %middle.block80 ], [ %spec.select, %for.body41 ]
%call51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !12, !11}
|
#include<stdio.h>
int next[300000];
int first[300000];
int go[300000];
int h[300000];
int n,m,i,ans=0,x,y;
int check(int k){
int t=first[k];
int flag=1;
while (t!=0){
if (h[go[t]]>=h[k])
flag=0;
t=next[t];
}
if (flag==1) return 1;else return 0;
}
int main(){
scanf("%d %d",&n,&m);
for (i=1;i<=n;i++)
scanf("%d",&h[i]);
for (i=1;i<=m;i++)
{scanf("%d %d",&x,&y);
next[i]=first[x];
first[x]=i;
go[i]=y;
next[i+m]=first[y];
first[y]=i+m;
go[i+m]=x;
}
for (i=1;i<=n;i++)
if (check(i)==1)
ans++;
printf("%d",ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276989/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276989/source.c"
target datalayout = "e-m:e-p270: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 0, align 4
@first = dso_local local_unnamed_addr global [300000 x i32] zeroinitializer, align 16
@h = dso_local global [300000 x i32] zeroinitializer, align 16
@go = dso_local local_unnamed_addr global [300000 x i32] zeroinitializer, align 16
@next = dso_local local_unnamed_addr global [300000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@n = dso_local global i32 0, align 4
@m = dso_local global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@x = dso_local global i32 0, align 4
@y = dso_local global i32 0, align 4
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @check(i32 noundef %k) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %k to i64
%arrayidx = getelementptr inbounds [300000 x i32], ptr @first, i64 0, i64 %idxprom
%t.016 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp.not17 = icmp eq i32 %t.016, 0
br i1 %cmp.not17, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%arrayidx6 = getelementptr inbounds [300000 x i32], ptr @h, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx6, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%t.019 = phi i32 [ %t.016, %while.body.lr.ph ], [ %t.0, %while.body ]
%flag.018 = phi i32 [ 1, %while.body.lr.ph ], [ %spec.select, %while.body ]
%idxprom1 = sext i32 %t.019 to i64
%arrayidx2 = getelementptr inbounds [300000 x i32], ptr @go, i64 0, i64 %idxprom1
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%idxprom3 = sext i32 %1 to i64
%arrayidx4 = getelementptr inbounds [300000 x i32], ptr @h, i64 0, i64 %idxprom3
%2 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp7.not = icmp slt i32 %2, %0
%spec.select = select i1 %cmp7.not, i32 %flag.018, i32 0
%arrayidx9 = getelementptr inbounds [300000 x i32], ptr @next, i64 0, i64 %idxprom1
%t.0 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp.not = icmp eq i32 %t.0, 0
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !9
while.end.loopexit: ; preds = %while.body
%3 = icmp eq i32 %spec.select, 1
%4 = zext i1 %3 to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%flag.0.lcssa = phi i32 [ 1, %entry ], [ %4, %while.end.loopexit ]
ret i32 %flag.0.lcssa
}
; 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, ptr noundef nonnull @m)
store i32 1, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not42 = icmp slt i32 %0, 1
br i1 %cmp.not42, label %for.cond2.preheader, label %for.body
for.cond2.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %4, %for.body ]
store i32 1, ptr @i, align 4, !tbaa !5
%2 = load i32, ptr @m, align 4, !tbaa !5
%cmp3.not44 = icmp slt i32 %2, 1
br i1 %cmp3.not44, label %for.cond27.preheader, label %for.body4
for.body: ; preds = %entry, %for.body
%storemerge43 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%idxprom = sext i32 %storemerge43 to i64
%arrayidx = getelementptr inbounds [300000 x i32], ptr @h, i64 0, i64 %idxprom
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%3 = load i32, ptr @i, align 4, !tbaa !5
%inc = add nsw i32 %3, 1
store i32 %inc, ptr @i, align 4, !tbaa !5
%4 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %3, %4
br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !11
for.cond27.preheader.loopexit: ; preds = %for.body4
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.cond27.preheader
for.cond27.preheader: ; preds = %for.cond27.preheader.loopexit, %for.cond2.preheader
%5 = phi i32 [ %.pre, %for.cond27.preheader.loopexit ], [ %1, %for.cond2.preheader ]
%ans.promoted = load i32, ptr @ans, align 4, !tbaa !5
%cmp28.not47 = icmp slt i32 %5, 1
br i1 %cmp28.not47, label %for.end35, label %for.body29.preheader
for.body29.preheader: ; preds = %for.cond27.preheader
%6 = add nuw i32 %5, 1
%wide.trip.count = zext i32 %6 to i64
br label %for.body29
for.body4: ; preds = %for.cond2.preheader, %for.body4
%call5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x, ptr noundef nonnull @y)
%7 = load i32, ptr @x, align 4, !tbaa !5
%idxprom6 = sext i32 %7 to i64
%arrayidx7 = getelementptr inbounds [300000 x i32], ptr @first, i64 0, i64 %idxprom6
%8 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%9 = load i32, ptr @i, align 4, !tbaa !5
%idxprom8 = sext i32 %9 to i64
%arrayidx9 = getelementptr inbounds [300000 x i32], ptr @next, i64 0, i64 %idxprom8
store i32 %8, ptr %arrayidx9, align 4, !tbaa !5
store i32 %9, ptr %arrayidx7, align 4, !tbaa !5
%10 = load i32, ptr @y, align 4, !tbaa !5
%arrayidx13 = getelementptr inbounds [300000 x i32], ptr @go, i64 0, i64 %idxprom8
store i32 %10, ptr %arrayidx13, align 4, !tbaa !5
%idxprom14 = sext i32 %10 to i64
%arrayidx15 = getelementptr inbounds [300000 x i32], ptr @first, i64 0, i64 %idxprom14
%11 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%12 = load i32, ptr @m, align 4, !tbaa !5
%add = add nsw i32 %12, %9
%idxprom16 = sext i32 %add to i64
%arrayidx17 = getelementptr inbounds [300000 x i32], ptr @next, i64 0, i64 %idxprom16
store i32 %11, ptr %arrayidx17, align 4, !tbaa !5
store i32 %add, ptr %arrayidx15, align 4, !tbaa !5
%arrayidx23 = getelementptr inbounds [300000 x i32], ptr @go, i64 0, i64 %idxprom16
store i32 %7, ptr %arrayidx23, align 4, !tbaa !5
%inc25 = add nsw i32 %9, 1
store i32 %inc25, ptr @i, align 4, !tbaa !5
%cmp3.not.not = icmp slt i32 %9, %12
br i1 %cmp3.not.not, label %for.body4, label %for.cond27.preheader.loopexit, !llvm.loop !12
for.body29: ; preds = %for.body29.preheader, %for.inc33
%indvars.iv = phi i64 [ 1, %for.body29.preheader ], [ %indvars.iv.next, %for.inc33 ]
%inc324648 = phi i32 [ %ans.promoted, %for.body29.preheader ], [ %inc3245, %for.inc33 ]
%arrayidx.i = getelementptr inbounds [300000 x i32], ptr @first, i64 0, i64 %indvars.iv
%t.016.i = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp.not17.i = icmp eq i32 %t.016.i, 0
br i1 %cmp.not17.i, label %if.then, label %while.body.lr.ph.i
while.body.lr.ph.i: ; preds = %for.body29
%arrayidx6.i = getelementptr inbounds [300000 x i32], ptr @h, i64 0, i64 %indvars.iv
%13 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5
br label %while.body.i
while.body.i: ; preds = %while.body.i, %while.body.lr.ph.i
%t.019.i = phi i32 [ %t.016.i, %while.body.lr.ph.i ], [ %t.0.i, %while.body.i ]
%flag.018.i = phi i32 [ 1, %while.body.lr.ph.i ], [ %spec.select.i, %while.body.i ]
%idxprom1.i = sext i32 %t.019.i to i64
%arrayidx2.i = getelementptr inbounds [300000 x i32], ptr @go, i64 0, i64 %idxprom1.i
%14 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%idxprom3.i = sext i32 %14 to i64
%arrayidx4.i = getelementptr inbounds [300000 x i32], ptr @h, i64 0, i64 %idxprom3.i
%15 = load i32, ptr %arrayidx4.i, align 4, !tbaa !5
%cmp7.not.i = icmp slt i32 %15, %13
%spec.select.i = select i1 %cmp7.not.i, i32 %flag.018.i, i32 0
%arrayidx9.i = getelementptr inbounds [300000 x i32], ptr @next, i64 0, i64 %idxprom1.i
%t.0.i = load i32, ptr %arrayidx9.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %t.0.i, 0
br i1 %cmp.not.i, label %check.exit, label %while.body.i, !llvm.loop !9
check.exit: ; preds = %while.body.i
%.not = icmp eq i32 %spec.select.i, 1
br i1 %.not, label %if.then, label %for.inc33
if.then: ; preds = %for.body29, %check.exit
%inc32 = add nsw i32 %inc324648, 1
store i32 %inc32, ptr @ans, align 4, !tbaa !5
br label %for.inc33
for.inc33: ; preds = %check.exit, %if.then
%inc3245 = phi i32 [ %inc324648, %check.exit ], [ %inc32, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end35.loopexit, label %for.body29, !llvm.loop !13
for.end35.loopexit: ; preds = %for.inc33
%16 = add i32 %5, 1
br label %for.end35
for.end35: ; preds = %for.end35.loopexit, %for.cond27.preheader
%17 = phi i32 [ %ans.promoted, %for.cond27.preheader ], [ %inc3245, %for.end35.loopexit ]
%storemerge39.lcssa = phi i32 [ 1, %for.cond27.preheader ], [ %16, %for.end35.loopexit ]
store i32 %storemerge39.lcssa, ptr @i, align 4, !tbaa !5
%call36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %17)
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 norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(void)
{
int N;
scanf("%d",&N);
if(N <= 999 && N >= 100){
printf("ABC%d\n",N);
}
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277182/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277182/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"ABC%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4
%1 = add i32 %0, -100
%or.cond = icmp ult i32 %1, 900
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
br label %if.end
if.end: ; preds = %if.then, %entry
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)"}
|
#include<stdio.h>
int main()
{
int i,j,c=0;
char s[101];
scanf("%s",s);
for(i=0;s[i]!='\0';i++)
{
for(j=0;j<i && s[j]!=s[i];j++);
if(j==i)c++;
}
if(c&1)
printf("IGNORE HIM!");
else
printf("CHAT WITH HER!");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27724/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27724/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [12 x i8] c"IGNORE HIM!\00", align 1
@.str.2 = private unnamed_addr constant [15 x i8] c"CHAT WITH HER!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 16, !tbaa !5
%cmp.not35 = icmp eq i8 %0, 0
br i1 %cmp.not35, label %if.else, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %for.end
%indvars.iv40 = phi i64 [ %indvars.iv.next41, %for.end ], [ 0, %entry ]
%1 = phi i8 [ %4, %for.end ], [ %0, %entry ]
%c.037 = phi i32 [ %spec.select, %for.end ], [ 0, %entry ]
%cmp332.not = icmp eq i64 %indvars.iv40, 0
br i1 %cmp332.not, label %for.end, label %land.rhs
land.rhs: ; preds = %for.cond2.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx6, align 1, !tbaa !5
%cmp11.not = icmp eq i8 %2, %1
br i1 %cmp11.not, label %for.end, label %for.inc
for.inc: ; preds = %land.rhs
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv40
br i1 %exitcond.not, label %for.end, label %land.rhs, !llvm.loop !8
for.end: ; preds = %land.rhs, %for.inc, %for.cond2.preheader
%j.0.lcssa = phi i64 [ 0, %for.cond2.preheader ], [ %indvars.iv40, %for.inc ], [ %indvars.iv, %land.rhs ]
%3 = and i64 %j.0.lcssa, 4294967295
%cmp14 = icmp eq i64 %3, %indvars.iv40
%inc16 = zext i1 %cmp14 to i32
%spec.select = add nuw nsw i32 %c.037, %inc16
%indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
%arrayidx = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %indvars.iv.next41
%4 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %4, 0
br i1 %cmp.not, label %for.end19, label %for.cond2.preheader, !llvm.loop !10
for.end19: ; preds = %for.end
%5 = and i32 %spec.select, 1
%6 = icmp eq i32 %5, 0
br i1 %6, label %if.else, label %if.end23
if.else: ; preds = %entry, %for.end19
br label %if.end23
if.end23: ; preds = %for.end19, %if.else
%.str.2.sink = phi ptr [ @.str.2, %if.else ], [ @.str.1, %for.end19 ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
/*Bismillahir Rahmanir Rahim*/
#include <stdio.h>
int main ()
{
int n;
while (scanf("%d",&n) !=EOF)
{
printf("ABC%d\n",n);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277283/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277283/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"ABC%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not3 = icmp eq i32 %call2, -1
br i1 %cmp.not3, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %n, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
long long min(long long x,long long y,long long z){
if(x<=y && x<=z)
return x;
else if(y<=x && y<=z)
return y;
else
return z;
}
int main(){
long long a,b,c,d,e,f,t1,t2;
scanf("%lld %lld %lld %lld %lld %lld",&a,&b,&c,&d,&e,&f);
if(f>e){
t2=min(b,c,d);
t1=min((d-t2),a,100005);
}
else{
t1=min(a,d,100005);
t2=min((d-t1),b,c);
}
printf("%lld\n",((t1*e)+t2*f));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27737/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27737/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [30 x i8] c"%lld %lld %lld %lld %lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min(i64 noundef %x, i64 noundef %y, i64 noundef %z) local_unnamed_addr #0 {
entry:
%cmp.not = icmp sgt i64 %x, %y
%cmp1.not = icmp sgt i64 %x, %z
%or.cond = or i1 %cmp.not, %cmp1.not
%cmp2.not = icmp sgt i64 %y, %x
%cmp4.not = icmp sgt i64 %y, %z
%or.cond15 = or i1 %cmp2.not, %cmp4.not
%spec.select = select i1 %or.cond15, i64 %z, i64 %y
%retval.0 = select i1 %or.cond, i64 %spec.select, i64 %x
ret i64 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
%d = alloca i64, align 8
%e = alloca i64, align 8
%f = 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 void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%0 = load i64, ptr %f, align 8, !tbaa !5
%1 = load i64, ptr %e, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, %1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%2 = load i64, ptr %b, align 8, !tbaa !5
%3 = load i64, ptr %c, align 8, !tbaa !5
%4 = load i64, ptr %d, align 8, !tbaa !5
%cmp.not.i = icmp sgt i64 %2, %3
%cmp1.not.i = icmp sgt i64 %2, %4
%or.cond.i = or i1 %cmp.not.i, %cmp1.not.i
%cmp2.not.i = icmp sgt i64 %3, %2
%cmp4.not.i = icmp sgt i64 %3, %4
%or.cond15.i = or i1 %cmp2.not.i, %cmp4.not.i
%spec.select.i = select i1 %or.cond15.i, i64 %4, i64 %3
%retval.0.i = select i1 %or.cond.i, i64 %spec.select.i, i64 %2
%sub = sub nsw i64 %4, %retval.0.i
%5 = load i64, ptr %a, align 8, !tbaa !5
%cmp.not.i10 = icmp sgt i64 %sub, %5
%cmp1.not.i11 = icmp sgt i64 %sub, 100005
%or.cond.i12 = or i1 %cmp.not.i10, %cmp1.not.i11
%cmp2.not.i13 = icmp sgt i64 %5, %sub
%cmp4.not.i14 = icmp sgt i64 %5, 100005
%or.cond15.i15 = or i1 %cmp4.not.i14, %cmp2.not.i13
%spec.select.i16 = select i1 %or.cond15.i15, i64 100005, i64 %5
%retval.0.i17 = select i1 %or.cond.i12, i64 %spec.select.i16, i64 %sub
br label %if.end
if.else: ; preds = %entry
%6 = load i64, ptr %a, align 8, !tbaa !5
%7 = load i64, ptr %d, align 8, !tbaa !5
%cmp.not.i18 = icmp sgt i64 %6, %7
%cmp1.not.i19 = icmp sgt i64 %6, 100005
%or.cond.i20 = or i1 %cmp1.not.i19, %cmp.not.i18
%cmp2.not.i21 = icmp sgt i64 %7, %6
%cmp4.not.i22 = icmp sgt i64 %7, 100005
%or.cond15.i23 = or i1 %cmp2.not.i21, %cmp4.not.i22
%spec.select.i24 = select i1 %or.cond15.i23, i64 100005, i64 %7
%retval.0.i25 = select i1 %or.cond.i20, i64 %spec.select.i24, i64 %6
%sub4 = sub nsw i64 %7, %retval.0.i25
%8 = load i64, ptr %b, align 8, !tbaa !5
%9 = load i64, ptr %c, align 8, !tbaa !5
%cmp.not.i26 = icmp sgt i64 %sub4, %8
%cmp1.not.i27 = icmp sgt i64 %sub4, %9
%or.cond.i28 = or i1 %cmp.not.i26, %cmp1.not.i27
%cmp2.not.i29 = icmp sgt i64 %8, %sub4
%cmp4.not.i30 = icmp sgt i64 %8, %9
%or.cond15.i31 = or i1 %cmp4.not.i30, %cmp2.not.i29
%spec.select.i32 = select i1 %or.cond15.i31, i64 %9, i64 %8
%retval.0.i33 = select i1 %or.cond.i28, i64 %spec.select.i32, i64 %sub4
br label %if.end
if.end: ; preds = %if.else, %if.then
%t1.0 = phi i64 [ %retval.0.i17, %if.then ], [ %retval.0.i25, %if.else ]
%t2.0 = phi i64 [ %retval.0.i, %if.then ], [ %retval.0.i33, %if.else ]
%mul = mul nsw i64 %t1.0, %1
%mul6 = mul nsw i64 %t2.0, %0
%add = add nsw i64 %mul6, %mul
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #4
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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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>
long gcd(long a, long b)
{
if (b == 0){
return (a);
}
return (gcd(b, a % b));
}
long lcm(long a, long b)
{
return (a / gcd(a, b) * b);
}
int main(void)
{
long a1, m1, a2, m2, a3, m3;
int x, y, z;
int A, B, C;
while (1){
scanf("%ld %ld %ld %ld %ld %ld", &a1, &m1, &a2, &m2, &a3, &m3);
if (!a1 && !m1 && !a2 && !m2 && !a3 && !m3){
break;
}
x = a1 % m1;
y = a2 % m2;
z = a3 % m3;
A = 1;
while (x != 1){
x = x * a1 % m1;
A++;
}
B = 1;
while (y != 1){
y = y * a2 % m2;
B++;
}
C = 1;
while (z != 1){
z = z * a3 % m3;
C++;
}
printf("%ld\n", lcm(lcm(A, B), C));
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277412/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277412/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%ld %ld %ld %ld %ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq i64 %b, 0
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i64 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %if.end ]
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 #0 {
entry:
%cmp4.i = icmp eq i64 %b, 0
br i1 %cmp4.i, label %gcd.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%b.tr6.i = phi i64 [ %rem.i, %if.end.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %if.end.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%cmp.i = icmp eq i64 %rem.i, 0
br i1 %cmp.i, label %gcd.exit, label %if.end.i
gcd.exit: ; preds = %if.end.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %if.end.i ]
%div = sdiv i64 %a, %a.tr.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%a1 = alloca i64, align 8
%m1 = alloca i64, align 8
%a2 = alloca i64, align 8
%m2 = alloca i64, align 8
%a3 = alloca i64, align 8
%m3 = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a3) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m3) #4
br label %while.cond
while.cond: ; preds = %lcm.exit66, %entry
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a1, ptr noundef nonnull %m1, ptr noundef nonnull %a2, ptr noundef nonnull %m2, ptr noundef nonnull %a3, ptr noundef nonnull %m3)
%0 = load i64, ptr %a1, align 8, !tbaa !5
%tobool = icmp ne i64 %0, 0
%1 = load i64, ptr %m1, align 8
%tobool1 = icmp ne i64 %1, 0
%or.cond = select i1 %tobool, i1 true, i1 %tobool1
%2 = load i64, ptr %a2, align 8
%tobool3 = icmp ne i64 %2, 0
%or.cond47 = select i1 %or.cond, i1 true, i1 %tobool3
%3 = load i64, ptr %m2, align 8
%tobool5 = icmp ne i64 %3, 0
%or.cond48 = select i1 %or.cond47, i1 true, i1 %tobool5
%4 = load i64, ptr %a3, align 8
%tobool7 = icmp ne i64 %4, 0
%or.cond49 = select i1 %or.cond48, i1 true, i1 %tobool7
%5 = load i64, ptr %m3, align 8
%tobool9 = icmp ne i64 %5, 0
%or.cond50 = select i1 %or.cond49, i1 true, i1 %tobool9
br i1 %or.cond50, label %while.cond14.preheader, label %while.end46
while.cond14.preheader: ; preds = %while.cond
%x.0.in67 = srem i64 %0, %1
%6 = and i64 %x.0.in67, 4294967295
%cmp.not68 = icmp eq i64 %6, 1
br i1 %cmp.not68, label %while.cond20.preheader, label %while.body16
while.cond20.preheader: ; preds = %while.body16, %while.cond14.preheader
%A.0.lcssa = phi i32 [ 1, %while.cond14.preheader ], [ %inc, %while.body16 ]
%y.0.in71 = srem i64 %2, %3
%7 = and i64 %y.0.in71, 4294967295
%cmp21.not72 = icmp eq i64 %7, 1
br i1 %cmp21.not72, label %while.cond30.preheader, label %while.body23
while.body16: ; preds = %while.cond14.preheader, %while.body16
%x.0.in70 = phi i64 [ %x.0.in, %while.body16 ], [ %x.0.in67, %while.cond14.preheader ]
%A.069 = phi i32 [ %inc, %while.body16 ], [ 1, %while.cond14.preheader ]
%sext58 = shl i64 %x.0.in70, 32
%conv17 = ashr exact i64 %sext58, 32
%mul = mul nsw i64 %conv17, %0
%inc = add nuw nsw i32 %A.069, 1
%x.0.in = srem i64 %mul, %1
%8 = and i64 %x.0.in, 4294967295
%cmp.not = icmp eq i64 %8, 1
br i1 %cmp.not, label %while.cond20.preheader, label %while.body16, !llvm.loop !9
while.cond30.preheader: ; preds = %while.body23, %while.cond20.preheader
%B.0.lcssa = phi i32 [ 1, %while.cond20.preheader ], [ %inc28, %while.body23 ]
%z.0.in76 = srem i64 %4, %5
%9 = and i64 %z.0.in76, 4294967295
%cmp31.not77 = icmp eq i64 %9, 1
br i1 %cmp31.not77, label %while.end39, label %while.body33
while.body23: ; preds = %while.cond20.preheader, %while.body23
%y.0.in74 = phi i64 [ %y.0.in, %while.body23 ], [ %y.0.in71, %while.cond20.preheader ]
%B.073 = phi i32 [ %inc28, %while.body23 ], [ 1, %while.cond20.preheader ]
%sext57 = shl i64 %y.0.in74, 32
%conv24 = ashr exact i64 %sext57, 32
%mul25 = mul nsw i64 %conv24, %2
%inc28 = add nuw nsw i32 %B.073, 1
%y.0.in = srem i64 %mul25, %3
%10 = and i64 %y.0.in, 4294967295
%cmp21.not = icmp eq i64 %10, 1
br i1 %cmp21.not, label %while.cond30.preheader, label %while.body23, !llvm.loop !11
while.body33: ; preds = %while.cond30.preheader, %while.body33
%z.0.in79 = phi i64 [ %z.0.in, %while.body33 ], [ %z.0.in76, %while.cond30.preheader ]
%C.078 = phi i32 [ %inc38, %while.body33 ], [ 1, %while.cond30.preheader ]
%sext = shl i64 %z.0.in79, 32
%conv34 = ashr exact i64 %sext, 32
%mul35 = mul nsw i64 %conv34, %4
%inc38 = add nuw nsw i32 %C.078, 1
%z.0.in = srem i64 %mul35, %5
%11 = and i64 %z.0.in, 4294967295
%cmp31.not = icmp eq i64 %11, 1
br i1 %cmp31.not, label %while.end39, label %while.body33, !llvm.loop !12
while.end39: ; preds = %while.body33, %while.cond30.preheader
%C.0.lcssa = phi i32 [ 1, %while.cond30.preheader ], [ %inc38, %while.body33 ]
%conv40 = zext i32 %A.0.lcssa to i64
%conv41 = zext i32 %B.0.lcssa to i64
br label %if.end.i.i
if.end.i.i: ; preds = %if.end.i.i, %while.end39
%b.tr6.i.i = phi i64 [ %rem.i.i, %if.end.i.i ], [ %conv41, %while.end39 ]
%a.tr5.i.i = phi i64 [ %b.tr6.i.i, %if.end.i.i ], [ %conv40, %while.end39 ]
%rem.i.i = urem i64 %a.tr5.i.i, %b.tr6.i.i
%cmp.i.i = icmp eq i64 %rem.i.i, 0
br i1 %cmp.i.i, label %lcm.exit, label %if.end.i.i
lcm.exit: ; preds = %if.end.i.i
%div.i = udiv i64 %conv40, %b.tr6.i.i
%mul.i = mul nuw nsw i64 %div.i, %conv41
%conv43 = zext i32 %C.0.lcssa to i64
br label %if.end.i.i59
if.end.i.i59: ; preds = %if.end.i.i59, %lcm.exit
%b.tr6.i.i60 = phi i64 [ %rem.i.i62, %if.end.i.i59 ], [ %conv43, %lcm.exit ]
%a.tr5.i.i61 = phi i64 [ %b.tr6.i.i60, %if.end.i.i59 ], [ %mul.i, %lcm.exit ]
%rem.i.i62 = srem i64 %a.tr5.i.i61, %b.tr6.i.i60
%cmp.i.i63 = icmp eq i64 %rem.i.i62, 0
br i1 %cmp.i.i63, label %lcm.exit66, label %if.end.i.i59
lcm.exit66: ; preds = %if.end.i.i59
%div.i64 = sdiv i64 %mul.i, %b.tr6.i.i60
%mul.i65 = mul nsw i64 %div.i64, %conv43
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %mul.i65)
br label %while.cond
while.end46: ; preds = %while.cond
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m3) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a3) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#pragma warning(disable:4996)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>
#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin4(X,Y,Z,W) scanf("%d %d %d %d",&X,&Y,&Z,&W)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)
#define c_cin(X) scanf("%c",&X);
#define ll_cin(X) scanf("%lld", &X)
#define ull_cin(X) scanf("%llu", &X)
#define lf_cin(X) scanf("%lf", &X)
#define i_cout(X) printf("%d\n",X)
#define f_cout(X) printf("%g\n",X)
#define i_cout2(X,Y) printf("%d %d\n",X,Y)
#define l_cout(X) printf("%ld\n",X)
#define s_cout(X) printf("%s\n",X)
#define s_coutc(X) printf("%s",X)
#define c_cout(X) printf("%c",X)
#define ll_cout(X) printf("%lld\n",X)
#define ull_cout(X) printf("%llu\n",X)
typedef long long ll;
typedef unsigned long long ull;
#define rept(x, s, n) for (int x = s; x < n; x++)
#define S_RTN(S) s_cout(S);return 0
#define _itoa(A,N) sprintf(A, "%d", N);
int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);
int _gcd(int a, int b);
int _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);
int s_asorts(const void* a, const void* b);
//昇順
int s_asorts(const void* a, const void* b) {
return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
int i;
rept(i, 0, n) {
l_cin2(*(a + i), *(b + i));
}
return 0;
}
int i_cins(int n, int* a) {
int i;
for (i = 0; i < n; i++) {
i_cin(*(a + i));
}
return 0;
}
int _gcd(int a, int b) {
int r, tmp;
if (a < b) { tmp = a; a = b; b = tmp; }
r = a % b;
while (r) {
if (!r) break;
a = b; b = r;
r = a % b;
}
return(b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数2つで得る
//#define pai 3.1415926535
#define deg_rad(X) (X*(M_PI/180))
long _max(long a, long b) {
return a > b ? a : b;
}
long _min(long a, long b) {
return a < b ? a : b;
}
int _swp(int* a, int* b)
{
int tmp;
tmp = *b; *b = *a; *a = tmp;
return 0;
}
int _cknum(char* a, int n) {
int i;
char t = '0';
for (i = 0; i < n; i++) {
if (a[i] < '0' || a[i]>'9') return 1;
}
return 0;
}
int _atoi(char* s, int len) {
char tmp[20];
memcpy(tmp, s, len);
tmp[len] = 0x00;
return (atoi(tmp));
}
//素因数分解 pf素数が入る pc 素数の数
ll _pfact(ll a);
static ll pf[100000000];
static ll pc;
ll _pfact(ll a) {
long i, r;
if (a % 2 == 0) {
pf[pc] = 2; pc++;
return(_pfact(a / 2));
}
r = sqrt(a);
for (i = 3; i <= r; i += 2) {
if (a % i == 0) {
pf[pc] = i; pc++;
return(_pfact(a / i));
}
}
if (a != 1) {
pf[pc] = a; pc++;
}
return 0;
}
#pragma endregion
//150-C
//169-A
//ARC-091 A Flip
static long l[100001];
static long r[100001];
int main(void) {
long n, m, l, r, ll = 0, rr = 100001, i, cnt;
scanf("%ld %ld", &n, &m);
for (i = 0; i < m; i++) {
scanf("%ld %ld", &l, &r);
ll = _max(l, ll);
rr = _min(r, rr);
}
cnt = rr - ll + 1;
printf("%ld\n", (cnt < 0) ? 0 : cnt);
return 0;
}
//int main(void) {
// char a[1001];
// int i, len, e=0,w=0,n=0,s=0;
//
// scanf("%s", a);
// len = strlen(a); a[len] = 0x00;
// for (i = 0; i < len; i++) {
// switch (a[i]) {
// case 'N':n ++; break;
// case 'S':s ++; break;
// case 'E':e ++; break;
// case 'W':w ++; break;
// }
// }
// if ((e == w) && (n && s)) {
// printf("Yes\n"); return 0;
// }
// if ((n == s) && (e && w)) {
// printf("Yes\n"); return 0;
// }
//
// printf("No\n");
//
//
// return 0;
//}
//066-B
//157-C
//int main(void) {
// int n, m;
// int s, c;
// int a[3] = { -1,-1,-1 };
// int i, ans=0;
//
// i_cin2(n, m);
//
// if (m == 0 && n!=1) { i_cout(-1); return 0; } //???2つ目の条件なし
//
// for (i = 0; i < m; i++) {
// i_cin2(s, c);
// if ((a[s - 1] != -1) && //矛盾はないか
// (a[s - 1] != c) ) { i_cout(-1); return 0; }
// switch (n) {
// case 1:if (s != 3) { i_cout(-1); return 0; }
// break;
// case 2:if (s == 1) { i_cout(-1); return 0; }
// if (s == 2 && c == 0)
// {i_cout(-1); return 0;}
// break;
// case 3:
// if (s == 1 && c == 0)
// {i_cout(-1); return 0;}
// break;
// }
// a[s - 1] = c;
// }
//
// for (i = 0; i < 3; i++) {
// if (a[i] == -1) a[i] = 0;
// }
// ans = a[0] * 100 + a[1] * 10 + a[2];
//
// i_cout(ans);
// return 0;
//}
//ABC-07 D 幅優先探索
//#define Q_SIZE 100000
//static struct _queue {
// char *d[Q_SIZE];
// int h;
// int t;
//} q;
//
//int pushq(struct _queue* q, char *item);
//int pushq(struct _queue* q, char *item) {
// if (q->t == Q_SIZE) return -1;
// q->d[q->t] = item;
// q->t++;
// return 0;
//}
//
//char* popq(struct _queue* q);
//char* popq(struct _queue* q) {
// char* tmp;
// if (q->h == q->t) return -1;
// tmp = q->d[q->h];
// q->h--;
// return tmp;
//}
//
//static struct _p {
// int x;
// int y;
// int cnt;
//} q;
//static char a[51][51];
//static struct _p p[50];
//static int pcnt;
//
//int _enq(struct _p *p, int x, int y, int cnt);
//int _enq(struct _p *p,int x, int y, int cnt) {
// p->x = x; p->y = y; p->cnt = cnt;
// pushq(&q,p); pcnt++;
//}
//int _deq(struct _p* p);
//int _deq(struct _p* p) {
// p=popq(&q);
// return(p == -1 ? p : 0);
//}
//int sqr_chk(int x, int y, int cnt) {
// int tmp;
// tmp = pcnt;
// if (a[x - 1][y - 1] == '.')
// {
// _enq(&p[pcnt], x - 1, y - 1, cnt); a[x - 1][y - 1] = 'X';
// }
// if (a[x - 1][y] == '.')
// {
// _enq(&p[pcnt], x - 1, y, cnt); a[x - 1][y] = 'X';
// }
// if (a[x+1][y] == '.')
// {
// _enq(&p[pcnt], x + 1, y, cnt); a[x + 1][y] = 'X';
// }
// if (a[x][y+1] == '.')
// {
// _enq(&p[pcnt], x, y + 1, cnt); a[x][y + 1] = 'X';
// }
// if (pcnt == tmp) return -1;
// else return 0;
//}
//
//int main(void) {
// int r, c;
// int sy, sx, gy, gx;
// int i = 0, j = 0, x = 0, y = 0, ans = 0;
// char cnt = '0';
//
// i_cin(r, c);
// i_cin4(sx, sy, gx, gy);
// if (sx == gx && sy == gy) {
// i_cout(0); return 0;
// }
// for (i = 0; i < r; i++)
// s_cin(a[i]);
// sy--; sx--;
// struct _p* pt;
// pt = &p[cnt];
// p->x = sx; p->y = sy; p->cnt = cnt;
//
// int rc;
// while (1) {
// rc = sqr_chk(pt->x,pt->y,pt->cnt);
// if (rc == -1) {
// rc = _deq(pt);
// if (rc == -1 || (pt->x == gx && pt->y == gy)) break;
// }
// }
//
// if (rc == -1) i_cout(rc);
// else i_cout(ans);
// return 0;
//}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277478/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277478/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@pc = internal unnamed_addr global i64 0, align 8
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_asorts(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #16
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_dsort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @l_cins2(i32 noundef %n, ptr noundef %a, ptr noundef %b) local_unnamed_addr #3 {
entry:
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret i32 0
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%add.ptr = getelementptr inbounds i64, ptr %a, i64 %indvars.iv
%add.ptr3 = getelementptr inbounds i64, ptr %b, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr, ptr noundef %add.ptr3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @i_cins(i32 noundef %n, ptr noundef %a) local_unnamed_addr #3 {
entry:
%cmp3 = icmp sgt i32 %n, 0
br i1 %cmp3, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n 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 ]
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %entry
ret i32 0
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @_gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #6 {
entry:
%spec.select = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
%spec.select15 = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%rem = srem i32 %spec.select15, %spec.select
%tobool.not16 = icmp eq i32 %rem, 0
br i1 %tobool.not16, label %while.end, label %if.end3
if.end3: ; preds = %entry, %if.end3
%r.018 = phi i32 [ %rem4, %if.end3 ], [ %rem, %entry ]
%b.addr.117 = phi i32 [ %r.018, %if.end3 ], [ %spec.select, %entry ]
%rem4 = srem i32 %b.addr.117, %r.018
%tobool.not = icmp eq i32 %rem4, 0
br i1 %tobool.not, label %while.end, label %if.end3, !llvm.loop !12
while.end: ; preds = %if.end3, %entry
%b.addr.1.lcssa = phi i32 [ %spec.select, %entry ], [ %r.018, %if.end3 ]
ret i32 %b.addr.1.lcssa
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @_max(i64 noundef %a, i64 noundef %b) local_unnamed_addr #7 {
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 @_min(i64 noundef %a, i64 noundef %b) local_unnamed_addr #7 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @_swp(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #8 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
store i32 %1, ptr %b, align 4, !tbaa !5
store i32 %0, ptr %a, align 4, !tbaa !5
ret i32 0
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @_cknum(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #9 {
entry:
%cmp13 = icmp sgt i32 %n, 0
br i1 %cmp13, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !13
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i8, ptr %a, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%1 = add i8 %0, -58
%or.cond = icmp ult i8 %1, -10
br i1 %or.cond, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local i32 @_atoi(ptr nocapture noundef readonly %s, i32 noundef %len) local_unnamed_addr #10 {
entry:
%tmp = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %tmp) #17
%conv = sext i32 %len to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %tmp, ptr align 1 %s, i64 %conv, i1 false)
%arrayidx = getelementptr inbounds [20 x i8], ptr %tmp, i64 0, i64 %conv
store i8 0, ptr %arrayidx, align 1, !tbaa !14
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %tmp, ptr noundef null, i32 noundef 10) #17
%conv.i = trunc i64 %call.i to i32
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %tmp) #17
ret i32 %conv.i
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #11
; Function Attrs: nofree nounwind memory(readwrite, argmem: write, inaccessiblemem: write) uwtable
define dso_local i64 @_pfact(i64 noundef %a) local_unnamed_addr #12 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse.backedge, %entry
%a.tr = phi i64 [ %a, %entry ], [ %div, %tailrecurse.backedge ]
%0 = and i64 %a.tr, 1
%cmp = icmp eq i64 %0, 0
br i1 %cmp, label %tailrecurse.backedge, label %if.end
tailrecurse.backedge: ; preds = %for.body, %tailrecurse
%.sink = phi i64 [ 2, %tailrecurse ], [ %i.035, %for.body ]
%1 = load i64, ptr @pc, align 8, !tbaa !15
%inc = add nsw i64 %1, 1
store i64 %inc, ptr @pc, align 8, !tbaa !15
%div = sdiv i64 %a.tr, %.sink
br label %tailrecurse
if.end: ; preds = %tailrecurse
%conv = sitofp i64 %a.tr to double
%call1 = tail call double @sqrt(double noundef %conv) #17
%conv2 = fptosi double %call1 to i64
%cmp3.not34 = icmp slt i64 %conv2, 3
br i1 %cmp3.not34, label %for.end, label %for.body
for.body: ; preds = %if.end, %for.inc
%i.035 = phi i64 [ %add, %for.inc ], [ 3, %if.end ]
%rem5 = srem i64 %a.tr, %i.035
%cmp6 = icmp eq i64 %rem5, 0
br i1 %cmp6, label %tailrecurse.backedge, label %for.inc
for.inc: ; preds = %for.body
%add = add nuw nsw i64 %i.035, 2
%cmp3.not = icmp sgt i64 %add, %conv2
br i1 %cmp3.not, label %for.end, label %for.body, !llvm.loop !17
for.end: ; preds = %if.end, %for.inc
%cmp14.not = icmp eq i64 %a.tr, 1
br i1 %cmp14.not, label %cleanup, label %if.then16
if.then16: ; preds = %for.end
%2 = load i64, ptr @pc, align 8, !tbaa !15
%inc18 = add nsw i64 %2, 1
store i64 %inc18, ptr @pc, align 8, !tbaa !15
br label %cleanup
cleanup: ; preds = %for.end, %if.then16
ret i64 0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #13
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i64, align 8
%m = alloca i64, align 8
%l = alloca i64, align 8
%r = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #17
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #17
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %l) #17
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #17
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i64, ptr %m, align 8, !tbaa !18
%cmp11 = icmp sgt i64 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%ll.014 = phi i64 [ %cond.i, %for.body ], [ 0, %entry ]
%i.013 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%rr.012 = phi i64 [ %cond.i10, %for.body ], [ 100001, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %r)
%1 = load i64, ptr %l, align 8, !tbaa !18
%cond.i = call i64 @llvm.smax.i64(i64 %1, i64 %ll.014)
%2 = load i64, ptr %r, align 8, !tbaa !18
%cond.i10 = call i64 @llvm.smin.i64(i64 %2, i64 %rr.012)
%inc = add nuw nsw i64 %i.013, 1
%3 = load i64, ptr %m, align 8, !tbaa !18
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !20
for.end.loopexit: ; preds = %for.body
%4 = sub nsw i64 %cond.i10, %cond.i
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%sub = phi i64 [ 100001, %entry ], [ %4, %for.end.loopexit ]
%5 = call i64 @llvm.smax.i64(i64 %sub, i64 -1)
%cond = add nsw i64 %5, 1
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %cond)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #17
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %l) #17
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #17
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #17
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #14
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #15
attributes #0 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree 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 = { 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 #9 = { 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 #10 = { mustprogress nofree nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #12 = { nofree nounwind memory(readwrite, argmem: write, inaccessiblemem: 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 #13 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #14 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #15 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #16 = { nounwind willreturn memory(read) }
attributes #17 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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 = !{!7, !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = distinct !{!17, !10}
!18 = !{!19, !19, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = distinct !{!20, !10}
|
#include<stdio.h>
#include<stdlib.h>
int main(){
long n = 0;
long m = 0;
long l[100000] = {};
long r[100000] = {};
long L = 0;
long R = 0;
long i = 0;
scanf("%ld %ld",&n,&m);
for(i=0;i<m;i++){
scanf("%ld %ld",&l[i],&r[i]);
}
L = 0;
R = n+2;
for(i=0;i<m;i++){
if(L < l[i]){
L = l[i];
}
if(r[i] < R){
R = r[i];
}
}
if(R-L>=0){
printf("%ld",R-L+1);
}else{
printf("0");
}
//printf("#%ld %ld",L,R);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277520/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277520/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%m = alloca i64, align 8
%l = alloca [100000 x i64], align 16
%r = alloca [100000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #6
store i64 0, ptr %n, align 8, !tbaa !5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #6
store i64 0, ptr %m, align 8, !tbaa !5
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %l) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800000) %l, i8 0, i64 800000, i1 false)
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %r) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800000) %r, i8 0, i64 800000, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i64, ptr %m, align 8, !tbaa !5
%cmp38 = icmp sgt i64 %0, 0
br i1 %cmp38, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
%1 = load i64, ptr %n, align 8, !tbaa !5
%add48 = add nsw i64 %1, 2
br label %for.end16
for.body: ; preds = %entry, %for.body
%i.039 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i64], ptr %l, i64 0, i64 %i.039
%arrayidx1 = getelementptr inbounds [100000 x i64], ptr %r, i64 0, i64 %i.039
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx1)
%inc = add nuw nsw i64 %i.039, 1
%2 = load i64, ptr %m, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%3 = load i64, ptr %n, align 8, !tbaa !5
%add = add nsw i64 %3, 2
%cmp440 = icmp sgt i64 %2, 0
br i1 %cmp440, label %for.body5.preheader, label %for.end16
for.body5.preheader: ; preds = %for.end
%xtraiter = and i64 %2, 1
%4 = icmp eq i64 %2, 1
br i1 %4, label %for.end16.loopexit.unr-lcssa, label %for.body5.preheader.new
for.body5.preheader.new: ; preds = %for.body5.preheader
%unroll_iter = and i64 %2, -2
br label %for.body5
for.body5: ; preds = %for.body5, %for.body5.preheader.new
%i.143 = phi i64 [ 0, %for.body5.preheader.new ], [ %inc15.1, %for.body5 ]
%R.042 = phi i64 [ %add, %for.body5.preheader.new ], [ %R.1.1, %for.body5 ]
%L.041 = phi i64 [ 0, %for.body5.preheader.new ], [ %spec.select.1, %for.body5 ]
%niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.1, %for.body5 ]
%arrayidx6 = getelementptr inbounds [100000 x i64], ptr %l, i64 0, i64 %i.143
%5 = load i64, ptr %arrayidx6, align 16, !tbaa !5
%spec.select = call i64 @llvm.smax.i64(i64 %L.041, i64 %5)
%arrayidx9 = getelementptr inbounds [100000 x i64], ptr %r, i64 0, i64 %i.143
%6 = load i64, ptr %arrayidx9, align 16, !tbaa !5
%R.1 = call i64 @llvm.smin.i64(i64 %6, i64 %R.042)
%inc15 = or i64 %i.143, 1
%arrayidx6.1 = getelementptr inbounds [100000 x i64], ptr %l, i64 0, i64 %inc15
%7 = load i64, ptr %arrayidx6.1, align 8, !tbaa !5
%spec.select.1 = call i64 @llvm.smax.i64(i64 %spec.select, i64 %7)
%arrayidx9.1 = getelementptr inbounds [100000 x i64], ptr %r, i64 0, i64 %inc15
%8 = load i64, ptr %arrayidx9.1, align 8, !tbaa !5
%R.1.1 = call i64 @llvm.smin.i64(i64 %8, i64 %R.1)
%inc15.1 = add nuw nsw i64 %i.143, 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.end16.loopexit.unr-lcssa, label %for.body5, !llvm.loop !11
for.end16.loopexit.unr-lcssa: ; preds = %for.body5, %for.body5.preheader
%spec.select.lcssa.ph = phi i64 [ undef, %for.body5.preheader ], [ %spec.select.1, %for.body5 ]
%R.1.lcssa.ph = phi i64 [ undef, %for.body5.preheader ], [ %R.1.1, %for.body5 ]
%i.143.unr = phi i64 [ 0, %for.body5.preheader ], [ %inc15.1, %for.body5 ]
%R.042.unr = phi i64 [ %add, %for.body5.preheader ], [ %R.1.1, %for.body5 ]
%L.041.unr = phi i64 [ 0, %for.body5.preheader ], [ %spec.select.1, %for.body5 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end16, label %for.body5.epil
for.body5.epil: ; preds = %for.end16.loopexit.unr-lcssa
%arrayidx6.epil = getelementptr inbounds [100000 x i64], ptr %l, i64 0, i64 %i.143.unr
%9 = load i64, ptr %arrayidx6.epil, align 8, !tbaa !5
%spec.select.epil = call i64 @llvm.smax.i64(i64 %L.041.unr, i64 %9)
%arrayidx9.epil = getelementptr inbounds [100000 x i64], ptr %r, i64 0, i64 %i.143.unr
%10 = load i64, ptr %arrayidx9.epil, align 8, !tbaa !5
%R.1.epil = call i64 @llvm.smin.i64(i64 %10, i64 %R.042.unr)
br label %for.end16
for.end16: ; preds = %for.body5.epil, %for.end16.loopexit.unr-lcssa, %for.end.thread, %for.end
%L.0.lcssa = phi i64 [ 0, %for.end ], [ 0, %for.end.thread ], [ %spec.select.lcssa.ph, %for.end16.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body5.epil ]
%R.0.lcssa = phi i64 [ %add, %for.end ], [ %add48, %for.end.thread ], [ %R.1.lcssa.ph, %for.end16.loopexit.unr-lcssa ], [ %R.1.epil, %for.body5.epil ]
%sub = sub nsw i64 %R.0.lcssa, %L.0.lcssa
%cmp17 = icmp sgt i64 %sub, -1
br i1 %cmp17, label %if.then18, label %if.else
if.then18: ; preds = %for.end16
%add20 = add nuw nsw i64 %sub, 1
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add20)
br label %if.end23
if.else: ; preds = %for.end16
%putchar = call i32 @putchar(i32 48)
br label %if.end23
if.end23: ; preds = %if.else, %if.then18
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %r) #6
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %l) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 8, 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
int n, m, l0 = 1, r0, l, r, i;
scanf("%d %d", &n, &m);
r0 = n;
for(i = 1; i <= m; i++){
scanf("%d %d", &l, &r);
if(l0 < l){
l0 = l;
}
if(r < r0){
r0 = r;
}
}
if(r0 - l0 + 1 > 0){
printf("%d", r0 - l0 + 1);
}else{
printf("0");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277564/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277564/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%l = alloca i32, align 4
%r = 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 %l) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #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 = load i32, ptr %m, align 4, !tbaa !5
%cmp.not19 = icmp slt i32 %1, 1
br i1 %cmp.not19, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%i.022 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%r0.021 = phi i32 [ %r0.1, %for.body ], [ %0, %entry ]
%l0.020 = phi i32 [ %spec.select, %for.body ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %r)
%2 = load i32, ptr %l, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %l0.020, i32 %2)
%3 = load i32, ptr %r, align 4, !tbaa !5
%r0.1 = call i32 @llvm.smin.i32(i32 %3, i32 %r0.021)
%inc = add nuw nsw i32 %i.022, 1
%4 = load i32, ptr %m, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.022, %4
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%l0.0.lcssa = phi i32 [ 1, %entry ], [ %spec.select, %for.body ]
%r0.0.lcssa = phi i32 [ %0, %entry ], [ %r0.1, %for.body ]
%sub = sub nsw i32 %r0.0.lcssa, %l0.0.lcssa
%cmp6 = icmp sgt i32 %sub, -1
br i1 %cmp6, label %if.then7, label %if.else
if.then7: ; preds = %for.end
%add = add nuw nsw i32 %sub, 1
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
br label %if.end12
if.else: ; preds = %for.end
%putchar = call i32 @putchar(i32 48)
br label %if.end12
if.end12: ; preds = %if.else, %if.then7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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 = { 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 i, j, k, n, t, m, h, w, g;
int l1, r1;
int f = 0;
int l, r;
scanf("%d %d", &n, &m);
l = 1;
r = n;
for (i = 0;i < m;i++) {
scanf("%d %d", &l1, &r1);
if (l1 > l) {
l = l1;
}
if (r1 < r) {
r = r1;
}
}
f = r - l + 1;
if (f < 0) {
f = 0;
}
printf("%d", f);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277614/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277614/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%l1 = alloca i32, align 4
%r1 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r1) #4
%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 = load i32, ptr %m, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %1, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%r.018 = phi i32 [ %r.1, %for.body ], [ %0, %entry ]
%l.017 = phi i32 [ %spec.select, %for.body ], [ 1, %entry ]
%i.016 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l1, ptr noundef nonnull %r1)
%2 = load i32, ptr %l1, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %2, i32 %l.017)
%3 = load i32, ptr %r1, align 4, !tbaa !5
%r.1 = call i32 @llvm.smin.i32(i32 %3, i32 %r.018)
%inc = add nuw nsw i32 %i.016, 1
%4 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%l.0.lcssa = phi i32 [ 1, %entry ], [ %spec.select, %for.body ]
%r.0.lcssa = phi i32 [ %0, %entry ], [ %r.1, %for.body ]
%sub = sub nsw i32 %r.0.lcssa, %l.0.lcssa
%5 = call i32 @llvm.smax.i32(i32 %sub, i32 -1)
%spec.store.select = add nsw i32 %5, 1
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.store.select)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l1) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
long N,M;
long i,j;
long L[100000],R[100000];
long ret = 0;
long min,max;
min = 100001;
max = 0;
scanf("%ld %ld",&N,&M);
for(i=0;i<M;i++){
scanf("%ld %ld",&(L[i]),&(R[i]));
if (L[i]>max){
max = L[i];
}
if (R[i]<min){
min = R[i];
}
}
ret = min - max + 1;
if(ret<1){ret = 0;}
printf("%ld\n",ret);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277658/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277658/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
%M = alloca i64, align 8
%L = alloca [100000 x i64], align 16
%R = alloca [100000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %M) #4
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %L) #4
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %R) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i64, ptr %M, align 8, !tbaa !5
%cmp26 = icmp sgt i64 %0, 0
br i1 %cmp26, label %for.body, label %for.end.thread
for.body: ; preds = %entry, %for.body
%max.029 = phi i64 [ %spec.select, %for.body ], [ 0, %entry ]
%min.028 = phi i64 [ %min.1, %for.body ], [ 100001, %entry ]
%i.027 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i64], ptr %L, i64 0, i64 %i.027
%arrayidx1 = getelementptr inbounds [100000 x i64], ptr %R, i64 0, i64 %i.027
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx1)
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
%spec.select = call i64 @llvm.smax.i64(i64 %1, i64 %max.029)
%2 = load i64, ptr %arrayidx1, align 8, !tbaa !5
%min.1 = call i64 @llvm.smin.i64(i64 %2, i64 %min.028)
%inc = add nuw nsw i64 %i.027, 1
%3 = load i64, ptr %M, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%4 = sub nsw i64 %min.1, %spec.select
%.fr = freeze i64 %4
%add = add nsw i64 %.fr, 1
%cmp11 = icmp slt i64 %.fr, 0
%spec.select35 = select i1 %cmp11, i64 0, i64 %add
br label %for.end.thread
for.end.thread: ; preds = %for.end, %entry
%5 = phi i64 [ 100002, %entry ], [ %spec.select35, %for.end ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %5)
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %R) #4
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %L) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %M) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #3
; 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", !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 arr[100002];
int r[100002];
int main()
{
int n, m;
int ans = 0;
scanf("%d %d", &n, &m);
for (int i = 0; i < m; i++)
{
int l, r;
scanf("%d %d", &l, &r);
arr[l] += 1;
arr[r + 1] -= 1;
}
for (int i = 1; i <= n; i++)
r[i] = r[i - 1] + arr[i];
for (int i = 1; i <= n; i++)
if (r[i] == m)
ans++;
printf("%d", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277700/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277700/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@arr = dso_local local_unnamed_addr global [100002 x i32] zeroinitializer, align 16
@r = dso_local local_unnamed_addr global [100002 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp43 = icmp sgt i32 %0, 0
br i1 %cmp43, label %for.body, label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.body, %entry
%.lcssa42 = phi i32 [ %0, %entry ], [ %9, %for.body ]
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp7.not45 = icmp slt i32 %1, 1
br i1 %cmp7.not45, label %for.cond.cleanup24, label %for.body9.preheader
for.body9.preheader: ; preds = %for.cond6.preheader
%2 = add nuw i32 %1, 1
%wide.trip.count = zext i32 %2 to i64
%.pre = load i32, ptr @r, align 16, !tbaa !5
%3 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %3, 1
%4 = icmp eq i32 %2, 2
br i1 %4, label %for.cond22.preheader.unr-lcssa, label %for.body9.preheader.new
for.body9.preheader.new: ; preds = %for.body9.preheader
%unroll_iter = and i64 %3, -2
br label %for.body9
for.body: ; preds = %entry, %for.body
%i.044 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %r)
%5 = load i32, ptr %l, align 4, !tbaa !5
%idxprom = sext i32 %5 to i64
%arrayidx = getelementptr inbounds [100002 x i32], ptr @arr, i64 0, i64 %idxprom
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %6, 1
store i32 %add, ptr %arrayidx, align 4, !tbaa !5
%7 = load i32, ptr %r, align 4, !tbaa !5
%add2 = add nsw i32 %7, 1
%idxprom3 = sext i32 %add2 to i64
%arrayidx4 = getelementptr inbounds [100002 x i32], ptr @arr, i64 0, i64 %idxprom3
%8 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%sub = add nsw i32 %8, -1
store i32 %sub, ptr %arrayidx4, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
%inc = add nuw nsw i32 %i.044, 1
%9 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %9
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !9
for.cond22.preheader.unr-lcssa: ; preds = %for.body9, %for.body9.preheader
%.unr = phi i32 [ %.pre, %for.body9.preheader ], [ %add15.1, %for.body9 ]
%indvars.iv.unr = phi i64 [ 1, %for.body9.preheader ], [ %indvars.iv.next.1, %for.body9 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond22.preheader, label %for.body9.epil
for.body9.epil: ; preds = %for.cond22.preheader.unr-lcssa
%arrayidx14.epil = getelementptr inbounds [100002 x i32], ptr @arr, i64 0, i64 %indvars.iv.unr
%10 = load i32, ptr %arrayidx14.epil, align 4, !tbaa !5
%add15.epil = add nsw i32 %10, %.unr
%arrayidx17.epil = getelementptr inbounds [100002 x i32], ptr @r, i64 0, i64 %indvars.iv.unr
store i32 %add15.epil, ptr %arrayidx17.epil, align 4, !tbaa !5
br label %for.cond22.preheader
for.cond22.preheader: ; preds = %for.cond22.preheader.unr-lcssa, %for.body9.epil
br i1 %cmp7.not45, label %for.cond.cleanup24, label %for.body25.preheader
for.body25.preheader: ; preds = %for.cond22.preheader
%11 = add nuw i32 %1, 1
%wide.trip.count57 = zext i32 %11 to i64
%12 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %1, 8
br i1 %min.iters.check, label %for.body25.preheader61, label %vector.ph
vector.ph: ; preds = %for.body25.preheader
%n.vec = and i64 %12, -8
%ind.end = or i64 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %.lcssa42, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %19, %vector.body ]
%vec.phi59 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %20, %vector.body ]
%offset.idx = or i64 %index, 1
%13 = getelementptr inbounds [100002 x i32], ptr @r, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %13, align 4, !tbaa !5
%14 = getelementptr inbounds i32, ptr %13, i64 4
%wide.load60 = load <4 x i32>, ptr %14, align 4, !tbaa !5
%15 = icmp eq <4 x i32> %wide.load, %broadcast.splat
%16 = icmp eq <4 x i32> %wide.load60, %broadcast.splat
%17 = zext <4 x i1> %15 to <4 x i32>
%18 = zext <4 x i1> %16 to <4 x i32>
%19 = add <4 x i32> %vec.phi, %17
%20 = add <4 x i32> %vec.phi59, %18
%index.next = add nuw i64 %index, 8
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %20, %19
%22 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %12, %n.vec
br i1 %cmp.n, label %for.cond.cleanup24, label %for.body25.preheader61
for.body25.preheader61: ; preds = %for.body25.preheader, %middle.block
%indvars.iv54.ph = phi i64 [ 1, %for.body25.preheader ], [ %ind.end, %middle.block ]
%ans.049.ph = phi i32 [ 0, %for.body25.preheader ], [ %22, %middle.block ]
br label %for.body25
for.body9: ; preds = %for.body9, %for.body9.preheader.new
%23 = phi i32 [ %.pre, %for.body9.preheader.new ], [ %add15.1, %for.body9 ]
%indvars.iv = phi i64 [ 1, %for.body9.preheader.new ], [ %indvars.iv.next.1, %for.body9 ]
%niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.1, %for.body9 ]
%arrayidx14 = getelementptr inbounds [100002 x i32], ptr @arr, i64 0, i64 %indvars.iv
%24 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%add15 = add nsw i32 %24, %23
%arrayidx17 = getelementptr inbounds [100002 x i32], ptr @r, i64 0, i64 %indvars.iv
store i32 %add15, ptr %arrayidx17, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx14.1 = getelementptr inbounds [100002 x i32], ptr @arr, i64 0, i64 %indvars.iv.next
%25 = load i32, ptr %arrayidx14.1, align 4, !tbaa !5
%add15.1 = add nsw i32 %25, %add15
%arrayidx17.1 = getelementptr inbounds [100002 x i32], ptr @r, i64 0, i64 %indvars.iv.next
store i32 %add15.1, ptr %arrayidx17.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond22.preheader.unr-lcssa, label %for.body9, !llvm.loop !14
for.cond.cleanup24: ; preds = %for.body25, %middle.block, %for.cond6.preheader, %for.cond22.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond22.preheader ], [ 0, %for.cond6.preheader ], [ %22, %middle.block ], [ %spec.select, %for.body25 ]
%call33 = 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 %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body25: ; preds = %for.body25.preheader61, %for.body25
%indvars.iv54 = phi i64 [ %indvars.iv.next55, %for.body25 ], [ %indvars.iv54.ph, %for.body25.preheader61 ]
%ans.049 = phi i32 [ %spec.select, %for.body25 ], [ %ans.049.ph, %for.body25.preheader61 ]
%arrayidx27 = getelementptr inbounds [100002 x i32], ptr @r, i64 0, i64 %indvars.iv54
%26 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%cmp28 = icmp eq i32 %26, %.lcssa42
%inc29 = zext i1 %cmp28 to i32
%spec.select = add nuw nsw i32 %ans.049, %inc29
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond58.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count57
br i1 %exitcond58.not, label %for.cond.cleanup24, label %for.body25, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !13, !12}
|
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
int compare_f(const void* a, const void* b) {
return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}
int compare_f2(const void* a, const void* b) {
return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}
static size_t comb(const size_t n, const size_t r) {
size_t result = 1;
for (size_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
static uint64_t combU64(const uint64_t n, const uint64_t r) {
uint64_t result = 1;
for (uint64_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
static uint64_t gcd(uint64_t m, uint64_t n)
{
uint64_t temp;
while (m % n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
static char S[200001];
static size_t whiteSum[200000];
static size_t blackSum[200000];
int main(void) {
size_t N;
scanf("%zu\n%s", &N, S);
bool blackFound = false;
for (size_t i = 0; i < N; i++) {
if (i == 0) {
whiteSum[0] = (S[i] == '.' ? 1 : 0);
blackSum[0] = (S[i] == '#' ? 1 : 0);
}
else {
whiteSum[i] = whiteSum[i - 1] + (S[i] == '.' ? 1 : 0);
blackSum[i] = blackSum[i - 1] + (S[i] == '#' ? 1 : 0);
}
}
size_t transCountMin = (size_t)10000000;
for (size_t i = 0; i <= N; i++) {
size_t transCount = 0;
if (i < N) {
transCount += whiteSum[N - 1] - whiteSum[i];
}
if (0 < i) {
transCount += blackSum[i - 1];
}
if (transCount < transCountMin) {
transCountMin = transCount;
}
}
printf("%zu\n", transCountMin);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277759/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277759/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%zu\0A%s\00", align 1
@S = internal global [200001 x i8] zeroinitializer, align 16
@whiteSum = internal unnamed_addr global [200000 x i64] zeroinitializer, align 16
@blackSum = internal unnamed_addr global [200000 x i64] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [5 x i8] c"%zu\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_f(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_f2(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp ugt i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%N = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull @S)
%0 = load i64, ptr %N, align 8, !tbaa !5
%cmp78.not = icmp eq i64 %0, 0
br i1 %cmp78.not, label %for.cond.cleanup33, label %for.inc.peel
for.inc.peel: ; preds = %entry
%1 = load i8, ptr @S, align 16
%cmp7 = icmp eq i8 %1, 35
%conv10 = zext i1 %cmp7 to i64
%cmp2 = icmp eq i8 %1, 46
%conv4 = zext i1 %cmp2 to i64
store i64 %conv4, ptr @whiteSum, align 16, !tbaa !5
store i64 %conv10, ptr @blackSum, align 16, !tbaa !5
%exitcond.peel.not = icmp eq i64 %0, 1
br i1 %exitcond.peel.not, label %if.end50.peel.thread98, label %for.inc.preheader
for.inc.preheader: ; preds = %for.inc.peel
%load_initial = load i64, ptr @blackSum, align 16
%load_initial107 = load i64, ptr @whiteSum, align 16
br label %for.inc
if.end50.peel.thread98: ; preds = %for.inc.peel
%sub3890 = add nsw i64 %0, -1
%arrayidx3991 = getelementptr inbounds [200000 x i64], ptr @whiteSum, i64 0, i64 %sub3890
%2 = load i64, ptr %arrayidx3991, align 8, !tbaa !5
%3 = load i64, ptr @whiteSum, align 16, !tbaa !5
%sub41.peel100 = sub i64 %2, %3
%spec.select.peel101 = call i64 @llvm.umin.i64(i64 %sub41.peel100, i64 10000000)
br label %for.body34.peel.next
if.end50.peel: ; preds = %for.inc
%4 = add i64 %0, 1
%sub38 = add i64 %0, -1
%arrayidx39 = getelementptr inbounds [200000 x i64], ptr @whiteSum, i64 0, i64 %sub38
%5 = load i64, ptr %arrayidx39, align 8, !tbaa !5
%6 = load i64, ptr @whiteSum, align 16, !tbaa !5
%sub41.peel = sub i64 %5, %6
%spec.select.peel = call i64 @llvm.umin.i64(i64 %sub41.peel, i64 10000000)
%exitcond83.peel = icmp ult i64 %4, 2
br i1 %exitcond83.peel, label %for.cond.cleanup33, label %for.body34.peel.next
for.body34.peel.next: ; preds = %if.end50.peel.thread98, %if.end50.peel
%spec.select.peel104 = phi i64 [ %spec.select.peel101, %if.end50.peel.thread98 ], [ %spec.select.peel, %if.end50.peel ]
%arrayidx3993103 = phi ptr [ %arrayidx3991, %if.end50.peel.thread98 ], [ %arrayidx39, %if.end50.peel ]
br label %for.body34
for.inc: ; preds = %for.inc.preheader, %for.inc
%store_forwarded108 = phi i64 [ %load_initial107, %for.inc.preheader ], [ %add, %for.inc ]
%store_forwarded = phi i64 [ %load_initial, %for.inc.preheader ], [ %add27, %for.inc ]
%i.079 = phi i64 [ 1, %for.inc.preheader ], [ %inc, %for.inc ]
%arrayidx12 = getelementptr inbounds [200001 x i8], ptr @S, i64 0, i64 %i.079
%7 = load i8, ptr %arrayidx12, align 1, !tbaa !9
%cmp14 = icmp eq i8 %7, 46
%conv17 = zext i1 %cmp14 to i64
%add = add i64 %store_forwarded108, %conv17
%arrayidx18 = getelementptr inbounds [200000 x i64], ptr @whiteSum, i64 0, i64 %i.079
store i64 %add, ptr %arrayidx18, align 8, !tbaa !5
%cmp23 = icmp eq i8 %7, 35
%conv26 = zext i1 %cmp23 to i64
%add27 = add i64 %store_forwarded, %conv26
%arrayidx28 = getelementptr inbounds [200000 x i64], ptr @blackSum, i64 0, i64 %i.079
store i64 %add27, ptr %arrayidx28, align 8, !tbaa !5
%inc = add nuw i64 %i.079, 1
%exitcond.not = icmp eq i64 %inc, %0
br i1 %exitcond.not, label %if.end50.peel, label %for.inc, !llvm.loop !10
for.cond.cleanup33: ; preds = %if.end50, %entry, %if.end50.peel
%spec.select.lcssa = phi i64 [ %spec.select.peel, %if.end50.peel ], [ 0, %entry ], [ %spec.select, %if.end50 ]
%call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %spec.select.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #5
ret i32 0
for.body34: ; preds = %for.body34.peel.next, %if.end50
%i29.081 = phi i64 [ 1, %for.body34.peel.next ], [ %inc56, %if.end50 ]
%transCountMin.080 = phi i64 [ %spec.select.peel104, %for.body34.peel.next ], [ %spec.select, %if.end50 ]
%cmp35 = icmp ult i64 %i29.081, %0
br i1 %cmp35, label %if.then37, label %if.end50
if.then37: ; preds = %for.body34
%8 = load i64, ptr %arrayidx3993103, align 8, !tbaa !5
%arrayidx40 = getelementptr inbounds [200000 x i64], ptr @whiteSum, i64 0, i64 %i29.081
%9 = load i64, ptr %arrayidx40, align 8, !tbaa !5
%sub41 = sub i64 %8, %9
br label %if.end50
if.end50: ; preds = %if.then37, %for.body34
%transCount.0 = phi i64 [ %sub41, %if.then37 ], [ 0, %for.body34 ]
%sub47 = add i64 %i29.081, -1
%arrayidx48 = getelementptr inbounds [200000 x i64], ptr @blackSum, i64 0, i64 %sub47
%10 = load i64, ptr %arrayidx48, align 8, !tbaa !5
%add49 = add i64 %10, %transCount.0
%spec.select = call i64 @llvm.umin.i64(i64 %add49, i64 %transCountMin.080)
%inc56 = add nuw i64 %i29.081, 1
%exitcond83 = icmp eq i64 %0, %i29.081
br i1 %exitcond83, label %for.cond.cleanup33, label %for.body34, !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 i64 @llvm.umin.i64(i64, i64) #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !11, !12}
|
#include<stdio.h>
int main(){
int prime[10001];
int i, k, n, max = 0;
for(i = 2; i <= 10000; i++){
prime[i] = 1;
}
for(i = 2; i*i <= 10000; i++){
if(prime[i]){
for(k = 2 * i; k <= 10000; k += i){
prime[k] = 0;
}
}
}
while(1){
scanf("%d", &n);
if(n == 0) break;
for(i = 2; i <= n; i++){
if(max < i && prime[i] == 1 && prime[i-2] == 1) max = i;
}
printf("%d %d\n", max-2, max);
max = 0;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277801/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277801/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%prime = alloca [10001 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %prime) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
br label %vector.body
vector.body: ; preds = %vector.body.1, %entry
%index = phi i64 [ 0, %entry ], [ %index.next.3, %vector.body.1 ]
%offset.idx = or i64 %index, 2
%0 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %offset.idx
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 8, !tbaa !5
%2 = icmp eq i64 %index, 9984
br i1 %2, label %for.body, label %vector.body.1, !llvm.loop !9
vector.body.1: ; preds = %vector.body
%offset.idx.1 = or i64 %index, 10
%3 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %offset.idx.1
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 8, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 8, !tbaa !5
%offset.idx.2 = or i64 %index, 18
%5 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %offset.idx.2
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 8, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 8, !tbaa !5
%offset.idx.3 = or i64 %index, 26
%7 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %offset.idx.3
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 8, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 8, !tbaa !5
%index.next.3 = add nuw nsw i64 %index, 32
br label %vector.body
for.body: ; preds = %vector.body
%arrayidx = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 9994
store i32 1, ptr %arrayidx, align 8, !tbaa !5
%arrayidx.1 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 9995
store i32 1, ptr %arrayidx.1, align 4, !tbaa !5
%arrayidx.2 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 9996
store i32 1, ptr %arrayidx.2, align 16, !tbaa !5
%arrayidx.3 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 9997
store i32 1, ptr %arrayidx.3, align 4, !tbaa !5
%arrayidx.4 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 9998
store i32 1, ptr %arrayidx.4, align 8, !tbaa !5
%arrayidx.5 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 9999
store i32 1, ptr %arrayidx.5, align 4, !tbaa !5
%arrayidx.6 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 10000
store i32 1, ptr %arrayidx.6, align 16, !tbaa !5
br label %for.body3
while.cond.preheader: ; preds = %for.inc14
%call63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp1764 = icmp eq i32 %9, 0
br i1 %cmp1764, label %while.end, label %for.cond20.preheader
for.body3: ; preds = %for.inc14.1, %for.body
%indvars.iv68 = phi i64 [ 2, %for.body ], [ %indvars.iv.next69.1, %for.inc14.1 ]
%indvars.iv66 = phi i64 [ 4, %for.body ], [ %indvars.iv.next67.1, %for.inc14.1 ]
%arrayidx5 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv68
%10 = load i32, ptr %arrayidx5, align 8, !tbaa !5
%tobool.not.not = icmp eq i32 %10, 0
br i1 %tobool.not.not, label %for.inc14, label %for.body9
for.body9: ; preds = %for.body3, %for.body9
%indvars.iv70 = phi i64 [ %indvars.iv.next71, %for.body9 ], [ %indvars.iv66, %for.body3 ]
%arrayidx11 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv70
store i32 0, ptr %arrayidx11, align 8, !tbaa !5
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, %indvars.iv68
%cmp8 = icmp ult i64 %indvars.iv.next71, 10001
br i1 %cmp8, label %for.body9, label %for.inc14, !llvm.loop !13
for.inc14: ; preds = %for.body9, %for.body3
%indvars.iv.next69 = or i64 %indvars.iv68, 1
%indvars.iv.next67 = or i64 %indvars.iv66, 2
%exitcond74.not = icmp eq i64 %indvars.iv.next69, 101
br i1 %exitcond74.not, label %while.cond.preheader, label %for.body3.1, !llvm.loop !14
for.body3.1: ; preds = %for.inc14
%arrayidx5.1 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv.next69
%11 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%tobool.not.not.1 = icmp eq i32 %11, 0
br i1 %tobool.not.not.1, label %for.inc14.1, label %for.body9.1
for.body9.1: ; preds = %for.body3.1, %for.body9.1
%indvars.iv70.1 = phi i64 [ %indvars.iv.next71.1, %for.body9.1 ], [ %indvars.iv.next67, %for.body3.1 ]
%arrayidx11.1 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv70.1
store i32 0, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next71.1 = add nuw nsw i64 %indvars.iv70.1, %indvars.iv.next69
%cmp8.1 = icmp ult i64 %indvars.iv.next71.1, 10001
br i1 %cmp8.1, label %for.body9.1, label %for.inc14.1, !llvm.loop !13
for.inc14.1: ; preds = %for.body9.1, %for.body3.1
%indvars.iv.next69.1 = add nuw nsw i64 %indvars.iv68, 2
%indvars.iv.next67.1 = add nuw nsw i64 %indvars.iv66, 4
br label %for.body3
for.cond20.preheader: ; preds = %while.cond.preheader, %for.end35
%12 = phi i32 [ %32, %for.end35 ], [ %9, %while.cond.preheader ]
%cmp21.not60 = icmp slt i32 %12, 2
br i1 %cmp21.not60, label %for.end35, label %for.body22.preheader
for.body22.preheader: ; preds = %for.cond20.preheader
%13 = add i32 %12, 1
%wide.trip.count = zext i32 %13 to i64
%xtraiter = and i64 %wide.trip.count, 1
%14 = icmp eq i32 %13, 3
br i1 %14, label %for.end35.loopexit.unr-lcssa, label %for.body22.preheader.new
for.body22.preheader.new: ; preds = %for.body22.preheader
%15 = and i64 %wide.trip.count, 4294967294
%16 = add nsw i64 %15, -4
br label %for.body22
for.body22: ; preds = %for.inc33.1, %for.body22.preheader.new
%indvars.iv75 = phi i64 [ 2, %for.body22.preheader.new ], [ %indvars.iv.next76.1, %for.inc33.1 ]
%max.162 = phi i32 [ 0, %for.body22.preheader.new ], [ %max.2.1, %for.inc33.1 ]
%niter = phi i64 [ 0, %for.body22.preheader.new ], [ %niter.next.1, %for.inc33.1 ]
%17 = sext i32 %max.162 to i64
%cmp23 = icmp sgt i64 %indvars.iv75, %17
br i1 %cmp23, label %land.lhs.true, label %for.inc33
land.lhs.true: ; preds = %for.body22
%arrayidx25 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv75
%18 = load i32, ptr %arrayidx25, align 8, !tbaa !5
%cmp26 = icmp eq i32 %18, 1
br i1 %cmp26, label %land.lhs.true27, label %for.inc33
land.lhs.true27: ; preds = %land.lhs.true
%19 = add nsw i64 %indvars.iv75, -2
%arrayidx29 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %19
%20 = load i32, ptr %arrayidx29, align 8, !tbaa !5
%cmp30 = icmp eq i32 %20, 1
%21 = trunc i64 %indvars.iv75 to i32
%spec.select = select i1 %cmp30, i32 %21, i32 %max.162
br label %for.inc33
for.inc33: ; preds = %land.lhs.true27, %for.body22, %land.lhs.true
%max.2 = phi i32 [ %max.162, %land.lhs.true ], [ %max.162, %for.body22 ], [ %spec.select, %land.lhs.true27 ]
%indvars.iv.next76 = or i64 %indvars.iv75, 1
%22 = sext i32 %max.2 to i64
%cmp23.1 = icmp sgt i64 %indvars.iv.next76, %22
br i1 %cmp23.1, label %land.lhs.true.1, label %for.inc33.1
land.lhs.true.1: ; preds = %for.inc33
%arrayidx25.1 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv.next76
%23 = load i32, ptr %arrayidx25.1, align 4, !tbaa !5
%cmp26.1 = icmp eq i32 %23, 1
br i1 %cmp26.1, label %land.lhs.true27.1, label %for.inc33.1
land.lhs.true27.1: ; preds = %land.lhs.true.1
%24 = add nsw i64 %indvars.iv75, -1
%arrayidx29.1 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %24
%25 = load i32, ptr %arrayidx29.1, align 4, !tbaa !5
%cmp30.1 = icmp eq i32 %25, 1
%26 = trunc i64 %indvars.iv.next76 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %26, i32 %max.2
br label %for.inc33.1
for.inc33.1: ; preds = %land.lhs.true27.1, %land.lhs.true.1, %for.inc33
%max.2.1 = phi i32 [ %max.2, %land.lhs.true.1 ], [ %max.2, %for.inc33 ], [ %spec.select.1, %land.lhs.true27.1 ]
%indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter, %16
br i1 %niter.ncmp.1, label %for.end35.loopexit.unr-lcssa, label %for.body22, !llvm.loop !15
for.end35.loopexit.unr-lcssa: ; preds = %for.inc33.1, %for.body22.preheader
%max.2.lcssa.ph = phi i32 [ undef, %for.body22.preheader ], [ %max.2.1, %for.inc33.1 ]
%indvars.iv75.unr = phi i64 [ 2, %for.body22.preheader ], [ %indvars.iv.next76.1, %for.inc33.1 ]
%max.162.unr = phi i32 [ 0, %for.body22.preheader ], [ %max.2.1, %for.inc33.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end35, label %for.body22.epil
for.body22.epil: ; preds = %for.end35.loopexit.unr-lcssa
%27 = sext i32 %max.162.unr to i64
%cmp23.epil = icmp sgt i64 %indvars.iv75.unr, %27
br i1 %cmp23.epil, label %land.lhs.true.epil, label %for.end35
land.lhs.true.epil: ; preds = %for.body22.epil
%arrayidx25.epil = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv75.unr
%28 = load i32, ptr %arrayidx25.epil, align 4, !tbaa !5
%cmp26.epil = icmp eq i32 %28, 1
br i1 %cmp26.epil, label %land.lhs.true27.epil, label %for.end35
land.lhs.true27.epil: ; preds = %land.lhs.true.epil
%29 = add nsw i64 %indvars.iv75.unr, -2
%arrayidx29.epil = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %29
%30 = load i32, ptr %arrayidx29.epil, align 4, !tbaa !5
%cmp30.epil = icmp eq i32 %30, 1
%31 = trunc i64 %indvars.iv75.unr to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %31, i32 %max.162.unr
br label %for.end35
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %land.lhs.true27.epil, %land.lhs.true.epil, %for.body22.epil, %for.cond20.preheader
%max.1.lcssa = phi i32 [ 0, %for.cond20.preheader ], [ %max.2.lcssa.ph, %for.end35.loopexit.unr-lcssa ], [ %max.162.unr, %land.lhs.true.epil ], [ %max.162.unr, %for.body22.epil ], [ %spec.select.epil, %land.lhs.true27.epil ]
%sub36 = add nsw i32 %max.1.lcssa, -2
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub36, i32 noundef %max.1.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%32 = load i32, ptr %n, align 4, !tbaa !5
%cmp17 = icmp eq i32 %32, 0
br i1 %cmp17, label %while.end, label %for.cond20.preheader
while.end: ; preds = %for.end35, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %prime) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int p[10001];
int main(void)
{
unsigned i,k, n;
for (i = 0; i < 10000; i++){
p[i] = 1;
}
p[0] = 0;
for (i = 2; i*i <= 10000; i++) {
if (p[i] == 1) {
for (k = 2*i; k <=10000 ; k += i){
p[k] = 0;
}
}
}
while(1){
scanf("%d" , &n);
if(n == 0)
break;
for(i = n ; i > 1;i--){
if(p[i]*p[i -2] ==1)
break;
}
if(n >= 5)
printf("%d %d\n",i-2,i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277845/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277845/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@p = dso_local local_unnamed_addr global [10001 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: 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
br label %vector.body
vector.body: ; preds = %vector.body, %entry
%index = phi i64 [ 0, %entry ], [ %index.next.4, %vector.body ]
%0 = getelementptr inbounds [10001 x i32], ptr @p, i64 0, i64 %index
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 16, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 16, !tbaa !5
%index.next = add nuw nsw i64 %index, 8
%2 = getelementptr inbounds [10001 x i32], ptr @p, i64 0, i64 %index.next
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 16, !tbaa !5
%index.next.1 = add nuw nsw i64 %index, 16
%4 = getelementptr inbounds [10001 x i32], ptr @p, i64 0, i64 %index.next.1
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 16, !tbaa !5
%index.next.2 = add nuw nsw i64 %index, 24
%6 = getelementptr inbounds [10001 x i32], ptr @p, i64 0, i64 %index.next.2
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 16, !tbaa !5
%index.next.3 = add nuw nsw i64 %index, 32
%8 = getelementptr inbounds [10001 x i32], ptr @p, i64 0, i64 %index.next.3
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 16, !tbaa !5
%index.next.4 = add nuw nsw i64 %index, 40
%10 = icmp eq i64 %index.next.4, 10000
br i1 %10, label %for.end, label %vector.body, !llvm.loop !9
for.end: ; preds = %vector.body
store i32 0, ptr @p, align 16, !tbaa !5
br label %for.body3
while.cond.preheader: ; preds = %for.inc15
%call62 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%11 = load i32, ptr %n, align 4, !tbaa !5
%cmp1863 = icmp eq i32 %11, 0
br i1 %cmp1863, label %while.end, label %for.cond21.preheader
for.body3: ; preds = %for.end, %for.inc15
%indvars.iv67 = phi i64 [ 2, %for.end ], [ %indvars.iv.next68, %for.inc15 ]
%indvars.iv65 = phi i64 [ 4, %for.end ], [ %indvars.iv.next66, %for.inc15 ]
%arrayidx5 = getelementptr inbounds [10001 x i32], ptr @p, i64 0, i64 %indvars.iv67
%12 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %12, 1
br i1 %cmp6, label %for.body10, label %for.inc15
for.body10: ; preds = %for.body3, %for.body10
%indvars.iv69 = phi i64 [ %indvars.iv.next70, %for.body10 ], [ %indvars.iv65, %for.body3 ]
%arrayidx12 = getelementptr inbounds [10001 x i32], ptr @p, i64 0, i64 %indvars.iv69
store i32 0, ptr %arrayidx12, align 4, !tbaa !5
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, %indvars.iv67
%cmp9 = icmp ult i64 %indvars.iv.next70, 10001
br i1 %cmp9, label %for.body10, label %for.inc15, !llvm.loop !13
for.inc15: ; preds = %for.body10, %for.body3
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
%indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 2
%exitcond74.not = icmp eq i64 %indvars.iv.next68, 101
br i1 %exitcond74.not, label %while.cond.preheader, label %for.body3, !llvm.loop !14
for.cond21.preheader: ; preds = %while.cond.preheader, %if.end38
%13 = phi i32 [ %16, %if.end38 ], [ %11, %while.cond.preheader ]
%cmp2259 = icmp ugt i32 %13, 1
br i1 %cmp2259, label %for.body23, label %if.end38
for.body23: ; preds = %for.cond21.preheader, %for.inc32
%i.260 = phi i32 [ %dec, %for.inc32 ], [ %13, %for.cond21.preheader ]
%idxprom24 = zext i32 %i.260 to i64
%arrayidx25 = getelementptr inbounds [10001 x i32], ptr @p, i64 0, i64 %idxprom24
%14 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%sub = add i32 %i.260, -2
%idxprom26 = zext i32 %sub to i64
%arrayidx27 = getelementptr inbounds [10001 x i32], ptr @p, i64 0, i64 %idxprom26
%15 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%mul28 = mul nsw i32 %15, %14
%cmp29 = icmp eq i32 %mul28, 1
br i1 %cmp29, label %for.end33, label %for.inc32
for.inc32: ; preds = %for.body23
%dec = add i32 %i.260, -1
%cmp22 = icmp ugt i32 %dec, 1
br i1 %cmp22, label %for.body23, label %for.end33, !llvm.loop !15
for.end33: ; preds = %for.inc32, %for.body23
%i.2.lcssa = phi i32 [ 1, %for.inc32 ], [ %i.260, %for.body23 ]
%cmp34 = icmp ugt i32 %13, 4
br i1 %cmp34, label %if.then35, label %if.end38
if.then35: ; preds = %for.end33
%sub36 = add i32 %i.2.lcssa, -2
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub36, i32 noundef %i.2.lcssa)
br label %if.end38
if.end38: ; preds = %for.cond21.preheader, %if.then35, %for.end33
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%16 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp eq i32 %16, 0
br i1 %cmp18, label %while.end, label %for.cond21.preheader
while.end: ; preds = %if.end38, %while.cond.preheader
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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#define MAX_V 1000000
int prime[MAX_V+1];
int main(){
int i, k, n;
for(i = 2; i <= MAX_V; i++){
prime[i] = 1;
}
for(i = 2; i * i <= MAX_V; i++){
if(prime[i]){
for(k = 2*i;k <= MAX_V; k += i){
prime[k] = 0;
}
}
}
while(scanf("%d", &n) != EOF){
if(n==0) break;
for(i = n; i >=2; i--){
if(prime[i - 2]&& prime[i]/*&&p1<i*/){
printf("%d %d\n", i - 2, i);
break;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277889/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277889/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@prime = dso_local local_unnamed_addr global [1000001 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: 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
br label %vector.body
vector.body: ; preds = %vector.body.3, %entry
%index = phi i64 [ 0, %entry ], [ %index.next.3, %vector.body.3 ]
%offset.idx = or i64 %index, 2
%0 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %offset.idx
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 8, !tbaa !5
%offset.idx.1 = or i64 %index, 10
%2 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %offset.idx.1
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 8, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 8, !tbaa !5
%offset.idx.2 = or i64 %index, 18
%4 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %offset.idx.2
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 8, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 8, !tbaa !5
%6 = icmp eq i64 %index, 999968
br i1 %6, label %for.body, label %vector.body.3, !llvm.loop !9
vector.body.3: ; preds = %vector.body
%offset.idx.3 = or i64 %index, 26
%7 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %offset.idx.3
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 8, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 8, !tbaa !5
%index.next.3 = add nuw nsw i64 %index, 32
br label %vector.body
for.body: ; preds = %vector.body
store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 999994), align 8, !tbaa !5
store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 999995), align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 999996), align 16, !tbaa !5
store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 999997), align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 999998), align 8, !tbaa !5
store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 999999), align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 1000000), align 16, !tbaa !5
br label %for.body3
while.cond.preheader: ; preds = %for.inc14
%call59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp1760 = icmp eq i32 %call59, -1
%9 = load i32, ptr %n, align 4
%cmp1861 = icmp eq i32 %9, 0
%or.cond62 = select i1 %cmp1760, i1 true, i1 %cmp1861
br i1 %or.cond62, label %while.end, label %for.cond21.preheader
for.body3: ; preds = %for.body, %for.inc14
%indvars.iv69 = phi i64 [ %indvars.iv.next70, %for.inc14 ], [ 2, %for.body ]
%indvars.iv67 = phi i64 [ %indvars.iv.next68, %for.inc14 ], [ 4, %for.body ]
%arrayidx5 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %indvars.iv69
%10 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%tobool.not.not = icmp eq i32 %10, 0
br i1 %tobool.not.not, label %for.inc14, label %for.body9
for.body9: ; preds = %for.body3, %for.body9
%indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.body9 ], [ %indvars.iv67, %for.body3 ]
%arrayidx11 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %indvars.iv71
store i32 0, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, %indvars.iv69
%cmp8 = icmp ult i64 %indvars.iv.next72, 1000001
br i1 %cmp8, label %for.body9, label %for.inc14, !llvm.loop !13
for.inc14: ; preds = %for.body9, %for.body3
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 2
%exitcond75.not = icmp eq i64 %indvars.iv.next70, 1001
br i1 %exitcond75.not, label %while.cond.preheader, label %for.body3, !llvm.loop !14
for.cond21.preheader: ; preds = %while.cond.preheader, %for.end35
%11 = phi i32 [ %15, %for.end35 ], [ %9, %while.cond.preheader ]
%cmp2257 = icmp sgt i32 %11, 1
br i1 %cmp2257, label %for.body23.preheader, label %for.end35
for.body23.preheader: ; preds = %for.cond21.preheader
%12 = zext i32 %11 to i64
br label %for.body23
for.body23: ; preds = %for.body23.preheader, %for.inc34
%indvars.iv76 = phi i64 [ %12, %for.body23.preheader ], [ %indvars.iv.next77, %for.inc34 ]
%indvars78 = trunc i64 %indvars.iv76 to i32
%sub = add nsw i32 %indvars78, -2
%idxprom24 = zext i32 %sub to i64
%arrayidx25 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %idxprom24
%13 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%tobool26.not = icmp eq i32 %13, 0
br i1 %tobool26.not, label %for.inc34, label %land.lhs.true
land.lhs.true: ; preds = %for.body23
%arrayidx28 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %indvars.iv76
%14 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%tobool29.not = icmp eq i32 %14, 0
br i1 %tobool29.not, label %for.inc34, label %if.then30
if.then30: ; preds = %land.lhs.true
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub, i32 noundef %indvars78)
br label %for.end35
for.inc34: ; preds = %for.body23, %land.lhs.true
%indvars.iv.next77 = add nsw i64 %indvars.iv76, -1
%cmp22 = icmp sgt i64 %indvars.iv76, 2
br i1 %cmp22, label %for.body23, label %for.end35, !llvm.loop !15
for.end35: ; preds = %for.inc34, %for.cond21.preheader, %if.then30
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp17 = icmp eq i32 %call, -1
%15 = load i32, ptr %n, align 4
%cmp18 = icmp eq i32 %15, 0
%or.cond = select i1 %cmp17, i1 true, i1 %cmp18
br i1 %or.cond, label %while.end, label %for.cond21.preheader, !llvm.loop !16
while.end: ; preds = %for.end35, %while.cond.preheader
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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
int isprime(int n) {
int i;
for(i = 2; i * i <= n; i++) {
if(n % i == 0) return 0;
}
return 1;
}
int main(){
int n, i;
while(1){
scanf("%d", &n);
if(n == 0) break;
for(i=n ; i >= 5 ; i--){
if(isprime(i) && isprime(i-2)) break;
}
printf("%d %d\n", i - 2, i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277931/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277931/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @isprime(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp.not6 = icmp slt i32 %n, 4
br i1 %cmp.not6, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %i.07, 1
%mul = mul nsw i32 %inc, %inc
%cmp.not = icmp sgt i32 %mul, %n
br i1 %cmp.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %entry, %for.cond
%i.07 = phi i32 [ %inc, %for.cond ], [ 2, %entry ]
%rem = srem i32 %n, %i.07
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call36 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp37 = icmp eq i32 %0, 0
br i1 %cmp37, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i32 [ %2, %for.end ], [ %0, %entry ]
%cmp133 = icmp sgt i32 %1, 4
br i1 %cmp133, label %for.body.i.preheader, label %for.end
for.body.i.preheader: ; preds = %for.cond.preheader, %for.inc
%i.034 = phi i32 [ %dec, %for.inc ], [ %1, %for.cond.preheader ]
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%inc.i = add nuw nsw i32 %i.07.i, 1
%mul.i = mul nsw i32 %inc.i, %inc.i
%cmp.not.i = icmp sgt i32 %mul.i, %i.034
br i1 %cmp.not.i, label %land.lhs.true, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.body.i.preheader, %for.cond.i
%i.07.i = phi i32 [ %inc.i, %for.cond.i ], [ 2, %for.body.i.preheader ]
%rem.i = srem i32 %i.034, %i.07.i
%cmp1.i = icmp eq i32 %rem.i, 0
br i1 %cmp1.i, label %for.inc, label %for.cond.i
land.lhs.true: ; preds = %for.cond.i
%sub = add nsw i32 %i.034, -2
%cmp.not6.i14 = icmp slt i32 %i.034, 6
br i1 %cmp.not6.i14, label %for.end, label %for.body.i15
for.cond.i19: ; preds = %for.body.i15
%inc.i20 = add nuw nsw i32 %i.07.i16, 1
%mul.i21 = mul nsw i32 %inc.i20, %inc.i20
%cmp.not.i22 = icmp sgt i32 %mul.i21, %sub
br i1 %cmp.not.i22, label %for.end, label %for.body.i15, !llvm.loop !5
for.body.i15: ; preds = %land.lhs.true, %for.cond.i19
%i.07.i16 = phi i32 [ %inc.i20, %for.cond.i19 ], [ 2, %land.lhs.true ]
%rem.i17 = srem i32 %sub, %i.07.i16
%cmp1.i18 = icmp eq i32 %rem.i17, 0
br i1 %cmp1.i18, label %for.inc, label %for.cond.i19
for.inc: ; preds = %for.body.i, %for.body.i15
%dec = add nsw i32 %i.034, -1
%cmp1 = icmp sgt i32 %i.034, 5
br i1 %cmp1, label %for.body.i.preheader, label %for.end, !llvm.loop !11
for.end: ; preds = %for.inc, %land.lhs.true, %for.cond.i19, %for.cond.preheader
%i.032 = phi i32 [ %1, %for.cond.preheader ], [ %i.034, %for.cond.i19 ], [ 4, %for.inc ], [ %i.034, %land.lhs.true ]
%sub7 = add nsw i32 %i.032, -2
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub7, i32 noundef %i.032)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%2 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp eq i32 %2, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include <stdio.h>
char is_sosuu[10001];
void get_sosuu(char* out,int max) {
int i,j;
for(i=0;i<=max;i++)out[i]=1;
if(max<=0)out[0]=0;
if(max<=1)out[1]=0;
for(i=2;i<=max;i++) {
if(!out[i])continue;
for(j=i+i;j<=max;j+=i)out[j]=0;
}
}
int main(void) {
int now_input;
int i;
get_sosuu(is_sosuu,10000);
while(1) {
scanf("%d",&now_input);
if(now_input==0)return 0;
for(i=now_input;i>=2;i--) {
if(is_sosuu[i] && is_sosuu[i-2])break;
}
printf("%d %d\n",i-2,i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277975/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277975/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@is_sosuu = dso_local local_unnamed_addr global [10001 x i8] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @get_sosuu(ptr nocapture noundef %out, i32 noundef %max) local_unnamed_addr #0 {
entry:
%cmp.not44 = icmp slt i32 %max, 0
br i1 %cmp.not44, label %if.end.thread, label %for.end
for.end: ; preds = %entry
%0 = add nuw i32 %max, 1
%1 = zext i32 %0 to i64
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %out, i8 1, i64 %1, i1 false), !tbaa !5
switch i32 %max, label %for.body9.preheader [
i32 0, label %if.end.thread
i32 1, label %if.end6.thread
]
if.end.thread: ; preds = %for.end, %entry
store i8 0, ptr %out, align 1, !tbaa !5
br label %if.end6.thread
if.end6.thread: ; preds = %for.end, %if.end.thread
%arrayidx5 = getelementptr inbounds i8, ptr %out, i64 1
store i8 0, ptr %arrayidx5, align 1, !tbaa !5
br label %for.end24
for.body9.preheader: ; preds = %for.end
%2 = add nuw i32 %max, 1
%wide.trip.count = zext i32 %2 to i64
br label %for.body9
for.body9: ; preds = %for.body9.preheader, %for.inc22
%indvars.iv52 = phi i64 [ 2, %for.body9.preheader ], [ %indvars.iv.next53, %for.inc22 ]
%indvars.iv = phi i64 [ 4, %for.body9.preheader ], [ %indvars.iv.next, %for.inc22 ]
%arrayidx11 = getelementptr inbounds i8, ptr %out, i64 %indvars.iv52
%3 = load i8, ptr %arrayidx11, align 1, !tbaa !5
%tobool.not = icmp eq i8 %3, 0
%indvars.iv52.tr = trunc i64 %indvars.iv52 to i32
%4 = shl i32 %indvars.iv52.tr, 1
%cmp15.not46 = icmp sgt i32 %4, %max
%or.cond = or i1 %tobool.not, %cmp15.not46
br i1 %or.cond, label %for.inc22, label %for.body16
for.body16: ; preds = %for.body9, %for.body16
%indvars.iv54 = phi i64 [ %indvars.iv.next55, %for.body16 ], [ %indvars.iv, %for.body9 ]
%arrayidx18 = getelementptr inbounds i8, ptr %out, i64 %indvars.iv54
store i8 0, ptr %arrayidx18, align 1, !tbaa !5
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, %indvars.iv52
%5 = trunc i64 %indvars.iv.next55 to i32
%cmp15.not = icmp sgt i32 %5, %max
br i1 %cmp15.not, label %for.inc22, label %for.body16, !llvm.loop !8
for.inc22: ; preds = %for.body16, %for.body9
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
%exitcond.not = icmp eq i64 %indvars.iv.next53, %wide.trip.count
br i1 %exitcond.not, label %for.end24, label %for.body9, !llvm.loop !10
for.end24: ; preds = %for.inc22, %if.end6.thread
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%now_input = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %now_input) #5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(10001) @is_sosuu, i8 1, i64 10001, i1 false), !tbaa !5
br label %for.body9.i
for.body9.i: ; preds = %for.inc22.i, %entry
%indvars.iv52.i = phi i64 [ 2, %entry ], [ %indvars.iv.next53.i, %for.inc22.i ]
%indvars.iv.i = phi i64 [ 4, %entry ], [ %indvars.iv.next.i, %for.inc22.i ]
%arrayidx11.i = getelementptr inbounds i8, ptr @is_sosuu, i64 %indvars.iv52.i
%0 = load i8, ptr %arrayidx11.i, align 1, !tbaa !5
%tobool.not.i = icmp eq i8 %0, 0
%indvars.iv52.tr.i = trunc i64 %indvars.iv52.i to i32
%1 = shl i32 %indvars.iv52.tr.i, 1
%cmp15.not46.i = icmp sgt i32 %1, 10000
%or.cond.i = or i1 %tobool.not.i, %cmp15.not46.i
br i1 %or.cond.i, label %for.inc22.i, label %for.body16.i
for.body16.i: ; preds = %for.body9.i, %for.body16.i
%indvars.iv54.i = phi i64 [ %indvars.iv.next55.i, %for.body16.i ], [ %indvars.iv.i, %for.body9.i ]
%arrayidx18.i = getelementptr inbounds i8, ptr @is_sosuu, i64 %indvars.iv54.i
store i8 0, ptr %arrayidx18.i, align 1, !tbaa !5
%indvars.iv.next55.i = add nuw nsw i64 %indvars.iv54.i, %indvars.iv52.i
%2 = icmp ugt i64 %indvars.iv.next55.i, 10000
br i1 %2, label %for.inc22.i, label %for.body16.i, !llvm.loop !8
for.inc22.i: ; preds = %for.body16.i, %for.body9.i
%indvars.iv.next53.i = add nuw nsw i64 %indvars.iv52.i, 1
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 2
%exitcond.not.i = icmp eq i64 %indvars.iv.next53.i, 10001
br i1 %exitcond.not.i, label %while.cond.preheader, label %for.body9.i, !llvm.loop !10
while.cond.preheader: ; preds = %for.inc22.i
%call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %now_input)
%3 = load i32, ptr %now_input, align 4, !tbaa !11
%cmp19 = icmp eq i32 %3, 0
br i1 %cmp19, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %while.cond.preheader, %for.end
%4 = phi i32 [ %8, %for.end ], [ %3, %while.cond.preheader ]
%cmp115 = icmp sgt i32 %4, 1
br i1 %cmp115, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %for.cond.preheader
%5 = zext i32 %4 to i64
br label %for.body
if.then: ; preds = %for.end, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %now_input) #5
ret i32 0
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ %5, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds [10001 x i8], ptr @is_sosuu, i64 0, i64 %indvars.iv
%6 = load i8, ptr %arrayidx, align 1, !tbaa !5
%tobool.not = icmp eq i8 %6, 0
br i1 %tobool.not, label %for.inc, label %land.lhs.true
land.lhs.true: ; preds = %for.body
%sub = add nuw i64 %indvars.iv, 4294967294
%idxprom2 = and i64 %sub, 4294967295
%arrayidx3 = getelementptr inbounds [10001 x i8], ptr @is_sosuu, i64 0, i64 %idxprom2
%7 = load i8, ptr %arrayidx3, align 1, !tbaa !5
%tobool5.not = icmp eq i8 %7, 0
br i1 %tobool5.not, label %for.inc, label %for.end.loopexit.split.loop.exit
for.inc: ; preds = %for.body, %land.lhs.true
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp1 = icmp sgt i64 %indvars.iv, 2
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !13
for.end.loopexit.split.loop.exit: ; preds = %land.lhs.true
%indvars20.le = trunc i64 %indvars.iv to i32
br label %for.end
for.end: ; preds = %for.inc, %for.end.loopexit.split.loop.exit, %for.cond.preheader
%i.0.lcssa = phi i32 [ %4, %for.cond.preheader ], [ %indvars20.le, %for.end.loopexit.split.loop.exit ], [ 1, %for.inc ]
%sub8 = add nsw i32 %i.0.lcssa, -2
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub8, i32 noundef %i.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %now_input)
%8 = load i32, ptr %now_input, align 4, !tbaa !11
%cmp = icmp eq i32 %8, 0
br i1 %cmp, label %if.then, label %for.cond.preheader
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = distinct !{!13, !9}
|
#include<stdio.h>
int a,b,i,x;
int main(){
for(i=0;i<4;i++){
scanf("%d",&x);
a+=x;
}
for(i=0;i<4;i++){
scanf("%d",&x);
b+=x;
}
if(a>b) printf("%d\n",a);
else printf("%d\n",b);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278046/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278046/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@i = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@x = dso_local global i32 0, align 4
@a = dso_local local_unnamed_addr global i32 0, align 4
@b = 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:
store i32 0, ptr @i, align 4, !tbaa !5
br label %for.body
for.cond1.preheader: ; preds = %for.body
store i32 0, ptr @i, align 4, !tbaa !5
br label %for.body3
for.body: ; preds = %entry, %for.body
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
%0 = load i32, ptr @x, align 4, !tbaa !5
%1 = load i32, ptr @a, align 4, !tbaa !5
%add = add nsw i32 %1, %0
store i32 %add, ptr @a, align 4, !tbaa !5
%2 = load i32, ptr @i, align 4, !tbaa !5
%inc = add nsw i32 %2, 1
store i32 %inc, ptr @i, align 4, !tbaa !5
%cmp = icmp slt i32 %2, 3
br i1 %cmp, label %for.body, label %for.cond1.preheader, !llvm.loop !9
for.body3: ; preds = %for.cond1.preheader, %for.body3
%call4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
%3 = load i32, ptr @x, align 4, !tbaa !5
%4 = load i32, ptr @b, align 4, !tbaa !5
%add5 = add nsw i32 %4, %3
store i32 %add5, ptr @b, align 4, !tbaa !5
%5 = load i32, ptr @i, align 4, !tbaa !5
%inc7 = add nsw i32 %5, 1
store i32 %inc7, ptr @i, align 4, !tbaa !5
%cmp2 = icmp slt i32 %5, 3
br i1 %cmp2, label %for.body3, label %for.end8, !llvm.loop !11
for.end8: ; preds = %for.body3
%6 = load i32, ptr @a, align 4, !tbaa !5
%.add5.lcssa = tail call i32 @llvm.smax.i32(i32 %6, i32 %add5)
%call11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.add5.lcssa)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,j,t,n,a1,a2;
long long cost,cost1,cost2,cost3,cost4,ans;
scanf("%d",&t);
for (i=0;i<t;i++)
{
scanf("%d",&n);
long long a[n],b[n];
for (j=0;j<n;j++) scanf("%lld",&a[j]);
for (j=0;j<n;j++) scanf("%lld",&b[j]);
cost1=labs(a[0]-b[0])+labs(a[n-1]-b[n-1]);
cost2=labs(a[0]-b[n-1])+labs(a[n-1]-b[0]);
if (cost1<cost2) ans=cost1;
else ans=cost2;
for (j=0;j<n;j++)
{
if (j==0||labs(a[0]-b[j])<cost1) cost1=labs(a[0]-b[j]);
if (j==0||labs(a[n-1]-b[j])<cost2) cost2=labs(a[n-1]-b[j]);
if (j==0||labs(b[0]-a[j])<cost3) cost3=labs(b[0]-a[j]);
if (j==0||labs(b[n-1]-a[j])<cost4) cost4=labs(b[n-1]-a[j]);
}
cost=cost1+cost2+cost3+cost4;
if (cost<ans) ans=cost;
cost=labs(a[0]-b[0])+cost2+cost4;
if (cost<ans) ans=cost;
cost=labs(a[0]-b[n-1])+cost2+cost3;
if (cost<ans) ans=cost;
cost=labs(a[n-1]-b[0])+cost1+cost4;
if (cost<ans) ans=cost;
cost=labs(a[n-1]-b[n-1])+cost1+cost3;
if (cost<ans) ans=cost;
printf("%lld\n",ans);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27809/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27809/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp255 = icmp sgt i32 %0, 0
br i1 %cmp255, label %for.body, label %for.end151
for.body: ; preds = %entry, %for.end101
%i.0258 = phi i32 [ %inc150, %for.end101 ], [ 0, %entry ]
%cost4.0257 = phi i64 [ %cost4.1.lcssa, %for.end101 ], [ undef, %entry ]
%cost3.0256 = phi i64 [ %cost3.1.lcssa, %for.end101 ], [ undef, %entry ]
%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 i64, i64 %2, align 16
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = zext i32 %4 to i64
%vla2 = alloca i64, i64 %5, align 16
%cmp4241 = icmp sgt i32 %4, 0
br i1 %cmp4241, label %for.body5, label %for.end15
for.cond7.preheader: ; preds = %for.body5
%cmp8243 = icmp sgt i32 %6, 0
br i1 %cmp8243, label %for.body9, label %for.end15
for.body5: ; preds = %for.body, %for.body5
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body5 ], [ 0, %for.body ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, 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
%cmp4 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp4, label %for.body5, label %for.cond7.preheader, !llvm.loop !9
for.body9: ; preds = %for.cond7.preheader, %for.body9
%indvars.iv261 = phi i64 [ %indvars.iv.next262, %for.body9 ], [ 0, %for.cond7.preheader ]
%arrayidx11 = getelementptr inbounds i64, ptr %vla2, i64 %indvars.iv261
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx11)
%indvars.iv.next262 = add nuw nsw i64 %indvars.iv261, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp8 = icmp slt i64 %indvars.iv.next262, %9
br i1 %cmp8, label %for.body9, label %for.end15, !llvm.loop !11
for.end15: ; preds = %for.body9, %for.body, %for.cond7.preheader
%.lcssa = phi i32 [ %6, %for.cond7.preheader ], [ %4, %for.body ], [ %8, %for.body9 ]
%10 = load i64, ptr %vla, align 16, !tbaa !12
%11 = load i64, ptr %vla2, align 16, !tbaa !12
%sub = sub nsw i64 %10, %11
%12 = call i64 @llvm.abs.i64(i64 %sub, i1 true)
%sub18 = add nsw i32 %.lcssa, -1
%idxprom19 = sext i32 %sub18 to i64
%arrayidx20 = getelementptr inbounds i64, ptr %vla, i64 %idxprom19
%13 = load i64, ptr %arrayidx20, align 8, !tbaa !12
%arrayidx23 = getelementptr inbounds i64, ptr %vla2, i64 %idxprom19
%14 = load i64, ptr %arrayidx23, align 8, !tbaa !12
%sub24 = sub nsw i64 %13, %14
%15 = call i64 @llvm.abs.i64(i64 %sub24, i1 true)
%add = add nuw nsw i64 %15, %12
%sub29 = sub nsw i64 %10, %14
%16 = call i64 @llvm.abs.i64(i64 %sub29, i1 true)
%sub34 = sub nsw i64 %13, %11
%17 = call i64 @llvm.abs.i64(i64 %sub34, i1 true)
%add35 = add nuw nsw i64 %16, %17
%add.add35 = call i64 @llvm.umin.i64(i64 %add, i64 %add35)
%cmp38245 = icmp sgt i32 %.lcssa, 0
br i1 %cmp38245, label %for.inc99.peel, label %for.end101
for.inc99.peel: ; preds = %for.end15
%wide.trip.count = zext i32 %.lcssa to i64
%sub80240.peel = sub nsw i64 %11, %10
%18 = call i64 @llvm.abs.i64(i64 %sub80240.peel, i1 true)
%sub97.peel = sub nsw i64 %14, %10
%19 = call i64 @llvm.abs.i64(i64 %sub97.peel, i1 true)
%exitcond.peel.not = icmp eq i32 %.lcssa, 1
br i1 %exitcond.peel.not, label %for.end101, label %lor.lhs.false
lor.lhs.false: ; preds = %for.inc99.peel, %lor.lhs.false
%indvars.iv264 = phi i64 [ %indvars.iv.next265, %lor.lhs.false ], [ 1, %for.inc99.peel ]
%cost4.1249 = phi i64 [ %cost4.2, %lor.lhs.false ], [ %19, %for.inc99.peel ]
%cost3.1248 = phi i64 [ %cost3.2234, %lor.lhs.false ], [ %18, %for.inc99.peel ]
%cost2.0247 = phi i64 [ %cost2.1217, %lor.lhs.false ], [ %17, %for.inc99.peel ]
%cost1.0246 = phi i64 [ %spec.select272, %lor.lhs.false ], [ %12, %for.inc99.peel ]
%arrayidx43 = getelementptr inbounds i64, ptr %vla2, i64 %indvars.iv264
%20 = load i64, ptr %arrayidx43, align 8, !tbaa !12
%sub44 = sub nsw i64 %10, %20
%21 = call i64 @llvm.abs.i64(i64 %sub44, i1 true)
%spec.select272 = call i64 @llvm.smin.i64(i64 %21, i64 %cost1.0246)
%sub59 = sub nsw i64 %13, %20
%22 = call i64 @llvm.abs.i64(i64 %sub59, i1 true)
%cost2.1217 = call i64 @llvm.smin.i64(i64 %22, i64 %cost2.0247)
%arrayidx73 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv264
%23 = load i64, ptr %arrayidx73, align 8, !tbaa !12
%sub74 = sub nsw i64 %11, %23
%24 = call i64 @llvm.abs.i64(i64 %sub74, i1 true)
%cost3.2234 = call i64 @llvm.smin.i64(i64 %24, i64 %cost3.1248)
%sub89 = sub nsw i64 %14, %23
%25 = call i64 @llvm.abs.i64(i64 %sub89, i1 true)
%cost4.2 = call i64 @llvm.smin.i64(i64 %25, i64 %cost4.1249)
%indvars.iv.next265 = add nuw nsw i64 %indvars.iv264, 1
%exitcond.not = icmp eq i64 %indvars.iv.next265, %wide.trip.count
br i1 %exitcond.not, label %for.end101, label %lor.lhs.false, !llvm.loop !14
for.end101: ; preds = %lor.lhs.false, %for.inc99.peel, %for.end15
%cost1.0.lcssa = phi i64 [ %add, %for.end15 ], [ %12, %for.inc99.peel ], [ %spec.select272, %lor.lhs.false ]
%cost2.0.lcssa = phi i64 [ %add35, %for.end15 ], [ %17, %for.inc99.peel ], [ %cost2.1217, %lor.lhs.false ]
%cost3.1.lcssa = phi i64 [ %cost3.0256, %for.end15 ], [ %18, %for.inc99.peel ], [ %cost3.2234, %lor.lhs.false ]
%cost4.1.lcssa = phi i64 [ %cost4.0257, %for.end15 ], [ %19, %for.inc99.peel ], [ %cost4.2, %lor.lhs.false ]
%add102 = add i64 %cost3.1.lcssa, %cost1.0.lcssa
%add103 = add i64 %add102, %cost2.0.lcssa
%add104 = add nsw i64 %add103, %cost4.1.lcssa
%spec.select = call i64 @llvm.smin.i64(i64 %add104, i64 %add.add35)
%add111 = add i64 %cost4.1.lcssa, %cost2.0.lcssa
%add112 = add i64 %add111, %12
%ans.2 = call i64 @llvm.smin.i64(i64 %add112, i64 %spec.select)
%add121 = add i64 %cost3.1.lcssa, %cost2.0.lcssa
%add122 = add i64 %add121, %16
%ans.3 = call i64 @llvm.smin.i64(i64 %add122, i64 %ans.2)
%add131 = add i64 %cost4.1.lcssa, %cost1.0.lcssa
%add132 = add i64 %add131, %17
%ans.4 = call i64 @llvm.smin.i64(i64 %add132, i64 %ans.3)
%add144 = add i64 %add102, %15
%ans.5 = call i64 @llvm.smin.i64(i64 %add144, i64 %ans.4)
%call148 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.5)
call void @llvm.stackrestore.p0(ptr %3)
%inc150 = add nuw nsw i32 %i.0258, 1
%26 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc150, %26
br i1 %cmp, label %for.body, label %for.end151, !llvm.loop !16
for.end151: ; preds = %for.end101, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
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 speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #4
; 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 i64 @llvm.umin.i64(i64, i64) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10, !15}
!15 = !{!"llvm.loop.peeled.count", i32 1}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
int main(void)
{
int asub[4];
int bsub[4];
int asum, bsum;
int i;
scanf("%d %d %d %d", &asub[0], &asub[1], &asub[2], &asub[3]);
scanf("%d %d %d %d", &bsub[0], &bsub[1], &bsub[2], &bsub[3]);
asum = bsum = 0;
for (i = 0; i < 4; i++){
asum += asub[i];
bsum += bsub[i];
}
if (asum > bsum || asum == bsum){
printf("%d\n", asum);
}
else if (asum < bsum){
printf("%d\n", bsum);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278132/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278132/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%asub = alloca [4 x i32], align 16
%bsub = alloca [4 x i32], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %asub) #4
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %bsub) #4
%arrayidx1 = getelementptr inbounds [4 x i32], ptr %asub, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [4 x i32], ptr %asub, i64 0, i64 2
%arrayidx3 = getelementptr inbounds [4 x i32], ptr %asub, i64 0, i64 3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %asub, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3)
%arrayidx5 = getelementptr inbounds [4 x i32], ptr %bsub, i64 0, i64 1
%arrayidx6 = getelementptr inbounds [4 x i32], ptr %bsub, i64 0, i64 2
%arrayidx7 = getelementptr inbounds [4 x i32], ptr %bsub, i64 0, i64 3
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %bsub, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx6, ptr noundef nonnull %arrayidx7)
%0 = load <4 x i32>, ptr %asub, align 16, !tbaa !5
%1 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %0)
%2 = load <4 x i32>, ptr %bsub, align 16, !tbaa !5
%3 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %2)
%add12.3.add.3 = call i32 @llvm.smax.i32(i32 %1, i32 %3)
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add12.3.add.3)
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %bsub) #4
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %asub) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main() {
int i=0 , j=0 , in , sum[2]={0};
while ( i < 2 ) {
while ( j < 4 ) {
scanf("%d",&in);
sum[i]+=in;
j++;
}
i++;
}
if ( sum[0] >= sum[1] )
printf("%d\n",sum[0]);
else
printf("%d\n",sum[1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278198/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278198/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 {
while.end.1:
%in = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %in) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in)
%0 = load i32, ptr %in, align 4, !tbaa !5
%call.122 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in)
%1 = load i32, ptr %in, align 4, !tbaa !5
%add.123 = add nsw i32 %0, %1
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in)
%2 = load i32, ptr %in, align 4, !tbaa !5
%add.2 = add nsw i32 %add.123, %2
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in)
%3 = load i32, ptr %in, align 4, !tbaa !5
%add.3 = add nsw i32 %add.2, %3
%.add.3 = call i32 @llvm.smax.i32(i32 %add.3, i32 0)
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.add.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %in) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int judge(int,int);
int main(void){
int A[4],B[4],i,sumA,sumB;
sumA = sumB = 0;
for( i = 0 ; i < 4 ; i++ ){
scanf("%d" ,&A[i]);
sumA += A[i];
}
for( i = 0 ; i < 4 ; i++ ){
scanf("%d" ,&B[i]);
sumB += B[i];
}
printf("%d\n" ,judge(sumA,sumB));
return 0;
}
int judge(int sumA,int sumB){
if( sumA >= sumB ) return sumA;
else return sumB;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278255/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278255/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [4 x i32], align 16
%B = alloca [4 x i32], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %B) #5
%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)
%1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%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)
%2 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%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)
%3 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %B)
%4 = load i32, ptr %B, align 16, !tbaa !5
%arrayidx7.1 = getelementptr inbounds [4 x i32], ptr %B, i64 0, i64 1
%call8.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7.1)
%5 = load i32, ptr %arrayidx7.1, align 4, !tbaa !5
%add11.1 = add nsw i32 %5, %4
%arrayidx7.2 = getelementptr inbounds [4 x i32], ptr %B, i64 0, i64 2
%call8.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7.2)
%6 = load i32, ptr %arrayidx7.2, align 8, !tbaa !5
%add11.2 = add nsw i32 %6, %add11.1
%arrayidx7.3 = getelementptr inbounds [4 x i32], ptr %B, i64 0, i64 3
%call8.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7.3)
%7 = load i32, ptr %arrayidx7.3, align 4, !tbaa !5
%add11.3 = add nsw i32 %7, %add11.2
%add.1 = add nsw i32 %1, %0
%add.2 = add nsw i32 %2, %add.1
%add.3 = add nsw i32 %3, %add.2
%sumB.sumA.i = call i32 @llvm.smax.i32(i32 %add.3, i32 %add11.3)
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sumB.sumA.i)
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %B) #5
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %A) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @judge(i32 noundef %sumA, i32 noundef %sumB) local_unnamed_addr #3 {
entry:
%sumB.sumA = tail call i32 @llvm.smax.i32(i32 %sumA, i32 %sumB)
ret i32 %sumB.sumA
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
int get_int2(int *a1, int *a2) {
scanf("%d %d", a1, a2);
return 0;
}
// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int *arr, int size) {
int i;
for(i = 0; i < size; i++) {
scanf("%d", &arr[i]);
}
return 0;
}
#define NUM_MAX 500
// max: 250000 * 1000
#define INF (1e+9)
#define COLOR_MAX 30
#define GROUPS 3
int calc(int group[][COLOR_MAX+1], int *cs, int ds[][COLOR_MAX+1], int colors) {
int i, c;
int disorder = 0;
for(i = 0; i < GROUPS; i++) {
for(c = 1; c <= colors; c++) {
int before = c;
int after = cs[i];
disorder += ds[before][after] * group[i][c];
}
}
#ifdef DEBUG
printf("%d, %d, %d -> %d\n", cs[0], cs[1], cs[2], disorder);
#endif
return disorder;
}
int main(void) {
int num, colors;
get_int2(&num, &colors);
// 1-indexed
static int ds[COLOR_MAX+1][COLOR_MAX+1];
static int mat[NUM_MAX+1][NUM_MAX+1];
int i, j;
for(i = 1; i <= colors; i++) {
fget_array(&ds[i][1], colors);
}
for(i = 1; i <= num; i++) {
fget_array(&mat[i][1], num);
}
static int group[3][COLOR_MAX+1];
for(i = 1; i <= num; i++) {
for(j = 1; j <= num; j++) {
int c = mat[i][j];
group[(i+j)%3][c]++;
}
}
int c0, c1, c2; // c_(mod)
int ans = INF;
for(c0 = 1; c0 <= colors; c0++) {
for(c1 = 1; c1 <= colors; c1++) {
if(c0 == c1) continue;
for(c2 = 1; c2 <= colors; c2++) {
if(c1 == c2) continue;
if(c0 == c2) continue;
int cs[3] = {c0, c1, c2};
int res = calc(group, cs, ds, colors);
ans = min(ans, res);
}
}
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278305/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278305/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@main.ds = internal global [31 x [31 x i32]] zeroinitializer, align 16
@main.mat = internal global [501 x [501 x i32]] zeroinitializer, align 16
@main.group = internal unnamed_addr global [3 x [31 x i32]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int2(ptr noundef %a1, ptr noundef %a2) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %a1, ptr noundef %a2)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @fget_array(ptr noundef %arr, i32 noundef %size) local_unnamed_addr #0 {
entry:
%cmp3 = icmp sgt i32 %size, 0
br i1 %cmp3, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %size 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 ]
%arrayidx = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !5
for.end: ; preds = %for.body, %entry
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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(argmem: read) uwtable
define dso_local i32 @calc(ptr nocapture noundef readonly %group, ptr nocapture noundef readonly %cs, ptr nocapture noundef readonly %ds, i32 noundef %colors) local_unnamed_addr #3 {
entry:
%cmp2.not22 = icmp slt i32 %colors, 1
br i1 %cmp2.not22, label %for.end14, label %for.cond1.preheader.preheader
for.cond1.preheader.preheader: ; preds = %entry
%0 = add nuw i32 %colors, 1
%1 = load i32, ptr %cs, align 4, !tbaa !7
%idxprom6 = sext i32 %1 to i64
%wide.trip.count = zext i32 %0 to i64
%2 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %colors, 8
br i1 %min.iters.check, label %for.body3.preheader, label %vector.ph
vector.ph: ; preds = %for.cond1.preheader.preheader
%n.vec = and i64 %2, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %38, %vector.body ]
%vec.phi33 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %39, %vector.body ]
%offset.idx = or i64 %index, 1
%3 = or i64 %index, 2
%4 = or i64 %index, 3
%5 = or i64 %index, 4
%6 = or i64 %index, 5
%7 = or i64 %index, 6
%8 = or i64 %index, 7
%9 = add i64 %index, 8
%10 = getelementptr inbounds [31 x i32], ptr %ds, i64 %offset.idx, i64 %idxprom6
%11 = getelementptr inbounds [31 x i32], ptr %ds, i64 %3, i64 %idxprom6
%12 = getelementptr inbounds [31 x i32], ptr %ds, i64 %4, i64 %idxprom6
%13 = getelementptr inbounds [31 x i32], ptr %ds, i64 %5, i64 %idxprom6
%14 = getelementptr inbounds [31 x i32], ptr %ds, i64 %6, i64 %idxprom6
%15 = getelementptr inbounds [31 x i32], ptr %ds, i64 %7, i64 %idxprom6
%16 = getelementptr inbounds [31 x i32], ptr %ds, i64 %8, i64 %idxprom6
%17 = getelementptr inbounds [31 x i32], ptr %ds, i64 %9, i64 %idxprom6
%18 = load i32, ptr %10, align 4, !tbaa !7
%19 = load i32, ptr %11, align 4, !tbaa !7
%20 = load i32, ptr %12, align 4, !tbaa !7
%21 = load i32, ptr %13, align 4, !tbaa !7
%22 = insertelement <4 x i32> poison, i32 %18, i64 0
%23 = insertelement <4 x i32> %22, i32 %19, i64 1
%24 = insertelement <4 x i32> %23, i32 %20, i64 2
%25 = insertelement <4 x i32> %24, i32 %21, i64 3
%26 = load i32, ptr %14, align 4, !tbaa !7
%27 = load i32, ptr %15, align 4, !tbaa !7
%28 = load i32, ptr %16, align 4, !tbaa !7
%29 = load i32, ptr %17, align 4, !tbaa !7
%30 = insertelement <4 x i32> poison, i32 %26, i64 0
%31 = insertelement <4 x i32> %30, i32 %27, i64 1
%32 = insertelement <4 x i32> %31, i32 %28, i64 2
%33 = insertelement <4 x i32> %32, i32 %29, i64 3
%34 = getelementptr inbounds [31 x i32], ptr %group, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %34, align 4, !tbaa !7
%35 = getelementptr inbounds i32, ptr %34, i64 4
%wide.load34 = load <4 x i32>, ptr %35, align 4, !tbaa !7
%36 = mul nsw <4 x i32> %wide.load, %25
%37 = mul nsw <4 x i32> %wide.load34, %33
%38 = add <4 x i32> %36, %vec.phi
%39 = add <4 x i32> %37, %vec.phi33
%index.next = add nuw i64 %index, 8
%40 = icmp eq i64 %index.next, %n.vec
br i1 %40, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %39, %38
%41 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %2, %n.vec
br i1 %cmp.n, label %for.cond1.for.inc12_crit_edge, label %for.body3.preheader
for.body3.preheader: ; preds = %for.cond1.preheader.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 1, %for.cond1.preheader.preheader ], [ %ind.end, %middle.block ]
%disorder.123.ph = phi i32 [ 0, %for.cond1.preheader.preheader ], [ %41, %middle.block ]
br label %for.body3
for.body3: ; preds = %for.body3.preheader, %for.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ %indvars.iv.ph, %for.body3.preheader ]
%disorder.123 = phi i32 [ %add, %for.body3 ], [ %disorder.123.ph, %for.body3.preheader ]
%arrayidx7 = getelementptr inbounds [31 x i32], ptr %ds, i64 %indvars.iv, i64 %idxprom6
%42 = load i32, ptr %arrayidx7, align 4, !tbaa !7
%arrayidx11 = getelementptr inbounds [31 x i32], ptr %group, i64 0, i64 %indvars.iv
%43 = load i32, ptr %arrayidx11, align 4, !tbaa !7
%mul = mul nsw i32 %43, %42
%add = add nsw i32 %mul, %disorder.123
%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.inc12_crit_edge, label %for.body3, !llvm.loop !14
for.cond1.for.inc12_crit_edge: ; preds = %for.body3, %middle.block
%add.lcssa = phi i32 [ %41, %middle.block ], [ %add, %for.body3 ]
%arrayidx.1 = getelementptr inbounds i32, ptr %cs, i64 1
%44 = load i32, ptr %arrayidx.1, align 4, !tbaa !7
%idxprom6.1 = sext i32 %44 to i64
%45 = add nsw i64 %wide.trip.count, -1
%min.iters.check37 = icmp ult i32 %colors, 8
br i1 %min.iters.check37, label %for.body3.1.preheader, label %vector.ph38
vector.ph38: ; preds = %for.cond1.for.inc12_crit_edge
%n.vec40 = and i64 %45, -8
%ind.end41 = or i64 %n.vec40, 1
%46 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %add.lcssa, i64 0
br label %vector.body44
vector.body44: ; preds = %vector.body44, %vector.ph38
%index45 = phi i64 [ 0, %vector.ph38 ], [ %index.next51, %vector.body44 ]
%vec.phi46 = phi <4 x i32> [ %46, %vector.ph38 ], [ %82, %vector.body44 ]
%vec.phi47 = phi <4 x i32> [ zeroinitializer, %vector.ph38 ], [ %83, %vector.body44 ]
%offset.idx48 = or i64 %index45, 1
%47 = or i64 %index45, 2
%48 = or i64 %index45, 3
%49 = or i64 %index45, 4
%50 = or i64 %index45, 5
%51 = or i64 %index45, 6
%52 = or i64 %index45, 7
%53 = add i64 %index45, 8
%54 = getelementptr inbounds [31 x i32], ptr %ds, i64 %offset.idx48, i64 %idxprom6.1
%55 = getelementptr inbounds [31 x i32], ptr %ds, i64 %47, i64 %idxprom6.1
%56 = getelementptr inbounds [31 x i32], ptr %ds, i64 %48, i64 %idxprom6.1
%57 = getelementptr inbounds [31 x i32], ptr %ds, i64 %49, i64 %idxprom6.1
%58 = getelementptr inbounds [31 x i32], ptr %ds, i64 %50, i64 %idxprom6.1
%59 = getelementptr inbounds [31 x i32], ptr %ds, i64 %51, i64 %idxprom6.1
%60 = getelementptr inbounds [31 x i32], ptr %ds, i64 %52, i64 %idxprom6.1
%61 = getelementptr inbounds [31 x i32], ptr %ds, i64 %53, i64 %idxprom6.1
%62 = load i32, ptr %54, align 4, !tbaa !7
%63 = load i32, ptr %55, align 4, !tbaa !7
%64 = load i32, ptr %56, align 4, !tbaa !7
%65 = load i32, ptr %57, align 4, !tbaa !7
%66 = insertelement <4 x i32> poison, i32 %62, i64 0
%67 = insertelement <4 x i32> %66, i32 %63, i64 1
%68 = insertelement <4 x i32> %67, i32 %64, i64 2
%69 = insertelement <4 x i32> %68, i32 %65, i64 3
%70 = load i32, ptr %58, align 4, !tbaa !7
%71 = load i32, ptr %59, align 4, !tbaa !7
%72 = load i32, ptr %60, align 4, !tbaa !7
%73 = load i32, ptr %61, align 4, !tbaa !7
%74 = insertelement <4 x i32> poison, i32 %70, i64 0
%75 = insertelement <4 x i32> %74, i32 %71, i64 1
%76 = insertelement <4 x i32> %75, i32 %72, i64 2
%77 = insertelement <4 x i32> %76, i32 %73, i64 3
%78 = getelementptr inbounds [31 x i32], ptr %group, i64 1, i64 %offset.idx48
%wide.load49 = load <4 x i32>, ptr %78, align 4, !tbaa !7
%79 = getelementptr inbounds i32, ptr %78, i64 4
%wide.load50 = load <4 x i32>, ptr %79, align 4, !tbaa !7
%80 = mul nsw <4 x i32> %wide.load49, %69
%81 = mul nsw <4 x i32> %wide.load50, %77
%82 = add <4 x i32> %80, %vec.phi46
%83 = add <4 x i32> %81, %vec.phi47
%index.next51 = add nuw i64 %index45, 8
%84 = icmp eq i64 %index.next51, %n.vec40
br i1 %84, label %middle.block35, label %vector.body44, !llvm.loop !15
middle.block35: ; preds = %vector.body44
%bin.rdx52 = add <4 x i32> %83, %82
%85 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx52)
%cmp.n43 = icmp eq i64 %45, %n.vec40
br i1 %cmp.n43, label %for.cond1.for.inc12_crit_edge.1, label %for.body3.1.preheader
for.body3.1.preheader: ; preds = %for.cond1.for.inc12_crit_edge, %middle.block35
%indvars.iv.1.ph = phi i64 [ 1, %for.cond1.for.inc12_crit_edge ], [ %ind.end41, %middle.block35 ]
%disorder.123.1.ph = phi i32 [ %add.lcssa, %for.cond1.for.inc12_crit_edge ], [ %85, %middle.block35 ]
br label %for.body3.1
for.body3.1: ; preds = %for.body3.1.preheader, %for.body3.1
%indvars.iv.1 = phi i64 [ %indvars.iv.next.1, %for.body3.1 ], [ %indvars.iv.1.ph, %for.body3.1.preheader ]
%disorder.123.1 = phi i32 [ %add.1, %for.body3.1 ], [ %disorder.123.1.ph, %for.body3.1.preheader ]
%arrayidx7.1 = getelementptr inbounds [31 x i32], ptr %ds, i64 %indvars.iv.1, i64 %idxprom6.1
%86 = load i32, ptr %arrayidx7.1, align 4, !tbaa !7
%arrayidx11.1 = getelementptr inbounds [31 x i32], ptr %group, i64 1, i64 %indvars.iv.1
%87 = load i32, ptr %arrayidx11.1, align 4, !tbaa !7
%mul.1 = mul nsw i32 %87, %86
%add.1 = add nsw i32 %mul.1, %disorder.123.1
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 1
%exitcond.1.not = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
br i1 %exitcond.1.not, label %for.cond1.for.inc12_crit_edge.1, label %for.body3.1, !llvm.loop !16
for.cond1.for.inc12_crit_edge.1: ; preds = %for.body3.1, %middle.block35
%add.1.lcssa = phi i32 [ %85, %middle.block35 ], [ %add.1, %for.body3.1 ]
%arrayidx.2 = getelementptr inbounds i32, ptr %cs, i64 2
%88 = load i32, ptr %arrayidx.2, align 4, !tbaa !7
%idxprom6.2 = sext i32 %88 to i64
%89 = add nsw i64 %wide.trip.count, -1
%min.iters.check56 = icmp ult i32 %colors, 8
br i1 %min.iters.check56, label %for.body3.2.preheader, label %vector.ph57
vector.ph57: ; preds = %for.cond1.for.inc12_crit_edge.1
%n.vec59 = and i64 %89, -8
%ind.end60 = or i64 %n.vec59, 1
%90 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %add.1.lcssa, i64 0
br label %vector.body63
vector.body63: ; preds = %vector.body63, %vector.ph57
%index64 = phi i64 [ 0, %vector.ph57 ], [ %index.next70, %vector.body63 ]
%vec.phi65 = phi <4 x i32> [ %90, %vector.ph57 ], [ %126, %vector.body63 ]
%vec.phi66 = phi <4 x i32> [ zeroinitializer, %vector.ph57 ], [ %127, %vector.body63 ]
%offset.idx67 = or i64 %index64, 1
%91 = or i64 %index64, 2
%92 = or i64 %index64, 3
%93 = or i64 %index64, 4
%94 = or i64 %index64, 5
%95 = or i64 %index64, 6
%96 = or i64 %index64, 7
%97 = add i64 %index64, 8
%98 = getelementptr inbounds [31 x i32], ptr %ds, i64 %offset.idx67, i64 %idxprom6.2
%99 = getelementptr inbounds [31 x i32], ptr %ds, i64 %91, i64 %idxprom6.2
%100 = getelementptr inbounds [31 x i32], ptr %ds, i64 %92, i64 %idxprom6.2
%101 = getelementptr inbounds [31 x i32], ptr %ds, i64 %93, i64 %idxprom6.2
%102 = getelementptr inbounds [31 x i32], ptr %ds, i64 %94, i64 %idxprom6.2
%103 = getelementptr inbounds [31 x i32], ptr %ds, i64 %95, i64 %idxprom6.2
%104 = getelementptr inbounds [31 x i32], ptr %ds, i64 %96, i64 %idxprom6.2
%105 = getelementptr inbounds [31 x i32], ptr %ds, i64 %97, i64 %idxprom6.2
%106 = load i32, ptr %98, align 4, !tbaa !7
%107 = load i32, ptr %99, align 4, !tbaa !7
%108 = load i32, ptr %100, align 4, !tbaa !7
%109 = load i32, ptr %101, align 4, !tbaa !7
%110 = insertelement <4 x i32> poison, i32 %106, i64 0
%111 = insertelement <4 x i32> %110, i32 %107, i64 1
%112 = insertelement <4 x i32> %111, i32 %108, i64 2
%113 = insertelement <4 x i32> %112, i32 %109, i64 3
%114 = load i32, ptr %102, align 4, !tbaa !7
%115 = load i32, ptr %103, align 4, !tbaa !7
%116 = load i32, ptr %104, align 4, !tbaa !7
%117 = load i32, ptr %105, align 4, !tbaa !7
%118 = insertelement <4 x i32> poison, i32 %114, i64 0
%119 = insertelement <4 x i32> %118, i32 %115, i64 1
%120 = insertelement <4 x i32> %119, i32 %116, i64 2
%121 = insertelement <4 x i32> %120, i32 %117, i64 3
%122 = getelementptr inbounds [31 x i32], ptr %group, i64 2, i64 %offset.idx67
%wide.load68 = load <4 x i32>, ptr %122, align 4, !tbaa !7
%123 = getelementptr inbounds i32, ptr %122, i64 4
%wide.load69 = load <4 x i32>, ptr %123, align 4, !tbaa !7
%124 = mul nsw <4 x i32> %wide.load68, %113
%125 = mul nsw <4 x i32> %wide.load69, %121
%126 = add <4 x i32> %124, %vec.phi65
%127 = add <4 x i32> %125, %vec.phi66
%index.next70 = add nuw i64 %index64, 8
%128 = icmp eq i64 %index.next70, %n.vec59
br i1 %128, label %middle.block54, label %vector.body63, !llvm.loop !17
middle.block54: ; preds = %vector.body63
%bin.rdx71 = add <4 x i32> %127, %126
%129 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx71)
%cmp.n62 = icmp eq i64 %89, %n.vec59
br i1 %cmp.n62, label %for.end14, label %for.body3.2.preheader
for.body3.2.preheader: ; preds = %for.cond1.for.inc12_crit_edge.1, %middle.block54
%indvars.iv.2.ph = phi i64 [ 1, %for.cond1.for.inc12_crit_edge.1 ], [ %ind.end60, %middle.block54 ]
%disorder.123.2.ph = phi i32 [ %add.1.lcssa, %for.cond1.for.inc12_crit_edge.1 ], [ %129, %middle.block54 ]
br label %for.body3.2
for.body3.2: ; preds = %for.body3.2.preheader, %for.body3.2
%indvars.iv.2 = phi i64 [ %indvars.iv.next.2, %for.body3.2 ], [ %indvars.iv.2.ph, %for.body3.2.preheader ]
%disorder.123.2 = phi i32 [ %add.2, %for.body3.2 ], [ %disorder.123.2.ph, %for.body3.2.preheader ]
%arrayidx7.2 = getelementptr inbounds [31 x i32], ptr %ds, i64 %indvars.iv.2, i64 %idxprom6.2
%130 = load i32, ptr %arrayidx7.2, align 4, !tbaa !7
%arrayidx11.2 = getelementptr inbounds [31 x i32], ptr %group, i64 2, i64 %indvars.iv.2
%131 = load i32, ptr %arrayidx11.2, align 4, !tbaa !7
%mul.2 = mul nsw i32 %131, %130
%add.2 = add nsw i32 %mul.2, %disorder.123.2
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv.2, 1
%exitcond.2.not = icmp eq i64 %indvars.iv.next.2, %wide.trip.count
br i1 %exitcond.2.not, label %for.end14, label %for.body3.2, !llvm.loop !18
for.end14: ; preds = %for.body3.2, %middle.block54, %entry
%.us-phi = phi i32 [ 0, %entry ], [ %129, %middle.block54 ], [ %add.2, %for.body3.2 ]
ret i32 %.us-phi
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%colors = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %colors) #5
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num, ptr noundef nonnull %colors)
%0 = load i32, ptr %colors, align 4, !tbaa !7
%cmp.not106 = icmp slt i32 %0, 1
br i1 %cmp.not106, label %for.cond3.preheader, label %for.body
for.cond3.preheader: ; preds = %fget_array.exit, %entry
%1 = load i32, ptr %num, align 4, !tbaa !7
%cmp4.not108 = icmp slt i32 %1, 1
br i1 %cmp4.not108, label %for.cond34.preheader, label %for.body5
for.body: ; preds = %entry, %fget_array.exit
%2 = phi i32 [ %3, %fget_array.exit ], [ %0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %fget_array.exit ], [ 1, %entry ]
%arrayidx1 = getelementptr inbounds [31 x [31 x i32]], ptr @main.ds, i64 0, i64 %indvars.iv, i64 1
%cmp3.i = icmp sgt i32 %2, 0
br i1 %cmp3.i, label %for.body.preheader.i, label %fget_array.exit
for.body.preheader.i: ; preds = %for.body
%wide.trip.count.i = zext i32 %2 to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %arrayidx1, i64 %indvars.iv.i
%call.i91 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.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 %fget_array.exit.loopexit, label %for.body.i, !llvm.loop !5
fget_array.exit.loopexit: ; preds = %for.body.i
%.pre = load i32, ptr %colors, align 4, !tbaa !7
br label %fget_array.exit
fget_array.exit: ; preds = %fget_array.exit.loopexit, %for.body
%3 = phi i32 [ %.pre, %fget_array.exit.loopexit ], [ %2, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = sext i32 %3 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %4
br i1 %cmp.not.not, label %for.body, label %for.cond3.preheader, !llvm.loop !19
for.cond13.preheader: ; preds = %fget_array.exit101
%cmp14.not112 = icmp slt i32 %9, 1
br i1 %cmp14.not112, label %for.cond34.preheader, label %for.cond16.preheader.preheader
for.cond16.preheader.preheader: ; preds = %for.cond13.preheader
%5 = add nuw i32 %9, 1
%wide.trip.count140 = zext i32 %5 to i64
%6 = add nsw i64 %wide.trip.count140, -1
%xtraiter = and i64 %6, 1
%7 = icmp eq i32 %5, 2
%unroll_iter = and i64 %6, -2
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond16.preheader
for.body5: ; preds = %for.cond3.preheader, %fget_array.exit101
%8 = phi i32 [ %9, %fget_array.exit101 ], [ %1, %for.cond3.preheader ]
%indvars.iv130 = phi i64 [ %indvars.iv.next131, %fget_array.exit101 ], [ 1, %for.cond3.preheader ]
%arrayidx8 = getelementptr inbounds [501 x [501 x i32]], ptr @main.mat, i64 0, i64 %indvars.iv130, i64 1
%cmp3.i92 = icmp sgt i32 %8, 0
br i1 %cmp3.i92, label %for.body.preheader.i93, label %fget_array.exit101
for.body.preheader.i93: ; preds = %for.body5
%wide.trip.count.i94 = zext i32 %8 to i64
br label %for.body.i95
for.body.i95: ; preds = %for.body.i95, %for.body.preheader.i93
%indvars.iv.i96 = phi i64 [ 0, %for.body.preheader.i93 ], [ %indvars.iv.next.i99, %for.body.i95 ]
%arrayidx.i97 = getelementptr inbounds i32, ptr %arrayidx8, i64 %indvars.iv.i96
%call.i98 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.i97)
%indvars.iv.next.i99 = add nuw nsw i64 %indvars.iv.i96, 1
%exitcond.not.i100 = icmp eq i64 %indvars.iv.next.i99, %wide.trip.count.i94
br i1 %exitcond.not.i100, label %fget_array.exit101.loopexit, label %for.body.i95, !llvm.loop !5
fget_array.exit101.loopexit: ; preds = %for.body.i95
%.pre157 = load i32, ptr %num, align 4, !tbaa !7
br label %fget_array.exit101
fget_array.exit101: ; preds = %fget_array.exit101.loopexit, %for.body5
%9 = phi i32 [ %.pre157, %fget_array.exit101.loopexit ], [ %8, %for.body5 ]
%indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
%10 = sext i32 %9 to i64
%cmp4.not.not = icmp slt i64 %indvars.iv130, %10
br i1 %cmp4.not.not, label %for.body5, label %for.cond13.preheader, !llvm.loop !20
for.cond16.preheader: ; preds = %for.cond16.preheader.preheader, %for.cond16.for.inc31_crit_edge
%indvars.iv137 = phi i64 [ 1, %for.cond16.preheader.preheader ], [ %indvars.iv.next138, %for.cond16.for.inc31_crit_edge ]
br i1 %7, label %for.cond16.for.inc31_crit_edge.unr-lcssa, label %for.body18
for.cond34.preheader: ; preds = %for.cond16.for.inc31_crit_edge, %for.cond3.preheader, %for.cond13.preheader
%11 = load i32, ptr %colors, align 4, !tbaa !7
%cmp35.not124 = icmp slt i32 %11, 1
br i1 %cmp35.not124, label %for.end61, label %for.cond37.preheader.lr.ph
for.cond37.preheader.lr.ph: ; preds = %for.cond34.preheader
%12 = add i32 %11, 1
%wide.trip.count.i102 = zext i32 %12 to i64
%13 = add nsw i64 %wide.trip.count.i102, -1
%14 = add nsw i64 %wide.trip.count.i102, -1
%15 = add nsw i64 %wide.trip.count.i102, -1
%min.iters.check183 = icmp ult i64 %15, 8
%n.vec186 = and i64 %15, -8
%ind.end187 = or i64 %n.vec186, 1
%cmp.n189 = icmp eq i64 %15, %n.vec186
%min.iters.check164 = icmp ult i64 %14, 8
%n.vec167 = and i64 %14, -8
%ind.end168 = or i64 %n.vec167, 1
%cmp.n170 = icmp eq i64 %14, %n.vec167
%min.iters.check = icmp ult i64 %13, 8
%n.vec = and i64 %13, -8
%ind.end = or i64 %n.vec, 1
%cmp.n = icmp eq i64 %13, %n.vec
br label %for.cond37.preheader
for.body18: ; preds = %for.cond16.preheader, %for.body18
%indvars.iv133 = phi i64 [ %indvars.iv.next134.1, %for.body18 ], [ 1, %for.cond16.preheader ]
%niter = phi i64 [ %niter.next.1, %for.body18 ], [ 0, %for.cond16.preheader ]
%arrayidx22 = getelementptr inbounds [501 x [501 x i32]], ptr @main.mat, i64 0, i64 %indvars.iv137, i64 %indvars.iv133
%16 = load i32, ptr %arrayidx22, align 4, !tbaa !7
%17 = add nuw nsw i64 %indvars.iv133, %indvars.iv137
%18 = trunc i64 %17 to i32
%rem = urem i32 %18, 3
%idxprom23 = zext i32 %rem to i64
%idxprom25 = sext i32 %16 to i64
%arrayidx26 = getelementptr inbounds [3 x [31 x i32]], ptr @main.group, i64 0, i64 %idxprom23, i64 %idxprom25
%19 = load i32, ptr %arrayidx26, align 4, !tbaa !7
%inc27 = add nsw i32 %19, 1
store i32 %inc27, ptr %arrayidx26, align 4, !tbaa !7
%indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
%arrayidx22.1 = getelementptr inbounds [501 x [501 x i32]], ptr @main.mat, i64 0, i64 %indvars.iv137, i64 %indvars.iv.next134
%20 = load i32, ptr %arrayidx22.1, align 4, !tbaa !7
%21 = add nuw nsw i64 %indvars.iv.next134, %indvars.iv137
%22 = trunc i64 %21 to i32
%rem.1 = urem i32 %22, 3
%idxprom23.1 = zext i32 %rem.1 to i64
%idxprom25.1 = sext i32 %20 to i64
%arrayidx26.1 = getelementptr inbounds [3 x [31 x i32]], ptr @main.group, i64 0, i64 %idxprom23.1, i64 %idxprom25.1
%23 = load i32, ptr %arrayidx26.1, align 4, !tbaa !7
%inc27.1 = add nsw i32 %23, 1
store i32 %inc27.1, ptr %arrayidx26.1, align 4, !tbaa !7
%indvars.iv.next134.1 = add nuw nsw i64 %indvars.iv133, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond16.for.inc31_crit_edge.unr-lcssa, label %for.body18, !llvm.loop !21
for.cond16.for.inc31_crit_edge.unr-lcssa: ; preds = %for.body18, %for.cond16.preheader
%indvars.iv133.unr = phi i64 [ 1, %for.cond16.preheader ], [ %indvars.iv.next134.1, %for.body18 ]
br i1 %lcmp.mod.not, label %for.cond16.for.inc31_crit_edge, label %for.body18.epil
for.body18.epil: ; preds = %for.cond16.for.inc31_crit_edge.unr-lcssa
%arrayidx22.epil = getelementptr inbounds [501 x [501 x i32]], ptr @main.mat, i64 0, i64 %indvars.iv137, i64 %indvars.iv133.unr
%24 = load i32, ptr %arrayidx22.epil, align 4, !tbaa !7
%25 = add nuw nsw i64 %indvars.iv133.unr, %indvars.iv137
%26 = trunc i64 %25 to i32
%rem.epil = urem i32 %26, 3
%idxprom23.epil = zext i32 %rem.epil to i64
%idxprom25.epil = sext i32 %24 to i64
%arrayidx26.epil = getelementptr inbounds [3 x [31 x i32]], ptr @main.group, i64 0, i64 %idxprom23.epil, i64 %idxprom25.epil
%27 = load i32, ptr %arrayidx26.epil, align 4, !tbaa !7
%inc27.epil = add nsw i32 %27, 1
store i32 %inc27.epil, ptr %arrayidx26.epil, align 4, !tbaa !7
br label %for.cond16.for.inc31_crit_edge
for.cond16.for.inc31_crit_edge: ; preds = %for.cond16.for.inc31_crit_edge.unr-lcssa, %for.body18.epil
%indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
%exitcond141.not = icmp eq i64 %indvars.iv.next138, %wide.trip.count140
br i1 %exitcond141.not, label %for.cond34.preheader, label %for.cond16.preheader, !llvm.loop !22
for.cond37.preheader: ; preds = %for.cond37.preheader.lr.ph, %for.cond37.for.inc59_crit_edge.split
%indvars.iv152 = phi i64 [ 1, %for.cond37.preheader.lr.ph ], [ %indvars.iv.next153, %for.cond37.for.inc59_crit_edge.split ]
%ans.0126 = phi i32 [ 1000000000, %for.cond37.preheader.lr.ph ], [ %ans.4, %for.cond37.for.inc59_crit_edge.split ]
br label %for.body39
for.body39: ; preds = %for.cond37.preheader, %for.inc56
%indvars.iv147 = phi i64 [ 1, %for.cond37.preheader ], [ %indvars.iv.next148, %for.inc56 ]
%ans.1122 = phi i32 [ %ans.0126, %for.cond37.preheader ], [ %ans.4, %for.inc56 ]
%cmp40 = icmp eq i64 %indvars.iv152, %indvars.iv147
br i1 %cmp40, label %for.inc56, label %for.body43
for.body43: ; preds = %for.body39, %for.inc53
%indvars.iv142 = phi i64 [ %indvars.iv.next143, %for.inc53 ], [ 1, %for.body39 ]
%ans.2117 = phi i32 [ %ans.3, %for.inc53 ], [ %ans.1122, %for.body39 ]
%cmp44 = icmp eq i64 %indvars.iv147, %indvars.iv142
%cmp47 = icmp eq i64 %indvars.iv152, %indvars.iv142
%or.cond = or i1 %cmp44, %cmp47
br i1 %or.cond, label %for.inc53, label %for.body3.i.preheader
for.body3.i.preheader: ; preds = %for.body43
br i1 %min.iters.check183, label %for.body3.i.preheader202, label %vector.body190
vector.body190: ; preds = %for.body3.i.preheader, %vector.body190
%index191 = phi i64 [ %index.next197, %vector.body190 ], [ 0, %for.body3.i.preheader ]
%vec.phi192 = phi <4 x i32> [ %63, %vector.body190 ], [ zeroinitializer, %for.body3.i.preheader ]
%vec.phi193 = phi <4 x i32> [ %64, %vector.body190 ], [ zeroinitializer, %for.body3.i.preheader ]
%offset.idx194 = or i64 %index191, 1
%28 = or i64 %index191, 2
%29 = or i64 %index191, 3
%30 = or i64 %index191, 4
%31 = or i64 %index191, 5
%32 = or i64 %index191, 6
%33 = or i64 %index191, 7
%34 = add i64 %index191, 8
%35 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %offset.idx194, i64 %indvars.iv152
%36 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %28, i64 %indvars.iv152
%37 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %29, i64 %indvars.iv152
%38 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %30, i64 %indvars.iv152
%39 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %31, i64 %indvars.iv152
%40 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %32, i64 %indvars.iv152
%41 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %33, i64 %indvars.iv152
%42 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %34, i64 %indvars.iv152
%43 = load i32, ptr %35, align 4, !tbaa !7
%44 = load i32, ptr %36, align 4, !tbaa !7
%45 = load i32, ptr %37, align 4, !tbaa !7
%46 = load i32, ptr %38, align 4, !tbaa !7
%47 = insertelement <4 x i32> poison, i32 %43, i64 0
%48 = insertelement <4 x i32> %47, i32 %44, i64 1
%49 = insertelement <4 x i32> %48, i32 %45, i64 2
%50 = insertelement <4 x i32> %49, i32 %46, i64 3
%51 = load i32, ptr %39, align 4, !tbaa !7
%52 = load i32, ptr %40, align 4, !tbaa !7
%53 = load i32, ptr %41, align 4, !tbaa !7
%54 = load i32, ptr %42, align 4, !tbaa !7
%55 = insertelement <4 x i32> poison, i32 %51, i64 0
%56 = insertelement <4 x i32> %55, i32 %52, i64 1
%57 = insertelement <4 x i32> %56, i32 %53, i64 2
%58 = insertelement <4 x i32> %57, i32 %54, i64 3
%59 = getelementptr inbounds [31 x i32], ptr @main.group, i64 0, i64 %offset.idx194
%wide.load195 = load <4 x i32>, ptr %59, align 4, !tbaa !7
%60 = getelementptr inbounds i32, ptr %59, i64 4
%wide.load196 = load <4 x i32>, ptr %60, align 4, !tbaa !7
%61 = mul nsw <4 x i32> %wide.load195, %50
%62 = mul nsw <4 x i32> %wide.load196, %58
%63 = add <4 x i32> %61, %vec.phi192
%64 = add <4 x i32> %62, %vec.phi193
%index.next197 = add nuw i64 %index191, 8
%65 = icmp eq i64 %index.next197, %n.vec186
br i1 %65, label %middle.block181, label %vector.body190, !llvm.loop !23
middle.block181: ; preds = %vector.body190
%bin.rdx198 = add <4 x i32> %64, %63
%66 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx198)
br i1 %cmp.n189, label %for.body3.1.i.preheader, label %for.body3.i.preheader202
for.body3.i.preheader202: ; preds = %for.body3.i.preheader, %middle.block181
%indvars.iv.i103.ph = phi i64 [ 1, %for.body3.i.preheader ], [ %ind.end187, %middle.block181 ]
%disorder.123.i.ph = phi i32 [ 0, %for.body3.i.preheader ], [ %66, %middle.block181 ]
br label %for.body3.i
for.body3.i: ; preds = %for.body3.i.preheader202, %for.body3.i
%indvars.iv.i103 = phi i64 [ %indvars.iv.next.i104, %for.body3.i ], [ %indvars.iv.i103.ph, %for.body3.i.preheader202 ]
%disorder.123.i = phi i32 [ %add.i, %for.body3.i ], [ %disorder.123.i.ph, %for.body3.i.preheader202 ]
%arrayidx7.i = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %indvars.iv.i103, i64 %indvars.iv152
%67 = load i32, ptr %arrayidx7.i, align 4, !tbaa !7
%arrayidx11.i = getelementptr inbounds [31 x i32], ptr @main.group, i64 0, i64 %indvars.iv.i103
%68 = load i32, ptr %arrayidx11.i, align 4, !tbaa !7
%mul.i = mul nsw i32 %68, %67
%add.i = add nsw i32 %mul.i, %disorder.123.i
%indvars.iv.next.i104 = add nuw nsw i64 %indvars.iv.i103, 1
%exitcond.not.i105 = icmp eq i64 %indvars.iv.next.i104, %wide.trip.count.i102
br i1 %exitcond.not.i105, label %for.body3.1.i.preheader, label %for.body3.i, !llvm.loop !24
for.body3.1.i.preheader: ; preds = %for.body3.i, %middle.block181
%add.i.lcssa = phi i32 [ %66, %middle.block181 ], [ %add.i, %for.body3.i ]
br i1 %min.iters.check164, label %for.body3.1.i.preheader201, label %vector.ph165
vector.ph165: ; preds = %for.body3.1.i.preheader
%69 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %add.i.lcssa, i64 0
br label %vector.body171
vector.body171: ; preds = %vector.body171, %vector.ph165
%index172 = phi i64 [ 0, %vector.ph165 ], [ %index.next178, %vector.body171 ]
%vec.phi173 = phi <4 x i32> [ %69, %vector.ph165 ], [ %105, %vector.body171 ]
%vec.phi174 = phi <4 x i32> [ zeroinitializer, %vector.ph165 ], [ %106, %vector.body171 ]
%offset.idx175 = or i64 %index172, 1
%70 = or i64 %index172, 2
%71 = or i64 %index172, 3
%72 = or i64 %index172, 4
%73 = or i64 %index172, 5
%74 = or i64 %index172, 6
%75 = or i64 %index172, 7
%76 = add i64 %index172, 8
%77 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %offset.idx175, i64 %indvars.iv147
%78 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %70, i64 %indvars.iv147
%79 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %71, i64 %indvars.iv147
%80 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %72, i64 %indvars.iv147
%81 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %73, i64 %indvars.iv147
%82 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %74, i64 %indvars.iv147
%83 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %75, i64 %indvars.iv147
%84 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %76, i64 %indvars.iv147
%85 = load i32, ptr %77, align 4, !tbaa !7
%86 = load i32, ptr %78, align 4, !tbaa !7
%87 = load i32, ptr %79, align 4, !tbaa !7
%88 = load i32, ptr %80, align 4, !tbaa !7
%89 = insertelement <4 x i32> poison, i32 %85, i64 0
%90 = insertelement <4 x i32> %89, i32 %86, i64 1
%91 = insertelement <4 x i32> %90, i32 %87, i64 2
%92 = insertelement <4 x i32> %91, i32 %88, i64 3
%93 = load i32, ptr %81, align 4, !tbaa !7
%94 = load i32, ptr %82, align 4, !tbaa !7
%95 = load i32, ptr %83, align 4, !tbaa !7
%96 = load i32, ptr %84, align 4, !tbaa !7
%97 = insertelement <4 x i32> poison, i32 %93, i64 0
%98 = insertelement <4 x i32> %97, i32 %94, i64 1
%99 = insertelement <4 x i32> %98, i32 %95, i64 2
%100 = insertelement <4 x i32> %99, i32 %96, i64 3
%101 = getelementptr inbounds [31 x i32], ptr @main.group, i64 1, i64 %offset.idx175
%wide.load176 = load <4 x i32>, ptr %101, align 16, !tbaa !7
%102 = getelementptr inbounds i32, ptr %101, i64 4
%wide.load177 = load <4 x i32>, ptr %102, align 16, !tbaa !7
%103 = mul nsw <4 x i32> %wide.load176, %92
%104 = mul nsw <4 x i32> %wide.load177, %100
%105 = add <4 x i32> %103, %vec.phi173
%106 = add <4 x i32> %104, %vec.phi174
%index.next178 = add nuw i64 %index172, 8
%107 = icmp eq i64 %index.next178, %n.vec167
br i1 %107, label %middle.block162, label %vector.body171, !llvm.loop !25
middle.block162: ; preds = %vector.body171
%bin.rdx179 = add <4 x i32> %106, %105
%108 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx179)
br i1 %cmp.n170, label %for.body3.2.i.preheader, label %for.body3.1.i.preheader201
for.body3.1.i.preheader201: ; preds = %for.body3.1.i.preheader, %middle.block162
%indvars.iv.1.i.ph = phi i64 [ 1, %for.body3.1.i.preheader ], [ %ind.end168, %middle.block162 ]
%disorder.123.1.i.ph = phi i32 [ %add.i.lcssa, %for.body3.1.i.preheader ], [ %108, %middle.block162 ]
br label %for.body3.1.i
for.body3.1.i: ; preds = %for.body3.1.i.preheader201, %for.body3.1.i
%indvars.iv.1.i = phi i64 [ %indvars.iv.next.1.i, %for.body3.1.i ], [ %indvars.iv.1.i.ph, %for.body3.1.i.preheader201 ]
%disorder.123.1.i = phi i32 [ %add.1.i, %for.body3.1.i ], [ %disorder.123.1.i.ph, %for.body3.1.i.preheader201 ]
%arrayidx7.1.i = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %indvars.iv.1.i, i64 %indvars.iv147
%109 = load i32, ptr %arrayidx7.1.i, align 4, !tbaa !7
%arrayidx11.1.i = getelementptr inbounds [31 x i32], ptr @main.group, i64 1, i64 %indvars.iv.1.i
%110 = load i32, ptr %arrayidx11.1.i, align 4, !tbaa !7
%mul.1.i = mul nsw i32 %110, %109
%add.1.i = add nsw i32 %mul.1.i, %disorder.123.1.i
%indvars.iv.next.1.i = add nuw nsw i64 %indvars.iv.1.i, 1
%exitcond.1.not.i = icmp eq i64 %indvars.iv.next.1.i, %wide.trip.count.i102
br i1 %exitcond.1.not.i, label %for.body3.2.i.preheader, label %for.body3.1.i, !llvm.loop !26
for.body3.2.i.preheader: ; preds = %for.body3.1.i, %middle.block162
%add.1.i.lcssa = phi i32 [ %108, %middle.block162 ], [ %add.1.i, %for.body3.1.i ]
br i1 %min.iters.check, label %for.body3.2.i.preheader200, label %vector.ph
vector.ph: ; preds = %for.body3.2.i.preheader
%111 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %add.1.i.lcssa, 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 <4 x i32> [ %111, %vector.ph ], [ %147, %vector.body ]
%vec.phi160 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %148, %vector.body ]
%offset.idx = or i64 %index, 1
%112 = or i64 %index, 2
%113 = or i64 %index, 3
%114 = or i64 %index, 4
%115 = or i64 %index, 5
%116 = or i64 %index, 6
%117 = or i64 %index, 7
%118 = add i64 %index, 8
%119 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %offset.idx, i64 %indvars.iv142
%120 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %112, i64 %indvars.iv142
%121 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %113, i64 %indvars.iv142
%122 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %114, i64 %indvars.iv142
%123 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %115, i64 %indvars.iv142
%124 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %116, i64 %indvars.iv142
%125 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %117, i64 %indvars.iv142
%126 = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %118, i64 %indvars.iv142
%127 = load i32, ptr %119, align 4, !tbaa !7
%128 = load i32, ptr %120, align 4, !tbaa !7
%129 = load i32, ptr %121, align 4, !tbaa !7
%130 = load i32, ptr %122, align 4, !tbaa !7
%131 = insertelement <4 x i32> poison, i32 %127, i64 0
%132 = insertelement <4 x i32> %131, i32 %128, i64 1
%133 = insertelement <4 x i32> %132, i32 %129, i64 2
%134 = insertelement <4 x i32> %133, i32 %130, i64 3
%135 = load i32, ptr %123, align 4, !tbaa !7
%136 = load i32, ptr %124, align 4, !tbaa !7
%137 = load i32, ptr %125, align 4, !tbaa !7
%138 = load i32, ptr %126, align 4, !tbaa !7
%139 = insertelement <4 x i32> poison, i32 %135, i64 0
%140 = insertelement <4 x i32> %139, i32 %136, i64 1
%141 = insertelement <4 x i32> %140, i32 %137, i64 2
%142 = insertelement <4 x i32> %141, i32 %138, i64 3
%143 = getelementptr inbounds [31 x i32], ptr @main.group, i64 2, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %143, align 4, !tbaa !7
%144 = getelementptr inbounds i32, ptr %143, i64 4
%wide.load161 = load <4 x i32>, ptr %144, align 4, !tbaa !7
%145 = mul nsw <4 x i32> %wide.load, %134
%146 = mul nsw <4 x i32> %wide.load161, %142
%147 = add <4 x i32> %145, %vec.phi
%148 = add <4 x i32> %146, %vec.phi160
%index.next = add nuw i64 %index, 8
%149 = icmp eq i64 %index.next, %n.vec
br i1 %149, label %middle.block, label %vector.body, !llvm.loop !27
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %148, %147
%150 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %calc.exit.loopexit, label %for.body3.2.i.preheader200
for.body3.2.i.preheader200: ; preds = %for.body3.2.i.preheader, %middle.block
%indvars.iv.2.i.ph = phi i64 [ 1, %for.body3.2.i.preheader ], [ %ind.end, %middle.block ]
%disorder.123.2.i.ph = phi i32 [ %add.1.i.lcssa, %for.body3.2.i.preheader ], [ %150, %middle.block ]
br label %for.body3.2.i
for.body3.2.i: ; preds = %for.body3.2.i.preheader200, %for.body3.2.i
%indvars.iv.2.i = phi i64 [ %indvars.iv.next.2.i, %for.body3.2.i ], [ %indvars.iv.2.i.ph, %for.body3.2.i.preheader200 ]
%disorder.123.2.i = phi i32 [ %add.2.i, %for.body3.2.i ], [ %disorder.123.2.i.ph, %for.body3.2.i.preheader200 ]
%arrayidx7.2.i = getelementptr inbounds [31 x i32], ptr @main.ds, i64 %indvars.iv.2.i, i64 %indvars.iv142
%151 = load i32, ptr %arrayidx7.2.i, align 4, !tbaa !7
%arrayidx11.2.i = getelementptr inbounds [31 x i32], ptr @main.group, i64 2, i64 %indvars.iv.2.i
%152 = load i32, ptr %arrayidx11.2.i, align 4, !tbaa !7
%mul.2.i = mul nsw i32 %152, %151
%add.2.i = add nsw i32 %mul.2.i, %disorder.123.2.i
%indvars.iv.next.2.i = add nuw nsw i64 %indvars.iv.2.i, 1
%exitcond.2.not.i = icmp eq i64 %indvars.iv.next.2.i, %wide.trip.count.i102
br i1 %exitcond.2.not.i, label %calc.exit.loopexit, label %for.body3.2.i, !llvm.loop !28
calc.exit.loopexit: ; preds = %for.body3.2.i, %middle.block
%add.2.i.lcssa = phi i32 [ %150, %middle.block ], [ %add.2.i, %for.body3.2.i ]
%cond = call i32 @llvm.smin.i32(i32 %ans.2117, i32 %add.2.i.lcssa)
br label %for.inc53
for.inc53: ; preds = %for.body43, %calc.exit.loopexit
%ans.3 = phi i32 [ %ans.2117, %for.body43 ], [ %cond, %calc.exit.loopexit ]
%indvars.iv.next143 = add nuw nsw i64 %indvars.iv142, 1
%exitcond146.not = icmp eq i64 %indvars.iv.next143, %wide.trip.count.i102
br i1 %exitcond146.not, label %for.inc56, label %for.body43, !llvm.loop !29
for.inc56: ; preds = %for.inc53, %for.body39
%ans.4 = phi i32 [ %ans.1122, %for.body39 ], [ %ans.3, %for.inc53 ]
%indvars.iv.next148 = add nuw nsw i64 %indvars.iv147, 1
%exitcond151.not = icmp eq i64 %indvars.iv.next148, %wide.trip.count.i102
br i1 %exitcond151.not, label %for.cond37.for.inc59_crit_edge.split, label %for.body39, !llvm.loop !30
for.cond37.for.inc59_crit_edge.split: ; preds = %for.inc56
%indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 1
%exitcond156.not = icmp eq i64 %indvars.iv.next153, %wide.trip.count.i102
br i1 %exitcond156.not, label %for.end61, label %for.cond37.preheader, !llvm.loop !31
for.end61: ; preds = %for.cond37.for.inc59_crit_edge.split, %for.cond34.preheader
%ans.0.lcssa = phi i32 [ 1000000000, %for.cond34.preheader ], [ %ans.4, %for.cond37.for.inc59_crit_edge.split ]
%call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %colors) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; 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 = { nofree nounwind "no-trapping-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(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 = { 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 = 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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !6, !13, !12}
!15 = distinct !{!15, !6, !12, !13}
!16 = distinct !{!16, !6, !13, !12}
!17 = distinct !{!17, !6, !12, !13}
!18 = distinct !{!18, !6, !13, !12}
!19 = distinct !{!19, !6}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6}
!23 = distinct !{!23, !6, !12, !13}
!24 = distinct !{!24, !6, !13, !12}
!25 = distinct !{!25, !6, !12, !13}
!26 = distinct !{!26, !6, !13, !12}
!27 = distinct !{!27, !6, !12, !13}
!28 = distinct !{!28, !6, !13, !12}
!29 = distinct !{!29, !6}
!30 = distinct !{!30, !6}
!31 = distinct !{!31, !6}
|
#include <stdio.h>
int main (void){
int a,i,s;
for(;;){
scanf("%d",&s);
if(s==0)break;
for(i=0;i<9;i++){
scanf("%d",&a);
s=s-a;
}
printf("%d\n",s);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278349/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278349/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%s = 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 %s) #3
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i32, ptr %s, align 4, !tbaa !5
%cmp9 = icmp eq i32 %0, 0
br i1 %cmp9, label %for.end5, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.cond1.preheader
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %s, align 4, !tbaa !5
%2 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %1, %2
store i32 %sub, ptr %s, align 4, !tbaa !5
%call3.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%3 = load i32, ptr %s, align 4, !tbaa !5
%4 = load i32, ptr %a, align 4, !tbaa !5
%sub.1 = sub nsw i32 %3, %4
store i32 %sub.1, ptr %s, align 4, !tbaa !5
%call3.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%5 = load i32, ptr %s, align 4, !tbaa !5
%6 = load i32, ptr %a, align 4, !tbaa !5
%sub.2 = sub nsw i32 %5, %6
store i32 %sub.2, ptr %s, align 4, !tbaa !5
%call3.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%7 = load i32, ptr %s, align 4, !tbaa !5
%8 = load i32, ptr %a, align 4, !tbaa !5
%sub.3 = sub nsw i32 %7, %8
store i32 %sub.3, ptr %s, align 4, !tbaa !5
%call3.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%9 = load i32, ptr %s, align 4, !tbaa !5
%10 = load i32, ptr %a, align 4, !tbaa !5
%sub.4 = sub nsw i32 %9, %10
store i32 %sub.4, ptr %s, align 4, !tbaa !5
%call3.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%11 = load i32, ptr %s, align 4, !tbaa !5
%12 = load i32, ptr %a, align 4, !tbaa !5
%sub.5 = sub nsw i32 %11, %12
store i32 %sub.5, ptr %s, align 4, !tbaa !5
%call3.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%13 = load i32, ptr %s, align 4, !tbaa !5
%14 = load i32, ptr %a, align 4, !tbaa !5
%sub.6 = sub nsw i32 %13, %14
store i32 %sub.6, ptr %s, align 4, !tbaa !5
%call3.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%15 = load i32, ptr %s, align 4, !tbaa !5
%16 = load i32, ptr %a, align 4, !tbaa !5
%sub.7 = sub nsw i32 %15, %16
store i32 %sub.7, ptr %s, align 4, !tbaa !5
%call3.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%17 = load i32, ptr %s, align 4, !tbaa !5
%18 = load i32, ptr %a, align 4, !tbaa !5
%sub.8 = sub nsw i32 %17, %18
store i32 %sub.8, ptr %s, align 4, !tbaa !5
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.8)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%19 = load i32, ptr %s, align 4, !tbaa !5
%cmp = icmp eq i32 %19, 0
br i1 %cmp, label %for.end5, label %for.cond1.preheader
for.end5: ; preds = %for.cond1.preheader, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #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 i;
int a,b,c;
while(1){
b=0;
scanf("%d",&a);
if(a==0)return 0;
for(i=0;i<9;i++){
scanf("%d",&c);
b+=c;
}
printf("%d\n",a-b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278392/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278392/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%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 %c) #3
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp9 = icmp eq i32 %0, 0
br i1 %cmp9, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.cond.preheader
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%1 = load i32, ptr %c, align 4, !tbaa !5
%call2.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%2 = load i32, ptr %c, align 4, !tbaa !5
%add.1 = add nsw i32 %2, %1
%call2.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%3 = load i32, ptr %c, align 4, !tbaa !5
%add.2 = add nsw i32 %3, %add.1
%call2.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%4 = load i32, ptr %c, align 4, !tbaa !5
%add.3 = add nsw i32 %4, %add.2
%call2.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%5 = load i32, ptr %c, align 4, !tbaa !5
%add.4 = add nsw i32 %5, %add.3
%call2.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%6 = load i32, ptr %c, align 4, !tbaa !5
%add.5 = add nsw i32 %6, %add.4
%call2.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%7 = load i32, ptr %c, align 4, !tbaa !5
%add.6 = add nsw i32 %7, %add.5
%call2.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%8 = load i32, ptr %c, align 4, !tbaa !5
%add.7 = add nsw i32 %8, %add.6
%call2.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%9 = load i32, ptr %c, align 4, !tbaa !5
%add.8 = add nsw i32 %9, %add.7
%10 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %10, %add.8
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%11 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp eq i32 %11, 0
br i1 %cmp, label %if.then, label %for.cond.preheader
if.then: ; preds = %for.cond.preheader, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #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 <stdlib.h>
#include <math.h>
#include <string.h>
#define mem(x,y) (x*)malloc(sizeof(x)*(y))
#define PI 3.14159265358979
int main()
{
int sum;
while(scanf("%d",&sum),sum)
{
int i;
for(i = 0;i < 9;i++)
{
int price;
scanf("%d",&price);
sum-=price;
}
printf("%d\n",sum);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278442/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278442/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%sum = alloca i32, align 4
%price = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sum) #3
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sum)
%0 = load i32, ptr %sum, align 4, !tbaa !5
%tobool.not6 = icmp eq i32 %0, 0
br i1 %tobool.not6, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.cond.preheader
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %price) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %price)
%1 = load i32, ptr %price, align 4, !tbaa !5
%2 = load i32, ptr %sum, align 4, !tbaa !5
%sub = sub nsw i32 %2, %1
store i32 %sub, ptr %sum, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %price) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %price) #3
%call1.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %price)
%3 = load i32, ptr %price, align 4, !tbaa !5
%4 = load i32, ptr %sum, align 4, !tbaa !5
%sub.1 = sub nsw i32 %4, %3
store i32 %sub.1, ptr %sum, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %price) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %price) #3
%call1.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %price)
%5 = load i32, ptr %price, align 4, !tbaa !5
%6 = load i32, ptr %sum, align 4, !tbaa !5
%sub.2 = sub nsw i32 %6, %5
store i32 %sub.2, ptr %sum, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %price) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %price) #3
%call1.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %price)
%7 = load i32, ptr %price, align 4, !tbaa !5
%8 = load i32, ptr %sum, align 4, !tbaa !5
%sub.3 = sub nsw i32 %8, %7
store i32 %sub.3, ptr %sum, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %price) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %price) #3
%call1.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %price)
%9 = load i32, ptr %price, align 4, !tbaa !5
%10 = load i32, ptr %sum, align 4, !tbaa !5
%sub.4 = sub nsw i32 %10, %9
store i32 %sub.4, ptr %sum, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %price) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %price) #3
%call1.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %price)
%11 = load i32, ptr %price, align 4, !tbaa !5
%12 = load i32, ptr %sum, align 4, !tbaa !5
%sub.5 = sub nsw i32 %12, %11
store i32 %sub.5, ptr %sum, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %price) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %price) #3
%call1.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %price)
%13 = load i32, ptr %price, align 4, !tbaa !5
%14 = load i32, ptr %sum, align 4, !tbaa !5
%sub.6 = sub nsw i32 %14, %13
store i32 %sub.6, ptr %sum, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %price) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %price) #3
%call1.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %price)
%15 = load i32, ptr %price, align 4, !tbaa !5
%16 = load i32, ptr %sum, align 4, !tbaa !5
%sub.7 = sub nsw i32 %16, %15
store i32 %sub.7, ptr %sum, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %price) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %price) #3
%call1.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %price)
%17 = load i32, ptr %price, align 4, !tbaa !5
%18 = load i32, ptr %sum, align 4, !tbaa !5
%sub.8 = sub nsw i32 %18, %17
store i32 %sub.8, ptr %sum, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %price) #3
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.8)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sum)
%19 = load i32, ptr %sum, align 4, !tbaa !5
%tobool.not = icmp eq i32 %19, 0
br i1 %tobool.not, label %while.end, label %for.cond.preheader, !llvm.loop !9
while.end: ; preds = %for.cond.preheader, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sum) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int d[3];
int k;
int i;
int cnt=0;
for(i=0;i<3;i++)
scanf("%d",&d[i]);
scanf("%d",&k);
while(d[0]>=d[1]){
cnt+=1;
d[1]*=2;
}
while(d[1]>=d[2]){
cnt+=1;
d[2]*=2;
}
if(cnt<=k) printf("Yes\n");
else printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278507/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278507/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%d = alloca [3 x i32], align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %d) #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 %d)
%arrayidx.1 = getelementptr inbounds [3 x i32], ptr %d, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%arrayidx.2 = getelementptr inbounds [3 x i32], ptr %d, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%0 = load i32, ptr %d, align 4, !tbaa !5
%arrayidx3.promoted = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp4.not26 = icmp slt i32 %0, %arrayidx3.promoted
br i1 %cmp4.not26, label %while.cond6.preheader, label %while.body
while.cond.while.cond6.preheader_crit_edge: ; preds = %while.body
store i32 %mul, ptr %arrayidx.1, align 4, !tbaa !5
br label %while.cond6.preheader
while.cond6.preheader: ; preds = %while.cond.while.cond6.preheader_crit_edge, %entry
%cnt.0.lcssa = phi i32 [ %add, %while.cond.while.cond6.preheader_crit_edge ], [ 0, %entry ]
%.lcssa = phi i32 [ %mul, %while.cond.while.cond6.preheader_crit_edge ], [ %arrayidx3.promoted, %entry ]
%arrayidx8.promoted = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%cmp9.not31 = icmp slt i32 %.lcssa, %arrayidx8.promoted
br i1 %cmp9.not31, label %while.end14, label %while.body10
while.body: ; preds = %entry, %while.body
%cnt.028 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%mul2527 = phi i32 [ %mul, %while.body ], [ %arrayidx3.promoted, %entry ]
%add = add nuw nsw i32 %cnt.028, 1
%mul = shl nsw i32 %mul2527, 1
%cmp4.not = icmp slt i32 %0, %mul
br i1 %cmp4.not, label %while.cond.while.cond6.preheader_crit_edge, label %while.body, !llvm.loop !9
while.body10: ; preds = %while.cond6.preheader, %while.body10
%cnt.133 = phi i32 [ %add11, %while.body10 ], [ %cnt.0.lcssa, %while.cond6.preheader ]
%mul133032 = phi i32 [ %mul13, %while.body10 ], [ %arrayidx8.promoted, %while.cond6.preheader ]
%add11 = add nuw nsw i32 %cnt.133, 1
%mul13 = shl nsw i32 %mul133032, 1
%cmp9.not = icmp slt i32 %.lcssa, %mul13
br i1 %cmp9.not, label %while.cond6.while.end14_crit_edge, label %while.body10, !llvm.loop !11
while.cond6.while.end14_crit_edge: ; preds = %while.body10
store i32 %mul13, ptr %arrayidx.2, align 4, !tbaa !5
br label %while.end14
while.end14: ; preds = %while.cond6.while.end14_crit_edge, %while.cond6.preheader
%cnt.1.lcssa = phi i32 [ %add11, %while.cond6.while.end14_crit_edge ], [ %cnt.0.lcssa, %while.cond6.preheader ]
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp15.not = icmp sgt i32 %cnt.1.lcssa, %1
%str.str.3 = select i1 %cmp15.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 %k) #4
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %d) #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() {
int red, blue, green, k;
int i=0;
scanf("%d%d%d%d", &red, &green, &blue, &k);
while(green<=red || blue<=green) {
if(green<=red) {
green = 2*green;
i++;
} else if(blue<=green) {
blue = 2*blue;
i++;
}
}
//printf("%d\n", i);
if(i<=k) {
printf("Yes");
} else if(i>k){
printf("No");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278558/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278558/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%red = alloca i32, align 4
%blue = alloca i32, align 4
%green = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %red) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %blue) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %green) #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 %red, ptr noundef nonnull %green, ptr noundef nonnull %blue, ptr noundef nonnull %k)
%0 = load i32, ptr %red, align 4, !tbaa !5
%green.promoted = load i32, ptr %green, align 4
%blue.promoted = load i32, ptr %blue, align 4
%cmp25 = icmp sle i32 %green.promoted, %0
%cmp126 = icmp sle i32 %blue.promoted, %green.promoted
%1 = select i1 %cmp25, i1 true, i1 %cmp126
br i1 %1, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end7
%cmp131 = phi i1 [ %cmp1, %if.end7 ], [ %cmp126, %entry ]
%cmp30 = phi i1 [ %cmp, %if.end7 ], [ %cmp25, %entry ]
%i.029 = phi i32 [ %i.1, %if.end7 ], [ 0, %entry ]
%mul2228 = phi i32 [ %mul21, %if.end7 ], [ %green.promoted, %entry ]
%mul52427 = phi i32 [ %mul523, %if.end7 ], [ %blue.promoted, %entry ]
br i1 %cmp30, label %if.then, label %if.else
if.then: ; preds = %while.body
%mul = shl nsw i32 %mul2228, 1
store i32 %mul, ptr %green, align 4, !tbaa !5
%inc = add nsw i32 %i.029, 1
br label %if.end7
if.else: ; preds = %while.body
br i1 %cmp131, label %if.then4, label %if.end7
if.then4: ; preds = %if.else
%mul5 = shl nsw i32 %mul52427, 1
store i32 %mul5, ptr %blue, align 4, !tbaa !5
%inc6 = add nsw i32 %i.029, 1
br label %if.end7
if.end7: ; preds = %if.else, %if.then4, %if.then
%mul523 = phi i32 [ %mul52427, %if.then ], [ %mul5, %if.then4 ], [ %mul52427, %if.else ]
%mul21 = phi i32 [ %mul, %if.then ], [ %mul2228, %if.then4 ], [ %mul2228, %if.else ]
%i.1 = phi i32 [ %inc, %if.then ], [ %inc6, %if.then4 ], [ %i.029, %if.else ]
%cmp = icmp sle i32 %mul21, %0
%cmp1 = icmp sle i32 %mul523, %mul21
%2 = select i1 %cmp, i1 true, i1 %cmp1
br i1 %2, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %if.end7, %entry
%i.0.lcssa = phi i32 [ 0, %entry ], [ %i.1, %if.end7 ]
%3 = load i32, ptr %k, align 4, !tbaa !5
%cmp8.not = icmp sgt i32 %i.0.lcssa, %3
%.str.2..str.1 = select i1 %cmp8.not, ptr @.str.2, ptr @.str.1
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %green) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %blue) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %red) #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;
scanf("%d %d %d", &A, &B, &C);
int K;
scanf("%d", &K);
int t=0;
while( A >= B){
B *= 2;
t++;
}
while( B >= C){
C *= 2;
t++;
}
if(t <= K) printf("Yes\n");
else printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278600/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278600/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
%K = 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)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %K)
%0 = load i32, ptr %A, align 4, !tbaa !5
%B.promoted = load i32, ptr %B, align 4, !tbaa !5
%cmp.not16 = icmp slt i32 %0, %B.promoted
br i1 %cmp.not16, label %while.cond2.preheader, label %while.body
while.cond.while.cond2.preheader_crit_edge: ; preds = %while.body
store i32 %mul, ptr %B, align 4, !tbaa !5
br label %while.cond2.preheader
while.cond2.preheader: ; preds = %while.cond.while.cond2.preheader_crit_edge, %entry
%t.0.lcssa = phi i32 [ %inc, %while.cond.while.cond2.preheader_crit_edge ], [ 0, %entry ]
%.lcssa = phi i32 [ %mul, %while.cond.while.cond2.preheader_crit_edge ], [ %B.promoted, %entry ]
%C.promoted = load i32, ptr %C, align 4, !tbaa !5
%cmp3.not21 = icmp slt i32 %.lcssa, %C.promoted
br i1 %cmp3.not21, label %while.end7, label %while.body4
while.body: ; preds = %entry, %while.body
%t.018 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
%mul1517 = phi i32 [ %mul, %while.body ], [ %B.promoted, %entry ]
%mul = shl nsw i32 %mul1517, 1
%inc = add nuw nsw i32 %t.018, 1
%cmp.not = icmp slt i32 %0, %mul
br i1 %cmp.not, label %while.cond.while.cond2.preheader_crit_edge, label %while.body, !llvm.loop !9
while.body4: ; preds = %while.cond2.preheader, %while.body4
%t.123 = phi i32 [ %inc6, %while.body4 ], [ %t.0.lcssa, %while.cond2.preheader ]
%mul52022 = phi i32 [ %mul5, %while.body4 ], [ %C.promoted, %while.cond2.preheader ]
%mul5 = shl nsw i32 %mul52022, 1
%inc6 = add nuw nsw i32 %t.123, 1
%cmp3.not = icmp slt i32 %.lcssa, %mul5
br i1 %cmp3.not, label %while.cond2.while.end7_crit_edge, label %while.body4, !llvm.loop !11
while.cond2.while.end7_crit_edge: ; preds = %while.body4
store i32 %mul5, ptr %C, align 4, !tbaa !5
br label %while.end7
while.end7: ; preds = %while.cond2.while.end7_crit_edge, %while.cond2.preheader
%t.1.lcssa = phi i32 [ %inc6, %while.cond2.while.end7_crit_edge ], [ %t.0.lcssa, %while.cond2.preheader ]
%1 = load i32, ptr %K, align 4, !tbaa !5
%cmp8.not = icmp sgt i32 %t.1.lcssa, %1
%str.str.4 = select i1 %cmp8.not, ptr @str, ptr @str.4
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #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 c[100002];
void merge(int i,int j,int *s){
if(i!=j){
merge(i,(i+j)/2,s);
merge((i+j)/2+1,j,s);
int a=i,b=(i+j)/2+1;
int d;
for(d=i;d<=j;d++){
if((i+j)/2<a){
c[d]=s[b];
b++;
}
else if(j<b){
c[d]=s[a];
a++;
}
else if(s[a]>s[b]){
c[d]=s[a];
a++;
}
else{
c[d]=s[b];
b++;
}
}
for(d=i;d<=j;d++)
s[d]=c[d];
}
}
int main(){
int n,h,i;
scanf("%d%d",&n,&h);
int a,amax=0,b[n+1];
for(i=0;i<n;i++){
scanf("%d%d",&a,&b[i]);
if(amax<a)
amax=a;
}
merge(0,n-1,b);
int count=0;
i=0;
while(h>0){
if(amax<b[i] && i<n){
h-=b[i];
i++;
count++;
}
else{
if(h%amax==0)
count+=h/amax;
else
count+=h/amax+1;
break;
}
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278651/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278651/source.c"
target datalayout = "e-m:e-p270: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 [100002 x i32] zeroinitializer, align 16
@.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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(i32 noundef %i, i32 noundef %j, ptr noundef %s) local_unnamed_addr #0 {
entry:
%s110 = ptrtoint ptr %s to i64
%cmp.not = icmp eq i32 %i, %j
br i1 %cmp.not, label %if.end52, label %if.then
if.then: ; preds = %entry
%add = add nsw i32 %j, %i
%div = sdiv i32 %add, 2
tail call void @merge(i32 noundef %i, i32 noundef %div, ptr noundef %s)
%add3 = add nsw i32 %div, 1
tail call void @merge(i32 noundef %add3, i32 noundef %j, ptr noundef %s)
%cmp7.not97 = icmp sgt i32 %i, %j
br i1 %cmp7.not97, label %if.end52, label %for.body.preheader
for.body.preheader: ; preds = %if.then
%0 = sext i32 %i to i64
%1 = add i32 %j, 1
br label %for.body
for.cond42.preheader: ; preds = %for.inc
br i1 %cmp7.not97, label %if.end52, label %for.body44.preheader
for.body44.preheader: ; preds = %for.cond42.preheader
%2 = sext i32 %i to i64
%3 = add i32 %j, 1
%4 = sub i32 %j, %i
%5 = zext i32 %4 to i64
%6 = add nuw nsw i64 %5, 1
%min.iters.check = icmp ult i32 %4, 15
br i1 %min.iters.check, label %for.body44.preheader112, label %vector.memcheck
vector.memcheck: ; preds = %for.body44.preheader
%7 = shl nsw i64 %0, 2
%8 = add i64 %7, %s110
%9 = add i64 %7, ptrtoint (ptr @c to i64)
%10 = sub i64 %8, %9
%diff.check = icmp ult i64 %10, 32
br i1 %diff.check, label %for.body44.preheader112, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %6, 8589934584
%ind.end = add nsw i64 %n.vec, %2
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = add i64 %index, %2
%11 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %11, align 4, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 4
%wide.load111 = load <4 x i32>, ptr %12, align 4, !tbaa !5
%13 = getelementptr inbounds i32, ptr %s, i64 %offset.idx
store <4 x i32> %wide.load, ptr %13, align 4, !tbaa !5
%14 = getelementptr inbounds i32, ptr %13, i64 4
store <4 x i32> %wide.load111, ptr %14, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%15 = icmp eq i64 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %6, %n.vec
br i1 %cmp.n, label %if.end52, label %for.body44.preheader112
for.body44.preheader112: ; preds = %vector.memcheck, %for.body44.preheader, %middle.block
%indvars.iv105.ph = phi i64 [ %2, %vector.memcheck ], [ %2, %for.body44.preheader ], [ %ind.end, %middle.block ]
%16 = add i32 %j, 1
%17 = trunc i64 %indvars.iv105.ph to i32
%18 = sub i32 %16, %17
%19 = sub i32 %j, %17
%xtraiter = and i32 %18, 3
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body44.prol.loopexit, label %for.body44.prol
for.body44.prol: ; preds = %for.body44.preheader112, %for.body44.prol
%indvars.iv105.prol = phi i64 [ %indvars.iv.next106.prol, %for.body44.prol ], [ %indvars.iv105.ph, %for.body44.preheader112 ]
%prol.iter = phi i32 [ %prol.iter.next, %for.body44.prol ], [ 0, %for.body44.preheader112 ]
%arrayidx46.prol = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %indvars.iv105.prol
%20 = load i32, ptr %arrayidx46.prol, align 4, !tbaa !5
%arrayidx48.prol = getelementptr inbounds i32, ptr %s, i64 %indvars.iv105.prol
store i32 %20, ptr %arrayidx48.prol, align 4, !tbaa !5
%indvars.iv.next106.prol = add nsw i64 %indvars.iv105.prol, 1
%prol.iter.next = add i32 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body44.prol.loopexit, label %for.body44.prol, !llvm.loop !13
for.body44.prol.loopexit: ; preds = %for.body44.prol, %for.body44.preheader112
%indvars.iv105.unr = phi i64 [ %indvars.iv105.ph, %for.body44.preheader112 ], [ %indvars.iv.next106.prol, %for.body44.prol ]
%21 = icmp ult i32 %19, 3
br i1 %21, label %if.end52, label %for.body44
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%b.099 = phi i32 [ %add3, %for.body.preheader ], [ %b.1, %for.inc ]
%a.098 = phi i32 [ %i, %for.body.preheader ], [ %a.1, %for.inc ]
%cmp10 = icmp slt i32 %div, %a.098
br i1 %cmp10, label %if.then11, label %if.else
if.then11: ; preds = %for.body
%idxprom = sext i32 %b.099 to i64
%arrayidx = getelementptr inbounds i32, ptr %s, i64 %idxprom
%22 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx13 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %indvars.iv
store i32 %22, ptr %arrayidx13, align 4, !tbaa !5
%inc = add nsw i32 %b.099, 1
br label %for.inc
if.else: ; preds = %for.body
%cmp14 = icmp sgt i32 %b.099, %j
%idxprom16 = sext i32 %a.098 to i64
%arrayidx17 = getelementptr inbounds i32, ptr %s, i64 %idxprom16
%23 = load i32, ptr %arrayidx17, align 4, !tbaa !5
br i1 %cmp14, label %if.then15, label %if.else21
if.then15: ; preds = %if.else
%arrayidx19 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %indvars.iv
store i32 %23, ptr %arrayidx19, align 4, !tbaa !5
%inc20 = add nsw i32 %a.098, 1
br label %for.inc
if.else21: ; preds = %if.else
%idxprom24 = sext i32 %b.099 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %s, i64 %idxprom24
%24 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %23, %24
%arrayidx31 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %indvars.iv
br i1 %cmp26, label %if.then27, label %if.else33
if.then27: ; preds = %if.else21
store i32 %23, ptr %arrayidx31, align 4, !tbaa !5
%inc32 = add nsw i32 %a.098, 1
br label %for.inc
if.else33: ; preds = %if.else21
store i32 %24, ptr %arrayidx31, align 4, !tbaa !5
%inc38 = add nsw i32 %b.099, 1
br label %for.inc
for.inc: ; preds = %if.then11, %if.then27, %if.else33, %if.then15
%a.1 = phi i32 [ %a.098, %if.then11 ], [ %inc20, %if.then15 ], [ %inc32, %if.then27 ], [ %a.098, %if.else33 ]
%b.1 = phi i32 [ %inc, %if.then11 ], [ %b.099, %if.then15 ], [ %b.099, %if.then27 ], [ %inc38, %if.else33 ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %1, %lftr.wideiv
br i1 %exitcond.not, label %for.cond42.preheader, label %for.body, !llvm.loop !15
for.body44: ; preds = %for.body44.prol.loopexit, %for.body44
%indvars.iv105 = phi i64 [ %indvars.iv.next106.3, %for.body44 ], [ %indvars.iv105.unr, %for.body44.prol.loopexit ]
%arrayidx46 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %indvars.iv105
%25 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%arrayidx48 = getelementptr inbounds i32, ptr %s, i64 %indvars.iv105
store i32 %25, ptr %arrayidx48, align 4, !tbaa !5
%indvars.iv.next106 = add nsw i64 %indvars.iv105, 1
%arrayidx46.1 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %indvars.iv.next106
%26 = load i32, ptr %arrayidx46.1, align 4, !tbaa !5
%arrayidx48.1 = getelementptr inbounds i32, ptr %s, i64 %indvars.iv.next106
store i32 %26, ptr %arrayidx48.1, align 4, !tbaa !5
%indvars.iv.next106.1 = add nsw i64 %indvars.iv105, 2
%arrayidx46.2 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %indvars.iv.next106.1
%27 = load i32, ptr %arrayidx46.2, align 4, !tbaa !5
%arrayidx48.2 = getelementptr inbounds i32, ptr %s, i64 %indvars.iv.next106.1
store i32 %27, ptr %arrayidx48.2, align 4, !tbaa !5
%indvars.iv.next106.2 = add nsw i64 %indvars.iv105, 3
%arrayidx46.3 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %indvars.iv.next106.2
%28 = load i32, ptr %arrayidx46.3, align 4, !tbaa !5
%arrayidx48.3 = getelementptr inbounds i32, ptr %s, i64 %indvars.iv.next106.2
store i32 %28, ptr %arrayidx48.3, align 4, !tbaa !5
%indvars.iv.next106.3 = add nsw i64 %indvars.iv105, 4
%lftr.wideiv108.3 = trunc i64 %indvars.iv.next106.3 to i32
%exitcond109.not.3 = icmp eq i32 %3, %lftr.wideiv108.3
br i1 %exitcond109.not.3, label %if.end52, label %for.body44, !llvm.loop !16
if.end52: ; preds = %for.body44.prol.loopexit, %for.body44, %middle.block, %if.then, %for.cond42.preheader, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%h = alloca i32, align 4
%a = 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 %h) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %h)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6
%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 i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %3, 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 ]
%amax.043 = phi i32 [ %spec.select, %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 %a, ptr noundef nonnull %arrayidx)
%4 = load i32, ptr %a, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %amax.043, i32 %4)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !17
for.end: ; preds = %for.body, %entry
%amax.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
%.lcssa = phi i32 [ %3, %entry ], [ %5, %for.body ]
%sub = add nsw i32 %.lcssa, -1
call void @merge(i32 noundef 0, i32 noundef %sub, ptr noundef nonnull %vla)
%.pr = load i32, ptr %h, align 4, !tbaa !5
%cmp346 = icmp sgt i32 %.pr, 0
br i1 %cmp346, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %for.end
%7 = load i32, ptr %n, align 4
%8 = sext i32 %7 to i64
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.then8
%indvars.iv55 = phi i64 [ 0, %while.body.lr.ph ], [ %indvars.iv.next56, %if.then8 ]
%9 = phi i32 [ %.pr, %while.body.lr.ph ], [ %sub11, %if.then8 ]
%arrayidx5 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv55
%10 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp slt i32 %amax.0.lcssa, %10
%cmp7 = icmp slt i64 %indvars.iv55, %8
%or.cond = select i1 %cmp6, i1 %cmp7, i1 false
br i1 %or.cond, label %if.then8, label %if.else
if.then8: ; preds = %while.body
%sub11 = sub nsw i32 %9, %10
store i32 %sub11, ptr %h, align 4, !tbaa !5
%indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
%cmp3 = icmp sgt i32 %sub11, 0
br i1 %cmp3, label %while.body, label %while.end.loopexit, !llvm.loop !18
if.else: ; preds = %while.body
%indvars57.le = trunc i64 %indvars.iv55 to i32
%rem = srem i32 %9, %amax.0.lcssa
%cmp14 = icmp eq i32 %rem, 0
%div = sdiv i32 %9, %amax.0.lcssa
br i1 %cmp14, label %if.then15, label %if.else17
if.then15: ; preds = %if.else
%add16 = add nsw i32 %div, %indvars57.le
br label %while.end
if.else17: ; preds = %if.else
%add19 = add nuw i32 %indvars57.le, 1
%add20 = add i32 %add19, %div
br label %while.end
while.end.loopexit: ; preds = %if.then8
%indvars = trunc i64 %indvars.iv.next56 to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %for.end, %if.then15, %if.else17
%count.1 = phi i32 [ %add16, %if.then15 ], [ %add20, %if.else17 ], [ 0, %for.end ], [ %indvars, %while.end.loopexit ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.1)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !11}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
|
#include<stdio.h>
#include<stdlib.h>
int compare(const void *a, const void *b){
int *A = (int *)a;
int *B = (int *)b;
if (*A > *B) return -1;
if (*A < *B) return 1;
return 0;
}
int main(){
int N,H,ans=0;
scanf("%d%d",&N,&H);
int a[N],b[N];
for(int i=0;i<N;i++)scanf("%d%d",&a[i],&b[i]);
qsort(a,N,sizeof(int),compare);
qsort(b,N,sizeof(int),compare);
if(b[0]<a[0]){
printf("%d\n",(H+a[0]-1)/a[0]);
return 0;
}
int maxb=0;
for(;maxb<N-1;maxb++)if(b[maxb+1]<a[0])break;
for(int i=0;i<=maxb;i++){
ans++;
H-=b[i];
if(H<=0)break;
}
if(H>0)ans+=(H+a[0]-1)/a[0];
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278695/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278695/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp slt i32 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%N = alloca i32, align 4
%H = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %H)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%cmp77 = icmp sgt i32 %3, 0
br i1 %cmp77, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %3 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %11, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @compare) #7
%5 = load i32, ptr %N, align 4, !tbaa !5
%conv5 = sext i32 %5 to i64
call void @qsort(ptr noundef nonnull %vla1, i64 noundef %conv5, i64 noundef 4, ptr noundef nonnull @compare) #7
%6 = load i32, ptr %vla1, align 16, !tbaa !5
%7 = load i32, ptr %vla, align 16, !tbaa !5
%cmp8 = icmp slt i32 %6, %7
br i1 %cmp8, label %if.then, label %for.cond13.preheader
for.cond13.preheader: ; preds = %for.cond.cleanup
%8 = load i32, ptr %N, align 4, !tbaa !5
%9 = call i32 @llvm.smax.i32(i32 %8, i32 1)
%smax = add nsw i32 %9, -1
%wide.trip.count = zext i32 %smax to i64
br label %for.cond13
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
%arrayidx3 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3)
%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.cond.cleanup, !llvm.loop !9
if.then: ; preds = %for.cond.cleanup
%12 = load i32, ptr %H, align 4, !tbaa !5
%add = add nsw i32 %7, -1
%sub = add i32 %add, %12
%div = sdiv i32 %sub, %7
br label %cleanup58
for.cond13: ; preds = %for.cond13.preheader, %for.body17
%indvars.iv87 = phi i64 [ 0, %for.cond13.preheader ], [ %indvars.iv.next88, %for.body17 ]
%exitcond.not = icmp eq i64 %indvars.iv87, %wide.trip.count
br i1 %exitcond.not, label %for.end28, label %for.body17
for.body17: ; preds = %for.cond13
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%arrayidx20 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv.next88
%13 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp22 = icmp slt i32 %13, %7
br i1 %cmp22, label %for.end28.split.loop.exit, label %for.cond13, !llvm.loop !11
for.end28.split.loop.exit: ; preds = %for.body17
%14 = trunc i64 %indvars.iv87 to i32
%15 = add nuw nsw i32 %14, 1
br label %for.end28
for.end28: ; preds = %for.cond13, %for.end28.split.loop.exit
%maxb.0.lcssa = phi i32 [ %15, %for.end28.split.loop.exit ], [ %9, %for.cond13 ]
%H.promoted = load i32, ptr %H, align 4, !tbaa !5
%wide.trip.count95 = zext i32 %maxb.0.lcssa to i64
br label %for.body34
for.cond30: ; preds = %for.body34
%exitcond96.not = icmp eq i64 %indvars.iv.next91, %wide.trip.count95
br i1 %exitcond96.not, label %if.then48, label %for.body34, !llvm.loop !12
for.body34: ; preds = %for.end28, %for.cond30
%indvars.iv90 = phi i64 [ 0, %for.end28 ], [ %indvars.iv.next91, %for.cond30 ]
%sub387980 = phi i32 [ %H.promoted, %for.end28 ], [ %sub38, %for.cond30 ]
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%arrayidx37 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv90
%16 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%sub38 = sub nsw i32 %sub387980, %16
%cmp39 = icmp slt i32 %sub38, 1
br i1 %cmp39, label %if.end55.loopexit, label %for.cond30
if.then48: ; preds = %for.cond30
store i32 %sub38, ptr %H, align 4, !tbaa !5
%add50 = add i32 %7, -1
%sub51 = add i32 %add50, %sub38
%div53 = sdiv i32 %sub51, %7
%add54 = add nsw i32 %div53, %maxb.0.lcssa
br label %cleanup58
if.end55.loopexit: ; preds = %for.body34
%indvars93 = trunc i64 %indvars.iv.next91 to i32
store i32 %sub38, ptr %H, align 4, !tbaa !5
br label %cleanup58
cleanup58: ; preds = %if.then48, %if.end55.loopexit, %if.then
%ans.2.sink = phi i32 [ %div, %if.then ], [ %add54, %if.then48 ], [ %indvars93, %if.end55.loopexit ]
%call56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.2.sink)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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 }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#define MAX 1000
int main(void)
{
char input[MAX];
char output[MAX];
int i;
int j = 0;
scanf("%s",input);
for(i=0;input[i]!='\0';i+=2){
if(input[i] == '2'){
output[j] = 'k';
j++;
}
else if(input[i] == '3'){
output[j] = 's';
j++;
}
else if(input[i] == '4'){
output[j] = 't';
j++;
}
else if(input[i] == '5'){
output[j] = 'n';
j++;
}
else if(input[i] == '6'){
output[j] = 'h';
j++;
}
else if(input[i] == '7'){
output[j] = 'm';
j++;
}
else if(input[i] == '8'){
output[j] = 'y';
j++;
if(input[i+1] == 'T'){
output[j] = 'a';
j++;
continue;
}
else if(input[i+1] == 'U'){
output[j] = 'u';
j++;
continue;
}
else if(input[i+1] == 'D'){
output[j] = 'o';
j++;
continue;
}
}
else if(input[i] == '9'){
output[j] = 'r';
j++;
}
else if(input[i] == '0'){
if(input[i+1] == 'U'){
output[j] = 'n';
output[j+1] = 'n';
j+=2;
continue;
}
else{
output[j] = 'w';
j++;
if(input[i+1] == 'T'){
output[j] = 'a';
j++;
continue;
}
else if(input[i+1] == 'D'){
output[j] = 'o';
j++;
continue;
}
}
}
if(input[i+1] == 'T'){
output[j] = 'a';
j++;
}
else if(input[i+1] == 'L'){
output[j] = 'i';
j++;
}
else if(input[i+1] == 'U'){
output[j] = 'u';
j++;
}
else if(input[i+1] == 'R'){
output[j] = 'e';
j++;
}
else if(input[i+1] == 'D'){
output[j] = 'o';
j++;
}
}
output[j] = '\0';
printf("%s\n",output);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278738/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278738/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%input = alloca [1000 x i8], align 16
%output = alloca [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %input) #4
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %output) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%j.0 = phi i32 [ %j.2, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i8], ptr %input, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 2, !tbaa !5
switch i8 %0, label %if.end167 [
i8 0, label %for.end
i8 50, label %if.end167.sink.split
i8 51, label %if.then14
i8 52, label %if.then24
i8 53, label %if.then34
i8 54, label %if.then44
i8 55, label %if.then54
i8 56, label %if.then64
i8 57, label %if.then107
i8 48, label %if.then117
]
if.then14: ; preds = %for.cond
br label %if.end167.sink.split
if.then24: ; preds = %for.cond
br label %if.end167.sink.split
if.then34: ; preds = %for.cond
br label %if.end167.sink.split
if.then44: ; preds = %for.cond
br label %if.end167.sink.split
if.then54: ; preds = %for.cond
br label %if.end167.sink.split
if.then64: ; preds = %for.cond
%idxprom65 = sext i32 %j.0 to i64
%arrayidx66 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom65
store i8 121, ptr %arrayidx66, align 1, !tbaa !5
%inc67 = add nsw i32 %j.0, 1
%1 = or i64 %indvars.iv, 1
%arrayidx69 = getelementptr inbounds [1000 x i8], ptr %input, i64 0, i64 %1
%2 = load i8, ptr %arrayidx69, align 1, !tbaa !5
switch i8 %2, label %if.end167 [
i8 84, label %if.then73
i8 85, label %if.then84
i8 68, label %if.then95
]
if.then73: ; preds = %if.then64
%idxprom74 = sext i32 %inc67 to i64
%arrayidx75 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom74
store i8 97, ptr %arrayidx75, align 1, !tbaa !5
%inc76 = add nsw i32 %j.0, 2
br label %for.inc
if.then84: ; preds = %if.then64
%idxprom85 = sext i32 %inc67 to i64
%arrayidx86 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom85
store i8 117, ptr %arrayidx86, align 1, !tbaa !5
%inc87 = add nsw i32 %j.0, 2
br label %for.inc
if.then95: ; preds = %if.then64
%idxprom96 = sext i32 %inc67 to i64
%arrayidx97 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom96
store i8 111, ptr %arrayidx97, align 1, !tbaa !5
%inc98 = add nsw i32 %j.0, 2
br label %for.inc
if.then107: ; preds = %for.cond
br label %if.end167.sink.split
if.then117: ; preds = %for.cond
%3 = or i64 %indvars.iv, 1
%arrayidx120 = getelementptr inbounds [1000 x i8], ptr %input, i64 0, i64 %3
%4 = load i8, ptr %arrayidx120, align 1, !tbaa !5
%cmp122 = icmp eq i8 %4, 85
%idxprom125 = sext i32 %j.0 to i64
%arrayidx126 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom125
%add127 = add nsw i32 %j.0, 1
br i1 %cmp122, label %if.then124, label %if.else131
if.then124: ; preds = %if.then117
store i8 110, ptr %arrayidx126, align 1, !tbaa !5
%idxprom128 = sext i32 %add127 to i64
%arrayidx129 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom128
store i8 110, ptr %arrayidx129, align 1, !tbaa !5
%add130 = add nsw i32 %j.0, 2
br label %for.inc
if.else131: ; preds = %if.then117
store i8 119, ptr %arrayidx126, align 1, !tbaa !5
switch i8 %4, label %if.end167 [
i8 84, label %if.then141
i8 68, label %if.then152
]
if.then141: ; preds = %if.else131
%idxprom142 = sext i32 %add127 to i64
%arrayidx143 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom142
store i8 97, ptr %arrayidx143, align 1, !tbaa !5
%inc144 = add nsw i32 %j.0, 2
br label %for.inc
if.then152: ; preds = %if.else131
%idxprom153 = sext i32 %add127 to i64
%arrayidx154 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom153
store i8 111, ptr %arrayidx154, align 1, !tbaa !5
%inc155 = add nsw i32 %j.0, 2
br label %for.inc
if.end167.sink.split: ; preds = %for.cond, %if.then24, %if.then44, %if.then107, %if.then54, %if.then34, %if.then14
%.sink = phi i8 [ 115, %if.then14 ], [ 110, %if.then34 ], [ 109, %if.then54 ], [ 114, %if.then107 ], [ 104, %if.then44 ], [ 116, %if.then24 ], [ 107, %for.cond ]
%idxprom15 = sext i32 %j.0 to i64
%arrayidx16 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom15
store i8 %.sink, ptr %arrayidx16, align 1, !tbaa !5
%inc17 = add nsw i32 %j.0, 1
br label %if.end167
if.end167: ; preds = %if.end167.sink.split, %if.else131, %for.cond, %if.then64
%j.1 = phi i32 [ %inc67, %if.then64 ], [ %j.0, %for.cond ], [ %add127, %if.else131 ], [ %inc17, %if.end167.sink.split ]
%5 = or i64 %indvars.iv, 1
%arrayidx170 = getelementptr inbounds [1000 x i8], ptr %input, i64 0, i64 %5
%6 = load i8, ptr %arrayidx170, align 1, !tbaa !5
switch i8 %6, label %for.inc [
i8 84, label %if.then174
i8 76, label %if.then185
i8 85, label %if.then196
i8 82, label %if.then207
i8 68, label %if.then218
]
if.then174: ; preds = %if.end167
%idxprom175 = sext i32 %j.1 to i64
%arrayidx176 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom175
store i8 97, ptr %arrayidx176, align 1, !tbaa !5
%inc177 = add nsw i32 %j.1, 1
br label %for.inc
if.then185: ; preds = %if.end167
%idxprom186 = sext i32 %j.1 to i64
%arrayidx187 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom186
store i8 105, ptr %arrayidx187, align 1, !tbaa !5
%inc188 = add nsw i32 %j.1, 1
br label %for.inc
if.then196: ; preds = %if.end167
%idxprom197 = sext i32 %j.1 to i64
%arrayidx198 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom197
store i8 117, ptr %arrayidx198, align 1, !tbaa !5
%inc199 = add nsw i32 %j.1, 1
br label %for.inc
if.then207: ; preds = %if.end167
%idxprom208 = sext i32 %j.1 to i64
%arrayidx209 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom208
store i8 101, ptr %arrayidx209, align 1, !tbaa !5
%inc210 = add nsw i32 %j.1, 1
br label %for.inc
if.then218: ; preds = %if.end167
%idxprom219 = sext i32 %j.1 to i64
%arrayidx220 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom219
store i8 111, ptr %arrayidx220, align 1, !tbaa !5
%inc221 = add nsw i32 %j.1, 1
br label %for.inc
for.inc: ; preds = %if.end167, %if.then174, %if.then196, %if.then218, %if.then207, %if.then185, %if.then152, %if.then141, %if.then124, %if.then95, %if.then84, %if.then73
%j.2 = phi i32 [ %inc177, %if.then174 ], [ %inc188, %if.then185 ], [ %inc199, %if.then196 ], [ %inc210, %if.then207 ], [ %inc221, %if.then218 ], [ %inc76, %if.then73 ], [ %inc87, %if.then84 ], [ %inc98, %if.then95 ], [ %add130, %if.then124 ], [ %inc144, %if.then141 ], [ %inc155, %if.then152 ], [ %j.1, %if.end167 ]
%indvars.iv.next = add nuw i64 %indvars.iv, 2
br label %for.cond, !llvm.loop !8
for.end: ; preds = %for.cond
%idxprom228 = sext i32 %j.0 to i64
%arrayidx229 = getelementptr inbounds [1000 x i8], ptr %output, i64 0, i64 %idxprom228
store i8 0, ptr %arrayidx229, align 1, !tbaa !5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %output)
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %output) #4
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %input) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int d[100][2],n,num = 0,i,j;
scanf("%d",&n);
for(i = 0; i < n; i++){
for(j = 0; j < 2; j++){
scanf("%d",&d[i][j]);
if(i > 1 &&j == 1){
if(d[i - 2][0] == d[i - 2][1] && d[i - 1][0]== d[i - 1][1] && d[i][0] == d[i][1]){
num = 1;
}
}
}
}
if(num == 0){
printf("No");
}
else{
printf("Yes");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278781/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278781/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"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:
%d = alloca [100 x [2 x i32]], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %d) #3
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
%cmp59 = icmp sgt i32 %0, 0
br i1 %cmp59, label %for.inc37.peel, label %if.end44
for.inc37.peel: ; preds = %entry
%arrayidx33.peel = getelementptr inbounds [100 x [2 x i32]], ptr %d, i64 0, i64 0, i64 1
%call6.us.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%call6.us.1.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx33.peel)
%.pre = load i32, ptr %n, align 4, !tbaa !5
%cmp.peel = icmp sgt i32 %.pre, 1
br i1 %cmp.peel, label %for.inc37.peel109, label %if.end44
for.inc37.peel109: ; preds = %for.inc37.peel
%arrayidx33.peel78 = getelementptr inbounds [100 x [2 x i32]], ptr %d, i64 0, i64 1, i64 1
%arrayidx.peel70 = getelementptr inbounds [100 x [2 x i32]], ptr %d, i64 0, i64 1
%call6.us.peel82 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.peel70)
%call6.us.1.peel84 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx33.peel78)
%.pre114 = load i32, ptr %n, align 4, !tbaa !5
%cmp.peel112 = icmp sgt i32 %.pre114, 2
br i1 %cmp.peel112, label %if.then.1, label %if.end44
if.then.1: ; preds = %for.inc37.peel109, %for.inc37
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc37 ], [ 2, %for.inc37.peel109 ]
%num.060 = phi i32 [ %num.2.1, %for.inc37 ], [ 0, %for.inc37.peel109 ]
%arrayidx = getelementptr inbounds [100 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv
%1 = add nuw i64 %indvars.iv, 4294967294
%idxprom9 = and i64 %1, 4294967295
%arrayidx10 = getelementptr inbounds [100 x [2 x i32]], ptr %d, i64 0, i64 %idxprom9
%arrayidx15 = getelementptr inbounds [100 x [2 x i32]], ptr %d, i64 0, i64 %idxprom9, i64 1
%arrayidx33 = getelementptr inbounds [100 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv, i64 1
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx33)
%2 = load i32, ptr %arrayidx10, align 8, !tbaa !5
%3 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%cmp16.1 = icmp eq i32 %2, %3
br i1 %cmp16.1, label %land.lhs.true17.1, label %for.inc37
land.lhs.true17.1: ; preds = %if.then.1
%4 = add nuw i64 %indvars.iv, 4294967295
%idxprom19 = and i64 %4, 4294967295
%arrayidx25 = getelementptr inbounds [100 x [2 x i32]], ptr %d, i64 0, i64 %idxprom19, i64 1
%arrayidx20 = getelementptr inbounds [100 x [2 x i32]], ptr %d, i64 0, i64 %idxprom19
%5 = load i32, ptr %arrayidx20, align 8, !tbaa !5
%6 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26.1 = icmp eq i32 %5, %6
br i1 %cmp26.1, label %land.lhs.true27.1, label %for.inc37
land.lhs.true27.1: ; preds = %land.lhs.true17.1
%7 = load i32, ptr %arrayidx, align 8, !tbaa !5
%8 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34.1 = icmp eq i32 %7, %8
%spec.select.1 = select i1 %cmp34.1, i32 1, i32 %num.060
br label %for.inc37
for.inc37: ; preds = %if.then.1, %land.lhs.true17.1, %land.lhs.true27.1
%num.2.1 = phi i32 [ %num.060, %land.lhs.true17.1 ], [ %num.060, %if.then.1 ], [ %spec.select.1, %land.lhs.true27.1 ]
%.pre115 = load i32, ptr %n, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = sext i32 %.pre115 to i64
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %if.then.1, label %for.end39, !llvm.loop !9
for.end39: ; preds = %for.inc37
%10 = icmp eq i32 %num.2.1, 0
%spec.select = select i1 %10, ptr @.str.1, ptr @.str.2
br label %if.end44
if.end44: ; preds = %for.end39, %entry, %for.inc37.peel, %for.inc37.peel109
%.str.2.sink = phi ptr [ @.str.1, %for.inc37.peel109 ], [ @.str.1, %for.inc37.peel ], [ @.str.1, %entry ], [ %spec.select, %for.end39 ]
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %d) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 2}
|
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int main (void) {
bool judge = false;
int count = 0, n, a, b;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d %d", &a, &b);
if (a == b) count++;
else count = 0;
if (count >= 3) judge = true;
}
if (judge) printf("Yes\n");
else printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278824/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278824/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %if.else9
for.cond.cleanup: ; preds = %for.body
%1 = and i8 %judge.1, 1
%2 = icmp eq i8 %1, 0
br i1 %2, label %if.else9, label %if.end11
for.body: ; preds = %entry, %for.body
%i.018 = phi i32 [ %inc6, %for.body ], [ 0, %entry ]
%count.017 = phi i32 [ %count.1, %for.body ], [ 0, %entry ]
%judge.016 = phi i8 [ %judge.1, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%3 = load i32, ptr %a, align 4, !tbaa !5
%4 = load i32, ptr %b, align 4, !tbaa !5
%cmp2 = icmp eq i32 %3, %4
%inc = add nsw i32 %count.017, 1
%count.1 = select i1 %cmp2, i32 %inc, i32 0
%cmp3 = icmp sgt i32 %count.1, 2
%judge.1 = select i1 %cmp3, i8 1, i8 %judge.016
%inc6 = add nuw nsw i32 %i.018, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc6, %5
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
if.else9: ; preds = %entry, %for.cond.cleanup
br label %if.end11
if.end11: ; preds = %for.cond.cleanup, %if.else9
%str.sink = phi ptr [ @str, %if.else9 ], [ @str.4, %for.cond.cleanup ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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[100]={},c[100]={},count_same=0,flag=0;
scanf("%d",&a);
for(int i=0;i<a;i++){
scanf("%d%d",&b[i],&c[i]);
if(b[i]==c[i]) count_same++;
else count_same=0;
if(count_same==3){
flag++;
break;
}
}
if(flag)printf("Yes");
else printf("No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278868/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278868/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"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 [100 x i32], align 16
%c = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %b) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %b, i8 0, i64 400, i1 false)
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %c) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %c, i8 0, i64 400, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not31 = icmp sgt i32 %0, 0
br i1 %cmp.not31, label %for.body, label %if.end18
for.cond: ; preds = %for.body
%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.not = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp.not, label %for.body, label %if.end18, !llvm.loop !9
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%count_same.032 = phi i32 [ %count_same.1, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [100 x i32], ptr %c, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%4 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp8 = icmp eq i32 %3, %4
%inc = add nsw i32 %count_same.032, 1
%count_same.1 = select i1 %cmp8, i32 %inc, i32 0
%cmp9 = icmp eq i32 %count_same.1, 3
br i1 %cmp9, label %if.end18, label %for.cond
if.end18: ; preds = %for.cond, %for.body, %entry
%.str.3.sink = phi ptr [ @.str.3, %entry ], [ @.str.2, %for.body ], [ @.str.3, %for.cond ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 400, 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
int main(void){
int a,b,c=0,n,i;
char s[1005];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %d",&a,&b);
if(a==b){
c++;
if(c>=3){
printf("Yes");
return 0;
}
}else{
c=0;
}
}
printf("No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278910/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278910/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"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
%n = 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 %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
%cmp16 = icmp sgt i32 %0, 0
br i1 %cmp16, label %for.body, label %cleanup
for.body: ; preds = %entry, %for.inc
%i.018 = phi i32 [ %inc7, %for.inc ], [ 0, %entry ]
%c.017 = phi i32 [ %c.1, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%cmp2 = icmp eq i32 %1, %2
br i1 %cmp2, label %if.then, label %for.inc
if.then: ; preds = %for.body
%inc = add nsw i32 %c.017, 1
%cmp3 = icmp sgt i32 %c.017, 1
br i1 %cmp3, label %cleanup, label %for.inc
for.inc: ; preds = %for.body, %if.then
%c.1 = phi i32 [ %inc, %if.then ], [ 0, %for.body ]
%inc7 = add nuw nsw i32 %i.018, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc7, %3
br i1 %cmp, label %for.body, label %cleanup, !llvm.loop !9
cleanup: ; preds = %for.inc, %if.then, %entry
%.str.3.sink = phi ptr [ @.str.3, %entry ], [ @.str.2, %if.then ], [ @.str.3, %for.inc ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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>
#include<string.h>
int main(void){
char s[11];
scanf("%s",s);
int len = strlen(s);
int checkA = 0 , checkB = 0 , checkC = 0;
if(s[0]=='A'){
checkA++;
}
for(int i = 2;i < len-1;i ++){
if(s[i]=='C'){
checkB++;
}
}
for(int i = 0;i < len;i ++){
if(s[i]>='a'&&s[i]<='z'){
checkC ++;
}
}
if(checkA==1&&checkB==1&&checkC==len-2){
printf("AC");
}
else {
printf("WA");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278954/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278954/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"AC\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"WA\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%conv = trunc i64 %call2 to i32
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp562 = icmp sgt i32 %conv, 3
br i1 %cmp562, label %for.body.preheader, label %for.cond16.preheader
for.body.preheader: ; preds = %entry
%sub = add i64 %call2, 4294967295
%wide.trip.count = and i64 %sub, 4294967295
%1 = add nsw i64 %wide.trip.count, -2
%min.iters.check = icmp ult i64 %1, 8
br i1 %min.iters.check, label %for.body.preheader96, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %1, -8
%ind.end = or i64 %n.vec, 2
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%vec.phi75 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%offset.idx = or i64 %index, 2
%2 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %offset.idx
%wide.load = load <4 x i8>, ptr %2, align 1, !tbaa !5
%3 = getelementptr inbounds i8, ptr %2, i64 4
%wide.load76 = load <4 x i8>, ptr %3, align 1, !tbaa !5
%4 = icmp eq <4 x i8> %wide.load, <i8 67, i8 67, i8 67, i8 67>
%5 = icmp eq <4 x i8> %wide.load76, <i8 67, i8 67, i8 67, i8 67>
%6 = zext <4 x i1> %4 to <4 x i32>
%7 = zext <4 x i1> %5 to <4 x i32>
%8 = add <4 x i32> %vec.phi, %6
%9 = add <4 x i32> %vec.phi75, %7
%index.next = add nuw i64 %index, 8
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %9, %8
%11 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %1, %n.vec
br i1 %cmp.n, label %for.cond16.preheader.loopexit, label %for.body.preheader96
for.body.preheader96: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 2, %for.body.preheader ], [ %ind.end, %middle.block ]
%checkB.063.ph = phi i32 [ 0, %for.body.preheader ], [ %11, %middle.block ]
br label %for.body
for.cond16.preheader.loopexit: ; preds = %for.body, %middle.block
%spec.select.lcssa = phi i32 [ %11, %middle.block ], [ %spec.select, %for.body ]
%12 = icmp eq i32 %spec.select.lcssa, 1
br label %for.cond16.preheader
for.cond16.preheader: ; preds = %for.cond16.preheader.loopexit, %entry
%checkB.0.lcssa = phi i1 [ false, %entry ], [ %12, %for.cond16.preheader.loopexit ]
%cmp1765 = icmp sgt i32 %conv, 0
br i1 %cmp1765, label %for.body20.preheader, label %for.cond.cleanup19
for.body20.preheader: ; preds = %for.cond16.preheader
%wide.trip.count73 = and i64 %call2, 4294967295
%min.iters.check79 = icmp ult i64 %wide.trip.count73, 8
br i1 %min.iters.check79, label %for.body20.preheader94, label %vector.ph80
vector.ph80: ; preds = %for.body20.preheader
%n.mod.vf81 = and i64 %call2, 7
%n.vec82 = sub nsw i64 %wide.trip.count73, %n.mod.vf81
br label %vector.body85
vector.body85: ; preds = %vector.body85, %vector.ph80
%index86 = phi i64 [ 0, %vector.ph80 ], [ %index.next91, %vector.body85 ]
%vec.phi87 = phi <4 x i32> [ zeroinitializer, %vector.ph80 ], [ %21, %vector.body85 ]
%vec.phi88 = phi <4 x i32> [ zeroinitializer, %vector.ph80 ], [ %22, %vector.body85 ]
%13 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %index86
%wide.load89 = load <4 x i8>, ptr %13, align 1, !tbaa !5
%14 = getelementptr inbounds i8, ptr %13, i64 4
%wide.load90 = load <4 x i8>, ptr %14, align 1, !tbaa !5
%15 = add <4 x i8> %wide.load89, <i8 -97, i8 -97, i8 -97, i8 -97>
%16 = add <4 x i8> %wide.load90, <i8 -97, i8 -97, i8 -97, i8 -97>
%17 = icmp ult <4 x i8> %15, <i8 26, i8 26, i8 26, i8 26>
%18 = icmp ult <4 x i8> %16, <i8 26, i8 26, i8 26, i8 26>
%19 = zext <4 x i1> %17 to <4 x i32>
%20 = zext <4 x i1> %18 to <4 x i32>
%21 = add <4 x i32> %vec.phi87, %19
%22 = add <4 x i32> %vec.phi88, %20
%index.next91 = add nuw i64 %index86, 8
%23 = icmp eq i64 %index.next91, %n.vec82
br i1 %23, label %middle.block77, label %vector.body85, !llvm.loop !12
middle.block77: ; preds = %vector.body85
%bin.rdx92 = add <4 x i32> %22, %21
%24 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx92)
%cmp.n84 = icmp eq i64 %n.mod.vf81, 0
br i1 %cmp.n84, label %for.cond.cleanup19, label %for.body20.preheader94
for.body20.preheader94: ; preds = %for.body20.preheader, %middle.block77
%indvars.iv70.ph = phi i64 [ 0, %for.body20.preheader ], [ %n.vec82, %middle.block77 ]
%checkC.066.ph = phi i32 [ 0, %for.body20.preheader ], [ %24, %middle.block77 ]
br label %for.body20
for.body: ; preds = %for.body.preheader96, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader96 ]
%checkB.063 = phi i32 [ %spec.select, %for.body ], [ %checkB.063.ph, %for.body.preheader96 ]
%arrayidx7 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %indvars.iv
%25 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp9 = icmp eq i8 %25, 67
%inc12 = zext i1 %cmp9 to i32
%spec.select = add nuw nsw i32 %checkB.063, %inc12
%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.cond16.preheader.loopexit, label %for.body, !llvm.loop !13
for.cond.cleanup19: ; preds = %for.body20, %middle.block77, %for.cond16.preheader
%checkC.0.lcssa = phi i32 [ 0, %for.cond16.preheader ], [ %24, %middle.block77 ], [ %checkC.1, %for.body20 ]
%cmp = icmp eq i8 %0, 65
%or.cond = select i1 %cmp, i1 %checkB.0.lcssa, i1 false
%sub43 = add nsw i32 %conv, -2
%cmp44 = icmp eq i32 %checkC.0.lcssa, %sub43
%or.cond61 = select i1 %or.cond, i1 %cmp44, i1 false
%.str.1..str.2 = select i1 %or.cond61, ptr @.str.1, ptr @.str.2
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %s) #5
ret i32 0
for.body20: ; preds = %for.body20.preheader94, %for.body20
%indvars.iv70 = phi i64 [ %indvars.iv.next71, %for.body20 ], [ %indvars.iv70.ph, %for.body20.preheader94 ]
%checkC.066 = phi i32 [ %checkC.1, %for.body20 ], [ %checkC.066.ph, %for.body20.preheader94 ]
%arrayidx22 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %indvars.iv70
%26 = load i8, ptr %arrayidx22, align 1, !tbaa !5
%27 = add i8 %26, -97
%or.cond60 = icmp ult i8 %27, 26
%inc32 = zext i1 %or.cond60 to i32
%checkC.1 = add nuw nsw i32 %checkC.066, %inc32
%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.cond.cleanup19, label %for.body20, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !10, !11}
!13 = distinct !{!13, !9, !11, !10}
!14 = distinct !{!14, !9, !11, !10}
|
# include <stdio.h>
# include <string.h>
int main(){
char S[10];
int flg = 0;
scanf("%s", S);
if (S[0] != 'A') flg = 1;
else S[0] = 'a';
int ct = 0;
for (int i = 2; i < strlen(S)-1; ++i){
if (S[i] == 'C'){
S[i] = 'c';
ct++;
}
}
if (ct != 1) flg = 1;
if (flg == 0){
for (int i = 0; i < strlen(S); ++i){
if ('a' <= S[i] && S[i] <= 'z')
continue;
else{
flg = 1;
break;
}
}
}
if (flg == 0) printf("AC");
else printf("WA");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278998/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278998/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"AC\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"WA\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %S) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%0 = load i8, ptr %S, align 1, !tbaa !5
%cmp.not = icmp eq i8 %0, 65
br i1 %cmp.not, label %if.else, label %if.end
if.else: ; preds = %entry
store i8 97, ptr %S, align 1, !tbaa !5
br label %if.end
if.end: ; preds = %entry, %if.else
%call568 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %S) #5
%1 = add i64 %call568, -4
%cmp670 = icmp ult i64 %1, -3
br i1 %cmp670, label %for.body, label %if.end55
for.cond.cleanup: ; preds = %for.inc
%2 = icmp eq i32 %ct.1, 1
%cmp21 = and i1 %cmp.not, %2
br i1 %cmp21, label %for.cond25.preheader, label %if.end55
for.cond25.preheader: ; preds = %for.cond.cleanup
%cmp29.not75.not = icmp eq i64 %call5, 0
br i1 %cmp29.not75.not, label %if.end55, label %for.body32
for.body: ; preds = %if.end, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 2, %if.end ]
%ct.071 = phi i32 [ %ct.1, %for.inc ], [ 0, %if.end ]
%arrayidx8 = getelementptr inbounds [10 x i8], ptr %S, i64 0, i64 %indvars.iv
%3 = load i8, ptr %arrayidx8, align 1, !tbaa !5
%cmp10 = icmp eq i8 %3, 67
br i1 %cmp10, label %if.then12, label %for.inc
if.then12: ; preds = %for.body
store i8 99, ptr %arrayidx8, align 1, !tbaa !5
%inc = add nsw i32 %ct.071, 1
br label %for.inc
for.inc: ; preds = %for.body, %if.then12
%ct.1 = phi i32 [ %inc, %if.then12 ], [ %ct.071, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%call5 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %S) #5
%sub = add i64 %call5, -1
%cmp6 = icmp ugt i64 %sub, %indvars.iv.next
br i1 %cmp6, label %for.body, label %for.cond.cleanup, !llvm.loop !8
for.cond25: ; preds = %for.body32
%indvars.iv.next81 = add nuw i64 %indvars.iv80, 1
%exitcond.not = icmp eq i64 %indvars.iv.next81, %call5
br i1 %exitcond.not, label %if.end55, label %for.body32, !llvm.loop !10
for.body32: ; preds = %for.cond25.preheader, %for.cond25
%indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.cond25 ], [ 0, %for.cond25.preheader ]
%arrayidx34 = getelementptr inbounds [10 x i8], ptr %S, i64 0, i64 %indvars.iv80
%4 = load i8, ptr %arrayidx34, align 1, !tbaa !5
%5 = add i8 %4, -97
%or.cond = icmp ult i8 %5, 26
br i1 %or.cond, label %for.cond25, label %if.end55
if.end55: ; preds = %for.body32, %for.cond25, %for.cond.cleanup, %if.end, %for.cond25.preheader
%.str.2.sink = phi ptr [ @.str.1, %for.cond25.preheader ], [ @.str.2, %if.end ], [ @.str.2, %for.cond.cleanup ], [ @.str.1, %for.cond25 ], [ @.str.2, %for.body32 ]
%call54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 10, 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 i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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 nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#include<stdio.h>
#include<string.h>
int main()
{
char s[20];
scanf("%s",s);
int k=0,l,i,j=0,c=0;
l=strlen(s);
if(s[0]=='A') k++;
for(i=2;i<l-1;i++)
{
if(s[i]=='C') j++;
if(s[i]>='a') c++;
}
//printf("%d\n",k);
if(j==1) k++;
//printf("%d\n",k);
if(s[1]>='a'&&s[l-1]>='a') c+=2;
if(c==l-2) k++;
//printf("%d\n",k);
if(k==3) printf("AC\n");
else printf("WA\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279054/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279054/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"WA\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"AC\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %s) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #7
%conv = trunc i64 %call2 to i32
%0 = load i8, ptr %s, align 16, !tbaa !5
%cmp = icmp eq i8 %0, 65
%spec.select = zext i1 %cmp to i32
%sub = add i32 %conv, -1
%cmp568 = icmp sgt i32 %conv, 3
br i1 %cmp568, label %for.body.preheader, label %for.end.thread
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %sub to i64
%1 = add nsw i64 %wide.trip.count, -2
%min.iters.check = icmp ult i64 %1, 8
br i1 %min.iters.check, label %for.body.preheader87, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %1, -8
%ind.end = or i64 %n.vec, 2
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %16, %vector.body ]
%vec.phi81 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%vec.phi82 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%vec.phi83 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%offset.idx = or i64 %index, 2
%2 = getelementptr inbounds [20 x i8], ptr %s, i64 0, i64 %offset.idx
%wide.load = load <4 x i8>, ptr %2, align 2, !tbaa !5
%3 = getelementptr inbounds i8, ptr %2, i64 4
%wide.load84 = load <4 x i8>, ptr %3, align 2, !tbaa !5
%4 = freeze <4 x i8> %wide.load
%5 = freeze <4 x i8> %wide.load84
%6 = icmp eq <4 x i8> %4, <i8 67, i8 67, i8 67, i8 67>
%7 = icmp eq <4 x i8> %5, <i8 67, i8 67, i8 67, i8 67>
%8 = zext <4 x i1> %6 to <4 x i32>
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = add <4 x i32> %vec.phi82, %8
%11 = add <4 x i32> %vec.phi83, %9
%12 = icmp sgt <4 x i8> %4, <i8 96, i8 96, i8 96, i8 96>
%13 = icmp sgt <4 x i8> %5, <i8 96, i8 96, i8 96, i8 96>
%14 = zext <4 x i1> %12 to <4 x i32>
%15 = zext <4 x i1> %13 to <4 x i32>
%16 = add <4 x i32> %vec.phi, %14
%17 = add <4 x i32> %vec.phi81, %15
%index.next = add nuw i64 %index, 8
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx85 = add <4 x i32> %11, %10
%19 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx85)
%bin.rdx = add <4 x i32> %17, %16
%20 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %1, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader87
for.body.preheader87: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 2, %for.body.preheader ], [ %ind.end, %middle.block ]
%c.071.ph = phi i32 [ 0, %for.body.preheader ], [ %20, %middle.block ]
%j.070.ph = phi i32 [ 0, %for.body.preheader ], [ %19, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader87, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader87 ]
%c.071 = phi i32 [ %c.1, %for.body ], [ %c.071.ph, %for.body.preheader87 ]
%j.070 = phi i32 [ %spec.select64, %for.body ], [ %j.070.ph, %for.body.preheader87 ]
%arrayidx7 = getelementptr inbounds [20 x i8], ptr %s, i64 0, i64 %indvars.iv
%21 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%.fr = freeze i8 %21
%cmp9 = icmp eq i8 %.fr, 67
%inc12 = zext i1 %cmp9 to i32
%spec.select64 = add i32 %j.070, %inc12
%cmp17 = icmp sgt i8 %.fr, 96
%inc20 = zext i1 %cmp17 to i32
%c.1 = add nuw nsw i32 %c.071, %inc20
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %middle.block
%spec.select64.lcssa = phi i32 [ %19, %middle.block ], [ %spec.select64, %for.body ]
%c.1.lcssa = phi i32 [ %20, %middle.block ], [ %c.1, %for.body ]
%22 = icmp eq i32 %spec.select64.lcssa, 1
%inc26 = select i1 %cmp, i32 2, i32 1
%spec.select80 = select i1 %22, i32 %inc26, i32 %spec.select
br label %for.end.thread
for.end.thread: ; preds = %for.end, %entry
%c.0.lcssa79 = phi i32 [ 0, %entry ], [ %c.1.lcssa, %for.end ]
%23 = phi i32 [ %spec.select, %entry ], [ %spec.select80, %for.end ]
%arrayidx28 = getelementptr inbounds [20 x i8], ptr %s, i64 0, i64 1
%24 = load i8, ptr %arrayidx28, align 1, !tbaa !5
%cmp30 = icmp sgt i8 %24, 96
br i1 %cmp30, label %land.lhs.true, label %if.end39
land.lhs.true: ; preds = %for.end.thread
%idxprom33 = sext i32 %sub to i64
%arrayidx34 = getelementptr inbounds [20 x i8], ptr %s, i64 0, i64 %idxprom33
%25 = load i8, ptr %arrayidx34, align 1, !tbaa !5
%cmp36 = icmp sgt i8 %25, 96
%add = add nsw i32 %c.0.lcssa79, 2
%spec.select66 = select i1 %cmp36, i32 %add, i32 %c.0.lcssa79
br label %if.end39
if.end39: ; preds = %land.lhs.true, %for.end.thread
%c.2 = phi i32 [ %c.0.lcssa79, %for.end.thread ], [ %spec.select66, %land.lhs.true ]
%sub40 = add nsw i32 %conv, -2
%cmp41 = icmp eq i32 %c.2, %sub40
%inc44 = zext i1 %cmp41 to i32
%spec.select67 = add nuw nsw i32 %23, %inc44
%cmp46 = icmp eq i32 %spec.select67, 3
%str.3.str = select i1 %cmp46, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %s) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
|
#include <stdio.h>
#include <string.h>
int main(){
char x[20];
char y[20];
int i,j=0;
scanf("%s", x);
for(i=0;i<strlen(x);i++){
if(x[i]>='A'&&x[i]<='Z'){
y[j]=x[i];
j++;
}
}
if(x[0]=='A'&&j==2&&y[1]=='C'&&x[strlen(x)-1]!='C'&&x[1]!='C'){
printf("AC\n");
}
else{
printf("WA\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279098/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279098/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"WA\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"AC\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca [20 x i8], align 16
%y = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %y) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %x) #6
%cmp55.not = icmp eq i64 %call2, 0
br i1 %cmp55.not, label %if.else, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call2, 1
%0 = icmp eq i64 %call2, 1
br i1 %0, label %for.end.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call2, -2
br label %for.body
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 ]
%j.057 = phi i32 [ 0, %for.body.preheader.new ], [ %j.1.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [20 x i8], ptr %x, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 2, !tbaa !5
%2 = add i8 %1, -65
%or.cond54 = icmp ult i8 %2, 26
br i1 %or.cond54, label %if.then, label %for.inc
if.then: ; preds = %for.body
%idxprom14 = sext i32 %j.057 to i64
%arrayidx15 = getelementptr inbounds [20 x i8], ptr %y, i64 0, i64 %idxprom14
store i8 %1, ptr %arrayidx15, align 1, !tbaa !5
%inc = add nsw i32 %j.057, 1
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%j.1 = phi i32 [ %inc, %if.then ], [ %j.057, %for.body ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [20 x i8], ptr %x, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%4 = add i8 %3, -65
%or.cond54.1 = icmp ult i8 %4, 26
br i1 %or.cond54.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.inc
%idxprom14.1 = sext i32 %j.1 to i64
%arrayidx15.1 = getelementptr inbounds [20 x i8], ptr %y, i64 0, i64 %idxprom14.1
store i8 %3, ptr %arrayidx15.1, align 1, !tbaa !5
%inc.1 = add nsw i32 %j.1, 1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%j.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ %j.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.end.unr-lcssa, label %for.body, !llvm.loop !8
for.end.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%j.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %j.1.1, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%j.057.unr = phi i32 [ 0, %for.body.preheader ], [ %j.1.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.unr-lcssa
%arrayidx.epil = getelementptr inbounds [20 x i8], ptr %x, i64 0, i64 %indvars.iv.unr
%5 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
%6 = add i8 %5, -65
%or.cond54.epil = icmp ult i8 %6, 26
br i1 %or.cond54.epil, label %if.then.epil, label %for.end
if.then.epil: ; preds = %for.body.epil
%idxprom14.epil = sext i32 %j.057.unr to i64
%arrayidx15.epil = getelementptr inbounds [20 x i8], ptr %y, i64 0, i64 %idxprom14.epil
store i8 %5, ptr %arrayidx15.epil, align 1, !tbaa !5
%inc.epil = add nsw i32 %j.057.unr, 1
br label %for.end
for.end: ; preds = %for.body.epil, %if.then.epil, %for.end.unr-lcssa
%j.1.lcssa = phi i32 [ %j.1.lcssa.ph, %for.end.unr-lcssa ], [ %inc.epil, %if.then.epil ], [ %j.057.unr, %for.body.epil ]
%arrayidx25.phi.trans.insert = getelementptr inbounds [20 x i8], ptr %y, i64 0, i64 1
%.pre = load i8, ptr %arrayidx25.phi.trans.insert, align 1
%7 = icmp eq i32 %j.1.lcssa, 2
%8 = icmp eq i8 %.pre, 67
%9 = load i8, ptr %x, align 16, !tbaa !5
%cmp19 = icmp eq i8 %9, 65
%or.cond = select i1 %cmp19, i1 %7, i1 false
%or.cond45 = select i1 %or.cond, i1 %8, i1 false
br i1 %or.cond45, label %land.lhs.true29, label %if.else
land.lhs.true29: ; preds = %for.end
%sub = add i64 %call2, -1
%arrayidx32 = getelementptr inbounds [20 x i8], ptr %x, i64 0, i64 %sub
%10 = load i8, ptr %arrayidx32, align 1, !tbaa !5
%cmp34 = icmp ne i8 %10, 67
%arrayidx37 = getelementptr inbounds [20 x i8], ptr %x, i64 0, i64 1
%11 = load i8, ptr %arrayidx37, align 1
%cmp39 = icmp ne i8 %11, 67
%or.cond46 = select i1 %cmp34, i1 %cmp39, i1 false
br i1 %or.cond46, label %if.end44, label %if.else
if.else: ; preds = %entry, %land.lhs.true29, %for.end
br label %if.end44
if.end44: ; preds = %land.lhs.true29, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %land.lhs.true29 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int main()
{
char s[15];
scanf("%s",s);
int n=strlen(s);
int f=0;
int sum=0;
for(int i=0;i<n;i++){
if(s[0]!='A'){
f=1;
break;
}
if(s[1]=='C'||s[n-1]=='C'){
f=1;
break;
}
else if(s[i]=='C'){
sum++;
}
if(s[i]>'A'&&s[i]<'C'||s[i]>'C'&&s[i]<'Z'){
f=1;
break;
}
}
if(sum==1&&f==0){
printf("AC\n");
}
else printf("WA\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279155/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279155/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"WA\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"AC\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [15 x i8], align 1
call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%conv = trunc i64 %call2 to i32
%0 = load i8, ptr %s, align 1
%.fr96 = freeze i8 %0
%cmp5.not = icmp ne i8 %.fr96, 65
%arrayidx7 = getelementptr inbounds [15 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx7, align 1
%.fr = freeze i8 %1
%cmp9 = icmp eq i8 %.fr, 67
%cmp74 = icmp slt i32 %conv, 1
%2 = or i1 %cmp5.not, %cmp9
%or.cond7176 = or i1 %2, %cmp74
br i1 %or.cond7176, label %if.else56, label %lor.lhs.false.lr.ph
lor.lhs.false.lr.ph: ; preds = %entry
%sub = shl i64 %call2, 32
%sext = add i64 %sub, -4294967296
%idxprom = ashr exact i64 %sext, 32
%arrayidx11 = getelementptr inbounds [15 x i8], ptr %s, i64 0, i64 %idxprom
%3 = load i8, ptr %arrayidx11, align 1, !tbaa !5
%cmp13 = icmp eq i8 %3, 67
br i1 %cmp13, label %if.else56, label %for.cond.preheader
for.cond.preheader: ; preds = %lor.lhs.false.lr.ph
%sext99 = shl i64 %call2, 32
%4 = ashr exact i64 %sext99, 32
%wide.trip.count = and i64 %call2, 4294967295
br label %for.cond
for.cond: ; preds = %for.cond.preheader, %lor.lhs.false
%indvars.iv = phi i64 [ 1, %for.cond.preheader ], [ %indvars.iv.next, %lor.lhs.false ]
%spec.select91 = phi i32 [ 0, %for.cond.preheader ], [ %spec.select, %lor.lhs.false ]
%exitcond = icmp eq i64 %indvars.iv, %wide.trip.count
br i1 %exitcond, label %cleanup, label %lor.lhs.false, !llvm.loop !8
lor.lhs.false: ; preds = %for.cond
%arrayidx17 = getelementptr inbounds [15 x i8], ptr %s, i64 0, i64 %indvars.iv
%5 = load i8, ptr %arrayidx17, align 1, !tbaa !5
%cmp19 = icmp eq i8 %5, 67
%inc = zext i1 %cmp19 to i32
%spec.select = add nuw nsw i32 %spec.select91, %inc
%cmp32 = icmp eq i8 %5, 66
%6 = add i8 %5, -68
%or.cond69 = icmp ult i8 %6, 22
%or.cond73 = or i1 %cmp32, %or.cond69
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br i1 %or.cond73, label %cleanup, label %for.cond, !llvm.loop !8
cleanup: ; preds = %for.cond, %lor.lhs.false
%sum.2.ph = phi i32 [ %spec.select91, %for.cond ], [ %spec.select, %lor.lhs.false ]
%cmp.le = icmp sge i64 %indvars.iv, %4
%7 = icmp eq i32 %sum.2.ph, 1
%or.cond = and i1 %cmp.le, %7
br i1 %or.cond, label %if.end58, label %if.else56
if.else56: ; preds = %entry, %lor.lhs.false.lr.ph, %cleanup
br label %if.end58
if.end58: ; preds = %cleanup, %if.else56
%str.sink = phi ptr [ @str, %if.else56 ], [ @str.3, %cleanup ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 main(int argc, const char * argv[]) {
int n;
scanf("%d",&n);
int *array = (int*)malloc(sizeof(int*) * n);
int j;
for (j=0; j<n; j++) {
scanf("%d", &array[j]);
}
int i;
for(i=0;i<n;i++){
printf("%d",array[n-i-1]);
if(i==n-1){
printf("\n");
}
else{
printf(" ");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279199/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279199/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #6
%cmp27 = icmp sgt i32 %0, 0
br i1 %cmp27, label %for.body, label %for.end19
for.cond4.preheader: ; preds = %for.body
%cmp529 = icmp sgt i32 %1, 0
br i1 %cmp529, label %for.body7, label %for.end19
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.cond4.preheader, !llvm.loop !9
for.body7: ; preds = %for.cond4.preheader, %for.body7
%3 = phi i32 [ %7, %for.body7 ], [ %1, %for.cond4.preheader ]
%i.030 = phi i32 [ %inc18, %for.body7 ], [ 0, %for.cond4.preheader ]
%4 = xor i32 %i.030, -1
%sub8 = add i32 %3, %4
%idxprom9 = sext i32 %sub8 to i64
%arrayidx10 = getelementptr inbounds i32, ptr %call1, i64 %idxprom9
%5 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%6 = load i32, ptr %n, align 4, !tbaa !5
%sub12 = add nsw i32 %6, -1
%cmp13 = icmp eq i32 %i.030, %sub12
%. = select i1 %cmp13, i32 10, i32 32
%putchar26 = call i32 @putchar(i32 %.)
%inc18 = add nuw nsw i32 %i.030, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp5 = icmp slt i32 %inc18, %7
br i1 %cmp5, label %for.body7, label %for.end19, !llvm.loop !11
for.end19: ; preds = %for.body7, %entry, %for.cond4.preheader
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 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
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void)
{
int n, i;
int num[101];
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d", &num[i]);
}
for (i = n - 1; i > 0; i--){
printf("%d ", num[i]);
}
printf("%d\n", num[0]);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279256/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279256/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%n = alloca i32, align 4
%num = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %num) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body, label %for.end9
for.cond2.preheader: ; preds = %for.body
%cmp319 = icmp sgt i32 %2, 1
br i1 %cmp319, label %for.body4.preheader, label %for.end9
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = zext i32 %2 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x i32], ptr %num, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4.preheader, %for.body4
%indvars.iv23 = phi i64 [ %1, %for.body4.preheader ], [ %indvars.iv.next24, %for.body4 ]
%indvars.iv.next24 = add nsw i64 %indvars.iv23, -1
%idxprom5 = and i64 %indvars.iv.next24, 4294967295
%arrayidx6 = getelementptr inbounds [101 x i32], ptr %num, i64 0, i64 %idxprom5
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%cmp3 = icmp ugt i64 %indvars.iv23, 2
br i1 %cmp3, label %for.body4, label %for.end9, !llvm.loop !11
for.end9: ; preds = %for.body4, %entry, %for.cond2.preheader
%5 = load i32, ptr %num, align 16, !tbaa !5
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %5)
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %num) #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}
|
#include<stdio.h>
int main()
{
int n,m,a,b,i,j,u,v,count=0;
scanf("%d%d%d%d",&n,&m,&a,&b);
if(m*a>=b)
{
i=n/m;
count=i*b;
j=n%m;
u=count+b;
v=count+(j*a);
if(u>=v)
count=v;
else
count=u;
}
else if(m*a<b)
{
count=a*n;
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2793/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2793/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %m, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %1, %0
%2 = load i32, ptr %b, align 4, !tbaa !5
%cmp.not = icmp slt i32 %mul, %2
%3 = load i32, ptr %n, align 4, !tbaa !5
br i1 %cmp.not, label %if.then9, label %if.then
if.then: ; preds = %entry
%div = sdiv i32 %3, %0
%mul1 = mul nsw i32 %div, %2
%rem = srem i32 %3, %0
%mul2 = mul nsw i32 %rem, %1
%cmp4.not = icmp slt i32 %2, %mul2
br i1 %cmp4.not, label %if.else, label %if.then5
if.then5: ; preds = %if.then
%add3 = add nsw i32 %mul2, %mul1
br label %if.end12
if.else: ; preds = %if.then
%add = add nsw i32 %mul1, %2
br label %if.end12
if.then9: ; preds = %entry
%mul10 = mul nsw i32 %3, %1
br label %if.end12
if.end12: ; preds = %if.then9, %if.then5, %if.else
%count.0 = phi i32 [ %add3, %if.then5 ], [ %add, %if.else ], [ %mul10, %if.then9 ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int i;
int n;
int a[101];
scanf("%d", &n);
for (i = 1; i <= n; i++){
scanf("%d", &a[i]);
}
for (i = n; i > 0; i--){
printf("%d", a[i]);
if (i != 1){
printf(" ");
}
else {
printf("\n");
}
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279357/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279357/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not20 = icmp slt i32 %0, 1
br i1 %cmp.not20, label %for.end12, label %for.body
for.cond2.preheader: ; preds = %for.body
%cmp322 = icmp sgt i32 %3, 0
br i1 %cmp322, label %for.body4.preheader, label %for.end12
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = zext i32 %3 to i64
%arrayidx633 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %1
%2 = load i32, ptr %arrayidx633, align 4, !tbaa !5
%call734 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2)
%cmp8.not35 = icmp eq i32 %3, 1
br i1 %cmp8.not35, label %for.end12.loopexit, label %for.inc11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %4
br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.inc11: ; preds = %for.body4.preheader, %for.inc11
%indvars.iv2636 = phi i64 [ %indvars.iv.next27, %for.inc11 ], [ %1, %for.body4.preheader ]
%putchar19 = call i32 @putchar(i32 32)
%indvars.iv.next27 = add nsw i64 %indvars.iv2636, -1
%arrayidx6 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv.next27
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%cmp8.not = icmp eq i64 %indvars.iv.next27, 1
br i1 %cmp8.not, label %for.end12.loopexit, label %for.inc11, !llvm.loop !11
for.end12.loopexit: ; preds = %for.inc11, %for.body4.preheader
%putchar = call i32 @putchar(i32 10)
br label %for.end12
for.end12: ; preds = %entry, %for.end12.loopexit, %for.cond2.preheader
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
long long int a[10000000];
int main()
{ long long int t,l,r,n,k,i;
scanf("%lld",&n);
for ( i = 0; i < 1000000; ++i)
{
a[i]=-1;
}
for (i = 0; i < n; ++i)
{
scanf("%lld",&k);
a[k]=1;
}
l=1;
r=1000000;
t=0;
k=0;
while(k<n)
{ t++;
l++;
r--;
if (a[l]==1)
{
k++;
a[l]=-1;
}
if (a[r]==1)
{
a[r]=-1;
k++;
}
}
printf("%lld\n",t);
return 0; } | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27940/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27940/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@a = dso_local local_unnamed_addr global [10000000 x i64] zeroinitializer, align 16
@.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 i64, align 8
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8000000) @a, i8 -1, i64 8000000, i1 false), !tbaa !5
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp233 = icmp sgt i64 %0, 0
br i1 %cmp233, label %for.body3, label %for.end8.thread
for.end8.thread: ; preds = %entry
store i64 0, ptr %k, align 8, !tbaa !5
br label %while.end
for.body3: ; preds = %entry, %for.body3
%i.134 = phi i64 [ %inc7, %for.body3 ], [ 0, %entry ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%1 = load i64, ptr %k, align 8, !tbaa !5
%arrayidx5 = getelementptr inbounds [10000000 x i64], ptr @a, i64 0, i64 %1
store i64 1, ptr %arrayidx5, align 8, !tbaa !5
%inc7 = add nuw nsw i64 %i.134, 1
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp2 = icmp slt i64 %inc7, %2
br i1 %cmp2, label %for.body3, label %for.end8, !llvm.loop !9
for.end8: ; preds = %for.body3
store i64 0, ptr %k, align 8, !tbaa !5
%cmp938 = icmp sgt i64 %2, 0
br i1 %cmp938, label %while.body, label %while.end
while.body: ; preds = %for.end8, %if.end21
%r.042 = phi i64 [ %dec, %if.end21 ], [ 1000000, %for.end8 ]
%l.041 = phi i64 [ %inc11, %if.end21 ], [ 1, %for.end8 ]
%t.040 = phi i64 [ %inc10, %if.end21 ], [ 0, %for.end8 ]
%inc203539 = phi i64 [ %inc2036, %if.end21 ], [ 0, %for.end8 ]
%inc10 = add nuw nsw i64 %t.040, 1
%inc11 = add nuw nsw i64 %l.041, 1
%dec = add nsw i64 %r.042, -1
%arrayidx12 = getelementptr inbounds [10000000 x i64], ptr @a, i64 0, i64 %inc11
%3 = load i64, ptr %arrayidx12, align 8, !tbaa !5
%cmp13 = icmp eq i64 %3, 1
br i1 %cmp13, label %if.then, label %if.end
if.then: ; preds = %while.body
%inc14 = add nsw i64 %inc203539, 1
store i64 %inc14, ptr %k, align 8, !tbaa !5
store i64 -1, ptr %arrayidx12, align 8, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %while.body
%inc2037 = phi i64 [ %inc14, %if.then ], [ %inc203539, %while.body ]
%arrayidx16 = getelementptr inbounds [10000000 x i64], ptr @a, i64 0, i64 %dec
%4 = load i64, ptr %arrayidx16, align 8, !tbaa !5
%cmp17 = icmp eq i64 %4, 1
br i1 %cmp17, label %if.then18, label %if.end21
if.then18: ; preds = %if.end
store i64 -1, ptr %arrayidx16, align 8, !tbaa !5
%inc20 = add nsw i64 %inc2037, 1
store i64 %inc20, ptr %k, align 8, !tbaa !5
br label %if.end21
if.end21: ; preds = %if.then18, %if.end
%inc2036 = phi i64 [ %inc20, %if.then18 ], [ %inc2037, %if.end ]
%cmp9 = icmp slt i64 %inc2036, %2
br i1 %cmp9, label %while.body, label %while.end, !llvm.loop !11
while.end: ; preds = %if.end21, %for.end8.thread, %for.end8
%t.0.lcssa = phi i64 [ 0, %for.end8 ], [ 0, %for.end8.thread ], [ %inc10, %if.end21 ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %t.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void)
{
int i,n,j;
scanf("%d",&i);
int a[i];
j=i-1;
for(n=j;n>=0;n--)
{
scanf("%d",&a[n]);
}
for(n=0;n<=j;n++)
{
printf("%d",a[n]);
if(n!=j)
printf(" ");
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279443/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279443/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%0 = load i32, ptr %i, 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 %i, align 4, !tbaa !5
%sub = add i32 %3, -1
%cmp22 = icmp sgt i32 %3, 0
br i1 %cmp22, label %for.body.preheader, label %for.end11
for.body.preheader: ; preds = %entry
%4 = zext i32 %sub to i64
br label %for.body
for.cond2.preheader: ; preds = %for.body
br i1 %cmp22, label %for.body4.preheader, label %for.end11
for.body4.preheader: ; preds = %for.cond2.preheader
%5 = zext i32 %sub to i64
%wide.trip.count = zext i32 %3 to i64
br label %for.body4
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ %4, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%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 nsw i64 %indvars.iv, -1
%cmp.not = icmp eq i64 %indvars.iv, 0
br i1 %cmp.not, label %for.cond2.preheader, label %for.body, !llvm.loop !9
for.body4: ; preds = %for.body4.preheader, %for.inc10
%indvars.iv27 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next28, %for.inc10 ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv27
%6 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%cmp8.not = icmp eq i64 %indvars.iv27, %5
br i1 %cmp8.not, label %for.inc10, label %if.then
if.then: ; preds = %for.body4
%putchar21 = call i32 @putchar(i32 32)
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
%exitcond.not = icmp eq i64 %indvars.iv.next28, %wide.trip.count
br i1 %exitcond.not, label %for.end11, label %for.body4, !llvm.loop !11
for.end11: ; preds = %for.inc10, %entry, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void){
int n;
int a[100];
int i;
scanf("%d", &n);
for(i=0;i<n;i++){
scanf("%d", &a[i]);
}
for(i= n-1;i>=0;i--){
printf("%d", a[i]);
if(i != 0) printf(" ");
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279494/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279494/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400, 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
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end11
for.cond2.preheader: ; preds = %for.body
%cmp323 = icmp sgt i32 %2, 0
br i1 %cmp323, label %for.body4.preheader, label %for.end11
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = zext i32 %2 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4.preheader, %for.inc10
%indvars.iv27 = phi i64 [ %1, %for.body4.preheader ], [ %indvars.iv.next28, %for.inc10 ]
%indvars.iv.next28 = add nsw i64 %indvars.iv27, -1
%idxprom5 = and i64 %indvars.iv.next28, 4294967295
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom5
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = and i64 %indvars.iv.next28, 4294967295
%cmp8.not = icmp eq i64 %5, 0
br i1 %cmp8.not, label %for.inc10, label %if.then
if.then: ; preds = %for.body4
%putchar19 = call i32 @putchar(i32 32)
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%cmp3 = icmp ugt i64 %indvars.iv27, 1
br i1 %cmp3, label %for.body4, label %for.end11, !llvm.loop !11
for.end11: ; preds = %for.inc10, %entry, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
# include"stdio.h"
int main(){
int n,m;
scanf("%d %d",&n,&m);
int r[m][2];
for(int i=0;i<m;i++)
scanf("%d %d",&r[i][0],&r[i][1]);
int c[n+1];
for(int i=0;i<n+1;i++) c[i]=0;
for(int i=0;i<m;i++){
c[r[i][0]]++;
c[r[i][1]]++;
}
for(int i=1;i<n+1;i++)
printf("%d\n",c[i]);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279559/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279559/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, 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
%cmp60 = icmp sgt i32 %3, 0
br i1 %cmp60, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %3, %entry ], [ %7, %for.body ]
%4 = load i32, ptr %n, align 4, !tbaa !5
%add = add i32 %4, 1
%5 = zext i32 %add to i64
%vla6 = alloca i32, i64 %5, align 16
%cmp10.not62 = icmp slt i32 %4, 0
br i1 %cmp10.not62, label %for.cond19.preheader, label %for.body12.preheader
for.body12.preheader: ; preds = %for.cond.cleanup
%6 = shl nuw nsw i64 %5, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla6, i8 0, i64 %6, i1 false), !tbaa !5
br label %for.cond19.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv, i64 1
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx4)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %m, 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.cond.cleanup, !llvm.loop !9
for.cond19.preheader: ; preds = %for.body12.preheader, %for.cond.cleanup
%cmp2064 = icmp sgt i32 %.lcssa, 0
br i1 %cmp2064, label %for.body22.preheader, label %for.cond39.preheader
for.body22.preheader: ; preds = %for.cond19.preheader
%wide.trip.count = zext i32 %.lcssa to i64
%xtraiter = and i64 %wide.trip.count, 1
%9 = icmp eq i32 %.lcssa, 1
br i1 %9, label %for.cond39.preheader.loopexit.unr-lcssa, label %for.body22.preheader.new
for.body22.preheader.new: ; preds = %for.body22.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body22
for.cond39.preheader.loopexit.unr-lcssa: ; preds = %for.body22, %for.body22.preheader
%indvars.iv73.unr = phi i64 [ 0, %for.body22.preheader ], [ %indvars.iv.next74.1, %for.body22 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond39.preheader, label %for.body22.epil
for.body22.epil: ; preds = %for.cond39.preheader.loopexit.unr-lcssa
%arrayidx24.epil = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv73.unr
%10 = load i32, ptr %arrayidx24.epil, align 8, !tbaa !5
%idxprom26.epil = sext i32 %10 to i64
%arrayidx27.epil = getelementptr inbounds i32, ptr %vla6, i64 %idxprom26.epil
%11 = load i32, ptr %arrayidx27.epil, align 4, !tbaa !5
%inc28.epil = add nsw i32 %11, 1
store i32 %inc28.epil, ptr %arrayidx27.epil, align 4, !tbaa !5
%arrayidx31.epil = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv73.unr, i64 1
%12 = load i32, ptr %arrayidx31.epil, align 4, !tbaa !5
%idxprom32.epil = sext i32 %12 to i64
%arrayidx33.epil = getelementptr inbounds i32, ptr %vla6, i64 %idxprom32.epil
%13 = load i32, ptr %arrayidx33.epil, align 4, !tbaa !5
%inc34.epil = add nsw i32 %13, 1
store i32 %inc34.epil, ptr %arrayidx33.epil, align 4, !tbaa !5
br label %for.cond39.preheader
for.cond39.preheader: ; preds = %for.body22.epil, %for.cond39.preheader.loopexit.unr-lcssa, %for.cond19.preheader
%cmp41.not66 = icmp slt i32 %4, 1
br i1 %cmp41.not66, label %for.cond.cleanup42, label %for.body43
for.body22: ; preds = %for.body22, %for.body22.preheader.new
%indvars.iv73 = phi i64 [ 0, %for.body22.preheader.new ], [ %indvars.iv.next74.1, %for.body22 ]
%niter = phi i64 [ 0, %for.body22.preheader.new ], [ %niter.next.1, %for.body22 ]
%arrayidx24 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv73
%14 = load i32, ptr %arrayidx24, align 16, !tbaa !5
%idxprom26 = sext i32 %14 to i64
%arrayidx27 = getelementptr inbounds i32, ptr %vla6, i64 %idxprom26
%15 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%inc28 = add nsw i32 %15, 1
store i32 %inc28, ptr %arrayidx27, align 4, !tbaa !5
%arrayidx31 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv73, i64 1
%16 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%idxprom32 = sext i32 %16 to i64
%arrayidx33 = getelementptr inbounds i32, ptr %vla6, i64 %idxprom32
%17 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%inc34 = add nsw i32 %17, 1
store i32 %inc34, ptr %arrayidx33, align 4, !tbaa !5
%indvars.iv.next74 = or i64 %indvars.iv73, 1
%arrayidx24.1 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv.next74
%18 = load i32, ptr %arrayidx24.1, align 8, !tbaa !5
%idxprom26.1 = sext i32 %18 to i64
%arrayidx27.1 = getelementptr inbounds i32, ptr %vla6, i64 %idxprom26.1
%19 = load i32, ptr %arrayidx27.1, align 4, !tbaa !5
%inc28.1 = add nsw i32 %19, 1
store i32 %inc28.1, ptr %arrayidx27.1, align 4, !tbaa !5
%arrayidx31.1 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv.next74, i64 1
%20 = load i32, ptr %arrayidx31.1, align 4, !tbaa !5
%idxprom32.1 = sext i32 %20 to i64
%arrayidx33.1 = getelementptr inbounds i32, ptr %vla6, i64 %idxprom32.1
%21 = load i32, ptr %arrayidx33.1, align 4, !tbaa !5
%inc34.1 = add nsw i32 %21, 1
store i32 %inc34.1, ptr %arrayidx33.1, align 4, !tbaa !5
%indvars.iv.next74.1 = add nuw nsw i64 %indvars.iv73, 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.cond39.preheader.loopexit.unr-lcssa, label %for.body22, !llvm.loop !11
for.cond.cleanup42: ; preds = %for.body43, %for.cond39.preheader
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
for.body43: ; preds = %for.cond39.preheader, %for.body43
%indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.body43 ], [ 1, %for.cond39.preheader ]
%arrayidx45 = getelementptr inbounds i32, ptr %vla6, i64 %indvars.iv76
%22 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %22)
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%23 = load i32, ptr %n, align 4, !tbaa !5
%24 = sext i32 %23 to i64
%cmp41.not.not = icmp slt i64 %indvars.iv76, %24
br i1 %cmp41.not.not, label %for.body43, label %for.cond.cleanup42, !llvm.loop !12
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main()
{
int N,M,i,a,b;
int grad[1000];
scanf("%d", &N);
scanf("%d", &M);
for(i=1;i<=N;i++)
grad[i]=0;
for(i=1;i<=M;i++)
{
scanf("%d %d", &a, &b);
grad[a]=grad[a]+1;
grad[b]=grad[b]+1;
}
for(i=1;i<=N;i++)
printf("%d\n", grad[i]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279601/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279601/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\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
%grad = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %grad) #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 %M)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not34 = icmp slt i32 %0, 1
br i1 %cmp.not34, label %for.cond2.preheader, label %for.body.preheader
for.body.preheader: ; preds = %entry
%scevgep = getelementptr inbounds i8, ptr %grad, i64 4
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
call void @llvm.memset.p0.i64(ptr nonnull align 4 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body.preheader, %entry
%3 = load i32, ptr %M, align 4, !tbaa !5
%cmp3.not36 = icmp slt i32 %3, 1
br i1 %cmp3.not36, label %for.cond18.preheader, label %for.body4
for.cond18.preheader.loopexit: ; preds = %for.body4
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.cond18.preheader
for.cond18.preheader: ; preds = %for.cond18.preheader.loopexit, %for.cond2.preheader
%4 = phi i32 [ %.pre, %for.cond18.preheader.loopexit ], [ %0, %for.cond2.preheader ]
%cmp19.not38 = icmp slt i32 %4, 1
br i1 %cmp19.not38, label %for.end26, label %for.body20
for.body4: ; preds = %for.cond2.preheader, %for.body4
%i.137 = phi i32 [ %inc16, %for.body4 ], [ 1, %for.cond2.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%5 = load i32, ptr %a, align 4, !tbaa !5
%idxprom6 = sext i32 %5 to i64
%arrayidx7 = getelementptr inbounds [1000 x i32], ptr %grad, i64 0, i64 %idxprom6
%6 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %6, 1
store i32 %add, ptr %arrayidx7, align 4, !tbaa !5
%7 = load i32, ptr %b, align 4, !tbaa !5
%idxprom10 = sext i32 %7 to i64
%arrayidx11 = getelementptr inbounds [1000 x i32], ptr %grad, i64 0, i64 %idxprom10
%8 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%add12 = add nsw i32 %8, 1
store i32 %add12, ptr %arrayidx11, align 4, !tbaa !5
%inc16 = add nuw nsw i32 %i.137, 1
%9 = load i32, ptr %M, align 4, !tbaa !5
%cmp3.not.not = icmp slt i32 %i.137, %9
br i1 %cmp3.not.not, label %for.body4, label %for.cond18.preheader.loopexit, !llvm.loop !9
for.body20: ; preds = %for.cond18.preheader, %for.body20
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body20 ], [ 1, %for.cond18.preheader ]
%arrayidx22 = getelementptr inbounds [1000 x i32], ptr %grad, i64 0, i64 %indvars.iv
%10 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%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
%cmp19.not.not = icmp slt i64 %indvars.iv, %12
br i1 %cmp19.not.not, label %for.body20, label %for.end26, !llvm.loop !11
for.end26: ; preds = %for.body20, %for.cond18.preheader
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %grad) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<stdlib.h>
int mini(int a,int b){
int min=0;
if(a>b)
min=b;
else
min=a;
return min;
}
int main(){
int max=0;
int n;
scanf("%d",&n);
int arr[n];
int a[n];
for(int i=0;i<n;i++){
scanf("%d ",&arr[i]);
}
for(int i=0;i<n;i++){
a[i]=mini((arr[i]-1),(1000000-arr[i]));}
for(int i=0;i<n;i++){
if(a[i]>max)
max=a[i];}
printf("%d",max);
return 0;} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27966/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27966/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @mini(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%b.a = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %b.a
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%cmp43 = icmp sgt i32 %3, 0
br i1 %cmp43, label %for.body, label %for.cond.cleanup22
for.cond4.preheader: ; preds = %for.body
%cmp545 = icmp sgt i32 %16, 0
br i1 %cmp545, label %for.body7.preheader, label %for.cond.cleanup22
for.body7.preheader: ; preds = %for.cond4.preheader
%wide.trip.count = zext i32 %16 to i64
%min.iters.check = icmp ult i32 %16, 8
br i1 %min.iters.check, label %for.body7.preheader84, label %vector.ph
vector.ph: ; preds = %for.body7.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%5 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load67 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = add nsw <4 x i32> %wide.load, <i32 -1, i32 -1, i32 -1, i32 -1>
%8 = add nsw <4 x i32> %wide.load67, <i32 -1, i32 -1, i32 -1, i32 -1>
%9 = sub nsw <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, %wide.load
%10 = sub nsw <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, %wide.load67
%11 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %7, <4 x i32> %9)
%12 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %8, <4 x i32> %10)
%13 = getelementptr inbounds i32, ptr %vla1, i64 %index
store <4 x i32> %11, ptr %13, align 16, !tbaa !5
%14 = getelementptr inbounds i32, ptr %13, i64 4
store <4 x i32> %12, ptr %14, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%15 = icmp eq i64 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond20.preheader, label %for.body7.preheader84
for.body7.preheader84: ; preds = %for.body7.preheader, %middle.block
%indvars.iv53.ph = phi i64 [ 0, %for.body7.preheader ], [ %n.vec, %middle.block ]
br label %for.body7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%16 = load i32, ptr %n, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp = icmp slt i64 %indvars.iv.next, %17
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !13
for.cond20.preheader: ; preds = %for.body7, %middle.block
br i1 %cmp545, label %for.body23.preheader, label %for.cond.cleanup22
for.body23.preheader: ; preds = %for.cond20.preheader
%wide.trip.count59 = zext i32 %16 to i64
%min.iters.check70 = icmp ult i32 %16, 8
br i1 %min.iters.check70, label %for.body23.preheader82, label %vector.ph71
vector.ph71: ; preds = %for.body23.preheader
%n.vec73 = and i64 %wide.trip.count, 4294967288
br label %vector.body76
vector.body76: ; preds = %vector.body76, %vector.ph71
%index77 = phi i64 [ 0, %vector.ph71 ], [ %index.next81, %vector.body76 ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph71 ], [ %20, %vector.body76 ]
%vec.phi78 = phi <4 x i32> [ zeroinitializer, %vector.ph71 ], [ %21, %vector.body76 ]
%18 = getelementptr inbounds i32, ptr %vla1, i64 %index77
%wide.load79 = load <4 x i32>, ptr %18, align 16, !tbaa !5
%19 = getelementptr inbounds i32, ptr %18, i64 4
%wide.load80 = load <4 x i32>, ptr %19, align 16, !tbaa !5
%20 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load79, <4 x i32> %vec.phi)
%21 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load80, <4 x i32> %vec.phi78)
%index.next81 = add nuw i64 %index77, 8
%22 = icmp eq i64 %index.next81, %n.vec73
br i1 %22, label %middle.block68, label %vector.body76, !llvm.loop !14
middle.block68: ; preds = %vector.body76
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %20, <4 x i32> %21)
%23 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n75 = icmp eq i64 %n.vec73, %wide.trip.count
br i1 %cmp.n75, label %for.cond.cleanup22, label %for.body23.preheader82
for.body23.preheader82: ; preds = %for.body23.preheader, %middle.block68
%indvars.iv56.ph = phi i64 [ 0, %for.body23.preheader ], [ %n.vec73, %middle.block68 ]
%max.048.ph = phi i32 [ 0, %for.body23.preheader ], [ %23, %middle.block68 ]
br label %for.body23
for.body7: ; preds = %for.body7.preheader84, %for.body7
%indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.body7 ], [ %indvars.iv53.ph, %for.body7.preheader84 ]
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv53
%24 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%sub = add nsw i32 %24, -1
%sub12 = sub nsw i32 1000000, %24
%b.a.i = call i32 @llvm.smin.i32(i32 %sub, i32 %sub12)
%arrayidx15 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv53
store i32 %b.a.i, ptr %arrayidx15, align 4, !tbaa !5
%indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
%exitcond.not = icmp eq i64 %indvars.iv.next54, %wide.trip.count
br i1 %exitcond.not, label %for.cond20.preheader, label %for.body7, !llvm.loop !15
for.cond.cleanup22: ; preds = %for.body23, %middle.block68, %entry, %for.cond4.preheader, %for.cond20.preheader
%max.0.lcssa = phi i32 [ 0, %for.cond20.preheader ], [ 0, %for.cond4.preheader ], [ 0, %entry ], [ %23, %middle.block68 ], [ %spec.select, %for.body23 ]
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %max.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
for.body23: ; preds = %for.body23.preheader82, %for.body23
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body23 ], [ %indvars.iv56.ph, %for.body23.preheader82 ]
%max.048 = phi i32 [ %spec.select, %for.body23 ], [ %max.048.ph, %for.body23.preheader82 ]
%arrayidx25 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv56
%25 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %25, i32 %max.048)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%exitcond60.not = icmp eq i64 %indvars.iv.next57, %wide.trip.count59
br i1 %exitcond60.not, label %for.cond.cleanup22, label %for.body23, !llvm.loop !16
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
; 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 <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10, !12, !11}
|
#include <stdio.h>
int main(void){
int i,j,N,M,a[51],b[51],count[51]={};
scanf("%d %d",&N,&M);
for(i=0;i<M;i++){
scanf("%d %d",&a[i],&b[i]);
a[i]--;
b[i]--;
}
for(i=0;i<N;i++){
for(j=0;j<M;j++){
if(a[j]==i){
count[i]++;
}
if(b[j]==i){
count[i]++;
}
}
}
for(i=0;i<N;i++){
printf("%d\n",count[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279702/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279702/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%count = alloca [51 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #4
call void @llvm.lifetime.start.p0(i64 204, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 204, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 204, ptr nonnull %count) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(204) %count, i8 0, i64 204, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i32, ptr %M, align 4, !tbaa !5
%cmp61 = icmp sgt i32 %0, 0
br i1 %cmp61, label %for.body, label %for.cond9.preheader
for.cond9.preheader: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %10, %for.body ]
%1 = load i32, ptr %N, align 4, !tbaa !5
%cmp1065 = icmp sgt i32 %1, 0
br i1 %cmp1065, label %for.cond12.preheader.lr.ph, label %for.end43
for.cond12.preheader.lr.ph: ; preds = %for.cond9.preheader
%cmp1363 = icmp sgt i32 %.lcssa, 0
br i1 %cmp1363, label %for.cond12.preheader.us.preheader, label %for.body37.preheader
for.cond12.preheader.us.preheader: ; preds = %for.cond12.preheader.lr.ph
%wide.trip.count78 = zext i32 %1 to i64
%wide.trip.count = zext i32 %.lcssa to i64
br label %for.cond12.preheader.us
for.cond12.preheader.us: ; preds = %for.cond12.preheader.us.preheader, %for.cond12.for.inc32_crit_edge.us
%indvars.iv75 = phi i64 [ 0, %for.cond12.preheader.us.preheader ], [ %indvars.iv.next76, %for.cond12.for.inc32_crit_edge.us ]
%arrayidx19.us = getelementptr inbounds [51 x i32], ptr %count, i64 0, i64 %indvars.iv75
br label %for.body14.us
for.body14.us: ; preds = %for.cond12.preheader.us, %for.inc29.us
%indvars.iv72 = phi i64 [ 0, %for.cond12.preheader.us ], [ %indvars.iv.next73, %for.inc29.us ]
%arrayidx16.us = getelementptr inbounds [51 x i32], ptr %a, i64 0, i64 %indvars.iv72
%2 = load i32, ptr %arrayidx16.us, align 4, !tbaa !5
%3 = zext i32 %2 to i64
%cmp17.us = icmp eq i64 %indvars.iv75, %3
br i1 %cmp17.us, label %if.then.us, label %if.end.us
if.then.us: ; preds = %for.body14.us
%4 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
%inc20.us = add nsw i32 %4, 1
store i32 %inc20.us, ptr %arrayidx19.us, align 4, !tbaa !5
br label %if.end.us
if.end.us: ; preds = %if.then.us, %for.body14.us
%arrayidx22.us = getelementptr inbounds [51 x i32], ptr %b, i64 0, i64 %indvars.iv72
%5 = load i32, ptr %arrayidx22.us, align 4, !tbaa !5
%6 = zext i32 %5 to i64
%cmp23.us = icmp eq i64 %indvars.iv75, %6
br i1 %cmp23.us, label %if.then24.us, label %for.inc29.us
if.then24.us: ; preds = %if.end.us
%7 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
%inc27.us = add nsw i32 %7, 1
store i32 %inc27.us, ptr %arrayidx19.us, align 4, !tbaa !5
br label %for.inc29.us
for.inc29.us: ; preds = %if.then24.us, %if.end.us
%indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
%exitcond.not = icmp eq i64 %indvars.iv.next73, %wide.trip.count
br i1 %exitcond.not, label %for.cond12.for.inc32_crit_edge.us, label %for.body14.us, !llvm.loop !9
for.cond12.for.inc32_crit_edge.us: ; preds = %for.inc29.us
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%exitcond79.not = icmp eq i64 %indvars.iv.next76, %wide.trip.count78
br i1 %exitcond79.not, label %for.cond35.preheader, label %for.cond12.preheader.us, !llvm.loop !11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [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)
%8 = load i32, ptr %arrayidx, align 4, !tbaa !5
%dec = add nsw i32 %8, -1
store i32 %dec, ptr %arrayidx, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%dec8 = add nsw i32 %9, -1
store i32 %dec8, ptr %arrayidx2, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%10 = load i32, ptr %M, 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.cond9.preheader, !llvm.loop !12
for.cond35.preheader: ; preds = %for.cond12.for.inc32_crit_edge.us
br i1 %cmp1065, label %for.body37.preheader, label %for.end43
for.body37.preheader: ; preds = %for.cond12.preheader.lr.ph, %for.cond35.preheader
br label %for.body37
for.body37: ; preds = %for.body37.preheader, %for.body37
%indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.body37 ], [ 0, %for.body37.preheader ]
%arrayidx39 = getelementptr inbounds [51 x i32], ptr %count, i64 0, i64 %indvars.iv80
%12 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%13 = load i32, ptr %N, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp36 = icmp slt i64 %indvars.iv.next81, %14
br i1 %cmp36, label %for.body37, label %for.end43, !llvm.loop !13
for.end43: ; preds = %for.body37, %for.cond9.preheader, %for.cond35.preheader
call void @llvm.lifetime.end.p0(i64 204, ptr nonnull %count) #4
call void @llvm.lifetime.end.p0(i64 204, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 204, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include<string.h>
#include<stdlib.h>
int main(void)
{
int g[50];
int x[50];
int n,m;
int a[50],b[50];
int i;
int c;
scanf("%d%d",&n,&m);
for(i=0;i<m;i++){
scanf("%d%d",&a[i],&b[i]);
}
for(i=0;i<50;i++){
g[i]=0;
x[i]=0;
}
for(i=0;i<n;i++){
for(c=0;c<m;c++){
if(i+1==a[c]){
g[i]++;
}
if(i+1==b[c]){
x[i]++;
}
}
}
for(i=0;i<n;i++){
printf("%d\n",g[i]+x[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279746/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279746/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%g = alloca [50 x i32], align 16
%x = alloca [50 x i32], align 16
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca [50 x i32], align 16
%b = alloca [50 x i32], align 16
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %g) #4
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp73 = icmp sgt i32 %0, 0
br i1 %cmp73, label %for.body, label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) %g, i8 0, i64 200, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) %x, i8 0, i64 200, i1 false), !tbaa !5
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp1578 = icmp sgt i32 %1, 0
br i1 %cmp1578, label %for.cond17.preheader.lr.ph, label %for.end52
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x i32], ptr %a, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [50 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
%2 = load i32, ptr %m, 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.cond4.preheader, !llvm.loop !9
for.cond17.preheader.lr.ph: ; preds = %for.cond4.preheader
%cmp1876 = icmp sgt i32 %.lcssa, 0
br i1 %cmp1876, label %for.cond17.preheader.us.preheader, label %for.body43.preheader
for.cond17.preheader.us.preheader: ; preds = %for.cond17.preheader.lr.ph
%wide.trip.count94 = zext i32 %1 to i64
%wide.trip.count = zext i32 %.lcssa to i64
br label %for.cond17.preheader.us
for.cond17.preheader.us: ; preds = %for.cond17.preheader.us.preheader, %for.cond17.for.inc38_crit_edge.us
%indvars.iv91 = phi i64 [ 0, %for.cond17.preheader.us.preheader ], [ %indvars.iv.next92, %for.cond17.for.inc38_crit_edge.us ]
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%arrayidx24.us = getelementptr inbounds [50 x i32], ptr %g, i64 0, i64 %indvars.iv91
%arrayidx32.us = getelementptr inbounds [50 x i32], ptr %x, i64 0, i64 %indvars.iv91
br label %for.body19.us
for.body19.us: ; preds = %for.cond17.preheader.us, %for.inc35.us
%indvars.iv88 = phi i64 [ 0, %for.cond17.preheader.us ], [ %indvars.iv.next89, %for.inc35.us ]
%arrayidx21.us = getelementptr inbounds [50 x i32], ptr %a, i64 0, i64 %indvars.iv88
%4 = load i32, ptr %arrayidx21.us, align 4, !tbaa !5
%5 = zext i32 %4 to i64
%cmp22.us = icmp eq i64 %indvars.iv.next92, %5
br i1 %cmp22.us, label %if.then.us, label %if.end.us
if.then.us: ; preds = %for.body19.us
%6 = load i32, ptr %arrayidx24.us, align 4, !tbaa !5
%inc25.us = add nsw i32 %6, 1
store i32 %inc25.us, ptr %arrayidx24.us, align 4, !tbaa !5
br label %if.end.us
if.end.us: ; preds = %if.then.us, %for.body19.us
%arrayidx28.us = getelementptr inbounds [50 x i32], ptr %b, i64 0, i64 %indvars.iv88
%7 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%8 = zext i32 %7 to i64
%cmp29.us = icmp eq i64 %indvars.iv.next92, %8
br i1 %cmp29.us, label %if.then30.us, label %for.inc35.us
if.then30.us: ; preds = %if.end.us
%9 = load i32, ptr %arrayidx32.us, align 4, !tbaa !5
%inc33.us = add nsw i32 %9, 1
store i32 %inc33.us, ptr %arrayidx32.us, align 4, !tbaa !5
br label %for.inc35.us
for.inc35.us: ; preds = %if.then30.us, %if.end.us
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%exitcond.not = icmp eq i64 %indvars.iv.next89, %wide.trip.count
br i1 %exitcond.not, label %for.cond17.for.inc38_crit_edge.us, label %for.body19.us, !llvm.loop !11
for.cond17.for.inc38_crit_edge.us: ; preds = %for.inc35.us
%exitcond95.not = icmp eq i64 %indvars.iv.next92, %wide.trip.count94
br i1 %exitcond95.not, label %for.cond41.preheader, label %for.cond17.preheader.us, !llvm.loop !12
for.cond41.preheader: ; preds = %for.cond17.for.inc38_crit_edge.us
br i1 %cmp1578, label %for.body43.preheader, label %for.end52
for.body43.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.cond41.preheader
br label %for.body43
for.body43: ; preds = %for.body43.preheader, %for.body43
%indvars.iv96 = phi i64 [ %indvars.iv.next97, %for.body43 ], [ 0, %for.body43.preheader ]
%arrayidx45 = getelementptr inbounds [50 x i32], ptr %g, i64 0, i64 %indvars.iv96
%10 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%arrayidx47 = getelementptr inbounds [50 x i32], ptr %x, i64 0, i64 %indvars.iv96
%11 = load i32, ptr %arrayidx47, align 4, !tbaa !5
%add48 = add nsw i32 %11, %10
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add48)
%indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp42 = icmp slt i64 %indvars.iv.next97, %13
br i1 %cmp42, label %for.body43, label %for.end52, !llvm.loop !13
for.end52: ; preds = %for.body43, %for.cond4.preheader, %for.cond41.preheader
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %g) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(void)
{
int n, m;
int c[51] = {0};
int a, b;
int i;
scanf("%d %d", &n, &m);
for ( i=0; i<m; i++ ) {
scanf("%d %d", &a, &b);
c[a-1]++; c[b-1]++;
}
for ( i=0; i<n; i++ ) {
printf("%d\n", c[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279797/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279797/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%c = alloca [51 x i32], align 16
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 204, ptr nonnull %c) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(204) %c, i8 0, i64 204, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp822 = icmp sgt i32 %1, 0
br i1 %cmp822, label %for.body9, label %for.end15
for.body: ; preds = %entry, %for.body
%i.021 = phi i32 [ %inc6, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [51 x i32], ptr %c, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %3, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%4 = load i32, ptr %b, align 4, !tbaa !5
%sub2 = add nsw i32 %4, -1
%idxprom3 = sext i32 %sub2 to i64
%arrayidx4 = getelementptr inbounds [51 x i32], ptr %c, i64 0, i64 %idxprom3
%5 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%inc5 = add nsw i32 %5, 1
store i32 %inc5, ptr %arrayidx4, align 4, !tbaa !5
%inc6 = add nuw nsw i32 %i.021, 1
%6 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc6, %6
br i1 %cmp, label %for.body, label %for.cond7.preheader, !llvm.loop !9
for.body9: ; preds = %for.cond7.preheader, %for.body9
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body9 ], [ 0, %for.cond7.preheader ]
%arrayidx11 = getelementptr inbounds [51 x i32], ptr %c, i64 0, i64 %indvars.iv
%7 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%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
%cmp8 = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp8, label %for.body9, label %for.end15, !llvm.loop !11
for.end15: ; preds = %for.body9, %for.cond7.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 204, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main()
{
int a,b;
double t;
scanf("%d %d",&a,&b);
t = (a*1.0)/(b*1.0);
printf("%lf",t);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279869/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279869/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%1 = load i32, ptr %b, align 4, !tbaa !5
%conv1 = sitofp i32 %1 to double
%div = fdiv double %conv, %conv1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
double t; double x;
scanf("%lf" "%lf", &t, &x);
printf("%lf", t / x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279911/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279911/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca double, align 8
%x = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t, ptr noundef nonnull %x)
%0 = load double, ptr %t, align 8, !tbaa !5
%1 = load double, ptr %x, align 8, !tbaa !5
%div = fdiv double %0, %1
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
float T,X,out;
scanf("%f %f", &T, &X);
out = (float)T / X;
printf("%f",out);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279962/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279962/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%f %f\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%f\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%T = alloca float, align 4
%X = alloca float, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T, ptr noundef nonnull %X)
%0 = load float, ptr %T, align 4, !tbaa !5
%1 = load float, ptr %X, align 4, !tbaa !5
%div = fdiv float %0, %1
%conv = fpext float %div to double
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %conv)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int t,x;
scanf("%d%d",&t,&x);
printf("%10.5f",(float)t/(float)x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280010/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280010/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"%10.5f\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t, ptr noundef nonnull %x)
%0 = load i32, ptr %t, align 4, !tbaa !5
%conv = sitofp i32 %0 to float
%1 = load i32, ptr %x, align 4, !tbaa !5
%conv1 = sitofp i32 %1 to float
%div = fdiv float %conv, %conv1
%conv2 = fpext float %div to double
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %conv2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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){
float T,X;
scanf("%f %f",&T,&X);
printf("%f",T/X);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280061/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280061/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%f %f\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%f\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%T = alloca float, align 4
%X = alloca float, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T, ptr noundef nonnull %X)
%0 = load float, ptr %T, align 4, !tbaa !5
%1 = load float, ptr %X, align 4, !tbaa !5
%div = fdiv float %0, %1
%conv = fpext float %div to double
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %conv)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){double a,b;scanf("%lf%lf",&a,&b);printf("%f",a/b);} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280104/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280104/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%f\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load double, ptr %a, align 8, !tbaa !5
%1 = load double, ptr %b, align 8, !tbaa !5
%div = fdiv double %0, %1
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
double x, t;
scanf("%lf %lf", &t, &x);
printf("%f", t / x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280148/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280148/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%f\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca double, align 8
%t = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t, ptr noundef nonnull %x)
%0 = load double, ptr %t, align 8, !tbaa !5
%1 = load double, ptr %x, align 8, !tbaa !5
%div = fdiv double %0, %1
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int nextInt() {
int n = 0;
int c;
while ((c = getchar()) != EOF) {
if (('0' <= c) && (c <= '9'<c)) {
n = n * 10 + (c - '0');
}
else {
break;
}
}
return n;
}
int main(){
int t = nextInt();
int x = nextInt();
/*
T = X x t
t = T/X
*/
printf("%lf\n", (double)t/x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280191/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280191/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @nextInt() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i9 = tail call i32 @getc(ptr noundef %0)
%cmp110 = icmp sgt i32 %call.i9, 47
br i1 %cmp110, label %if.then, label %while.end
if.then: ; preds = %entry, %if.then
%call.i12 = phi i32 [ %call.i, %if.then ], [ %call.i9, %entry ]
%n.011 = phi i32 [ %add, %if.then ], [ 0, %entry ]
%mul = mul nsw i32 %n.011, 10
%sub = add i32 %mul, -48
%add = add i32 %sub, %call.i12
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = tail call i32 @getc(ptr noundef %1)
%cmp1 = icmp sgt i32 %call.i, 47
br i1 %cmp1, label %if.then, label %while.end, !llvm.loop !9
while.end: ; preds = %if.then, %entry
%n.0.lcssa = phi i32 [ 0, %entry ], [ %add, %if.then ]
ret i32 %n.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i9.i = tail call i32 @getc(ptr noundef %0)
%cmp110.i = icmp sgt i32 %call.i9.i, 47
br i1 %cmp110.i, label %if.then.i, label %nextInt.exit
if.then.i: ; preds = %entry, %if.then.i
%call.i12.i = phi i32 [ %call.i.i, %if.then.i ], [ %call.i9.i, %entry ]
%n.011.i = phi i32 [ %add.i, %if.then.i ], [ 0, %entry ]
%mul.i = mul nsw i32 %n.011.i, 10
%sub.i = add nsw i32 %call.i12.i, -48
%add.i = add i32 %sub.i, %mul.i
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.i = tail call i32 @getc(ptr noundef %1)
%cmp1.i = icmp sgt i32 %call.i.i, 47
br i1 %cmp1.i, label %if.then.i, label %nextInt.exit.loopexit, !llvm.loop !9
nextInt.exit.loopexit: ; preds = %if.then.i
%2 = sitofp i32 %add.i to double
br label %nextInt.exit
nextInt.exit: ; preds = %nextInt.exit.loopexit, %entry
%n.0.lcssa.i = phi double [ 0.000000e+00, %entry ], [ %2, %nextInt.exit.loopexit ]
%3 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i9.i4 = tail call i32 @getc(ptr noundef %3)
%cmp110.i5 = icmp sgt i32 %call.i9.i4, 47
br i1 %cmp110.i5, label %if.then.i7, label %nextInt.exit15
if.then.i7: ; preds = %nextInt.exit, %if.then.i7
%call.i12.i8 = phi i32 [ %call.i.i13, %if.then.i7 ], [ %call.i9.i4, %nextInt.exit ]
%n.011.i9 = phi i32 [ %add.i12, %if.then.i7 ], [ 0, %nextInt.exit ]
%mul.i10 = mul nsw i32 %n.011.i9, 10
%sub.i11 = add nsw i32 %call.i12.i8, -48
%add.i12 = add i32 %sub.i11, %mul.i10
%4 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.i13 = tail call i32 @getc(ptr noundef %4)
%cmp1.i14 = icmp sgt i32 %call.i.i13, 47
br i1 %cmp1.i14, label %if.then.i7, label %nextInt.exit15.loopexit, !llvm.loop !9
nextInt.exit15.loopexit: ; preds = %if.then.i7
%5 = sitofp i32 %add.i12 to double
br label %nextInt.exit15
nextInt.exit15: ; preds = %nextInt.exit15.loopexit, %nextInt.exit
%n.0.lcssa.i6 = phi double [ 0.000000e+00, %nextInt.exit ], [ %5, %nextInt.exit15.loopexit ]
%div = fdiv double %n.0.lcssa.i, %n.0.lcssa.i6
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %div)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
double x, t;
scanf("%lf %lf", &t, &x);
printf("%lf", t / x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280234/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280234/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca double, align 8
%t = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t, ptr noundef nonnull %x)
%0 = load double, ptr %t, align 8, !tbaa !5
%1 = load double, ptr %x, align 8, !tbaa !5
%div = fdiv double %0, %1
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int N,judge=1;
scanf("%d",&N);
int A[N];
for(int i=0;i<N;i++){
scanf("%d",&A[i]);
if(A[i]%2==0){
if(A[i]%3==0||A[i]%5==0);
else judge=0;
}
}
if(judge==1)printf("APPROVED");
else printf("DENIED");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280278/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280278/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [9 x i8] c"APPROVED\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"DENIED\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %3, 0
br i1 %cmp27, label %for.body, label %if.end20
for.cond.cleanup: ; preds = %for.body
%4 = icmp eq i32 %judge.1, 1
%spec.select = select i1 %4, ptr @.str.1, ptr @.str.2
br label %if.end20
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%judge.028 = phi i32 [ %judge.1, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%6 = and i32 %5, 1
%cmp4 = icmp ne i32 %6, 0
%rem7 = srem i32 %5, 3
%cmp8 = icmp eq i32 %rem7, 0
%or.cond = or i1 %cmp4, %cmp8
%rem11 = srem i32 %5, 5
%cmp12 = icmp eq i32 %rem11, 0
%or.cond26 = or i1 %cmp12, %or.cond
%judge.1 = select i1 %or.cond26, i32 %judge.028, i32 0
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %N, 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.cond.cleanup, !llvm.loop !9
if.end20: ; preds = %for.cond.cleanup, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ %spec.select, %for.cond.cleanup ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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"}
|
#include <stdio.h>
#define num3 3
int main(void){
int n;
scanf("%d\n",&n);
int Anum[n];
int test=0;
for(int i;i < n;i++){
scanf("%d ",&Anum[i]);
if((Anum[i] % 2) == 0 && (Anum[i] % 3) != 0 && (Anum[i] % 5) != 0){
test++;
}
}
if(test > 0){
printf("\nDENIED");
}
else{
printf("\nAPPROVED");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280320/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280320/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.3 = private unnamed_addr constant [10 x i8] c"\0AAPPROVED\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
if.end19:
%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 = call ptr @llvm.stacksave.p0()
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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)"}
|
#include <stdio.h>
int main(void)
{
int n;
//printf("N,A1,A2...Anを入力してください");
scanf("%d",&n);
int a[n],i,k=0;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if((a[i] % 2 == 1) || (a[i] % 3 == 0) || (a[i] % 5 == 0))
k++;
}
if(k==n)
printf("APPROVED\n");
else
printf("DENIED\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280364/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280364/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"DENIED\00", align 1
@str.3 = private unnamed_addr constant [9 x i8] c"APPROVED\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %3, 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 ]
%k.030 = phi i32 [ %k.1, %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)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%5 = and i32 %4, -2147483647
%cmp4 = icmp eq i32 %5, 1
%rem7 = srem i32 %4, 3
%cmp8 = icmp eq i32 %rem7, 0
%or.cond = or i1 %cmp4, %cmp8
%rem12 = srem i32 %4, 5
%cmp13 = icmp eq i32 %rem12, 0
%or.cond27 = or i1 %cmp13, %or.cond
%inc = zext i1 %or.cond27 to i32
%k.1 = add nuw nsw i32 %k.030, %inc
%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
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%k.0.lcssa = phi i32 [ 0, %entry ], [ %k.1, %for.body ]
%.lcssa = phi i32 [ %3, %entry ], [ %6, %for.body ]
%cmp15 = icmp eq i32 %k.0.lcssa, %.lcssa
%str.3.str = select i1 %cmp15, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.