Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include<stdio.h>
int main(void){
char y[10];
int i,kazu[10],yy,m,d;
scanf("%s",&y);
for(i=0;i<10;i++){
if(i!=4&&i!=7){
if(y[i]=='0'){
kazu[i]=0;
}else if(y[i]=='1'){
kazu[i]=1;
}else if(y[i]=='2'){
kazu[i]=2;
}else if(y[i]=='3'){
kazu[i]=3;
}else if(y[i]=='4'){
kazu[i]=4;
}else if(y[i]=='5'){
kazu[i]=5;
}else if(y[i]=='6'){
kazu[i]=6;
}else if(y[i]=='7'){
kazu[i]=7;
}else if(y[i]=='8'){
kazu[i]=8;
}else if(y[i]=='9'){
kazu[i]=9;
}
}
}
yy=kazu[0]*1000+kazu[1]*100+kazu[2]*10+kazu[3];
m=kazu[5]*10+kazu[6];
d=kazu[8]*10+kazu[9];
if(yy>2019){
printf("TBD\n");
}else if(yy==2019&&m>4){
printf("TBD\n");
}else if(yy==2019&&m==4&&d>30){
printf("TBD\n");
}else{
printf("Heisei\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161153/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161153/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"Heisei\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"TBD\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
if.then:
%y = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %y) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %y)
%0 = load i8, ptr %y, align 1, !tbaa !5
%switch.tableidx = add i8 %0, -49
%1 = icmp ult i8 %switch.tableidx, 9
%switch.idx.cast = zext i8 %switch.tableidx to i32
%switch.idx.mult = mul nuw nsw i32 %switch.idx.cast, 1000
%switch.offset = add nuw nsw i32 %switch.idx.mult, 1000
%kazu.sroa.0.0 = select i1 %1, i32 %switch.offset, i32 0
%arrayidx.1 = getelementptr inbounds [10 x i8], ptr %y, i64 0, i64 1
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%switch.tableidx191 = add i8 %2, -49
%3 = icmp ult i8 %switch.tableidx191, 9
%switch.idx.cast192 = zext i8 %switch.tableidx191 to i32
%switch.idx.mult193 = mul nuw nsw i32 %switch.idx.cast192, 100
%switch.offset194 = add nuw nsw i32 %switch.idx.mult193, 100
%kazu.sroa.13.0 = select i1 %3, i32 %switch.offset194, i32 0
%arrayidx.2 = getelementptr inbounds [10 x i8], ptr %y, i64 0, i64 2
%4 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%switch.tableidx177 = add i8 %4, -49
%5 = icmp ult i8 %switch.tableidx177, 9
%switch.idx.cast178 = zext i8 %switch.tableidx177 to i32
%switch.idx.mult179 = mul nuw nsw i32 %switch.idx.cast178, 10
%switch.offset180 = add nuw nsw i32 %switch.idx.mult179, 10
%kazu.sroa.24.0 = select i1 %5, i32 %switch.offset180, i32 0
%arrayidx.3 = getelementptr inbounds [10 x i8], ptr %y, i64 0, i64 3
%6 = load i8, ptr %arrayidx.3, align 1, !tbaa !5
%switch.tableidx201 = add i8 %6, -48
%narrow = call i8 @llvm.umin.i8(i8 %switch.tableidx201, i8 9)
%spec.select203 = zext i8 %narrow to i32
%arrayidx.5 = getelementptr inbounds [10 x i8], ptr %y, i64 0, i64 5
%7 = load i8, ptr %arrayidx.5, align 1, !tbaa !5
%switch.tableidx182 = add i8 %7, -49
%8 = icmp ult i8 %switch.tableidx182, 9
%switch.idx.cast183 = zext i8 %switch.tableidx182 to i32
%switch.idx.mult184 = mul nuw nsw i32 %switch.idx.cast183, 10
%switch.offset185 = add nuw nsw i32 %switch.idx.mult184, 10
%kazu.sroa.56.0 = select i1 %8, i32 %switch.offset185, i32 0
%arrayidx.6 = getelementptr inbounds [10 x i8], ptr %y, i64 0, i64 6
%9 = load i8, ptr %arrayidx.6, align 1, !tbaa !5
%switch.tableidx196 = add i8 %9, -48
%narrow204 = call i8 @llvm.umin.i8(i8 %switch.tableidx196, i8 9)
%spec.select = zext i8 %narrow204 to i32
%arrayidx.8 = getelementptr inbounds [10 x i8], ptr %y, i64 0, i64 8
%10 = load i8, ptr %arrayidx.8, align 1, !tbaa !5
%switch.tableidx187 = add i8 %10, -49
%11 = icmp ult i8 %switch.tableidx187, 9
%switch.idx.cast188 = zext i8 %switch.tableidx187 to i32
%switch.idx.mult189 = mul nuw nsw i32 %switch.idx.cast188, 10
%switch.offset190 = add nuw nsw i32 %switch.idx.mult189, 10
%kazu.sroa.88.0 = select i1 %11, i32 %switch.offset190, i32 0
%arrayidx.9 = getelementptr inbounds [10 x i8], ptr %y, i64 0, i64 9
%12 = load i8, ptr %arrayidx.9, align 1, !tbaa !5
%switch.tableidx198 = add i8 %12, -48
%narrow205 = call i8 @llvm.umin.i8(i8 %switch.tableidx198, i8 9)
%spec.select200 = zext i8 %narrow205 to i32
%add = add nuw nsw i32 %kazu.sroa.13.0, %kazu.sroa.0.0
%add103 = add nuw nsw i32 %add, %kazu.sroa.24.0
%add105 = add nuw nsw i32 %add103, %spec.select203
%add109 = add nuw nsw i32 %kazu.sroa.56.0, %spec.select
%add113 = add nuw nsw i32 %kazu.sroa.88.0, %spec.select200
%cmp114 = icmp ugt i32 %add105, 2019
br i1 %cmp114, label %if.end141, label %if.else118
if.else118: ; preds = %if.then
%cmp119 = icmp eq i32 %add105, 2019
%cmp122 = icmp ugt i32 %add109, 4
%or.cond142 = select i1 %cmp119, i1 %cmp122, i1 false
br i1 %or.cond142, label %if.end141, label %if.else126
if.else126: ; preds = %if.else118
%cmp130 = icmp eq i32 %add109, 4
%or.cond143 = select i1 %cmp119, i1 %cmp130, i1 false
%cmp133 = icmp ugt i32 %add113, 30
%or.cond144 = select i1 %or.cond143, i1 %cmp133, i1 false
%str.3.str = select i1 %or.cond144, ptr @str.5, ptr @str
br label %if.end141
if.end141: ; preds = %if.else126, %if.else118, %if.then
%str.4.sink = phi ptr [ @str.5, %if.then ], [ @str.5, %if.else118 ], [ %str.3.str, %if.else126 ]
%puts172 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %y) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.umin.i8(i8, i8) #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
char s[10];
scanf("%s",s);
int a=10*(s[5]-'0');
int b=s[6]-'0';
if(a+b>4) printf("TBD\n");
else printf("Heisei\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161197/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161197/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"Heisei\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"TBD\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)
%arrayidx = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 5
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%conv = sext i8 %0 to i32
%1 = mul nsw i32 %conv, 10
%arrayidx1 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 6
%2 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%conv2 = sext i8 %2 to i32
%sub3 = add nsw i32 %1, %conv2
%cmp = icmp sgt i32 %sub3, 532
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main()
{
int t,n,a[60],b,len;
char s[60],ss[60],op;
scanf("%d",&t);
while(t--)
{
int i=0,k=0,j,f=0;
scanf("%s",s);
len=strlen(s);
n=len;
for(int j=0;j<n;j++)
a[j]=0;
while(len--)
{
for(j=0;j<k;j++)
{
if(s[i]==ss[j])
{
if(a[j]==1) n--;
else a[j]=1;
f=1;
break;
}
}
if(j==k&&f==0) ss[k++]=s[i];
i++;f=0;
}
printf("%d\n",n/2);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16124/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16124/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%a = alloca [60 x i32], align 16
%s = alloca [60 x i8], align 16
%ss = alloca [60 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.start.p0(i64 240, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 60, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 60, ptr nonnull %ss) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec75 = add nsw i32 %0, -1
store i32 %dec75, ptr %t, align 4, !tbaa !5
%tobool.not76 = icmp eq i32 %0, 0
br i1 %tobool.not76, label %while.end47, label %while.body
while.body: ; preds = %entry, %while.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%conv = trunc i64 %call3 to i32
%cmp64 = icmp sgt i32 %conv, 0
br i1 %cmp64, label %while.cond6.preheader.thread, label %while.cond6.preheader
while.cond6.preheader.thread: ; preds = %while.body
%1 = shl i64 %call3, 2
%2 = and i64 %1, 17179869180
call void @llvm.memset.p0.i64(ptr nonnull align 16 %a, i8 0, i64 %2, i1 false), !tbaa !5
br label %for.cond10.preheader.preheader
while.cond6.preheader: ; preds = %while.body
%tobool8.not69 = icmp eq i32 %conv, 0
br i1 %tobool8.not69, label %while.end, label %for.cond10.preheader.preheader
for.cond10.preheader.preheader: ; preds = %while.cond6.preheader.thread, %while.cond6.preheader
br label %for.cond10.preheader
for.cond10.preheader: ; preds = %for.cond10.preheader.preheader, %if.end44
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %if.end44 ], [ 0, %for.cond10.preheader.preheader ]
%dec773.in = phi i32 [ %dec773, %if.end44 ], [ %conv, %for.cond10.preheader.preheader ]
%k.072 = phi i32 [ %k.1, %if.end44 ], [ 0, %for.cond10.preheader.preheader ]
%n.070 = phi i32 [ %n.288, %if.end44 ], [ %conv, %for.cond10.preheader.preheader ]
%dec773 = add nsw i32 %dec773.in, -1
%cmp11.not66 = icmp sgt i32 %k.072, 0
br i1 %cmp11.not66, label %for.body13.lr.ph, label %for.end33
for.body13.lr.ph: ; preds = %for.cond10.preheader
%arrayidx15 = getelementptr inbounds [60 x i8], ptr %s, i64 0, i64 %indvars.iv81
%3 = load i8, ptr %arrayidx15, align 1, !tbaa !9
%wide.trip.count = zext i32 %k.072 to i64
br label %for.body13
for.body13: ; preds = %for.body13.lr.ph, %for.inc31
%indvars.iv = phi i64 [ 0, %for.body13.lr.ph ], [ %indvars.iv.next, %for.inc31 ]
%arrayidx18 = getelementptr inbounds [60 x i8], ptr %ss, i64 0, i64 %indvars.iv
%4 = load i8, ptr %arrayidx18, align 1, !tbaa !9
%cmp20 = icmp eq i8 %3, %4
br i1 %cmp20, label %if.then, label %for.inc31
if.then: ; preds = %for.body13
%5 = trunc i64 %indvars.iv to i32
%arrayidx23 = getelementptr inbounds [60 x i32], ptr %a, i64 0, i64 %indvars.iv
%6 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24 = icmp eq i32 %6, 1
br i1 %cmp24, label %if.then26, label %if.else
if.then26: ; preds = %if.then
%dec27 = add nsw i32 %n.070, -1
br label %for.end33
if.else: ; preds = %if.then
store i32 1, ptr %arrayidx23, align 4, !tbaa !5
br label %for.end33
for.inc31: ; preds = %for.body13
%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 %if.then38, label %for.body13, !llvm.loop !10
for.end33: ; preds = %for.cond10.preheader, %if.then26, %if.else
%j.063 = phi i32 [ %5, %if.then26 ], [ %5, %if.else ], [ 0, %for.cond10.preheader ]
%n.2 = phi i32 [ %dec27, %if.then26 ], [ %n.070, %if.else ], [ %n.070, %for.cond10.preheader ]
%cmp34 = icmp eq i32 %j.063, %k.072
br i1 %cmp34, label %if.then38, label %if.end44
if.then38: ; preds = %for.inc31, %for.end33
%n.289 = phi i32 [ %n.2, %for.end33 ], [ %n.070, %for.inc31 ]
%arrayidx40 = getelementptr inbounds [60 x i8], ptr %s, i64 0, i64 %indvars.iv81
%7 = load i8, ptr %arrayidx40, align 1, !tbaa !9
%inc41 = add nsw i32 %k.072, 1
%idxprom42 = sext i32 %k.072 to i64
%arrayidx43 = getelementptr inbounds [60 x i8], ptr %ss, i64 0, i64 %idxprom42
store i8 %7, ptr %arrayidx43, align 1, !tbaa !9
br label %if.end44
if.end44: ; preds = %if.then38, %for.end33
%n.288 = phi i32 [ %n.289, %if.then38 ], [ %n.2, %for.end33 ]
%k.1 = phi i32 [ %inc41, %if.then38 ], [ %k.072, %for.end33 ]
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%tobool8.not = icmp eq i32 %dec773, 0
br i1 %tobool8.not, label %while.end, label %for.cond10.preheader, !llvm.loop !12
while.end: ; preds = %if.end44, %while.cond6.preheader
%n.0.lcssa = phi i32 [ 0, %while.cond6.preheader ], [ %n.288, %if.end44 ]
%div = sdiv i32 %n.0.lcssa, 2
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %div)
%8 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %8, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %8, 0
br i1 %tobool.not, label %while.end47, label %while.body, !llvm.loop !13
while.end47: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 60, ptr nonnull %ss) #5
call void @llvm.lifetime.end.p0(i64 60, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 240, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
|
#include<stdio.h>
int main(void){
int m,d;
scanf("2019/%d/%d",&m,&d);
if(m<=4){
printf("Heisei");
}else{
printf("TBD");
}
return 0;
}
/*test
1.
2019/04/30
->Heisei
2.
2019/11/01
->TBD
*/ | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161290/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161290/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"2019/%d/%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"Heisei\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"TBD\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m, ptr noundef nonnull %d)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 5
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main()
{
long long int r,n,i,s,f;
scanf("%lld",&n);
f=sqrt(n);
for(i=f;i>=1;i--){
if(n%i==0){
r=n/i;
s=r+i-2;
break;
}
}
printf("%lld",s);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161333/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161333/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
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)
%0 = load i64, ptr %n, align 8, !tbaa !5
%conv = sitofp i64 %0 to double
%call1 = call double @sqrt(double noundef %conv) #5
%conv2 = fptosi double %call1 to i64
%1 = load i64, ptr %n, align 8, !tbaa !5
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%i.0 = phi i64 [ %conv2, %entry ], [ %dec, %for.cond ]
%cmp = icmp sgt i64 %i.0, 0
call void @llvm.assume(i1 %cmp)
%rem = srem i64 %1, %i.0
%div = sdiv i64 %1, %i.0
%cmp4 = icmp eq i64 %rem, 0
%dec = add nsw i64 %i.0, -1
br i1 %cmp4, label %if.then, label %for.cond, !llvm.loop !9
if.then: ; preds = %for.cond
%add = add nsw i64 %i.0, -2
%sub = add i64 %add, %div
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %sub)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #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(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
long n;
scanf("%ld", &n);
long l = sqrt(n);
for(l++; l>0; l--){
if(n%l==0) break;
}
printf("%ld\n", n/l+l-2);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161377/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161377/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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)
%0 = load i64, ptr %n, align 8, !tbaa !5
%conv = sitofp i64 %0 to double
%call1 = call double @sqrt(double noundef %conv) #5
%conv2 = fptosi double %call1 to i64
%inc = add i64 %conv2, 1
%cmp12 = icmp sgt i64 %conv2, -1
%.pre = load i64, ptr %n, align 8, !tbaa !5
br i1 %cmp12, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%smin = call i64 @llvm.smin.i64(i64 %inc, i64 1)
%1 = add i64 %smin, -1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%l.013 = phi i64 [ %inc, %for.body.lr.ph ], [ %dec, %for.inc ]
%rem = srem i64 %.pre, %l.013
%cmp4 = icmp eq i64 %rem, 0
br i1 %cmp4, label %for.end, label %for.inc
for.inc: ; preds = %for.body
%dec = add nsw i64 %l.013, -1
%cmp = icmp sgt i64 %l.013, 1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.body, %entry
%l.0.lcssa = phi i64 [ %inc, %entry ], [ %l.013, %for.body ], [ %1, %for.inc ]
%div = sdiv i64 %.pre, %l.0.lcssa
%add = add i64 %l.0.lcssa, -2
%sub = add i64 %add, %div
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void) {
long long n, a=2,i,j;
scanf("%lld", &n);
for (i = 1; i <= n; i++) {
if (n < i * i) {
break;
}
if (n % i == 0) {
j = i;
}
}
printf("%lld\n", n/j+j-a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161427/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161427/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%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
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not12 = icmp slt i64 %0, 1
br i1 %cmp.not12, label %for.end, label %if.end
if.end: ; preds = %entry, %if.end
%j.016 = phi i64 [ %spec.select, %if.end ], [ undef, %entry ]
%i.015 = phi i64 [ %inc, %if.end ], [ 1, %entry ]
%rem = srem i64 %0, %i.015
%cmp2 = icmp eq i64 %rem, 0
%spec.select = select i1 %cmp2, i64 %i.015, i64 %j.016
%inc = add nuw nsw i64 %i.015, 1
%cmp.not = icmp sge i64 %i.015, %0
%mul = mul nsw i64 %inc, %inc
%cmp1 = icmp slt i64 %0, %mul
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp1
br i1 %or.cond, label %for.end, label %if.end, !llvm.loop !9
for.end: ; preds = %if.end, %entry
%j.0.lcssa = phi i64 [ undef, %entry ], [ %spec.select, %if.end ]
%div = sdiv i64 %0, %j.0.lcssa
%add = add i64 %j.0.lcssa, -2
%sub = add i64 %add, %div
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
long main(void){
long N;
long cnt = 0;
scanf("%ld", &N);
long array[1000] = {0};
for (long i = (long)sqrt(N); i > 0 ; i--) {
if (N % i == 0) {
printf("%ld\n",i + N/i - 2);
return 0;
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161470/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161470/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !5
%conv = sitofp i64 %0 to double
%call1 = call double @sqrt(double noundef %conv) #4
%conv2 = fptosi double %call1 to i64
%cmp16 = icmp sgt i64 %conv2, 0
br i1 %cmp16, label %for.body.lr.ph, label %cleanup
for.body.lr.ph: ; preds = %entry
%1 = load i64, ptr %N, align 8, !tbaa !5
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%i.017 = phi i64 [ %conv2, %for.body.lr.ph ], [ %dec, %for.inc ]
%rem = srem i64 %1, %i.017
%div = sdiv i64 %1, %i.017
%cmp4 = icmp eq i64 %rem, 0
br i1 %cmp4, label %if.then, label %for.inc
if.then: ; preds = %for.body
%add = add nsw i64 %i.017, -2
%sub = add i64 %add, %div
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub)
br label %cleanup
for.inc: ; preds = %for.body
%dec = add nsw i64 %i.017, -1
%cmp = icmp sgt i64 %i.017, 1
br i1 %cmp, label %for.body, label %cleanup, !llvm.loop !9
cleanup: ; preds = %for.inc, %entry, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #4
ret i64 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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>
long long int a(long long int N) {
long long int i;
long long int max = 0;
for (i = 2; i * i <= N; i++) {
if (N % i == 0) {
if (i > max) max = i;
}
}
if (max == 0) {
return 0;
}
else {
return max;
}
}
int main() {
long long int N;
long long int x, y;
scanf("%lld", &N);
x = a(N);
if (x == 0) {
printf("%lld", N - 1);
}
else {
y = N / x;
printf("%lld", x + y - 2);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161513/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161513/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @a(i64 noundef %N) local_unnamed_addr #0 {
entry:
%cmp.not16 = icmp slt i64 %N, 4
br i1 %cmp.not16, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%max.018 = phi i64 [ %max.1, %for.body ], [ 0, %entry ]
%i.017 = phi i64 [ %inc, %for.body ], [ 2, %entry ]
%rem = srem i64 %N, %i.017
%cmp1 = icmp eq i64 %rem, 0
%cmp2 = icmp sgt i64 %i.017, %max.018
%or.cond = select i1 %cmp1, i1 %cmp2, i1 false
%max.1 = select i1 %or.cond, i64 %i.017, i64 %max.018
%inc = add nuw nsw i64 %i.017, 1
%mul = mul nsw i64 %inc, %inc
%cmp.not = icmp sgt i64 %mul, %N
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !5
for.end: ; preds = %for.body, %entry
%max.0.lcssa = phi i64 [ 0, %entry ], [ %max.1, %for.body ]
ret i64 %max.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%N = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !7
%cmp.not16.i = icmp slt i64 %0, 4
br i1 %cmp.not16.i, label %if.then, label %for.body.i
for.body.i: ; preds = %entry, %for.body.i
%max.018.i = phi i64 [ %max.1.i, %for.body.i ], [ 0, %entry ]
%i.017.i = phi i64 [ %inc.i, %for.body.i ], [ 2, %entry ]
%rem.i = srem i64 %0, %i.017.i
%cmp1.i = icmp eq i64 %rem.i, 0
%cmp2.i = icmp sgt i64 %i.017.i, %max.018.i
%or.cond.i = select i1 %cmp1.i, i1 %cmp2.i, i1 false
%max.1.i = select i1 %or.cond.i, i64 %i.017.i, i64 %max.018.i
%inc.i = add nuw nsw i64 %i.017.i, 1
%mul.i = mul nsw i64 %inc.i, %inc.i
%cmp.not.i = icmp sgt i64 %mul.i, %0
br i1 %cmp.not.i, label %a.exit, label %for.body.i, !llvm.loop !5
a.exit: ; preds = %for.body.i
%cmp = icmp eq i64 %max.1.i, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry, %a.exit
%sub = add nsw i64 %0, -1
br label %if.end
if.else: ; preds = %a.exit
%div = sdiv i64 %0, %max.1.i
%add = add i64 %max.1.i, -2
%sub3 = add i64 %add, %div
br label %if.end
if.end: ; preds = %if.else, %if.then
%sub3.sink = phi i64 [ %sub3, %if.else ], [ %sub, %if.then ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %sub3.sink)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"long long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
long long int a, min;
scanf("%lld", &a);
min = a-1;
for(int i = 1; i < 1123456; ++i){
if(a%i == 0){
long long temp = (a/i + i - 2);
min = min > temp ? temp: min;
}
}
printf("%lld\n", min);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161557/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161557/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%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
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i64, ptr %a, align 8, !tbaa !5
%sub = add nsw i64 %0, -1
br label %for.body
for.cond.cleanup: ; preds = %for.inc
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %min.1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ 1, %entry ], [ %indvars.iv.next, %for.inc ]
%min.017 = phi i64 [ %sub, %entry ], [ %min.1, %for.inc ]
%rem = srem i64 %0, %indvars.iv
%div = sdiv i64 %0, %indvars.iv
%cmp1 = icmp eq i64 %rem, 0
br i1 %cmp1, label %if.then, label %for.inc
if.then: ; preds = %for.body
%add = add nsw i64 %indvars.iv, -2
%sub5 = add i64 %add, %div
%cond = call i64 @llvm.smin.i64(i64 %min.017, i64 %sub5)
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%min.1 = phi i64 [ %cond, %if.then ], [ %min.017, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 1123456
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) #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 i64 @llvm.smin.i64(i64, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int t;
scanf("%d", &t);
while(t--){
int n, c1, c2;
scanf("%d", &n);
if(n%3==0)
{
printf("%d %d\n", n/3, n/3);
}
else if(n%3==1){
printf("%d %d\n", 1+n/3, n/3);
}
else{
printf("%d %d\n", n/3, 1+n/3);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16160/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16160/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec16 = add nsw i32 %0, -1
store i32 %dec16, ptr %t, align 4, !tbaa !5
%tobool.not17 = icmp eq i32 %0, 0
br i1 %tobool.not17, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end15
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%rem = srem i32 %1, 3
%div11 = sdiv i32 %1, 3
switch i32 %rem, label %if.else10 [
i32 0, label %if.then
i32 1, label %if.then6
]
if.then: ; preds = %while.body
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div11, i32 noundef %div11)
br label %if.end15
if.then6: ; preds = %while.body
%add = add nsw i32 %div11, 1
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add, i32 noundef %div11)
br label %if.end15
if.else10: ; preds = %while.body
%add13 = add nsw i32 %div11, 1
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div11, i32 noundef %add13)
br label %if.end15
if.end15: ; preds = %if.then6, %if.else10, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
%2 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %2, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %2, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end15, %entry
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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
double sigma( int n, double ave );
double colAve( int n );
int s[1000];
int main( void )
{
int n;
//int s[1000];
int i;
double var;
double a;
while( 1 )
{
scanf("%d",&n);
if( n == 0 )break;
for( i = 0; i < n; i++ )
{
scanf("%d", &s[i]);
}
var = colAve( n );
var = sigma( n, var );
a = sqrt( var / n );
printf("%lf\n",a);
}
return 0;
}
double sigma( int n, double ave )
{
double ans;
int i;
for( i = 0; i < n; i++ )
{
ans += (s[i] - ave) * (s[i] - ave);
}
return ans;
}
double colAve( int n )
{
int i;
double ans;
for( i = 0; i < n; i++ )
{
ans += s[i];
}
return (ans/n);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161650/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161650/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@s = dso_local global [1000 x i32] zeroinitializer, align 16
@.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:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp27 = icmp eq i32 %0, 0
br i1 %cmp27, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %sigma.exit
%1 = phi i32 [ %16, %sigma.exit ], [ %0, %entry ]
%cmp124 = icmp sgt i32 %1, 0
br i1 %cmp124, label %for.body, label %colAve.exit.thread
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%.pr = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %.pr to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp6.i = icmp sgt i32 %.pr, 0
br i1 %cmp6.i, label %for.body.preheader.i, label %colAve.exit.thread
colAve.exit.thread: ; preds = %for.cond.preheader, %for.end
%.lcssa32 = phi i32 [ %.pr, %for.end ], [ %1, %for.cond.preheader ]
%conv1.i20 = sitofp i32 %.lcssa32 to double
br label %sigma.exit
for.body.preheader.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %.pr to i64
%xtraiter = and i64 %wide.trip.count.i, 3
%3 = icmp ult i32 %.pr, 4
br i1 %3, label %colAve.exit.unr-lcssa, label %for.body.preheader.i.new
for.body.preheader.i.new: ; preds = %for.body.preheader.i
%unroll_iter = and i64 %wide.trip.count.i, 4294967292
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ]
%ans.08.i = phi double [ undef, %for.body.preheader.i.new ], [ %add.i.3, %for.body.i ]
%niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ]
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv.i
%4 = load i32, ptr %arrayidx.i, align 16, !tbaa !5
%conv.i = sitofp i32 %4 to double
%add.i = fadd double %ans.08.i, %conv.i
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv.next.i
%5 = load i32, ptr %arrayidx.i.1, align 4, !tbaa !5
%conv.i.1 = sitofp i32 %5 to double
%add.i.1 = fadd double %add.i, %conv.i.1
%indvars.iv.next.i.1 = or i64 %indvars.iv.i, 2
%arrayidx.i.2 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv.next.i.1
%6 = load i32, ptr %arrayidx.i.2, align 8, !tbaa !5
%conv.i.2 = sitofp i32 %6 to double
%add.i.2 = fadd double %add.i.1, %conv.i.2
%indvars.iv.next.i.2 = or i64 %indvars.iv.i, 3
%arrayidx.i.3 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv.next.i.2
%7 = load i32, ptr %arrayidx.i.3, align 4, !tbaa !5
%conv.i.3 = sitofp i32 %7 to double
%add.i.3 = fadd double %add.i.2, %conv.i.3
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %colAve.exit.unr-lcssa, label %for.body.i, !llvm.loop !11
colAve.exit.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i.unr = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ]
%ans.08.i.unr = phi double [ undef, %for.body.preheader.i ], [ %add.i.3, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %colAve.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %colAve.exit.unr-lcssa, %for.body.i.epil
%indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %colAve.exit.unr-lcssa ]
%ans.08.i.epil = phi double [ %add.i.epil, %for.body.i.epil ], [ %ans.08.i.unr, %colAve.exit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %colAve.exit.unr-lcssa ]
%arrayidx.i.epil = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv.i.epil
%8 = load i32, ptr %arrayidx.i.epil, align 4, !tbaa !5
%conv.i.epil = sitofp i32 %8 to double
%add.i.epil = fadd double %ans.08.i.epil, %conv.i.epil
%indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %colAve.exit, label %for.body.i.epil, !llvm.loop !12
colAve.exit: ; preds = %for.body.i.epil, %colAve.exit.unr-lcssa
%add.i.lcssa = phi double [ %ans.08.i.unr, %colAve.exit.unr-lcssa ], [ %add.i.epil, %for.body.i.epil ]
%conv1.i = sitofp i32 %.pr to double
%div.i = fdiv double %add.i.lcssa, %conv1.i
%xtraiter34 = and i64 %wide.trip.count.i, 1
%9 = icmp eq i32 %.pr, 1
br i1 %9, label %sigma.exit.loopexit.unr-lcssa, label %colAve.exit.new
colAve.exit.new: ; preds = %colAve.exit
%unroll_iter38 = and i64 %wide.trip.count.i, 4294967294
br label %for.body.i13
for.body.i13: ; preds = %for.body.i13, %colAve.exit.new
%indvars.iv.i14 = phi i64 [ 0, %colAve.exit.new ], [ %indvars.iv.next.i17.1, %for.body.i13 ]
%ans.011.i = phi double [ undef, %colAve.exit.new ], [ %13, %for.body.i13 ]
%niter39 = phi i64 [ 0, %colAve.exit.new ], [ %niter39.next.1, %for.body.i13 ]
%arrayidx.i15 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv.i14
%10 = load i32, ptr %arrayidx.i15, align 8, !tbaa !5
%conv.i16 = sitofp i32 %10 to double
%sub.i = fsub double %conv.i16, %div.i
%11 = call double @llvm.fmuladd.f64(double %sub.i, double %sub.i, double %ans.011.i)
%indvars.iv.next.i17 = or i64 %indvars.iv.i14, 1
%arrayidx.i15.1 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv.next.i17
%12 = load i32, ptr %arrayidx.i15.1, align 4, !tbaa !5
%conv.i16.1 = sitofp i32 %12 to double
%sub.i.1 = fsub double %conv.i16.1, %div.i
%13 = call double @llvm.fmuladd.f64(double %sub.i.1, double %sub.i.1, double %11)
%indvars.iv.next.i17.1 = add nuw nsw i64 %indvars.iv.i14, 2
%niter39.next.1 = add i64 %niter39, 2
%niter39.ncmp.1 = icmp eq i64 %niter39.next.1, %unroll_iter38
br i1 %niter39.ncmp.1, label %sigma.exit.loopexit.unr-lcssa, label %for.body.i13, !llvm.loop !14
sigma.exit.loopexit.unr-lcssa: ; preds = %for.body.i13, %colAve.exit
%indvars.iv.i14.unr = phi i64 [ 0, %colAve.exit ], [ %indvars.iv.next.i17.1, %for.body.i13 ]
%ans.011.i.unr = phi double [ undef, %colAve.exit ], [ %13, %for.body.i13 ]
%lcmp.mod36.not = icmp eq i64 %xtraiter34, 0
br i1 %lcmp.mod36.not, label %sigma.exit, label %for.body.i13.epil
for.body.i13.epil: ; preds = %sigma.exit.loopexit.unr-lcssa
%arrayidx.i15.epil = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv.i14.unr
%14 = load i32, ptr %arrayidx.i15.epil, align 4, !tbaa !5
%conv.i16.epil = sitofp i32 %14 to double
%sub.i.epil = fsub double %conv.i16.epil, %div.i
%15 = call double @llvm.fmuladd.f64(double %sub.i.epil, double %sub.i.epil, double %ans.011.i.unr)
br label %sigma.exit
sigma.exit: ; preds = %for.body.i13.epil, %sigma.exit.loopexit.unr-lcssa, %colAve.exit.thread
%conv1.i22 = phi double [ %conv1.i20, %colAve.exit.thread ], [ %conv1.i, %sigma.exit.loopexit.unr-lcssa ], [ %conv1.i, %for.body.i13.epil ]
%ans.0.lcssa.i10 = phi double [ undef, %colAve.exit.thread ], [ %ans.011.i.unr, %sigma.exit.loopexit.unr-lcssa ], [ %15, %for.body.i13.epil ]
%div = fdiv double %ans.0.lcssa.i10, %conv1.i22
%call5 = call double @sqrt(double noundef %div) #7
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call5)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%16 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %16, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %sigma.exit, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local double @colAve(i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp6 = icmp sgt i32 %n, 0
br i1 %cmp6, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%xtraiter = and i64 %wide.trip.count, 3
%0 = icmp ult i32 %n, 4
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%ans.08 = phi double [ undef, %for.body.preheader.new ], [ %add.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 16, !tbaa !5
%conv = sitofp i32 %1 to double
%add = fadd double %ans.08, %conv
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv.next
%2 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%conv.1 = sitofp i32 %2 to double
%add.1 = fadd double %add, %conv.1
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv.next.1
%3 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%conv.2 = sitofp i32 %3 to double
%add.2 = fadd double %add.1, %conv.2
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv.next.2
%4 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%conv.3 = sitofp i32 %4 to double
%add.3 = fadd double %add.2, %conv.3
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !11
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%ans.08.unr = phi double [ undef, %for.body.preheader ], [ %add.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ]
%ans.08.epil = phi double [ %add.epil, %for.body.epil ], [ %ans.08.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv.epil
%5 = load i32, ptr %arrayidx.epil, align 4, !tbaa !5
%conv.epil = sitofp i32 %5 to double
%add.epil = fadd double %ans.08.epil, %conv.epil
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !15
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%ans.0.lcssa = phi double [ undef, %entry ], [ %ans.08.unr, %for.end.loopexit.unr-lcssa ], [ %add.epil, %for.body.epil ]
%conv1 = sitofp i32 %n to double
%div = fdiv double %ans.0.lcssa, %conv1
ret double %div
}
; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local double @sigma(i32 noundef %n, double noundef %ave) local_unnamed_addr #4 {
entry:
%cmp10 = icmp sgt i32 %n, 0
br i1 %cmp10, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%xtraiter = and i64 %wide.trip.count, 1
%0 = icmp eq i32 %n, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
%ans.011 = phi double [ undef, %for.body.preheader.new ], [ %4, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 8, !tbaa !5
%conv = sitofp i32 %1 to double
%sub = fsub double %conv, %ave
%2 = tail call double @llvm.fmuladd.f64(double %sub, double %sub, double %ans.011)
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv.next
%3 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%conv.1 = sitofp i32 %3 to double
%sub.1 = fsub double %conv.1, %ave
%4 = tail call double @llvm.fmuladd.f64(double %sub.1, double %sub.1, double %2)
%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.loopexit.unr-lcssa, label %for.body, !llvm.loop !14
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
%ans.011.unr = phi double [ undef, %for.body.preheader ], [ %4, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %indvars.iv.unr
%5 = load i32, ptr %arrayidx.epil, align 4, !tbaa !5
%conv.epil = sitofp i32 %5 to double
%sub.epil = fsub double %conv.epil, %ave
%6 = tail call double @llvm.fmuladd.f64(double %sub.epil, double %sub.epil, double %ans.011.unr)
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%ans.0.lcssa = phi double [ undef, %entry ], [ %ans.011.unr, %for.end.loopexit.unr-lcssa ], [ %6, %for.body.epil ]
ret double %ans.0.lcssa
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #5
; 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { mustprogress 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, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !13}
|
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main(void)
{
int i, n;
double *p;
double ave, a;
while (1) {
scanf("%d", &n);
if (n == 0) break;
p = calloc(n, sizeof(double));
if (p != NULL) {
for (i = 0; i < n; i++) {
scanf("%lf", &p[i]);
}
ave = 0.0;
a = 0.0;
for (i = 0; i < n; i++) {
ave += p[i];
}
ave /= n;
for (i = 0; i < n; i++) {
a += (p[i] - ave) * (p[i] - ave);
}
a /= n;
a = sqrt(a);
}
free(p);
printf("%.8f\n", a);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161694/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161694/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%.8f\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call67 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp68 = icmp eq i32 %0, 0
br i1 %cmp68, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end33
%1 = phi i32 [ %25, %if.end33 ], [ %0, %entry ]
%a.069 = phi double [ %a.2, %if.end33 ], [ undef, %entry ]
%conv = sext i32 %1 to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 8) #8
%cmp2.not = icmp eq ptr %call1, null
br i1 %cmp2.not, label %if.end33, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end
%cmp557 = icmp sgt i32 %1, 0
br i1 %cmp557, label %for.body, label %for.end16.thread
for.cond8.preheader: ; preds = %for.body
%cmp959 = icmp sgt i32 %3, 0
br i1 %cmp959, label %for.body11.preheader, label %for.end16.thread
for.body11.preheader: ; preds = %for.cond8.preheader
%wide.trip.count = zext i32 %3 to i64
%xtraiter = and i64 %wide.trip.count, 7
%2 = icmp ult i32 %3, 8
br i1 %2, label %for.end16.unr-lcssa, label %for.body11.preheader.new
for.body11.preheader.new: ; preds = %for.body11.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967288
br label %for.body11
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds double, ptr %call1, i64 %indvars.iv
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, 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
%cmp5 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp5, label %for.body, label %for.cond8.preheader, !llvm.loop !9
for.body11: ; preds = %for.body11, %for.body11.preheader.new
%indvars.iv73 = phi i64 [ 0, %for.body11.preheader.new ], [ %indvars.iv.next74.7, %for.body11 ]
%ave.061 = phi double [ 0.000000e+00, %for.body11.preheader.new ], [ %add.7, %for.body11 ]
%niter = phi i64 [ 0, %for.body11.preheader.new ], [ %niter.next.7, %for.body11 ]
%arrayidx13 = getelementptr inbounds double, ptr %call1, i64 %indvars.iv73
%5 = load double, ptr %arrayidx13, align 8, !tbaa !11
%add = fadd double %ave.061, %5
%indvars.iv.next74 = or i64 %indvars.iv73, 1
%arrayidx13.1 = getelementptr inbounds double, ptr %call1, i64 %indvars.iv.next74
%6 = load double, ptr %arrayidx13.1, align 8, !tbaa !11
%add.1 = fadd double %add, %6
%indvars.iv.next74.1 = or i64 %indvars.iv73, 2
%arrayidx13.2 = getelementptr inbounds double, ptr %call1, i64 %indvars.iv.next74.1
%7 = load double, ptr %arrayidx13.2, align 8, !tbaa !11
%add.2 = fadd double %add.1, %7
%indvars.iv.next74.2 = or i64 %indvars.iv73, 3
%arrayidx13.3 = getelementptr inbounds double, ptr %call1, i64 %indvars.iv.next74.2
%8 = load double, ptr %arrayidx13.3, align 8, !tbaa !11
%add.3 = fadd double %add.2, %8
%indvars.iv.next74.3 = or i64 %indvars.iv73, 4
%arrayidx13.4 = getelementptr inbounds double, ptr %call1, i64 %indvars.iv.next74.3
%9 = load double, ptr %arrayidx13.4, align 8, !tbaa !11
%add.4 = fadd double %add.3, %9
%indvars.iv.next74.4 = or i64 %indvars.iv73, 5
%arrayidx13.5 = getelementptr inbounds double, ptr %call1, i64 %indvars.iv.next74.4
%10 = load double, ptr %arrayidx13.5, align 8, !tbaa !11
%add.5 = fadd double %add.4, %10
%indvars.iv.next74.5 = or i64 %indvars.iv73, 6
%arrayidx13.6 = getelementptr inbounds double, ptr %call1, i64 %indvars.iv.next74.5
%11 = load double, ptr %arrayidx13.6, align 8, !tbaa !11
%add.6 = fadd double %add.5, %11
%indvars.iv.next74.6 = or i64 %indvars.iv73, 7
%arrayidx13.7 = getelementptr inbounds double, ptr %call1, i64 %indvars.iv.next74.6
%12 = load double, ptr %arrayidx13.7, align 8, !tbaa !11
%add.7 = fadd double %add.6, %12
%indvars.iv.next74.7 = add nuw nsw i64 %indvars.iv73, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end16.unr-lcssa, label %for.body11, !llvm.loop !13
for.end16.thread: ; preds = %for.cond8.preheader, %for.cond.preheader
%.lcssa83.ph = phi i32 [ %3, %for.cond8.preheader ], [ %1, %for.cond.preheader ]
%conv1788 = sitofp i32 %.lcssa83.ph to double
br label %for.end29
for.end16.unr-lcssa: ; preds = %for.body11, %for.body11.preheader
%add.lcssa.ph = phi double [ undef, %for.body11.preheader ], [ %add.7, %for.body11 ]
%indvars.iv73.unr = phi i64 [ 0, %for.body11.preheader ], [ %indvars.iv.next74.7, %for.body11 ]
%ave.061.unr = phi double [ 0.000000e+00, %for.body11.preheader ], [ %add.7, %for.body11 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end16, label %for.body11.epil
for.body11.epil: ; preds = %for.end16.unr-lcssa, %for.body11.epil
%indvars.iv73.epil = phi i64 [ %indvars.iv.next74.epil, %for.body11.epil ], [ %indvars.iv73.unr, %for.end16.unr-lcssa ]
%ave.061.epil = phi double [ %add.epil, %for.body11.epil ], [ %ave.061.unr, %for.end16.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body11.epil ], [ 0, %for.end16.unr-lcssa ]
%arrayidx13.epil = getelementptr inbounds double, ptr %call1, i64 %indvars.iv73.epil
%13 = load double, ptr %arrayidx13.epil, align 8, !tbaa !11
%add.epil = fadd double %ave.061.epil, %13
%indvars.iv.next74.epil = add nuw nsw i64 %indvars.iv73.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end16, label %for.body11.epil, !llvm.loop !14
for.end16: ; preds = %for.body11.epil, %for.end16.unr-lcssa
%add.lcssa = phi double [ %add.lcssa.ph, %for.end16.unr-lcssa ], [ %add.epil, %for.body11.epil ]
%conv17 = sitofp i32 %3 to double
%div = fdiv double %add.lcssa, %conv17
br i1 %cmp959, label %for.body21.preheader, label %for.end29
for.body21.preheader: ; preds = %for.end16
%xtraiter95 = and i64 %wide.trip.count, 3
%14 = icmp ult i32 %3, 4
br i1 %14, label %for.end29.loopexit.unr-lcssa, label %for.body21.preheader.new
for.body21.preheader.new: ; preds = %for.body21.preheader
%unroll_iter99 = and i64 %wide.trip.count, 4294967292
br label %for.body21
for.body21: ; preds = %for.body21, %for.body21.preheader.new
%indvars.iv76 = phi i64 [ 0, %for.body21.preheader.new ], [ %indvars.iv.next77.3, %for.body21 ]
%a.165 = phi double [ 0.000000e+00, %for.body21.preheader.new ], [ %22, %for.body21 ]
%niter100 = phi i64 [ 0, %for.body21.preheader.new ], [ %niter100.next.3, %for.body21 ]
%arrayidx23 = getelementptr inbounds double, ptr %call1, i64 %indvars.iv76
%15 = load double, ptr %arrayidx23, align 8, !tbaa !11
%sub = fsub double %15, %div
%16 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %a.165)
%indvars.iv.next77 = or i64 %indvars.iv76, 1
%arrayidx23.1 = getelementptr inbounds double, ptr %call1, i64 %indvars.iv.next77
%17 = load double, ptr %arrayidx23.1, align 8, !tbaa !11
%sub.1 = fsub double %17, %div
%18 = call double @llvm.fmuladd.f64(double %sub.1, double %sub.1, double %16)
%indvars.iv.next77.1 = or i64 %indvars.iv76, 2
%arrayidx23.2 = getelementptr inbounds double, ptr %call1, i64 %indvars.iv.next77.1
%19 = load double, ptr %arrayidx23.2, align 8, !tbaa !11
%sub.2 = fsub double %19, %div
%20 = call double @llvm.fmuladd.f64(double %sub.2, double %sub.2, double %18)
%indvars.iv.next77.2 = or i64 %indvars.iv76, 3
%arrayidx23.3 = getelementptr inbounds double, ptr %call1, i64 %indvars.iv.next77.2
%21 = load double, ptr %arrayidx23.3, align 8, !tbaa !11
%sub.3 = fsub double %21, %div
%22 = call double @llvm.fmuladd.f64(double %sub.3, double %sub.3, double %20)
%indvars.iv.next77.3 = add nuw nsw i64 %indvars.iv76, 4
%niter100.next.3 = add i64 %niter100, 4
%niter100.ncmp.3 = icmp eq i64 %niter100.next.3, %unroll_iter99
br i1 %niter100.ncmp.3, label %for.end29.loopexit.unr-lcssa, label %for.body21, !llvm.loop !16
for.end29.loopexit.unr-lcssa: ; preds = %for.body21, %for.body21.preheader
%.lcssa93.ph = phi double [ undef, %for.body21.preheader ], [ %22, %for.body21 ]
%indvars.iv76.unr = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next77.3, %for.body21 ]
%a.165.unr = phi double [ 0.000000e+00, %for.body21.preheader ], [ %22, %for.body21 ]
%lcmp.mod97.not = icmp eq i64 %xtraiter95, 0
br i1 %lcmp.mod97.not, label %for.end29, label %for.body21.epil
for.body21.epil: ; preds = %for.end29.loopexit.unr-lcssa, %for.body21.epil
%indvars.iv76.epil = phi i64 [ %indvars.iv.next77.epil, %for.body21.epil ], [ %indvars.iv76.unr, %for.end29.loopexit.unr-lcssa ]
%a.165.epil = phi double [ %24, %for.body21.epil ], [ %a.165.unr, %for.end29.loopexit.unr-lcssa ]
%epil.iter96 = phi i64 [ %epil.iter96.next, %for.body21.epil ], [ 0, %for.end29.loopexit.unr-lcssa ]
%arrayidx23.epil = getelementptr inbounds double, ptr %call1, i64 %indvars.iv76.epil
%23 = load double, ptr %arrayidx23.epil, align 8, !tbaa !11
%sub.epil = fsub double %23, %div
%24 = call double @llvm.fmuladd.f64(double %sub.epil, double %sub.epil, double %a.165.epil)
%indvars.iv.next77.epil = add nuw nsw i64 %indvars.iv76.epil, 1
%epil.iter96.next = add i64 %epil.iter96, 1
%epil.iter96.cmp.not = icmp eq i64 %epil.iter96.next, %xtraiter95
br i1 %epil.iter96.cmp.not, label %for.end29, label %for.body21.epil, !llvm.loop !17
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.body21.epil, %for.end16.thread, %for.end16
%conv1790 = phi double [ %conv17, %for.end16 ], [ %conv1788, %for.end16.thread ], [ %conv17, %for.body21.epil ], [ %conv17, %for.end29.loopexit.unr-lcssa ]
%a.1.lcssa = phi double [ 0.000000e+00, %for.end16 ], [ 0.000000e+00, %for.end16.thread ], [ %.lcssa93.ph, %for.end29.loopexit.unr-lcssa ], [ %24, %for.body21.epil ]
%div31 = fdiv double %a.1.lcssa, %conv1790
%call32 = call double @sqrt(double noundef %div31) #7
br label %if.end33
if.end33: ; preds = %for.end29, %if.end
%a.2 = phi double [ %call32, %for.end29 ], [ %a.069, %if.end ]
call void @free(ptr noundef %call1) #7
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %a.2)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%25 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %25, 0
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %if.end33, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0,1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !15}
|
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
if(n==1)
{
printf("Hello World\n");
}
else
{
int a,b;
scanf("%d%d",&a,&b);
printf("%d\n",a+b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161744/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161744/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [12 x i8] c"Hello World\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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, 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
%add = add nsw i32 %2, %1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main() {
int n;
scanf(" %d", &n);
if (n==1) {
printf("Hello World\n");
}
else {
int a, b;
scanf("%d %d", &a, &b);
printf("%d\n", a+b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161795/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161795/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [12 x i8] c"Hello World\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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, 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
%add = add nsw i32 %2, %1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main (){
int a,b,i;
scanf("%d",&i);
if(i == 1){
printf("Hello World");
}else{
scanf("%d %d",&a,&b);
printf("%d",a+b);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161838/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161838/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [12 x i8] c"Hello World\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%i = 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 %i) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%0 = load i32, ptr %i, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end
if.else: ; preds = %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, 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
%add = add nsw i32 %2, %1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int N, A, B;
scanf("%d", &N);
if (N==1){
printf("Hello World");
}
else if (N==2){
scanf("%d", &A);
scanf("%d", &B);
printf("%d", A+B);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161881/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161881/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [12 x i8] c"Hello World\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) #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)
%0 = load i32, ptr %N, align 4, !tbaa !5
switch i32 %0, label %if.end7 [
i32 1, label %if.then
i32 2, label %if.then3
]
if.then: ; preds = %entry
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end7
if.then3: ; preds = %entry
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %B)
%1 = load i32, ptr %A, align 4, !tbaa !5
%2 = load i32, ptr %B, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add)
br label %if.end7
if.end7: ; preds = %entry, %if.then3, %if.then
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 %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n,a,b,s;
scanf("%d",&n);
if(n==1)
{
printf("Hello World");
}
else if(n==2)
{
scanf("%d %d" ,&a,&b);
s=a+b;
printf("%d",s);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161931/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161931/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [12 x i8] c"Hello World\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%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 %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)
%0 = load i32, ptr %n, align 4, !tbaa !5
switch i32 %0, label %if.end6 [
i32 1, label %if.then
i32 2, label %if.then3
]
if.then: ; preds = %entry
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end6
if.then3: ; preds = %entry
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, 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
%add = add nsw i32 %2, %1
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add)
br label %if.end6
if.end6: ; preds = %entry, %if.then3, %if.then
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 %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 a,b,c;
scanf("%d",&a);
if(a==1){printf("Hello World");}
else{scanf("%d",&b);
scanf("%d",&c);
printf("%d",b+c);}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_161975/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_161975/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [12 x i8] c"Hello World\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end
if.else: ; preds = %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%1 = load i32, ptr %b, align 4, !tbaa !5
%2 = load i32, ptr %c, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int a,b,c,d,N;
scanf("%d", &N);
if(N==1){
printf("Hello World\n");
}
else{
scanf("%d",&a);
scanf("%d",&b);
printf("%d\n", a+b);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162017/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162017/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [12 x i8] c"Hello World\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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int N,A,B,SUM;
scanf("%d",&N);
if(N==1){
printf("Hello World");
}else if(N>=2){
scanf("%d",&A);
scanf("%d",&B);
SUM=A+B;
printf("%d",SUM);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162068/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162068/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [12 x i8] c"Hello World\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) #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)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end7
if.else: ; preds = %entry
%cmp2 = icmp sgt i32 %0, 1
br i1 %cmp2, label %if.then3, label %if.end7
if.then3: ; preds = %if.else
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %B)
%1 = load i32, ptr %A, align 4, !tbaa !5
%2 = load i32, ptr %B, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add)
br label %if.end7
if.end7: ; preds = %if.else, %if.then3, %if.then
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 %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int n, a, b;
scanf("%d", &n);
if(n == 1)
printf("Hello World\n");
else {
scanf("%d", &a);
scanf("%d", &b);
printf("%d\n", a + b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162118/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162118/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [12 x i8] c"Hello World\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
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define SIZE 300000
#define max(a,b) ((a>b) ? (a) : (b))
int cmp1(const void *p,const void *q)//昇順
{
return *(int *)p - *(int *)q;
}
typedef long long int int64;
int tate[SIZE]={0};
int yoko[SIZE]={0};
int tatemax[SIZE]={0};
int yokomax[SIZE]={0};
int tatemaxnum=0;
int yokomaxnum=0;
int bombh[SIZE]={0};
int bombw[SIZE]={0};
int main()
{
int h,w,m;
int x,y;
int i,j,k;
int hmaxcand=-1;
int wmaxcand=-1;
int64 ans=0;
//printf("a");
scanf("%d %d %d",&h,&w,&m);
for(i=0;i<m;i++)
{
scanf("%d %d",&x,&y);
bombh[i]=x-1;
bombw[i]=y-1;
tate[x-1]++;
yoko[y-1]++;
}
//printf("b");
for(i=0;i<h;i++)
{
if(hmaxcand<tate[i])
{
hmaxcand=tate[i];
tatemaxnum=0;
tatemax[tatemaxnum]=i;
tatemaxnum++;
}
else if(hmaxcand==tate[i])
{
tatemax[tatemaxnum]=i;
tatemaxnum++;
}
}
for(j=0;j<w;j++)
{
if(wmaxcand<yoko[j])
{
wmaxcand=yoko[j];
yokomaxnum=0;
yokomax[yokomaxnum]=j;
yokomaxnum++;
}
else if(wmaxcand==yoko[j])
{
yokomax[yokomaxnum]=j;
yokomaxnum++;
}
}
//printf("c");
//暫定の答え
ans=(int64)(hmaxcand)+(int64)(wmaxcand);
//printf("zantei = %lld\n",ans);
//tatemax,yokomaxをソート
qsort(tatemax,tatemaxnum,sizeof(int),cmp1);
qsort(yokomax,yokomaxnum,sizeof(int),cmp1);
void *result1;
void *result2;
int64 flag=0;
for(i=0;i<m;i++)
{
//各爆弾について、tatemax中、yokomax中にあるかにぶたん
//printf("searching %d %d\n",bombh[i],bombw[i]);
result1 = bsearch(bombh+i,tatemax,tatemaxnum,sizeof(int),cmp1);
result2 = bsearch(bombw+i,yokomax,yokomaxnum,sizeof(int),cmp1);
if(result1!=NULL && result2!=NULL)
{
flag++;
}
}
//printf("%lld ",((int64)(hmaxcand)*(int64)(wmaxcand)));
if(flag==((int64)(tatemaxnum)*(int64)(yokomaxnum)))ans--;
printf("%lld",ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162169/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162169/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@tate = dso_local local_unnamed_addr global [300000 x i32] zeroinitializer, align 16
@yoko = dso_local local_unnamed_addr global [300000 x i32] zeroinitializer, align 16
@tatemax = dso_local global [300000 x i32] zeroinitializer, align 16
@yokomax = dso_local global [300000 x i32] zeroinitializer, align 16
@tatemaxnum = dso_local local_unnamed_addr global i32 0, align 4
@yokomaxnum = dso_local local_unnamed_addr global i32 0, align 4
@bombh = dso_local local_unnamed_addr global [300000 x i32] zeroinitializer, align 16
@bombw = dso_local local_unnamed_addr global [300000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [9 x i8] c"%d %d %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 [5 x i8] c"%lld\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp1(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #0 {
entry:
%0 = load i32, ptr %p, align 4, !tbaa !5
%1 = load i32, ptr %q, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%m = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp140 = icmp sgt i32 %0, 0
br i1 %cmp140, label %for.body, label %for.cond13.preheader
for.cond13.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr %h, align 4, !tbaa !5
%tatemaxnum.promoted = load i32, ptr @tatemaxnum, align 4, !tbaa !5
%cmp14144 = icmp sgt i32 %1, 0
br i1 %cmp14144, label %for.body15.preheader, label %for.cond35.preheader
for.body15.preheader: ; preds = %for.cond13.preheader
%wide.trip.count = zext i32 %1 to i64
br label %for.body15
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.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%2 = load i32, ptr %x, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%arrayidx = getelementptr inbounds [300000 x i32], ptr @bombh, i64 0, i64 %indvars.iv
store i32 %sub, ptr %arrayidx, align 4, !tbaa !5
%3 = load i32, ptr %y, align 4, !tbaa !5
%sub2 = add nsw i32 %3, -1
%arrayidx4 = getelementptr inbounds [300000 x i32], ptr @bombw, i64 0, i64 %indvars.iv
store i32 %sub2, ptr %arrayidx4, align 4, !tbaa !5
%idxprom6 = sext i32 %sub to i64
%arrayidx7 = getelementptr inbounds [300000 x i32], ptr @tate, i64 0, i64 %idxprom6
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nsw i32 %4, 1
store i32 %inc, ptr %arrayidx7, align 4, !tbaa !5
%idxprom9 = sext i32 %sub2 to i64
%arrayidx10 = getelementptr inbounds [300000 x i32], ptr @yoko, i64 0, i64 %idxprom9
%5 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%inc11 = add nsw i32 %5, 1
store i32 %inc11, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %m, 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.cond13.preheader, !llvm.loop !9
for.cond35.preheader.loopexit: ; preds = %for.inc32
%8 = sext i32 %hmaxcand.1 to i64
br label %for.cond35.preheader
for.cond35.preheader: ; preds = %for.cond35.preheader.loopexit, %for.cond13.preheader
%9 = phi i32 [ %tatemaxnum.promoted, %for.cond13.preheader ], [ %inc30142, %for.cond35.preheader.loopexit ]
%hmaxcand.0.lcssa = phi i64 [ -1, %for.cond13.preheader ], [ %8, %for.cond35.preheader.loopexit ]
%10 = load i32, ptr %w, align 4, !tbaa !5
%cmp36150 = icmp sgt i32 %10, 0
br i1 %cmp36150, label %for.body37.preheader, label %for.end59
for.body37.preheader: ; preds = %for.cond35.preheader
%yokomaxnum.promoted = load i32, ptr @yokomaxnum, align 4, !tbaa !5
%wide.trip.count184 = zext i32 %10 to i64
br label %for.body37
for.body15: ; preds = %for.body15.preheader, %for.inc32
%indvars.iv178 = phi i64 [ 0, %for.body15.preheader ], [ %indvars.iv.next179, %for.inc32 ]
%hmaxcand.0146 = phi i32 [ -1, %for.body15.preheader ], [ %hmaxcand.1, %for.inc32 ]
%inc30143145 = phi i32 [ %tatemaxnum.promoted, %for.body15.preheader ], [ %inc30142, %for.inc32 ]
%arrayidx17 = getelementptr inbounds [300000 x i32], ptr @tate, i64 0, i64 %indvars.iv178
%11 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%cmp18 = icmp slt i32 %hmaxcand.0146, %11
br i1 %cmp18, label %if.then, label %if.else
if.then: ; preds = %for.body15
%12 = trunc i64 %indvars.iv178 to i32
store i32 %12, ptr @tatemax, align 16, !tbaa !5
br label %for.inc32.sink.split
if.else: ; preds = %for.body15
%cmp26 = icmp eq i32 %hmaxcand.0146, %11
br i1 %cmp26, label %if.then27, label %for.inc32
if.then27: ; preds = %if.else
%idxprom28 = sext i32 %inc30143145 to i64
%arrayidx29 = getelementptr inbounds [300000 x i32], ptr @tatemax, i64 0, i64 %idxprom28
%13 = trunc i64 %indvars.iv178 to i32
store i32 %13, ptr %arrayidx29, align 4, !tbaa !5
%inc30 = add nsw i32 %inc30143145, 1
br label %for.inc32.sink.split
for.inc32.sink.split: ; preds = %if.then27, %if.then
%.sink = phi i32 [ 1, %if.then ], [ %inc30, %if.then27 ]
%hmaxcand.1.ph = phi i32 [ %11, %if.then ], [ %hmaxcand.0146, %if.then27 ]
store i32 %.sink, ptr @tatemaxnum, align 4, !tbaa !5
br label %for.inc32
for.inc32: ; preds = %for.inc32.sink.split, %if.else
%inc30142 = phi i32 [ %inc30143145, %if.else ], [ %.sink, %for.inc32.sink.split ]
%hmaxcand.1 = phi i32 [ %hmaxcand.0146, %if.else ], [ %hmaxcand.1.ph, %for.inc32.sink.split ]
%indvars.iv.next179 = add nuw nsw i64 %indvars.iv178, 1
%exitcond.not = icmp eq i64 %indvars.iv.next179, %wide.trip.count
br i1 %exitcond.not, label %for.cond35.preheader.loopexit, label %for.body15, !llvm.loop !11
for.body37: ; preds = %for.body37.preheader, %for.inc57
%indvars.iv181 = phi i64 [ 0, %for.body37.preheader ], [ %indvars.iv.next182, %for.inc57 ]
%wmaxcand.0152 = phi i32 [ -1, %for.body37.preheader ], [ %wmaxcand.1, %for.inc57 ]
%inc54149151 = phi i32 [ %yokomaxnum.promoted, %for.body37.preheader ], [ %inc54148, %for.inc57 ]
%arrayidx39 = getelementptr inbounds [300000 x i32], ptr @yoko, i64 0, i64 %indvars.iv181
%14 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%cmp40 = icmp slt i32 %wmaxcand.0152, %14
br i1 %cmp40, label %if.then41, label %if.else47
if.then41: ; preds = %for.body37
%15 = trunc i64 %indvars.iv181 to i32
store i32 %15, ptr @yokomax, align 16, !tbaa !5
br label %for.inc57.sink.split
if.else47: ; preds = %for.body37
%cmp50 = icmp eq i32 %wmaxcand.0152, %14
br i1 %cmp50, label %if.then51, label %for.inc57
if.then51: ; preds = %if.else47
%idxprom52 = sext i32 %inc54149151 to i64
%arrayidx53 = getelementptr inbounds [300000 x i32], ptr @yokomax, i64 0, i64 %idxprom52
%16 = trunc i64 %indvars.iv181 to i32
store i32 %16, ptr %arrayidx53, align 4, !tbaa !5
%inc54 = add nsw i32 %inc54149151, 1
br label %for.inc57.sink.split
for.inc57.sink.split: ; preds = %if.then51, %if.then41
%.sink200 = phi i32 [ 1, %if.then41 ], [ %inc54, %if.then51 ]
%wmaxcand.1.ph = phi i32 [ %14, %if.then41 ], [ %wmaxcand.0152, %if.then51 ]
store i32 %.sink200, ptr @yokomaxnum, align 4, !tbaa !5
br label %for.inc57
for.inc57: ; preds = %for.inc57.sink.split, %if.else47
%inc54148 = phi i32 [ %inc54149151, %if.else47 ], [ %.sink200, %for.inc57.sink.split ]
%wmaxcand.1 = phi i32 [ %wmaxcand.0152, %if.else47 ], [ %wmaxcand.1.ph, %for.inc57.sink.split ]
%indvars.iv.next182 = add nuw nsw i64 %indvars.iv181, 1
%exitcond185.not = icmp eq i64 %indvars.iv.next182, %wide.trip.count184
br i1 %exitcond185.not, label %for.end59.loopexit, label %for.body37, !llvm.loop !12
for.end59.loopexit: ; preds = %for.inc57
%17 = sext i32 %wmaxcand.1 to i64
br label %for.end59
for.end59: ; preds = %for.end59.loopexit, %for.cond35.preheader
%wmaxcand.0.lcssa = phi i64 [ -1, %for.cond35.preheader ], [ %17, %for.end59.loopexit ]
%conv61 = sext i32 %9 to i64
call void @qsort(ptr noundef nonnull @tatemax, i64 noundef %conv61, i64 noundef 4, ptr noundef nonnull @cmp1) #5
%18 = load i32, ptr @yokomaxnum, align 4, !tbaa !5
%conv62 = sext i32 %18 to i64
call void @qsort(ptr noundef nonnull @yokomax, i64 noundef %conv62, i64 noundef 4, ptr noundef nonnull @cmp1) #5
%19 = load i32, ptr %m, align 4, !tbaa !5
%cmp64155 = icmp sgt i32 %19, 0
%.pre = load i32, ptr @tatemaxnum, align 4, !tbaa !5
%.pre197 = load i32, ptr @yokomaxnum, align 4, !tbaa !5
%conv67 = sext i32 %.pre to i64
br i1 %cmp64155, label %for.body66.lr.ph, label %for.end59.for.end82_crit_edge
for.end59.for.end82_crit_edge: ; preds = %for.end59
%.pre199 = sext i32 %.pre197 to i64
br label %for.end82
for.body66.lr.ph: ; preds = %for.end59
%cmp18.not.i = icmp eq i32 %.pre, 0
%conv71 = sext i32 %.pre197 to i64
%cmp18.not.i119 = icmp eq i32 %.pre197, 0
%brmerge = select i1 %cmp18.not.i, i1 true, i1 %cmp18.not.i119
%conv71.mux = select i1 %cmp18.not.i, i64 %conv71, i64 0
br i1 %brmerge, label %for.end82, label %for.body66.preheader
for.body66.preheader: ; preds = %for.body66.lr.ph
%wide.trip.count189 = zext i32 %19 to i64
br label %for.body66
for.body66: ; preds = %for.body66.preheader, %bsearch.exit138.loopexit
%indvars.iv186 = phi i64 [ 0, %for.body66.preheader ], [ %indvars.iv.next187, %bsearch.exit138.loopexit ]
%flag.0157 = phi i64 [ 0, %for.body66.preheader ], [ %spec.select, %bsearch.exit138.loopexit ]
%add.ptr = getelementptr inbounds i32, ptr @bombh, i64 %indvars.iv186
%20 = load i32, ptr %add.ptr, align 4, !tbaa !5
br label %while.body.i
while.body.i: ; preds = %for.body66, %if.end6.i
%__l.020.i = phi i64 [ %__l.1.i, %if.end6.i ], [ 0, %for.body66 ]
%__u.019.i = phi i64 [ %__u.1.i, %if.end6.i ], [ %conv67, %for.body66 ]
%add.i = add i64 %__u.019.i, %__l.020.i
%div17.i = lshr i64 %add.i, 1
%mul.i = shl i64 %div17.i, 2
%add.ptr.i = getelementptr inbounds i8, ptr @tatemax, i64 %mul.i
%21 = load i32, ptr %add.ptr.i, align 4, !tbaa !5
%cmp1.i = icmp slt i32 %20, %21
br i1 %cmp1.i, label %if.end6.i, label %if.else.i
if.else.i: ; preds = %while.body.i
%cmp2.not.i = icmp eq i32 %20, %21
br i1 %cmp2.not.i, label %bsearch.exit.loopexit, label %if.then3.i
if.then3.i: ; preds = %if.else.i
%add4.i = add nuw i64 %div17.i, 1
br label %if.end6.i
if.end6.i: ; preds = %if.then3.i, %while.body.i
%__u.1.i = phi i64 [ %__u.019.i, %if.then3.i ], [ %div17.i, %while.body.i ]
%__l.1.i = phi i64 [ %add4.i, %if.then3.i ], [ %__l.020.i, %while.body.i ]
%cmp.i = icmp ult i64 %__l.1.i, %__u.1.i
br i1 %cmp.i, label %while.body.i, label %bsearch.exit.loopexit, !llvm.loop !13
bsearch.exit.loopexit: ; preds = %if.end6.i, %if.else.i
%retval.0.i.ph = phi i64 [ 1, %if.else.i ], [ 0, %if.end6.i ]
%add.ptr70 = getelementptr inbounds i32, ptr @bombw, i64 %indvars.iv186
%22 = load i32, ptr %add.ptr70, align 4, !tbaa !5
br label %while.body.i120
while.body.i120: ; preds = %bsearch.exit.loopexit, %if.end6.i133
%__l.020.i121 = phi i64 [ %__l.1.i135, %if.end6.i133 ], [ 0, %bsearch.exit.loopexit ]
%__u.019.i122 = phi i64 [ %__u.1.i134, %if.end6.i133 ], [ %conv71, %bsearch.exit.loopexit ]
%add.i123 = add i64 %__u.019.i122, %__l.020.i121
%div17.i124 = lshr i64 %add.i123, 1
%mul.i125 = shl i64 %div17.i124, 2
%add.ptr.i126 = getelementptr inbounds i8, ptr @yokomax, i64 %mul.i125
%23 = load i32, ptr %add.ptr.i126, align 4, !tbaa !5
%cmp1.i128 = icmp slt i32 %22, %23
br i1 %cmp1.i128, label %if.end6.i133, label %if.else.i129
if.else.i129: ; preds = %while.body.i120
%cmp2.not.i130 = icmp eq i32 %22, %23
br i1 %cmp2.not.i130, label %bsearch.exit138.loopexit, label %if.then3.i131
if.then3.i131: ; preds = %if.else.i129
%add4.i132 = add nuw i64 %div17.i124, 1
br label %if.end6.i133
if.end6.i133: ; preds = %if.then3.i131, %while.body.i120
%__u.1.i134 = phi i64 [ %__u.019.i122, %if.then3.i131 ], [ %div17.i124, %while.body.i120 ]
%__l.1.i135 = phi i64 [ %add4.i132, %if.then3.i131 ], [ %__l.020.i121, %while.body.i120 ]
%cmp.i136 = icmp ult i64 %__l.1.i135, %__u.1.i134
br i1 %cmp.i136, label %while.body.i120, label %bsearch.exit138.loopexit, !llvm.loop !13
bsearch.exit138.loopexit: ; preds = %if.end6.i133, %if.else.i129
%retval.0.i137.ph = phi i64 [ 1, %if.else.i129 ], [ 0, %if.end6.i133 ]
%or.cond = and i64 %retval.0.i137.ph, %retval.0.i.ph
%spec.select = add nuw nsw i64 %or.cond, %flag.0157
%indvars.iv.next187 = add nuw nsw i64 %indvars.iv186, 1
%exitcond190.not = icmp eq i64 %indvars.iv.next187, %wide.trip.count189
br i1 %exitcond190.not, label %for.end82, label %for.body66, !llvm.loop !14
for.end82: ; preds = %bsearch.exit138.loopexit, %for.body66.lr.ph, %for.end59.for.end82_crit_edge
%conv84.pre-phi = phi i64 [ %.pre199, %for.end59.for.end82_crit_edge ], [ %conv71.mux, %for.body66.lr.ph ], [ %conv71, %bsearch.exit138.loopexit ]
%flag.0.lcssa = phi i64 [ 0, %for.end59.for.end82_crit_edge ], [ 0, %for.body66.lr.ph ], [ %spec.select, %bsearch.exit138.loopexit ]
%add = add nsw i64 %wmaxcand.0.lcssa, %hmaxcand.0.lcssa
%mul = mul nsw i64 %conv84.pre-phi, %conv67
%cmp85 = icmp eq i64 %flag.0.lcssa, %mul
%dec = sext i1 %cmp85 to i64
%spec.select118 = add nsw i64 %add, %dec
%call89 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %spec.select118)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#define ll long long
#define pai 3.1415926535897932384626433832795028841971693
int compare(const void *a, const void *b){
return (*(ll int *)a)- (*(ll int *)b);
}
int main(){
ll int ans=0;
ll int n,i;
scanf("%lld",&n);
ll int a[n];
for(i=0;i<n;i++){
scanf("%lld",&a[i]);
ans^=a[i];
}
for(i=0;i<n;i++){
printf("%lld\n",ans^a[i]);
}
return 0;
}
//XORは同じものを消し合わせて考えることができる | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162233/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162233/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\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) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: 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)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %0, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp19 = icmp sgt i64 %2, 0
br i1 %cmp19, label %for.body, label %for.end11
for.cond3.preheader: ; preds = %for.body
%3 = icmp sgt i64 %5, 0
br i1 %3, label %for.body5, label %for.end11
for.body: ; preds = %entry, %for.body
%ans.021 = phi i64 [ %xor, %for.body ], [ 0, %entry ]
%i.020 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.020
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%4 = load i64, ptr %arrayidx, align 8, !tbaa !5
%xor = xor i64 %4, %ans.021
%inc = add nuw nsw i64 %i.020, 1
%5 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %5
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.body5: ; preds = %for.cond3.preheader, %for.body5
%i.123 = phi i64 [ %inc10, %for.body5 ], [ 0, %for.cond3.preheader ]
%arrayidx6 = getelementptr inbounds i64, ptr %vla, i64 %i.123
%6 = load i64, ptr %arrayidx6, align 8, !tbaa !5
%xor7 = xor i64 %6, %xor
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %xor7)
%inc10 = add nuw nsw i64 %i.123, 1
%7 = load i64, ptr %n, align 8, !tbaa !5
%cmp4 = icmp slt i64 %inc10, %7
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !11
for.end11: ; preds = %for.body5, %entry, %for.cond3.preheader
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
int get_int(void) {
int num;
scanf("%d", &num);
return num;
}
int get_int2(int *a1, int *a2) {
scanf("%d %d", a1, a2);
return 0;
}
#define NUM_MAX 100000
#define POINT_MAX (NUM_MAX*10)
struct point2d {
int x;
int y;
};
int asc(const void *a1, const void *a2) {
struct point2d *p1 = (struct point2d*)a1;
struct point2d *p2 = (struct point2d*)a2;
if(p1->x == p2->x) {
return p1->y - p2->y;
}
return p1->x - p2->x;
}
int check(struct point2d p, int row, int col) {
if(p.x < 0 || p.y < 0) return 0;
if(p.x >= row-2 || p.y >= col-2) return 0;
return 1;
}
#define HASH_SIZE 65536
struct list {
struct point2d p;
int idx;
int cnt;
struct list *next;
};
struct list *create_htable(void) {
static struct list htable[HASH_SIZE];
int i;
for(i = 0; i < HASH_SIZE; i++) {
htable[i].next = &htable[i];
}
return htable;
}
int is_equal(struct point2d p1, struct point2d p2) {
return p1.x == p2.x && p1.y == p2.y;
}
int get_key(struct point2d p) {
return (p.x*p.y+p.x+p.y) & (HASH_SIZE-1);
}
struct list* find(struct list *htable, struct point2d p) {
struct list *head = &htable[get_key(p)];
struct list *elem;
for(elem = head->next; elem != head; elem = elem->next) {
if(is_equal(elem->p, p)) {
return elem;
}
}
return NULL;
}
int find_cnt(struct list *htable, struct point2d p) {
struct list *elem = find(htable, p);
return elem->cnt;
}
void add_elem(struct list *htable, struct point2d p) {
struct list *elem = find(htable, p);
if(elem) {
elem->cnt++;
return;
}
elem = malloc(sizeof(struct list));
struct list *head = &htable[get_key(p)];
elem->next = head->next;
elem->p = p;
elem->cnt = 1;
head->next = elem;
}
int64_t sum_up(struct list *htable, int64_t *map) {
int64_t sum = 0;
int i;
for(i = 0; i < HASH_SIZE; i++) {
struct list *head = &htable[i];
struct list *elem;
for(elem = head->next; elem != head; elem = elem->next) {
map[elem->cnt]++;
sum++;
}
}
return sum;
}
int main(void) {
int row, col, num;
get_int2(&row, &col);
num = get_int();
int i, j, k;
struct list* htable = create_htable();
for(k = 0; k < num; k++) {
int x, y;
get_int2(&x, &y);
// 1-indexed -> 0-indexed
x--; y--;
// put into stack
for(i = 0; i <= 2; i++) {
for(j = 0; j <= 2; j++) {
struct point2d np = (struct point2d){x-i, y-j};
if(check(np, row, col)) {
add_elem(htable, np);
}
}
}
}
static int64_t map[10];
int64_t rem = sum_up(htable, map);
map[0] = (int64_t)(row-2)*(col-2) - rem;
for(i = 0; i < 10; i++) {
printf("%lld\n", map[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162277/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162277/source.c"
target datalayout = "e-m:e-p270: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.list = type { %struct.point2d, i32, i32, ptr }
%struct.point2d = type { i32, i32 }
@.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
@create_htable.htable = internal global [65536 x %struct.list] zeroinitializer, align 16
@main.map = internal unnamed_addr global [10 x i64] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #11
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #11
ret i32 %0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int2(ptr noundef %a1, ptr noundef %a2) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %a1, ptr noundef %a2)
ret i32 0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @asc(ptr nocapture noundef readonly %a1, ptr nocapture noundef readonly %a2) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %a1, align 4, !tbaa !9
%1 = load i32, ptr %a2, align 4, !tbaa !9
%cmp = icmp eq i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%y = getelementptr inbounds %struct.point2d, ptr %a1, i64 0, i32 1
%2 = load i32, ptr %y, align 4, !tbaa !11
%y2 = getelementptr inbounds %struct.point2d, ptr %a2, i64 0, i32 1
%3 = load i32, ptr %y2, align 4, !tbaa !11
%sub = sub nsw i32 %2, %3
br label %cleanup
if.end: ; preds = %entry
%sub5 = sub nsw i32 %0, %1
br label %cleanup
cleanup: ; preds = %if.end, %if.then
%retval.0 = phi i32 [ %sub, %if.then ], [ %sub5, %if.end ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @check(i64 %p.coerce, i32 noundef %row, i32 noundef %col) local_unnamed_addr #4 {
entry:
%0 = and i64 %p.coerce, -9223372034707292160
%or.cond.not = icmp eq i64 %0, 0
br i1 %or.cond.not, label %if.end, label %return
if.end: ; preds = %entry
%p.sroa.3.0.extract.shift = lshr i64 %p.coerce, 32
%p.sroa.3.0.extract.trunc = trunc i64 %p.sroa.3.0.extract.shift to i32
%p.sroa.0.0.extract.trunc = trunc i64 %p.coerce to i32
%sub = add nsw i32 %row, -2
%cmp3.not = icmp sgt i32 %sub, %p.sroa.0.0.extract.trunc
%sub6 = add nsw i32 %col, -2
%cmp7.not = icmp sgt i32 %sub6, %p.sroa.3.0.extract.trunc
%or.cond = select i1 %cmp3.not, i1 %cmp7.not, i1 false
%spec.select = zext i1 %or.cond to i32
br label %return
return: ; preds = %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ %spec.select, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local nonnull ptr @create_htable() local_unnamed_addr #5 {
entry:
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body ]
%arrayidx = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv
%next = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv, i32 3
store ptr %arrayidx, ptr %next, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next
%next.1 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next, i32 3
store ptr %arrayidx.1, ptr %next.1, align 8, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.1
%next.2 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.1, i32 3
store ptr %arrayidx.2, ptr %next.2, align 16, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.2
%next.3 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.2, i32 3
store ptr %arrayidx.3, ptr %next.3, align 8, !tbaa !12
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, 65536
br i1 %exitcond.not.3, label %for.end, label %for.body, !llvm.loop !15
for.end: ; preds = %for.body
ret ptr @create_htable.htable
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @is_equal(i64 %p1.coerce, i64 %p2.coerce) local_unnamed_addr #4 {
entry:
%0 = icmp eq i64 %p1.coerce, %p2.coerce
%land.ext = zext i1 %0 to i32
ret i32 %land.ext
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @get_key(i64 %p.coerce) local_unnamed_addr #4 {
entry:
%p.sroa.0.0.extract.trunc = trunc i64 %p.coerce to i32
%p.sroa.3.0.extract.shift = lshr i64 %p.coerce, 32
%p.sroa.3.0.extract.trunc = trunc i64 %p.sroa.3.0.extract.shift to i32
%p.sroa.0.0.extract.trunc6 = add i32 %p.sroa.3.0.extract.trunc, 1
%add = mul i32 %p.sroa.0.0.extract.trunc6, %p.sroa.0.0.extract.trunc
%add3 = add nsw i32 %add, %p.sroa.3.0.extract.trunc
%and = and i32 %add3, 65535
ret i32 %and
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @find(ptr noundef readonly %htable, i64 %p.coerce) local_unnamed_addr #6 {
entry:
%p.sroa.3.0.extract.shift.i = lshr i64 %p.coerce, 32
%p.sroa.0.0.extract.trunc6.i = add nuw nsw i64 %p.sroa.3.0.extract.shift.i, 1
%add.i = mul i64 %p.sroa.0.0.extract.trunc6.i, %p.coerce
%add3.i = add i64 %add.i, %p.sroa.3.0.extract.shift.i
%and.i = and i64 %add3.i, 65535
%arrayidx = getelementptr inbounds %struct.list, ptr %htable, i64 %and.i
%next = getelementptr inbounds %struct.list, ptr %htable, i64 %and.i, i32 3
%elem.010 = load ptr, ptr %next, align 8, !tbaa !12
%cmp.not11 = icmp eq ptr %elem.010, %arrayidx
br i1 %cmp.not11, label %cleanup, label %for.body
for.body: ; preds = %entry, %for.inc
%elem.012 = phi ptr [ %elem.0, %for.inc ], [ %elem.010, %entry ]
%0 = load i64, ptr %elem.012, align 8
%.not = icmp eq i64 %0, %p.coerce
br i1 %.not, label %cleanup, label %for.inc
for.inc: ; preds = %for.body
%next3 = getelementptr inbounds %struct.list, ptr %elem.012, i64 0, i32 3
%elem.0 = load ptr, ptr %next3, align 8, !tbaa !12
%cmp.not = icmp eq ptr %elem.0, %arrayidx
br i1 %cmp.not, label %cleanup, label %for.body, !llvm.loop !17
cleanup: ; preds = %for.body, %for.inc, %entry
%retval.0 = phi ptr [ null, %entry ], [ null, %for.inc ], [ %elem.012, %for.body ]
ret ptr %retval.0
}
; Function Attrs: nofree nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find_cnt(ptr noundef readonly %htable, i64 %p.coerce) local_unnamed_addr #7 {
entry:
%p.sroa.3.0.extract.shift.i.i = lshr i64 %p.coerce, 32
%p.sroa.0.0.extract.trunc6.i.i = add nuw nsw i64 %p.sroa.3.0.extract.shift.i.i, 1
%add.i.i = mul i64 %p.sroa.0.0.extract.trunc6.i.i, %p.coerce
%add3.i.i = add i64 %add.i.i, %p.sroa.3.0.extract.shift.i.i
%and.i.i = and i64 %add3.i.i, 65535
%arrayidx.i = getelementptr inbounds %struct.list, ptr %htable, i64 %and.i.i
%next.i = getelementptr inbounds %struct.list, ptr %htable, i64 %and.i.i, i32 3
%elem.010.i = load ptr, ptr %next.i, align 8, !tbaa !12
%cmp.not11.i = icmp ne ptr %elem.010.i, %arrayidx.i
tail call void @llvm.assume(i1 %cmp.not11.i)
%0 = load i64, ptr %elem.010.i, align 8
%.not.i1 = icmp eq i64 %0, %p.coerce
br i1 %.not.i1, label %find.exit, label %for.inc.i
for.inc.i: ; preds = %entry, %for.inc.i
%elem.012.i2 = phi ptr [ %elem.0.i, %for.inc.i ], [ %elem.010.i, %entry ]
%next3.i = getelementptr inbounds %struct.list, ptr %elem.012.i2, i64 0, i32 3
%elem.0.i = load ptr, ptr %next3.i, align 8, !tbaa !12
%cmp.not.i = icmp ne ptr %elem.0.i, %arrayidx.i
tail call void @llvm.assume(i1 %cmp.not.i)
%1 = load i64, ptr %elem.0.i, align 8
%.not.i = icmp eq i64 %1, %p.coerce
br i1 %.not.i, label %find.exit, label %for.inc.i
find.exit: ; preds = %for.inc.i, %entry
%elem.012.i.lcssa = phi ptr [ %elem.010.i, %entry ], [ %elem.0.i, %for.inc.i ]
%cnt = getelementptr inbounds %struct.list, ptr %elem.012.i.lcssa, i64 0, i32 2
%2 = load i32, ptr %cnt, align 4, !tbaa !18
ret i32 %2
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @add_elem(ptr noundef %htable, i64 %p.coerce) local_unnamed_addr #0 {
entry:
%p.sroa.3.0.extract.shift.i.i = lshr i64 %p.coerce, 32
%p.sroa.0.0.extract.trunc6.i.i = add nuw nsw i64 %p.sroa.3.0.extract.shift.i.i, 1
%add.i.i = mul i64 %p.sroa.0.0.extract.trunc6.i.i, %p.coerce
%add3.i.i = add i64 %add.i.i, %p.sroa.3.0.extract.shift.i.i
%and.i.i = and i64 %add3.i.i, 65535
%arrayidx.i = getelementptr inbounds %struct.list, ptr %htable, i64 %and.i.i
%next.i = getelementptr inbounds %struct.list, ptr %htable, i64 %and.i.i, i32 3
%elem.010.i = load ptr, ptr %next.i, align 8, !tbaa !12
%cmp.not11.i = icmp eq ptr %elem.010.i, %arrayidx.i
br i1 %cmp.not11.i, label %if.end, label %for.body.i
for.body.i: ; preds = %entry, %for.inc.i
%elem.012.i = phi ptr [ %elem.0.i, %for.inc.i ], [ %elem.010.i, %entry ]
%0 = load i64, ptr %elem.012.i, align 8
%.not.i = icmp eq i64 %0, %p.coerce
br i1 %.not.i, label %if.then, label %for.inc.i
for.inc.i: ; preds = %for.body.i
%next3.i = getelementptr inbounds %struct.list, ptr %elem.012.i, i64 0, i32 3
%elem.0.i = load ptr, ptr %next3.i, align 8, !tbaa !12
%cmp.not.i = icmp eq ptr %elem.0.i, %arrayidx.i
br i1 %cmp.not.i, label %if.end, label %for.body.i, !llvm.loop !17
if.then: ; preds = %for.body.i
%cnt = getelementptr inbounds %struct.list, ptr %elem.012.i, i64 0, i32 2
%1 = load i32, ptr %cnt, align 4, !tbaa !18
%inc = add nsw i32 %1, 1
store i32 %inc, ptr %cnt, align 4, !tbaa !18
br label %cleanup
if.end: ; preds = %for.inc.i, %entry
%call1 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #12
%next3 = getelementptr inbounds %struct.list, ptr %call1, i64 0, i32 3
store ptr %elem.010.i, ptr %next3, align 8, !tbaa !12
store i64 %p.coerce, ptr %call1, align 8, !tbaa.struct !19
%cnt5 = getelementptr inbounds %struct.list, ptr %call1, i64 0, i32 2
store i32 1, ptr %cnt5, align 4, !tbaa !18
store ptr %call1, ptr %next.i, align 8, !tbaa !12
br label %cleanup
cleanup: ; preds = %if.end, %if.then
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #8
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local i64 @sum_up(ptr noundef readonly %htable, ptr nocapture noundef %map) local_unnamed_addr #9 {
entry:
br label %for.body
for.body: ; preds = %entry, %for.end
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.end ]
%sum.022 = phi i64 [ 0, %entry ], [ %sum.1.lcssa, %for.end ]
%arrayidx = getelementptr inbounds %struct.list, ptr %htable, i64 %indvars.iv
%next = getelementptr inbounds %struct.list, ptr %htable, i64 %indvars.iv, i32 3
%elem.017 = load ptr, ptr %next, align 8, !tbaa !12
%cmp2.not18 = icmp eq ptr %elem.017, %arrayidx
br i1 %cmp2.not18, label %for.end, label %for.body3
for.body3: ; preds = %for.body, %for.body3
%elem.020 = phi ptr [ %elem.0, %for.body3 ], [ %elem.017, %for.body ]
%sum.119 = phi i64 [ %inc6, %for.body3 ], [ %sum.022, %for.body ]
%cnt = getelementptr inbounds %struct.list, ptr %elem.020, i64 0, i32 2
%0 = load i32, ptr %cnt, align 4, !tbaa !18
%idxprom4 = sext i32 %0 to i64
%arrayidx5 = getelementptr inbounds i64, ptr %map, i64 %idxprom4
%1 = load i64, ptr %arrayidx5, align 8, !tbaa !20
%inc = add nsw i64 %1, 1
store i64 %inc, ptr %arrayidx5, align 8, !tbaa !20
%inc6 = add nsw i64 %sum.119, 1
%next7 = getelementptr inbounds %struct.list, ptr %elem.020, i64 0, i32 3
%elem.0 = load ptr, ptr %next7, align 8, !tbaa !12
%cmp2.not = icmp eq ptr %elem.0, %arrayidx
br i1 %cmp2.not, label %for.end, label %for.body3, !llvm.loop !22
for.end: ; preds = %for.body3, %for.body
%sum.1.lcssa = phi i64 [ %sum.022, %for.body ], [ %inc6, %for.body3 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 65536
br i1 %exitcond.not, label %for.end10, label %for.body, !llvm.loop !23
for.end10: ; preds = %for.end
ret i64 %sum.1.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num.i = alloca i32, align 4
%row = alloca i32, align 4
%col = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %row) #11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %col) #11
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %row, ptr noundef nonnull %col)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num.i) #11
%call.i52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num.i)
%0 = load i32, ptr %num.i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num.i) #11
br label %for.body.i
for.body.i: ; preds = %for.body.i, %entry
%indvars.iv.i = phi i64 [ 0, %entry ], [ %indvars.iv.next.i.3, %for.body.i ]
%arrayidx.i = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.i
%next.i = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.i, i32 3
store ptr %arrayidx.i, ptr %next.i, align 16, !tbaa !12
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.i
%next.i.1 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.i, i32 3
store ptr %arrayidx.i.1, ptr %next.i.1, align 8, !tbaa !12
%indvars.iv.next.i.1 = or i64 %indvars.iv.i, 2
%arrayidx.i.2 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.i.1
%next.i.2 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.i.1, i32 3
store ptr %arrayidx.i.2, ptr %next.i.2, align 16, !tbaa !12
%indvars.iv.next.i.2 = or i64 %indvars.iv.i, 3
%arrayidx.i.3 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.i.2
%next.i.3 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.i.2, i32 3
store ptr %arrayidx.i.3, ptr %next.i.3, align 8, !tbaa !12
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, 65536
br i1 %exitcond.not.i.3, label %for.cond.preheader, label %for.body.i, !llvm.loop !15
for.cond.preheader: ; preds = %for.body.i
%cmp68 = icmp sgt i32 %0, 0
br i1 %cmp68, label %for.body, label %for.body.i55.preheader
for.body: ; preds = %for.cond.preheader, %for.end17
%k.069 = phi i32 [ %inc19, %for.end17 ], [ 0, %for.cond.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #11
%call.i53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%1 = load i32, ptr %x, align 4, !tbaa !5
%2 = load i32, ptr %y, align 4, !tbaa !5
%dec4 = add nsw i32 %2, -1
%3 = load i32, ptr %col, align 4
%4 = load i32, ptr %row, align 4
%sub.i = add nsw i32 %4, -2
%sub6.i = add nsw i32 %3, -2
%np.sroa.5.0.insert.ext = zext i32 %dec4 to i64
%np.sroa.5.0.insert.shift = shl nuw i64 %np.sroa.5.0.insert.ext, 32
%cmp7.not.i = icmp slt i32 %sub6.i, %2
%p.sroa.0.0.extract.trunc6.i.i.i = add nuw nsw i64 %np.sroa.5.0.insert.ext, 1
%sub13.1 = add nsw i32 %2, -2
%np.sroa.5.0.insert.ext.1 = zext i32 %sub13.1 to i64
%np.sroa.5.0.insert.shift.1 = shl nuw i64 %np.sroa.5.0.insert.ext.1, 32
%cmp7.not.i.1 = icmp sle i32 %3, %2
%p.sroa.0.0.extract.trunc6.i.i.i.1 = add nuw nsw i64 %np.sroa.5.0.insert.ext.1, 1
%sub13.2 = add nsw i32 %2, -3
%np.sroa.5.0.insert.ext.2 = zext i32 %sub13.2 to i64
%np.sroa.5.0.insert.shift.2 = shl nuw i64 %np.sroa.5.0.insert.ext.2, 32
%cmp7.not.i.2 = icmp sle i32 %sub6.i, %sub13.2
%p.sroa.0.0.extract.trunc6.i.i.i.2 = add nuw nsw i64 %np.sroa.5.0.insert.ext.2, 1
br label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.body, %for.inc15
%indvars.iv = phi i64 [ 0, %for.body ], [ %indvars.iv.next, %for.inc15 ]
%5 = trunc i64 %indvars.iv to i32
%6 = xor i32 %5, -1
%sub = add i32 %1, %6
%np.sroa.0.0.insert.ext = zext i32 %sub to i64
%cmp3.not.i = icmp sle i32 %sub.i, %sub
%cmp3.not.i.fr = freeze i1 %cmp3.not.i
br i1 %cmp3.not.i.fr, label %for.inc15, label %for.body10.preheader
for.body10.preheader: ; preds = %for.cond8.preheader
%np.sroa.0.0.insert.insert = or i64 %np.sroa.5.0.insert.shift, %np.sroa.0.0.insert.ext
%7 = and i64 %np.sroa.0.0.insert.insert, -9223372034707292160
%or.cond.not.i = icmp ne i64 %7, 0
%or.cond = select i1 %or.cond.not.i, i1 true, i1 %cmp7.not.i
br i1 %or.cond, label %if.end, label %if.then
if.then: ; preds = %for.body10.preheader
%add.i.i.i = mul nuw i64 %p.sroa.0.0.extract.trunc6.i.i.i, %np.sroa.0.0.insert.ext
%add3.i.i.i = add nuw i64 %add.i.i.i, %np.sroa.5.0.insert.ext
%and.i.i.i = and i64 %add3.i.i.i, 65535
%arrayidx.i.i = getelementptr inbounds %struct.list, ptr @create_htable.htable, i64 %and.i.i.i
%next.i.i = getelementptr inbounds %struct.list, ptr @create_htable.htable, i64 %and.i.i.i, i32 3
%elem.010.i.i = load ptr, ptr %next.i.i, align 8, !tbaa !12
%cmp.not11.i.i = icmp eq ptr %elem.010.i.i, %arrayidx.i.i
br i1 %cmp.not11.i.i, label %if.end.i54, label %for.body.i.i
for.body.i.i: ; preds = %if.then, %for.inc.i.i
%elem.012.i.i = phi ptr [ %elem.0.i.i, %for.inc.i.i ], [ %elem.010.i.i, %if.then ]
%8 = load i64, ptr %elem.012.i.i, align 8
%.not.i.i = icmp eq i64 %8, %np.sroa.0.0.insert.insert
br i1 %.not.i.i, label %if.then.i, label %for.inc.i.i
for.inc.i.i: ; preds = %for.body.i.i
%next3.i.i = getelementptr inbounds %struct.list, ptr %elem.012.i.i, i64 0, i32 3
%elem.0.i.i = load ptr, ptr %next3.i.i, align 8, !tbaa !12
%cmp.not.i.i = icmp eq ptr %elem.0.i.i, %arrayidx.i.i
br i1 %cmp.not.i.i, label %if.end.i54, label %for.body.i.i, !llvm.loop !17
if.then.i: ; preds = %for.body.i.i
%cnt.i = getelementptr inbounds %struct.list, ptr %elem.012.i.i, i64 0, i32 2
%9 = load i32, ptr %cnt.i, align 4, !tbaa !18
%inc.i = add nsw i32 %9, 1
store i32 %inc.i, ptr %cnt.i, align 4, !tbaa !18
br label %if.end
if.end.i54: ; preds = %for.inc.i.i, %if.then
%call1.i = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #12
%next3.i = getelementptr inbounds %struct.list, ptr %call1.i, i64 0, i32 3
store ptr %elem.010.i.i, ptr %next3.i, align 8, !tbaa !12
store i64 %np.sroa.0.0.insert.insert, ptr %call1.i, align 8, !tbaa.struct !19
%cnt5.i = getelementptr inbounds %struct.list, ptr %call1.i, i64 0, i32 2
store i32 1, ptr %cnt5.i, align 4, !tbaa !18
store ptr %call1.i, ptr %next.i.i, align 8, !tbaa !12
br label %if.end
if.end: ; preds = %for.body10.preheader, %if.end.i54, %if.then.i
%np.sroa.0.0.insert.insert.1 = or i64 %np.sroa.5.0.insert.shift.1, %np.sroa.0.0.insert.ext
%10 = and i64 %np.sroa.0.0.insert.insert.1, -9223372034707292160
%or.cond.not.i.1 = icmp ne i64 %10, 0
%or.cond.1 = select i1 %or.cond.not.i.1, i1 true, i1 %cmp7.not.i.1
br i1 %or.cond.1, label %if.end.1, label %if.then.1
if.then.1: ; preds = %if.end
%add.i.i.i.1 = mul nuw i64 %p.sroa.0.0.extract.trunc6.i.i.i.1, %np.sroa.0.0.insert.ext
%add3.i.i.i.1 = add nuw i64 %add.i.i.i.1, %np.sroa.5.0.insert.ext.1
%and.i.i.i.1 = and i64 %add3.i.i.i.1, 65535
%arrayidx.i.i.1 = getelementptr inbounds %struct.list, ptr @create_htable.htable, i64 %and.i.i.i.1
%next.i.i.1 = getelementptr inbounds %struct.list, ptr @create_htable.htable, i64 %and.i.i.i.1, i32 3
%elem.010.i.i.1 = load ptr, ptr %next.i.i.1, align 8, !tbaa !12
%cmp.not11.i.i.1 = icmp eq ptr %elem.010.i.i.1, %arrayidx.i.i.1
br i1 %cmp.not11.i.i.1, label %if.end.i54.1, label %for.body.i.i.1
for.body.i.i.1: ; preds = %if.then.1, %for.inc.i.i.1
%elem.012.i.i.1 = phi ptr [ %elem.0.i.i.1, %for.inc.i.i.1 ], [ %elem.010.i.i.1, %if.then.1 ]
%11 = load i64, ptr %elem.012.i.i.1, align 8
%.not.i.i.1 = icmp eq i64 %11, %np.sroa.0.0.insert.insert.1
br i1 %.not.i.i.1, label %if.then.i.1, label %for.inc.i.i.1
for.inc.i.i.1: ; preds = %for.body.i.i.1
%next3.i.i.1 = getelementptr inbounds %struct.list, ptr %elem.012.i.i.1, i64 0, i32 3
%elem.0.i.i.1 = load ptr, ptr %next3.i.i.1, align 8, !tbaa !12
%cmp.not.i.i.1 = icmp eq ptr %elem.0.i.i.1, %arrayidx.i.i.1
br i1 %cmp.not.i.i.1, label %if.end.i54.1, label %for.body.i.i.1, !llvm.loop !17
if.then.i.1: ; preds = %for.body.i.i.1
%cnt.i.1 = getelementptr inbounds %struct.list, ptr %elem.012.i.i.1, i64 0, i32 2
%12 = load i32, ptr %cnt.i.1, align 4, !tbaa !18
%inc.i.1 = add nsw i32 %12, 1
store i32 %inc.i.1, ptr %cnt.i.1, align 4, !tbaa !18
br label %if.end.1
if.end.i54.1: ; preds = %for.inc.i.i.1, %if.then.1
%call1.i.1 = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #12
%next3.i.1 = getelementptr inbounds %struct.list, ptr %call1.i.1, i64 0, i32 3
store ptr %elem.010.i.i.1, ptr %next3.i.1, align 8, !tbaa !12
store i64 %np.sroa.0.0.insert.insert.1, ptr %call1.i.1, align 8, !tbaa.struct !19
%cnt5.i.1 = getelementptr inbounds %struct.list, ptr %call1.i.1, i64 0, i32 2
store i32 1, ptr %cnt5.i.1, align 4, !tbaa !18
store ptr %call1.i.1, ptr %next.i.i.1, align 8, !tbaa !12
br label %if.end.1
if.end.1: ; preds = %if.end.i54.1, %if.then.i.1, %if.end
%np.sroa.0.0.insert.insert.2 = or i64 %np.sroa.5.0.insert.shift.2, %np.sroa.0.0.insert.ext
%13 = and i64 %np.sroa.0.0.insert.insert.2, -9223372034707292160
%or.cond.not.i.2 = icmp ne i64 %13, 0
%or.cond.2 = select i1 %or.cond.not.i.2, i1 true, i1 %cmp7.not.i.2
br i1 %or.cond.2, label %for.inc15, label %if.then.2
if.then.2: ; preds = %if.end.1
%add.i.i.i.2 = mul nuw i64 %p.sroa.0.0.extract.trunc6.i.i.i.2, %np.sroa.0.0.insert.ext
%add3.i.i.i.2 = add nuw i64 %add.i.i.i.2, %np.sroa.5.0.insert.ext.2
%and.i.i.i.2 = and i64 %add3.i.i.i.2, 65535
%arrayidx.i.i.2 = getelementptr inbounds %struct.list, ptr @create_htable.htable, i64 %and.i.i.i.2
%next.i.i.2 = getelementptr inbounds %struct.list, ptr @create_htable.htable, i64 %and.i.i.i.2, i32 3
%elem.010.i.i.2 = load ptr, ptr %next.i.i.2, align 8, !tbaa !12
%cmp.not11.i.i.2 = icmp eq ptr %elem.010.i.i.2, %arrayidx.i.i.2
br i1 %cmp.not11.i.i.2, label %if.end.i54.2, label %for.body.i.i.2
for.body.i.i.2: ; preds = %if.then.2, %for.inc.i.i.2
%elem.012.i.i.2 = phi ptr [ %elem.0.i.i.2, %for.inc.i.i.2 ], [ %elem.010.i.i.2, %if.then.2 ]
%14 = load i64, ptr %elem.012.i.i.2, align 8
%.not.i.i.2 = icmp eq i64 %14, %np.sroa.0.0.insert.insert.2
br i1 %.not.i.i.2, label %if.then.i.2, label %for.inc.i.i.2
for.inc.i.i.2: ; preds = %for.body.i.i.2
%next3.i.i.2 = getelementptr inbounds %struct.list, ptr %elem.012.i.i.2, i64 0, i32 3
%elem.0.i.i.2 = load ptr, ptr %next3.i.i.2, align 8, !tbaa !12
%cmp.not.i.i.2 = icmp eq ptr %elem.0.i.i.2, %arrayidx.i.i.2
br i1 %cmp.not.i.i.2, label %if.end.i54.2, label %for.body.i.i.2, !llvm.loop !17
if.then.i.2: ; preds = %for.body.i.i.2
%cnt.i.2 = getelementptr inbounds %struct.list, ptr %elem.012.i.i.2, i64 0, i32 2
%15 = load i32, ptr %cnt.i.2, align 4, !tbaa !18
%inc.i.2 = add nsw i32 %15, 1
store i32 %inc.i.2, ptr %cnt.i.2, align 4, !tbaa !18
br label %for.inc15
if.end.i54.2: ; preds = %for.inc.i.i.2, %if.then.2
%call1.i.2 = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #12
%next3.i.2 = getelementptr inbounds %struct.list, ptr %call1.i.2, i64 0, i32 3
store ptr %elem.010.i.i.2, ptr %next3.i.2, align 8, !tbaa !12
store i64 %np.sroa.0.0.insert.insert.2, ptr %call1.i.2, align 8, !tbaa.struct !19
%cnt5.i.2 = getelementptr inbounds %struct.list, ptr %call1.i.2, i64 0, i32 2
store i32 1, ptr %cnt5.i.2, align 4, !tbaa !18
store ptr %call1.i.2, ptr %next.i.i.2, align 8, !tbaa !12
br label %for.inc15
for.inc15: ; preds = %if.end.1, %if.then.i.2, %if.end.i54.2, %for.cond8.preheader
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 3
br i1 %exitcond.not, label %for.end17, label %for.cond8.preheader, !llvm.loop !24
for.end17: ; preds = %for.inc15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #11
%inc19 = add nuw nsw i32 %k.069, 1
%exitcond75.not = icmp eq i32 %inc19, %0
br i1 %exitcond75.not, label %for.body.i55.preheader, label %for.body, !llvm.loop !25
for.body.i55.preheader: ; preds = %for.end17, %for.cond.preheader
br label %for.body.i55
for.body.i55: ; preds = %for.body.i55.preheader, %for.end.i
%indvars.iv.i56 = phi i64 [ %indvars.iv.next.i61, %for.end.i ], [ 0, %for.body.i55.preheader ]
%sum.022.i = phi i64 [ %sum.1.lcssa.i, %for.end.i ], [ 0, %for.body.i55.preheader ]
%arrayidx.i57 = getelementptr inbounds %struct.list, ptr @create_htable.htable, i64 %indvars.iv.i56
%next.i58 = getelementptr inbounds %struct.list, ptr @create_htable.htable, i64 %indvars.iv.i56, i32 3
%elem.017.i = load ptr, ptr %next.i58, align 8, !tbaa !12
%cmp2.not18.i = icmp eq ptr %elem.017.i, %arrayidx.i57
br i1 %cmp2.not18.i, label %for.end.i, label %for.body3.i
for.body3.i: ; preds = %for.body.i55, %for.body3.i
%elem.020.i = phi ptr [ %elem.0.i, %for.body3.i ], [ %elem.017.i, %for.body.i55 ]
%sum.119.i = phi i64 [ %inc6.i, %for.body3.i ], [ %sum.022.i, %for.body.i55 ]
%cnt.i59 = getelementptr inbounds %struct.list, ptr %elem.020.i, i64 0, i32 2
%16 = load i32, ptr %cnt.i59, align 4, !tbaa !18
%idxprom4.i = sext i32 %16 to i64
%arrayidx5.i = getelementptr inbounds i64, ptr @main.map, i64 %idxprom4.i
%17 = load i64, ptr %arrayidx5.i, align 8, !tbaa !20
%inc.i60 = add nsw i64 %17, 1
store i64 %inc.i60, ptr %arrayidx5.i, align 8, !tbaa !20
%inc6.i = add nsw i64 %sum.119.i, 1
%next7.i = getelementptr inbounds %struct.list, ptr %elem.020.i, i64 0, i32 3
%elem.0.i = load ptr, ptr %next7.i, align 8, !tbaa !12
%cmp2.not.i = icmp eq ptr %elem.0.i, %arrayidx.i57
br i1 %cmp2.not.i, label %for.end.i, label %for.body3.i, !llvm.loop !22
for.end.i: ; preds = %for.body3.i, %for.body.i55
%sum.1.lcssa.i = phi i64 [ %sum.022.i, %for.body.i55 ], [ %inc6.i, %for.body3.i ]
%indvars.iv.next.i61 = add nuw nsw i64 %indvars.iv.i56, 1
%exitcond.not.i62 = icmp eq i64 %indvars.iv.next.i61, 65536
br i1 %exitcond.not.i62, label %sum_up.exit, label %for.body.i55, !llvm.loop !23
sum_up.exit: ; preds = %for.end.i
%18 = load i32, ptr %row, align 4, !tbaa !5
%sub22 = add nsw i32 %18, -2
%conv = sext i32 %sub22 to i64
%19 = load i32, ptr %col, align 4, !tbaa !5
%sub23 = add nsw i32 %19, -2
%conv24 = sext i32 %sub23 to i64
%mul = mul nsw i64 %conv24, %conv
%sub25 = sub nsw i64 %mul, %sum.1.lcssa.i
store i64 %sub25, ptr @main.map, align 16, !tbaa !20
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sub25)
%20 = load i64, ptr getelementptr inbounds ([10 x i64], ptr @main.map, i64 0, i64 1), align 8, !tbaa !20
%call30.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %20)
%21 = load i64, ptr getelementptr inbounds ([10 x i64], ptr @main.map, i64 0, i64 2), align 16, !tbaa !20
%call30.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %21)
%22 = load i64, ptr getelementptr inbounds ([10 x i64], ptr @main.map, i64 0, i64 3), align 8, !tbaa !20
%call30.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %22)
%23 = load i64, ptr getelementptr inbounds ([10 x i64], ptr @main.map, i64 0, i64 4), align 16, !tbaa !20
%call30.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %23)
%24 = load i64, ptr getelementptr inbounds ([10 x i64], ptr @main.map, i64 0, i64 5), align 8, !tbaa !20
%call30.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %24)
%25 = load i64, ptr getelementptr inbounds ([10 x i64], ptr @main.map, i64 0, i64 6), align 16, !tbaa !20
%call30.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %25)
%26 = load i64, ptr getelementptr inbounds ([10 x i64], ptr @main.map, i64 0, i64 7), align 8, !tbaa !20
%call30.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %26)
%27 = load i64, ptr getelementptr inbounds ([10 x i64], ptr @main.map, i64 0, i64 8), align 16, !tbaa !20
%call30.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %27)
%28 = load i64, ptr getelementptr inbounds ([10 x i64], ptr @main.map, i64 0, i64 9), align 8, !tbaa !20
%call30.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %28)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %col) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %row) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #10
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 #5 = { nofree norecurse nosync nounwind memory(write, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { 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 #9 = { nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #11 = { nounwind }
attributes #12 = { 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 = !{!10, !6, i64 0}
!10 = !{!"point2d", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = !{!13, !14, i64 16}
!13 = !{!"list", !10, i64 0, !6, i64 8, !6, i64 12, !14, i64 16}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = !{!13, !6, i64 12}
!19 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!20 = !{!21, !21, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = distinct !{!22, !16}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !16}
!25 = distinct !{!25, !16}
|
#include<stdio.h>
void bubble_srt( int a[],int b[], int n );
int main()
{
int n,s;
int sum=0;
int sum1=0;
int sum2=0;
scanf("%d %d",&n,&s);
int floor[1000];
int time [1000];
for(int i=0;i<n;i++)
scanf("%d %d",&floor[i],&time[i]);
bubble_srt(floor,time,n);
sum +=s-floor[0];
if(sum<time[0])
sum=time[0];
for(int i=0;i<n-1;i++)
{
sum1 =floor[i]-floor[i+1];
sum +=sum1;
if(sum<time[i+1])
sum=time[i+1];
}
sum2=floor[n-1]-0;
sum +=sum2;
printf("%d",sum);
return 0;
}
void bubble_srt( int a[],int b[], int n )
{
int i, j,temp,temp1;
for(i = 0; i < n; i++) // Make a pass through the array for each element
{
for(j = 1; j < (n-i); j++) // Go through the array beginning to end
{
if(a[j-1] < a[j]) // If the the first number is greater, swap it
{
temp=a[j-1];
a[j-1]=a[j];
a[j]=temp;
temp1=b[j-1];
b[j-1]=b[j];
b[j]=temp1;
}
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16232/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16232/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%s = alloca i32, align 4
%floor = alloca [1000 x i32], align 16
%time = alloca [1000 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 %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %s)
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %floor) #5
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %time) #5
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp56 = icmp sgt i32 %0, 0
br i1 %cmp56, label %for.body, label %bubble_srt.exit
for.cond.cleanup: ; preds = %for.body
%cmp56.i = icmp sgt i32 %11, 0
br i1 %cmp56.i, label %for.cond1.preheader.i, label %bubble_srt.exit
for.cond1.preheader.i: ; preds = %for.cond.cleanup, %for.inc28.i
%indvars.iv60.i = phi i32 [ %indvars.iv.next61.i, %for.inc28.i ], [ %11, %for.cond.cleanup ]
%i.057.i = phi i32 [ %inc29.i, %for.inc28.i ], [ 0, %for.cond.cleanup ]
%sub.i = sub nsw i32 %11, %i.057.i
%cmp254.i = icmp sgt i32 %sub.i, 1
br i1 %cmp254.i, label %for.body3.preheader.i, label %for.inc28.i
for.body3.preheader.i: ; preds = %for.cond1.preheader.i
%wide.trip.count.i = zext i32 %indvars.iv60.i to i64
%.pre = load i32, ptr %floor, align 16, !tbaa !5
br label %for.body3.i
for.body3.i: ; preds = %for.inc.i, %for.body3.preheader.i
%1 = phi i32 [ %.pre, %for.body3.preheader.i ], [ %6, %for.inc.i ]
%indvars.iv.i = phi i64 [ 1, %for.body3.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%arrayidx6.i = getelementptr inbounds i32, ptr %floor, i64 %indvars.iv.i
%2 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5
%cmp7.i = icmp slt i32 %1, %2
br i1 %cmp7.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%3 = add nsw i64 %indvars.iv.i, -1
%arrayidx.i = getelementptr inbounds i32, ptr %floor, i64 %3
store i32 %2, ptr %arrayidx.i, align 4, !tbaa !5
store i32 %1, ptr %arrayidx6.i, align 4, !tbaa !5
%arrayidx20.i = getelementptr inbounds i32, ptr %time, i64 %3
%4 = load <2 x i32>, ptr %arrayidx20.i, align 4, !tbaa !5
%5 = shufflevector <2 x i32> %4, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
store <2 x i32> %5, ptr %arrayidx20.i, align 4, !tbaa !5
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%6 = phi i32 [ %1, %if.then.i ], [ %2, %for.body3.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %for.inc28.i, label %for.body3.i, !llvm.loop !9
for.inc28.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%inc29.i = add nuw nsw i32 %i.057.i, 1
%indvars.iv.next61.i = add i32 %indvars.iv60.i, -1
%exitcond62.not.i = icmp eq i32 %inc29.i, %11
br i1 %exitcond62.not.i, label %bubble_srt.exit, label %for.cond1.preheader.i, !llvm.loop !11
bubble_srt.exit: ; preds = %for.inc28.i, %entry, %for.cond.cleanup
%.lcssa70 = phi i32 [ %11, %for.cond.cleanup ], [ %0, %entry ], [ %11, %for.inc28.i ]
%7 = load i32, ptr %s, align 4, !tbaa !5
%8 = load i32, ptr %floor, align 16, !tbaa !5
%sub = sub nsw i32 %7, %8
%9 = load i32, ptr %time, align 16, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %sub, i32 %9)
%sub11 = add i32 %.lcssa70, -1
%cmp1258 = icmp sgt i32 %.lcssa70, 1
br i1 %cmp1258, label %for.body14.preheader, label %for.cond.cleanup13
for.body14.preheader: ; preds = %bubble_srt.exit
%wide.trip.count = zext i32 %sub11 to i64
%xtraiter = and i64 %wide.trip.count, 1
%10 = icmp eq i32 %sub11, 1
br i1 %10, label %for.cond.cleanup13.loopexit.unr-lcssa, label %for.body14.preheader.new
for.body14.preheader.new: ; preds = %for.body14.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body14
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %floor, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [1000 x i32], ptr %time, 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
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp = icmp slt i64 %indvars.iv.next, %12
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !12
for.cond.cleanup13.loopexit.unr-lcssa.loopexit: ; preds = %for.body14
%13 = add nuw nsw i64 %indvars.iv65, 3
br label %for.cond.cleanup13.loopexit.unr-lcssa
for.cond.cleanup13.loopexit.unr-lcssa: ; preds = %for.cond.cleanup13.loopexit.unr-lcssa.loopexit, %for.body14.preheader
%spec.select55.lcssa.ph = phi i32 [ undef, %for.body14.preheader ], [ %spec.select55.1, %for.cond.cleanup13.loopexit.unr-lcssa.loopexit ]
%.unr = phi i32 [ %8, %for.body14.preheader ], [ %20, %for.cond.cleanup13.loopexit.unr-lcssa.loopexit ]
%indvars.iv65.unr = phi i64 [ 1, %for.body14.preheader ], [ %13, %for.cond.cleanup13.loopexit.unr-lcssa.loopexit ]
%sum.159.unr = phi i32 [ %spec.select, %for.body14.preheader ], [ %spec.select55.1, %for.cond.cleanup13.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup13, label %for.body14.epil
for.body14.epil: ; preds = %for.cond.cleanup13.loopexit.unr-lcssa
%arrayidx19.epil = getelementptr inbounds [1000 x i32], ptr %floor, i64 0, i64 %indvars.iv65.unr
%14 = load i32, ptr %arrayidx19.epil, align 4, !tbaa !5
%sub20.epil = add i32 %.unr, %sum.159.unr
%add21.epil = sub i32 %sub20.epil, %14
%arrayidx24.epil = getelementptr inbounds [1000 x i32], ptr %time, i64 0, i64 %indvars.iv65.unr
%15 = load i32, ptr %arrayidx24.epil, align 4, !tbaa !5
%spec.select55.epil = call i32 @llvm.smax.i32(i32 %add21.epil, i32 %15)
br label %for.cond.cleanup13
for.cond.cleanup13: ; preds = %for.body14.epil, %for.cond.cleanup13.loopexit.unr-lcssa, %bubble_srt.exit
%sum.1.lcssa = phi i32 [ %spec.select, %bubble_srt.exit ], [ %spec.select55.lcssa.ph, %for.cond.cleanup13.loopexit.unr-lcssa ], [ %spec.select55.epil, %for.body14.epil ]
%idxprom35 = sext i32 %sub11 to i64
%arrayidx36 = getelementptr inbounds [1000 x i32], ptr %floor, i64 0, i64 %idxprom35
%16 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%add38 = add nsw i32 %16, %sum.1.lcssa
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add38)
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %time) #5
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %floor) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body14: ; preds = %for.body14, %for.body14.preheader.new
%17 = phi i32 [ %8, %for.body14.preheader.new ], [ %20, %for.body14 ]
%indvars.iv65 = phi i64 [ 0, %for.body14.preheader.new ], [ %indvars.iv.next66.1, %for.body14 ]
%sum.159 = phi i32 [ %spec.select, %for.body14.preheader.new ], [ %spec.select55.1, %for.body14 ]
%niter = phi i64 [ 0, %for.body14.preheader.new ], [ %niter.next.1, %for.body14 ]
%indvars.iv.next66 = or i64 %indvars.iv65, 1
%arrayidx19 = getelementptr inbounds [1000 x i32], ptr %floor, i64 0, i64 %indvars.iv.next66
%18 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%sub20 = add i32 %17, %sum.159
%add21 = sub i32 %sub20, %18
%arrayidx24 = getelementptr inbounds [1000 x i32], ptr %time, i64 0, i64 %indvars.iv.next66
%19 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%spec.select55 = call i32 @llvm.smax.i32(i32 %add21, i32 %19)
%indvars.iv.next66.1 = add nuw nsw i64 %indvars.iv65, 2
%arrayidx19.1 = getelementptr inbounds [1000 x i32], ptr %floor, i64 0, i64 %indvars.iv.next66.1
%20 = load i32, ptr %arrayidx19.1, align 8, !tbaa !5
%sub20.1 = add i32 %18, %spec.select55
%add21.1 = sub i32 %sub20.1, %20
%arrayidx24.1 = getelementptr inbounds [1000 x i32], ptr %time, i64 0, i64 %indvars.iv.next66.1
%21 = load i32, ptr %arrayidx24.1, align 8, !tbaa !5
%spec.select55.1 = call i32 @llvm.smax.i32(i32 %add21.1, i32 %21)
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup13.loopexit.unr-lcssa.loopexit, label %for.body14, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @bubble_srt(ptr nocapture noundef %a, ptr nocapture noundef %b, i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp56 = icmp sgt i32 %n, 0
br i1 %cmp56, label %for.cond1.preheader, label %for.end30
for.cond1.preheader: ; preds = %entry, %for.inc28
%indvars.iv60 = phi i32 [ %indvars.iv.next61, %for.inc28 ], [ %n, %entry ]
%i.057 = phi i32 [ %inc29, %for.inc28 ], [ 0, %entry ]
%sub = sub nsw i32 %n, %i.057
%cmp254 = icmp sgt i32 %sub, 1
br i1 %cmp254, label %for.body3.preheader, label %for.inc28
for.body3.preheader: ; preds = %for.cond1.preheader
%wide.trip.count = zext i32 %indvars.iv60 to i64
br label %for.body3
for.body3: ; preds = %for.body3.preheader, %for.inc
%indvars.iv = phi i64 [ 1, %for.body3.preheader ], [ %indvars.iv.next, %for.inc ]
%0 = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %0
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx6 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp slt i32 %1, %2
br i1 %cmp7, label %if.then, label %for.inc
if.then: ; preds = %for.body3
store i32 %2, ptr %arrayidx, align 4, !tbaa !5
store i32 %1, ptr %arrayidx6, align 4, !tbaa !5
%arrayidx20 = getelementptr inbounds i32, ptr %b, i64 %0
%3 = load <2 x i32>, ptr %arrayidx20, align 4, !tbaa !5
%4 = shufflevector <2 x i32> %3, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
store <2 x i32> %4, ptr %arrayidx20, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body3, %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.inc28, label %for.body3, !llvm.loop !9
for.inc28: ; preds = %for.inc, %for.cond1.preheader
%inc29 = add nuw nsw i32 %i.057, 1
%indvars.iv.next61 = add i32 %indvars.iv60, -1
%exitcond62.not = icmp eq i32 %inc29, %n
br i1 %exitcond62.not, label %for.end30, label %for.cond1.preheader, !llvm.loop !11
for.end30: ; preds = %for.inc28, %entry
ret void
}
; 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 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
long long A, B, C, D, max;
scanf("%lld%lld%lld", &A, &B, &C);
if ((A>=B && B>=C) || (A>=C && C>=B)) D = B*C*(A%2);
else if ((A>=B && C>=A) || (A<=B && B<=C)) D = A*B*(C%2);
else if ((B>=A && A>=C) || (B>=C && C>=A)) D = C*A*(B%2);
printf("%lld\n", D);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162363/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162363/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%lld%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i64, align 8
%B = alloca i64, align 8
%C = 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C)
%0 = load i64, ptr %A, align 8
%1 = load i64, ptr %B, align 8
%cmp.not = icmp slt i64 %0, %1
%2 = load i64, ptr %C, align 8
%cmp1.not = icmp slt i64 %1, %2
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp1.not
br i1 %or.cond, label %lor.lhs.false, label %if.then
lor.lhs.false: ; preds = %entry
%cmp2.not = icmp slt i64 %0, %2
%cmp4.not = icmp slt i64 %2, %1
%or.cond37 = or i1 %cmp2.not, %cmp4.not
br i1 %or.cond37, label %if.else, label %if.then
if.then: ; preds = %lor.lhs.false, %entry
%rem = srem i64 %0, 2
%mul = mul i64 %rem, %1
%mul5 = mul i64 %mul, %2
br label %if.end30
if.else: ; preds = %lor.lhs.false
%cmp8.not = icmp slt i64 %2, %0
%or.cond38 = select i1 %cmp.not, i1 true, i1 %cmp8.not
br i1 %or.cond38, label %lor.lhs.false9, label %if.then13
lor.lhs.false9: ; preds = %if.else
%cmp10.not = icmp sgt i64 %0, %1
%or.cond39 = or i1 %cmp10.not, %cmp4.not
br i1 %or.cond39, label %if.else17, label %if.then13
if.then13: ; preds = %lor.lhs.false9, %if.else
%mul14 = mul nsw i64 %1, %0
%rem15 = srem i64 %2, 2
%mul16 = mul nsw i64 %mul14, %rem15
br label %if.end30
if.else17: ; preds = %lor.lhs.false9
%or.cond40 = or i1 %cmp10.not, %cmp2.not
br i1 %or.cond40, label %lor.lhs.false21, label %if.then25
lor.lhs.false21: ; preds = %if.else17
%3 = xor i1 %cmp1.not, true
call void @llvm.assume(i1 %3)
%4 = xor i1 %cmp8.not, true
call void @llvm.assume(i1 %4)
br label %if.then25
if.then25: ; preds = %lor.lhs.false21, %if.else17
%mul26 = mul nsw i64 %2, %0
%rem27 = srem i64 %1, 2
%mul28 = mul nsw i64 %mul26, %rem27
br label %if.end30
if.end30: ; preds = %if.then13, %if.then25, %if.then
%D.0 = phi i64 [ %mul5, %if.then ], [ %mul16, %if.then13 ], [ %mul28, %if.then25 ]
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %D.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %C) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #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 willreturn memory(inaccessiblemem: 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)"}
|
#include<stdio.h>
int main(void) {
int H,W,i,j;
while(1){
scanf("%d %d",&H,&W);
if(H==0&&W==0) break;
for(i=0;i<H;i++){
if(i==0||i==(H-1))
for(j=0;j<W;j++)
printf("#");
else{
printf("#");
for(j=1;j<(W-1);j++)
printf(".");
printf("#");
}
printf("\n");
}
printf("\n");
}
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162413/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162413/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%0 = load i32, ptr %H, align 4, !tbaa !5
%cmp46 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp147 = icmp eq i32 %1, 0
%or.cond48 = select i1 %cmp46, i1 %cmp147, i1 false
br i1 %or.cond48, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end24
%2 = phi i32 [ %9, %for.end24 ], [ %0, %entry ]
%cmp243 = icmp sgt i32 %2, 0
br i1 %cmp243, label %for.body, label %for.end24
for.body: ; preds = %for.cond.preheader, %if.end20
%3 = phi i32 [ %8, %if.end20 ], [ %2, %for.cond.preheader ]
%i.044 = phi i32 [ %inc23, %if.end20 ], [ 0, %for.cond.preheader ]
%cmp3 = icmp eq i32 %i.044, 0
%sub = add nsw i32 %3, -1
%cmp4 = icmp eq i32 %i.044, %sub
%or.cond37 = select i1 %cmp3, i1 true, i1 %cmp4
br i1 %or.cond37, label %for.cond6.preheader, label %if.else
for.cond6.preheader: ; preds = %for.body
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp741 = icmp sgt i32 %4, 0
br i1 %cmp741, label %for.body8, label %if.end20
for.body8: ; preds = %for.cond6.preheader, %for.body8
%j.042 = phi i32 [ %inc, %for.body8 ], [ 0, %for.cond6.preheader ]
%putchar36 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %j.042, 1
%5 = load i32, ptr %W, align 4, !tbaa !5
%cmp7 = icmp slt i32 %inc, %5
br i1 %cmp7, label %for.body8, label %if.end20, !llvm.loop !9
if.else: ; preds = %for.body
%putchar32 = call i32 @putchar(i32 35)
%6 = load i32, ptr %W, align 4, !tbaa !5
%cmp1339 = icmp sgt i32 %6, 2
br i1 %cmp1339, label %for.body14, label %for.end18
for.body14: ; preds = %if.else, %for.body14
%j.140 = phi i32 [ %inc17, %for.body14 ], [ 1, %if.else ]
%putchar34 = call i32 @putchar(i32 46)
%inc17 = add nuw nsw i32 %j.140, 1
%7 = load i32, ptr %W, align 4, !tbaa !5
%sub12 = add nsw i32 %7, -1
%cmp13 = icmp slt i32 %inc17, %sub12
br i1 %cmp13, label %for.body14, label %for.end18, !llvm.loop !11
for.end18: ; preds = %for.body14, %if.else
%putchar33 = call i32 @putchar(i32 35)
br label %if.end20
if.end20: ; preds = %for.body8, %for.cond6.preheader, %for.end18
%putchar35 = call i32 @putchar(i32 10)
%inc23 = add nuw nsw i32 %i.044, 1
%8 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc23, %8
br i1 %cmp2, label %for.body, label %for.end24, !llvm.loop !12
for.end24: ; preds = %if.end20, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%9 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end24, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void)
{
int h;
int w;
int i;
int j;
while (1){
scanf("%d %d", &h, &w);
if (h == 0 && w == 0){
break;
}
for (i = 0; i < w; i++){
printf("#");
}
printf("\n");
for (i = 0; i < h - 2; i++){
printf("#");
for (j = 0; j < w - 2; j++){
printf(".");
}
printf("#\n");
}
for (i = 0; i < w; i++){
printf("#");
}
printf("\n\n");
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162507/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162507/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@str.6 = private unnamed_addr constant [2 x i8] c"#\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp51 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp152 = icmp eq i32 %1, 0
%or.cond53 = select i1 %cmp51, i1 %cmp152, i1 false
br i1 %or.cond53, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end27
%2 = phi i32 [ %11, %for.end27 ], [ %1, %entry ]
%cmp240 = icmp sgt i32 %2, 0
br i1 %cmp240, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.body
%i.041 = phi i32 [ %inc, %for.body ], [ 0, %for.cond.preheader ]
%putchar39 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %i.041, 1
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc, %3
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%4 = load i32, ptr %h, align 4, !tbaa !5
%cmp646 = icmp sgt i32 %4, 2
br i1 %cmp646, label %for.body7, label %for.cond21.preheader
for.cond21.preheader: ; preds = %for.end16, %for.end
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp2248 = icmp sgt i32 %5, 0
br i1 %cmp2248, label %for.body23, label %for.end27
for.body7: ; preds = %for.end, %for.end16
%i.147 = phi i32 [ %inc19, %for.end16 ], [ 0, %for.end ]
%putchar36 = call i32 @putchar(i32 35)
%6 = load i32, ptr %w, align 4, !tbaa !5
%cmp1143 = icmp sgt i32 %6, 2
br i1 %cmp1143, label %for.body12, label %for.end16
for.body12: ; preds = %for.body7, %for.body12
%j.044 = phi i32 [ %inc15, %for.body12 ], [ 0, %for.body7 ]
%putchar38 = call i32 @putchar(i32 46)
%inc15 = add nuw nsw i32 %j.044, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%sub10 = add nsw i32 %7, -2
%cmp11 = icmp slt i32 %inc15, %sub10
br i1 %cmp11, label %for.body12, label %for.end16, !llvm.loop !11
for.end16: ; preds = %for.body12, %for.body7
%puts37 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%inc19 = add nuw nsw i32 %i.147, 1
%8 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %8, -2
%cmp6 = icmp slt i32 %inc19, %sub
br i1 %cmp6, label %for.body7, label %for.cond21.preheader, !llvm.loop !12
for.body23: ; preds = %for.cond21.preheader, %for.body23
%i.249 = phi i32 [ %inc26, %for.body23 ], [ 0, %for.cond21.preheader ]
%putchar35 = call i32 @putchar(i32 35)
%inc26 = add nuw nsw i32 %i.249, 1
%9 = load i32, ptr %w, align 4, !tbaa !5
%cmp22 = icmp slt i32 %inc26, %9
br i1 %cmp22, label %for.body23, label %for.end27, !llvm.loop !13
for.end27: ; preds = %for.body23, %for.cond21.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%10 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %10, 0
%11 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %11, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end27, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <string.h>
void print_frame(int h, int w) {
char line[w];
line[w-1] = '\0';
memset(line, '#', w-1);
printf("%s\n", line);
memset(line + 1, '.', w-3);
while (h--) {
printf("%s\n", line);
}
memset(line, '#', w-1);
printf("%s\n", line);
}
int main() {
int h, w;
scanf("%d %d", &h, &w);
while (h != 0 || w != 0) {
print_frame(h - 2, w + 1);
printf("\n");
scanf("%d %d", &h, &w);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162558/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162558/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @print_frame(i32 noundef %h, i32 noundef %w) local_unnamed_addr #0 {
entry:
%0 = zext i32 %w to i64
%vla = alloca i8, i64 %0, align 16
%sub = add nsw i32 %w, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %idxprom
store i8 0, ptr %arrayidx, align 1, !tbaa !5
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla, i8 35, i64 %idxprom, i1 false)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %vla)
%add.ptr = getelementptr inbounds i8, ptr %vla, i64 1
%sub2 = add nsw i32 %w, -3
%conv3 = sext i32 %sub2 to i64
call void @llvm.memset.p0.i64(ptr nonnull align 1 %add.ptr, i8 46, i64 %conv3, i1 false)
%tobool.not14 = icmp eq i32 %h, 0
br i1 %tobool.not14, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%h.addr.015 = phi i32 [ %dec, %while.body ], [ %h, %entry ]
%dec = add nsw i32 %h.addr.015, -1
%puts13 = call i32 @puts(ptr nonnull dereferenceable(1) %vla)
%tobool.not = icmp eq i32 %dec, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !8
while.end: ; preds = %while.body, %entry
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla, i8 35, i64 %idxprom, i1 false)
%puts12 = call i32 @puts(ptr nonnull dereferenceable(1) %vla)
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !10
%cmp4 = icmp ne i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp15 = icmp ne i32 %1, 0
%2 = select i1 %cmp4, i1 true, i1 %cmp15
br i1 %2, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%3 = phi i32 [ %6, %while.body ], [ %1, %entry ]
%4 = phi i32 [ %5, %while.body ], [ %0, %entry ]
%sub = add nsw i32 %4, -2
%add = add nsw i32 %3, 1
call void @print_frame(i32 noundef %sub, i32 noundef %add)
%putchar = call i32 @putchar(i32 10)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h, ptr noundef nonnull %w)
%5 = load i32, ptr %h, align 4, !tbaa !10
%cmp = icmp ne i32 %5, 0
%6 = load i32, ptr %w, align 4
%cmp1 = icmp ne i32 %6, 0
%7 = select i1 %cmp, i1 true, i1 %cmp1
br i1 %7, label %while.body, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; 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 nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = distinct !{!12, !9}
|
#include <stdio.h>
int main(void)
{
int w, h;
int i, n;
while (1){
scanf("%d %d", &h, &w);
if (h == 0 && w == 0){
break;
}
for (i = 0; i < h; i++){
printf("#");
for (n = 0; n < w-2; n++){
if(i == 0 || i == h-1){
printf("#");
}
else{
printf(".");
}
}
printf("#\n");
}
printf("\n");
}
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162600/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162600/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"#\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%w = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
%call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp33 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp134 = icmp eq i32 %1, 0
%or.cond35 = select i1 %cmp33, i1 %cmp134, i1 false
br i1 %or.cond35, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end17
%2 = phi i32 [ %8, %for.end17 ], [ %0, %entry ]
%cmp229 = icmp sgt i32 %2, 0
br i1 %cmp229, label %for.body, label %for.end17
for.body: ; preds = %for.cond.preheader, %for.end
%i.030 = phi i32 [ %inc16, %for.end ], [ 0, %for.cond.preheader ]
%putchar23 = call i32 @putchar(i32 35)
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp527 = icmp sgt i32 %3, 2
br i1 %cmp527, label %for.body6.lr.ph, label %for.end
for.body6.lr.ph: ; preds = %for.body
%cmp7 = icmp eq i32 %i.030, 0
br i1 %cmp7, label %for.body6.us, label %for.body6
for.body6.us: ; preds = %for.body6.lr.ph, %for.body6.us
%n.028.us = phi i32 [ %inc.us, %for.body6.us ], [ 0, %for.body6.lr.ph ]
%putchar25.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %n.028.us, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%sub.us = add nsw i32 %4, -2
%cmp5.us = icmp slt i32 %inc.us, %sub.us
br i1 %cmp5.us, label %for.body6.us, label %for.end, !llvm.loop !9
for.body6: ; preds = %for.body6.lr.ph, %for.body6
%n.028 = phi i32 [ %inc, %for.body6 ], [ 0, %for.body6.lr.ph ]
%5 = load i32, ptr %h, align 4, !tbaa !5
%sub8 = add nsw i32 %5, -1
%cmp9 = icmp eq i32 %i.030, %sub8
%. = select i1 %cmp9, i32 35, i32 46
%putchar25 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %n.028, 1
%6 = load i32, ptr %w, align 4, !tbaa !5
%sub = add nsw i32 %6, -2
%cmp5 = icmp slt i32 %inc, %sub
br i1 %cmp5, label %for.body6, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body6, %for.body6.us, %for.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%inc16 = add nuw nsw i32 %i.030, 1
%7 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc16, %7
br i1 %cmp2, label %for.body, label %for.end17, !llvm.loop !11
for.end17: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%8 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %8, 0
%9 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %9, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end17, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; 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>
void print_frame(int height, int width) {
int i, j;
for(j = 0; j < width; j++) {
printf("#");
}
putchar('\n');
for(i = 0; i < height - 2; i++) {
putchar('#');
for(j = 0; j < width - 2; j++) {
putchar('.');
}
printf("#\n");
}
for(j = 0; j < width; j++) {
printf("#");
}
printf("\n\n");
}
int main(void) {
int h, w;
while(1) {
scanf("%d %d", &h, &w);
if(h == 0 && w == 0)
break;
else {
print_frame(h, w);
}
}
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162659/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162659/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.3 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
@str = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@str.4 = private unnamed_addr constant [2 x i8] c"#\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @print_frame(i32 noundef %height, i32 noundef %width) local_unnamed_addr #0 {
entry:
%cmp40 = icmp sgt i32 %width, 0
br i1 %cmp40, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%j.041 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%0 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i = tail call noundef i32 @putc(i32 noundef 35, ptr noundef %0)
%inc = add nuw nsw i32 %j.041, 1
%exitcond.not = icmp eq i32 %inc, %width
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%1 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i36 = tail call noundef i32 @putc(i32 noundef 10, ptr noundef %1)
%sub = add i32 %height, -2
%cmp344 = icmp sgt i32 %height, 2
br i1 %cmp344, label %for.body4.lr.ph, label %for.cond18.preheader
for.body4.lr.ph: ; preds = %for.end
%cmp842 = icmp sgt i32 %width, 2
br i1 %cmp842, label %for.body4.us.preheader, label %for.body4
for.body4.us.preheader: ; preds = %for.body4.lr.ph
%2 = add i32 %width, -3
br label %for.body4.us
for.body4.us: ; preds = %for.body4.us.preheader, %for.cond6.for.end13_crit_edge.us
%i.045.us = phi i32 [ %inc16.us, %for.cond6.for.end13_crit_edge.us ], [ 0, %for.body4.us.preheader ]
%3 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i37.us = tail call noundef i32 @putc(i32 noundef 35, ptr noundef %3)
br label %for.body9.us
for.body9.us: ; preds = %for.body4.us, %for.body9.us
%j.143.us = phi i32 [ 0, %for.body4.us ], [ %inc12.us, %for.body9.us ]
%4 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i38.us = tail call noundef i32 @putc(i32 noundef 46, ptr noundef %4)
%inc12.us = add nuw nsw i32 %j.143.us, 1
%exitcond50.not = icmp eq i32 %j.143.us, %2
br i1 %exitcond50.not, label %for.cond6.for.end13_crit_edge.us, label %for.body9.us, !llvm.loop !11
for.cond6.for.end13_crit_edge.us: ; preds = %for.body9.us
%puts34.us = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
%inc16.us = add nuw nsw i32 %i.045.us, 1
%exitcond51.not = icmp eq i32 %inc16.us, %sub
br i1 %exitcond51.not, label %for.cond18.preheader, label %for.body4.us, !llvm.loop !12
for.cond18.preheader: ; preds = %for.body4, %for.cond6.for.end13_crit_edge.us, %for.end
br i1 %cmp40, label %for.body20, label %for.end24
for.body4: ; preds = %for.body4.lr.ph, %for.body4
%i.045 = phi i32 [ %inc16, %for.body4 ], [ 0, %for.body4.lr.ph ]
%5 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i37 = tail call noundef i32 @putc(i32 noundef 35, ptr noundef %5)
%puts34 = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
%inc16 = add nuw nsw i32 %i.045, 1
%exitcond49.not = icmp eq i32 %inc16, %sub
br i1 %exitcond49.not, label %for.cond18.preheader, label %for.body4, !llvm.loop !12
for.body20: ; preds = %for.cond18.preheader, %for.body20
%j.247 = phi i32 [ %inc23, %for.body20 ], [ 0, %for.cond18.preheader ]
%6 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i39 = tail call noundef i32 @putc(i32 noundef 35, ptr noundef %6)
%inc23 = add nuw nsw i32 %j.247, 1
%exitcond52.not = icmp eq i32 %inc23, %width
br i1 %exitcond52.not, label %for.end24, label %for.body20, !llvm.loop !13
for.end24: ; preds = %for.body20, %for.cond18.preheader
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
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 #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !14
%cmp3 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp14 = icmp eq i32 %1, 0
%or.cond5 = select i1 %cmp3, i1 %cmp14, i1 false
br i1 %or.cond5, label %while.end, label %if.else
if.else: ; preds = %entry, %if.else
%2 = phi i32 [ %5, %if.else ], [ %1, %entry ]
%3 = phi i32 [ %4, %if.else ], [ %0, %entry ]
call void @print_frame(i32 noundef %3, i32 noundef %2)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %h, ptr noundef nonnull %w)
%4 = load i32, ptr %h, align 4, !tbaa !14
%cmp = icmp eq i32 %4, 0
%5 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %5, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %if.else
while.end: ; preds = %if.else, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
|
#include <stdio.h>
int main(void){
int h,w;
int i,j;
while(scanf("%d %d", &h, &w)!=EOF && (h!=0 || w!=0)){
for(i=0;i<w;i++)printf("#");
printf("\n");
for(i=0;i<h-2;i++){
printf("#");
for(j=0;j<w-2;j++)printf(".");
printf("#\n");
}
for(i=0;i<w;i++)printf("#");
printf("\n\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162716/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162716/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@str.6 = private unnamed_addr constant [2 x i8] c"#\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%cmp.not52 = icmp eq i32 %call51, -1
br i1 %cmp.not52, label %while.end, label %land.rhs
land.rhs: ; preds = %entry, %for.end28
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp1 = icmp ne i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp2 = icmp ne i32 %1, 0
%2 = select i1 %cmp1, i1 true, i1 %cmp2
br i1 %2, label %for.cond.preheader, label %while.end
for.cond.preheader: ; preds = %land.rhs
%cmp341 = icmp sgt i32 %1, 0
br i1 %cmp341, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.body
%i.042 = phi i32 [ %inc, %for.body ], [ 0, %for.cond.preheader ]
%putchar40 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %i.042, 1
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc, %3
br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%4 = load i32, ptr %h, align 4, !tbaa !5
%cmp747 = icmp sgt i32 %4, 2
br i1 %cmp747, label %for.body8, label %for.cond22.preheader
for.cond22.preheader: ; preds = %for.end17, %for.end
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp2349 = icmp sgt i32 %5, 0
br i1 %cmp2349, label %for.body24, label %for.end28
for.body8: ; preds = %for.end, %for.end17
%i.148 = phi i32 [ %inc20, %for.end17 ], [ 0, %for.end ]
%putchar37 = call i32 @putchar(i32 35)
%6 = load i32, ptr %w, align 4, !tbaa !5
%cmp1244 = icmp sgt i32 %6, 2
br i1 %cmp1244, label %for.body13, label %for.end17
for.body13: ; preds = %for.body8, %for.body13
%j.045 = phi i32 [ %inc16, %for.body13 ], [ 0, %for.body8 ]
%putchar39 = call i32 @putchar(i32 46)
%inc16 = add nuw nsw i32 %j.045, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%sub11 = add nsw i32 %7, -2
%cmp12 = icmp slt i32 %inc16, %sub11
br i1 %cmp12, label %for.body13, label %for.end17, !llvm.loop !11
for.end17: ; preds = %for.body13, %for.body8
%puts38 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%inc20 = add nuw nsw i32 %i.148, 1
%8 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %8, -2
%cmp7 = icmp slt i32 %inc20, %sub
br i1 %cmp7, label %for.body8, label %for.cond22.preheader, !llvm.loop !12
for.body24: ; preds = %for.cond22.preheader, %for.body24
%i.250 = phi i32 [ %inc27, %for.body24 ], [ 0, %for.cond22.preheader ]
%putchar36 = call i32 @putchar(i32 35)
%inc27 = add nuw nsw i32 %i.250, 1
%9 = load i32, ptr %w, align 4, !tbaa !5
%cmp23 = icmp slt i32 %inc27, %9
br i1 %cmp23, label %for.body24, label %for.end28, !llvm.loop !13
for.end28: ; preds = %for.body24, %for.cond22.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !14
while.end: ; preds = %land.rhs, %for.end28, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#define MAX 1000000
#define sqrtMAX 1000
int main(void)
{
int n;
int b[MAX+1] = {0};
int i, j;
// ツエツδ可トツスツテツネツスツづ個づ督づゥツつ「
b[0] = 1;
b[1] = 1;
for(i=4; i<=MAX; i+=2)
b[i] = 1;
for(i=3; i<=sqrtMAX; i+=2)
for(j=i+i; j<=MAX; j+=i)
b[j] = 1;
while(scanf("%d", &n)!=EOF) {
for(i=n-1; i>=2; i--) {
if(b[i]==0) {
printf("%d", i);
break;
}
}
for(i=n+1; i<=MAX; i++) {
if(b[i]==0) {
printf(" %d\n", i);
break;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162774/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162774/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%b = alloca [1000001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4000004, ptr nonnull %b) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000004) %b, i8 0, i64 4000004, i1 false)
store i32 1, ptr %b, align 16, !tbaa !5
%arrayidx1 = getelementptr inbounds [1000001 x i32], ptr %b, i64 0, i64 1
store i32 1, ptr %arrayidx1, align 4, !tbaa !5
br label %for.body
for.body: ; preds = %for.body.7, %entry
%indvars.iv = phi i64 [ 4, %entry ], [ %indvars.iv.next.7, %for.body.7 ]
%arrayidx2 = getelementptr inbounds [1000001 x i32], ptr %b, i64 0, i64 %indvars.iv
store i32 1, ptr %arrayidx2, align 16, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 2
%arrayidx2.1 = getelementptr inbounds [1000001 x i32], ptr %b, i64 0, i64 %indvars.iv.next
store i32 1, ptr %arrayidx2.1, align 8, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 4
%arrayidx2.2 = getelementptr inbounds [1000001 x i32], ptr %b, i64 0, i64 %indvars.iv.next.1
store i32 1, ptr %arrayidx2.2, align 16, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 6
%arrayidx2.3 = getelementptr inbounds [1000001 x i32], ptr %b, i64 0, i64 %indvars.iv.next.2
store i32 1, ptr %arrayidx2.3, align 8, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 8
%arrayidx2.4 = getelementptr inbounds [1000001 x i32], ptr %b, i64 0, i64 %indvars.iv.next.3
store i32 1, ptr %arrayidx2.4, align 16, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 10
%arrayidx2.5 = getelementptr inbounds [1000001 x i32], ptr %b, i64 0, i64 %indvars.iv.next.4
store i32 1, ptr %arrayidx2.5, align 8, !tbaa !5
%indvars.iv.next.5 = add nuw nsw i64 %indvars.iv, 12
%arrayidx2.6 = getelementptr inbounds [1000001 x i32], ptr %b, i64 0, i64 %indvars.iv.next.5
store i32 1, ptr %arrayidx2.6, align 16, !tbaa !5
%cmp.6 = icmp ult i64 %indvars.iv, 999987
br i1 %cmp.6, label %for.body.7, label %for.body9.preheader, !llvm.loop !9
for.body.7: ; preds = %for.body
%indvars.iv.next.6 = add nuw nsw i64 %indvars.iv, 14
%arrayidx2.7 = getelementptr inbounds [1000001 x i32], ptr %b, i64 0, i64 %indvars.iv.next.6
store i32 1, ptr %arrayidx2.7, align 8, !tbaa !5
%indvars.iv.next.7 = add nuw nsw i64 %indvars.iv, 16
br label %for.body
while.cond.preheader: ; preds = %for.inc15
%call63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp18.not64 = icmp eq i32 %call63, -1
br i1 %cmp18.not64, label %while.end, label %while.body
for.body9.preheader: ; preds = %for.body, %for.inc15.1
%indvars.iv68 = phi i64 [ %indvars.iv.next69.1, %for.inc15.1 ], [ 3, %for.body ]
%indvars.iv66 = phi i64 [ %indvars.iv.next67.1, %for.inc15.1 ], [ 6, %for.body ]
br label %for.body9
for.body9: ; preds = %for.body9.preheader, %for.body9
%indvars.iv70 = phi i64 [ %indvars.iv66, %for.body9.preheader ], [ %indvars.iv.next71, %for.body9 ]
%arrayidx11 = getelementptr inbounds [1000001 x i32], ptr %b, i64 0, i64 %indvars.iv70
store i32 1, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, %indvars.iv68
%cmp8 = icmp ult i64 %indvars.iv.next71, 1000001
br i1 %cmp8, label %for.body9, label %for.inc15, !llvm.loop !11
for.inc15: ; preds = %for.body9
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 2
%0 = icmp ult i64 %indvars.iv68, 999
br i1 %0, label %for.body9.preheader.1, label %while.cond.preheader, !llvm.loop !12
for.body9.preheader.1: ; preds = %for.inc15
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 4
br label %for.body9.1
for.body9.1: ; preds = %for.body9.1, %for.body9.preheader.1
%indvars.iv70.1 = phi i64 [ %indvars.iv.next67, %for.body9.preheader.1 ], [ %indvars.iv.next71.1, %for.body9.1 ]
%arrayidx11.1 = getelementptr inbounds [1000001 x i32], ptr %b, i64 0, i64 %indvars.iv70.1
store i32 1, 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, 1000001
br i1 %cmp8.1, label %for.body9.1, label %for.inc15.1, !llvm.loop !11
for.inc15.1: ; preds = %for.body9.1
%indvars.iv.next69.1 = add nuw nsw i64 %indvars.iv68, 4
%indvars.iv.next67.1 = add nuw nsw i64 %indvars.iv66, 8
br label %for.body9.preheader
while.body: ; preds = %while.cond.preheader, %for.end39
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = zext i32 %1 to i64
br label %for.cond19
for.cond19: ; preds = %for.body21, %while.body
%indvars.iv74 = phi i64 [ %4, %for.body21 ], [ %2, %while.body ]
%3 = trunc i64 %indvars.iv74 to i32
%cmp20 = icmp sgt i32 %3, 2
br i1 %cmp20, label %for.body21, label %for.end27
for.body21: ; preds = %for.cond19
%4 = add nsw i64 %indvars.iv74, -1
%arrayidx23 = getelementptr inbounds [1000001 x i32], ptr %b, i64 0, i64 %4
%5 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24 = icmp eq i32 %5, 0
br i1 %cmp24, label %if.then, label %for.cond19, !llvm.loop !13
if.then: ; preds = %for.body21
%6 = trunc i64 %4 to i32
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.end27
for.end27: ; preds = %for.cond19, %if.then
%7 = phi i32 [ %.pre, %if.then ], [ %1, %for.cond19 ]
%8 = sext i32 %7 to i64
%smax = call i32 @llvm.smax.i32(i32 %7, i32 1000000)
%wide.trip.count = zext i32 %smax to i64
br label %for.cond29
for.cond29: ; preds = %for.body31, %for.end27
%indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body31 ], [ %8, %for.end27 ]
%exitcond.not = icmp eq i64 %indvars.iv78, %wide.trip.count
br i1 %exitcond.not, label %for.end39, label %for.body31
for.body31: ; preds = %for.cond29
%indvars.iv.next79 = add nsw i64 %indvars.iv78, 1
%arrayidx33 = getelementptr inbounds [1000001 x i32], ptr %b, i64 0, i64 %indvars.iv.next79
%9 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34 = icmp eq i32 %9, 0
br i1 %cmp34, label %if.then35, label %for.cond29, !llvm.loop !14
if.then35: ; preds = %for.body31
%10 = trunc i64 %indvars.iv.next79 to i32
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10)
br label %for.end39
for.end39: ; preds = %for.cond29, %if.then35
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp18.not = icmp eq i32 %call, -1
br i1 %cmp18.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %for.end39, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 4000004, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#define MAX_NUM (50030)
void enum_prime(char list[]) {
int i, j;
list[0] = list[1] = 0;
for (i = 2; i < MAX_NUM; i++) {
list[i] = 1;
}
for (i = 2; i < MAX_NUM; i++) {
if (list[i] == 0)
continue;
for (j = i + i; j < MAX_NUM; j += i) {
list[j] = 0;
}
if (MAX_NUM < i * i)
break;
}
}
int main() {
int i, n, under, upper;
char prime_list[MAX_NUM];
enum_prime(prime_list);
while (scanf("%d ", &n) != EOF) {
for (i = 0; i < MAX_NUM; i++) {
if (prime_list[i] && n < i) {
upper = i;
break;
}
if (prime_list[i] && i < n) {
under = i;
}
}
printf("%d %d\n", under, upper);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162824/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162824/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 \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 @enum_prime(ptr nocapture noundef %list) local_unnamed_addr #0 {
entry:
%arrayidx = getelementptr inbounds i8, ptr %list, i64 1
store i8 0, ptr %arrayidx, align 1, !tbaa !5
store i8 0, ptr %list, align 1, !tbaa !5
%scevgep = getelementptr i8, ptr %list, i64 2
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50028) %scevgep, i8 1, i64 50028, i1 false), !tbaa !5
br label %for.body5
for.body5: ; preds = %for.body5.backedge, %entry
%0 = phi i8 [ 1, %entry ], [ %.pre, %for.body5.backedge ]
%i.145 = phi i32 [ 2, %entry ], [ %i.145.be, %for.body5.backedge ]
%idxprom6 = zext i32 %i.145 to i64
%cmp8 = icmp eq i8 %0, 0
br i1 %cmp8, label %for.inc23, label %if.end
if.end: ; preds = %for.body5
%cmp1143 = icmp ult i32 %i.145, 25015
br i1 %cmp1143, label %for.body13.preheader, label %for.end18
for.body13.preheader: ; preds = %if.end
%add = shl nuw nsw i32 %i.145, 1
%1 = zext i32 %add to i64
br label %for.body13
for.body13: ; preds = %for.body13.preheader, %for.body13
%indvars.iv = phi i64 [ %1, %for.body13.preheader ], [ %indvars.iv.next, %for.body13 ]
%arrayidx15 = getelementptr inbounds i8, ptr %list, i64 %indvars.iv
store i8 0, ptr %arrayidx15, align 1, !tbaa !5
%indvars.iv.next = add i64 %indvars.iv, %idxprom6
%cmp11 = icmp ult i64 %indvars.iv.next, 50030
br i1 %cmp11, label %for.body13, label %for.end18, !llvm.loop !8
for.end18: ; preds = %for.body13, %if.end
%mul = mul nsw i32 %i.145, %i.145
%cmp19 = icmp ult i32 %mul, 50031
%cmp4 = icmp ult i32 %i.145, 50029
%or.cond = and i1 %cmp19, %cmp4
br i1 %or.cond, label %for.body5.backedge, label %for.end25
for.inc23: ; preds = %for.body5
%cmp4.old = icmp ult i32 %i.145, 50029
br i1 %cmp4.old, label %for.body5.backedge, label %for.end25
for.body5.backedge: ; preds = %for.inc23, %for.end18
%i.145.be = add nuw nsw i32 %i.145, 1
%idxprom6.phi.trans.insert = zext i32 %i.145.be to i64
%arrayidx7.phi.trans.insert = getelementptr inbounds i8, ptr %list, i64 %idxprom6.phi.trans.insert
%.pre = load i8, ptr %arrayidx7.phi.trans.insert, align 1, !tbaa !5
br label %for.body5, !llvm.loop !10
for.end25: ; preds = %for.end18, %for.inc23
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
%prime_list = alloca [50030 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 50030, ptr nonnull %prime_list) #5
%arrayidx.i = getelementptr inbounds i8, ptr %prime_list, i64 1
store i8 0, ptr %arrayidx.i, align 1, !tbaa !5
store i8 0, ptr %prime_list, align 16, !tbaa !5
%scevgep.i = getelementptr inbounds i8, ptr %prime_list, i64 2
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(50028) %scevgep.i, i8 1, i64 50028, i1 false), !tbaa !5
br label %for.body5.i
for.body5.i: ; preds = %for.body5.backedge.i, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body5.backedge.i ], [ 2, %entry ]
%0 = phi i8 [ %.pre.i, %for.body5.backedge.i ], [ 1, %entry ]
%i.145.i = phi i32 [ %i.145.be.i, %for.body5.backedge.i ], [ 2, %entry ]
%cmp8.i = icmp eq i8 %0, 0
br i1 %cmp8.i, label %for.inc23.i, label %if.end.i
if.end.i: ; preds = %for.body5.i
%cmp1143.i = icmp ult i64 %indvars.iv, 25015
br i1 %cmp1143.i, label %for.body13.preheader.i, label %for.end18.i
for.body13.preheader.i: ; preds = %if.end.i
%1 = shl nuw nsw i64 %indvars.iv, 1
br label %for.body13.i
for.body13.i: ; preds = %for.body13.i, %for.body13.preheader.i
%indvars.iv.i = phi i64 [ %1, %for.body13.preheader.i ], [ %indvars.iv.next.i, %for.body13.i ]
%arrayidx15.i = getelementptr inbounds i8, ptr %prime_list, i64 %indvars.iv.i
store i8 0, ptr %arrayidx15.i, align 1, !tbaa !5
%indvars.iv.next.i = add i64 %indvars.iv.i, %indvars.iv
%cmp11.i = icmp ult i64 %indvars.iv.next.i, 50030
br i1 %cmp11.i, label %for.body13.i, label %for.end18.i, !llvm.loop !8
for.end18.i: ; preds = %for.body13.i, %if.end.i
%mul.i = mul nsw i32 %i.145.i, %i.145.i
%cmp19.i = icmp ult i32 %mul.i, 50031
%cmp4.i = icmp ult i64 %indvars.iv, 50029
%or.cond.i = and i1 %cmp4.i, %cmp19.i
br i1 %or.cond.i, label %for.body5.backedge.i, label %enum_prime.exit
for.inc23.i: ; preds = %for.body5.i
%cmp4.old.i = icmp ult i64 %indvars.iv, 50029
br i1 %cmp4.old.i, label %for.body5.backedge.i, label %enum_prime.exit
for.body5.backedge.i: ; preds = %for.inc23.i, %for.end18.i
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%i.145.be.i = add nuw nsw i32 %i.145.i, 1
%arrayidx7.phi.trans.insert.i = getelementptr inbounds i8, ptr %prime_list, i64 %indvars.iv.next
%.pre.i = load i8, ptr %arrayidx7.phi.trans.insert.i, align 1, !tbaa !5
br label %for.body5.i, !llvm.loop !10
enum_prime.exit: ; preds = %for.end18.i, %for.inc23.i
%call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not25 = icmp eq i32 %call24, -1
br i1 %cmp.not25, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %enum_prime.exit, %for.end
%upper.027 = phi i32 [ %upper.1, %for.end ], [ undef, %enum_prime.exit ]
%under.026 = phi i32 [ %under.1.lcssa, %for.end ], [ undef, %enum_prime.exit ]
%2 = load i32, ptr %n, align 4
%3 = sext i32 %2 to i64
br label %for.body
for.body: ; preds = %if.end.1, %for.cond.preheader
%indvars.iv29 = phi i64 [ 0, %for.cond.preheader ], [ %indvars.iv.next30.1, %if.end.1 ]
%under.123 = phi i32 [ %under.026, %for.cond.preheader ], [ %under.2.1, %if.end.1 ]
%arrayidx = getelementptr inbounds [50030 x i8], ptr %prime_list, i64 0, i64 %indvars.iv29
%4 = load i8, ptr %arrayidx, align 2, !tbaa !5
%tobool.not = icmp ne i8 %4, 0
%cmp2 = icmp sgt i64 %indvars.iv29, %3
%or.cond = select i1 %tobool.not, i1 %cmp2, i1 false
%5 = trunc i64 %indvars.iv29 to i32
br i1 %or.cond, label %for.end, label %if.end
if.end: ; preds = %for.body
%cmp9 = icmp slt i64 %indvars.iv29, %3
%or.cond21 = select i1 %tobool.not, i1 %cmp9, i1 false
%under.2 = select i1 %or.cond21, i32 %5, i32 %under.123
%indvars.iv.next30 = or i64 %indvars.iv29, 1
%arrayidx.1 = getelementptr inbounds [50030 x i8], ptr %prime_list, i64 0, i64 %indvars.iv.next30
%6 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%tobool.not.1 = icmp ne i8 %6, 0
%cmp2.1 = icmp sgt i64 %indvars.iv.next30, %3
%or.cond.1 = select i1 %tobool.not.1, i1 %cmp2.1, i1 false
%7 = trunc i64 %indvars.iv.next30 to i32
br i1 %or.cond.1, label %for.end, label %if.end.1
if.end.1: ; preds = %if.end
%cmp9.1 = icmp slt i64 %indvars.iv.next30, %3
%or.cond21.1 = select i1 %tobool.not.1, i1 %cmp9.1, i1 false
%under.2.1 = select i1 %or.cond21.1, i32 %7, i32 %under.2
%indvars.iv.next30.1 = add nuw nsw i64 %indvars.iv29, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next30.1, 50030
br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %if.end.1, %if.end, %for.body
%under.1.lcssa = phi i32 [ %under.123, %for.body ], [ %under.2, %if.end ], [ %under.2.1, %if.end.1 ]
%upper.1 = phi i32 [ %5, %for.body ], [ %7, %if.end ], [ %upper.027, %if.end.1 ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %under.1.lcssa, i32 noundef %upper.1)
%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 %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end, %enum_prime.exit
call void @llvm.lifetime.end.p0(i64 50030, ptr nonnull %prime_list) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree 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 = distinct !{!11, !9}
!12 = distinct !{!12, !9}
|
// AtCoder AGC013 A - Sorted Arrays
// 2020.1.22 bal4u
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#if 1
//int getchar_unlocked(void);
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in() { // 非負整数の入力
int n = 0, c = gc();
do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
return n;
}
int main()
{
int a = 0, f = 0;
int ans = 1;
int N = in();
while (N--) {
int A = in();
if (a > 0) {
if (a < A) {
if (f < 0) a = 0, f = 0, ans++;
else f = 1;
} else if (a > A) {
if (f > 0) a = 0, f = 0, ans++;
else f = -1;
}
}
a = A;
}
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162868/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162868/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #3
%.pre13.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.preheader
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i = zext i8 %3 to i32
br label %do.body.preheader
do.body.preheader: ; preds = %cond.true.i, %cond.false.i
%.ph = phi ptr [ %0, %cond.false.i ], [ %.pre13.pre, %cond.true.i ]
%c.0.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ]
br label %do.body
do.body: ; preds = %do.body.preheader, %getchar_unlocked.exit12
%4 = phi ptr [ %8, %getchar_unlocked.exit12 ], [ %.ph, %do.body.preheader ]
%n.0 = phi i32 [ %add, %getchar_unlocked.exit12 ], [ 0, %do.body.preheader ]
%c.0 = phi i32 [ %cond.i8, %getchar_unlocked.exit12 ], [ %c.0.ph, %do.body.preheader ]
%mul = mul nsw i32 %n.0, 10
%and = and i32 %c.0, 15
%add = add nsw i32 %and, %mul
%_IO_read_ptr.i3 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i3, align 8, !tbaa !9
%_IO_read_end.i4 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i4, align 8, !tbaa !14
%cmp.not.i5 = icmp ult ptr %5, %6
br i1 %cmp.not.i5, label %cond.false.i9, label %cond.true.i6, !prof !15
cond.true.i6: ; preds = %do.body
%call.i7 = tail call i32 @__uflow(ptr noundef nonnull %4) #3
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit12
cond.false.i9: ; preds = %do.body
%incdec.ptr.i10 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i10, ptr %_IO_read_ptr.i3, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i11 = zext i8 %7 to i32
br label %getchar_unlocked.exit12
getchar_unlocked.exit12: ; preds = %cond.true.i6, %cond.false.i9
%8 = phi ptr [ %.pre, %cond.true.i6 ], [ %4, %cond.false.i9 ]
%cond.i8 = phi i32 [ %call.i7, %cond.true.i6 ], [ %conv3.i11, %cond.false.i9 ]
%cmp = icmp sgt i32 %cond.i8, 47
br i1 %cmp, label %do.body, label %do.end, !llvm.loop !17
do.end: ; preds = %getchar_unlocked.exit12
ret i32 %add
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !14
%cmp.not.i.i = icmp ult ptr %1, %2
br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !15
cond.true.i.i: ; preds = %entry
%call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #3
%.pre13.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i.preheader
cond.false.i.i: ; preds = %entry
%incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i.i = zext i8 %3 to i32
br label %do.body.i.preheader
do.body.i.preheader: ; preds = %cond.false.i.i, %cond.true.i.i
%.ph68 = phi ptr [ %0, %cond.false.i.i ], [ %.pre13.pre.i, %cond.true.i.i ]
%c.0.i.ph = phi i32 [ %conv3.i.i, %cond.false.i.i ], [ %call.i.i, %cond.true.i.i ]
br label %do.body.i
do.body.i: ; preds = %do.body.i.preheader, %getchar_unlocked.exit12.i
%4 = phi ptr [ %8, %getchar_unlocked.exit12.i ], [ %.ph68, %do.body.i.preheader ]
%n.0.i = phi i32 [ %add.i, %getchar_unlocked.exit12.i ], [ 0, %do.body.i.preheader ]
%c.0.i = phi i32 [ %cond.i8.i, %getchar_unlocked.exit12.i ], [ %c.0.i.ph, %do.body.i.preheader ]
%mul.i = mul nsw i32 %n.0.i, 10
%and.i = and i32 %c.0.i, 15
%add.i = add nsw i32 %and.i, %mul.i
%_IO_read_ptr.i3.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i3.i, align 8, !tbaa !9
%_IO_read_end.i4.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i4.i, align 8, !tbaa !14
%cmp.not.i5.i = icmp ult ptr %5, %6
br i1 %cmp.not.i5.i, label %cond.false.i9.i, label %cond.true.i6.i, !prof !15
cond.true.i6.i: ; preds = %do.body.i
%call.i7.i = tail call i32 @__uflow(ptr noundef nonnull %4) #3
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit12.i
cond.false.i9.i: ; preds = %do.body.i
%incdec.ptr.i10.i = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i10.i, ptr %_IO_read_ptr.i3.i, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i11.i = zext i8 %7 to i32
br label %getchar_unlocked.exit12.i
getchar_unlocked.exit12.i: ; preds = %cond.false.i9.i, %cond.true.i6.i
%8 = phi ptr [ %.pre.i, %cond.true.i6.i ], [ %4, %cond.false.i9.i ]
%cond.i8.i = phi i32 [ %call.i7.i, %cond.true.i6.i ], [ %conv3.i11.i, %cond.false.i9.i ]
%cmp.i = icmp sgt i32 %cond.i8.i, 47
br i1 %cmp.i, label %do.body.i, label %while.cond.preheader, !llvm.loop !17
while.cond.preheader: ; preds = %getchar_unlocked.exit12.i
%tobool.not60 = icmp eq i32 %add.i, 0
br i1 %tobool.not60, label %while.end, label %while.body
while.body: ; preds = %while.cond.preheader, %if.end16
%9 = phi ptr [ %18, %if.end16 ], [ %8, %while.cond.preheader ]
%dec64.in = phi i32 [ %dec64, %if.end16 ], [ %add.i, %while.cond.preheader ]
%a.063 = phi i32 [ %add.i42, %if.end16 ], [ 0, %while.cond.preheader ]
%ans.062 = phi i32 [ %ans.1, %if.end16 ], [ 1, %while.cond.preheader ]
%f.061 = phi i32 [ %f.1, %if.end16 ], [ 0, %while.cond.preheader ]
%dec64 = add nsw i32 %dec64.in, -1
%_IO_read_ptr.i.i28 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 1
%10 = load ptr, ptr %_IO_read_ptr.i.i28, align 8, !tbaa !9
%_IO_read_end.i.i29 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 2
%11 = load ptr, ptr %_IO_read_end.i.i29, align 8, !tbaa !14
%cmp.not.i.i30 = icmp ult ptr %10, %11
br i1 %cmp.not.i.i30, label %cond.false.i.i55, label %cond.true.i.i31, !prof !15
cond.true.i.i31: ; preds = %while.body
%call.i.i32 = tail call i32 @__uflow(ptr noundef nonnull %9) #3
%.pre13.pre.i33 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i37.preheader
cond.false.i.i55: ; preds = %while.body
%incdec.ptr.i.i56 = getelementptr inbounds i8, ptr %10, i64 1
store ptr %incdec.ptr.i.i56, ptr %_IO_read_ptr.i.i28, align 8, !tbaa !9
%12 = load i8, ptr %10, align 1, !tbaa !16
%conv3.i.i57 = zext i8 %12 to i32
br label %do.body.i37.preheader
do.body.i37.preheader: ; preds = %cond.false.i.i55, %cond.true.i.i31
%.ph67 = phi ptr [ %9, %cond.false.i.i55 ], [ %.pre13.pre.i33, %cond.true.i.i31 ]
%c.0.i39.ph = phi i32 [ %conv3.i.i57, %cond.false.i.i55 ], [ %call.i.i32, %cond.true.i.i31 ]
br label %do.body.i37
do.body.i37: ; preds = %do.body.i37.preheader, %getchar_unlocked.exit12.i49
%13 = phi ptr [ %18, %getchar_unlocked.exit12.i49 ], [ %.ph67, %do.body.i37.preheader ]
%14 = phi ptr [ %19, %getchar_unlocked.exit12.i49 ], [ %.ph67, %do.body.i37.preheader ]
%n.0.i38 = phi i32 [ %add.i42, %getchar_unlocked.exit12.i49 ], [ 0, %do.body.i37.preheader ]
%c.0.i39 = phi i32 [ %cond.i8.i50, %getchar_unlocked.exit12.i49 ], [ %c.0.i39.ph, %do.body.i37.preheader ]
%mul.i40 = mul nsw i32 %n.0.i38, 10
%and.i41 = and i32 %c.0.i39, 15
%add.i42 = add nsw i32 %and.i41, %mul.i40
%_IO_read_ptr.i3.i43 = getelementptr inbounds %struct._IO_FILE, ptr %14, i64 0, i32 1
%15 = load ptr, ptr %_IO_read_ptr.i3.i43, align 8, !tbaa !9
%_IO_read_end.i4.i44 = getelementptr inbounds %struct._IO_FILE, ptr %14, i64 0, i32 2
%16 = load ptr, ptr %_IO_read_end.i4.i44, align 8, !tbaa !14
%cmp.not.i5.i45 = icmp ult ptr %15, %16
br i1 %cmp.not.i5.i45, label %cond.false.i9.i52, label %cond.true.i6.i46, !prof !15
cond.true.i6.i46: ; preds = %do.body.i37
%call.i7.i47 = tail call i32 @__uflow(ptr noundef nonnull %14) #3
%.pre.i48 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit12.i49
cond.false.i9.i52: ; preds = %do.body.i37
%incdec.ptr.i10.i53 = getelementptr inbounds i8, ptr %15, i64 1
store ptr %incdec.ptr.i10.i53, ptr %_IO_read_ptr.i3.i43, align 8, !tbaa !9
%17 = load i8, ptr %15, align 1, !tbaa !16
%conv3.i11.i54 = zext i8 %17 to i32
br label %getchar_unlocked.exit12.i49
getchar_unlocked.exit12.i49: ; preds = %cond.false.i9.i52, %cond.true.i6.i46
%18 = phi ptr [ %.pre.i48, %cond.true.i6.i46 ], [ %13, %cond.false.i9.i52 ]
%19 = phi ptr [ %.pre.i48, %cond.true.i6.i46 ], [ %14, %cond.false.i9.i52 ]
%cond.i8.i50 = phi i32 [ %call.i7.i47, %cond.true.i6.i46 ], [ %conv3.i11.i54, %cond.false.i9.i52 ]
%cmp.i51 = icmp sgt i32 %cond.i8.i50, 47
br i1 %cmp.i51, label %do.body.i37, label %in.exit58, !llvm.loop !17
in.exit58: ; preds = %getchar_unlocked.exit12.i49
%cmp = icmp sgt i32 %a.063, 0
br i1 %cmp, label %if.then, label %if.end16
if.then: ; preds = %in.exit58
%cmp2 = icmp slt i32 %a.063, %add.i42
br i1 %cmp2, label %if.then3, label %if.else6
if.then3: ; preds = %if.then
%cmp4 = icmp sgt i32 %f.061, -1
%spec.select = zext i1 %cmp4 to i32
%not.cmp4 = xor i1 %cmp4, true
%inc = zext i1 %not.cmp4 to i32
%spec.select25 = add nsw i32 %ans.062, %inc
br label %if.end16
if.else6: ; preds = %if.then
%cmp7 = icmp sgt i32 %a.063, %add.i42
br i1 %cmp7, label %if.then8, label %if.end16
if.then8: ; preds = %if.else6
%cmp9 = icmp slt i32 %f.061, 1
%spec.select26 = sext i1 %cmp9 to i32
%not.cmp9 = xor i1 %cmp9, true
%inc11 = zext i1 %not.cmp9 to i32
%spec.select27 = add nsw i32 %ans.062, %inc11
br label %if.end16
if.end16: ; preds = %if.then8, %if.then3, %if.else6, %in.exit58
%f.1 = phi i32 [ %f.061, %if.else6 ], [ %f.061, %in.exit58 ], [ %spec.select, %if.then3 ], [ %spec.select26, %if.then8 ]
%ans.1 = phi i32 [ %ans.062, %if.else6 ], [ %ans.062, %in.exit58 ], [ %spec.select25, %if.then3 ], [ %spec.select27, %if.then8 ]
%tobool.not = icmp eq i32 %dec64, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !19
while.end: ; preds = %if.end16, %while.cond.preheader
%ans.0.lcssa = phi i32 [ 1, %while.cond.preheader ], [ %ans.1, %if.end16 ]
%call17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %ans.0.lcssa)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
declare i32 @__uflow(ptr noundef) local_unnamed_addr #2
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_IO_FILE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !12, i64 120, !13, i64 128, !7, i64 130, !7, i64 131, !6, i64 136, !12, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !12, i64 184, !11, i64 192, !7, i64 196}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !6, i64 16}
!15 = !{!"branch_weights", i32 2000, i32 1}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
|
#include <stdio.h>
#include <stdlib.h>
int main(){
int N, i, ans = 1;
scanf("%d", &N);
int *A = (int *)malloc(sizeof(int) * N);
for(i = 0; i < N; i++){
scanf("%d", &A[i]);
}
int now = 0;
for(i = 1; i < N; i++){
if(now == 0){
if(A[i] > A[i - 1]){
now = 1;
}
else if(A[i] < A[i - 1]){
now = -1;
}
}
else if(now == 1){
if(A[i] < A[i - 1]){
ans++;
now = 0;
}
}
else{
if(A[i] > A[i - 1]){
ans++;
now = 0;
}
}
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162918/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162918/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #5
%cmp85 = icmp sgt i32 %0, 0
br i1 %cmp85, label %for.body, label %for.end55
for.cond4.preheader: ; preds = %for.body
%cmp587 = icmp sgt i32 %1, 1
br i1 %cmp587, label %for.body7.preheader, label %for.end55
for.body7.preheader: ; preds = %for.cond4.preheader
%wide.trip.count = zext i32 %1 to i64
%invariant.gep = getelementptr i32, ptr %call1, i64 -1
%invariant.gep102 = getelementptr i32, ptr %call1, i64 -1
%invariant.gep104 = getelementptr i32, ptr %call1, i64 -1
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 %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.body7.preheader, %for.inc53
%indvars.iv94 = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next95, %for.inc53 ]
%now.090 = phi i32 [ 0, %for.body7.preheader ], [ %now.1, %for.inc53 ]
%ans.088 = phi i32 [ 1, %for.body7.preheader ], [ %ans.1, %for.inc53 ]
%arrayidx42 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv94
%3 = load i32, ptr %arrayidx42, align 4, !tbaa !5
switch i32 %now.090, label %if.else40 [
i32 0, label %if.then
i32 1, label %if.then29
]
if.then: ; preds = %for.body7
%gep103 = getelementptr i32, ptr %invariant.gep102, i64 %indvars.iv94
%4 = load i32, ptr %gep103, align 4, !tbaa !5
%cmp14 = icmp sgt i32 %3, %4
br i1 %cmp14, label %for.inc53, label %if.else
if.else: ; preds = %if.then
%cmp22 = icmp slt i32 %3, %4
%spec.select = sext i1 %cmp22 to i32
br label %for.inc53
if.then29: ; preds = %for.body7
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv94
%5 = load i32, ptr %gep, align 4, !tbaa !5
%cmp35 = icmp slt i32 %3, %5
%inc38 = zext i1 %cmp35 to i32
%spec.select81 = add nsw i32 %ans.088, %inc38
%not.cmp35 = xor i1 %cmp35, true
%spec.select82 = zext i1 %not.cmp35 to i32
br label %for.inc53
if.else40: ; preds = %for.body7
%gep105 = getelementptr i32, ptr %invariant.gep104, i64 %indvars.iv94
%6 = load i32, ptr %gep105, align 4, !tbaa !5
%cmp46 = icmp sgt i32 %3, %6
%inc49 = zext i1 %cmp46 to i32
%spec.select83 = add nsw i32 %ans.088, %inc49
%spec.select84 = select i1 %cmp46, i32 0, i32 %now.090
br label %for.inc53
for.inc53: ; preds = %if.else40, %if.then29, %if.else, %if.then
%ans.1 = phi i32 [ %ans.088, %if.then ], [ %ans.088, %if.else ], [ %spec.select81, %if.then29 ], [ %spec.select83, %if.else40 ]
%now.1 = phi i32 [ 1, %if.then ], [ %spec.select, %if.else ], [ %spec.select82, %if.then29 ], [ %spec.select84, %if.else40 ]
%indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
%exitcond.not = icmp eq i64 %indvars.iv.next95, %wide.trip.count
br i1 %exitcond.not, label %for.end55, label %for.body7, !llvm.loop !11
for.end55: ; preds = %for.inc53, %entry, %for.cond4.preheader
%ans.0.lcssa = phi i32 [ 1, %for.cond4.preheader ], [ 1, %entry ], [ %ans.1, %for.inc53 ]
%call56 = 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) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
void quick_sort(int a[][2], int first, int last);
void array_copy(int a[], int b[], int n);
int main(void){
int n; //仕事数
scanf("%d",&n); //仕事数
int works[n][2]; //仕事のデータ
int i, sum = 0, flag = 1; //ループ変数,仕事時間の和,YesかNoか
for(i=0 ; i<n ; i++)
scanf("%d %d",&works[i][0] , &works[i][1]); //仕事のデータ
quick_sort(works, 0, n-1);
for(i=0 ; i<n ; i++){
sum += works[i][0];
if(sum > works[i][1]){
flag = 0;
break;
}
}
if(flag == 1)
printf("Yes\n");
else
printf("No\n");
return 0;
}
void quick_sort(int a[][2], int first, int last){
int tmp[2];
int k;
int flag = 1;
int p = a[first][1];
int i = first , j = last;
while(flag){
while(a[i][1] < p)
i++;
while(p < a[j][1])
j--;
if(i<j){
array_copy(tmp, a[i], 2);
array_copy(a[i], a[j], 2);
array_copy(a[j], tmp, 2);
i++;
j--;
}
else
flag = 0;
}
if(first < i-1)
quick_sort(a, first, i-1);
if(j+1 < last)
quick_sort(a, j+1, last);
}
void array_copy(int a[], int b[], int n){
for(int i=0 ; i<n ; i++)
a[i] = b[i];
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162961/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162961/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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 %n, align 4, !tbaa !5
%cmp33 = icmp sgt i32 %3, 0
br i1 %cmp33, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
%sub44 = add nsw i32 %3, -1
call void @quick_sort(ptr noundef nonnull %vla, i32 noundef 0, i32 noundef %sub44)
br label %if.end23
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.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx4)
%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
%sub = add nsw i32 %4, -1
call void @quick_sort(ptr noundef nonnull %vla, i32 noundef 0, i32 noundef %sub)
%cmp7.not35 = icmp sgt i32 %4, 0
br i1 %cmp7.not35, label %for.body8.preheader, label %if.end23
for.body8.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %4 to i64
br label %for.body8
for.cond6: ; preds = %for.body8
%indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
%exitcond.not = icmp eq i64 %indvars.iv.next41, %wide.trip.count
br i1 %exitcond.not, label %if.end23, label %for.body8, !llvm.loop !11
for.body8: ; preds = %for.body8.preheader, %for.cond6
%indvars.iv40 = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next41, %for.cond6 ]
%sum.037 = phi i32 [ 0, %for.body8.preheader ], [ %add, %for.cond6 ]
%arrayidx10 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv40
%6 = load i32, ptr %arrayidx10, align 8, !tbaa !5
%add = add nsw i32 %6, %sum.037
%arrayidx14 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv40, i64 1
%7 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %add, %7
br i1 %cmp15, label %if.end23, label %for.cond6
if.end23: ; preds = %for.body8, %for.cond6, %for.end, %for.end.thread
%str.sink = phi ptr [ @str.4, %for.end.thread ], [ @str.4, %for.end ], [ @str.4, %for.cond6 ], [ @str, %for.body8 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @quick_sort(ptr noundef %a, i32 noundef %first, i32 noundef %last) local_unnamed_addr #4 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end34, %entry
%first.tr = phi i32 [ %first, %entry ], [ %add, %if.end34 ]
%idxprom = sext i32 %first.tr to i64
%arrayidx1 = getelementptr inbounds [2 x i32], ptr %a, i64 %idxprom, i64 1
%0 = load i32, ptr %arrayidx1, align 4, !tbaa !5
br label %while.cond2.preheader
while.cond2.preheader: ; preds = %if.end, %tailrecurse
%j.083 = phi i32 [ %last, %tailrecurse ], [ %dec29, %if.end ]
%i.082 = phi i32 [ %first.tr, %tailrecurse ], [ %inc28, %if.end ]
%1 = sext i32 %i.082 to i64
br label %while.cond2
while.cond2: ; preds = %while.cond2, %while.cond2.preheader
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond2 ], [ %1, %while.cond2.preheader ]
%arrayidx5 = getelementptr inbounds [2 x i32], ptr %a, i64 %indvars.iv, i64 1
%2 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp = icmp slt i32 %2, %0
%indvars.iv.next = add i64 %indvars.iv, 1
br i1 %cmp, label %while.cond2, label %while.cond7.preheader, !llvm.loop !12
while.cond7.preheader: ; preds = %while.cond2
%3 = trunc i64 %indvars.iv to i32
%4 = sext i32 %j.083 to i64
br label %while.cond7
while.cond7: ; preds = %while.cond7, %while.cond7.preheader
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %while.cond7 ], [ %4, %while.cond7.preheader ]
%arrayidx10 = getelementptr inbounds [2 x i32], ptr %a, i64 %indvars.iv85, i64 1
%5 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp slt i32 %0, %5
%indvars.iv.next86 = add i64 %indvars.iv85, -1
br i1 %cmp11, label %while.cond7, label %while.end13, !llvm.loop !13
while.end13: ; preds = %while.cond7
%6 = trunc i64 %indvars.iv85 to i32
%cmp14 = icmp slt i32 %3, %6
br i1 %cmp14, label %if.end, label %while.end30
if.end: ; preds = %while.end13
%arrayidx9.le = getelementptr [2 x i32], ptr %a, i64 %indvars.iv85
%arrayidx4.le = getelementptr [2 x i32], ptr %a, i64 %indvars.iv
%tmp.sroa.0.0.copyload = load i64, ptr %arrayidx4.le, align 4, !tbaa !5
%7 = load i32, ptr %arrayidx9.le, align 4, !tbaa !5
store i32 %7, ptr %arrayidx4.le, align 4, !tbaa !5
%arrayidx2.i70.1 = getelementptr inbounds i32, ptr %arrayidx4.le, i64 1
store i32 %5, ptr %arrayidx2.i70.1, align 4, !tbaa !5
store i64 %tmp.sroa.0.0.copyload, ptr %arrayidx9.le, align 4, !tbaa !5
%inc28 = add nsw i32 %3, 1
%dec29 = add nsw i32 %6, -1
br label %while.cond2.preheader, !llvm.loop !14
while.end30: ; preds = %while.end13
%sub = add nsw i32 %3, -1
%cmp31 = icmp sgt i32 %sub, %first.tr
br i1 %cmp31, label %if.then32, label %if.end34
if.then32: ; preds = %while.end30
tail call void @quick_sort(ptr noundef nonnull %a, i32 noundef %first.tr, i32 noundef %sub)
br label %if.end34
if.end34: ; preds = %if.then32, %while.end30
%add = add nsw i32 %6, 1
%cmp35 = icmp slt i32 %add, %last
br i1 %cmp35, label %tailrecurse, label %if.end38
if.end38: ; preds = %if.end34
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @array_copy(ptr nocapture noundef writeonly %a, ptr nocapture noundef readonly %b, i32 noundef %n) local_unnamed_addr #5 {
entry:
%cmp6 = icmp sgt i32 %n, 0
br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%a9 = ptrtoint ptr %a to i64
%b10 = ptrtoint ptr %b to i64
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
%0 = sub i64 %a9, %b10
%diff.check = icmp ult i64 %0, 32
%or.cond = or i1 %min.iters.check, %diff.check
br i1 %or.cond, label %for.body.preheader12, 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 i32, ptr %b, i64 %index
%wide.load = load <4 x i32>, ptr %1, align 4, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
%wide.load11 = load <4 x i32>, ptr %2, align 4, !tbaa !5
%3 = getelementptr inbounds i32, ptr %a, i64 %index
store <4 x i32> %wide.load, ptr %3, align 4, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> %wide.load11, ptr %4, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader12
for.body.preheader12: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%6 = xor i64 %indvars.iv.ph, -1
%7 = add nsw i64 %6, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader12, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader12 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader12 ]
%arrayidx.prol = getelementptr inbounds i32, ptr %b, i64 %indvars.iv.prol
%8 = load i32, ptr %arrayidx.prol, align 4, !tbaa !5
%arrayidx2.prol = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.prol
store i32 %8, ptr %arrayidx2.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !18
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader12
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader12 ], [ %indvars.iv.next.prol, %for.body.prol ]
%9 = icmp ult i64 %7, 3
br i1 %9, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
ret void
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%arrayidx = getelementptr inbounds i32, ptr %b, i64 %indvars.iv
%10 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
store i32 %10, ptr %arrayidx2, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %b, i64 %indvars.iv.next
%11 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%arrayidx2.1 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next
store i32 %11, ptr %arrayidx2.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds i32, ptr %b, i64 %indvars.iv.next.1
%12 = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%arrayidx2.2 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.1
store i32 %12, ptr %arrayidx2.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds i32, ptr %b, i64 %indvars.iv.next.2
%13 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%arrayidx2.3 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.2
store i32 %13, ptr %arrayidx2.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond.cleanup, label %for.body, !llvm.loop !20
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !10, !16}
|
#include <stdio.h>
#define N 200000
typedef struct a{
int cost;
int deadline;
} Work;
typedef Work key;
void marge(key data[], key work[], int start, int mid, int end){
int i = start;
int j = mid + 1;
int k = start;
while(i <= mid && j <= end){
if(data[i].deadline <= data[j].deadline){
work[k++] = data[i++];
}else{
work[k++] = data[j++];
}
}
if(i <= mid){
while(i <= mid){
work[k++] = data[i++];
}
}else{
while(j <= end){
work[k++] = data[j++];
}
}
for(k = start; k <= end; k++){
data[k] = work[k];
}
}
void margesort(key data[], key work[], int start, int end){
int mid;
if(start < end){
mid = start + (end - start)/2;
margesort(data, work, start, mid);
margesort(data, work, mid + 1, end);
marge(data, work, start, mid, end);
}
}
int main(void){
int n;
long long int costsum = 0;
Work data[N];
Work tmp[N];
int i;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d %d", &(data[i].cost), &(data[i].deadline));
}
margesort(data, tmp, 0, n-1);
for(i = 0; i < n; i++){
costsum += data[i].cost;
if(costsum > data[i].deadline){
break;
}
}
if(i == n){
puts("Yes");
}else{
puts("No");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163003/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163003/source.c"
target datalayout = "e-m:e-p270: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.a = type { i32, i32 }
@.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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @marge(ptr nocapture noundef %data, ptr nocapture noundef %work, i32 noundef %start, i32 noundef %mid, i32 noundef %end) local_unnamed_addr #0 {
entry:
%work159 = ptrtoint ptr %work to i64
%data138 = ptrtoint ptr %data to i64
%work137 = ptrtoint ptr %work to i64
%data131 = ptrtoint ptr %data to i64
%work130 = ptrtoint ptr %work to i64
%add = add i32 %mid, 1
%cmp81 = icmp sle i32 %start, %mid
%cmp182 = icmp slt i32 %mid, %end
%0 = and i1 %cmp81, %cmp182
br i1 %0, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %entry
%1 = sext i32 %start to i64
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%indvars.iv = phi i64 [ %1, %while.body.preheader ], [ %indvars.iv.next, %while.body ]
%j.084 = phi i32 [ %add, %while.body.preheader ], [ %j.1, %while.body ]
%i.083 = phi i32 [ %start, %while.body.preheader ], [ %i.1, %while.body ]
%idxprom = sext i32 %i.083 to i64
%deadline = getelementptr inbounds %struct.a, ptr %data, i64 %idxprom, i32 1
%2 = load i32, ptr %deadline, align 4, !tbaa !5
%idxprom2 = sext i32 %j.084 to i64
%deadline4 = getelementptr inbounds %struct.a, ptr %data, i64 %idxprom2, i32 1
%3 = load i32, ptr %deadline4, align 4, !tbaa !5
%cmp5.not = icmp sle i32 %2, %3
%idxprom2.pn = select i1 %cmp5.not, i64 %idxprom, i64 %idxprom2
%inc8 = zext i1 %cmp5.not to i32
%i.1 = add nsw i32 %i.083, %inc8
%not.cmp5.not = xor i1 %cmp5.not, true
%inc14 = zext i1 %not.cmp5.not to i32
%j.1 = add nsw i32 %j.084, %inc14
%.sink.in = getelementptr inbounds %struct.a, ptr %data, i64 %idxprom2.pn
%.sink = load i64, ptr %.sink.in, align 4
%4 = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv
store i64 %.sink, ptr %4, align 4
%indvars.iv.next = add i64 %indvars.iv, 1
%cmp = icmp sle i32 %i.1, %mid
%cmp1 = icmp sle i32 %j.1, %end
%5 = select i1 %cmp, i1 %cmp1, i1 false
br i1 %5, label %while.body, label %while.end.loopexit, !llvm.loop !10
while.end.loopexit: ; preds = %while.body
%6 = trunc i64 %indvars.iv.next to i32
br i1 %cmp, label %while.cond19.preheader, label %while.cond30.preheader
while.end: ; preds = %entry
br i1 %cmp81, label %while.cond19.preheader, label %while.cond30.preheader
while.cond30.preheader: ; preds = %while.end.loopexit, %while.end
%k.0.lcssa126 = phi i32 [ %6, %while.end.loopexit ], [ %start, %while.end ]
%j.0.lcssa125 = phi i32 [ %j.1, %while.end.loopexit ], [ %add, %while.end ]
%cmp31.not89 = icmp sgt i32 %j.0.lcssa125, %end
br i1 %cmp31.not89, label %if.end40, label %while.body32.preheader
while.body32.preheader: ; preds = %while.cond30.preheader
%7 = sext i32 %k.0.lcssa126 to i64
%8 = sext i32 %j.0.lcssa125 to i64
%9 = add i32 %end, 1
%10 = sub i32 %end, %j.0.lcssa125
%11 = zext i32 %10 to i64
%12 = add nuw nsw i64 %11, 1
%min.iters.check = icmp ult i32 %10, 11
br i1 %min.iters.check, label %while.body32.preheader178, label %vector.memcheck
vector.memcheck: ; preds = %while.body32.preheader
%13 = shl nsw i64 %7, 3
%14 = add i64 %13, %work130
%15 = shl nsw i64 %8, 3
%16 = add i64 %15, %data131
%17 = sub i64 %14, %16
%diff.check = icmp ult i64 %17, 32
br i1 %diff.check, label %while.body32.preheader178, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %12, 8589934588
%ind.end = add nsw i64 %n.vec, %8
%ind.end132 = add nsw i64 %n.vec, %7
%invariant.gep = getelementptr %struct.a, ptr %work, i64 %7
%invariant.gep186 = getelementptr %struct.a, ptr %data, i64 %8
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%gep = getelementptr %struct.a, ptr %invariant.gep, i64 %index
%gep187 = getelementptr %struct.a, ptr %invariant.gep186, i64 %index
%wide.load = load <2 x i64>, ptr %gep187, align 4
%18 = getelementptr inbounds i64, ptr %gep187, i64 2
%wide.load135 = load <2 x i64>, ptr %18, align 4
store <2 x i64> %wide.load, ptr %gep, align 4
%19 = getelementptr inbounds i64, ptr %gep, i64 2
store <2 x i64> %wide.load135, ptr %19, align 4
%index.next = add nuw i64 %index, 4
%20 = icmp eq i64 %index.next, %n.vec
br i1 %20, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %12, %n.vec
br i1 %cmp.n, label %if.end40, label %while.body32.preheader178
while.body32.preheader178: ; preds = %vector.memcheck, %while.body32.preheader, %middle.block
%indvars.iv103.ph = phi i64 [ %8, %vector.memcheck ], [ %8, %while.body32.preheader ], [ %ind.end, %middle.block ]
%indvars.iv101.ph = phi i64 [ %7, %vector.memcheck ], [ %7, %while.body32.preheader ], [ %ind.end132, %middle.block ]
%21 = add i32 %end, 1
%22 = trunc i64 %indvars.iv103.ph to i32
%23 = sub i32 %21, %22
%24 = sub i32 %end, %22
%xtraiter = and i32 %23, 3
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.body32.prol.loopexit, label %while.body32.prol
while.body32.prol: ; preds = %while.body32.preheader178, %while.body32.prol
%indvars.iv103.prol = phi i64 [ %indvars.iv.next104.prol, %while.body32.prol ], [ %indvars.iv103.ph, %while.body32.preheader178 ]
%indvars.iv101.prol = phi i64 [ %indvars.iv.next102.prol, %while.body32.prol ], [ %indvars.iv101.ph, %while.body32.preheader178 ]
%prol.iter = phi i32 [ %prol.iter.next, %while.body32.prol ], [ 0, %while.body32.preheader178 ]
%indvars.iv.next102.prol = add nsw i64 %indvars.iv101.prol, 1
%arrayidx35.prol = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv101.prol
%indvars.iv.next104.prol = add nsw i64 %indvars.iv103.prol, 1
%arrayidx38.prol = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv103.prol
%25 = load i64, ptr %arrayidx38.prol, align 4
store i64 %25, ptr %arrayidx35.prol, align 4
%prol.iter.next = add i32 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %while.body32.prol.loopexit, label %while.body32.prol, !llvm.loop !15
while.body32.prol.loopexit: ; preds = %while.body32.prol, %while.body32.preheader178
%indvars.iv103.unr = phi i64 [ %indvars.iv103.ph, %while.body32.preheader178 ], [ %indvars.iv.next104.prol, %while.body32.prol ]
%indvars.iv101.unr = phi i64 [ %indvars.iv101.ph, %while.body32.preheader178 ], [ %indvars.iv.next102.prol, %while.body32.prol ]
%26 = icmp ult i32 %24, 3
br i1 %26, label %if.end40, label %while.body32.preheader178.new
while.body32.preheader178.new: ; preds = %while.body32.prol.loopexit
%invariant.gep188 = getelementptr %struct.a, ptr %work, i64 1
%invariant.gep190 = getelementptr %struct.a, ptr %data, i64 1
%invariant.gep192 = getelementptr %struct.a, ptr %work, i64 2
%invariant.gep194 = getelementptr %struct.a, ptr %data, i64 2
%invariant.gep196 = getelementptr %struct.a, ptr %work, i64 3
%invariant.gep198 = getelementptr %struct.a, ptr %data, i64 3
br label %while.body32
while.cond19.preheader: ; preds = %while.end.loopexit, %while.end
%k.0.lcssa127 = phi i32 [ %6, %while.end.loopexit ], [ %start, %while.end ]
%i.0.lcssa124 = phi i32 [ %i.1, %while.end.loopexit ], [ %start, %while.end ]
%cmp20.not92 = icmp sgt i32 %i.0.lcssa124, %mid
br i1 %cmp20.not92, label %if.end40, label %while.body21.preheader
while.body21.preheader: ; preds = %while.cond19.preheader
%27 = sext i32 %k.0.lcssa127 to i64
%28 = sext i32 %i.0.lcssa124 to i64
%29 = sub i32 %mid, %i.0.lcssa124
%30 = zext i32 %29 to i64
%31 = add nuw nsw i64 %30, 1
%min.iters.check142 = icmp ult i32 %29, 11
br i1 %min.iters.check142, label %while.body21.preheader177, label %vector.memcheck136
vector.memcheck136: ; preds = %while.body21.preheader
%32 = shl nsw i64 %27, 3
%33 = add i64 %32, %work137
%34 = shl nsw i64 %28, 3
%35 = add i64 %34, %data138
%36 = sub i64 %33, %35
%diff.check139 = icmp ult i64 %36, 32
br i1 %diff.check139, label %while.body21.preheader177, label %vector.ph143
vector.ph143: ; preds = %vector.memcheck136
%n.vec145 = and i64 %31, 8589934588
%ind.end146 = add nsw i64 %n.vec145, %28
%ind.end148 = add nsw i64 %n.vec145, %27
%invariant.gep200 = getelementptr %struct.a, ptr %work, i64 %27
%invariant.gep202 = getelementptr %struct.a, ptr %data, i64 %28
br label %vector.body151
vector.body151: ; preds = %vector.body151, %vector.ph143
%index152 = phi i64 [ 0, %vector.ph143 ], [ %index.next157, %vector.body151 ]
%gep201 = getelementptr %struct.a, ptr %invariant.gep200, i64 %index152
%gep203 = getelementptr %struct.a, ptr %invariant.gep202, i64 %index152
%wide.load155 = load <2 x i64>, ptr %gep203, align 4
%37 = getelementptr inbounds i64, ptr %gep203, i64 2
%wide.load156 = load <2 x i64>, ptr %37, align 4
store <2 x i64> %wide.load155, ptr %gep201, align 4
%38 = getelementptr inbounds i64, ptr %gep201, i64 2
store <2 x i64> %wide.load156, ptr %38, align 4
%index.next157 = add nuw i64 %index152, 4
%39 = icmp eq i64 %index.next157, %n.vec145
br i1 %39, label %middle.block140, label %vector.body151, !llvm.loop !17
middle.block140: ; preds = %vector.body151
%cmp.n150 = icmp eq i64 %31, %n.vec145
br i1 %cmp.n150, label %if.end40, label %while.body21.preheader177
while.body21.preheader177: ; preds = %vector.memcheck136, %while.body21.preheader, %middle.block140
%indvars.iv111.ph = phi i64 [ %28, %vector.memcheck136 ], [ %28, %while.body21.preheader ], [ %ind.end146, %middle.block140 ]
%indvars.iv109.ph = phi i64 [ %27, %vector.memcheck136 ], [ %27, %while.body21.preheader ], [ %ind.end148, %middle.block140 ]
%40 = add i32 %mid, 1
%41 = trunc i64 %indvars.iv111.ph to i32
%42 = sub i32 %40, %41
%43 = sub i32 %mid, %41
%xtraiter180 = and i32 %42, 3
%lcmp.mod181.not = icmp eq i32 %xtraiter180, 0
br i1 %lcmp.mod181.not, label %while.body21.prol.loopexit, label %while.body21.prol
while.body21.prol: ; preds = %while.body21.preheader177, %while.body21.prol
%indvars.iv111.prol = phi i64 [ %indvars.iv.next112.prol, %while.body21.prol ], [ %indvars.iv111.ph, %while.body21.preheader177 ]
%indvars.iv109.prol = phi i64 [ %indvars.iv.next110.prol, %while.body21.prol ], [ %indvars.iv109.ph, %while.body21.preheader177 ]
%prol.iter182 = phi i32 [ %prol.iter182.next, %while.body21.prol ], [ 0, %while.body21.preheader177 ]
%indvars.iv.next110.prol = add nsw i64 %indvars.iv109.prol, 1
%arrayidx24.prol = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv109.prol
%indvars.iv.next112.prol = add nsw i64 %indvars.iv111.prol, 1
%arrayidx27.prol = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv111.prol
%44 = load i64, ptr %arrayidx27.prol, align 4
store i64 %44, ptr %arrayidx24.prol, align 4
%prol.iter182.next = add i32 %prol.iter182, 1
%prol.iter182.cmp.not = icmp eq i32 %prol.iter182.next, %xtraiter180
br i1 %prol.iter182.cmp.not, label %while.body21.prol.loopexit, label %while.body21.prol, !llvm.loop !18
while.body21.prol.loopexit: ; preds = %while.body21.prol, %while.body21.preheader177
%indvars.iv111.unr = phi i64 [ %indvars.iv111.ph, %while.body21.preheader177 ], [ %indvars.iv.next112.prol, %while.body21.prol ]
%indvars.iv109.unr = phi i64 [ %indvars.iv109.ph, %while.body21.preheader177 ], [ %indvars.iv.next110.prol, %while.body21.prol ]
%45 = icmp ult i32 %43, 3
br i1 %45, label %if.end40, label %while.body21.preheader177.new
while.body21.preheader177.new: ; preds = %while.body21.prol.loopexit
%invariant.gep204 = getelementptr %struct.a, ptr %work, i64 1
%invariant.gep206 = getelementptr %struct.a, ptr %data, i64 1
%invariant.gep208 = getelementptr %struct.a, ptr %work, i64 2
%invariant.gep210 = getelementptr %struct.a, ptr %data, i64 2
%invariant.gep212 = getelementptr %struct.a, ptr %work, i64 3
%invariant.gep214 = getelementptr %struct.a, ptr %data, i64 3
br label %while.body21
while.body21: ; preds = %while.body21, %while.body21.preheader177.new
%indvars.iv111 = phi i64 [ %indvars.iv111.unr, %while.body21.preheader177.new ], [ %indvars.iv.next112.3, %while.body21 ]
%indvars.iv109 = phi i64 [ %indvars.iv109.unr, %while.body21.preheader177.new ], [ %indvars.iv.next110.3, %while.body21 ]
%arrayidx24 = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv109
%arrayidx27 = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv111
%46 = load i64, ptr %arrayidx27, align 4
store i64 %46, ptr %arrayidx24, align 4
%gep205 = getelementptr %struct.a, ptr %invariant.gep204, i64 %indvars.iv109
%gep207 = getelementptr %struct.a, ptr %invariant.gep206, i64 %indvars.iv111
%47 = load i64, ptr %gep207, align 4
store i64 %47, ptr %gep205, align 4
%gep209 = getelementptr %struct.a, ptr %invariant.gep208, i64 %indvars.iv109
%gep211 = getelementptr %struct.a, ptr %invariant.gep210, i64 %indvars.iv111
%48 = load i64, ptr %gep211, align 4
store i64 %48, ptr %gep209, align 4
%indvars.iv.next110.3 = add nsw i64 %indvars.iv109, 4
%gep213 = getelementptr %struct.a, ptr %invariant.gep212, i64 %indvars.iv109
%indvars.iv.next112.3 = add nsw i64 %indvars.iv111, 4
%gep215 = getelementptr %struct.a, ptr %invariant.gep214, i64 %indvars.iv111
%49 = load i64, ptr %gep215, align 4
store i64 %49, ptr %gep213, align 4
%lftr.wideiv116.3 = trunc i64 %indvars.iv.next112.3 to i32
%exitcond117.not.3 = icmp eq i32 %add, %lftr.wideiv116.3
br i1 %exitcond117.not.3, label %if.end40, label %while.body21, !llvm.loop !19
while.body32: ; preds = %while.body32, %while.body32.preheader178.new
%indvars.iv103 = phi i64 [ %indvars.iv103.unr, %while.body32.preheader178.new ], [ %indvars.iv.next104.3, %while.body32 ]
%indvars.iv101 = phi i64 [ %indvars.iv101.unr, %while.body32.preheader178.new ], [ %indvars.iv.next102.3, %while.body32 ]
%arrayidx35 = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv101
%arrayidx38 = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv103
%50 = load i64, ptr %arrayidx38, align 4
store i64 %50, ptr %arrayidx35, align 4
%gep189 = getelementptr %struct.a, ptr %invariant.gep188, i64 %indvars.iv101
%gep191 = getelementptr %struct.a, ptr %invariant.gep190, i64 %indvars.iv103
%51 = load i64, ptr %gep191, align 4
store i64 %51, ptr %gep189, align 4
%gep193 = getelementptr %struct.a, ptr %invariant.gep192, i64 %indvars.iv101
%gep195 = getelementptr %struct.a, ptr %invariant.gep194, i64 %indvars.iv103
%52 = load i64, ptr %gep195, align 4
store i64 %52, ptr %gep193, align 4
%indvars.iv.next102.3 = add nsw i64 %indvars.iv101, 4
%gep197 = getelementptr %struct.a, ptr %invariant.gep196, i64 %indvars.iv101
%indvars.iv.next104.3 = add nsw i64 %indvars.iv103, 4
%gep199 = getelementptr %struct.a, ptr %invariant.gep198, i64 %indvars.iv103
%53 = load i64, ptr %gep199, align 4
store i64 %53, ptr %gep197, align 4
%lftr.wideiv.3 = trunc i64 %indvars.iv.next104.3 to i32
%exitcond.not.3 = icmp eq i32 %9, %lftr.wideiv.3
br i1 %exitcond.not.3, label %if.end40, label %while.body32, !llvm.loop !20
if.end40: ; preds = %while.body32.prol.loopexit, %while.body32, %while.body21.prol.loopexit, %while.body21, %middle.block, %middle.block140, %while.cond30.preheader, %while.cond19.preheader
%cmp41.not95 = icmp sgt i32 %start, %end
br i1 %cmp41.not95, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %if.end40
%54 = sext i32 %start to i64
%55 = add i32 %end, 1
%56 = sub i32 %end, %start
%57 = zext i32 %56 to i64
%58 = add nuw nsw i64 %57, 1
%min.iters.check163 = icmp ult i32 %56, 13
br i1 %min.iters.check163, label %for.body.preheader176, label %vector.memcheck158
vector.memcheck158: ; preds = %for.body.preheader
%59 = shl nsw i64 %54, 3
%60 = add i64 %59, %data138
%61 = add i64 %59, %work159
%62 = sub i64 %60, %61
%diff.check160 = icmp ult i64 %62, 32
br i1 %diff.check160, label %for.body.preheader176, label %vector.ph164
vector.ph164: ; preds = %vector.memcheck158
%n.vec166 = and i64 %58, 8589934588
%ind.end167 = add nsw i64 %n.vec166, %54
br label %vector.body170
vector.body170: ; preds = %vector.body170, %vector.ph164
%index171 = phi i64 [ 0, %vector.ph164 ], [ %index.next175, %vector.body170 ]
%offset.idx172 = add i64 %index171, %54
%63 = getelementptr inbounds %struct.a, ptr %data, i64 %offset.idx172
%64 = getelementptr inbounds %struct.a, ptr %work, i64 %offset.idx172
%wide.load173 = load <2 x i64>, ptr %64, align 4
%65 = getelementptr inbounds i64, ptr %64, i64 2
%wide.load174 = load <2 x i64>, ptr %65, align 4
store <2 x i64> %wide.load173, ptr %63, align 4
%66 = getelementptr inbounds i64, ptr %63, i64 2
store <2 x i64> %wide.load174, ptr %66, align 4
%index.next175 = add nuw i64 %index171, 4
%67 = icmp eq i64 %index.next175, %n.vec166
br i1 %67, label %middle.block161, label %vector.body170, !llvm.loop !21
middle.block161: ; preds = %vector.body170
%cmp.n169 = icmp eq i64 %58, %n.vec166
br i1 %cmp.n169, label %for.end, label %for.body.preheader176
for.body.preheader176: ; preds = %vector.memcheck158, %for.body.preheader, %middle.block161
%indvars.iv119.ph = phi i64 [ %54, %vector.memcheck158 ], [ %54, %for.body.preheader ], [ %ind.end167, %middle.block161 ]
%68 = add i32 %end, 1
%69 = trunc i64 %indvars.iv119.ph to i32
%70 = sub i32 %68, %69
%71 = sub i32 %end, %69
%xtraiter183 = and i32 %70, 3
%lcmp.mod184.not = icmp eq i32 %xtraiter183, 0
br i1 %lcmp.mod184.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader176, %for.body.prol
%indvars.iv119.prol = phi i64 [ %indvars.iv.next120.prol, %for.body.prol ], [ %indvars.iv119.ph, %for.body.preheader176 ]
%prol.iter185 = phi i32 [ %prol.iter185.next, %for.body.prol ], [ 0, %for.body.preheader176 ]
%arrayidx43.prol = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv119.prol
%arrayidx45.prol = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv119.prol
%72 = load i64, ptr %arrayidx45.prol, align 4
store i64 %72, ptr %arrayidx43.prol, align 4
%indvars.iv.next120.prol = add nsw i64 %indvars.iv119.prol, 1
%prol.iter185.next = add i32 %prol.iter185, 1
%prol.iter185.cmp.not = icmp eq i32 %prol.iter185.next, %xtraiter183
br i1 %prol.iter185.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !22
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader176
%indvars.iv119.unr = phi i64 [ %indvars.iv119.ph, %for.body.preheader176 ], [ %indvars.iv.next120.prol, %for.body.prol ]
%73 = icmp ult i32 %71, 3
br i1 %73, label %for.end, label %for.body
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv119 = phi i64 [ %indvars.iv.next120.3, %for.body ], [ %indvars.iv119.unr, %for.body.prol.loopexit ]
%arrayidx43 = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv119
%arrayidx45 = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv119
%74 = load i64, ptr %arrayidx45, align 4
store i64 %74, ptr %arrayidx43, align 4
%indvars.iv.next120 = add nsw i64 %indvars.iv119, 1
%arrayidx43.1 = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv.next120
%arrayidx45.1 = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv.next120
%75 = load i64, ptr %arrayidx45.1, align 4
store i64 %75, ptr %arrayidx43.1, align 4
%indvars.iv.next120.1 = add nsw i64 %indvars.iv119, 2
%arrayidx43.2 = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv.next120.1
%arrayidx45.2 = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv.next120.1
%76 = load i64, ptr %arrayidx45.2, align 4
store i64 %76, ptr %arrayidx43.2, align 4
%indvars.iv.next120.2 = add nsw i64 %indvars.iv119, 3
%arrayidx43.3 = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv.next120.2
%arrayidx45.3 = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv.next120.2
%77 = load i64, ptr %arrayidx45.3, align 4
store i64 %77, ptr %arrayidx43.3, align 4
%indvars.iv.next120.3 = add nsw i64 %indvars.iv119, 4
%lftr.wideiv122.3 = trunc i64 %indvars.iv.next120.3 to i32
%exitcond123.not.3 = icmp eq i32 %55, %lftr.wideiv122.3
br i1 %exitcond123.not.3, label %for.end, label %for.body, !llvm.loop !23
for.end: ; preds = %for.body.prol.loopexit, %for.body, %middle.block161, %if.end40
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @margesort(ptr noundef %data, ptr noundef %work, i32 noundef %start, i32 noundef %end) local_unnamed_addr #2 {
entry:
%work51 = ptrtoint ptr %work to i64
%data30 = ptrtoint ptr %data to i64
%work29 = ptrtoint ptr %work to i64
%data23 = ptrtoint ptr %data to i64
%work22 = ptrtoint ptr %work to i64
%cmp = icmp slt i32 %start, %end
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%sub = sub nsw i32 %end, %start
%div = sdiv i32 %sub, 2
%add = add nsw i32 %div, %start
tail call void @margesort(ptr noundef %data, ptr noundef %work, i32 noundef %start, i32 noundef %add)
%add1 = add nsw i32 %add, 1
tail call void @margesort(ptr noundef %data, ptr noundef %work, i32 noundef %add1, i32 noundef %end)
%cmp81.i = icmp sgt i32 %sub, -2
%cmp182.i = icmp slt i32 %add, %end
%0 = and i1 %cmp81.i, %cmp182.i
br i1 %0, label %while.body.preheader.i, label %while.end.i
while.body.preheader.i: ; preds = %if.then
%1 = sext i32 %start to i64
br label %while.body.i
while.body.i: ; preds = %while.body.i, %while.body.preheader.i
%indvars.iv.i = phi i64 [ %1, %while.body.preheader.i ], [ %indvars.iv.next.i, %while.body.i ]
%j.084.i = phi i32 [ %add1, %while.body.preheader.i ], [ %j.1.i, %while.body.i ]
%i.083.i = phi i32 [ %start, %while.body.preheader.i ], [ %i.1.i, %while.body.i ]
%idxprom.i = sext i32 %i.083.i to i64
%deadline.i = getelementptr inbounds %struct.a, ptr %data, i64 %idxprom.i, i32 1
%2 = load i32, ptr %deadline.i, align 4, !tbaa !5
%idxprom2.i = sext i32 %j.084.i to i64
%deadline4.i = getelementptr inbounds %struct.a, ptr %data, i64 %idxprom2.i, i32 1
%3 = load i32, ptr %deadline4.i, align 4, !tbaa !5
%cmp5.not.i = icmp sle i32 %2, %3
%idxprom2.pn.i = select i1 %cmp5.not.i, i64 %idxprom.i, i64 %idxprom2.i
%inc8.i = zext i1 %cmp5.not.i to i32
%i.1.i = add nsw i32 %i.083.i, %inc8.i
%not.cmp5.not.i = xor i1 %cmp5.not.i, true
%inc14.i = zext i1 %not.cmp5.not.i to i32
%j.1.i = add nsw i32 %j.084.i, %inc14.i
%.sink.in.i = getelementptr inbounds %struct.a, ptr %data, i64 %idxprom2.pn.i
%.sink.i = load i64, ptr %.sink.in.i, align 4
%4 = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv.i
store i64 %.sink.i, ptr %4, align 4
%indvars.iv.next.i = add i64 %indvars.iv.i, 1
%cmp.i = icmp sle i32 %i.1.i, %add
%cmp1.i = icmp sle i32 %j.1.i, %end
%5 = select i1 %cmp.i, i1 %cmp1.i, i1 false
br i1 %5, label %while.body.i, label %while.end.loopexit.i, !llvm.loop !10
while.end.loopexit.i: ; preds = %while.body.i
%6 = trunc i64 %indvars.iv.next.i to i32
br i1 %cmp.i, label %while.cond19.preheader.i, label %while.cond30.preheader.i
while.end.i: ; preds = %if.then
br i1 %cmp81.i, label %while.cond19.preheader.i, label %while.cond30.preheader.i
while.cond30.preheader.i: ; preds = %while.end.i, %while.end.loopexit.i
%k.0.lcssa126.i = phi i32 [ %6, %while.end.loopexit.i ], [ %start, %while.end.i ]
%j.0.lcssa125.i = phi i32 [ %j.1.i, %while.end.loopexit.i ], [ %add1, %while.end.i ]
%cmp31.not89.i = icmp sgt i32 %j.0.lcssa125.i, %end
br i1 %cmp31.not89.i, label %for.body.preheader.i, label %while.body32.preheader.i
while.body32.preheader.i: ; preds = %while.cond30.preheader.i
%7 = sext i32 %k.0.lcssa126.i to i64
%8 = sext i32 %j.0.lcssa125.i to i64
%9 = add i32 %end, 1
%10 = sub i32 %end, %j.0.lcssa125.i
%11 = zext i32 %10 to i64
%12 = add nuw nsw i64 %11, 1
%min.iters.check = icmp ult i32 %10, 11
br i1 %min.iters.check, label %while.body32.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %while.body32.preheader.i
%13 = shl nsw i64 %7, 3
%14 = add i64 %13, %work22
%15 = shl nsw i64 %8, 3
%16 = add i64 %15, %data23
%17 = sub i64 %14, %16
%diff.check = icmp ult i64 %17, 32
br i1 %diff.check, label %while.body32.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %12, 8589934588
%ind.end = add nsw i64 %n.vec, %8
%ind.end24 = add nsw i64 %n.vec, %7
%invariant.gep = getelementptr %struct.a, ptr %work, i64 %7
%invariant.gep75 = getelementptr %struct.a, ptr %data, i64 %8
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%gep = getelementptr %struct.a, ptr %invariant.gep, i64 %index
%gep76 = getelementptr %struct.a, ptr %invariant.gep75, i64 %index
%wide.load = load <2 x i64>, ptr %gep76, align 4
%18 = getelementptr inbounds i64, ptr %gep76, i64 2
%wide.load27 = load <2 x i64>, ptr %18, align 4
store <2 x i64> %wide.load, ptr %gep, align 4
%19 = getelementptr inbounds i64, ptr %gep, i64 2
store <2 x i64> %wide.load27, ptr %19, align 4
%index.next = add nuw i64 %index, 4
%20 = icmp eq i64 %index.next, %n.vec
br i1 %20, label %middle.block, label %vector.body, !llvm.loop !24
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %12, %n.vec
br i1 %cmp.n, label %for.body.preheader.i, label %while.body32.i.preheader
while.body32.i.preheader: ; preds = %vector.memcheck, %while.body32.preheader.i, %middle.block
%indvars.iv103.i.ph = phi i64 [ %8, %vector.memcheck ], [ %8, %while.body32.preheader.i ], [ %ind.end, %middle.block ]
%indvars.iv101.i.ph = phi i64 [ %7, %vector.memcheck ], [ %7, %while.body32.preheader.i ], [ %ind.end24, %middle.block ]
%21 = add i32 %end, 1
%22 = trunc i64 %indvars.iv103.i.ph to i32
%23 = sub i32 %21, %22
%24 = sub i32 %end, %22
%xtraiter = and i32 %23, 3
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.body32.i.prol.loopexit, label %while.body32.i.prol
while.body32.i.prol: ; preds = %while.body32.i.preheader, %while.body32.i.prol
%indvars.iv103.i.prol = phi i64 [ %indvars.iv.next104.i.prol, %while.body32.i.prol ], [ %indvars.iv103.i.ph, %while.body32.i.preheader ]
%indvars.iv101.i.prol = phi i64 [ %indvars.iv.next102.i.prol, %while.body32.i.prol ], [ %indvars.iv101.i.ph, %while.body32.i.preheader ]
%prol.iter = phi i32 [ %prol.iter.next, %while.body32.i.prol ], [ 0, %while.body32.i.preheader ]
%indvars.iv.next102.i.prol = add nsw i64 %indvars.iv101.i.prol, 1
%arrayidx35.i.prol = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv101.i.prol
%indvars.iv.next104.i.prol = add nsw i64 %indvars.iv103.i.prol, 1
%arrayidx38.i.prol = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv103.i.prol
%25 = load i64, ptr %arrayidx38.i.prol, align 4
store i64 %25, ptr %arrayidx35.i.prol, align 4
%prol.iter.next = add i32 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %while.body32.i.prol.loopexit, label %while.body32.i.prol, !llvm.loop !25
while.body32.i.prol.loopexit: ; preds = %while.body32.i.prol, %while.body32.i.preheader
%indvars.iv103.i.unr = phi i64 [ %indvars.iv103.i.ph, %while.body32.i.preheader ], [ %indvars.iv.next104.i.prol, %while.body32.i.prol ]
%indvars.iv101.i.unr = phi i64 [ %indvars.iv101.i.ph, %while.body32.i.preheader ], [ %indvars.iv.next102.i.prol, %while.body32.i.prol ]
%26 = icmp ult i32 %24, 3
br i1 %26, label %for.body.preheader.i, label %while.body32.i.preheader.new
while.body32.i.preheader.new: ; preds = %while.body32.i.prol.loopexit
%invariant.gep77 = getelementptr %struct.a, ptr %work, i64 1
%invariant.gep79 = getelementptr %struct.a, ptr %data, i64 1
%invariant.gep81 = getelementptr %struct.a, ptr %work, i64 2
%invariant.gep83 = getelementptr %struct.a, ptr %data, i64 2
%invariant.gep85 = getelementptr %struct.a, ptr %work, i64 3
%invariant.gep87 = getelementptr %struct.a, ptr %data, i64 3
br label %while.body32.i
while.cond19.preheader.i: ; preds = %while.end.i, %while.end.loopexit.i
%k.0.lcssa127.i = phi i32 [ %6, %while.end.loopexit.i ], [ %start, %while.end.i ]
%i.0.lcssa124.i = phi i32 [ %i.1.i, %while.end.loopexit.i ], [ %start, %while.end.i ]
%cmp20.not92.i = icmp sgt i32 %i.0.lcssa124.i, %add
br i1 %cmp20.not92.i, label %for.body.preheader.i, label %while.body21.preheader.i
while.body21.preheader.i: ; preds = %while.cond19.preheader.i
%27 = sext i32 %k.0.lcssa127.i to i64
%28 = sext i32 %i.0.lcssa124.i to i64
%29 = add i32 %div, %start
%30 = sub i32 %29, %i.0.lcssa124.i
%31 = zext i32 %30 to i64
%32 = add nuw nsw i64 %31, 1
%min.iters.check34 = icmp ult i32 %30, 11
br i1 %min.iters.check34, label %while.body21.i.preheader, label %vector.memcheck28
vector.memcheck28: ; preds = %while.body21.preheader.i
%33 = shl nsw i64 %27, 3
%34 = add i64 %33, %work29
%35 = shl nsw i64 %28, 3
%36 = add i64 %35, %data30
%37 = sub i64 %34, %36
%diff.check31 = icmp ult i64 %37, 32
br i1 %diff.check31, label %while.body21.i.preheader, label %vector.ph35
vector.ph35: ; preds = %vector.memcheck28
%n.vec37 = and i64 %32, 8589934588
%ind.end38 = add nsw i64 %n.vec37, %28
%ind.end40 = add nsw i64 %n.vec37, %27
%invariant.gep89 = getelementptr %struct.a, ptr %work, i64 %27
%invariant.gep91 = getelementptr %struct.a, ptr %data, i64 %28
br label %vector.body43
vector.body43: ; preds = %vector.body43, %vector.ph35
%index44 = phi i64 [ 0, %vector.ph35 ], [ %index.next49, %vector.body43 ]
%gep90 = getelementptr %struct.a, ptr %invariant.gep89, i64 %index44
%gep92 = getelementptr %struct.a, ptr %invariant.gep91, i64 %index44
%wide.load47 = load <2 x i64>, ptr %gep92, align 4
%38 = getelementptr inbounds i64, ptr %gep92, i64 2
%wide.load48 = load <2 x i64>, ptr %38, align 4
store <2 x i64> %wide.load47, ptr %gep90, align 4
%39 = getelementptr inbounds i64, ptr %gep90, i64 2
store <2 x i64> %wide.load48, ptr %39, align 4
%index.next49 = add nuw i64 %index44, 4
%40 = icmp eq i64 %index.next49, %n.vec37
br i1 %40, label %middle.block32, label %vector.body43, !llvm.loop !26
middle.block32: ; preds = %vector.body43
%cmp.n42 = icmp eq i64 %32, %n.vec37
br i1 %cmp.n42, label %for.body.preheader.i, label %while.body21.i.preheader
while.body21.i.preheader: ; preds = %vector.memcheck28, %while.body21.preheader.i, %middle.block32
%indvars.iv111.i.ph = phi i64 [ %28, %vector.memcheck28 ], [ %28, %while.body21.preheader.i ], [ %ind.end38, %middle.block32 ]
%indvars.iv109.i.ph = phi i64 [ %27, %vector.memcheck28 ], [ %27, %while.body21.preheader.i ], [ %ind.end40, %middle.block32 ]
%41 = add i32 %div, %start
%42 = add i32 %41, 1
%43 = trunc i64 %indvars.iv111.i.ph to i32
%44 = sub i32 %42, %43
%45 = sub i32 %41, %43
%xtraiter69 = and i32 %44, 3
%lcmp.mod70.not = icmp eq i32 %xtraiter69, 0
br i1 %lcmp.mod70.not, label %while.body21.i.prol.loopexit, label %while.body21.i.prol
while.body21.i.prol: ; preds = %while.body21.i.preheader, %while.body21.i.prol
%indvars.iv111.i.prol = phi i64 [ %indvars.iv.next112.i.prol, %while.body21.i.prol ], [ %indvars.iv111.i.ph, %while.body21.i.preheader ]
%indvars.iv109.i.prol = phi i64 [ %indvars.iv.next110.i.prol, %while.body21.i.prol ], [ %indvars.iv109.i.ph, %while.body21.i.preheader ]
%prol.iter71 = phi i32 [ %prol.iter71.next, %while.body21.i.prol ], [ 0, %while.body21.i.preheader ]
%indvars.iv.next110.i.prol = add nsw i64 %indvars.iv109.i.prol, 1
%arrayidx24.i.prol = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv109.i.prol
%indvars.iv.next112.i.prol = add nsw i64 %indvars.iv111.i.prol, 1
%arrayidx27.i.prol = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv111.i.prol
%46 = load i64, ptr %arrayidx27.i.prol, align 4
store i64 %46, ptr %arrayidx24.i.prol, align 4
%prol.iter71.next = add i32 %prol.iter71, 1
%prol.iter71.cmp.not = icmp eq i32 %prol.iter71.next, %xtraiter69
br i1 %prol.iter71.cmp.not, label %while.body21.i.prol.loopexit, label %while.body21.i.prol, !llvm.loop !27
while.body21.i.prol.loopexit: ; preds = %while.body21.i.prol, %while.body21.i.preheader
%indvars.iv111.i.unr = phi i64 [ %indvars.iv111.i.ph, %while.body21.i.preheader ], [ %indvars.iv.next112.i.prol, %while.body21.i.prol ]
%indvars.iv109.i.unr = phi i64 [ %indvars.iv109.i.ph, %while.body21.i.preheader ], [ %indvars.iv.next110.i.prol, %while.body21.i.prol ]
%47 = icmp ult i32 %45, 3
br i1 %47, label %for.body.preheader.i, label %while.body21.i.preheader.new
while.body21.i.preheader.new: ; preds = %while.body21.i.prol.loopexit
%invariant.gep93 = getelementptr %struct.a, ptr %work, i64 1
%invariant.gep95 = getelementptr %struct.a, ptr %data, i64 1
%invariant.gep97 = getelementptr %struct.a, ptr %work, i64 2
%invariant.gep99 = getelementptr %struct.a, ptr %data, i64 2
%invariant.gep101 = getelementptr %struct.a, ptr %work, i64 3
%invariant.gep103 = getelementptr %struct.a, ptr %data, i64 3
br label %while.body21.i
while.body21.i: ; preds = %while.body21.i, %while.body21.i.preheader.new
%indvars.iv111.i = phi i64 [ %indvars.iv111.i.unr, %while.body21.i.preheader.new ], [ %indvars.iv.next112.i.3, %while.body21.i ]
%indvars.iv109.i = phi i64 [ %indvars.iv109.i.unr, %while.body21.i.preheader.new ], [ %indvars.iv.next110.i.3, %while.body21.i ]
%arrayidx24.i = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv109.i
%arrayidx27.i = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv111.i
%48 = load i64, ptr %arrayidx27.i, align 4
store i64 %48, ptr %arrayidx24.i, align 4
%gep94 = getelementptr %struct.a, ptr %invariant.gep93, i64 %indvars.iv109.i
%gep96 = getelementptr %struct.a, ptr %invariant.gep95, i64 %indvars.iv111.i
%49 = load i64, ptr %gep96, align 4
store i64 %49, ptr %gep94, align 4
%gep98 = getelementptr %struct.a, ptr %invariant.gep97, i64 %indvars.iv109.i
%gep100 = getelementptr %struct.a, ptr %invariant.gep99, i64 %indvars.iv111.i
%50 = load i64, ptr %gep100, align 4
store i64 %50, ptr %gep98, align 4
%indvars.iv.next110.i.3 = add nsw i64 %indvars.iv109.i, 4
%gep102 = getelementptr %struct.a, ptr %invariant.gep101, i64 %indvars.iv109.i
%indvars.iv.next112.i.3 = add nsw i64 %indvars.iv111.i, 4
%gep104 = getelementptr %struct.a, ptr %invariant.gep103, i64 %indvars.iv111.i
%51 = load i64, ptr %gep104, align 4
store i64 %51, ptr %gep102, align 4
%lftr.wideiv116.i.3 = trunc i64 %indvars.iv.next112.i.3 to i32
%exitcond117.not.i.3 = icmp eq i32 %add1, %lftr.wideiv116.i.3
br i1 %exitcond117.not.i.3, label %for.body.preheader.i, label %while.body21.i, !llvm.loop !28
while.body32.i: ; preds = %while.body32.i, %while.body32.i.preheader.new
%indvars.iv103.i = phi i64 [ %indvars.iv103.i.unr, %while.body32.i.preheader.new ], [ %indvars.iv.next104.i.3, %while.body32.i ]
%indvars.iv101.i = phi i64 [ %indvars.iv101.i.unr, %while.body32.i.preheader.new ], [ %indvars.iv.next102.i.3, %while.body32.i ]
%arrayidx35.i = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv101.i
%arrayidx38.i = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv103.i
%52 = load i64, ptr %arrayidx38.i, align 4
store i64 %52, ptr %arrayidx35.i, align 4
%gep78 = getelementptr %struct.a, ptr %invariant.gep77, i64 %indvars.iv101.i
%gep80 = getelementptr %struct.a, ptr %invariant.gep79, i64 %indvars.iv103.i
%53 = load i64, ptr %gep80, align 4
store i64 %53, ptr %gep78, align 4
%gep82 = getelementptr %struct.a, ptr %invariant.gep81, i64 %indvars.iv101.i
%gep84 = getelementptr %struct.a, ptr %invariant.gep83, i64 %indvars.iv103.i
%54 = load i64, ptr %gep84, align 4
store i64 %54, ptr %gep82, align 4
%indvars.iv.next102.i.3 = add nsw i64 %indvars.iv101.i, 4
%gep86 = getelementptr %struct.a, ptr %invariant.gep85, i64 %indvars.iv101.i
%indvars.iv.next104.i.3 = add nsw i64 %indvars.iv103.i, 4
%gep88 = getelementptr %struct.a, ptr %invariant.gep87, i64 %indvars.iv103.i
%55 = load i64, ptr %gep88, align 4
store i64 %55, ptr %gep86, align 4
%lftr.wideiv.i.3 = trunc i64 %indvars.iv.next104.i.3 to i32
%exitcond.not.i.3 = icmp eq i32 %9, %lftr.wideiv.i.3
br i1 %exitcond.not.i.3, label %for.body.preheader.i, label %while.body32.i, !llvm.loop !29
for.body.preheader.i: ; preds = %while.body32.i.prol.loopexit, %while.body32.i, %while.body21.i.prol.loopexit, %while.body21.i, %middle.block, %middle.block32, %while.cond30.preheader.i, %while.cond19.preheader.i
%56 = sext i32 %start to i64
%57 = add i32 %end, 1
%58 = zext i32 %sub to i64
%59 = add nuw nsw i64 %58, 1
%min.iters.check55 = icmp ult i32 %sub, 13
br i1 %min.iters.check55, label %for.body.i.preheader, label %vector.memcheck50
vector.memcheck50: ; preds = %for.body.preheader.i
%60 = shl nsw i64 %56, 3
%61 = add i64 %60, %data30
%62 = add i64 %60, %work51
%63 = sub i64 %61, %62
%diff.check52 = icmp ult i64 %63, 32
br i1 %diff.check52, label %for.body.i.preheader, label %vector.ph56
vector.ph56: ; preds = %vector.memcheck50
%n.vec58 = and i64 %59, 8589934588
%ind.end59 = add nsw i64 %n.vec58, %56
br label %vector.body62
vector.body62: ; preds = %vector.body62, %vector.ph56
%index63 = phi i64 [ 0, %vector.ph56 ], [ %index.next67, %vector.body62 ]
%offset.idx64 = add i64 %index63, %56
%64 = getelementptr inbounds %struct.a, ptr %data, i64 %offset.idx64
%65 = getelementptr inbounds %struct.a, ptr %work, i64 %offset.idx64
%wide.load65 = load <2 x i64>, ptr %65, align 4
%66 = getelementptr inbounds i64, ptr %65, i64 2
%wide.load66 = load <2 x i64>, ptr %66, align 4
store <2 x i64> %wide.load65, ptr %64, align 4
%67 = getelementptr inbounds i64, ptr %64, i64 2
store <2 x i64> %wide.load66, ptr %67, align 4
%index.next67 = add nuw i64 %index63, 4
%68 = icmp eq i64 %index.next67, %n.vec58
br i1 %68, label %middle.block53, label %vector.body62, !llvm.loop !30
middle.block53: ; preds = %vector.body62
%cmp.n61 = icmp eq i64 %59, %n.vec58
br i1 %cmp.n61, label %if.end, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck50, %for.body.preheader.i, %middle.block53
%indvars.iv119.i.ph = phi i64 [ %56, %vector.memcheck50 ], [ %56, %for.body.preheader.i ], [ %ind.end59, %middle.block53 ]
%69 = add i32 %end, 1
%70 = trunc i64 %indvars.iv119.i.ph to i32
%71 = sub i32 %69, %70
%72 = sub i32 %end, %70
%xtraiter72 = and i32 %71, 3
%lcmp.mod73.not = icmp eq i32 %xtraiter72, 0
br i1 %lcmp.mod73.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv119.i.prol = phi i64 [ %indvars.iv.next120.i.prol, %for.body.i.prol ], [ %indvars.iv119.i.ph, %for.body.i.preheader ]
%prol.iter74 = phi i32 [ %prol.iter74.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%arrayidx43.i.prol = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv119.i.prol
%arrayidx45.i.prol = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv119.i.prol
%73 = load i64, ptr %arrayidx45.i.prol, align 4
store i64 %73, ptr %arrayidx43.i.prol, align 4
%indvars.iv.next120.i.prol = add nsw i64 %indvars.iv119.i.prol, 1
%prol.iter74.next = add i32 %prol.iter74, 1
%prol.iter74.cmp.not = icmp eq i32 %prol.iter74.next, %xtraiter72
br i1 %prol.iter74.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !31
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv119.i.unr = phi i64 [ %indvars.iv119.i.ph, %for.body.i.preheader ], [ %indvars.iv.next120.i.prol, %for.body.i.prol ]
%74 = icmp ult i32 %72, 3
br i1 %74, label %if.end, label %for.body.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv119.i = phi i64 [ %indvars.iv.next120.i.3, %for.body.i ], [ %indvars.iv119.i.unr, %for.body.i.prol.loopexit ]
%arrayidx43.i = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv119.i
%arrayidx45.i = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv119.i
%75 = load i64, ptr %arrayidx45.i, align 4
store i64 %75, ptr %arrayidx43.i, align 4
%indvars.iv.next120.i = add nsw i64 %indvars.iv119.i, 1
%arrayidx43.i.1 = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv.next120.i
%arrayidx45.i.1 = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv.next120.i
%76 = load i64, ptr %arrayidx45.i.1, align 4
store i64 %76, ptr %arrayidx43.i.1, align 4
%indvars.iv.next120.i.1 = add nsw i64 %indvars.iv119.i, 2
%arrayidx43.i.2 = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv.next120.i.1
%arrayidx45.i.2 = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv.next120.i.1
%77 = load i64, ptr %arrayidx45.i.2, align 4
store i64 %77, ptr %arrayidx43.i.2, align 4
%indvars.iv.next120.i.2 = add nsw i64 %indvars.iv119.i, 3
%arrayidx43.i.3 = getelementptr inbounds %struct.a, ptr %data, i64 %indvars.iv.next120.i.2
%arrayidx45.i.3 = getelementptr inbounds %struct.a, ptr %work, i64 %indvars.iv.next120.i.2
%78 = load i64, ptr %arrayidx45.i.3, align 4
store i64 %78, ptr %arrayidx43.i.3, align 4
%indvars.iv.next120.i.3 = add nsw i64 %indvars.iv119.i, 4
%lftr.wideiv122.i.3 = trunc i64 %indvars.iv.next120.i.3 to i32
%exitcond123.not.i.3 = icmp eq i32 %57, %lftr.wideiv122.i.3
br i1 %exitcond123.not.i.3, label %if.end, label %for.body.i, !llvm.loop !32
if.end: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block53, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%data = alloca [200000 x %struct.a], align 16
%tmp = alloca [200000 x %struct.a], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 1600000, ptr nonnull %data) #5
call void @llvm.lifetime.start.p0(i64 1600000, ptr nonnull %tmp) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !33
%cmp35 = icmp sgt i32 %0, 0
br i1 %cmp35, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
%sub48 = add nsw i32 %0, -1
call void @margesort(ptr noundef nonnull %data, ptr noundef nonnull %tmp, i32 noundef 0, i32 noundef %sub48)
br label %for.end19
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 x %struct.a], ptr %data, i64 0, i64 %indvars.iv
%deadline = getelementptr inbounds [200000 x %struct.a], ptr %data, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %deadline)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !33
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !34
for.end: ; preds = %for.body
%sub = add nsw i32 %1, -1
call void @margesort(ptr noundef nonnull %data, ptr noundef nonnull %tmp, i32 noundef 0, i32 noundef %sub)
%cmp637 = icmp sgt i32 %1, 0
br i1 %cmp637, label %for.body7.preheader, label %for.end19
for.body7.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %1 to i64
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.inc17
%indvars.iv44 = phi i64 [ 0, %for.body7.preheader ], [ %indvars.iv.next45, %for.inc17 ]
%costsum.038 = phi i64 [ 0, %for.body7.preheader ], [ %add, %for.inc17 ]
%arrayidx9 = getelementptr inbounds [200000 x %struct.a], ptr %data, i64 0, i64 %indvars.iv44
%3 = load i32, ptr %arrayidx9, align 8, !tbaa !35
%conv = sext i32 %3 to i64
%add = add nsw i64 %costsum.038, %conv
%deadline13 = getelementptr inbounds [200000 x %struct.a], ptr %data, i64 0, i64 %indvars.iv44, i32 1
%4 = load i32, ptr %deadline13, align 4, !tbaa !5
%conv14 = sext i32 %4 to i64
%cmp15 = icmp sgt i64 %add, %conv14
br i1 %cmp15, label %for.end19.loopexit, label %for.inc17
for.inc17: ; preds = %for.body7
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%exitcond.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count
br i1 %exitcond.not, label %if.end25, label %for.body7, !llvm.loop !36
for.end19.loopexit: ; preds = %for.body7
%5 = trunc i64 %indvars.iv44 to i32
br label %for.end19
for.end19: ; preds = %for.end19.loopexit, %for.end.thread, %for.end
%.lcssa50 = phi i32 [ %1, %for.end ], [ %0, %for.end.thread ], [ %1, %for.end19.loopexit ]
%i.1.lcssa = phi i32 [ 0, %for.end ], [ 0, %for.end.thread ], [ %5, %for.end19.loopexit ]
%cmp20 = icmp eq i32 %i.1.lcssa, %.lcssa50
%spec.select = select i1 %cmp20, ptr @.str.2, ptr @.str.3
br label %if.end25
if.end25: ; preds = %for.inc17, %for.end19
%.str.3.sink = phi ptr [ %spec.select, %for.end19 ], [ @.str.2, %for.inc17 ]
%call24 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 1600000, ptr nonnull %tmp) #5
call void @llvm.lifetime.end.p0(i64 1600000, ptr nonnull %data) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 4}
!6 = !{!"a", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !11, !13, !14}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !11, !13}
!20 = distinct !{!20, !11, !13}
!21 = distinct !{!21, !11, !13, !14}
!22 = distinct !{!22, !16}
!23 = distinct !{!23, !11, !13}
!24 = distinct !{!24, !11, !13, !14}
!25 = distinct !{!25, !16}
!26 = distinct !{!26, !11, !13, !14}
!27 = distinct !{!27, !16}
!28 = distinct !{!28, !11, !13}
!29 = distinct !{!29, !11, !13}
!30 = distinct !{!30, !11, !13, !14}
!31 = distinct !{!31, !16}
!32 = distinct !{!32, !11, !13}
!33 = !{!7, !7, i64 0}
!34 = distinct !{!34, !11}
!35 = !{!6, !7, i64 0}
!36 = distinct !{!36, !11}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
long int A, B, N;
double LOG;
scanf("%ld", &N);
LOG = log10(N);
long int sum = 0;
while (N != 0) {
if (LOG == (int)LOG){
sum = 10;
break;
}
sum += N % 10;
N = N/10;
}
printf("%ld\n", sum);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163047/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163047/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !5
%conv = sitofp i64 %0 to double
%call1 = call double @log10(double noundef %conv) #4
%.pr = load i64, ptr %N, align 8, !tbaa !5
%cmp.not10 = icmp eq i64 %.pr, 0
br i1 %cmp.not10, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%conv3 = fptosi double %call1 to i32
%conv4 = sitofp i32 %conv3 to double
%cmp5 = fcmp oeq double %call1, %conv4
br i1 %cmp5, label %while.end, label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%sum.011 = phi i64 [ %add, %while.body ], [ 0, %while.body.lr.ph ]
%1 = phi i64 [ %div, %while.body ], [ %.pr, %while.body.lr.ph ]
%rem = srem i64 %1, 10
%add = add nsw i64 %sum.011, %rem
%div = sdiv i64 %1, 10
%.off = add i64 %1, 9
%cmp.not = icmp ult i64 %.off, 19
br i1 %cmp.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i64 %div, ptr %N, align 8, !tbaa !5
br label %while.end
while.end: ; preds = %while.body.lr.ph, %while.cond.while.end_crit_edge, %entry
%sum.1 = phi i64 [ %add, %while.cond.while.end_crit_edge ], [ 0, %entry ], [ 10, %while.body.lr.ph ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sum.1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @log10(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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 digit_sum(int x) {
int sum=0;
while(x>0) {
sum += x%10;
x /= 10;
}
return sum;
}
int main(void) {
int n, i, j, min=45;
scanf("%d", &n);
for(i=n-1; i>0; i--) {
j = n-i;
if(digit_sum(i)+digit_sum(j)<min)
min = digit_sum(i)+digit_sum(j);
}
printf("%d\n", min);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163098/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163098/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @digit_sum(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp4 = icmp sgt i32 %x, 0
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%sum.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = urem i32 %x.addr.05, 10
%add = add nuw nsw i32 %sum.06, %rem
%div = udiv i32 %x.addr.05, 10
%cmp.not = icmp ult i32 %x.addr.05, 10
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp46 = icmp sgt i32 %0, 1
br i1 %cmp46, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.048.in = phi i32 [ %i.048, %for.inc ], [ %0, %entry ]
%min.047 = phi i32 [ %min.1, %for.inc ], [ 45, %entry ]
%i.048 = add nsw i32 %i.048.in, -1
br label %while.body.i
while.body.i: ; preds = %for.body, %while.body.i
%sum.06.i = phi i32 [ %add.i, %while.body.i ], [ 0, %for.body ]
%x.addr.05.i = phi i32 [ %div.i, %while.body.i ], [ %i.048, %for.body ]
%rem.i = urem i32 %x.addr.05.i, 10
%add.i = add nuw nsw i32 %rem.i, %sum.06.i
%div.i = udiv i32 %x.addr.05.i, 10
%cmp.not.i = icmp ult i32 %x.addr.05.i, 10
br i1 %cmp.not.i, label %while.body.i17.preheader, label %while.body.i, !llvm.loop !5
while.body.i17.preheader: ; preds = %while.body.i
%sub1 = sub nsw i32 %0, %i.048
br label %while.body.i17
while.body.i17: ; preds = %while.body.i17.preheader, %while.body.i17
%sum.06.i18 = phi i32 [ %add.i21, %while.body.i17 ], [ 0, %while.body.i17.preheader ]
%x.addr.05.i19 = phi i32 [ %div.i22, %while.body.i17 ], [ %sub1, %while.body.i17.preheader ]
%rem.i20 = urem i32 %x.addr.05.i19, 10
%add.i21 = add nuw nsw i32 %rem.i20, %sum.06.i18
%div.i22 = udiv i32 %x.addr.05.i19, 10
%cmp.not.i23 = icmp ult i32 %x.addr.05.i19, 10
br i1 %cmp.not.i23, label %digit_sum.exit24, label %while.body.i17, !llvm.loop !5
digit_sum.exit24: ; preds = %while.body.i17
%add = add nuw nsw i32 %add.i21, %add.i
%cmp4 = icmp slt i32 %add, %min.047
br i1 %cmp4, label %while.body.i27, label %for.inc
while.body.i27: ; preds = %digit_sum.exit24, %while.body.i27
%sum.06.i28 = phi i32 [ %add.i31, %while.body.i27 ], [ 0, %digit_sum.exit24 ]
%x.addr.05.i29 = phi i32 [ %div.i32, %while.body.i27 ], [ %i.048, %digit_sum.exit24 ]
%rem.i30 = urem i32 %x.addr.05.i29, 10
%add.i31 = add nuw nsw i32 %rem.i30, %sum.06.i28
%div.i32 = udiv i32 %x.addr.05.i29, 10
%cmp.not.i33 = icmp ult i32 %x.addr.05.i29, 10
br i1 %cmp.not.i33, label %while.body.i37, label %while.body.i27, !llvm.loop !5
while.body.i37: ; preds = %while.body.i27, %while.body.i37
%sum.06.i38 = phi i32 [ %add.i41, %while.body.i37 ], [ 0, %while.body.i27 ]
%x.addr.05.i39 = phi i32 [ %div.i42, %while.body.i37 ], [ %sub1, %while.body.i27 ]
%rem.i40 = urem i32 %x.addr.05.i39, 10
%add.i41 = add nuw nsw i32 %rem.i40, %sum.06.i38
%div.i42 = udiv i32 %x.addr.05.i39, 10
%cmp.not.i43 = icmp ult i32 %x.addr.05.i39, 10
br i1 %cmp.not.i43, label %digit_sum.exit44, label %while.body.i37, !llvm.loop !5
digit_sum.exit44: ; preds = %while.body.i37
%add7 = add nuw nsw i32 %add.i41, %add.i31
br label %for.inc
for.inc: ; preds = %digit_sum.exit24, %digit_sum.exit44
%min.1 = phi i32 [ %add7, %digit_sum.exit44 ], [ %min.047, %digit_sum.exit24 ]
%cmp = icmp sgt i32 %i.048.in, 2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.inc, %entry
%min.0.lcssa = phi i32 [ 45, %entry ], [ %min.1, %for.inc ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!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>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#define SIZE 100005
#define PI acosl(-1) //3.14159265358979323846264338327950L
#define rep(i, N) for (i = 0; i < N; i++) //制御変数iを用いてN回転
#define array(N, t) (t*)calloc(N, sizeof(t)) //t型N要素の1次元配列を動的確保後0クリア(freeを忘れずに)
#define zero(a); {int iter; rep(iter, sizeof(a)/sizeof((a)[0])) (a)[iter]=0;} //1次元配列aのゼロ初期化?
#define Sort(a, t) qsort(a, sizeof(a)/sizeof((a)[0]), sizeof(t), comp) //compを使って1次元配列をソート
typedef long long ll; typedef long double ld;
typedef struct node { int data; struct node *next; } Node;
Node *list[SIZE];
int queue[SIZE]; int q_head = 0, q_tail = 0;
void print_log(); //とりあえず文字を出力してどこまで実行できているか確認(for debug)
void printa_int(int *a, int size); //int型の1次元配列aを出力(for debug)
void printl_int(int size); //リンクリストを出力(for debug)
int comp(const void *a, const void *b); //昇順並び替えに使う比較関数
Node* add_node(int i, int data); void free_list(Node* head);
int queue_empty(); int queue_full();
void enqueue(int data); int dequeue();
ll* factorize(ll N); //Nを素因数分解、得られる配列は素因数,指数,素因数,…となっている(添字はintで指定する必要あり?)
void check_factorization(ll *fact); //素因数分解を表示(for debug)
int main() {
int X;
scanf("%d", &X);
printf("%d\n", 10 - X / 200);
return 0;
}
void print_log() {
printf("=== print log ===\n");
}
void printa_int(int *a, int size) {
int i;
printf("[");
for (i = 0; i < size; i++)
printf("%d, ", a[i]);
printf("]\n");
}
void printl_int(int size) {
int i;
Node *t;
rep(i, size) {
printf("[%d] ", i);
for (t = list[i]; t; t = t->next) printf("%d, ", t->data);
printf("\n");
}
}
int comp(const void *a, const void *b) {
return *(int*)a - *(int*)b;
}
Node* add_node(int i, int data) {
if (!list[i]) {
list[i] = (Node*)malloc(sizeof(Node*));
list[i]->data = data;
} else {
Node *t;
t = list[i];
list[i] = (Node*)malloc(sizeof(Node*));
list[i]->data = data;
list[i]->next = t;
}
return list[i];
}
void free_list(Node* head) {
Node *prev = NULL, *t = head;
while (t) {
prev = t;
t = t->next;
free(prev);
}
}
int queue_empty() {
return q_head == q_tail;
}
int queue_full() {
return (q_head - 1) % SIZE == q_tail % SIZE;
}
void enqueue(int data) {
if (queue_full()) {
printf("full!\n");
return;
}
queue[q_tail++] = data;
q_tail %= SIZE;
}
int dequeue() {
if (queue_empty()) {
printf("empty!\n");
return -444444;
}
int data = queue[q_head++];
q_head %= SIZE;
return data;
}
ll* factorize(ll N) {
ll *res = array(((sqrt(N) + 1) * 2), ll);
ll i, x = N;
int count = 0;
for (i = 2; i * i <= N; i++) {
ll e = 0;
while (x % i == 0) {
x /= i;
e++;
}
if (e > 0) {
res[count * 2] = i;
res[count * 2 + 1] = e;
count++;
}
}
if (x > 1) {
res[count * 2] = x;
res[count * 2 + 1] = 1;
}
return res;
}
void check_factorization(ll *fact) {
int i = 1;
printf("%lld^%lld", fact[0], fact[1]);
while (fact[i * 2] > 0) {
printf(" * %lld^%lld", fact[i * 2], fact[i * 2 + 1]);
i++;
}
printf("\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163148/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163148/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.node = type { i32, ptr }
@q_head = dso_local local_unnamed_addr global i32 0, align 4
@q_tail = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"%d, \00", align 1
@.str.6 = private unnamed_addr constant [6 x i8] c"[%d] \00", align 1
@list = dso_local local_unnamed_addr global [100005 x ptr] zeroinitializer, align 16
@queue = dso_local local_unnamed_addr global [100005 x i32] zeroinitializer, align 16
@.str.10 = private unnamed_addr constant [10 x i8] c"%lld^%lld\00", align 1
@.str.11 = private unnamed_addr constant [13 x i8] c" * %lld^%lld\00", align 1
@str = private unnamed_addr constant [18 x i8] c"=== print log ===\00", align 1
@str.12 = private unnamed_addr constant [2 x i8] c"]\00", align 1
@str.13 = private unnamed_addr constant [6 x i8] c"full!\00", align 1
@str.14 = private unnamed_addr constant [7 x i8] c"empty!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%X = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #13
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X)
%0 = load i32, ptr %X, align 4, !tbaa !5
%div.neg = sdiv i32 %0, -200
%sub = add nsw i32 %div.neg, 10
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #13
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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 uwtable
define dso_local void @print_log() local_unnamed_addr #0 {
entry:
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @printa_int(ptr nocapture noundef readonly %a, i32 noundef %size) local_unnamed_addr #0 {
entry:
%putchar = tail call i32 @putchar(i32 91)
%cmp5 = icmp sgt i32 %size, 0
br i1 %cmp5, 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 %a, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.12)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @printl_int(i32 noundef %size) local_unnamed_addr #0 {
entry:
%cmp15 = icmp sgt i32 %size, 0
br i1 %cmp15, label %for.body.preheader, label %for.end6
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %size to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.end ]
%0 = trunc i64 %indvars.iv to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %0)
%arrayidx = getelementptr inbounds [100005 x ptr], ptr @list, i64 0, i64 %indvars.iv
%t.012 = load ptr, ptr %arrayidx, align 8, !tbaa !11
%tobool.not13 = icmp eq ptr %t.012, null
br i1 %tobool.not13, label %for.end, label %for.body2
for.body2: ; preds = %for.body, %for.body2
%t.014 = phi ptr [ %t.0, %for.body2 ], [ %t.012, %for.body ]
%1 = load i32, ptr %t.014, align 8, !tbaa !13
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %1)
%next = getelementptr inbounds %struct.node, ptr %t.014, i64 0, i32 1
%t.0 = load ptr, ptr %next, align 8, !tbaa !11
%tobool.not = icmp eq ptr %t.0, null
br i1 %tobool.not, label %for.end, label %for.body2, !llvm.loop !15
for.end: ; preds = %for.body2, %for.body
%putchar = tail call i32 @putchar(i32 10)
%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.end6, label %for.body, !llvm.loop !16
for.end6: ; preds = %for.end, %entry
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(readwrite, argmem: none) uwtable
define dso_local ptr @add_node(i32 noundef %i, i32 noundef %data) local_unnamed_addr #4 {
entry:
%idxprom = sext i32 %i to i64
%arrayidx = getelementptr inbounds [100005 x ptr], ptr @list, i64 0, i64 %idxprom
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !11
%tobool.not = icmp eq ptr %0, null
%call = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #14
br i1 %tobool.not, label %if.then, label %if.else
if.then: ; preds = %entry
store i32 %data, ptr %call, align 8, !tbaa !13
br label %if.end
if.else: ; preds = %entry
%next = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1
store ptr %0, ptr %next, align 8, !tbaa !17
br label %if.end
if.end: ; preds = %if.else, %if.then
store ptr %call, ptr %arrayidx, align 8
ret ptr %call
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5
; Function Attrs: nounwind uwtable
define dso_local void @free_list(ptr noundef %head) local_unnamed_addr #6 {
entry:
%tobool.not3 = icmp eq ptr %head, null
br i1 %tobool.not3, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%t.04 = phi ptr [ %0, %while.body ], [ %head, %entry ]
%next = getelementptr inbounds %struct.node, ptr %t.04, i64 0, i32 1
%0 = load ptr, ptr %next, align 8, !tbaa !17
tail call void @free(ptr noundef nonnull %t.04) #13
%tobool.not = icmp eq ptr %0, null
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %while.body, %entry
ret void
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @queue_empty() local_unnamed_addr #8 {
entry:
%0 = load i32, ptr @q_head, align 4, !tbaa !5
%1 = load i32, ptr @q_tail, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @queue_full() local_unnamed_addr #8 {
entry:
%0 = load i32, ptr @q_head, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%rem = srem i32 %sub, 100005
%1 = load i32, ptr @q_tail, align 4, !tbaa !5
%rem1 = srem i32 %1, 100005
%cmp = icmp eq i32 %rem, %rem1
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @enqueue(i32 noundef %data) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @q_head, align 4, !tbaa !5
%sub.i = add nsw i32 %0, -1
%rem.i = srem i32 %sub.i, 100005
%1 = load i32, ptr @q_tail, align 4, !tbaa !5
%rem1.i = srem i32 %1, 100005
%cmp.i.not = icmp eq i32 %rem.i, %rem1.i
br i1 %cmp.i.not, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.13)
br label %return
if.end: ; preds = %entry
%inc = add nsw i32 %1, 1
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [100005 x i32], ptr @queue, i64 0, i64 %idxprom
store i32 %data, ptr %arrayidx, align 4, !tbaa !5
%rem = srem i32 %inc, 100005
store i32 %rem, ptr @q_tail, align 4, !tbaa !5
br label %return
return: ; preds = %if.end, %if.then
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @dequeue() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @q_head, align 4, !tbaa !5
%1 = load i32, ptr @q_tail, align 4, !tbaa !5
%cmp.i.not = icmp eq i32 %0, %1
br i1 %cmp.i.not, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.14)
br label %return
if.end: ; preds = %entry
%inc = add nsw i32 %0, 1
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x i32], ptr @queue, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%rem = srem i32 %inc, 100005
store i32 %rem, ptr @q_head, align 4, !tbaa !5
br label %return
return: ; preds = %if.end, %if.then
%retval.0 = phi i32 [ -444444, %if.then ], [ %2, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(write, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @factorize(i64 noundef %N) local_unnamed_addr #9 {
entry:
%conv = sitofp i64 %N to double
%call = tail call double @sqrt(double noundef %conv) #13
%add = fadd double %call, 1.000000e+00
%mul = fmul double %add, 2.000000e+00
%conv1 = fptoui double %mul to i64
%call2 = tail call noalias ptr @calloc(i64 noundef %conv1, i64 noundef 8) #15
%cmp.not52 = icmp slt i64 %N, 4
br i1 %cmp.not52, label %for.end, label %while.cond.preheader
while.cond.preheader: ; preds = %entry, %if.end
%count.055 = phi i32 [ %count.1, %if.end ], [ 0, %entry ]
%x.054 = phi i64 [ %x.1.lcssa61, %if.end ], [ %N, %entry ]
%i.053 = phi i64 [ %inc15, %if.end ], [ 2, %entry ]
%rem47 = srem i64 %x.054, %i.053
%cmp548 = icmp eq i64 %rem47, 0
br i1 %cmp548, label %while.body, label %if.end
while.body: ; preds = %while.cond.preheader, %while.body
%e.050 = phi i64 [ %inc, %while.body ], [ 0, %while.cond.preheader ]
%x.149 = phi i64 [ %div, %while.body ], [ %x.054, %while.cond.preheader ]
%div = sdiv i64 %x.149, %i.053
%inc = add nuw nsw i64 %e.050, 1
%rem = srem i64 %div, %i.053
%cmp5 = icmp eq i64 %rem, 0
br i1 %cmp5, label %while.body, label %if.then, !llvm.loop !19
if.then: ; preds = %while.body
%mul9 = shl nsw i32 %count.055, 1
%idxprom = sext i32 %mul9 to i64
%arrayidx = getelementptr inbounds i64, ptr %call2, i64 %idxprom
store i64 %i.053, ptr %arrayidx, align 8, !tbaa !20
%add11 = or i32 %mul9, 1
%idxprom12 = sext i32 %add11 to i64
%arrayidx13 = getelementptr inbounds i64, ptr %call2, i64 %idxprom12
store i64 %inc, ptr %arrayidx13, align 8, !tbaa !20
%inc14 = add nsw i32 %count.055, 1
br label %if.end
if.end: ; preds = %while.cond.preheader, %if.then
%x.1.lcssa61 = phi i64 [ %div, %if.then ], [ %x.054, %while.cond.preheader ]
%count.1 = phi i32 [ %inc14, %if.then ], [ %count.055, %while.cond.preheader ]
%inc15 = add nuw nsw i64 %i.053, 1
%mul3 = mul nsw i64 %inc15, %inc15
%cmp.not = icmp sgt i64 %mul3, %N
br i1 %cmp.not, label %for.end.loopexit, label %while.cond.preheader, !llvm.loop !22
for.end.loopexit: ; preds = %if.end
%0 = shl nsw i32 %count.1, 1
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%x.0.lcssa = phi i64 [ %N, %entry ], [ %x.1.lcssa61, %for.end.loopexit ]
%count.0.lcssa = phi i32 [ 0, %entry ], [ %0, %for.end.loopexit ]
%cmp16 = icmp sgt i64 %x.0.lcssa, 1
br i1 %cmp16, label %if.then18, label %if.end26
if.then18: ; preds = %for.end
%idxprom20 = sext i32 %count.0.lcssa to i64
%arrayidx21 = getelementptr inbounds i64, ptr %call2, i64 %idxprom20
store i64 %x.0.lcssa, ptr %arrayidx21, align 8, !tbaa !20
%add23 = or i32 %count.0.lcssa, 1
%idxprom24 = sext i32 %add23 to i64
%arrayidx25 = getelementptr inbounds i64, ptr %call2, i64 %idxprom24
store i64 1, ptr %arrayidx25, align 8, !tbaa !20
br label %if.end26
if.end26: ; preds = %if.then18, %for.end
ret ptr %call2
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #10
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #11
; Function Attrs: nofree nounwind uwtable
define dso_local void @check_factorization(ptr nocapture noundef readonly %fact) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %fact, align 8, !tbaa !20
%arrayidx1 = getelementptr inbounds i64, ptr %fact, i64 1
%1 = load i64, ptr %arrayidx1, align 8, !tbaa !20
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i64 noundef %0, i64 noundef %1)
%arrayidx218 = getelementptr inbounds i64, ptr %fact, i64 2
%2 = load i64, ptr %arrayidx218, align 8, !tbaa !20
%cmp19 = icmp sgt i64 %2, 0
br i1 %cmp19, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 1, %entry ]
%3 = phi i64 [ %6, %while.body ], [ %2, %entry ]
%mul21 = phi i32 [ %mul, %while.body ], [ 2, %entry ]
%add = or i32 %mul21, 1
%idxprom7 = zext i32 %add to i64
%arrayidx8 = getelementptr inbounds i64, ptr %fact, i64 %idxprom7
%4 = load i64, ptr %arrayidx8, align 8, !tbaa !20
%call9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, i64 noundef %3, i64 noundef %4)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%5 = trunc i64 %indvars.iv.next to i32
%mul = shl nuw nsw i32 %5, 1
%idxprom = zext i32 %mul to i64
%arrayidx2 = getelementptr inbounds i64, ptr %fact, i64 %idxprom
%6 = load i64, ptr %arrayidx2, align 8, !tbaa !20
%cmp = icmp sgt i64 %6, 0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !23
while.end: ; preds = %while.body, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #12
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #12
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(readwrite, argmem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind memory(write, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { 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 #12 = { nofree nounwind }
attributes #13 = { nounwind }
attributes #14 = { nounwind allocsize(0) }
attributes #15 = { nounwind allocsize(0,1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"node", !6, i64 0, !12, i64 8}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!14, !12, i64 8}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = !{!21, !21, i64 0}
!21 = !{!"long long", !7, i64 0}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
|
#include <stdio.h>
int main()
{
int x;
scanf("%d", &x);
if (x >= 400 && x <= 599) printf("8");
if (x >= 600 && x <= 799) printf("7");
if (x >= 800 && x <= 999) printf("6");
if (x >= 1000 && x <= 1199) printf("5");
if (x >= 1200 && x <= 1399) printf("4");
if (x >= 1400 && x <= 1599) printf("3");
if (x >= 1600 && x <= 1799) printf("2");
if (x >= 1800 && x <= 1999) printf("1");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163191/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163191/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4
%1 = add i32 %0, -400
%or.cond = icmp ult i32 %1, 200
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %entry
%putchar = call i32 @putchar(i32 56)
%.pre = load i32, ptr %x, align 4
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %.pre, %if.then ], [ %0, %entry ]
%3 = add i32 %2, -600
%or.cond45 = icmp ult i32 %3, 200
br i1 %or.cond45, label %if.then6, label %if.end8
if.then6: ; preds = %if.end
%putchar52 = call i32 @putchar(i32 55)
%.pre59 = load i32, ptr %x, align 4
br label %if.end8
if.end8: ; preds = %if.then6, %if.end
%4 = phi i32 [ %.pre59, %if.then6 ], [ %2, %if.end ]
%5 = add i32 %4, -800
%or.cond46 = icmp ult i32 %5, 200
br i1 %or.cond46, label %if.then12, label %if.end14
if.then12: ; preds = %if.end8
%putchar53 = call i32 @putchar(i32 54)
%.pre60 = load i32, ptr %x, align 4
br label %if.end14
if.end14: ; preds = %if.then12, %if.end8
%6 = phi i32 [ %.pre60, %if.then12 ], [ %4, %if.end8 ]
%7 = add i32 %6, -1000
%or.cond47 = icmp ult i32 %7, 200
br i1 %or.cond47, label %if.then18, label %if.end20
if.then18: ; preds = %if.end14
%putchar54 = call i32 @putchar(i32 53)
%.pre61 = load i32, ptr %x, align 4
br label %if.end20
if.end20: ; preds = %if.then18, %if.end14
%8 = phi i32 [ %.pre61, %if.then18 ], [ %6, %if.end14 ]
%9 = add i32 %8, -1200
%or.cond48 = icmp ult i32 %9, 200
br i1 %or.cond48, label %if.then24, label %if.end26
if.then24: ; preds = %if.end20
%putchar55 = call i32 @putchar(i32 52)
%.pre62 = load i32, ptr %x, align 4
br label %if.end26
if.end26: ; preds = %if.then24, %if.end20
%10 = phi i32 [ %.pre62, %if.then24 ], [ %8, %if.end20 ]
%11 = add i32 %10, -1400
%or.cond49 = icmp ult i32 %11, 200
br i1 %or.cond49, label %if.then30, label %if.end32
if.then30: ; preds = %if.end26
%putchar56 = call i32 @putchar(i32 51)
%.pre63 = load i32, ptr %x, align 4
br label %if.end32
if.end32: ; preds = %if.then30, %if.end26
%12 = phi i32 [ %.pre63, %if.then30 ], [ %10, %if.end26 ]
%13 = add i32 %12, -1600
%or.cond50 = icmp ult i32 %13, 200
br i1 %or.cond50, label %if.then36, label %if.end38
if.then36: ; preds = %if.end32
%putchar57 = call i32 @putchar(i32 50)
%.pre64 = load i32, ptr %x, align 4
br label %if.end38
if.end38: ; preds = %if.then36, %if.end32
%14 = phi i32 [ %.pre64, %if.then36 ], [ %12, %if.end32 ]
%15 = add i32 %14, -1800
%or.cond51 = icmp ult i32 %15, 200
br i1 %or.cond51, label %if.then42, label %if.end44
if.then42: ; preds = %if.end38
%putchar58 = call i32 @putchar(i32 49)
br label %if.end44
if.end44: ; preds = %if.then42, %if.end38
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
int main(void)
{
int X;
scanf("%d", &X);
if(X>=400 && X<=599) printf("8\n");
else if(X>=600 && X<=799) printf("7\n");
else if(X>=800 && X<=999) printf("6\n");
else if(X>=1000 && X<=1199) printf("5\n");
else if(X>=1200 && X<=1399) printf("4\n");
else if(X>=1400 && X<=1599) printf("3\n");
else if(X>=1600 && X<=1799) printf("2\n");
else if(X>=1800 && X<=1999) printf("1\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163234/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163234/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [2 x i8] c"1\00", align 1
@str.9 = private unnamed_addr constant [2 x i8] c"2\00", align 1
@str.10 = private unnamed_addr constant [2 x i8] c"3\00", align 1
@str.11 = private unnamed_addr constant [2 x i8] c"4\00", align 1
@str.12 = private unnamed_addr constant [2 x i8] c"5\00", align 1
@str.13 = private unnamed_addr constant [2 x i8] c"6\00", align 1
@str.14 = private unnamed_addr constant [2 x i8] c"7\00", align 1
@str.15 = private unnamed_addr constant [2 x i8] c"8\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%X = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X)
%0 = load i32, ptr %X, align 4
%1 = add i32 %0, -400
%or.cond = icmp ult i32 %1, 200
br i1 %or.cond, label %if.end50.sink.split, label %if.else
if.else: ; preds = %entry
%2 = add i32 %0, -600
%or.cond51 = icmp ult i32 %2, 200
br i1 %or.cond51, label %if.end50.sink.split, label %if.else8
if.else8: ; preds = %if.else
%3 = add i32 %0, -800
%or.cond52 = icmp ult i32 %3, 200
br i1 %or.cond52, label %if.end50.sink.split, label %if.else14
if.else14: ; preds = %if.else8
%4 = add i32 %0, -1000
%or.cond53 = icmp ult i32 %4, 200
br i1 %or.cond53, label %if.end50.sink.split, label %if.else20
if.else20: ; preds = %if.else14
%5 = add i32 %0, -1200
%or.cond54 = icmp ult i32 %5, 200
br i1 %or.cond54, label %if.end50.sink.split, label %if.else26
if.else26: ; preds = %if.else20
%6 = add i32 %0, -1400
%or.cond55 = icmp ult i32 %6, 200
br i1 %or.cond55, label %if.end50.sink.split, label %if.else32
if.else32: ; preds = %if.else26
%7 = add i32 %0, -1600
%or.cond56 = icmp ult i32 %7, 200
br i1 %or.cond56, label %if.end50.sink.split, label %if.else38
if.else38: ; preds = %if.else32
%8 = add i32 %0, -1800
%or.cond57 = icmp ult i32 %8, 200
br i1 %or.cond57, label %if.end50.sink.split, label %if.end50
if.end50.sink.split: ; preds = %if.else38, %if.else32, %if.else26, %if.else20, %if.else14, %if.else8, %if.else, %entry
%str.14.sink = phi ptr [ @str.15, %entry ], [ @str.14, %if.else ], [ @str.13, %if.else8 ], [ @str.12, %if.else14 ], [ @str.11, %if.else20 ], [ @str.10, %if.else26 ], [ @str.9, %if.else32 ], [ @str, %if.else38 ]
%puts63 = call i32 @puts(ptr nonnull dereferenceable(1) %str.14.sink)
br label %if.end50
if.end50: ; preds = %if.end50.sink.split, %if.else38
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
typedef long long LL;
typedef long double Lf;
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
//#define Rep(i,a,n)for(LL i=(LL)(a);i<(LL)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define Repp(i,l,r,k)for(int i=(int)(l);i<(int)(r);i+=(int)(k))
//#define Repp(i,l,r,k)for(LL i=(LL)(l);i<(LL)(r);i+=(LL)(k))
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define MOD 1000000007//998244353,1000000007,1000000009
int upi(const void* a, const void* b) { return*(int*)a<*(int*)b ? -1 : *(int*)a> * (int*)b ? 1 : 0; }
int downi(const void* a, const void* b) { return*(int*)a<*(int*)b ? 1 : *(int*)a> * (int*)b ? -1 : 0; }
void sortupi(int* a, int n) { qsort(a, n, sizeof(int), upi); } //1,2,3,4,...
void sortdowni(int* a, int n) { qsort(a, n, sizeof(int), downi); }
int upLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? -1 : *(LL*)a> * (LL*)b ? 1 : 0; }
int downLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? 1 : *(LL*)a> * (LL*)b ? -1 : 0; }
void sortupLL(LL* a, int n) { qsort(a, n, sizeof(LL), upLL); }
void sortdownLL(LL* a, int n) { qsort(a, n, sizeof(LL), downLL); }
int cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; } // a,b,c,d
int cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); } // aaa,aab
LL gcd(LL p, LL q) { while (q) { LL t = p % q; p = q; q = t; }return p; }
LL modpow(LL a,LL n,int m){LL x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define invmodpow(b,p)modpow(b,p-2,p)// a/b≡a*b^{-1}(mod p)...return b^{-1}(mod p)
typedef struct fac { LL n, exp; }F;
LL fact(LL n,F*a){LL x,i,j,c=0;x=n;for(i=2;i*i<=x;i++){for(j=1;x%i==0;j++)x/=i;if(j>1){a[c].n=i;a[c++].exp=j-1;}}if(x-1){a[c].n=x;a[c++].exp=1;}return c;}
//snippet
//overflow...char 1e6
#define N 109
int main() {
int x;
scanf("%d", &x);
for (int i = 8; i > 0; i--) {
if (2000 - i * 200 <= x && x < 2200 - i * 200) {
printf("%d\n", i);
return 0;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163278/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163278/source.c"
target datalayout = "e-m:e-p270: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.fac = type { i64, i64 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upi(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 slt i32 %0, %1
%cmp1 = icmp sgt i32 %0, %1
%cond = zext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 -1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downi(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 slt i32 %0, %1
%cmp1 = icmp sgt i32 %0, %1
%cond = sext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 1, i32 %cond
ret i32 %cond2
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortupi(ptr noundef %a, i32 noundef %n) local_unnamed_addr #1 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @upi) #9
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortdowni(ptr noundef %a, i32 noundef %n) local_unnamed_addr #1 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @downi) #9
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upLL(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !9
%1 = load i64, ptr %b, align 8, !tbaa !9
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = zext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 -1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downLL(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !9
%1 = load i64, ptr %b, align 8, !tbaa !9
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = sext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 1, i32 %cond
ret i32 %cond2
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortupLL(ptr noundef %a, i32 noundef %n) local_unnamed_addr #1 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upLL) #9
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortdownLL(ptr noundef %a, i32 noundef %n) local_unnamed_addr #1 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @downLL) #9
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_char(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !11
%conv = sext i8 %0 to i32
%1 = load i8, ptr %b, align 1, !tbaa !11
%conv1 = sext i8 %1 to i32
%sub = sub nsw i32 %conv, %conv1
ret i32 %sub
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @cmp_str(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #3 {
entry:
%0 = load ptr, ptr %a, align 8, !tbaa !12
%1 = load ptr, ptr %b, align 8, !tbaa !12
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #10
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %p, i64 noundef %q) local_unnamed_addr #5 {
entry:
%tobool.not4 = icmp eq i64 %q, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%p.addr.06 = phi i64 [ %q.addr.05, %while.body ], [ %p, %entry ]
%q.addr.05 = phi i64 [ %rem, %while.body ], [ %q, %entry ]
%rem = srem i64 %p.addr.06, %q.addr.05
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%p.addr.0.lcssa = phi i64 [ %p, %entry ], [ %q.addr.05, %while.body ]
ret i64 %p.addr.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #6
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #6
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @modpow(i64 noundef %a, i64 noundef %n, i32 noundef %m) local_unnamed_addr #5 {
entry:
%conv = sext i32 %m to i64
%tobool.not16 = icmp eq i64 %n, 0
br i1 %tobool.not16, label %for.end, label %for.body
for.body: ; preds = %entry, %cond.end
%mul4.pn = phi i64 [ %mul4, %cond.end ], [ %a, %entry ]
%x.018 = phi i64 [ %x.1, %cond.end ], [ 1, %entry ]
%n.addr.017 = phi i64 [ %div, %cond.end ], [ %n, %entry ]
%a.addr.019 = srem i64 %mul4.pn, %conv
%and = and i64 %n.addr.017, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %cond.end, label %cond.true
cond.true: ; preds = %for.body
%mul = mul nsw i64 %a.addr.019, %x.018
%rem3 = srem i64 %mul, %conv
br label %cond.end
cond.end: ; preds = %for.body, %cond.true
%x.1 = phi i64 [ %rem3, %cond.true ], [ %x.018, %for.body ]
%mul4 = mul nsw i64 %a.addr.019, %a.addr.019
%div = sdiv i64 %n.addr.017, 2
%n.addr.017.off = add i64 %n.addr.017, 1
%tobool.not = icmp ult i64 %n.addr.017.off, 3
br i1 %tobool.not, label %for.end, label %for.body, !llvm.loop !16
for.end: ; preds = %cond.end, %entry
%x.0.lcssa = phi i64 [ 1, %entry ], [ %x.1, %cond.end ]
ret i64 %x.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: write) uwtable
define dso_local i64 @fact(i64 noundef %n, ptr nocapture noundef writeonly %a) local_unnamed_addr #7 {
entry:
%cmp.not42 = icmp slt i64 %n, 4
br i1 %cmp.not42, label %for.end10, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc8
%c.045 = phi i64 [ %c.1, %for.inc8 ], [ 0, %entry ]
%i.044 = phi i64 [ %inc9, %for.inc8 ], [ 2, %entry ]
%x.043 = phi i64 [ %x.1.lcssa51, %for.inc8 ], [ %n, %entry ]
%rem37 = srem i64 %x.043, %i.044
%cmp238 = icmp eq i64 %rem37, 0
br i1 %cmp238, label %for.body3, label %for.inc8
for.body3: ; preds = %for.cond1.preheader, %for.body3
%j.040 = phi i64 [ %inc, %for.body3 ], [ 1, %for.cond1.preheader ]
%x.139 = phi i64 [ %div, %for.body3 ], [ %x.043, %for.cond1.preheader ]
%div = sdiv i64 %x.139, %i.044
%inc = add nuw nsw i64 %j.040, 1
%rem = srem i64 %div, %i.044
%cmp2 = icmp eq i64 %rem, 0
br i1 %cmp2, label %for.body3, label %if.then, !llvm.loop !17
if.then: ; preds = %for.body3
%arrayidx = getelementptr inbounds %struct.fac, ptr %a, i64 %c.045
store i64 %i.044, ptr %arrayidx, align 8, !tbaa !18
%inc6 = add nsw i64 %c.045, 1
%exp = getelementptr inbounds %struct.fac, ptr %a, i64 %c.045, i32 1
store i64 %j.040, ptr %exp, align 8, !tbaa !20
br label %for.inc8
for.inc8: ; preds = %for.cond1.preheader, %if.then
%x.1.lcssa51 = phi i64 [ %div, %if.then ], [ %x.043, %for.cond1.preheader ]
%c.1 = phi i64 [ %inc6, %if.then ], [ %c.045, %for.cond1.preheader ]
%inc9 = add nuw nsw i64 %i.044, 1
%mul = mul nsw i64 %inc9, %inc9
%cmp.not = icmp sgt i64 %mul, %x.1.lcssa51
br i1 %cmp.not, label %for.end10, label %for.cond1.preheader, !llvm.loop !21
for.end10: ; preds = %for.inc8, %entry
%x.0.lcssa = phi i64 [ %n, %entry ], [ %x.1.lcssa51, %for.inc8 ]
%c.0.lcssa = phi i64 [ 0, %entry ], [ %c.1, %for.inc8 ]
%tobool.not = icmp eq i64 %x.0.lcssa, 1
br i1 %tobool.not, label %if.end18, label %if.then12
if.then12: ; preds = %for.end10
%arrayidx13 = getelementptr inbounds %struct.fac, ptr %a, i64 %c.0.lcssa
store i64 %x.0.lcssa, ptr %arrayidx13, align 8, !tbaa !18
%inc15 = add nsw i64 %c.0.lcssa, 1
%exp17 = getelementptr inbounds %struct.fac, ptr %a, i64 %c.0.lcssa, i32 1
store i64 1, ptr %exp17, align 8, !tbaa !20
br label %if.end18
if.end18: ; preds = %if.then12, %for.end10
%c.2 = phi i64 [ %inc15, %if.then12 ], [ %c.0.lcssa, %for.end10 ]
ret i64 %c.2
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = add i32 %0, -400
%or.cond = icmp ult i32 %1, 200
br i1 %or.cond, label %if.then, label %for.inc
if.then: ; preds = %for.inc.6, %for.inc.5, %for.inc.4, %for.inc.3, %for.inc.2, %for.inc.1, %for.inc, %entry
%i.012.lcssa = phi i32 [ 8, %entry ], [ 7, %for.inc ], [ 6, %for.inc.1 ], [ 5, %for.inc.2 ], [ 4, %for.inc.3 ], [ 3, %for.inc.4 ], [ 2, %for.inc.5 ], [ 1, %for.inc.6 ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.012.lcssa)
br label %cleanup6
for.inc: ; preds = %entry
%2 = add i32 %0, -600
%or.cond.1 = icmp ult i32 %2, 200
br i1 %or.cond.1, label %if.then, label %for.inc.1
for.inc.1: ; preds = %for.inc
%3 = add i32 %0, -800
%or.cond.2 = icmp ult i32 %3, 200
br i1 %or.cond.2, label %if.then, label %for.inc.2
for.inc.2: ; preds = %for.inc.1
%4 = add i32 %0, -1000
%or.cond.3 = icmp ult i32 %4, 200
br i1 %or.cond.3, label %if.then, label %for.inc.3
for.inc.3: ; preds = %for.inc.2
%5 = add i32 %0, -1200
%or.cond.4 = icmp ult i32 %5, 200
br i1 %or.cond.4, label %if.then, label %for.inc.4
for.inc.4: ; preds = %for.inc.3
%6 = add i32 %0, -1400
%or.cond.5 = icmp ult i32 %6, 200
br i1 %or.cond.5, label %if.then, label %for.inc.5
for.inc.5: ; preds = %for.inc.4
%7 = add i32 %0, -1600
%or.cond.6 = icmp ult i32 %7, 200
br i1 %or.cond.6, label %if.then, label %for.inc.6
for.inc.6: ; preds = %for.inc.5
%8 = add i32 %0, -1800
%or.cond.7 = icmp ult i32 %8, 200
br i1 %or.cond.7, label %if.then, label %cleanup6
cleanup6: ; preds = %for.inc.6, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #9
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nofree norecurse nosync nounwind memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = !{!19, !10, i64 0}
!19 = !{!"fac", !10, i64 0, !10, i64 8}
!20 = !{!19, !10, i64 8}
!21 = distinct !{!21, !15}
|
#include <stdio.h>
#include <stdlib.h>
int main(void){
int n, z, w, a[2000], i;
scanf("%d %d %d", &n, &z, &w);
for(i = 0; i < n; i++){
scanf("%d", &a[i]);
}
if(abs(a[n - 1] - w) > abs(a[n - 1] - a[n - 2]))
printf("%d\n", abs(a[n - 1] - w));
else
printf("%d\n", abs(a[n - 1] - a[n - 2]));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163328/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163328/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.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
%z = alloca i32, align 4
%w = alloca i32, align 4
%a = alloca [2000 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 %z) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %a) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %z, ptr noundef nonnull %w)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %0, 0
br i1 %cmp30, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%sub = add nsw i32 %.lcssa, -1
%idxprom2 = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %idxprom2
%3 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%4 = load i32, ptr %w, align 4, !tbaa !5
%sub4 = sub nsw i32 %3, %4
%5 = call i32 @llvm.abs.i32(i32 %sub4, i1 true)
%sub8 = add nsw i32 %.lcssa, -2
%idxprom9 = sext i32 %sub8 to i64
%arrayidx10 = getelementptr inbounds [2000 x i32], ptr %a, i64 0, i64 %idxprom9
%6 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%sub11 = sub nsw i32 %3, %6
%7 = call i32 @llvm.abs.i32(i32 %sub11, i1 true)
%. = call i32 @llvm.umax.i32(i32 %5, i32 %7)
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.)
call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.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 speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int a;
int sum = 0;
scanf("%d",&a);
for(int i=1;i<=a;i++){
sum = sum + i;
}
printf("%d\n",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163371/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163371/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not5 = icmp slt i32 %0, 1
br i1 %cmp.not5, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = shl nuw i32 %0, 1
%2 = add nsw i32 %0, -1
%3 = zext i32 %2 to i33
%4 = add nsw i32 %0, -2
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = add i32 %1, %8
%10 = add i32 %9, -1
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body.preheader, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %10, %for.body.preheader ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int n;
scanf("%d",&n);
if(n%2){ printf("%d", ((n-1)/2 * (1+n-1)) + n); }
else { printf("%d", n /2 * (1+n ) ); }
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163414/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163414/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, 1
%tobool.not = icmp eq i32 %1, 0
br i1 %tobool.not, label %if.else, label %if.then
if.then: ; preds = %entry
%sub = add nsw i32 %0, -1
%div = sdiv i32 %sub, 2
%mul8 = add nsw i32 %div, 1
br label %if.end
if.else: ; preds = %entry
%div4 = sdiv i32 %0, 2
%add5 = add nuw nsw i32 %0, 1
br label %if.end
if.end: ; preds = %if.else, %if.then
%add5.sink = phi i32 [ %add5, %if.else ], [ %0, %if.then ]
%div4.sink = phi i32 [ %div4, %if.else ], [ %mul8, %if.then ]
%mul6 = mul i32 %div4.sink, %add5.sink
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %mul6)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main() {
int N=0;
scanf("%d",&N);
printf("%d\n",(int)(0.5*N*(N+1)));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163458/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163458/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
store i32 0, ptr %N, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%mul = fmul double %conv, 5.000000e-01
%add = add nsw i32 %0, 1
%conv1 = sitofp i32 %add to double
%mul2 = fmul double %mul, %conv1
%conv3 = fptosi double %mul2 to i32
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int n,total=0,i;
scanf("%d",&n);
for(i=1;i<=n;i++)
total+=i;
printf("%d\n",total);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163500/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163500/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not5 = icmp slt i32 %0, 1
br i1 %cmp.not5, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = shl nuw i32 %0, 1
%2 = add nsw i32 %0, -1
%3 = zext i32 %2 to i33
%4 = add nsw i32 %0, -2
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = add i32 %1, %8
%10 = add i32 %9, -1
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%total.0.lcssa = phi i32 [ 0, %entry ], [ %10, %for.body.preheader ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %total.0.lcssa)
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 sum=0;
int n;
scanf("%d",&n);
while(n!=0){
sum+=n;
n--;
}
printf("%d",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163544/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163544/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%.pr = load i32, ptr %n, align 4, !tbaa !5
%cmp.not3 = icmp eq i32 %.pr, 0
br i1 %cmp.not3, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%0 = add i32 %.pr, -1
%1 = mul i32 %0, %0
%2 = zext i32 %0 to i33
%3 = add i32 %.pr, -2
%4 = zext i32 %3 to i33
%5 = mul i33 %2, %4
%6 = lshr i33 %5, 1
%7 = trunc i33 %6 to i32
%8 = add i32 %.pr, %1
%9 = sub i32 %8, %7
store i32 0, ptr %n, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.body.preheader, %entry
%sum.0.lcssa = phi i32 [ %9, %while.body.preheader ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n, i, sum=0;
scanf("%d", &n);
for (i = 1; i <= n; i++)
{
sum = sum + i;
}
printf("%d", sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163588/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163588/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not5 = icmp slt i32 %0, 1
br i1 %cmp.not5, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = shl nuw i32 %0, 1
%2 = add nsw i32 %0, -1
%3 = zext i32 %2 to i33
%4 = add nsw i32 %0, -2
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = add i32 %1, %8
%10 = add i32 %9, -1
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %10, %for.body.preheader ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int n,k=0,i;
scanf("%d", &n);
for(i=1; i<=n; i++)
k+=i;
printf("%d\n", k);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163630/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163630/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not5 = icmp slt i32 %0, 1
br i1 %cmp.not5, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = shl nuw i32 %0, 1
%2 = add nsw i32 %0, -1
%3 = zext i32 %2 to i33
%4 = add nsw i32 %0, -2
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = add i32 %1, %8
%10 = add i32 %9, -1
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%k.0.lcssa = phi i32 [ 0, %entry ], [ %10, %for.body.preheader ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %k.0.lcssa)
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 sum=0;
int N, i;
scanf("%d", &N);
for(i=1;i<=N;i++){
sum += i;
}
printf("%d\n", sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163674/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163674/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not5 = icmp slt i32 %0, 1
br i1 %cmp.not5, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = shl nuw i32 %0, 1
%2 = add nsw i32 %0, -1
%3 = zext i32 %2 to i33
%4 = add nsw i32 %0, -2
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = add i32 %1, %8
%10 = add i32 %9, -1
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %10, %for.body.preheader ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int i,sum=0,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
sum+=i;
printf("%d\n",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163760/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163760/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not5 = icmp slt i32 %0, 1
br i1 %cmp.not5, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = shl nuw i32 %0, 1
%2 = add nsw i32 %0, -1
%3 = zext i32 %2 to i33
%4 = add nsw i32 %0, -2
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = add i32 %1, %8
%10 = add i32 %9, -1
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %10, %for.body.preheader ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int n;
scanf("%d", &n);
n = n * (n + 1) / 2;
printf("%d\n", n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163803/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163803/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%mul = mul nsw i32 %add, %0
%div = sdiv i32 %mul, 2
store i32 %div, ptr %n, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int i,a;
while(scanf("%d",&a)!=EOF){
int sum=0;
for(i=1;i<=a;i++){
sum=sum+i;
}
printf("%d\n",sum);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163847/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163847/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%cmp.not10 = icmp eq i32 %call9, -1
br i1 %cmp.not10, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp1.not6 = icmp slt i32 %0, 1
br i1 %cmp1.not6, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%1 = shl nuw i32 %0, 1
%2 = add nsw i32 %0, -1
%3 = zext i32 %2 to i33
%4 = add nsw i32 %0, -2
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = add i32 %1, -1
%10 = add i32 %9, %8
br label %for.end
for.end: ; preds = %for.body.preheader, %for.cond.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %10, %for.body.preheader ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !9
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int i, N, candy = 0;
scanf("%d", &N);
for (i = 0; i < N; i++)
candy += i + 1;
printf("%d", candy);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163890/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163890/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%1 = shl nuw i32 %0, 1
%2 = add nsw i32 %0, -1
%3 = zext i32 %2 to i33
%4 = add nsw i32 %0, -2
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = add i32 %1, %8
%10 = add i32 %9, -1
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%candy.0.lcssa = phi i32 [ 0, %entry ], [ %10, %for.body.preheader ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %candy.0.lcssa)
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"}
|
/*
* FileName: H_fix_3
* CreatedDate: 2020-05-19 23:43:15 +0900
* LastModified: 2020-05-20 00:14:46 +0900
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
long int dp[1000][1000];
void print_dp(int h,int w){
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
printf("%ld ",dp[i][j]);
}
printf("\n");
}
}
int main(void){
int h,w;
scanf("%d %d",&h,&w);
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
dp[i][j]=1;
}
}
for(int i=0;i<h;i++){
char moji[w];
scanf("%s",moji);
for(int j=0;j<w;j++){
if(moji[j]=='#'){
dp[i][j]=0;
}
}
}
int flag=0;
for(int i=0;i<h;i++){
if(dp[i][0]==0){
flag=1;
}
if(flag==1){
dp[i][0]=0;
}
}
flag=0;
for(int j=0;j<w;j++){
if(dp[0][j]==0){
flag=1;
}
if(flag==1){
dp[0][j]=0;
}
}
// print_dp(h,w);
for(int i=1;i<h;i++){
for(int j=1;j<w;j++){
if(dp[i][j]==0){
continue;
}
dp[i][j]=(dp[i-1][j]+dp[i][j-1])%1000000007;
}
}
printf("%ld\n",dp[h-1][w-1]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163933/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163933/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%ld \00", align 1
@dp = dso_local local_unnamed_addr global [1000 x [1000 x i64]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @print_dp(i32 noundef %h, i32 noundef %w) local_unnamed_addr #0 {
entry:
%cmp17 = icmp sgt i32 %h, 0
br i1 %cmp17, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup
for.cond1.preheader.lr.ph: ; preds = %entry
%cmp215 = icmp sgt i32 %w, 0
br i1 %cmp215, label %for.cond1.preheader.us.preheader, label %for.cond1.preheader
for.cond1.preheader.us.preheader: ; preds = %for.cond1.preheader.lr.ph
%wide.trip.count25 = zext i32 %h to i64
%wide.trip.count = zext i32 %w to i64
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.cond.cleanup3_crit_edge.us
%indvars.iv22 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next23, %for.cond1.for.cond.cleanup3_crit_edge.us ]
br label %for.body4.us
for.body4.us: ; preds = %for.cond1.preheader.us, %for.body4.us
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.us ], [ %indvars.iv.next, %for.body4.us ]
%arrayidx6.us = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %indvars.iv22, i64 %indvars.iv
%0 = load i64, ptr %arrayidx6.us, align 8, !tbaa !5
%call.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond21.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond21.not, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us, !llvm.loop !9
for.cond1.for.cond.cleanup3_crit_edge.us: ; preds = %for.body4.us
%putchar.us = tail call i32 @putchar(i32 10)
%indvars.iv.next23 = add nuw nsw i64 %indvars.iv22, 1
%exitcond26.not = icmp eq i64 %indvars.iv.next23, %wide.trip.count25
br i1 %exitcond26.not, label %for.cond.cleanup, label %for.cond1.preheader.us, !llvm.loop !11
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.preheader
%i.018 = phi i32 [ %inc9, %for.cond1.preheader ], [ 0, %for.cond1.preheader.lr.ph ]
%putchar = tail call i32 @putchar(i32 10)
%inc9 = add nuw nsw i32 %i.018, 1
%exitcond.not = icmp eq i32 %inc9, %h
br i1 %exitcond.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !11
for.cond.cleanup: ; preds = %for.cond1.preheader, %for.cond1.for.cond.cleanup3_crit_edge.us, %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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !12
%cmp155 = icmp sgt i32 %0, 0
br i1 %cmp155, label %for.cond1.preheader.lr.ph, label %for.cond59.preheader
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr %w, align 4, !tbaa !12
%cmp2153 = icmp sgt i32 %1, 0
br i1 %cmp2153, label %for.cond1.preheader.us.preheader, label %for.body14.preheader
for.cond1.preheader.us.preheader: ; preds = %for.cond1.preheader.lr.ph
%wide.trip.count178 = zext i32 %0 to i64
%wide.trip.count = zext i32 %1 to i64
%min.iters.check = icmp ult i32 %1, 4
%n.vec = and i64 %wide.trip.count, 4294967292
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.cond.cleanup3_crit_edge.us
%indvars.iv175 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next176, %for.cond1.for.cond.cleanup3_crit_edge.us ]
br i1 %min.iters.check, label %for.body4.us.preheader, label %vector.body
vector.body: ; preds = %for.cond1.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ]
%2 = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %indvars.iv175, i64 %index
store <2 x i64> <i64 1, i64 1>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i64, ptr %2, i64 2
store <2 x i64> <i64 1, i64 1>, ptr %3, align 16, !tbaa !5
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us.preheader
for.body4.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body4.us
for.body4.us: ; preds = %for.body4.us.preheader, %for.body4.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body4.us ], [ %indvars.iv.ph, %for.body4.us.preheader ]
%arrayidx6.us = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %indvars.iv175, i64 %indvars.iv
store i64 1, ptr %arrayidx6.us, align 8, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us, !llvm.loop !17
for.cond1.for.cond.cleanup3_crit_edge.us: ; preds = %for.body4.us, %middle.block
%indvars.iv.next176 = add nuw nsw i64 %indvars.iv175, 1
%exitcond179.not = icmp eq i64 %indvars.iv.next176, %wide.trip.count178
br i1 %exitcond179.not, label %for.cond11.preheader, label %for.cond1.preheader.us, !llvm.loop !18
for.cond11.preheader: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us
br i1 %cmp155, label %for.body14.preheader, label %for.cond59.preheader
for.body14.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond11.preheader
br label %for.body14
for.cond36.preheader: ; preds = %for.cond.cleanup19
%cmp37161 = icmp sgt i32 %26, 0
br i1 %cmp37161, label %for.body40.preheader, label %for.cond59.preheader
for.body40.preheader: ; preds = %for.cond36.preheader
%wide.trip.count191 = zext i32 %26 to i64
%xtraiter = and i64 %wide.trip.count191, 1
%5 = icmp eq i32 %26, 1
br i1 %5, label %for.cond59.preheader.loopexit.unr-lcssa, label %for.body40.preheader.new
for.body40.preheader.new: ; preds = %for.body40.preheader
%unroll_iter = and i64 %wide.trip.count191, 4294967294
br label %for.body40
for.body14: ; preds = %for.body14.preheader, %for.cond.cleanup19
%indvars.iv185 = phi i64 [ %indvars.iv.next186, %for.cond.cleanup19 ], [ 0, %for.body14.preheader ]
%6 = load i32, ptr %w, align 4, !tbaa !12
%7 = zext i32 %6 to i64
%8 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %7, align 16
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %vla)
%9 = load i32, ptr %w, align 4, !tbaa !12
%cmp18157 = icmp sgt i32 %9, 0
br i1 %cmp18157, label %for.body20.lr.ph, label %for.cond.cleanup19
for.body20.lr.ph: ; preds = %for.body14
%wide.trip.count183 = zext i32 %9 to i64
%min.iters.check216 = icmp ult i32 %9, 4
br i1 %min.iters.check216, label %for.body20.preheader, label %vector.ph217
vector.ph217: ; preds = %for.body20.lr.ph
%n.vec219 = and i64 %wide.trip.count183, 4294967292
br label %vector.body222
vector.body222: ; preds = %pred.store.continue230, %vector.ph217
%index223 = phi i64 [ 0, %vector.ph217 ], [ %index.next231, %pred.store.continue230 ]
%10 = or i64 %index223, 2
%11 = getelementptr inbounds i8, ptr %vla, i64 %index223
%wide.load = load <2 x i8>, ptr %11, align 4, !tbaa !19
%12 = getelementptr inbounds i8, ptr %11, i64 2
%wide.load224 = load <2 x i8>, ptr %12, align 2, !tbaa !19
%13 = icmp eq <2 x i8> %wide.load, <i8 35, i8 35>
%14 = icmp eq <2 x i8> %wide.load224, <i8 35, i8 35>
%15 = extractelement <2 x i1> %13, i64 0
br i1 %15, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body222
%16 = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %indvars.iv185, i64 %index223
store i64 0, ptr %16, align 16, !tbaa !5
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body222
%17 = extractelement <2 x i1> %13, i64 1
br i1 %17, label %pred.store.if225, label %pred.store.continue226
pred.store.if225: ; preds = %pred.store.continue
%18 = or i64 %index223, 1
%19 = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %indvars.iv185, i64 %18
store i64 0, ptr %19, align 8, !tbaa !5
br label %pred.store.continue226
pred.store.continue226: ; preds = %pred.store.if225, %pred.store.continue
%20 = extractelement <2 x i1> %14, i64 0
br i1 %20, label %pred.store.if227, label %pred.store.continue228
pred.store.if227: ; preds = %pred.store.continue226
%21 = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %indvars.iv185, i64 %10
store i64 0, ptr %21, align 16, !tbaa !5
br label %pred.store.continue228
pred.store.continue228: ; preds = %pred.store.if227, %pred.store.continue226
%22 = extractelement <2 x i1> %14, i64 1
br i1 %22, label %pred.store.if229, label %pred.store.continue230
pred.store.if229: ; preds = %pred.store.continue228
%23 = or i64 %index223, 3
%24 = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %indvars.iv185, i64 %23
store i64 0, ptr %24, align 8, !tbaa !5
br label %pred.store.continue230
pred.store.continue230: ; preds = %pred.store.if229, %pred.store.continue228
%index.next231 = add nuw i64 %index223, 4
%25 = icmp eq i64 %index.next231, %n.vec219
br i1 %25, label %middle.block214, label %vector.body222, !llvm.loop !20
middle.block214: ; preds = %pred.store.continue230
%cmp.n221 = icmp eq i64 %n.vec219, %wide.trip.count183
br i1 %cmp.n221, label %for.cond.cleanup19, label %for.body20.preheader
for.body20.preheader: ; preds = %for.body20.lr.ph, %middle.block214
%indvars.iv180.ph = phi i64 [ 0, %for.body20.lr.ph ], [ %n.vec219, %middle.block214 ]
br label %for.body20
for.cond.cleanup19: ; preds = %for.inc29, %middle.block214, %for.body14
call void @llvm.stackrestore.p0(ptr %8)
%indvars.iv.next186 = add nuw nsw i64 %indvars.iv185, 1
%26 = load i32, ptr %h, align 4, !tbaa !12
%27 = sext i32 %26 to i64
%cmp12 = icmp slt i64 %indvars.iv.next186, %27
br i1 %cmp12, label %for.body14, label %for.cond36.preheader, !llvm.loop !21
for.body20: ; preds = %for.body20.preheader, %for.inc29
%indvars.iv180 = phi i64 [ %indvars.iv.next181, %for.inc29 ], [ %indvars.iv180.ph, %for.body20.preheader ]
%arrayidx22 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv180
%28 = load i8, ptr %arrayidx22, align 1, !tbaa !19
%cmp23 = icmp eq i8 %28, 35
br i1 %cmp23, label %if.then, label %for.inc29
if.then: ; preds = %for.body20
%arrayidx28 = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %indvars.iv185, i64 %indvars.iv180
store i64 0, ptr %arrayidx28, align 8, !tbaa !5
br label %for.inc29
for.inc29: ; preds = %for.body20, %if.then
%indvars.iv.next181 = add nuw nsw i64 %indvars.iv180, 1
%exitcond184.not = icmp eq i64 %indvars.iv.next181, %wide.trip.count183
br i1 %exitcond184.not, label %for.cond.cleanup19, label %for.body20, !llvm.loop !22
for.cond59.preheader.loopexit.unr-lcssa.loopexit: ; preds = %for.inc55.1
%29 = icmp eq i32 %spec.select.1, 1
br label %for.cond59.preheader.loopexit.unr-lcssa
for.cond59.preheader.loopexit.unr-lcssa: ; preds = %for.cond59.preheader.loopexit.unr-lcssa.loopexit, %for.body40.preheader
%indvars.iv188.unr = phi i64 [ 0, %for.body40.preheader ], [ %indvars.iv.next189.1, %for.cond59.preheader.loopexit.unr-lcssa.loopexit ]
%flag.0162.unr = phi i1 [ false, %for.body40.preheader ], [ %29, %for.cond59.preheader.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond59.preheader, label %for.body40.epil
for.body40.epil: ; preds = %for.cond59.preheader.loopexit.unr-lcssa
%arrayidx42.epil = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %indvars.iv188.unr
%30 = load i64, ptr %arrayidx42.epil, align 16, !tbaa !5
%cmp44.epil = icmp eq i64 %30, 0
%cmp48.epil = or i1 %cmp44.epil, %flag.0162.unr
br i1 %cmp48.epil, label %if.then50.epil, label %for.cond59.preheader
if.then50.epil: ; preds = %for.body40.epil
store i64 0, ptr %arrayidx42.epil, align 16, !tbaa !5
br label %for.cond59.preheader
for.cond59.preheader: ; preds = %for.cond59.preheader.loopexit.unr-lcssa, %if.then50.epil, %for.body40.epil, %entry, %for.cond11.preheader, %for.cond36.preheader
%.lcssa152213 = phi i32 [ %26, %for.cond36.preheader ], [ %0, %for.cond11.preheader ], [ %0, %entry ], [ %26, %for.body40.epil ], [ %26, %if.then50.epil ], [ %26, %for.cond59.preheader.loopexit.unr-lcssa ]
%31 = load i32, ptr %w, align 4, !tbaa !12
%cmp60164 = icmp sgt i32 %31, 0
br i1 %cmp60164, label %for.body63.preheader, label %for.cond80.preheader
for.body63.preheader: ; preds = %for.cond59.preheader
%wide.trip.count196 = zext i32 %31 to i64
%xtraiter232 = and i64 %wide.trip.count196, 1
%32 = icmp eq i32 %31, 1
br i1 %32, label %for.cond80.preheader.loopexit.unr-lcssa, label %for.body63.preheader.new
for.body63.preheader.new: ; preds = %for.body63.preheader
%unroll_iter234 = and i64 %wide.trip.count196, 4294967294
br label %for.body63
for.body40: ; preds = %for.inc55.1, %for.body40.preheader.new
%indvars.iv188 = phi i64 [ 0, %for.body40.preheader.new ], [ %indvars.iv.next189.1, %for.inc55.1 ]
%flag.0162 = phi i32 [ 0, %for.body40.preheader.new ], [ %spec.select.1, %for.inc55.1 ]
%niter = phi i64 [ 0, %for.body40.preheader.new ], [ %niter.next.1, %for.inc55.1 ]
%arrayidx42 = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %indvars.iv188
%33 = load i64, ptr %arrayidx42, align 16, !tbaa !5
%cmp44 = icmp eq i64 %33, 0
%spec.select = select i1 %cmp44, i32 1, i32 %flag.0162
%cmp48 = icmp eq i32 %spec.select, 1
br i1 %cmp48, label %if.then50, label %for.inc55
if.then50: ; preds = %for.body40
store i64 0, ptr %arrayidx42, align 16, !tbaa !5
br label %for.inc55
for.inc55: ; preds = %for.body40, %if.then50
%indvars.iv.next189 = or i64 %indvars.iv188, 1
%arrayidx42.1 = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %indvars.iv.next189
%34 = load i64, ptr %arrayidx42.1, align 16, !tbaa !5
%cmp44.1 = icmp eq i64 %34, 0
%spec.select.1 = select i1 %cmp44.1, i32 1, i32 %spec.select
%cmp48.1 = icmp eq i32 %spec.select.1, 1
br i1 %cmp48.1, label %if.then50.1, label %for.inc55.1
if.then50.1: ; preds = %for.inc55
store i64 0, ptr %arrayidx42.1, align 16, !tbaa !5
br label %for.inc55.1
for.inc55.1: ; preds = %if.then50.1, %for.inc55
%indvars.iv.next189.1 = add nuw nsw i64 %indvars.iv188, 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.cond59.preheader.loopexit.unr-lcssa.loopexit, label %for.body40, !llvm.loop !23
for.cond80.preheader.loopexit.unr-lcssa.loopexit: ; preds = %for.inc76.1
%35 = icmp eq i32 %spec.select151.1, 1
br label %for.cond80.preheader.loopexit.unr-lcssa
for.cond80.preheader.loopexit.unr-lcssa: ; preds = %for.cond80.preheader.loopexit.unr-lcssa.loopexit, %for.body63.preheader
%indvars.iv193.unr = phi i64 [ 0, %for.body63.preheader ], [ %indvars.iv.next194.1, %for.cond80.preheader.loopexit.unr-lcssa.loopexit ]
%flag.2165.unr = phi i1 [ false, %for.body63.preheader ], [ %35, %for.cond80.preheader.loopexit.unr-lcssa.loopexit ]
%lcmp.mod233.not = icmp eq i64 %xtraiter232, 0
br i1 %lcmp.mod233.not, label %for.cond80.preheader, label %for.body63.epil
for.body63.epil: ; preds = %for.cond80.preheader.loopexit.unr-lcssa
%arrayidx65.epil = getelementptr inbounds [1000 x i64], ptr @dp, i64 0, i64 %indvars.iv193.unr
%36 = load i64, ptr %arrayidx65.epil, align 8, !tbaa !5
%cmp66.epil = icmp eq i64 %36, 0
%cmp70.epil = or i1 %cmp66.epil, %flag.2165.unr
br i1 %cmp70.epil, label %if.then72.epil, label %for.cond80.preheader
if.then72.epil: ; preds = %for.body63.epil
store i64 0, ptr %arrayidx65.epil, align 8, !tbaa !5
br label %for.cond80.preheader
for.cond80.preheader: ; preds = %for.cond80.preheader.loopexit.unr-lcssa, %if.then72.epil, %for.body63.epil, %for.cond59.preheader
%cmp81170 = icmp sgt i32 %.lcssa152213, 1
%cmp87168 = icmp sgt i32 %31, 1
%or.cond = and i1 %cmp81170, %cmp87168
br i1 %or.cond, label %for.cond86.preheader.us.preheader, label %for.cond.cleanup83
for.cond86.preheader.us.preheader: ; preds = %for.cond80.preheader
%wide.trip.count208 = zext i32 %.lcssa152213 to i64
%wide.trip.count202 = zext i32 %31 to i64
br label %for.cond86.preheader.us
for.cond86.preheader.us: ; preds = %for.cond86.preheader.us.preheader, %for.cond86.for.cond.cleanup89_crit_edge.us
%indvars.iv204 = phi i64 [ 1, %for.cond86.preheader.us.preheader ], [ %indvars.iv.next205, %for.cond86.for.cond.cleanup89_crit_edge.us ]
%37 = add nsw i64 %indvars.iv204, -1
br label %for.body90.us
for.body90.us: ; preds = %for.cond86.preheader.us, %for.inc112.us
%indvars.iv198 = phi i64 [ 1, %for.cond86.preheader.us ], [ %indvars.iv.next199, %for.inc112.us ]
%arrayidx94.us = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %indvars.iv204, i64 %indvars.iv198
%38 = load i64, ptr %arrayidx94.us, align 8, !tbaa !5
%cmp95.us = icmp eq i64 %38, 0
br i1 %cmp95.us, label %for.inc112.us, label %if.end98.us
if.end98.us: ; preds = %for.body90.us
%arrayidx102.us = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %37, i64 %indvars.iv198
%39 = load i64, ptr %arrayidx102.us, align 8, !tbaa !5
%40 = add nsw i64 %indvars.iv198, -1
%arrayidx107.us = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %indvars.iv204, i64 %40
%41 = load i64, ptr %arrayidx107.us, align 8, !tbaa !5
%add.us = add nsw i64 %41, %39
%rem.us = srem i64 %add.us, 1000000007
store i64 %rem.us, ptr %arrayidx94.us, align 8, !tbaa !5
br label %for.inc112.us
for.inc112.us: ; preds = %if.end98.us, %for.body90.us
%indvars.iv.next199 = add nuw nsw i64 %indvars.iv198, 1
%exitcond203.not = icmp eq i64 %indvars.iv.next199, %wide.trip.count202
br i1 %exitcond203.not, label %for.cond86.for.cond.cleanup89_crit_edge.us, label %for.body90.us, !llvm.loop !24
for.cond86.for.cond.cleanup89_crit_edge.us: ; preds = %for.inc112.us
%indvars.iv.next205 = add nuw nsw i64 %indvars.iv204, 1
%exitcond209.not = icmp eq i64 %indvars.iv.next205, %wide.trip.count208
br i1 %exitcond209.not, label %for.cond.cleanup83, label %for.cond86.preheader.us, !llvm.loop !25
for.body63: ; preds = %for.inc76.1, %for.body63.preheader.new
%indvars.iv193 = phi i64 [ 0, %for.body63.preheader.new ], [ %indvars.iv.next194.1, %for.inc76.1 ]
%flag.2165 = phi i32 [ 0, %for.body63.preheader.new ], [ %spec.select151.1, %for.inc76.1 ]
%niter235 = phi i64 [ 0, %for.body63.preheader.new ], [ %niter235.next.1, %for.inc76.1 ]
%arrayidx65 = getelementptr inbounds [1000 x i64], ptr @dp, i64 0, i64 %indvars.iv193
%42 = load i64, ptr %arrayidx65, align 16, !tbaa !5
%cmp66 = icmp eq i64 %42, 0
%spec.select151 = select i1 %cmp66, i32 1, i32 %flag.2165
%cmp70 = icmp eq i32 %spec.select151, 1
br i1 %cmp70, label %if.then72, label %for.inc76
if.then72: ; preds = %for.body63
store i64 0, ptr %arrayidx65, align 16, !tbaa !5
br label %for.inc76
for.inc76: ; preds = %for.body63, %if.then72
%indvars.iv.next194 = or i64 %indvars.iv193, 1
%arrayidx65.1 = getelementptr inbounds [1000 x i64], ptr @dp, i64 0, i64 %indvars.iv.next194
%43 = load i64, ptr %arrayidx65.1, align 8, !tbaa !5
%cmp66.1 = icmp eq i64 %43, 0
%spec.select151.1 = select i1 %cmp66.1, i32 1, i32 %spec.select151
%cmp70.1 = icmp eq i32 %spec.select151.1, 1
br i1 %cmp70.1, label %if.then72.1, label %for.inc76.1
if.then72.1: ; preds = %for.inc76
store i64 0, ptr %arrayidx65.1, align 8, !tbaa !5
br label %for.inc76.1
for.inc76.1: ; preds = %if.then72.1, %for.inc76
%indvars.iv.next194.1 = add nuw nsw i64 %indvars.iv193, 2
%niter235.next.1 = add i64 %niter235, 2
%niter235.ncmp.1 = icmp eq i64 %niter235.next.1, %unroll_iter234
br i1 %niter235.ncmp.1, label %for.cond80.preheader.loopexit.unr-lcssa.loopexit, label %for.body63, !llvm.loop !26
for.cond.cleanup83: ; preds = %for.cond86.for.cond.cleanup89_crit_edge.us, %for.cond80.preheader
%sub118 = add nsw i32 %.lcssa152213, -1
%idxprom119 = sext i32 %sub118 to i64
%sub121 = add nsw i32 %31, -1
%idxprom122 = sext i32 %sub121 to i64
%arrayidx123 = getelementptr inbounds [1000 x [1000 x i64]], ptr @dp, i64 0, i64 %idxprom119, i64 %idxprom122
%44 = load i64, ptr %arrayidx123, align 8, !tbaa !5
%call124 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %44)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: 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 = !{!"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 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !10, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10, !16, !15}
!18 = distinct !{!18, !10}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !10, !15, !16}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10, !16, !15}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
|
#include<stdio.h>
int main()
{
int a[50];
int i,max,n,k,sum=0,j;
scanf("%d%d",&n,&k);
for(i=0; i<n; i++)
{
scanf("%d",&a[i]);
}
for(i=0; i<n; i++)
{
for(j=i+1; j<n; j++)
{
if(a[i]<a[j])
{
max=a[i];
a[i]=a[j];
a[j]=max;
}
}
}
for(i=0; i<k; i++)
{
sum=sum+a[i];
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163977/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163977/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [50 x i32], align 16
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp54 = icmp sgt i32 %0, 0
br i1 %cmp54, label %for.body, label %for.cond27.preheader
for.cond2.preheader: ; preds = %for.body
%cmp358 = icmp sgt i32 %2, 0
br i1 %cmp358, label %for.body4.preheader, label %for.cond27.preheader
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = zext i32 %2 to i64
%wide.trip.count74 = 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 [50 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond2.loopexit: ; preds = %for.inc21, %for.body4
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond75.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count74
br i1 %exitcond75.not, label %for.cond27.preheader, label %for.body4, !llvm.loop !11
for.cond27.preheader: ; preds = %for.cond2.loopexit, %entry, %for.cond2.preheader
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp2860 = icmp sgt i32 %4, 0
br i1 %cmp2860, label %for.body29.preheader, label %for.end35
for.body29.preheader: ; preds = %for.cond27.preheader
%wide.trip.count79 = zext i32 %4 to i64
%min.iters.check = icmp ult i32 %4, 8
br i1 %min.iters.check, label %for.body29.preheader85, label %vector.ph
vector.ph: ; preds = %for.body29.preheader
%n.vec = and i64 %wide.trip.count79, 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 ], [ %7, %vector.body ]
%vec.phi83 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%5 = getelementptr inbounds [50 x i32], ptr %a, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load84 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = add <4 x i32> %wide.load, %vec.phi
%8 = add <4 x i32> %wide.load84, %vec.phi83
%index.next = add nuw i64 %index, 8
%9 = icmp eq i64 %index.next, %n.vec
br i1 %9, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %8, %7
%10 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count79
br i1 %cmp.n, label %for.end35, label %for.body29.preheader85
for.body29.preheader85: ; preds = %for.body29.preheader, %middle.block
%indvars.iv76.ph = phi i64 [ 0, %for.body29.preheader ], [ %n.vec, %middle.block ]
%sum.062.ph = phi i32 [ 0, %for.body29.preheader ], [ %10, %middle.block ]
br label %for.body29
for.body4: ; preds = %for.body4.preheader, %for.cond2.loopexit
%indvars.iv71 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next72, %for.cond2.loopexit ]
%indvars.iv66 = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next67, %for.cond2.loopexit ]
%indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
%cmp656 = icmp ult i64 %indvars.iv.next72, %1
br i1 %cmp656, label %for.body7.lr.ph, label %for.cond2.loopexit
for.body7.lr.ph: ; preds = %for.body4
%arrayidx9 = getelementptr inbounds [50 x i32], ptr %a, i64 0, i64 %indvars.iv71
br label %for.body7
for.body7: ; preds = %for.body7.lr.ph, %for.inc21
%indvars.iv68 = phi i64 [ %indvars.iv66, %for.body7.lr.ph ], [ %indvars.iv.next69, %for.inc21 ]
%11 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [50 x i32], ptr %a, i64 0, i64 %indvars.iv68
%12 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp slt i32 %11, %12
br i1 %cmp12, label %if.then, label %for.inc21
if.then: ; preds = %for.body7
store i32 %12, ptr %arrayidx9, align 4, !tbaa !5
store i32 %11, ptr %arrayidx11, align 4, !tbaa !5
br label %for.inc21
for.inc21: ; preds = %for.body7, %if.then
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%exitcond.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count74
br i1 %exitcond.not, label %for.cond2.loopexit, label %for.body7, !llvm.loop !15
for.body29: ; preds = %for.body29.preheader85, %for.body29
%indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.body29 ], [ %indvars.iv76.ph, %for.body29.preheader85 ]
%sum.062 = phi i32 [ %add32, %for.body29 ], [ %sum.062.ph, %for.body29.preheader85 ]
%arrayidx31 = getelementptr inbounds [50 x i32], ptr %a, i64 0, i64 %indvars.iv76
%13 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%add32 = add nsw i32 %13, %sum.062
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%exitcond80.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count79
br i1 %exitcond80.not, label %for.end35, label %for.body29, !llvm.loop !16
for.end35: ; preds = %for.body29, %middle.block, %for.cond27.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond27.preheader ], [ %10, %middle.block ], [ %add32, %for.body29 ]
%call36 = 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 %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !14, !13}
|
#include<stdio.h>
#include<stdlib.h>
int fun(int [],int ,int );
int cmp(const void *,const void *);
int cmp(const void *a,const void *b)
{
return *(int *)b-*(int *)a;
}
int fun(int a[],int n,int k)
{
int i,sum=0;
qsort(a,n,sizeof(a[i]),cmp);
for(i=0;i<k;i++)
{
sum=sum+a[i];
}
return sum;
}
int main()
{
int a[50];
int n,k,i;
scanf("%d%d",&n,&k);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("%d\n",fun(a,n,k));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164026/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164026/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @fun(ptr noundef %a, i32 noundef %n, i32 noundef %k) local_unnamed_addr #1 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @cmp) #6
%cmp6 = icmp sgt i32 %k, 0
br i1 %cmp6, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %k to i64
%min.iters.check = icmp ult i32 %k, 8
br i1 %min.iters.check, label %for.body.preheader12, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %2, %vector.body ]
%vec.phi10 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i32, ptr %a, i64 %index
%wide.load = load <4 x i32>, ptr %0, align 4, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 4
%wide.load11 = load <4 x i32>, ptr %1, align 4, !tbaa !5
%2 = add <4 x i32> %wide.load, %vec.phi
%3 = add <4 x i32> %wide.load11, %vec.phi10
%index.next = add nuw i64 %index, 8
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %3, %2
%5 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader12
for.body.preheader12: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%sum.08.ph = phi i32 [ 0, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader12, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader12 ]
%sum.08 = phi i32 [ %add, %for.body ], [ %sum.08.ph, %for.body.preheader12 ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %6, %sum.08
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %5, %middle.block ], [ %add, %for.body ]
ret i32 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%a = alloca [50 x i32], align 16
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.i.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %2, %for.body ]
%3 = load i32, ptr %k, align 4, !tbaa !5
call void @qsort(ptr noundef nonnull %a, i64 noundef %conv.i.pre-phi, i64 noundef 4, ptr noundef nonnull @cmp) #6
%cmp6.i = icmp sgt i32 %3, 0
br i1 %cmp6.i, label %for.body.preheader.i, label %fun.exit
for.body.preheader.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %3 to i64
%min.iters.check = icmp ult i32 %3, 8
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body.preheader.i
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%vec.phi10 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%4 = getelementptr inbounds i32, ptr %a, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load11 = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = add <4 x i32> %wide.load, %vec.phi
%7 = add <4 x i32> %wide.load11, %vec.phi10
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %7, %6
%9 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %fun.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%sum.08.i.ph = phi i32 [ 0, %for.body.preheader.i ], [ %9, %middle.block ]
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%sum.08.i = phi i32 [ %add.i, %for.body.i ], [ %sum.08.i.ph, %for.body.i.preheader ]
%arrayidx.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.i
%10 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%add.i = add nsw i32 %10, %sum.08.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 %fun.exit, label %for.body.i, !llvm.loop !16
fun.exit: ; preds = %for.body.i, %middle.block, %for.end
%sum.0.lcssa.i = phi i32 [ 0, %for.end ], [ %9, %middle.block ], [ %add.i, %for.body.i ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sum.0.lcssa.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %a) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10, !12, !11}
|
#include <stdio.h>
int main(void) {
int n,i,k,j,l;
scanf("%d",&n);
int a[n+1];
int f[601]={0};
int tot=n;
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
f[a[i]]++;
}
for(i=1;i<=600;i++)
{
if(f[i]!=0)
{
tot=tot-f[i]+1;
}
}
tot=tot-f[0];
printf("%d\n",tot);
// your code goes here
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16407/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16407/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%f = alloca [601 x i32], align 16
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
%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
call void @llvm.lifetime.start.p0(i64 2404, ptr nonnull %f) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2404) %f, i8 0, i64 2404, i1 false)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not31 = icmp slt i32 %3, 1
br i1 %cmp.not31, label %for.body9.preheader, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %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)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom4 = sext i32 %4 to i64
%arrayidx5 = getelementptr inbounds [601 x i32], ptr %f, i64 0, i64 %idxprom4
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%inc = add nsw i32 %5, 1
store i32 %inc, ptr %arrayidx5, align 4, !tbaa !5
%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.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.body9.preheader, !llvm.loop !9
for.body9.preheader: ; preds = %for.body, %entry
br label %for.body9
for.body9: ; preds = %for.body9, %for.body9.preheader
%indvars.iv36 = phi i64 [ 1, %for.body9.preheader ], [ %indvars.iv.next37.3, %for.body9 ]
%tot.034 = phi i32 [ %3, %for.body9.preheader ], [ %tot.1.3, %for.body9 ]
%arrayidx11 = getelementptr inbounds [601 x i32], ptr %f, i64 0, i64 %indvars.iv36
%8 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12.not = icmp eq i32 %8, 0
%sub = add i32 %tot.034, 1
%add15 = sub i32 %sub, %8
%tot.1 = select i1 %cmp12.not, i32 %tot.034, i32 %add15
%indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
%arrayidx11.1 = getelementptr inbounds [601 x i32], ptr %f, i64 0, i64 %indvars.iv.next37
%9 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5
%cmp12.not.1 = icmp eq i32 %9, 0
%sub.1 = add i32 %tot.1, 1
%add15.1 = sub i32 %sub.1, %9
%tot.1.1 = select i1 %cmp12.not.1, i32 %tot.1, i32 %add15.1
%indvars.iv.next37.1 = add nuw nsw i64 %indvars.iv36, 2
%arrayidx11.2 = getelementptr inbounds [601 x i32], ptr %f, i64 0, i64 %indvars.iv.next37.1
%10 = load i32, ptr %arrayidx11.2, align 4, !tbaa !5
%cmp12.not.2 = icmp eq i32 %10, 0
%sub.2 = add i32 %tot.1.1, 1
%add15.2 = sub i32 %sub.2, %10
%tot.1.2 = select i1 %cmp12.not.2, i32 %tot.1.1, i32 %add15.2
%indvars.iv.next37.2 = add nuw nsw i64 %indvars.iv36, 3
%arrayidx11.3 = getelementptr inbounds [601 x i32], ptr %f, i64 0, i64 %indvars.iv.next37.2
%11 = load i32, ptr %arrayidx11.3, align 4, !tbaa !5
%cmp12.not.3 = icmp eq i32 %11, 0
%sub.3 = add i32 %tot.1.2, 1
%add15.3 = sub i32 %sub.3, %11
%tot.1.3 = select i1 %cmp12.not.3, i32 %tot.1.2, i32 %add15.3
%indvars.iv.next37.3 = add nuw nsw i64 %indvars.iv36, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next37.3, 601
br i1 %exitcond.not.3, label %for.end18, label %for.body9, !llvm.loop !11
for.end18: ; preds = %for.body9
%12 = load i32, ptr %f, align 16, !tbaa !5
%sub20 = sub nsw i32 %tot.1.3, %12
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub20)
call void @llvm.lifetime.end.p0(i64 2404, ptr nonnull %f) #5
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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress 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}
|
#include<stdio.h>
#include<stdlib.h>
int desc(const void *a, const void *b) {
return *(int *)b - *(int *)a;
}
int main(){
int k,n,l[100],i,ans=0;
scanf("%d%d",&n,&k);
for(i=0;i<n;i++){
scanf("%d",&l[i]);
}
qsort(l,n,sizeof(int),desc);
for(i=0;i<k;i++){
ans+=l[i];
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164112/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164112/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%k = alloca i32, align 4
%n = alloca i32, align 4
%l = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %l) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %l, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %2, %for.body ]
call void @qsort(ptr noundef nonnull %l, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @desc) #6
%3 = load i32, ptr %k, align 4, !tbaa !5
%cmp320 = icmp sgt i32 %3, 0
br i1 %cmp320, label %for.body5.preheader, label %for.end10
for.body5.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %3 to i64
%min.iters.check = icmp ult i32 %3, 8
br i1 %min.iters.check, label %for.body5.preheader31, label %vector.ph
vector.ph: ; preds = %for.body5.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%vec.phi29 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%4 = getelementptr inbounds [100 x i32], ptr %l, 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.load30 = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = add <4 x i32> %wide.load, %vec.phi
%7 = add <4 x i32> %wide.load30, %vec.phi29
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %7, %6
%9 = 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.end10, label %for.body5.preheader31
for.body5.preheader31: ; preds = %for.body5.preheader, %middle.block
%indvars.iv26.ph = phi i64 [ 0, %for.body5.preheader ], [ %n.vec, %middle.block ]
%ans.022.ph = phi i32 [ 0, %for.body5.preheader ], [ %9, %middle.block ]
br label %for.body5
for.body5: ; preds = %for.body5.preheader31, %for.body5
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.body5 ], [ %indvars.iv26.ph, %for.body5.preheader31 ]
%ans.022 = phi i32 [ %add, %for.body5 ], [ %ans.022.ph, %for.body5.preheader31 ]
%arrayidx7 = getelementptr inbounds [100 x i32], ptr %l, i64 0, i64 %indvars.iv26
%10 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %10, %ans.022
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%exitcond.not = icmp eq i64 %indvars.iv.next27, %wide.trip.count
br i1 %exitcond.not, label %for.end10, label %for.body5, !llvm.loop !14
for.end10: ; preds = %for.body5, %middle.block, %for.end
%ans.0.lcssa = phi i32 [ 0, %for.end ], [ %9, %middle.block ], [ %add, %for.body5 ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %l) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree 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}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
|
#include<stdio.h>
#include<string.h>
int main(){
int n,k;
int l[51];
int i,j,temp;
int x=0;
scanf("%d%d",&n,&k);
for(i=0;i<n;i++){
scanf("%d",&l[i]);
}
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(l[j]<l[j-1]){
temp=l[j-1];
l[j-1]=l[j];
l[j]=temp;
}
}
}
for(i=n-1;i>n-(k+1);i--){
x+=l[i];
}
printf("%d\n",x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164163/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164163/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%l = 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 %k) #4
call void @llvm.lifetime.start.p0(i64 204, ptr nonnull %l) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp59 = icmp sgt i32 %0, 0
br i1 %cmp59, label %for.body, label %for.cond2.preheader.for.cond30.preheader_crit_edge
for.cond2.preheader: ; preds = %for.body
%cmp365 = icmp sgt i32 %4, 0
br i1 %cmp365, label %for.cond5.preheader.lr.ph, label %for.cond2.preheader.for.cond30.preheader_crit_edge
for.cond2.preheader.for.cond30.preheader_crit_edge: ; preds = %entry, %for.cond2.preheader
%.lcssa91 = phi i32 [ %4, %for.cond2.preheader ], [ %0, %entry ]
%.pre = add nsw i32 %.lcssa91, -1
br label %for.cond30.preheader
for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader
%j.061 = add nsw i32 %4, -1
%1 = zext i32 %4 to i64
%2 = add nsw i64 %1, -1
%3 = zext i32 %j.061 to i64
%wide.trip.count = zext i32 %4 to i64
br label %for.cond5.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [51 x i32], ptr %l, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond5.preheader.lr.ph, %for.inc26
%indvars.iv82 = phi i64 [ 0, %for.cond5.preheader.lr.ph ], [ %indvars.iv.next83, %for.inc26 ]
%cmp662 = icmp ult i64 %indvars.iv82, %3
br i1 %cmp662, label %for.body7, label %for.inc26
for.cond30.preheader: ; preds = %for.inc26, %for.cond2.preheader.for.cond30.preheader_crit_edge
%.lcssa90 = phi i32 [ %.lcssa91, %for.cond2.preheader.for.cond30.preheader_crit_edge ], [ %4, %for.inc26 ]
%i.267.pre-phi = phi i32 [ %.pre, %for.cond2.preheader.for.cond30.preheader_crit_edge ], [ %j.061, %for.inc26 ]
%6 = load i32, ptr %k, align 4, !tbaa !5
%add.neg = xor i32 %6, -1
%sub31 = add i32 %.lcssa90, %add.neg
%cmp3268 = icmp sgt i32 %i.267.pre-phi, %sub31
br i1 %cmp3268, label %for.body33.preheader, label %for.end39
for.body33.preheader: ; preds = %for.cond30.preheader
%7 = sext i32 %i.267.pre-phi to i64
%8 = sext i32 %sub31 to i64
%9 = sub nsw i64 %7, %8
%min.iters.check = icmp ult i64 %9, 8
br i1 %min.iters.check, label %for.body33.preheader95, label %vector.ph
vector.ph: ; preds = %for.body33.preheader
%n.vec = and i64 %9, -8
%ind.end = sub nsw i64 %7, %n.vec
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 ], [ %13, %vector.body ]
%vec.phi92 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%offset.idx = sub i64 %7, %index
%10 = getelementptr inbounds [51 x i32], ptr %l, i64 0, i64 %offset.idx
%11 = getelementptr inbounds i32, ptr %10, i64 -3
%wide.load = load <4 x i32>, ptr %11, align 4, !tbaa !5
%reverse = shufflevector <4 x i32> %wide.load, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%12 = getelementptr inbounds i32, ptr %10, i64 -7
%wide.load93 = load <4 x i32>, ptr %12, align 4, !tbaa !5
%reverse94 = shufflevector <4 x i32> %wide.load93, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%13 = add <4 x i32> %reverse, %vec.phi
%14 = add <4 x i32> %reverse94, %vec.phi92
%index.next = add nuw i64 %index, 8
%15 = icmp eq i64 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %14, %13
%16 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %9, %n.vec
br i1 %cmp.n, label %for.end39, label %for.body33.preheader95
for.body33.preheader95: ; preds = %for.body33.preheader, %middle.block
%indvars.iv85.ph = phi i64 [ %7, %for.body33.preheader ], [ %ind.end, %middle.block ]
%x.069.ph = phi i32 [ 0, %for.body33.preheader ], [ %16, %middle.block ]
br label %for.body33
for.body7: ; preds = %for.cond5.preheader, %for.inc24
%indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.inc24 ], [ %1, %for.cond5.preheader ]
%indvars.iv74 = phi i64 [ %indvars.iv.next75, %for.inc24 ], [ %2, %for.cond5.preheader ]
%indvars.iv.next77 = add nsw i64 %indvars.iv76, -1
%arrayidx9 = getelementptr inbounds [51 x i32], ptr %l, i64 0, i64 %indvars.iv74
%17 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%18 = add nsw i64 %indvars.iv76, -2
%arrayidx12 = getelementptr inbounds [51 x i32], ptr %l, i64 0, i64 %18
%19 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13 = icmp slt i32 %17, %19
br i1 %cmp13, label %if.then, label %for.inc24
if.then: ; preds = %for.body7
store i32 %17, ptr %arrayidx12, align 4, !tbaa !5
store i32 %19, ptr %arrayidx9, align 4, !tbaa !5
br label %for.inc24
for.inc24: ; preds = %for.body7, %if.then
%indvars.iv.next75 = add nsw i64 %indvars.iv74, -1
%cmp6 = icmp sgt i64 %indvars.iv.next75, %indvars.iv82
br i1 %cmp6, label %for.body7, label %for.inc26, !llvm.loop !14
for.inc26: ; preds = %for.inc24, %for.cond5.preheader
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%exitcond.not = icmp eq i64 %indvars.iv.next83, %wide.trip.count
br i1 %exitcond.not, label %for.cond30.preheader, label %for.cond5.preheader, !llvm.loop !15
for.body33: ; preds = %for.body33.preheader95, %for.body33
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.body33 ], [ %indvars.iv85.ph, %for.body33.preheader95 ]
%x.069 = phi i32 [ %add36, %for.body33 ], [ %x.069.ph, %for.body33.preheader95 ]
%arrayidx35 = getelementptr inbounds [51 x i32], ptr %l, i64 0, i64 %indvars.iv85
%20 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%add36 = add nsw i32 %20, %x.069
%indvars.iv.next86 = add nsw i64 %indvars.iv85, -1
%cmp32 = icmp sgt i64 %indvars.iv.next86, %8
br i1 %cmp32, label %for.body33, label %for.end39, !llvm.loop !16
for.end39: ; preds = %for.body33, %middle.block, %for.cond30.preheader
%x.0.lcssa = phi i32 [ 0, %for.cond30.preheader ], [ %16, %middle.block ], [ %add36, %for.body33 ]
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %x.0.lcssa)
call void @llvm.lifetime.end.p0(i64 204, ptr nonnull %l) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!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}
!16 = distinct !{!16, !10, !13, !12}
|
#include<stdio.h>
int main(){
int n,k,temp;
scanf("%d" "%d",&n,&k);
/* printf("n;%d",n);
printf("\n");
printf("k;%d",k);
printf("\n");*/
int i[n-1];
int max[k-1];
int count=0;
int total=0;
for(int j=0;j<k;j++){
max[j] = 0;
}
for(int j=0;j<n;j++){
scanf("%d",&temp);
i[j] = temp;
}
/* for(int j=0;j<n;j++){
printf("i[%d];%d",j,i[j]);
printf("\n");
}*/
while(count != k){
for(int m=0;m<k;m++){
for(int l=0;l<n;l++){
if(max[m] < i[l]){
max[m] = i[l];
}
}
for(int q=0;q<n;q++){
if(max[m] == i[q]){
i[q] = 0;
break;
}
}
}
count = count+1;
}
/* for(int j=0;j<k;j++){
printf("max[%d];%d",j,max[j]);
printf("\n");
}
printf("cou;%d",count);
printf("\n");*/
for(int p=0;p<k;p++){
total = total + max[p];
}
printf("%d",total);
printf("\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164206/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164206/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%temp = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %temp) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%1 = zext i32 %sub to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %k, align 4, !tbaa !5
%sub1 = add nsw i32 %3, -1
%4 = zext i32 %sub1 to i64
%vla2 = alloca i32, i64 %4, align 16
%cmp87 = icmp sgt i32 %3, 0
br i1 %cmp87, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%5 = zext i32 %3 to i64
%6 = shl nuw nsw i64 %5, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla2, i8 0, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body.preheader, %entry
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp589 = icmp sgt i32 %7, 0
br i1 %cmp589, label %for.body7, label %while.cond.preheader
while.cond.preheader.loopexit: ; preds = %for.body7
%.pre = load i32, ptr %k, align 4, !tbaa !5
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.cond.preheader.loopexit, %for.cond4.preheader
%8 = phi i32 [ %3, %for.cond4.preheader ], [ %.pre, %while.cond.preheader.loopexit ]
%.lcssa86 = phi i32 [ %7, %for.cond4.preheader ], [ %18, %while.cond.preheader.loopexit ]
%cmp1696 = icmp sgt i32 %8, 0
br i1 %cmp1696, label %for.cond15.preheader.lr.ph.split.us, label %for.cond.cleanup57
for.cond15.preheader.lr.ph.split.us: ; preds = %while.cond.preheader
%cmp2091 = icmp sgt i32 %.lcssa86, 0
br i1 %cmp2091, label %for.cond15.preheader.us.us.us.preheader, label %for.body58.preheader
for.cond15.preheader.us.us.us.preheader: ; preds = %for.cond15.preheader.lr.ph.split.us
%wide.trip.count178 = zext i32 %8 to i64
%wide.trip.count = zext i32 %.lcssa86 to i64
%min.iters.check = icmp ult i32 %.lcssa86, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.cond15.preheader.us.us.us
for.cond15.preheader.us.us.us: ; preds = %for.cond15.preheader.us.us.us.preheader, %for.cond15.for.cond.cleanup17_crit_edge.split.us.split.us.us.us.us
%count.0121.us.us.us = phi i32 [ %add.us.us.us, %for.cond15.for.cond.cleanup17_crit_edge.split.us.split.us.us.us.us ], [ 0, %for.cond15.preheader.us.us.us.preheader ]
br label %for.cond19.preheader.us.us.us.us.us
for.cond19.preheader.us.us.us.us.us: ; preds = %cleanup.us.us.us.us.us, %for.cond15.preheader.us.us.us
%indvars.iv175 = phi i64 [ %indvars.iv.next176, %cleanup.us.us.us.us.us ], [ 0, %for.cond15.preheader.us.us.us ]
%arrayidx24.us.us.us.us.us = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv175
%arrayidx24.promoted.us.us.us.us.us = load i32, ptr %arrayidx24.us.us.us.us.us, align 4
br i1 %min.iters.check, label %for.body22.us.us.us.us.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond19.preheader.us.us.us.us.us
%minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %arrayidx24.promoted.us.us.us.us.us, i64 0
%minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %11, %vector.body ]
%vec.phi190 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %12, %vector.body ]
%9 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %9, align 16, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
%wide.load191 = load <4 x i32>, ptr %10, align 16, !tbaa !5
%11 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
%12 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi190, <4 x i32> %wide.load191)
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %11, <4 x i32> %12)
%14 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
br i1 %cmp.n, label %for.cond19.for.cond35.preheader_crit_edge.us.us.us.us.us, label %for.body22.us.us.us.us.us.preheader
for.body22.us.us.us.us.us.preheader: ; preds = %for.cond19.preheader.us.us.us.us.us, %middle.block
%indvars.iv167.ph = phi i64 [ 0, %for.cond19.preheader.us.us.us.us.us ], [ %n.vec, %middle.block ]
%spec.store.select93.us.us.us.us.us.ph = phi i32 [ %arrayidx24.promoted.us.us.us.us.us, %for.cond19.preheader.us.us.us.us.us ], [ %14, %middle.block ]
br label %for.body22.us.us.us.us.us
for.cond35.us.us.us.us.us: ; preds = %for.body38.us.us.us.us.us
%indvars.iv.next171 = add nuw nsw i64 %indvars.iv170, 1
%exitcond174.not = icmp eq i64 %indvars.iv.next171, %wide.trip.count
br i1 %exitcond174.not, label %cleanup.us.us.us.us.us, label %for.body38.us.us.us.us.us, !llvm.loop !13
for.body38.us.us.us.us.us: ; preds = %for.cond19.for.cond35.preheader_crit_edge.us.us.us.us.us, %for.cond35.us.us.us.us.us
%indvars.iv170 = phi i64 [ 0, %for.cond19.for.cond35.preheader_crit_edge.us.us.us.us.us ], [ %indvars.iv.next171, %for.cond35.us.us.us.us.us ]
%arrayidx42.us.us.us.us.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv170
%15 = load i32, ptr %arrayidx42.us.us.us.us.us, align 4, !tbaa !5
%cmp43.us.us.us.us.us = icmp eq i32 %spec.store.select.us.us.us.us.us.lcssa, %15
br i1 %cmp43.us.us.us.us.us, label %if.then44.us.us.us.us.us, label %for.cond35.us.us.us.us.us
if.then44.us.us.us.us.us: ; preds = %for.body38.us.us.us.us.us
%arrayidx42.us.us.us.us.us.le = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv170
store i32 0, ptr %arrayidx42.us.us.us.us.us.le, align 4, !tbaa !5
br label %cleanup.us.us.us.us.us
cleanup.us.us.us.us.us: ; preds = %for.cond35.us.us.us.us.us, %if.then44.us.us.us.us.us
%indvars.iv.next176 = add nuw nsw i64 %indvars.iv175, 1
%exitcond179.not = icmp eq i64 %indvars.iv.next176, %wide.trip.count178
br i1 %exitcond179.not, label %for.cond15.for.cond.cleanup17_crit_edge.split.us.split.us.us.us.us, label %for.cond19.preheader.us.us.us.us.us, !llvm.loop !14
for.body22.us.us.us.us.us: ; preds = %for.body22.us.us.us.us.us.preheader, %for.body22.us.us.us.us.us
%indvars.iv167 = phi i64 [ %indvars.iv.next168, %for.body22.us.us.us.us.us ], [ %indvars.iv167.ph, %for.body22.us.us.us.us.us.preheader ]
%spec.store.select93.us.us.us.us.us = phi i32 [ %spec.store.select.us.us.us.us.us, %for.body22.us.us.us.us.us ], [ %spec.store.select93.us.us.us.us.us.ph, %for.body22.us.us.us.us.us.preheader ]
%arrayidx26.us.us.us.us.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv167
%16 = load i32, ptr %arrayidx26.us.us.us.us.us, align 4, !tbaa !5
%spec.store.select.us.us.us.us.us = call i32 @llvm.smax.i32(i32 %spec.store.select93.us.us.us.us.us, i32 %16)
%indvars.iv.next168 = add nuw nsw i64 %indvars.iv167, 1
%exitcond.not = icmp eq i64 %indvars.iv.next168, %wide.trip.count
br i1 %exitcond.not, label %for.cond19.for.cond35.preheader_crit_edge.us.us.us.us.us, label %for.body22.us.us.us.us.us, !llvm.loop !15
for.cond19.for.cond35.preheader_crit_edge.us.us.us.us.us: ; preds = %for.body22.us.us.us.us.us, %middle.block
%spec.store.select.us.us.us.us.us.lcssa = phi i32 [ %14, %middle.block ], [ %spec.store.select.us.us.us.us.us, %for.body22.us.us.us.us.us ]
store i32 %spec.store.select.us.us.us.us.us.lcssa, ptr %arrayidx24.us.us.us.us.us, align 4
br label %for.body38.us.us.us.us.us
for.cond15.for.cond.cleanup17_crit_edge.split.us.split.us.us.us.us: ; preds = %cleanup.us.us.us.us.us
%add.us.us.us = add nuw nsw i32 %count.0121.us.us.us, 1
%cmp14.not.us.us.us = icmp eq i32 %add.us.us.us, %8
br i1 %cmp14.not.us.us.us, label %for.cond55.preheader, label %for.cond15.preheader.us.us.us, !llvm.loop !16
for.body7: ; preds = %for.cond4.preheader, %for.body7
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body7 ], [ 0, %for.cond4.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %temp)
%17 = load i32, ptr %temp, align 4, !tbaa !5
%arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
store i32 %17, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%18 = load i32, ptr %n, align 4, !tbaa !5
%19 = sext i32 %18 to i64
%cmp5 = icmp slt i64 %indvars.iv.next, %19
br i1 %cmp5, label %for.body7, label %while.cond.preheader.loopexit, !llvm.loop !17
for.cond55.preheader: ; preds = %for.cond15.for.cond.cleanup17_crit_edge.split.us.split.us.us.us.us
%cmp56158 = icmp sgt i32 %8, 0
br i1 %cmp56158, label %for.body58.preheader, label %for.cond.cleanup57
for.body58.preheader: ; preds = %for.cond15.preheader.lr.ph.split.us, %for.cond55.preheader
%wide.trip.count183 = zext i32 %8 to i64
%min.iters.check194 = icmp ult i32 %8, 8
br i1 %min.iters.check194, label %for.body58.preheader208, label %vector.ph195
vector.ph195: ; preds = %for.body58.preheader
%n.vec197 = and i64 %wide.trip.count183, 4294967288
br label %vector.body200
vector.body200: ; preds = %vector.body200, %vector.ph195
%index201 = phi i64 [ 0, %vector.ph195 ], [ %index.next206, %vector.body200 ]
%vec.phi202 = phi <4 x i32> [ zeroinitializer, %vector.ph195 ], [ %22, %vector.body200 ]
%vec.phi203 = phi <4 x i32> [ zeroinitializer, %vector.ph195 ], [ %23, %vector.body200 ]
%20 = getelementptr inbounds i32, ptr %vla2, i64 %index201
%wide.load204 = load <4 x i32>, ptr %20, align 16, !tbaa !5
%21 = getelementptr inbounds i32, ptr %20, i64 4
%wide.load205 = load <4 x i32>, ptr %21, align 16, !tbaa !5
%22 = add <4 x i32> %wide.load204, %vec.phi202
%23 = add <4 x i32> %wide.load205, %vec.phi203
%index.next206 = add nuw i64 %index201, 8
%24 = icmp eq i64 %index.next206, %n.vec197
br i1 %24, label %middle.block192, label %vector.body200, !llvm.loop !18
middle.block192: ; preds = %vector.body200
%bin.rdx = add <4 x i32> %23, %22
%25 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n199 = icmp eq i64 %n.vec197, %wide.trip.count183
br i1 %cmp.n199, label %for.cond.cleanup57, label %for.body58.preheader208
for.body58.preheader208: ; preds = %for.body58.preheader, %middle.block192
%indvars.iv180.ph = phi i64 [ 0, %for.body58.preheader ], [ %n.vec197, %middle.block192 ]
%total.0159.ph = phi i32 [ 0, %for.body58.preheader ], [ %25, %middle.block192 ]
br label %for.body58
for.cond.cleanup57: ; preds = %for.body58, %middle.block192, %while.cond.preheader, %for.cond55.preheader
%total.0.lcssa = phi i32 [ 0, %for.cond55.preheader ], [ 0, %while.cond.preheader ], [ %25, %middle.block192 ], [ %add61, %for.body58 ]
%call66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %total.0.lcssa)
%putchar = call i32 @putchar(i32 10)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %temp) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
for.body58: ; preds = %for.body58.preheader208, %for.body58
%indvars.iv180 = phi i64 [ %indvars.iv.next181, %for.body58 ], [ %indvars.iv180.ph, %for.body58.preheader208 ]
%total.0159 = phi i32 [ %add61, %for.body58 ], [ %total.0159.ph, %for.body58.preheader208 ]
%arrayidx60 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv180
%26 = load i32, ptr %arrayidx60, align 4, !tbaa !5
%add61 = add nsw i32 %26, %total.0159
%indvars.iv.next181 = add nuw nsw i64 %indvars.iv180, 1
%exitcond184.not = icmp eq i64 %indvars.iv.next181, %wide.trip.count183
br i1 %exitcond184.not, label %for.cond.cleanup57, label %for.body58, !llvm.loop !19
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
; 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !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, !12, !11}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !11, !12}
!19 = distinct !{!19, !10, !12, !11}
|
#include <stdlib.h>
#include <stdio.h>
int main() {
unsigned int a[100];
unsigned int n;
scanf("%u",&n);
unsigned int i,j;
for(j=0;j<n;++j)
scanf("%u",&a[j]);
unsigned int ans=0;
for(i=1;i<=600;++i){
for(j=0;j<n;++j){
if(a[j]==i){
++ans;
break;
}
}
}
printf("%u\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16425/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16425/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%u\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%u\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [100 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #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
%cmp27.not = icmp eq i32 %0, 0
br i1 %cmp27.not, label %for.end17, label %for.body
for.cond2.preheader: ; preds = %for.body
%cmp629.not = icmp eq i32 %3, 0
br i1 %cmp629.not, label %for.end17, label %for.cond5.preheader.us.preheader
for.cond5.preheader.us.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %3 to i64
br label %for.cond5.preheader.us
for.cond5.preheader.us: ; preds = %for.inc15.us.1, %for.cond5.preheader.us.preheader
%ans.033.us = phi i32 [ 0, %for.cond5.preheader.us.preheader ], [ %ans.1.us.1, %for.inc15.us.1 ]
%i.031.us = phi i32 [ 1, %for.cond5.preheader.us.preheader ], [ %inc16.us.1, %for.inc15.us.1 ]
br label %for.body7.us
for.cond5.us: ; preds = %for.body7.us
%indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
%exitcond.not = icmp eq i64 %indvars.iv.next38, %wide.trip.count
br i1 %exitcond.not, label %for.inc15.us, label %for.body7.us, !llvm.loop !9
for.body7.us: ; preds = %for.cond5.preheader.us, %for.cond5.us
%indvars.iv37 = phi i64 [ 0, %for.cond5.preheader.us ], [ %indvars.iv.next38, %for.cond5.us ]
%arrayidx9.us = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv37
%1 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%cmp10.us = icmp eq i32 %1, %i.031.us
br i1 %cmp10.us, label %if.then.us, label %for.cond5.us
if.then.us: ; preds = %for.body7.us
%inc11.us = add i32 %ans.033.us, 1
br label %for.inc15.us
for.inc15.us: ; preds = %for.cond5.us, %if.then.us
%ans.1.us = phi i32 [ %inc11.us, %if.then.us ], [ %ans.033.us, %for.cond5.us ]
%inc16.us = add nuw nsw i32 %i.031.us, 1
br label %for.body7.us.1
for.body7.us.1: ; preds = %for.cond5.us.1, %for.inc15.us
%indvars.iv37.1 = phi i64 [ 0, %for.inc15.us ], [ %indvars.iv.next38.1, %for.cond5.us.1 ]
%arrayidx9.us.1 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv37.1
%2 = load i32, ptr %arrayidx9.us.1, align 4, !tbaa !5
%cmp10.us.1 = icmp eq i32 %2, %inc16.us
br i1 %cmp10.us.1, label %if.then.us.1, label %for.cond5.us.1
for.cond5.us.1: ; preds = %for.body7.us.1
%indvars.iv.next38.1 = add nuw nsw i64 %indvars.iv37.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next38.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc15.us.1, label %for.body7.us.1, !llvm.loop !9
if.then.us.1: ; preds = %for.body7.us.1
%inc11.us.1 = add i32 %ans.1.us, 1
br label %for.inc15.us.1
for.inc15.us.1: ; preds = %for.cond5.us.1, %if.then.us.1
%ans.1.us.1 = phi i32 [ %inc11.us.1, %if.then.us.1 ], [ %ans.1.us, %for.cond5.us.1 ]
%inc16.us.1 = add nuw nsw i32 %i.031.us, 2
%exitcond40.not.1 = icmp eq i32 %inc16.us.1, 601
br i1 %exitcond40.not.1, label %for.end17, label %for.cond5.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 [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
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%cmp = icmp ult i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !12
for.end17: ; preds = %for.inc15.us.1, %entry, %for.cond2.preheader
%.us-phi = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %ans.1.us.1, %for.inc15.us.1 ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.us-phi)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(){
int a[1];
int C;
int ans;
if(scanf("%d", &a[0])==1){}
C = (int)((double)a[0]/100);
if(100*C <= a[0] && a[0]<=105*C){
ans = 1;
}else{
ans = 0;
}
printf("%d\n", ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164293/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164293/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [1 x i32], align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%div = fdiv double %conv, 1.000000e+02
%conv2 = fptosi double %div to i32
%mul = mul nsw i32 %conv2, 100
%cmp4.not = icmp sle i32 %mul, %0
%mul7 = mul nsw i32 %conv2, 105
%cmp8.not = icmp sle i32 %0, %mul7
%or.cond.not = select i1 %cmp4.not, i1 %cmp8.not, i1 false
%ans.0 = zext i1 %or.cond.not to i32
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #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 <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>
int main (void)
{
intmax_t X;
intmax_t ans = 0;
scanf("%jd", &X);
X -= ((X % 100) / 5) * 105;
if (X < 0) {
puts("0");
return 0;
}
if ((X % 100) > 0)
X -= 100 + (X % 100);
if (X < 0) {
puts("0");
return 0;
}
puts("1");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164336/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164336/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%jd\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"0\00", align 1
@.str.2 = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%X = alloca i64, align 8
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 %X)
%0 = load i64, ptr %X, align 8, !tbaa !5
%rem = srem i64 %0, 100
%div.lhs.trunc = trunc i64 %rem to i8
%div15 = sdiv i8 %div.lhs.trunc, 5
%div.sext = sext i8 %div15 to i64
%mul.neg = mul nsw i64 %div.sext, -105
%sub = add i64 %mul.neg, %0
store i64 %sub, ptr %X, align 8, !tbaa !5
%cmp = icmp slt i64 %sub, 0
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%rem2 = urem i64 %sub, 100
%cmp3.not = icmp eq i64 %rem2, 0
br i1 %cmp3.not, label %if.end11, label %if.end7
if.end7: ; preds = %if.end
%add.neg = add nsw i64 %sub, -100
%sub6 = sub nsw i64 %add.neg, %rem2
store i64 %sub6, ptr %X, align 8, !tbaa !5
%cmp8 = icmp slt i64 %sub6, 0
br i1 %cmp8, label %cleanup, label %if.end11
if.end11: ; preds = %if.end, %if.end7
br label %cleanup
cleanup: ; preds = %if.end7, %entry, %if.end11
%.str.2.sink = phi ptr [ @.str.2, %if.end11 ], [ @.str.1, %entry ], [ @.str.1, %if.end7 ]
%call12 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
int memo[601] = {0};
int main()
{
int n = 0;
scanf("%d",&n);
int temp = 0;
int count = 0;
while ( n-- )
{
scanf("%d",&temp);
memo[temp]++;
}
for ( int i = 1; i < 601 ; i++ )
{
if ( memo[i] > 0 )
{
count++;
}
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16438/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16438/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@memo = dso_local local_unnamed_addr global [601 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%temp = 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %temp) #4
store i32 0, ptr %temp, align 4, !tbaa !5
%0 = load i32, ptr %n, align 4, !tbaa !5
%dec11 = add nsw i32 %0, -1
store i32 %dec11, ptr %n, align 4, !tbaa !5
%tobool.not12 = icmp eq i32 %0, 0
br i1 %tobool.not12, label %vector.body.preheader, label %while.body
vector.body.preheader: ; preds = %while.body, %entry
br label %vector.body
vector.body: ; preds = %vector.body.1, %vector.body.preheader
%index = phi i64 [ 0, %vector.body.preheader ], [ %index.next.1, %vector.body.1 ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.body.preheader ], [ %16, %vector.body.1 ]
%vec.phi16 = phi <4 x i32> [ zeroinitializer, %vector.body.preheader ], [ %17, %vector.body.1 ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds [601 x i32], ptr @memo, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %1, align 4, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
%wide.load17 = load <4 x i32>, ptr %2, align 4, !tbaa !5
%3 = icmp sgt <4 x i32> %wide.load, zeroinitializer
%4 = icmp sgt <4 x i32> %wide.load17, zeroinitializer
%5 = zext <4 x i1> %3 to <4 x i32>
%6 = zext <4 x i1> %4 to <4 x i32>
%7 = add <4 x i32> %vec.phi, %5
%8 = add <4 x i32> %vec.phi16, %6
%9 = icmp eq i64 %index, 592
br i1 %9, label %middle.block, label %vector.body.1, !llvm.loop !9
vector.body.1: ; preds = %vector.body
%offset.idx.1 = or i64 %index, 9
%10 = getelementptr inbounds [601 x i32], ptr @memo, i64 0, i64 %offset.idx.1
%wide.load.1 = load <4 x i32>, ptr %10, align 4, !tbaa !5
%11 = getelementptr inbounds i32, ptr %10, i64 4
%wide.load17.1 = load <4 x i32>, ptr %11, align 4, !tbaa !5
%12 = icmp sgt <4 x i32> %wide.load.1, zeroinitializer
%13 = icmp sgt <4 x i32> %wide.load17.1, zeroinitializer
%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> %7, %14
%17 = add <4 x i32> %8, %15
%index.next.1 = add nuw nsw i64 %index, 16
br label %vector.body
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %8, %7
%18 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %temp) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
while.body: ; preds = %entry, %while.body
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %temp)
%19 = load i32, ptr %temp, align 4, !tbaa !5
%idxprom = sext i32 %19 to i64
%arrayidx = getelementptr inbounds [601 x i32], ptr @memo, i64 0, i64 %idxprom
%20 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %20, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%21 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %21, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %21, 0
br i1 %tobool.not, label %vector.body.preheader, label %while.body, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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}
|
#include <stdio.h>
int main(void){
int n, p[100], a, b, i, cnta=0, cntb=0, acntb=0, min;
scanf("%d", &n);
scanf("%d %d", &a, &b);
for(i=0;i<n;i++){
scanf("%d", &p[i]);
}
for(i=0;i<n;i++){
if(p[i]<=a)
cnta++;
else if(a < p[i] && p[i] <= b)
acntb++;
else if(p[i] > b)
cntb++;
}
min=cnta;
if(min>acntb)
min=acntb;
if(min>cntb)
min=cntb;
printf("%d\n", min);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164422/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164422/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%p = alloca [100 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 400, ptr nonnull %p) #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)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp52 = icmp sgt i32 %0, 0
br i1 %cmp52, label %for.body, label %for.end28
for.cond3.preheader: ; preds = %for.body
%cmp454 = icmp sgt i32 %4, 0
br i1 %cmp454, label %for.body5.lr.ph, label %for.end28
for.body5.lr.ph: ; preds = %for.cond3.preheader
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count, 1
%3 = icmp eq i32 %4, 1
br i1 %3, label %for.end28.loopexit.unr-lcssa, label %for.body5.lr.ph.new
for.body5.lr.ph.new: ; preds = %for.body5.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body5
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %p, i64 0, i64 %indvars.iv
%call2 = 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.cond3.preheader, !llvm.loop !9
for.body5: ; preds = %for.inc26.1, %for.body5.lr.ph.new
%indvars.iv64 = phi i64 [ 0, %for.body5.lr.ph.new ], [ %indvars.iv.next65.1, %for.inc26.1 ]
%acntb.058 = phi i32 [ 0, %for.body5.lr.ph.new ], [ %acntb.1.1, %for.inc26.1 ]
%cntb.057 = phi i32 [ 0, %for.body5.lr.ph.new ], [ %cntb.1.1, %for.inc26.1 ]
%cnta.056 = phi i32 [ 0, %for.body5.lr.ph.new ], [ %cnta.1.1, %for.inc26.1 ]
%niter = phi i64 [ 0, %for.body5.lr.ph.new ], [ %niter.next.1, %for.inc26.1 ]
%arrayidx7 = getelementptr inbounds [100 x i32], ptr %p, i64 0, i64 %indvars.iv64
%6 = load i32, ptr %arrayidx7, align 8, !tbaa !5
%cmp8.not = icmp sgt i32 %6, %1
br i1 %cmp8.not, label %land.lhs.true, label %if.then
if.then: ; preds = %for.body5
%inc9 = add nsw i32 %cnta.056, 1
br label %for.inc26
land.lhs.true: ; preds = %for.body5
%cmp15.not = icmp sgt i32 %6, %2
br i1 %cmp15.not, label %if.else18, label %if.then16
if.then16: ; preds = %land.lhs.true
%inc17 = add nsw i32 %acntb.058, 1
br label %for.inc26
if.else18: ; preds = %land.lhs.true
%inc23 = add nsw i32 %cntb.057, 1
br label %for.inc26
for.inc26: ; preds = %if.else18, %if.then, %if.then16
%cnta.1 = phi i32 [ %inc9, %if.then ], [ %cnta.056, %if.then16 ], [ %cnta.056, %if.else18 ]
%cntb.1 = phi i32 [ %cntb.057, %if.then ], [ %cntb.057, %if.then16 ], [ %inc23, %if.else18 ]
%acntb.1 = phi i32 [ %acntb.058, %if.then ], [ %inc17, %if.then16 ], [ %acntb.058, %if.else18 ]
%indvars.iv.next65 = or i64 %indvars.iv64, 1
%arrayidx7.1 = getelementptr inbounds [100 x i32], ptr %p, i64 0, i64 %indvars.iv.next65
%7 = load i32, ptr %arrayidx7.1, align 4, !tbaa !5
%cmp8.not.1 = icmp sgt i32 %7, %1
br i1 %cmp8.not.1, label %land.lhs.true.1, label %if.then.1
if.then.1: ; preds = %for.inc26
%inc9.1 = add nsw i32 %cnta.1, 1
br label %for.inc26.1
land.lhs.true.1: ; preds = %for.inc26
%cmp15.not.1 = icmp sgt i32 %7, %2
br i1 %cmp15.not.1, label %if.else18.1, label %if.then16.1
if.then16.1: ; preds = %land.lhs.true.1
%inc17.1 = add nsw i32 %acntb.1, 1
br label %for.inc26.1
if.else18.1: ; preds = %land.lhs.true.1
%inc23.1 = add nsw i32 %cntb.1, 1
br label %for.inc26.1
for.inc26.1: ; preds = %if.else18.1, %if.then16.1, %if.then.1
%cnta.1.1 = phi i32 [ %inc9.1, %if.then.1 ], [ %cnta.1, %if.then16.1 ], [ %cnta.1, %if.else18.1 ]
%cntb.1.1 = phi i32 [ %cntb.1, %if.then.1 ], [ %cntb.1, %if.then16.1 ], [ %inc23.1, %if.else18.1 ]
%acntb.1.1 = phi i32 [ %acntb.1, %if.then.1 ], [ %inc17.1, %if.then16.1 ], [ %acntb.1, %if.else18.1 ]
%indvars.iv.next65.1 = add nuw nsw i64 %indvars.iv64, 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.end28.loopexit.unr-lcssa, label %for.body5, !llvm.loop !11
for.end28.loopexit.unr-lcssa: ; preds = %for.inc26.1, %for.body5.lr.ph
%cnta.1.lcssa.ph = phi i32 [ undef, %for.body5.lr.ph ], [ %cnta.1.1, %for.inc26.1 ]
%cntb.1.lcssa.ph = phi i32 [ undef, %for.body5.lr.ph ], [ %cntb.1.1, %for.inc26.1 ]
%acntb.1.lcssa.ph = phi i32 [ undef, %for.body5.lr.ph ], [ %acntb.1.1, %for.inc26.1 ]
%indvars.iv64.unr = phi i64 [ 0, %for.body5.lr.ph ], [ %indvars.iv.next65.1, %for.inc26.1 ]
%acntb.058.unr = phi i32 [ 0, %for.body5.lr.ph ], [ %acntb.1.1, %for.inc26.1 ]
%cntb.057.unr = phi i32 [ 0, %for.body5.lr.ph ], [ %cntb.1.1, %for.inc26.1 ]
%cnta.056.unr = phi i32 [ 0, %for.body5.lr.ph ], [ %cnta.1.1, %for.inc26.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end28, label %for.body5.epil
for.body5.epil: ; preds = %for.end28.loopexit.unr-lcssa
%arrayidx7.epil = getelementptr inbounds [100 x i32], ptr %p, i64 0, i64 %indvars.iv64.unr
%8 = load i32, ptr %arrayidx7.epil, align 4, !tbaa !5
%cmp8.not.epil = icmp sgt i32 %8, %1
br i1 %cmp8.not.epil, label %land.lhs.true.epil, label %if.then.epil
if.then.epil: ; preds = %for.body5.epil
%inc9.epil = add nsw i32 %cnta.056.unr, 1
br label %for.end28
land.lhs.true.epil: ; preds = %for.body5.epil
%cmp15.not.epil = icmp sgt i32 %8, %2
br i1 %cmp15.not.epil, label %if.else18.epil, label %if.then16.epil
if.then16.epil: ; preds = %land.lhs.true.epil
%inc17.epil = add nsw i32 %acntb.058.unr, 1
br label %for.end28
if.else18.epil: ; preds = %land.lhs.true.epil
%inc23.epil = add nsw i32 %cntb.057.unr, 1
br label %for.end28
for.end28: ; preds = %for.end28.loopexit.unr-lcssa, %if.else18.epil, %if.then16.epil, %if.then.epil, %entry, %for.cond3.preheader
%cnta.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %cnta.1.lcssa.ph, %for.end28.loopexit.unr-lcssa ], [ %inc9.epil, %if.then.epil ], [ %cnta.056.unr, %if.then16.epil ], [ %cnta.056.unr, %if.else18.epil ]
%cntb.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %cntb.1.lcssa.ph, %for.end28.loopexit.unr-lcssa ], [ %cntb.057.unr, %if.then.epil ], [ %cntb.057.unr, %if.then16.epil ], [ %inc23.epil, %if.else18.epil ]
%acntb.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %acntb.1.lcssa.ph, %for.end28.loopexit.unr-lcssa ], [ %acntb.058.unr, %if.then.epil ], [ %inc17.epil, %if.then16.epil ], [ %acntb.058.unr, %if.else18.epil ]
%spec.select51 = call i32 @llvm.smin.i32(i32 %cnta.0.lcssa, i32 %acntb.0.lcssa)
%min.1 = call i32 @llvm.smin.i32(i32 %spec.select51, i32 %cntb.0.lcssa)
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %min.1)
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 400, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define absl(v) labs((v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
ll res = 1;
while (n > 0) {
if (n & 1){
res *= a; if(mod>=1) res %= mod;
}
a *= a; if(mod>=1) a %= mod;
n >>= 1;
}
return res;
}
void initialize(){
}
int main(void){
initialize();
ll n,m,i,j,k,result=0,tmp;
int a[LIMIT2]={0};
char s[LIMIT1];
ll dp[LIMIT1][2];
scanf("%lld",&n);
rep(i,n) scanf("%d",&a[i]);
dp[0][0]=0;
dp[1][0]=(ll)a[0];
for(i=2;i<n;i++){
dp[i][0]=gcd(dp[i-1][0],(ll)a[i-1]);
}
dp[n-2][1]=(ll)a[n-1];
dp[n-1][1]=0;
for(i=n-3;i>=0;i--){
dp[i][1]=gcd(dp[i+1][1],(ll)a[i+1]);
}
/*
rep(i,n) printf("%lld ",dp[i][0]);
printf("\n");
rep(i,n) printf("%lld ",dp[i][1]);*/
rep(i,n){
if(dp[i][0]==0) tmp=dp[i][1];
else if(dp[i][1]==0) tmp=dp[i][0];
else tmp=gcd(dp[i][0],dp[i][1]);
result = max(tmp,result);
}
printf("%lld",result);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164473/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164473/source.c"
target datalayout = "e-m:e-p270: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 0, i32 1, i32 -1, i32 -1, i32 1], align 16
@dy = dso_local local_unnamed_addr global [8 x i32] [i32 0, i32 1, i32 0, i32 -1, i32 1, i32 1, i32 -1, i32 -1], align 16
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\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:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %cond.end, label %cond.true
cond.true: ; preds = %entry, %cond.true
%b.tr6 = phi i64 [ %rem, %cond.true ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %cond.true ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %cond.end, label %cond.true
cond.end: ; preds = %cond.true, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %cond.true ]
ret i64 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @nPr(i32 noundef %n, i32 noundef %r) local_unnamed_addr #0 {
entry:
%conv = sext i32 %r to i64
%cmp6 = icmp sgt i32 %r, 0
br i1 %cmp6, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%conv2 = sext i32 %n to i64
%xtraiter = and i64 %conv, 7
%0 = icmp ult i32 %r, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %conv, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%result.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %mul.7, %for.body ]
%i.07 = phi i64 [ 0, %for.body.lr.ph.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.7, %for.body ]
%sub = sub nsw i64 %conv2, %i.07
%mul = mul nsw i64 %result.08, %sub
%inc.neg = xor i64 %i.07, -1
%sub.1 = add i64 %inc.neg, %conv2
%mul.1 = mul nsw i64 %mul, %sub.1
%inc.1 = or i64 %i.07, 2
%sub.2 = sub nsw i64 %conv2, %inc.1
%mul.2 = mul nsw i64 %mul.1, %sub.2
%inc.2 = or i64 %i.07, 3
%sub.3 = sub nsw i64 %conv2, %inc.2
%mul.3 = mul nsw i64 %mul.2, %sub.3
%inc.3 = or i64 %i.07, 4
%sub.4 = sub nsw i64 %conv2, %inc.3
%mul.4 = mul nsw i64 %mul.3, %sub.4
%inc.4 = or i64 %i.07, 5
%sub.5 = sub nsw i64 %conv2, %inc.4
%mul.5 = mul nsw i64 %mul.4, %sub.5
%inc.5 = or i64 %i.07, 6
%sub.6 = sub nsw i64 %conv2, %inc.5
%mul.6 = mul nsw i64 %mul.5, %sub.6
%inc.6 = or i64 %i.07, 7
%sub.7 = sub nsw i64 %conv2, %inc.6
%mul.7 = mul nsw i64 %mul.6, %sub.7
%inc.7 = add nuw nsw i64 %i.07, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !5
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%mul.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %mul.7, %for.body ]
%result.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %mul.7, %for.body ]
%i.07.unr = phi i64 [ 0, %for.body.lr.ph ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%result.08.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %result.08.unr, %for.end.loopexit.unr-lcssa ]
%i.07.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.07.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%sub.epil = sub nsw i64 %conv2, %i.07.epil
%mul.epil = mul nsw i64 %result.08.epil, %sub.epil
%inc.epil = add nuw nsw i64 %i.07.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !7
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%result.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %result.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @nCr(i32 noundef %n, i32 noundef %r) local_unnamed_addr #2 {
entry:
%cmp = icmp slt i32 %n, %r
br i1 %cmp, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%sub = sub nsw i32 %n, %r
%cond = tail call i32 @llvm.smin.i32(i32 %sub, i32 %r)
%conv = sext i32 %cond to i64
%cmp320 = icmp sgt i32 %cond, 0
br i1 %cmp320, label %for.body.lr.ph, label %cleanup
for.body.lr.ph: ; preds = %for.cond.preheader
%conv5 = sext i32 %n to i64
%xtraiter = and i64 %conv, 1
%0 = icmp eq i32 %cond, 1
br i1 %0, label %cleanup.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %conv, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%result.022 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.021 = phi i64 [ 0, %for.body.lr.ph.new ], [ %add.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub6 = sub nsw i64 %conv5, %i.021
%mul = mul nsw i64 %result.022, %sub6
%add = or i64 %i.021, 1
%div = sdiv i64 %mul, %add
%sub6.1 = sub nsw i64 %conv5, %add
%mul.1 = mul nsw i64 %div, %sub6.1
%add.1 = add nuw nsw i64 %i.021, 2
%div.1 = sdiv i64 %mul.1, %add.1
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !9
cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%result.022.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.021.unr = phi i64 [ 0, %for.body.lr.ph ], [ %add.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %cleanup, label %for.body.epil
for.body.epil: ; preds = %cleanup.loopexit.unr-lcssa
%sub6.epil = sub nsw i64 %conv5, %i.021.unr
%mul.epil = mul nsw i64 %result.022.unr, %sub6.epil
%add.epil = add nuw nsw i64 %i.021.unr, 1
%div.epil = sdiv i64 %mul.epil, %add.epil
br label %cleanup
cleanup: ; preds = %for.body.epil, %cleanup.loopexit.unr-lcssa, %for.cond.preheader, %entry
%retval.0 = phi i64 [ 0, %entry ], [ 1, %for.cond.preheader ], [ %div.lcssa.ph, %cleanup.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upint(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !10
%1 = load i32, ptr %b, align 4, !tbaa !10
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp sgt i32 %0, %1
%cond = zext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 -1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downint(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !10
%1 = load i32, ptr %b, align 4, !tbaa !10
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp sgt i32 %0, %1
%cond = sext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upchar(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %left, ptr noundef nonnull dereferenceable(1) %right) #12
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downchar(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %right, ptr noundef nonnull dereferenceable(1) %left) #12
ret i32 %call
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: write) uwtable
define dso_local void @tmpInit(ptr nocapture noundef writeonly %c, i64 noundef %m) local_unnamed_addr #6 {
entry:
%cmp4 = icmp sgt i64 %m, 0
br i1 %cmp4, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %m, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %m, -8
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = getelementptr inbounds i32, ptr %c, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 4, !tbaa !10
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 4, !tbaa !10
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %m
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%i.05.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%i.05 = phi i64 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader7 ]
%conv = trunc i64 %i.05 to i32
%arrayidx = getelementptr inbounds i32, ptr %c, i64 %i.05
store i32 %conv, ptr %arrayidx, align 4, !tbaa !10
%inc = add nuw nsw i64 %i.05, 1
%exitcond.not = icmp eq i64 %inc, %m
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !17
for.end: ; preds = %for.body, %middle.block, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @modpow(i64 noundef %a, i64 noundef %n, i64 noundef %mod) local_unnamed_addr #0 {
entry:
%cmp29 = icmp sgt i64 %n, 0
br i1 %cmp29, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%cmp1 = icmp sgt i64 %mod, 0
br i1 %cmp1, label %while.body.us.us, label %while.body
while.body.us.us: ; preds = %while.body.lr.ph, %if.then6.us.us
%res.032.us.us = phi i64 [ %res.123.us.us, %if.then6.us.us ], [ 1, %while.body.lr.ph ]
%a.addr.031.us.us = phi i64 [ %rem7.us.us, %if.then6.us.us ], [ %a, %while.body.lr.ph ]
%n.addr.030.us.us = phi i64 [ %shr.us.us, %if.then6.us.us ], [ %n, %while.body.lr.ph ]
%and.us.us = and i64 %n.addr.030.us.us, 1
%tobool.not.us.us = icmp eq i64 %and.us.us, 0
br i1 %tobool.not.us.us, label %if.then6.us.us, label %if.then.us.us
if.then.us.us: ; preds = %while.body.us.us
%mul.us.us = mul nsw i64 %res.032.us.us, %a.addr.031.us.us
%rem.us.us = srem i64 %mul.us.us, %mod
br label %if.then6.us.us
if.then6.us.us: ; preds = %while.body.us.us, %if.then.us.us
%res.123.us.us = phi i64 [ %rem.us.us, %if.then.us.us ], [ %res.032.us.us, %while.body.us.us ]
%mul424.us.us = mul nsw i64 %a.addr.031.us.us, %a.addr.031.us.us
%rem7.us.us = srem i64 %mul424.us.us, %mod
%shr.us.us = lshr i64 %n.addr.030.us.us, 1
%cmp.us.us.not = icmp ult i64 %n.addr.030.us.us, 2
br i1 %cmp.us.us.not, label %while.end, label %while.body.us.us, !llvm.loop !18
while.body: ; preds = %while.body.lr.ph, %while.body
%res.032 = phi i64 [ %spec.select, %while.body ], [ 1, %while.body.lr.ph ]
%a.addr.031 = phi i64 [ %a.addr.1, %while.body ], [ %a, %while.body.lr.ph ]
%n.addr.030 = phi i64 [ %shr, %while.body ], [ %n, %while.body.lr.ph ]
%and = and i64 %n.addr.030, 1
%tobool.not = icmp eq i64 %and, 0
%mul = select i1 %tobool.not, i64 1, i64 %a.addr.031
%spec.select = mul nsw i64 %res.032, %mul
%a.addr.1 = mul nsw i64 %a.addr.031, %a.addr.031
%shr = lshr i64 %n.addr.030, 1
%cmp.not = icmp ult i64 %n.addr.030, 2
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %while.body, %if.then6.us.us, %entry
%res.0.lcssa = phi i64 [ 1, %entry ], [ %res.123.us.us, %if.then6.us.us ], [ %spec.select, %while.body ]
ret i64 %res.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local void @initialize() local_unnamed_addr #7 {
entry:
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #8 {
entry:
%n = alloca i64, align 8
%a = alloca [500002 x i32], align 16
%dp = alloca [200002 x [2 x i64]], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #13
call void @llvm.lifetime.start.p0(i64 2000008, ptr nonnull %a) #13
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2000008) %a, i8 0, i64 2000008, i1 false)
call void @llvm.lifetime.start.p0(i64 3200032, ptr nonnull %dp) #13
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !19
%cmp117 = icmp sgt i64 %0, 0
br i1 %cmp117, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
store i64 0, ptr %dp, align 16, !tbaa !19
%arrayidx5131 = getelementptr inbounds [200002 x [2 x i64]], ptr %dp, i64 0, i64 1
store i64 0, ptr %arrayidx5131, align 16, !tbaa !19
br label %for.end21
for.body: ; preds = %entry, %for.body
%i.0118 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500002 x i32], ptr %a, i64 0, i64 %i.0118
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.0118, 1
%1 = load i64, ptr %n, align 8, !tbaa !19
%cmp = icmp slt i64 %inc, %1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !21
for.end: ; preds = %for.body
%.pre = load i32, ptr %a, align 16, !tbaa !10
%2 = sext i32 %.pre to i64
store i64 0, ptr %dp, align 16, !tbaa !19
%arrayidx5 = getelementptr inbounds [200002 x [2 x i64]], ptr %dp, i64 0, i64 1
store i64 %2, ptr %arrayidx5, align 16, !tbaa !19
%cmp8119 = icmp sgt i64 %1, 2
br i1 %cmp8119, label %for.body10, label %for.end21
for.body10: ; preds = %for.end, %gcd.exit
%3 = phi i64 [ %a.tr.lcssa.i, %gcd.exit ], [ %2, %for.end ]
%i.1120 = phi i64 [ %inc20, %gcd.exit ], [ 2, %for.end ]
%sub = add nsw i64 %i.1120, -1
%arrayidx14 = getelementptr inbounds [500002 x i32], ptr %a, i64 0, i64 %sub
%4 = load i32, ptr %arrayidx14, align 4, !tbaa !10
%tobool.not4.i = icmp eq i32 %4, 0
br i1 %tobool.not4.i, label %gcd.exit, label %cond.true.i.preheader
cond.true.i.preheader: ; preds = %for.body10
%conv15 = sext i32 %4 to i64
br label %cond.true.i
cond.true.i: ; preds = %cond.true.i.preheader, %cond.true.i
%b.tr6.i = phi i64 [ %rem.i, %cond.true.i ], [ %conv15, %cond.true.i.preheader ]
%a.tr5.i = phi i64 [ %b.tr6.i, %cond.true.i ], [ %3, %cond.true.i.preheader ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %cond.true.i
gcd.exit: ; preds = %cond.true.i, %for.body10
%a.tr.lcssa.i = phi i64 [ %3, %for.body10 ], [ %b.tr6.i, %cond.true.i ]
%arrayidx17 = getelementptr inbounds [200002 x [2 x i64]], ptr %dp, i64 0, i64 %i.1120
store i64 %a.tr.lcssa.i, ptr %arrayidx17, align 16, !tbaa !19
%inc20 = add nuw nsw i64 %i.1120, 1
%exitcond.not = icmp eq i64 %inc20, %1
br i1 %exitcond.not, label %for.end21, label %for.body10, !llvm.loop !22
for.end21: ; preds = %gcd.exit, %for.end.thread, %for.end
%cmp8119134 = phi i1 [ false, %for.end.thread ], [ false, %for.end ], [ %cmp8119, %gcd.exit ]
%.lcssa133 = phi i64 [ %0, %for.end.thread ], [ %1, %for.end ], [ %1, %gcd.exit ]
%sub22 = add nsw i64 %.lcssa133, -1
%arrayidx23 = getelementptr inbounds [500002 x i32], ptr %a, i64 0, i64 %sub22
%5 = load i32, ptr %arrayidx23, align 4, !tbaa !10
%conv24 = sext i32 %5 to i64
%sub25 = add nsw i64 %.lcssa133, -2
%arrayidx27 = getelementptr inbounds [200002 x [2 x i64]], ptr %dp, i64 0, i64 %sub25, i64 1
store i64 %conv24, ptr %arrayidx27, align 8, !tbaa !19
%arrayidx30 = getelementptr inbounds [200002 x [2 x i64]], ptr %dp, i64 0, i64 %sub22, i64 1
store i64 0, ptr %arrayidx30, align 8, !tbaa !19
br i1 %cmp8119134, label %for.body35.preheader, label %for.cond46.preheader
for.body35.preheader: ; preds = %for.end21
%sub31 = add nsw i64 %.lcssa133, -3
br label %for.body35
for.cond46.preheader: ; preds = %gcd.exit108, %for.end21
%cmp47123 = icmp sgt i64 %.lcssa133, 0
br i1 %cmp47123, label %for.body49, label %for.end74
for.body35: ; preds = %for.body35.preheader, %gcd.exit108
%6 = phi i64 [ %a.tr.lcssa.i107, %gcd.exit108 ], [ %conv24, %for.body35.preheader ]
%i.2122 = phi i64 [ %dec, %gcd.exit108 ], [ %sub31, %for.body35.preheader ]
%add = add nuw nsw i64 %i.2122, 1
%arrayidx39 = getelementptr inbounds [500002 x i32], ptr %a, i64 0, i64 %add
%7 = load i32, ptr %arrayidx39, align 4, !tbaa !10
%tobool.not4.i101 = icmp eq i32 %7, 0
br i1 %tobool.not4.i101, label %gcd.exit108, label %cond.true.i102.preheader
cond.true.i102.preheader: ; preds = %for.body35
%conv40 = sext i32 %7 to i64
br label %cond.true.i102
cond.true.i102: ; preds = %cond.true.i102.preheader, %cond.true.i102
%b.tr6.i103 = phi i64 [ %rem.i105, %cond.true.i102 ], [ %conv40, %cond.true.i102.preheader ]
%a.tr5.i104 = phi i64 [ %b.tr6.i103, %cond.true.i102 ], [ %6, %cond.true.i102.preheader ]
%rem.i105 = srem i64 %a.tr5.i104, %b.tr6.i103
%tobool.not.i106 = icmp eq i64 %rem.i105, 0
br i1 %tobool.not.i106, label %gcd.exit108, label %cond.true.i102
gcd.exit108: ; preds = %cond.true.i102, %for.body35
%a.tr.lcssa.i107 = phi i64 [ %6, %for.body35 ], [ %b.tr6.i103, %cond.true.i102 ]
%arrayidx43 = getelementptr inbounds [200002 x [2 x i64]], ptr %dp, i64 0, i64 %i.2122, i64 1
store i64 %a.tr.lcssa.i107, ptr %arrayidx43, align 8, !tbaa !19
%dec = add nsw i64 %i.2122, -1
%cmp33 = icmp sgt i64 %i.2122, 0
br i1 %cmp33, label %for.body35, label %for.cond46.preheader, !llvm.loop !23
for.body49: ; preds = %for.cond46.preheader, %if.end69
%i.3125 = phi i64 [ %inc73, %if.end69 ], [ 0, %for.cond46.preheader ]
%result.0124 = phi i64 [ %cond, %if.end69 ], [ 0, %for.cond46.preheader ]
%arrayidx50 = getelementptr inbounds [200002 x [2 x i64]], ptr %dp, i64 0, i64 %i.3125
%8 = load i64, ptr %arrayidx50, align 16, !tbaa !19
%cmp52 = icmp eq i64 %8, 0
%arrayidx55 = getelementptr inbounds [200002 x [2 x i64]], ptr %dp, i64 0, i64 %i.3125, i64 1
%9 = load i64, ptr %arrayidx55, align 8, !tbaa !19
br i1 %cmp52, label %if.end69, label %if.else
if.else: ; preds = %for.body49
%cmp58 = icmp eq i64 %9, 0
br i1 %cmp58, label %if.end69, label %cond.true.i110
cond.true.i110: ; preds = %if.else, %cond.true.i110
%b.tr6.i111 = phi i64 [ %rem.i113, %cond.true.i110 ], [ %9, %if.else ]
%a.tr5.i112 = phi i64 [ %b.tr6.i111, %cond.true.i110 ], [ %8, %if.else ]
%rem.i113 = srem i64 %a.tr5.i112, %b.tr6.i111
%tobool.not.i114 = icmp eq i64 %rem.i113, 0
br i1 %tobool.not.i114, label %if.end69, label %cond.true.i110
if.end69: ; preds = %cond.true.i110, %for.body49, %if.else
%tmp.0 = phi i64 [ %8, %if.else ], [ %9, %for.body49 ], [ %b.tr6.i111, %cond.true.i110 ]
%cond = call i64 @llvm.smax.i64(i64 %tmp.0, i64 %result.0124)
%inc73 = add nuw nsw i64 %i.3125, 1
%exitcond128.not = icmp eq i64 %inc73, %.lcssa133
br i1 %exitcond128.not, label %for.end74, label %for.body49, !llvm.loop !24
for.end74: ; preds = %if.end69, %for.cond46.preheader
%result.0.lcssa = phi i64 [ 0, %for.cond46.preheader ], [ %cond, %if.end69 ]
%call75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %result.0.lcssa)
call void @llvm.lifetime.end.p0(i64 3200032, ptr nonnull %dp) #13
call void @llvm.lifetime.end.p0(i64 2000008, ptr nonnull %a) #13
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #13
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #9
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #11
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 nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 #4 = { 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 #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree norecurse nosync nounwind memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #10 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #12 = { nounwind willreturn memory(read) }
attributes #13 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !8}
!8 = !{!"llvm.loop.unroll.disable"}
!9 = distinct !{!9, !6}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C/C++ TBAA"}
!14 = distinct !{!14, !6, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !6, !16, !15}
!18 = distinct !{!18, !6}
!19 = !{!20, !20, i64 0}
!20 = !{!"long long", !12, i64 0}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6}
!23 = distinct !{!23, !6}
!24 = distinct !{!24, !6}
|
#include<stdio.h>
int GDC(int x, int y){
while(x>0 && y>0){
if(x>y){
x=x%y;
}else{
y=y%x;
}
}
if(x==0){
return y;
}else{
return x;
}
}
int main(){
int i, j, k;
int N, A[110000];
int L[110000];
int R[110000];
int tmp, max=0;
scanf("%d", &N);
for(i=0; i<N; i++){
scanf("%d", &A[i]);
}
L[0] = 0;
R[N] = 0;
for(i=0; i<N; i++){
L[i+1] = GDC(L[i],A[i]);
}
for(i=N-1; i>=0; i--){
R[i] = GDC(R[i+1],A[i]);
}
for(i=0; i<N; i++){
tmp = GDC(L[i], R[i+1]);
if(max<tmp){
max=tmp;
}
}
printf("%d", max);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164516/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164516/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @GDC(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%cmp16 = icmp sgt i32 %x, 0
%cmp117 = icmp sgt i32 %y, 0
%0 = and i1 %cmp16, %cmp117
br i1 %0, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end
%y.addr.019 = phi i32 [ %y.addr.1, %if.end ], [ %y, %entry ]
%x.addr.018 = phi i32 [ %x.addr.1, %if.end ], [ %x, %entry ]
%cmp2 = icmp ugt i32 %x.addr.018, %y.addr.019
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %while.body
%rem = urem i32 %x.addr.018, %y.addr.019
br label %if.end
if.else: ; preds = %while.body
%rem3 = urem i32 %y.addr.019, %x.addr.018
br label %if.end
if.end: ; preds = %if.else, %if.then
%x.addr.1 = phi i32 [ %rem, %if.then ], [ %x.addr.018, %if.else ]
%y.addr.1 = phi i32 [ %y.addr.019, %if.then ], [ %rem3, %if.else ]
%cmp = icmp sgt i32 %x.addr.1, 0
%cmp1 = icmp sgt i32 %y.addr.1, 0
%1 = and i1 %cmp, %cmp1
br i1 %1, label %while.body, label %while.end, !llvm.loop !5
while.end: ; preds = %if.end, %entry
%x.addr.0.lcssa = phi i32 [ %x, %entry ], [ %x.addr.1, %if.end ]
%y.addr.0.lcssa = phi i32 [ %y, %entry ], [ %y.addr.1, %if.end ]
%cmp4 = icmp eq i32 %x.addr.0.lcssa, 0
%y.addr.0.x.addr.0 = select i1 %cmp4, i32 %y.addr.0.lcssa, i32 %x.addr.0.lcssa
ret i32 %y.addr.0.x.addr.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%N = alloca i32, align 4
%A = alloca [110000 x i32], align 16
%L = alloca [110000 x i32], align 16
%R = alloca [110000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 440000, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 440000, ptr nonnull %L) #5
call void @llvm.lifetime.start.p0(i64 440000, ptr nonnull %R) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !7
%cmp103 = icmp sgt i32 %0, 0
br i1 %cmp103, label %for.body, label %for.end43
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [110000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !7
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body
store i32 0, ptr %L, align 16, !tbaa !7
%arrayidx4 = getelementptr inbounds [110000 x i32], ptr %R, i64 0, i64 %2
store i32 0, ptr %arrayidx4, align 4, !tbaa !7
%cmp6105 = icmp sgt i32 %1, 0
br i1 %cmp6105, label %for.body7.preheader, label %for.end43
for.body7.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %1 to i64
br label %for.body7
for.cond18.preheader: ; preds = %GDC.exit
br i1 %cmp6105, label %for.body20.preheader, label %for.end43
for.body20.preheader: ; preds = %for.cond18.preheader
%3 = zext i32 %1 to i64
br label %for.body20
for.body7: ; preds = %for.body7.preheader, %GDC.exit
%4 = phi i32 [ 0, %for.body7.preheader ], [ %y.addr.0.x.addr.0.i, %GDC.exit ]
%indvars.iv115 = phi i64 [ 0, %for.body7.preheader ], [ %indvars.iv.next116, %GDC.exit ]
%arrayidx11 = getelementptr inbounds [110000 x i32], ptr %A, i64 0, i64 %indvars.iv115
%5 = load i32, ptr %arrayidx11, align 4, !tbaa !7
%cmp16.i = icmp sgt i32 %4, 0
%cmp117.i = icmp sgt i32 %5, 0
%6 = and i1 %cmp16.i, %cmp117.i
br i1 %6, label %while.body.i, label %GDC.exit
while.body.i: ; preds = %for.body7, %if.end.i
%y.addr.019.i = phi i32 [ %y.addr.1.i, %if.end.i ], [ %5, %for.body7 ]
%x.addr.018.i = phi i32 [ %x.addr.1.i, %if.end.i ], [ %4, %for.body7 ]
%cmp2.i = icmp ugt i32 %x.addr.018.i, %y.addr.019.i
br i1 %cmp2.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %while.body.i
%rem.i = urem i32 %x.addr.018.i, %y.addr.019.i
br label %if.end.i
if.else.i: ; preds = %while.body.i
%rem3.i = urem i32 %y.addr.019.i, %x.addr.018.i
br label %if.end.i
if.end.i: ; preds = %if.else.i, %if.then.i
%x.addr.1.i = phi i32 [ %rem.i, %if.then.i ], [ %x.addr.018.i, %if.else.i ]
%y.addr.1.i = phi i32 [ %y.addr.019.i, %if.then.i ], [ %rem3.i, %if.else.i ]
%cmp.i = icmp sgt i32 %x.addr.1.i, 0
%cmp1.i = icmp sgt i32 %y.addr.1.i, 0
%7 = and i1 %cmp.i, %cmp1.i
br i1 %7, label %while.body.i, label %GDC.exit, !llvm.loop !5
GDC.exit: ; preds = %if.end.i, %for.body7
%x.addr.0.lcssa.i = phi i32 [ %4, %for.body7 ], [ %x.addr.1.i, %if.end.i ]
%y.addr.0.lcssa.i = phi i32 [ %5, %for.body7 ], [ %y.addr.1.i, %if.end.i ]
%cmp4.i = icmp eq i32 %x.addr.0.lcssa.i, 0
%y.addr.0.x.addr.0.i = select i1 %cmp4.i, i32 %y.addr.0.lcssa.i, i32 %x.addr.0.lcssa.i
%indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
%arrayidx14 = getelementptr inbounds [110000 x i32], ptr %L, i64 0, i64 %indvars.iv.next116
store i32 %y.addr.0.x.addr.0.i, ptr %arrayidx14, align 4, !tbaa !7
%exitcond.not = icmp eq i64 %indvars.iv.next116, %wide.trip.count
br i1 %exitcond.not, label %for.cond18.preheader, label %for.body7, !llvm.loop !12
for.cond31.preheader: ; preds = %GDC.exit82
br i1 %cmp6105, label %for.body33.preheader, label %for.end43
for.body33.preheader: ; preds = %for.cond31.preheader
%wide.trip.count125 = zext i32 %1 to i64
br label %for.body33
for.body20: ; preds = %for.body20.preheader, %GDC.exit82
%indvars.iv118 = phi i64 [ %3, %for.body20.preheader ], [ %indvars.iv.next119, %GDC.exit82 ]
%indvars.iv.next119 = add nsw i64 %indvars.iv118, -1
%arrayidx23 = getelementptr inbounds [110000 x i32], ptr %R, i64 0, i64 %indvars.iv118
%8 = load i32, ptr %arrayidx23, align 4, !tbaa !7
%idxprom24 = and i64 %indvars.iv.next119, 4294967295
%arrayidx25 = getelementptr inbounds [110000 x i32], ptr %A, i64 0, i64 %idxprom24
%9 = load i32, ptr %arrayidx25, align 4, !tbaa !7
%cmp16.i63 = icmp sgt i32 %8, 0
%cmp117.i64 = icmp sgt i32 %9, 0
%10 = and i1 %cmp16.i63, %cmp117.i64
br i1 %10, label %while.body.i69, label %GDC.exit82
while.body.i69: ; preds = %for.body20, %if.end.i75
%y.addr.019.i70 = phi i32 [ %y.addr.1.i77, %if.end.i75 ], [ %9, %for.body20 ]
%x.addr.018.i71 = phi i32 [ %x.addr.1.i76, %if.end.i75 ], [ %8, %for.body20 ]
%cmp2.i72 = icmp ugt i32 %x.addr.018.i71, %y.addr.019.i70
br i1 %cmp2.i72, label %if.then.i80, label %if.else.i73
if.then.i80: ; preds = %while.body.i69
%rem.i81 = urem i32 %x.addr.018.i71, %y.addr.019.i70
br label %if.end.i75
if.else.i73: ; preds = %while.body.i69
%rem3.i74 = urem i32 %y.addr.019.i70, %x.addr.018.i71
br label %if.end.i75
if.end.i75: ; preds = %if.else.i73, %if.then.i80
%x.addr.1.i76 = phi i32 [ %rem.i81, %if.then.i80 ], [ %x.addr.018.i71, %if.else.i73 ]
%y.addr.1.i77 = phi i32 [ %y.addr.019.i70, %if.then.i80 ], [ %rem3.i74, %if.else.i73 ]
%cmp.i78 = icmp sgt i32 %x.addr.1.i76, 0
%cmp1.i79 = icmp sgt i32 %y.addr.1.i77, 0
%11 = and i1 %cmp.i78, %cmp1.i79
br i1 %11, label %while.body.i69, label %GDC.exit82, !llvm.loop !5
GDC.exit82: ; preds = %if.end.i75, %for.body20
%x.addr.0.lcssa.i65 = phi i32 [ %8, %for.body20 ], [ %x.addr.1.i76, %if.end.i75 ]
%y.addr.0.lcssa.i66 = phi i32 [ %9, %for.body20 ], [ %y.addr.1.i77, %if.end.i75 ]
%cmp4.i67 = icmp eq i32 %x.addr.0.lcssa.i65, 0
%y.addr.0.x.addr.0.i68 = select i1 %cmp4.i67, i32 %y.addr.0.lcssa.i66, i32 %x.addr.0.lcssa.i65
%arrayidx28 = getelementptr inbounds [110000 x i32], ptr %R, i64 0, i64 %idxprom24
store i32 %y.addr.0.x.addr.0.i68, ptr %arrayidx28, align 4, !tbaa !7
%cmp19 = icmp sgt i64 %indvars.iv118, 1
br i1 %cmp19, label %for.body20, label %for.cond31.preheader, !llvm.loop !13
for.body33: ; preds = %for.body33.preheader, %GDC.exit102
%indvars.iv121 = phi i64 [ 0, %for.body33.preheader ], [ %indvars.iv.next122, %GDC.exit102 ]
%max.0111 = phi i32 [ 0, %for.body33.preheader ], [ %spec.select, %GDC.exit102 ]
%arrayidx35 = getelementptr inbounds [110000 x i32], ptr %L, i64 0, i64 %indvars.iv121
%12 = load i32, ptr %arrayidx35, align 4, !tbaa !7
%indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
%arrayidx38 = getelementptr inbounds [110000 x i32], ptr %R, i64 0, i64 %indvars.iv.next122
%13 = load i32, ptr %arrayidx38, align 4, !tbaa !7
%cmp16.i83 = icmp sgt i32 %12, 0
%cmp117.i84 = icmp sgt i32 %13, 0
%14 = and i1 %cmp16.i83, %cmp117.i84
br i1 %14, label %while.body.i89, label %GDC.exit102
while.body.i89: ; preds = %for.body33, %if.end.i95
%y.addr.019.i90 = phi i32 [ %y.addr.1.i97, %if.end.i95 ], [ %13, %for.body33 ]
%x.addr.018.i91 = phi i32 [ %x.addr.1.i96, %if.end.i95 ], [ %12, %for.body33 ]
%cmp2.i92 = icmp ugt i32 %x.addr.018.i91, %y.addr.019.i90
br i1 %cmp2.i92, label %if.then.i100, label %if.else.i93
if.then.i100: ; preds = %while.body.i89
%rem.i101 = urem i32 %x.addr.018.i91, %y.addr.019.i90
br label %if.end.i95
if.else.i93: ; preds = %while.body.i89
%rem3.i94 = urem i32 %y.addr.019.i90, %x.addr.018.i91
br label %if.end.i95
if.end.i95: ; preds = %if.else.i93, %if.then.i100
%x.addr.1.i96 = phi i32 [ %rem.i101, %if.then.i100 ], [ %x.addr.018.i91, %if.else.i93 ]
%y.addr.1.i97 = phi i32 [ %y.addr.019.i90, %if.then.i100 ], [ %rem3.i94, %if.else.i93 ]
%cmp.i98 = icmp sgt i32 %x.addr.1.i96, 0
%cmp1.i99 = icmp sgt i32 %y.addr.1.i97, 0
%15 = and i1 %cmp.i98, %cmp1.i99
br i1 %15, label %while.body.i89, label %GDC.exit102, !llvm.loop !5
GDC.exit102: ; preds = %if.end.i95, %for.body33
%x.addr.0.lcssa.i85 = phi i32 [ %12, %for.body33 ], [ %x.addr.1.i96, %if.end.i95 ]
%y.addr.0.lcssa.i86 = phi i32 [ %13, %for.body33 ], [ %y.addr.1.i97, %if.end.i95 ]
%cmp4.i87 = icmp eq i32 %x.addr.0.lcssa.i85, 0
%y.addr.0.x.addr.0.i88 = select i1 %cmp4.i87, i32 %y.addr.0.lcssa.i86, i32 %x.addr.0.lcssa.i85
%spec.select = call i32 @llvm.smax.i32(i32 %max.0111, i32 %y.addr.0.x.addr.0.i88)
%exitcond126.not = icmp eq i64 %indvars.iv.next122, %wide.trip.count125
br i1 %exitcond126.not, label %for.end43, label %for.body33, !llvm.loop !14
for.end43: ; preds = %GDC.exit102, %entry, %for.end, %for.cond18.preheader, %for.cond31.preheader
%max.0.lcssa = phi i32 [ 0, %for.cond31.preheader ], [ 0, %for.cond18.preheader ], [ 0, %for.end ], [ 0, %entry ], [ %spec.select, %GDC.exit102 ]
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %max.0.lcssa)
call void @llvm.lifetime.end.p0(i64 440000, ptr nonnull %R) #5
call void @llvm.lifetime.end.p0(i64 440000, ptr nonnull %L) #5
call void @llvm.lifetime.end.p0(i64 440000, ptr nonnull %A) #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
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 = { 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 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}
|
#include<stdio.h>
#pragma warning(disable:4996)
int A[700];
int main()
{
int n, m, i, j, dip = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &m);
A[m]++;
if (A[m] == 1 && m != 0)
dip++;
}
printf("%d", dip);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16456/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16456/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@A = dso_local local_unnamed_addr global [700 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%dip.013 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%i.012 = phi i32 [ %inc7, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%1 = load i32, ptr %m, align 4
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [700 x i32], ptr @A, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %2, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%cmp4 = icmp eq i32 %2, 0
%cmp5 = icmp ne i32 %1, 0
%or.cond = and i1 %cmp5, %cmp4
%inc6 = zext i1 %or.cond to i32
%spec.select = add nuw nsw i32 %dip.013, %inc6
%inc7 = add nuw nsw i32 %i.012, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc7, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%dip.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %dip.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int n;
scanf("%d",&n);
long long a[n+1] , b[n+1] , c[n+1];
long long ans = 0;
for(int i = 1;i <= n;i ++){
scanf("%lld %lld",&a[i] ,&b[i]);
if(a[i]%b[i] != 0){
c[i] = a[i] % b[i];
}
else{
c[i] = 0;
}
}
for(int i = n;i > 0;i --){
if(c[i]%b[i] != 0){
ans += b[i] - (c[i]%b[i]);
}
c[i-1] += ans;
}
printf("%lld\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164617/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164617/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10 x i8] c"%lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
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
%add = add nsw i32 %0, 1
%1 = zext i32 %add to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%add1 = add nsw i32 %3, 1
%4 = zext i32 %add1 to i64
%vla2 = alloca i64, i64 %4, align 16
%vla4 = alloca i64, i64 %4, align 16
%cmp.not68 = icmp slt i32 %3, 1
br i1 %cmp.not68, label %for.cond.cleanup25, label %for.body
for.cond23.preheader: ; preds = %for.body
%cmp2470 = icmp sgt i32 %9, 0
br i1 %cmp2470, label %for.body26.preheader, label %for.cond.cleanup25
for.body26.preheader: ; preds = %for.cond23.preheader
%5 = zext i32 %9 to i64
br label %for.body26
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%arrayidx6 = getelementptr inbounds i64, ptr %vla2, i64 %indvars.iv
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx6)
%6 = load i64, ptr %arrayidx, align 8, !tbaa !9
%7 = load i64, ptr %arrayidx6, align 8, !tbaa !9
%rem = srem i64 %6, %7
%8 = getelementptr inbounds i64, ptr %vla4, i64 %indvars.iv
store i64 %rem, ptr %8, align 8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %10
br i1 %cmp.not.not, label %for.body, label %for.cond23.preheader, !llvm.loop !11
for.cond.cleanup25: ; preds = %for.body26, %entry, %for.cond23.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond23.preheader ], [ 0, %entry ], [ %ans.1, %for.body26 ]
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body26: ; preds = %for.body26.preheader, %for.body26
%indvars.iv76 = phi i64 [ %5, %for.body26.preheader ], [ %indvars.iv.next77, %for.body26 ]
%ans.071 = phi i64 [ 0, %for.body26.preheader ], [ %ans.1, %for.body26 ]
%arrayidx28 = getelementptr inbounds i64, ptr %vla4, i64 %indvars.iv76
%11 = load i64, ptr %arrayidx28, align 8, !tbaa !9
%arrayidx30 = getelementptr inbounds i64, ptr %vla2, i64 %indvars.iv76
%12 = load i64, ptr %arrayidx30, align 8, !tbaa !9
%rem31 = srem i64 %11, %12
%cmp32.not = icmp eq i64 %rem31, 0
%sub = sub nsw i64 %12, %rem31
%add41 = select i1 %cmp32.not, i64 0, i64 %sub
%ans.1 = add nsw i64 %add41, %ans.071
%indvars.iv.next77 = add nsw i64 %indvars.iv76, -1
%idxprom44 = and i64 %indvars.iv.next77, 4294967295
%arrayidx45 = getelementptr inbounds i64, ptr %vla4, i64 %idxprom44
%13 = load i64, ptr %arrayidx45, align 8, !tbaa !9
%add46 = add nsw i64 %ans.1, %13
store i64 %add46, ptr %arrayidx45, align 8, !tbaa !9
%cmp24 = icmp ugt i64 %indvars.iv76, 1
br i1 %cmp24, label %for.body26, label %for.cond.cleanup25, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main() {
int n;
scanf("%d ",&n);
int a[n],b[n];
int i;
for(i=0;i<=n-1;i++)scanf("%d %d",&a[i],&b[i]);
long long int ans=0;
for(i=n-1;i>=0;i--){
if((a[i]+ans)%b[i]!=0)ans+=b[i]-(a[i]+ans)%b[i];
}
printf("%lld",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164668/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164668/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 \00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
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
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%cmp.not.not45 = icmp sgt i32 %3, 0
br i1 %cmp.not.not45, label %for.body, label %for.end30
for.cond6.preheader: ; preds = %for.body
%cmp747 = icmp sgt i32 %7, 0
br i1 %cmp747, label %for.body8.preheader, label %for.end30
for.body8.preheader: ; preds = %for.cond6.preheader
%5 = zext i32 %7 to i64
%xtraiter = and i64 %5, 1
%6 = icmp eq i32 %7, 1
br i1 %6, label %for.end30.loopexit.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %5, 4294967294
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp.not.not = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp.not.not, label %for.body, label %for.cond6.preheader, !llvm.loop !9
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%indvars.iv53 = phi i64 [ %5, %for.body8.preheader.new ], [ %indvars.iv.next54.1, %for.body8 ]
%ans.049 = phi i64 [ 0, %for.body8.preheader.new ], [ %ans.1.1, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.1, %for.body8 ]
%indvars.iv.next54 = add i64 %indvars.iv53, 4294967295
%idxprom9 = and i64 %indvars.iv.next54, 4294967295
%arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %idxprom9
%9 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%conv = sext i32 %9 to i64
%add = add nsw i64 %ans.049, %conv
%arrayidx12 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom9
%10 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%conv13 = sext i32 %10 to i64
%rem = srem i64 %add, %conv13
%cmp14.not = icmp eq i64 %rem, 0
%sub27 = sub nsw i64 %conv13, %rem
%add28 = select i1 %cmp14.not, i64 0, i64 %sub27
%ans.1 = add nsw i64 %add28, %ans.049
%indvars.iv.next54.1 = add nsw i64 %indvars.iv53, -2
%idxprom9.1 = and i64 %indvars.iv.next54.1, 4294967295
%arrayidx10.1 = getelementptr inbounds i32, ptr %vla, i64 %idxprom9.1
%11 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%conv.1 = sext i32 %11 to i64
%add.1 = add nsw i64 %ans.1, %conv.1
%arrayidx12.1 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom9.1
%12 = load i32, ptr %arrayidx12.1, align 4, !tbaa !5
%conv13.1 = sext i32 %12 to i64
%rem.1 = srem i64 %add.1, %conv13.1
%cmp14.not.1 = icmp eq i64 %rem.1, 0
%sub27.1 = sub nsw i64 %conv13.1, %rem.1
%add28.1 = select i1 %cmp14.not.1, i64 0, i64 %sub27.1
%ans.1.1 = add nsw i64 %add28.1, %ans.1
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1.not = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1.not, label %for.end30.loopexit.unr-lcssa, label %for.body8, !llvm.loop !11
for.end30.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%ans.1.lcssa.ph = phi i64 [ undef, %for.body8.preheader ], [ %ans.1.1, %for.body8 ]
%indvars.iv53.unr = phi i64 [ %5, %for.body8.preheader ], [ %indvars.iv.next54.1, %for.body8 ]
%ans.049.unr = phi i64 [ 0, %for.body8.preheader ], [ %ans.1.1, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end30, label %for.body8.epil
for.body8.epil: ; preds = %for.end30.loopexit.unr-lcssa
%indvars.iv.next54.epil = add i64 %indvars.iv53.unr, 4294967295
%idxprom9.epil = and i64 %indvars.iv.next54.epil, 4294967295
%arrayidx10.epil = getelementptr inbounds i32, ptr %vla, i64 %idxprom9.epil
%13 = load i32, ptr %arrayidx10.epil, align 4, !tbaa !5
%conv.epil = sext i32 %13 to i64
%add.epil = add nsw i64 %ans.049.unr, %conv.epil
%arrayidx12.epil = getelementptr inbounds i32, ptr %vla1, i64 %idxprom9.epil
%14 = load i32, ptr %arrayidx12.epil, align 4, !tbaa !5
%conv13.epil = sext i32 %14 to i64
%rem.epil = srem i64 %add.epil, %conv13.epil
%cmp14.not.epil = icmp eq i64 %rem.epil, 0
%sub27.epil = sub nsw i64 %conv13.epil, %rem.epil
%add28.epil = select i1 %cmp14.not.epil, i64 0, i64 %sub27.epil
%ans.1.epil = add nsw i64 %add28.epil, %ans.049.unr
br label %for.end30
for.end30: ; preds = %for.body8.epil, %for.end30.loopexit.unr-lcssa, %entry, %for.cond6.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond6.preheader ], [ 0, %entry ], [ %ans.1.lcssa.ph, %for.end30.loopexit.unr-lcssa ], [ %ans.1.epil, %for.body8.epil ]
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<string.h>
#include<math.h>
#define Limit 100
#define Size 16
int swap_upper(int*, int*, int);
int swap_lower(int*, int*, int);
int swap_left(int*, int*, int);
int swap_right(int*, int*, int);
int fair_evaluator(int*, int*);
int Dfs(int*, int*, int, int, int);
int main(void)
{
int i, e = sqrt(Size), dis, init[Size], goal[Size] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0};
for (i = 0; i < Size; i++) scanf("%d", &init[i]);
dis = fair_evaluator(init, goal);
for (i = dis; i < Limit; i++) {
if (Dfs(init, goal, 0, -1, i)) {
printf("%d\n", i);
break;
}
}
}
int swap_upper(int *board, int *next, int prev)
{
int i, pos, e = sqrt(Size);
for (i = 0; i < Size; i++) {
if (!board[i]) pos = i;
}
if (!(pos / e) || prev == 1) return 0;
else {
memcpy(next, board, sizeof(int) * Size);
next[pos] = board[pos - e];
next[pos - e] = board[pos];
}
return 1;
}
int swap_lower(int *board, int *next, int prev)
{
int i, pos, e = sqrt(Size);
for (i = 0; i < Size; i++) {
if (!board[i]) pos = i;
}
if ((pos / e) == e - 1 || prev == 0) return 0;
else {
memcpy(next, board, sizeof(int) * Size);
next[pos] = board[pos + e];
next[pos + e] = board[pos];
}
return 1;
}
int swap_left(int *board, int *next, int prev)
{
int i, pos, e = sqrt(Size);
for (i = 0; i < Size; i++) {
if (!board[i]) pos = i;
}
if (!(pos % e) || prev == 3) return 0;
else {
memcpy(next, board, sizeof(int) * Size);
next[pos] = board[pos - 1];
next[pos - 1] = board[pos];
}
return 1;
}
int swap_right(int *board, int *next, int prev)
{
int i, pos, e = sqrt(Size);
for (i = 0; i < Size; i++) {
if (!board[i]) pos = i;
}
if ((pos % e) == e - 1 || prev == 2) return 0;
else {
memcpy(next, board, sizeof(int) * Size);
next[pos] = board[pos + 1];
next[pos + 1] = board[pos];
}
return 1;
}
int fair_evaluator(int *board, int *goal)
{
int i, j, e = sqrt(Size), score = 0;
for (i = 1; i < Size; i++) {
int x1, y1, x2, y2;
for (j = 0; j < Size; j++) {
if (board[j] == i) {
x1 = j % e;
y1 = j / e;
}
if (goal[j] == i) {
x2 = j % e;
y2 = j / e;
}
}
score += fabs(x1 - x2) + fabs(y1 - y2);
}
return score;
}
int Dfs(int *board, int *goal, int depth, int prev, int limit)
{
int dis = fair_evaluator(board, goal), next[Size];
if (!dis) return 1;
else if (depth + dis > limit) return 0;
if (swap_upper(board, next, prev)) {
if (Dfs(next, goal, depth + 1, 0, limit)) return 1;
}
if (swap_lower(board, next, prev)) {
if (Dfs(next, goal, depth + 1, 1, limit)) return 1;
}
if (swap_left(board, next, prev)) {
if (Dfs(next, goal, depth + 1, 2, limit)) return 1;
}
if (swap_right(board, next, prev)) {
if (Dfs(next, goal, depth + 1, 3, limit)) return 1;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164710/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164710/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@__const.main.goal = private unnamed_addr constant [16 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 0], 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:
%init = alloca [16 x i32], align 16
%goal = alloca [16 x i32], align 16
call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %init) #8
call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %goal) #8
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %goal, ptr noundef nonnull align 16 dereferenceable(64) @__const.main.goal, i64 64, i1 false)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %init)
%arrayidx.1 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 1
%call2.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%arrayidx.2 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 2
%call2.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%arrayidx.3 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 3
%call2.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3)
%arrayidx.4 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 4
%call2.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.4)
%arrayidx.5 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 5
%call2.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.5)
%arrayidx.6 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 6
%call2.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.6)
%arrayidx.7 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 7
%call2.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.7)
%arrayidx.8 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 8
%call2.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.8)
%arrayidx.9 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 9
%call2.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.9)
%arrayidx.10 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 10
%call2.10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.10)
%arrayidx.11 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 11
%call2.11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.11)
%arrayidx.12 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 12
%call2.12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.12)
%arrayidx.13 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 13
%call2.13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.13)
%arrayidx.14 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 14
%call2.14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.14)
%arrayidx.15 = getelementptr inbounds [16 x i32], ptr %init, i64 0, i64 15
%call2.15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.15)
%call4 = call i32 @fair_evaluator(ptr noundef nonnull %init, ptr noundef nonnull %goal)
%cmp624 = icmp slt i32 %call4, 100
br i1 %cmp624, label %for.body8, label %for.end15
for.body8: ; preds = %entry, %for.inc13
%i.125 = phi i32 [ %inc14, %for.inc13 ], [ %call4, %entry ]
%call11 = call i32 @Dfs(ptr noundef nonnull %init, ptr noundef nonnull %goal, i32 noundef 0, i32 noundef -1, i32 noundef %i.125), !range !5
%tobool.not = icmp eq i32 %call11, 0
br i1 %tobool.not, label %for.inc13, label %if.then
if.then: ; preds = %for.body8
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.125)
br label %for.end15
for.inc13: ; preds = %for.body8
%inc14 = add i32 %i.125, 1
%exitcond.not = icmp eq i32 %inc14, 100
br i1 %exitcond.not, label %for.end15, label %for.body8, !llvm.loop !6
for.end15: ; preds = %for.inc13, %entry, %if.then
call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %goal) #8
call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %init) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @fair_evaluator(ptr nocapture noundef readonly %board, ptr nocapture noundef readonly %goal) local_unnamed_addr #4 {
entry:
%arrayidx.8.phi.trans.insert = getelementptr inbounds i32, ptr %board, i64 8
%arrayidx9.8.phi.trans.insert = getelementptr inbounds i32, ptr %goal, i64 8
%0 = load <4 x i32>, ptr %board, align 4, !tbaa !8
%1 = load <4 x i32>, ptr %goal, align 4, !tbaa !8
%arrayidx.4 = getelementptr inbounds i32, ptr %board, i64 4
%arrayidx9.4 = getelementptr inbounds i32, ptr %goal, i64 4
%2 = load <4 x i32>, ptr %arrayidx9.4, align 4, !tbaa !8
%3 = load <4 x i32>, ptr %arrayidx.4, align 4, !tbaa !8
%4 = load <4 x i32>, ptr %arrayidx.8.phi.trans.insert, align 4, !tbaa !8
%5 = load <4 x i32>, ptr %arrayidx9.8.phi.trans.insert, align 4, !tbaa !8
%arrayidx.12 = getelementptr inbounds i32, ptr %board, i64 12
%arrayidx9.12 = getelementptr inbounds i32, ptr %goal, i64 12
%6 = load <4 x i32>, ptr %arrayidx.12, align 4, !tbaa !8
%7 = load <4 x i32>, ptr %arrayidx9.12, align 4, !tbaa !8
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %for.cond2.preheader
%y2.051 = phi i32 [ undef, %entry ], [ %y2.2.15, %for.cond2.preheader ]
%x2.050 = phi i32 [ undef, %entry ], [ %x2.2.15, %for.cond2.preheader ]
%y1.049 = phi i32 [ undef, %entry ], [ %y1.2.15, %for.cond2.preheader ]
%x1.048 = phi i32 [ undef, %entry ], [ %x1.2.15, %for.cond2.preheader ]
%score.047 = phi i32 [ 0, %entry ], [ %conv21, %for.cond2.preheader ]
%i.046 = phi i32 [ 1, %entry ], [ %inc23, %for.cond2.preheader ]
%8 = insertelement <4 x i32> poison, i32 %i.046, i64 0
%9 = shufflevector <4 x i32> %8, <4 x i32> poison, <4 x i32> zeroinitializer
%10 = icmp eq <4 x i32> %0, %9
%11 = freeze <4 x i1> %10
%12 = extractelement <4 x i1> %11, i64 0
%x1.2 = select i1 %12, i32 0, i32 %x1.048
%13 = icmp eq <4 x i32> %1, %9
%14 = freeze <4 x i1> %13
%15 = extractelement <4 x i1> %14, i64 0
%x2.2 = select i1 %15, i32 0, i32 %x2.050
%16 = extractelement <4 x i1> %11, i64 1
%x1.2.1 = select i1 %16, i32 1, i32 %x1.2
%17 = extractelement <4 x i1> %14, i64 1
%x2.2.1 = select i1 %17, i32 1, i32 %x2.2
%18 = extractelement <4 x i1> %11, i64 2
%x1.2.2 = select i1 %18, i32 2, i32 %x1.2.1
%19 = extractelement <4 x i1> %14, i64 2
%x2.2.2 = select i1 %19, i32 2, i32 %x2.2.1
%20 = extractelement <4 x i1> %11, i64 3
%x1.2.3 = select i1 %20, i32 3, i32 %x1.2.2
%21 = bitcast <4 x i1> %11 to i4
%.not = icmp eq i4 %21, 0
%y1.2.3 = select i1 %.not, i32 %y1.049, i32 0
%22 = extractelement <4 x i1> %14, i64 3
%x2.2.3 = select i1 %22, i32 3, i32 %x2.2.2
%23 = bitcast <4 x i1> %14 to i4
%.not57 = icmp eq i4 %23, 0
%y2.2.3 = select i1 %.not57, i32 %y2.051, i32 0
%24 = icmp eq <4 x i32> %3, %9
%25 = freeze <4 x i1> %24
%26 = extractelement <4 x i1> %25, i64 0
%x1.2.4 = select i1 %26, i32 0, i32 %x1.2.3
%27 = icmp eq <4 x i32> %2, %9
%28 = freeze <4 x i1> %27
%29 = extractelement <4 x i1> %28, i64 0
%x2.2.4 = select i1 %29, i32 0, i32 %x2.2.3
%30 = extractelement <4 x i1> %25, i64 1
%x1.2.5 = select i1 %30, i32 1, i32 %x1.2.4
%31 = extractelement <4 x i1> %28, i64 1
%x2.2.5 = select i1 %31, i32 1, i32 %x2.2.4
%32 = extractelement <4 x i1> %25, i64 2
%x1.2.6 = select i1 %32, i32 2, i32 %x1.2.5
%33 = extractelement <4 x i1> %28, i64 2
%x2.2.6 = select i1 %33, i32 2, i32 %x2.2.5
%34 = extractelement <4 x i1> %25, i64 3
%x1.2.7 = select i1 %34, i32 3, i32 %x1.2.6
%35 = bitcast <4 x i1> %25 to i4
%.not58 = icmp eq i4 %35, 0
%y1.2.7 = select i1 %.not58, i32 %y1.2.3, i32 1
%36 = extractelement <4 x i1> %28, i64 3
%x2.2.7 = select i1 %36, i32 3, i32 %x2.2.6
%37 = bitcast <4 x i1> %28 to i4
%.not59 = icmp eq i4 %37, 0
%y2.2.7 = select i1 %.not59, i32 %y2.2.3, i32 1
%38 = icmp eq <4 x i32> %4, %9
%39 = freeze <4 x i1> %38
%40 = extractelement <4 x i1> %39, i64 0
%x1.2.8 = select i1 %40, i32 0, i32 %x1.2.7
%41 = icmp eq <4 x i32> %5, %9
%42 = freeze <4 x i1> %41
%43 = extractelement <4 x i1> %42, i64 0
%x2.2.8 = select i1 %43, i32 0, i32 %x2.2.7
%44 = extractelement <4 x i1> %39, i64 1
%x1.2.9 = select i1 %44, i32 1, i32 %x1.2.8
%45 = extractelement <4 x i1> %42, i64 1
%x2.2.9 = select i1 %45, i32 1, i32 %x2.2.8
%46 = extractelement <4 x i1> %39, i64 2
%x1.2.10 = select i1 %46, i32 2, i32 %x1.2.9
%47 = extractelement <4 x i1> %42, i64 2
%x2.2.10 = select i1 %47, i32 2, i32 %x2.2.9
%48 = extractelement <4 x i1> %39, i64 3
%x1.2.11 = select i1 %48, i32 3, i32 %x1.2.10
%49 = bitcast <4 x i1> %39 to i4
%.not60 = icmp eq i4 %49, 0
%y1.2.11 = select i1 %.not60, i32 %y1.2.7, i32 2
%50 = extractelement <4 x i1> %42, i64 3
%x2.2.11 = select i1 %50, i32 3, i32 %x2.2.10
%51 = bitcast <4 x i1> %42 to i4
%.not61 = icmp eq i4 %51, 0
%y2.2.11 = select i1 %.not61, i32 %y2.2.7, i32 2
%52 = icmp eq <4 x i32> %6, %9
%53 = freeze <4 x i1> %52
%54 = extractelement <4 x i1> %53, i64 0
%x1.2.12 = select i1 %54, i32 0, i32 %x1.2.11
%55 = icmp eq <4 x i32> %7, %9
%56 = freeze <4 x i1> %55
%57 = extractelement <4 x i1> %56, i64 0
%x2.2.12 = select i1 %57, i32 0, i32 %x2.2.11
%58 = extractelement <4 x i1> %53, i64 1
%x1.2.13 = select i1 %58, i32 1, i32 %x1.2.12
%59 = extractelement <4 x i1> %56, i64 1
%x2.2.13 = select i1 %59, i32 1, i32 %x2.2.12
%60 = extractelement <4 x i1> %53, i64 2
%x1.2.14 = select i1 %60, i32 2, i32 %x1.2.13
%61 = extractelement <4 x i1> %56, i64 2
%x2.2.14 = select i1 %61, i32 2, i32 %x2.2.13
%62 = extractelement <4 x i1> %53, i64 3
%x1.2.15 = select i1 %62, i32 3, i32 %x1.2.14
%63 = bitcast <4 x i1> %53 to i4
%.not62 = icmp eq i4 %63, 0
%y1.2.15 = select i1 %.not62, i32 %y1.2.11, i32 3
%64 = extractelement <4 x i1> %56, i64 3
%x2.2.15 = select i1 %64, i32 3, i32 %x2.2.14
%65 = bitcast <4 x i1> %56 to i4
%.not63 = icmp eq i4 %65, 0
%y2.2.15 = select i1 %.not63, i32 %y2.2.11, i32 3
%sub = sub nsw i32 %x1.2.15, %x2.2.15
%conv16 = sitofp i32 %sub to double
%66 = tail call double @llvm.fabs.f64(double %conv16)
%sub17 = sub nsw i32 %y1.2.15, %y2.2.15
%conv18 = sitofp i32 %sub17 to double
%67 = tail call double @llvm.fabs.f64(double %conv18)
%add = fadd double %66, %67
%conv19 = sitofp i32 %score.047 to double
%add20 = fadd double %add, %conv19
%conv21 = fptosi double %add20 to i32
%inc23 = add nuw nsw i32 %i.046, 1
%exitcond.not = icmp eq i32 %inc23, 16
br i1 %exitcond.not, label %for.end24, label %for.cond2.preheader, !llvm.loop !12
for.end24: ; preds = %for.cond2.preheader
ret i32 %conv21
}
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @Dfs(ptr nocapture noundef readonly %board, ptr noundef %goal, i32 noundef %depth, i32 noundef %prev, i32 noundef %limit) local_unnamed_addr #5 {
entry:
%next = alloca [16 x i32], align 16
%call = tail call i32 @fair_evaluator(ptr noundef %board, ptr noundef %goal)
call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %next) #8
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %cleanup, label %if.else
if.else: ; preds = %entry
%add = add nsw i32 %call, %depth
%cmp = icmp sgt i32 %add, %limit
br i1 %cmp, label %cleanup, label %if.end2
if.end2: ; preds = %if.else
%arrayidx.1.i = getelementptr inbounds i32, ptr %board, i64 1
%0 = load i32, ptr %arrayidx.1.i, align 4, !tbaa !8
%tobool.not.1.i = icmp eq i32 %0, 0
%spec.select.1.i = zext i1 %tobool.not.1.i to i32
%arrayidx.2.i = getelementptr inbounds i32, ptr %board, i64 2
%1 = load i32, ptr %arrayidx.2.i, align 4, !tbaa !8
%tobool.not.2.i = icmp eq i32 %1, 0
%spec.select.2.i = select i1 %tobool.not.2.i, i32 2, i32 %spec.select.1.i
%arrayidx.3.i = getelementptr inbounds i32, ptr %board, i64 3
%2 = load i32, ptr %arrayidx.3.i, align 4, !tbaa !8
%tobool.not.3.i = icmp eq i32 %2, 0
%spec.select.3.i = select i1 %tobool.not.3.i, i32 3, i32 %spec.select.2.i
%arrayidx.4.i = getelementptr inbounds i32, ptr %board, i64 4
%3 = load i32, ptr %arrayidx.4.i, align 4, !tbaa !8
%tobool.not.4.i = icmp eq i32 %3, 0
%spec.select.4.i = select i1 %tobool.not.4.i, i32 4, i32 %spec.select.3.i
%arrayidx.5.i = getelementptr inbounds i32, ptr %board, i64 5
%4 = load i32, ptr %arrayidx.5.i, align 4, !tbaa !8
%tobool.not.5.i = icmp eq i32 %4, 0
%spec.select.5.i = select i1 %tobool.not.5.i, i32 5, i32 %spec.select.4.i
%arrayidx.6.i = getelementptr inbounds i32, ptr %board, i64 6
%5 = load i32, ptr %arrayidx.6.i, align 4, !tbaa !8
%tobool.not.6.i = icmp eq i32 %5, 0
%spec.select.6.i = select i1 %tobool.not.6.i, i32 6, i32 %spec.select.5.i
%arrayidx.7.i = getelementptr inbounds i32, ptr %board, i64 7
%6 = load i32, ptr %arrayidx.7.i, align 4, !tbaa !8
%tobool.not.7.i = icmp eq i32 %6, 0
%spec.select.7.i = select i1 %tobool.not.7.i, i32 7, i32 %spec.select.6.i
%arrayidx.8.i = getelementptr inbounds i32, ptr %board, i64 8
%7 = load i32, ptr %arrayidx.8.i, align 4, !tbaa !8
%tobool.not.8.i = icmp eq i32 %7, 0
%spec.select.8.i = select i1 %tobool.not.8.i, i32 8, i32 %spec.select.7.i
%arrayidx.9.i = getelementptr inbounds i32, ptr %board, i64 9
%8 = load i32, ptr %arrayidx.9.i, align 4, !tbaa !8
%tobool.not.9.i = icmp eq i32 %8, 0
%spec.select.9.i = select i1 %tobool.not.9.i, i32 9, i32 %spec.select.8.i
%arrayidx.10.i = getelementptr inbounds i32, ptr %board, i64 10
%9 = load i32, ptr %arrayidx.10.i, align 4, !tbaa !8
%tobool.not.10.i = icmp eq i32 %9, 0
%spec.select.10.i = select i1 %tobool.not.10.i, i32 10, i32 %spec.select.9.i
%arrayidx.11.i = getelementptr inbounds i32, ptr %board, i64 11
%10 = load i32, ptr %arrayidx.11.i, align 4, !tbaa !8
%tobool.not.11.i = icmp eq i32 %10, 0
%spec.select.11.i = select i1 %tobool.not.11.i, i32 11, i32 %spec.select.10.i
%arrayidx.12.i = getelementptr inbounds i32, ptr %board, i64 12
%11 = load i32, ptr %arrayidx.12.i, align 4, !tbaa !8
%tobool.not.12.i = icmp eq i32 %11, 0
%spec.select.12.i = select i1 %tobool.not.12.i, i32 12, i32 %spec.select.11.i
%arrayidx.13.i = getelementptr inbounds i32, ptr %board, i64 13
%12 = load i32, ptr %arrayidx.13.i, align 4, !tbaa !8
%tobool.not.13.i = icmp eq i32 %12, 0
%spec.select.13.i = select i1 %tobool.not.13.i, i32 13, i32 %spec.select.12.i
%arrayidx.14.i = getelementptr inbounds i32, ptr %board, i64 14
%13 = load i32, ptr %arrayidx.14.i, align 4, !tbaa !8
%tobool.not.14.i = icmp eq i32 %13, 0
%spec.select.14.i = select i1 %tobool.not.14.i, i32 14, i32 %spec.select.13.i
%arrayidx.15.i = getelementptr inbounds i32, ptr %board, i64 15
%14 = load i32, ptr %arrayidx.15.i, align 4, !tbaa !8
%tobool.not.15.i = icmp eq i32 %14, 0
%spec.select.15.i = select i1 %tobool.not.15.i, i32 15, i32 %spec.select.14.i
%tobool2.i = icmp ult i32 %spec.select.15.i, 4
%cmp3.i = icmp eq i32 %prev, 1
%or.cond.i = or i1 %cmp3.i, %tobool2.i
br i1 %or.cond.i, label %if.end12, label %if.then5
if.then5: ; preds = %if.end2
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %next, ptr noundef nonnull align 4 dereferenceable(64) %board, i64 64, i1 false)
%sub.i = add nsw i32 %spec.select.15.i, -4
%idxprom6.i = zext i32 %sub.i to i64
%arrayidx7.i = getelementptr inbounds i32, ptr %board, i64 %idxprom6.i
%15 = load i32, ptr %arrayidx7.i, align 4, !tbaa !8
%idxprom8.i = zext i32 %spec.select.15.i to i64
%arrayidx9.i = getelementptr inbounds i32, ptr %next, i64 %idxprom8.i
store i32 %15, ptr %arrayidx9.i, align 4, !tbaa !8
%arrayidx11.i = getelementptr inbounds i32, ptr %board, i64 %idxprom8.i
%16 = load i32, ptr %arrayidx11.i, align 4, !tbaa !8
%arrayidx14.i = getelementptr inbounds i32, ptr %next, i64 %idxprom6.i
store i32 %16, ptr %arrayidx14.i, align 4, !tbaa !8
%add7 = add nsw i32 %depth, 1
%call8 = call i32 @Dfs(ptr noundef nonnull %next, ptr noundef %goal, i32 noundef %add7, i32 noundef 0, i32 noundef %limit), !range !5
%tobool9.not = icmp eq i32 %call8, 0
br i1 %tobool9.not, label %if.then5.if.end12_crit_edge, label %cleanup
if.then5.if.end12_crit_edge: ; preds = %if.then5
%.pre = load i32, ptr %arrayidx.1.i, align 4, !tbaa !8
%.pre237 = load i32, ptr %arrayidx.2.i, align 4, !tbaa !8
%.pre238 = load i32, ptr %arrayidx.3.i, align 4, !tbaa !8
%.pre239 = load i32, ptr %arrayidx.4.i, align 4, !tbaa !8
%.pre240 = load i32, ptr %arrayidx.5.i, align 4, !tbaa !8
%.pre241 = load i32, ptr %arrayidx.6.i, align 4, !tbaa !8
%.pre242 = load i32, ptr %arrayidx.7.i, align 4, !tbaa !8
%.pre243 = load i32, ptr %arrayidx.8.i, align 4, !tbaa !8
%.pre244 = load i32, ptr %arrayidx.9.i, align 4, !tbaa !8
%.pre245 = load i32, ptr %arrayidx.10.i, align 4, !tbaa !8
%.pre246 = load i32, ptr %arrayidx.11.i, align 4, !tbaa !8
%.pre247 = load i32, ptr %arrayidx.12.i, align 4, !tbaa !8
%.pre248 = load i32, ptr %arrayidx.13.i, align 4, !tbaa !8
%.pre249 = load i32, ptr %arrayidx.14.i, align 4, !tbaa !8
%.pre250 = load i32, ptr %arrayidx.15.i, align 4, !tbaa !8
br label %if.end12
if.end12: ; preds = %if.then5.if.end12_crit_edge, %if.end2
%17 = phi i32 [ %.pre250, %if.then5.if.end12_crit_edge ], [ %14, %if.end2 ]
%18 = phi i32 [ %.pre249, %if.then5.if.end12_crit_edge ], [ %13, %if.end2 ]
%19 = phi i32 [ %.pre248, %if.then5.if.end12_crit_edge ], [ %12, %if.end2 ]
%20 = phi i32 [ %.pre247, %if.then5.if.end12_crit_edge ], [ %11, %if.end2 ]
%21 = phi i32 [ %.pre246, %if.then5.if.end12_crit_edge ], [ %10, %if.end2 ]
%22 = phi i32 [ %.pre245, %if.then5.if.end12_crit_edge ], [ %9, %if.end2 ]
%23 = phi i32 [ %.pre244, %if.then5.if.end12_crit_edge ], [ %8, %if.end2 ]
%24 = phi i32 [ %.pre243, %if.then5.if.end12_crit_edge ], [ %7, %if.end2 ]
%25 = phi i32 [ %.pre242, %if.then5.if.end12_crit_edge ], [ %6, %if.end2 ]
%26 = phi i32 [ %.pre241, %if.then5.if.end12_crit_edge ], [ %5, %if.end2 ]
%27 = phi i32 [ %.pre240, %if.then5.if.end12_crit_edge ], [ %4, %if.end2 ]
%28 = phi i32 [ %.pre239, %if.then5.if.end12_crit_edge ], [ %3, %if.end2 ]
%29 = phi i32 [ %.pre238, %if.then5.if.end12_crit_edge ], [ %2, %if.end2 ]
%30 = phi i32 [ %.pre237, %if.then5.if.end12_crit_edge ], [ %1, %if.end2 ]
%31 = phi i32 [ %.pre, %if.then5.if.end12_crit_edge ], [ %0, %if.end2 ]
%tobool.not.1.i68 = icmp eq i32 %31, 0
%spec.select.1.i69 = zext i1 %tobool.not.1.i68 to i32
%tobool.not.2.i71 = icmp eq i32 %30, 0
%spec.select.2.i72 = select i1 %tobool.not.2.i71, i32 2, i32 %spec.select.1.i69
%tobool.not.3.i74 = icmp eq i32 %29, 0
%spec.select.3.i75 = select i1 %tobool.not.3.i74, i32 3, i32 %spec.select.2.i72
%tobool.not.4.i77 = icmp eq i32 %28, 0
%spec.select.4.i78 = select i1 %tobool.not.4.i77, i32 4, i32 %spec.select.3.i75
%tobool.not.5.i80 = icmp eq i32 %27, 0
%spec.select.5.i81 = select i1 %tobool.not.5.i80, i32 5, i32 %spec.select.4.i78
%tobool.not.6.i83 = icmp eq i32 %26, 0
%spec.select.6.i84 = select i1 %tobool.not.6.i83, i32 6, i32 %spec.select.5.i81
%tobool.not.7.i86 = icmp eq i32 %25, 0
%spec.select.7.i87 = select i1 %tobool.not.7.i86, i32 7, i32 %spec.select.6.i84
%tobool.not.8.i89 = icmp eq i32 %24, 0
%spec.select.8.i90 = select i1 %tobool.not.8.i89, i32 8, i32 %spec.select.7.i87
%tobool.not.9.i92 = icmp eq i32 %23, 0
%spec.select.9.i93 = select i1 %tobool.not.9.i92, i32 9, i32 %spec.select.8.i90
%tobool.not.10.i95 = icmp eq i32 %22, 0
%spec.select.10.i96 = select i1 %tobool.not.10.i95, i32 10, i32 %spec.select.9.i93
%tobool.not.11.i98 = icmp eq i32 %21, 0
%spec.select.11.i99 = select i1 %tobool.not.11.i98, i32 11, i32 %spec.select.10.i96
%tobool.not.12.i101 = icmp eq i32 %20, 0
%spec.select.12.i102 = select i1 %tobool.not.12.i101, i32 12, i32 %spec.select.11.i99
%tobool.not.13.i104 = icmp eq i32 %19, 0
%spec.select.13.i105 = select i1 %tobool.not.13.i104, i32 13, i32 %spec.select.12.i102
%tobool.not.14.i107 = icmp eq i32 %18, 0
%spec.select.14.i108 = select i1 %tobool.not.14.i107, i32 14, i32 %spec.select.13.i105
%tobool.not.15.i110 = icmp eq i32 %17, 0
%spec.select.15.i111 = select i1 %tobool.not.15.i110, i32 15, i32 %spec.select.14.i108
%32 = and i32 %spec.select.15.i111, -4
%cmp2.i = icmp eq i32 %32, 12
%cmp4.i = icmp eq i32 %prev, 0
%or.cond.i112 = or i1 %cmp4.i, %cmp2.i
br i1 %or.cond.i112, label %if.end23, label %if.then16
if.then16: ; preds = %if.end12
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %next, ptr noundef nonnull align 4 dereferenceable(64) %board, i64 64, i1 false)
%add.i = add nuw nsw i32 %spec.select.15.i111, 4
%idxprom7.i = zext i32 %add.i to i64
%arrayidx8.i = getelementptr inbounds i32, ptr %board, i64 %idxprom7.i
%33 = load i32, ptr %arrayidx8.i, align 4, !tbaa !8
%idxprom9.i = zext i32 %spec.select.15.i111 to i64
%arrayidx10.i = getelementptr inbounds i32, ptr %next, i64 %idxprom9.i
store i32 %33, ptr %arrayidx10.i, align 4, !tbaa !8
%arrayidx12.i = getelementptr inbounds i32, ptr %board, i64 %idxprom9.i
%34 = load i32, ptr %arrayidx12.i, align 4, !tbaa !8
%arrayidx15.i = getelementptr inbounds i32, ptr %next, i64 %idxprom7.i
store i32 %34, ptr %arrayidx15.i, align 4, !tbaa !8
%add18 = add nsw i32 %depth, 1
%call19 = call i32 @Dfs(ptr noundef nonnull %next, ptr noundef %goal, i32 noundef %add18, i32 noundef 1, i32 noundef %limit), !range !5
%tobool20.not = icmp eq i32 %call19, 0
br i1 %tobool20.not, label %if.then16.if.end23_crit_edge, label %cleanup
if.then16.if.end23_crit_edge: ; preds = %if.then16
%.pre251 = load i32, ptr %arrayidx.1.i, align 4, !tbaa !8
%.pre252 = load i32, ptr %arrayidx.2.i, align 4, !tbaa !8
%.pre253 = load i32, ptr %arrayidx.3.i, align 4, !tbaa !8
%.pre254 = load i32, ptr %arrayidx.4.i, align 4, !tbaa !8
%.pre255 = load i32, ptr %arrayidx.5.i, align 4, !tbaa !8
%.pre256 = load i32, ptr %arrayidx.6.i, align 4, !tbaa !8
%.pre257 = load i32, ptr %arrayidx.7.i, align 4, !tbaa !8
%.pre258 = load i32, ptr %arrayidx.8.i, align 4, !tbaa !8
%.pre259 = load i32, ptr %arrayidx.9.i, align 4, !tbaa !8
%.pre260 = load i32, ptr %arrayidx.10.i, align 4, !tbaa !8
%.pre261 = load i32, ptr %arrayidx.11.i, align 4, !tbaa !8
%.pre262 = load i32, ptr %arrayidx.12.i, align 4, !tbaa !8
%.pre263 = load i32, ptr %arrayidx.13.i, align 4, !tbaa !8
%.pre264 = load i32, ptr %arrayidx.14.i, align 4, !tbaa !8
%.pre265 = load i32, ptr %arrayidx.15.i, align 4, !tbaa !8
br label %if.end23
if.end23: ; preds = %if.then16.if.end23_crit_edge, %if.end12
%35 = phi i32 [ %.pre265, %if.then16.if.end23_crit_edge ], [ %17, %if.end12 ]
%36 = phi i32 [ %.pre264, %if.then16.if.end23_crit_edge ], [ %18, %if.end12 ]
%37 = phi i32 [ %.pre263, %if.then16.if.end23_crit_edge ], [ %19, %if.end12 ]
%38 = phi i32 [ %.pre262, %if.then16.if.end23_crit_edge ], [ %20, %if.end12 ]
%39 = phi i32 [ %.pre261, %if.then16.if.end23_crit_edge ], [ %21, %if.end12 ]
%40 = phi i32 [ %.pre260, %if.then16.if.end23_crit_edge ], [ %22, %if.end12 ]
%41 = phi i32 [ %.pre259, %if.then16.if.end23_crit_edge ], [ %23, %if.end12 ]
%42 = phi i32 [ %.pre258, %if.then16.if.end23_crit_edge ], [ %24, %if.end12 ]
%43 = phi i32 [ %.pre257, %if.then16.if.end23_crit_edge ], [ %25, %if.end12 ]
%44 = phi i32 [ %.pre256, %if.then16.if.end23_crit_edge ], [ %26, %if.end12 ]
%45 = phi i32 [ %.pre255, %if.then16.if.end23_crit_edge ], [ %27, %if.end12 ]
%46 = phi i32 [ %.pre254, %if.then16.if.end23_crit_edge ], [ %28, %if.end12 ]
%47 = phi i32 [ %.pre253, %if.then16.if.end23_crit_edge ], [ %29, %if.end12 ]
%48 = phi i32 [ %.pre252, %if.then16.if.end23_crit_edge ], [ %30, %if.end12 ]
%49 = phi i32 [ %.pre251, %if.then16.if.end23_crit_edge ], [ %31, %if.end12 ]
%tobool.not.1.i116 = icmp eq i32 %49, 0
%spec.select.1.i117 = zext i1 %tobool.not.1.i116 to i32
%tobool.not.2.i119 = icmp eq i32 %48, 0
%spec.select.2.i120 = select i1 %tobool.not.2.i119, i32 2, i32 %spec.select.1.i117
%tobool.not.3.i122 = icmp eq i32 %47, 0
%spec.select.3.i123 = select i1 %tobool.not.3.i122, i32 3, i32 %spec.select.2.i120
%tobool.not.4.i125 = icmp eq i32 %46, 0
%spec.select.4.i126 = select i1 %tobool.not.4.i125, i32 4, i32 %spec.select.3.i123
%tobool.not.5.i128 = icmp eq i32 %45, 0
%spec.select.5.i129 = select i1 %tobool.not.5.i128, i32 5, i32 %spec.select.4.i126
%tobool.not.6.i131 = icmp eq i32 %44, 0
%spec.select.6.i132 = select i1 %tobool.not.6.i131, i32 6, i32 %spec.select.5.i129
%tobool.not.7.i134 = icmp eq i32 %43, 0
%spec.select.7.i135 = select i1 %tobool.not.7.i134, i32 7, i32 %spec.select.6.i132
%tobool.not.8.i137 = icmp eq i32 %42, 0
%spec.select.8.i138 = select i1 %tobool.not.8.i137, i32 8, i32 %spec.select.7.i135
%tobool.not.9.i140 = icmp eq i32 %41, 0
%spec.select.9.i141 = select i1 %tobool.not.9.i140, i32 9, i32 %spec.select.8.i138
%tobool.not.10.i143 = icmp eq i32 %40, 0
%spec.select.10.i144 = select i1 %tobool.not.10.i143, i32 10, i32 %spec.select.9.i141
%tobool.not.11.i146 = icmp eq i32 %39, 0
%spec.select.11.i147 = select i1 %tobool.not.11.i146, i32 11, i32 %spec.select.10.i144
%tobool.not.12.i149 = icmp eq i32 %38, 0
%spec.select.12.i150 = select i1 %tobool.not.12.i149, i32 12, i32 %spec.select.11.i147
%tobool.not.13.i152 = icmp eq i32 %37, 0
%spec.select.13.i153 = select i1 %tobool.not.13.i152, i32 13, i32 %spec.select.12.i150
%tobool.not.14.i155 = icmp eq i32 %36, 0
%spec.select.14.i156 = select i1 %tobool.not.14.i155, i32 14, i32 %spec.select.13.i153
%tobool.not.15.i158 = icmp eq i32 %35, 0
%spec.select.15.i159 = select i1 %tobool.not.15.i158, i32 15, i32 %spec.select.14.i156
%50 = and i32 %spec.select.15.i159, 3
%tobool2.i160 = icmp eq i32 %50, 0
%cmp3.i161 = icmp eq i32 %prev, 3
%or.cond.i162 = or i1 %cmp3.i161, %tobool2.i160
br i1 %or.cond.i162, label %if.end34, label %if.then27
if.then27: ; preds = %if.end23
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %next, ptr noundef nonnull align 4 dereferenceable(64) %board, i64 64, i1 false)
%sub.i164 = add nsw i32 %spec.select.15.i159, -1
%idxprom6.i165 = zext i32 %sub.i164 to i64
%arrayidx7.i166 = getelementptr inbounds i32, ptr %board, i64 %idxprom6.i165
%51 = load i32, ptr %arrayidx7.i166, align 4, !tbaa !8
%idxprom8.i167 = zext i32 %spec.select.15.i159 to i64
%arrayidx9.i168 = getelementptr inbounds i32, ptr %next, i64 %idxprom8.i167
store i32 %51, ptr %arrayidx9.i168, align 4, !tbaa !8
%arrayidx11.i169 = getelementptr inbounds i32, ptr %board, i64 %idxprom8.i167
%52 = load i32, ptr %arrayidx11.i169, align 4, !tbaa !8
%arrayidx14.i170 = getelementptr inbounds i32, ptr %next, i64 %idxprom6.i165
store i32 %52, ptr %arrayidx14.i170, align 4, !tbaa !8
%add29 = add nsw i32 %depth, 1
%call30 = call i32 @Dfs(ptr noundef nonnull %next, ptr noundef %goal, i32 noundef %add29, i32 noundef 2, i32 noundef %limit), !range !5
%tobool31.not = icmp eq i32 %call30, 0
br i1 %tobool31.not, label %if.then27.if.end34_crit_edge, label %cleanup
if.then27.if.end34_crit_edge: ; preds = %if.then27
%.pre266 = load i32, ptr %arrayidx.1.i, align 4, !tbaa !8
%.pre267 = load i32, ptr %arrayidx.2.i, align 4, !tbaa !8
%.pre268 = load i32, ptr %arrayidx.3.i, align 4, !tbaa !8
%.pre269 = load i32, ptr %arrayidx.4.i, align 4, !tbaa !8
%.pre270 = load i32, ptr %arrayidx.5.i, align 4, !tbaa !8
%.pre271 = load i32, ptr %arrayidx.6.i, align 4, !tbaa !8
%.pre272 = load i32, ptr %arrayidx.7.i, align 4, !tbaa !8
%.pre273 = load i32, ptr %arrayidx.8.i, align 4, !tbaa !8
%.pre274 = load i32, ptr %arrayidx.9.i, align 4, !tbaa !8
%.pre275 = load i32, ptr %arrayidx.10.i, align 4, !tbaa !8
%.pre276 = load i32, ptr %arrayidx.11.i, align 4, !tbaa !8
%.pre277 = load i32, ptr %arrayidx.12.i, align 4, !tbaa !8
%.pre278 = load i32, ptr %arrayidx.13.i, align 4, !tbaa !8
%.pre279 = load i32, ptr %arrayidx.14.i, align 4, !tbaa !8
%.pre280 = load i32, ptr %arrayidx.15.i, align 4, !tbaa !8
br label %if.end34
if.end34: ; preds = %if.then27.if.end34_crit_edge, %if.end23
%53 = phi i32 [ %.pre280, %if.then27.if.end34_crit_edge ], [ %35, %if.end23 ]
%54 = phi i32 [ %.pre279, %if.then27.if.end34_crit_edge ], [ %36, %if.end23 ]
%55 = phi i32 [ %.pre278, %if.then27.if.end34_crit_edge ], [ %37, %if.end23 ]
%56 = phi i32 [ %.pre277, %if.then27.if.end34_crit_edge ], [ %38, %if.end23 ]
%57 = phi i32 [ %.pre276, %if.then27.if.end34_crit_edge ], [ %39, %if.end23 ]
%58 = phi i32 [ %.pre275, %if.then27.if.end34_crit_edge ], [ %40, %if.end23 ]
%59 = phi i32 [ %.pre274, %if.then27.if.end34_crit_edge ], [ %41, %if.end23 ]
%60 = phi i32 [ %.pre273, %if.then27.if.end34_crit_edge ], [ %42, %if.end23 ]
%61 = phi i32 [ %.pre272, %if.then27.if.end34_crit_edge ], [ %43, %if.end23 ]
%62 = phi i32 [ %.pre271, %if.then27.if.end34_crit_edge ], [ %44, %if.end23 ]
%63 = phi i32 [ %.pre270, %if.then27.if.end34_crit_edge ], [ %45, %if.end23 ]
%64 = phi i32 [ %.pre269, %if.then27.if.end34_crit_edge ], [ %46, %if.end23 ]
%65 = phi i32 [ %.pre268, %if.then27.if.end34_crit_edge ], [ %47, %if.end23 ]
%66 = phi i32 [ %.pre267, %if.then27.if.end34_crit_edge ], [ %48, %if.end23 ]
%67 = phi i32 [ %.pre266, %if.then27.if.end34_crit_edge ], [ %49, %if.end23 ]
%tobool.not.1.i173 = icmp eq i32 %67, 0
%spec.select.1.i174 = zext i1 %tobool.not.1.i173 to i32
%tobool.not.2.i176 = icmp eq i32 %66, 0
%spec.select.2.i177 = select i1 %tobool.not.2.i176, i32 2, i32 %spec.select.1.i174
%tobool.not.3.i179 = icmp eq i32 %65, 0
%spec.select.3.i180 = select i1 %tobool.not.3.i179, i32 3, i32 %spec.select.2.i177
%tobool.not.4.i182 = icmp eq i32 %64, 0
%spec.select.4.i183 = select i1 %tobool.not.4.i182, i32 4, i32 %spec.select.3.i180
%tobool.not.5.i185 = icmp eq i32 %63, 0
%spec.select.5.i186 = select i1 %tobool.not.5.i185, i32 5, i32 %spec.select.4.i183
%tobool.not.6.i188 = icmp eq i32 %62, 0
%spec.select.6.i189 = select i1 %tobool.not.6.i188, i32 6, i32 %spec.select.5.i186
%tobool.not.7.i191 = icmp eq i32 %61, 0
%spec.select.7.i192 = select i1 %tobool.not.7.i191, i32 7, i32 %spec.select.6.i189
%tobool.not.8.i194 = icmp eq i32 %60, 0
%spec.select.8.i195 = select i1 %tobool.not.8.i194, i32 8, i32 %spec.select.7.i192
%tobool.not.9.i197 = icmp eq i32 %59, 0
%spec.select.9.i198 = select i1 %tobool.not.9.i197, i32 9, i32 %spec.select.8.i195
%tobool.not.10.i200 = icmp eq i32 %58, 0
%spec.select.10.i201 = select i1 %tobool.not.10.i200, i32 10, i32 %spec.select.9.i198
%tobool.not.11.i203 = icmp eq i32 %57, 0
%spec.select.11.i204 = select i1 %tobool.not.11.i203, i32 11, i32 %spec.select.10.i201
%tobool.not.12.i206 = icmp eq i32 %56, 0
%spec.select.12.i207 = select i1 %tobool.not.12.i206, i32 12, i32 %spec.select.11.i204
%tobool.not.13.i209 = icmp eq i32 %55, 0
%spec.select.13.i210 = select i1 %tobool.not.13.i209, i32 13, i32 %spec.select.12.i207
%tobool.not.14.i212 = icmp eq i32 %54, 0
%spec.select.14.i213 = select i1 %tobool.not.14.i212, i32 14, i32 %spec.select.13.i210
%tobool.not.15.i215 = icmp eq i32 %53, 0
%spec.select.15.i216 = select i1 %tobool.not.15.i215, i32 15, i32 %spec.select.14.i213
%68 = and i32 %spec.select.15.i216, -2147483645
%cmp2.i217 = icmp eq i32 %68, 3
%cmp4.i218 = icmp eq i32 %prev, 2
%or.cond.i219 = or i1 %cmp4.i218, %cmp2.i217
br i1 %or.cond.i219, label %if.end45, label %if.then38
if.then38: ; preds = %if.end34
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %next, ptr noundef nonnull align 4 dereferenceable(64) %board, i64 64, i1 false)
%add.i221 = add nuw nsw i32 %spec.select.15.i216, 1
%idxprom7.i222 = zext i32 %add.i221 to i64
%arrayidx8.i223 = getelementptr inbounds i32, ptr %board, i64 %idxprom7.i222
%69 = load i32, ptr %arrayidx8.i223, align 4, !tbaa !8
%idxprom9.i224 = zext i32 %spec.select.15.i216 to i64
%arrayidx10.i225 = getelementptr inbounds i32, ptr %next, i64 %idxprom9.i224
store i32 %69, ptr %arrayidx10.i225, align 4, !tbaa !8
%arrayidx12.i226 = getelementptr inbounds i32, ptr %board, i64 %idxprom9.i224
%70 = load i32, ptr %arrayidx12.i226, align 4, !tbaa !8
%arrayidx15.i227 = getelementptr inbounds i32, ptr %next, i64 %idxprom7.i222
store i32 %70, ptr %arrayidx15.i227, align 4, !tbaa !8
%add40 = add nsw i32 %depth, 1
%call41 = call i32 @Dfs(ptr noundef nonnull %next, ptr noundef %goal, i32 noundef %add40, i32 noundef 3, i32 noundef %limit), !range !5
%tobool42.not = icmp eq i32 %call41, 0
br i1 %tobool42.not, label %if.end45, label %cleanup
if.end45: ; preds = %if.end34, %if.then38
br label %cleanup
cleanup: ; preds = %if.then38, %if.then27, %if.then16, %if.then5, %if.else, %entry, %if.end45
%retval.0 = phi i32 [ 0, %if.end45 ], [ 1, %entry ], [ 0, %if.else ], [ 1, %if.then5 ], [ 1, %if.then16 ], [ 1, %if.then27 ], [ 1, %if.then38 ]
call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %next) #8
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @swap_upper(ptr nocapture noundef readonly %board, ptr nocapture noundef writeonly %next, i32 noundef %prev) local_unnamed_addr #6 {
entry:
%arrayidx.1 = getelementptr inbounds i32, ptr %board, i64 1
%0 = load i32, ptr %arrayidx.1, align 4, !tbaa !8
%tobool.not.1 = icmp eq i32 %0, 0
%spec.select.1 = zext i1 %tobool.not.1 to i32
%arrayidx.2 = getelementptr inbounds i32, ptr %board, i64 2
%1 = load i32, ptr %arrayidx.2, align 4, !tbaa !8
%tobool.not.2 = icmp eq i32 %1, 0
%spec.select.2 = select i1 %tobool.not.2, i32 2, i32 %spec.select.1
%arrayidx.3 = getelementptr inbounds i32, ptr %board, i64 3
%2 = load i32, ptr %arrayidx.3, align 4, !tbaa !8
%tobool.not.3 = icmp eq i32 %2, 0
%spec.select.3 = select i1 %tobool.not.3, i32 3, i32 %spec.select.2
%arrayidx.4 = getelementptr inbounds i32, ptr %board, i64 4
%3 = load i32, ptr %arrayidx.4, align 4, !tbaa !8
%tobool.not.4 = icmp eq i32 %3, 0
%spec.select.4 = select i1 %tobool.not.4, i32 4, i32 %spec.select.3
%arrayidx.5 = getelementptr inbounds i32, ptr %board, i64 5
%4 = load i32, ptr %arrayidx.5, align 4, !tbaa !8
%tobool.not.5 = icmp eq i32 %4, 0
%spec.select.5 = select i1 %tobool.not.5, i32 5, i32 %spec.select.4
%arrayidx.6 = getelementptr inbounds i32, ptr %board, i64 6
%5 = load i32, ptr %arrayidx.6, align 4, !tbaa !8
%tobool.not.6 = icmp eq i32 %5, 0
%spec.select.6 = select i1 %tobool.not.6, i32 6, i32 %spec.select.5
%arrayidx.7 = getelementptr inbounds i32, ptr %board, i64 7
%6 = load i32, ptr %arrayidx.7, align 4, !tbaa !8
%tobool.not.7 = icmp eq i32 %6, 0
%spec.select.7 = select i1 %tobool.not.7, i32 7, i32 %spec.select.6
%arrayidx.8 = getelementptr inbounds i32, ptr %board, i64 8
%7 = load <8 x i32>, ptr %arrayidx.8, align 4, !tbaa !8
%8 = icmp eq <8 x i32> %7, zeroinitializer
%9 = extractelement <8 x i1> %8, i64 0
%spec.select.8 = select i1 %9, i32 8, i32 %spec.select.7
%10 = extractelement <8 x i1> %8, i64 1
%spec.select.9 = select i1 %10, i32 9, i32 %spec.select.8
%11 = extractelement <8 x i1> %8, i64 2
%spec.select.10 = select i1 %11, i32 10, i32 %spec.select.9
%12 = extractelement <8 x i1> %8, i64 3
%spec.select.11 = select i1 %12, i32 11, i32 %spec.select.10
%13 = extractelement <8 x i1> %8, i64 4
%spec.select.12 = select i1 %13, i32 12, i32 %spec.select.11
%14 = extractelement <8 x i1> %8, i64 5
%spec.select.13 = select i1 %14, i32 13, i32 %spec.select.12
%15 = extractelement <8 x i1> %8, i64 6
%spec.select.14 = select i1 %15, i32 14, i32 %spec.select.13
%16 = extractelement <8 x i1> %8, i64 7
%spec.select.15 = select i1 %16, i32 15, i32 %spec.select.14
%tobool2 = icmp ult i32 %spec.select.15, 4
%cmp3 = icmp eq i32 %prev, 1
%or.cond = or i1 %cmp3, %tobool2
br i1 %or.cond, label %cleanup, label %if.else
if.else: ; preds = %entry
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(64) %next, ptr noundef nonnull align 4 dereferenceable(64) %board, i64 64, i1 false)
%sub = add nsw i32 %spec.select.15, -4
%idxprom6 = zext i32 %sub to i64
%arrayidx7 = getelementptr inbounds i32, ptr %board, i64 %idxprom6
%17 = load i32, ptr %arrayidx7, align 4, !tbaa !8
%idxprom8 = zext i32 %spec.select.15 to i64
%arrayidx9 = getelementptr inbounds i32, ptr %next, i64 %idxprom8
store i32 %17, ptr %arrayidx9, align 4, !tbaa !8
%arrayidx11 = getelementptr inbounds i32, ptr %board, i64 %idxprom8
%18 = load i32, ptr %arrayidx11, align 4, !tbaa !8
%arrayidx14 = getelementptr inbounds i32, ptr %next, i64 %idxprom6
store i32 %18, ptr %arrayidx14, align 4, !tbaa !8
br label %cleanup
cleanup: ; preds = %entry, %if.else
%retval.0 = phi i32 [ 1, %if.else ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @swap_lower(ptr nocapture noundef readonly %board, ptr nocapture noundef writeonly %next, i32 noundef %prev) local_unnamed_addr #6 {
entry:
%arrayidx.1 = getelementptr inbounds i32, ptr %board, i64 1
%0 = load i32, ptr %arrayidx.1, align 4, !tbaa !8
%tobool.not.1 = icmp eq i32 %0, 0
%spec.select.1 = zext i1 %tobool.not.1 to i32
%arrayidx.2 = getelementptr inbounds i32, ptr %board, i64 2
%1 = load i32, ptr %arrayidx.2, align 4, !tbaa !8
%tobool.not.2 = icmp eq i32 %1, 0
%spec.select.2 = select i1 %tobool.not.2, i32 2, i32 %spec.select.1
%arrayidx.3 = getelementptr inbounds i32, ptr %board, i64 3
%2 = load i32, ptr %arrayidx.3, align 4, !tbaa !8
%tobool.not.3 = icmp eq i32 %2, 0
%spec.select.3 = select i1 %tobool.not.3, i32 3, i32 %spec.select.2
%arrayidx.4 = getelementptr inbounds i32, ptr %board, i64 4
%3 = load i32, ptr %arrayidx.4, align 4, !tbaa !8
%tobool.not.4 = icmp eq i32 %3, 0
%spec.select.4 = select i1 %tobool.not.4, i32 4, i32 %spec.select.3
%arrayidx.5 = getelementptr inbounds i32, ptr %board, i64 5
%4 = load i32, ptr %arrayidx.5, align 4, !tbaa !8
%tobool.not.5 = icmp eq i32 %4, 0
%spec.select.5 = select i1 %tobool.not.5, i32 5, i32 %spec.select.4
%arrayidx.6 = getelementptr inbounds i32, ptr %board, i64 6
%5 = load i32, ptr %arrayidx.6, align 4, !tbaa !8
%tobool.not.6 = icmp eq i32 %5, 0
%spec.select.6 = select i1 %tobool.not.6, i32 6, i32 %spec.select.5
%arrayidx.7 = getelementptr inbounds i32, ptr %board, i64 7
%6 = load i32, ptr %arrayidx.7, align 4, !tbaa !8
%tobool.not.7 = icmp eq i32 %6, 0
%spec.select.7 = select i1 %tobool.not.7, i32 7, i32 %spec.select.6
%arrayidx.8 = getelementptr inbounds i32, ptr %board, i64 8
%7 = load <8 x i32>, ptr %arrayidx.8, align 4, !tbaa !8
%8 = icmp eq <8 x i32> %7, zeroinitializer
%9 = extractelement <8 x i1> %8, i64 0
%spec.select.8 = select i1 %9, i32 8, i32 %spec.select.7
%10 = extractelement <8 x i1> %8, i64 1
%spec.select.9 = select i1 %10, i32 9, i32 %spec.select.8
%11 = extractelement <8 x i1> %8, i64 2
%spec.select.10 = select i1 %11, i32 10, i32 %spec.select.9
%12 = extractelement <8 x i1> %8, i64 3
%spec.select.11 = select i1 %12, i32 11, i32 %spec.select.10
%13 = extractelement <8 x i1> %8, i64 4
%spec.select.12 = select i1 %13, i32 12, i32 %spec.select.11
%14 = extractelement <8 x i1> %8, i64 5
%spec.select.13 = select i1 %14, i32 13, i32 %spec.select.12
%15 = extractelement <8 x i1> %8, i64 6
%spec.select.14 = select i1 %15, i32 14, i32 %spec.select.13
%16 = extractelement <8 x i1> %8, i64 7
%spec.select.15 = select i1 %16, i32 15, i32 %spec.select.14
%17 = and i32 %spec.select.15, -4
%cmp2 = icmp eq i32 %17, 12
%cmp4 = icmp eq i32 %prev, 0
%or.cond = or i1 %cmp4, %cmp2
br i1 %or.cond, label %cleanup, label %if.else
if.else: ; preds = %entry
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(64) %next, ptr noundef nonnull align 4 dereferenceable(64) %board, i64 64, i1 false)
%add = add nuw nsw i32 %spec.select.15, 4
%idxprom7 = zext i32 %add to i64
%arrayidx8 = getelementptr inbounds i32, ptr %board, i64 %idxprom7
%18 = load i32, ptr %arrayidx8, align 4, !tbaa !8
%idxprom9 = zext i32 %spec.select.15 to i64
%arrayidx10 = getelementptr inbounds i32, ptr %next, i64 %idxprom9
store i32 %18, ptr %arrayidx10, align 4, !tbaa !8
%arrayidx12 = getelementptr inbounds i32, ptr %board, i64 %idxprom9
%19 = load i32, ptr %arrayidx12, align 4, !tbaa !8
%arrayidx15 = getelementptr inbounds i32, ptr %next, i64 %idxprom7
store i32 %19, ptr %arrayidx15, align 4, !tbaa !8
br label %cleanup
cleanup: ; preds = %entry, %if.else
%retval.0 = phi i32 [ 1, %if.else ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @swap_left(ptr nocapture noundef readonly %board, ptr nocapture noundef writeonly %next, i32 noundef %prev) local_unnamed_addr #6 {
entry:
%arrayidx.1 = getelementptr inbounds i32, ptr %board, i64 1
%0 = load i32, ptr %arrayidx.1, align 4, !tbaa !8
%tobool.not.1 = icmp eq i32 %0, 0
%spec.select.1 = zext i1 %tobool.not.1 to i32
%arrayidx.2 = getelementptr inbounds i32, ptr %board, i64 2
%1 = load i32, ptr %arrayidx.2, align 4, !tbaa !8
%tobool.not.2 = icmp eq i32 %1, 0
%spec.select.2 = select i1 %tobool.not.2, i32 2, i32 %spec.select.1
%arrayidx.3 = getelementptr inbounds i32, ptr %board, i64 3
%2 = load i32, ptr %arrayidx.3, align 4, !tbaa !8
%tobool.not.3 = icmp eq i32 %2, 0
%spec.select.3 = select i1 %tobool.not.3, i32 3, i32 %spec.select.2
%arrayidx.4 = getelementptr inbounds i32, ptr %board, i64 4
%3 = load i32, ptr %arrayidx.4, align 4, !tbaa !8
%tobool.not.4 = icmp eq i32 %3, 0
%spec.select.4 = select i1 %tobool.not.4, i32 4, i32 %spec.select.3
%arrayidx.5 = getelementptr inbounds i32, ptr %board, i64 5
%4 = load i32, ptr %arrayidx.5, align 4, !tbaa !8
%tobool.not.5 = icmp eq i32 %4, 0
%spec.select.5 = select i1 %tobool.not.5, i32 5, i32 %spec.select.4
%arrayidx.6 = getelementptr inbounds i32, ptr %board, i64 6
%5 = load i32, ptr %arrayidx.6, align 4, !tbaa !8
%tobool.not.6 = icmp eq i32 %5, 0
%spec.select.6 = select i1 %tobool.not.6, i32 6, i32 %spec.select.5
%arrayidx.7 = getelementptr inbounds i32, ptr %board, i64 7
%6 = load i32, ptr %arrayidx.7, align 4, !tbaa !8
%tobool.not.7 = icmp eq i32 %6, 0
%spec.select.7 = select i1 %tobool.not.7, i32 7, i32 %spec.select.6
%arrayidx.8 = getelementptr inbounds i32, ptr %board, i64 8
%7 = load <8 x i32>, ptr %arrayidx.8, align 4, !tbaa !8
%8 = icmp eq <8 x i32> %7, zeroinitializer
%9 = extractelement <8 x i1> %8, i64 0
%spec.select.8 = select i1 %9, i32 8, i32 %spec.select.7
%10 = extractelement <8 x i1> %8, i64 1
%spec.select.9 = select i1 %10, i32 9, i32 %spec.select.8
%11 = extractelement <8 x i1> %8, i64 2
%spec.select.10 = select i1 %11, i32 10, i32 %spec.select.9
%12 = extractelement <8 x i1> %8, i64 3
%spec.select.11 = select i1 %12, i32 11, i32 %spec.select.10
%13 = extractelement <8 x i1> %8, i64 4
%spec.select.12 = select i1 %13, i32 12, i32 %spec.select.11
%14 = extractelement <8 x i1> %8, i64 5
%spec.select.13 = select i1 %14, i32 13, i32 %spec.select.12
%15 = extractelement <8 x i1> %8, i64 6
%spec.select.14 = select i1 %15, i32 14, i32 %spec.select.13
%16 = extractelement <8 x i1> %8, i64 7
%spec.select.15 = select i1 %16, i32 15, i32 %spec.select.14
%17 = and i32 %spec.select.15, 3
%tobool2 = icmp eq i32 %17, 0
%cmp3 = icmp eq i32 %prev, 3
%or.cond = or i1 %cmp3, %tobool2
br i1 %or.cond, label %cleanup, label %if.else
if.else: ; preds = %entry
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(64) %next, ptr noundef nonnull align 4 dereferenceable(64) %board, i64 64, i1 false)
%sub = add nsw i32 %spec.select.15, -1
%idxprom6 = zext i32 %sub to i64
%arrayidx7 = getelementptr inbounds i32, ptr %board, i64 %idxprom6
%18 = load i32, ptr %arrayidx7, align 4, !tbaa !8
%idxprom8 = zext i32 %spec.select.15 to i64
%arrayidx9 = getelementptr inbounds i32, ptr %next, i64 %idxprom8
store i32 %18, ptr %arrayidx9, align 4, !tbaa !8
%arrayidx11 = getelementptr inbounds i32, ptr %board, i64 %idxprom8
%19 = load i32, ptr %arrayidx11, align 4, !tbaa !8
%arrayidx14 = getelementptr inbounds i32, ptr %next, i64 %idxprom6
store i32 %19, ptr %arrayidx14, align 4, !tbaa !8
br label %cleanup
cleanup: ; preds = %entry, %if.else
%retval.0 = phi i32 [ 1, %if.else ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @swap_right(ptr nocapture noundef readonly %board, ptr nocapture noundef writeonly %next, i32 noundef %prev) local_unnamed_addr #6 {
entry:
%arrayidx.1 = getelementptr inbounds i32, ptr %board, i64 1
%0 = load i32, ptr %arrayidx.1, align 4, !tbaa !8
%tobool.not.1 = icmp eq i32 %0, 0
%spec.select.1 = zext i1 %tobool.not.1 to i32
%arrayidx.2 = getelementptr inbounds i32, ptr %board, i64 2
%1 = load i32, ptr %arrayidx.2, align 4, !tbaa !8
%tobool.not.2 = icmp eq i32 %1, 0
%spec.select.2 = select i1 %tobool.not.2, i32 2, i32 %spec.select.1
%arrayidx.3 = getelementptr inbounds i32, ptr %board, i64 3
%2 = load i32, ptr %arrayidx.3, align 4, !tbaa !8
%tobool.not.3 = icmp eq i32 %2, 0
%spec.select.3 = select i1 %tobool.not.3, i32 3, i32 %spec.select.2
%arrayidx.4 = getelementptr inbounds i32, ptr %board, i64 4
%3 = load i32, ptr %arrayidx.4, align 4, !tbaa !8
%tobool.not.4 = icmp eq i32 %3, 0
%spec.select.4 = select i1 %tobool.not.4, i32 4, i32 %spec.select.3
%arrayidx.5 = getelementptr inbounds i32, ptr %board, i64 5
%4 = load i32, ptr %arrayidx.5, align 4, !tbaa !8
%tobool.not.5 = icmp eq i32 %4, 0
%spec.select.5 = select i1 %tobool.not.5, i32 5, i32 %spec.select.4
%arrayidx.6 = getelementptr inbounds i32, ptr %board, i64 6
%5 = load i32, ptr %arrayidx.6, align 4, !tbaa !8
%tobool.not.6 = icmp eq i32 %5, 0
%spec.select.6 = select i1 %tobool.not.6, i32 6, i32 %spec.select.5
%arrayidx.7 = getelementptr inbounds i32, ptr %board, i64 7
%6 = load i32, ptr %arrayidx.7, align 4, !tbaa !8
%tobool.not.7 = icmp eq i32 %6, 0
%spec.select.7 = select i1 %tobool.not.7, i32 7, i32 %spec.select.6
%arrayidx.8 = getelementptr inbounds i32, ptr %board, i64 8
%7 = load <8 x i32>, ptr %arrayidx.8, align 4, !tbaa !8
%8 = icmp eq <8 x i32> %7, zeroinitializer
%9 = extractelement <8 x i1> %8, i64 0
%spec.select.8 = select i1 %9, i32 8, i32 %spec.select.7
%10 = extractelement <8 x i1> %8, i64 1
%spec.select.9 = select i1 %10, i32 9, i32 %spec.select.8
%11 = extractelement <8 x i1> %8, i64 2
%spec.select.10 = select i1 %11, i32 10, i32 %spec.select.9
%12 = extractelement <8 x i1> %8, i64 3
%spec.select.11 = select i1 %12, i32 11, i32 %spec.select.10
%13 = extractelement <8 x i1> %8, i64 4
%spec.select.12 = select i1 %13, i32 12, i32 %spec.select.11
%14 = extractelement <8 x i1> %8, i64 5
%spec.select.13 = select i1 %14, i32 13, i32 %spec.select.12
%15 = extractelement <8 x i1> %8, i64 6
%spec.select.14 = select i1 %15, i32 14, i32 %spec.select.13
%16 = extractelement <8 x i1> %8, i64 7
%spec.select.15 = select i1 %16, i32 15, i32 %spec.select.14
%17 = and i32 %spec.select.15, -2147483645
%cmp2 = icmp eq i32 %17, 3
%cmp4 = icmp eq i32 %prev, 2
%or.cond = or i1 %cmp4, %cmp2
br i1 %or.cond, label %cleanup, label %if.else
if.else: ; preds = %entry
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(64) %next, ptr noundef nonnull align 4 dereferenceable(64) %board, i64 64, i1 false)
%add = add nuw nsw i32 %spec.select.15, 1
%idxprom7 = zext i32 %add to i64
%arrayidx8 = getelementptr inbounds i32, ptr %board, i64 %idxprom7
%18 = load i32, ptr %arrayidx8, align 4, !tbaa !8
%idxprom9 = zext i32 %spec.select.15 to i64
%arrayidx10 = getelementptr inbounds i32, ptr %next, i64 %idxprom9
store i32 %18, ptr %arrayidx10, align 4, !tbaa !8
%arrayidx12 = getelementptr inbounds i32, ptr %board, i64 %idxprom9
%19 = load i32, ptr %arrayidx12, align 4, !tbaa !8
%arrayidx15 = getelementptr inbounds i32, ptr %next, i64 %idxprom7
store i32 %19, ptr %arrayidx15, align 4, !tbaa !8
br label %cleanup
cleanup: ; preds = %entry, %if.else
%retval.0 = phi i32 [ 1, %if.else ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #7
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree 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 #5 = { 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 #6 = { mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress 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 = !{i32 0, i32 2}
!6 = distinct !{!6, !7}
!7 = !{!"llvm.loop.mustprogress"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = distinct !{!12, !7}
|
#include<stdio.h>
#define M 4
typedef struct{
int A[M][M];
}Pazzle;
Pazzle P;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int heuristic(Pazzle P){
int i,j;
int hx,hy,sum=0;
for(i=0; i<M; i++){
for(j=0; j<M; j++){
if(P.A[i][j] == 0)continue;
hx = (P.A[i][j]-1)%M-j;
hy = (P.A[i][j]-1)/M-i;
if(hx < 0)sum -= hx;
else sum += hx;
if(hy < 0)sum -= hy;
else sum += hy;
}
}
return sum;
}
int dfs(int x,int y,int max,int cnt,int n){
int i,temp;
int x0,y0,ans=-1,h;
h = heuristic(P);
if(h == 0)return cnt;
if(cnt + h > max)return -1;
for(i=0; i<4; i++){
x0 = x + dx[i];
y0 = y + dy[i];
if((i == (n+2)%4 && n != -1) || !(0<=x0 && x0<M && 0<=y0 && y0<M))continue;
temp = P.A[y][x];
P.A[y][x] = P.A[y0][x0];
P.A[y0][x0] = temp;
ans = dfs(x0,y0,max,cnt+1,i);
if(ans != -1)return ans;
temp = P.A[y][x];
P.A[y][x] = P.A[y0][x0];
P.A[y0][x0] = temp;
}
return -1;
}
int main(){
int i,j;
int kx,ky,ans,a;
Pazzle tP;
for(i=0; i<M; i++){
for(j=0; j<M; j++){
scanf("%d",&a);
P.A[i][j] = a;
if(a == 0){
kx = j;
ky = i;
}
}
}
tP = P;
for(i=1; i<46; i++){
P=tP;
ans = dfs(kx,ky,i,0,-1);
if(ans != -1){
printf("%d\n",ans);
break;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164754/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164754/source.c"
target datalayout = "e-m:e-p270: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.Pazzle = type { [4 x [4 x i32]] }
@dx = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 1, i32 0, i32 -1], align 16
@dy = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 0, i32 -1, i32 0], align 16
@P = dso_local local_unnamed_addr global %struct.Pazzle zeroinitializer, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @heuristic(ptr nocapture noundef readonly byval(%struct.Pazzle) align 8 %P) local_unnamed_addr #0 {
entry:
%0 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 0, i64 3
%1 = load <4 x i32>, ptr %0, align 4
%2 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 1, i64 3
%3 = load i32, ptr %2, align 4, !tbaa !5
%4 = insertelement <4 x i32> %1, i32 %3, i64 1
%5 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 2, i64 3
%6 = load i32, ptr %5, align 4, !tbaa !5
%7 = insertelement <4 x i32> %4, i32 %6, i64 2
%8 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 3, i64 3
%9 = load i32, ptr %8, align 4, !tbaa !5
%10 = insertelement <4 x i32> %7, i32 %9, i64 3
%11 = icmp ne <4 x i32> %10, zeroinitializer
%12 = add nsw <4 x i32> %10, <i32 -1, i32 -1, i32 -1, i32 -1>
%.frozen75 = freeze <4 x i32> %12
%13 = sdiv <4 x i32> %.frozen75, <i32 4, i32 4, i32 4, i32 4>
%14 = add nsw <4 x i32> %13, <i32 0, i32 -1, i32 -2, i32 -3>
%15 = icmp slt <4 x i32> %14, zeroinitializer
%16 = xor <4 x i1> %15, <i1 true, i1 true, i1 true, i1 true>
%17 = select <4 x i1> %11, <4 x i1> %16, <4 x i1> zeroinitializer
%18 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 0, i64 2
%19 = load <4 x i32>, ptr %18, align 8
%20 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 1, i64 2
%21 = load i32, ptr %20, align 8, !tbaa !5
%22 = insertelement <4 x i32> %19, i32 %21, i64 1
%23 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 2, i64 2
%24 = load i32, ptr %23, align 8, !tbaa !5
%25 = insertelement <4 x i32> %22, i32 %24, i64 2
%26 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 3, i64 2
%27 = load i32, ptr %26, align 8, !tbaa !5
%28 = insertelement <4 x i32> %25, i32 %27, i64 3
%29 = icmp eq <4 x i32> %28, zeroinitializer
%30 = add nsw <4 x i32> %28, <i32 -1, i32 -1, i32 -1, i32 -1>
%.frozen = freeze <4 x i32> %30
%31 = sdiv <4 x i32> %.frozen, <i32 4, i32 4, i32 4, i32 4>
%32 = add nsw <4 x i32> %31, <i32 0, i32 -1, i32 -2, i32 -3>
%33 = icmp slt <4 x i32> %32, zeroinitializer
%34 = select <4 x i1> %29, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %33
%35 = xor <4 x i1> %29, <i1 true, i1 true, i1 true, i1 true>
%36 = select <4 x i1> %35, <4 x i1> %33, <4 x i1> zeroinitializer
%37 = mul <4 x i32> %31, <i32 4, i32 4, i32 4, i32 4>
%.decomposed = sub <4 x i32> %.frozen, %37
%38 = add nsw <4 x i32> %.decomposed, <i32 -2, i32 -2, i32 -2, i32 -2>
%39 = tail call <4 x i32> @llvm.abs.v4i32(<4 x i32> %38, i1 true)
%40 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 0, i64 1
%41 = load <4 x i32>, ptr %40, align 4
%42 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 1, i64 1
%43 = load i32, ptr %42, align 4, !tbaa !5
%44 = insertelement <4 x i32> %41, i32 %43, i64 1
%45 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 2, i64 1
%46 = load i32, ptr %45, align 4, !tbaa !5
%47 = insertelement <4 x i32> %44, i32 %46, i64 2
%48 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 3, i64 1
%49 = load i32, ptr %48, align 4, !tbaa !5
%50 = insertelement <4 x i32> %47, i32 %49, i64 3
%51 = icmp eq <4 x i32> %50, zeroinitializer
%52 = add nsw <4 x i32> %50, <i32 -1, i32 -1, i32 -1, i32 -1>
%.frozen71 = freeze <4 x i32> %52
%53 = sdiv <4 x i32> %.frozen71, <i32 4, i32 4, i32 4, i32 4>
%54 = add nsw <4 x i32> %53, <i32 0, i32 -1, i32 -2, i32 -3>
%55 = icmp slt <4 x i32> %54, zeroinitializer
%56 = select <4 x i1> %51, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %55
%57 = xor <4 x i1> %51, <i1 true, i1 true, i1 true, i1 true>
%58 = select <4 x i1> %57, <4 x i1> %55, <4 x i1> zeroinitializer
%59 = mul <4 x i32> %53, <i32 4, i32 4, i32 4, i32 4>
%.decomposed72 = sub <4 x i32> %.frozen71, %59
%60 = add nsw <4 x i32> %.decomposed72, <i32 -1, i32 -1, i32 -1, i32 -1>
%61 = tail call <4 x i32> @llvm.abs.v4i32(<4 x i32> %60, i1 true)
%62 = load <4 x i32>, ptr %P, align 8
%63 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 1, i64 0
%64 = load i32, ptr %63, align 8, !tbaa !5
%65 = insertelement <4 x i32> %62, i32 %64, i64 1
%66 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 2, i64 0
%67 = load i32, ptr %66, align 8, !tbaa !5
%68 = insertelement <4 x i32> %65, i32 %67, i64 2
%69 = getelementptr inbounds [4 x [4 x i32]], ptr %P, i64 0, i64 3, i64 0
%70 = load i32, ptr %69, align 8, !tbaa !5
%71 = insertelement <4 x i32> %68, i32 %70, i64 3
%72 = icmp eq <4 x i32> %71, zeroinitializer
%73 = add nsw <4 x i32> %71, <i32 -1, i32 -1, i32 -1, i32 -1>
%.frozen73 = freeze <4 x i32> %73
%74 = sdiv <4 x i32> %.frozen73, <i32 4, i32 4, i32 4, i32 4>
%75 = add nsw <4 x i32> %74, <i32 0, i32 -1, i32 -2, i32 -3>
%76 = icmp slt <4 x i32> %75, zeroinitializer
%77 = select <4 x i1> %72, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %76
%78 = xor <4 x i1> %72, <i1 true, i1 true, i1 true, i1 true>
%79 = select <4 x i1> %78, <4 x i1> %76, <4 x i1> zeroinitializer
%80 = mul <4 x i32> %74, <i32 4, i32 4, i32 4, i32 4>
%.decomposed74 = sub <4 x i32> %.frozen73, %80
%81 = tail call <4 x i32> @llvm.abs.v4i32(<4 x i32> %.decomposed74, i1 true)
%82 = sub nsw <4 x i32> %81, %75
%predphi = select <4 x i1> %79, <4 x i32> %82, <4 x i32> zeroinitializer
%83 = add nsw <4 x i32> %81, %75
%predphi64 = select <4 x i1> %77, <4 x i32> %predphi, <4 x i32> %83
%84 = add <4 x i32> %61, %predphi64
%85 = sub <4 x i32> %84, %54
%predphi65 = select <4 x i1> %58, <4 x i32> %85, <4 x i32> %predphi64
%86 = add <4 x i32> %84, %54
%predphi66 = select <4 x i1> %56, <4 x i32> %predphi65, <4 x i32> %86
%87 = add <4 x i32> %39, %predphi66
%88 = sub <4 x i32> %87, %32
%predphi67 = select <4 x i1> %36, <4 x i32> %88, <4 x i32> %predphi66
%89 = add <4 x i32> %87, %32
%predphi68 = select <4 x i1> %34, <4 x i32> %predphi67, <4 x i32> %89
%90 = mul <4 x i32> %13, <i32 4, i32 4, i32 4, i32 4>
%.decomposed76 = sub <4 x i32> %.frozen75, %90
%91 = sub <4 x i32> %predphi68, %.decomposed76
%92 = add <4 x i32> %91, <i32 3, i32 3, i32 3, i32 3>
%93 = add <4 x i32> %92, %14
%94 = select <4 x i1> %11, <4 x i1> %15, <4 x i1> zeroinitializer
%95 = sub <4 x i32> %92, %14
%predphi69 = select <4 x i1> %94, <4 x i32> %95, <4 x i32> %predphi68
%predphi70 = select <4 x i1> %17, <4 x i32> %93, <4 x i32> %predphi69
%96 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %predphi70)
ret i32 %96
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @dfs(i32 noundef %x, i32 noundef %y, i32 noundef %max, i32 noundef %cnt, i32 noundef %n) local_unnamed_addr #2 {
entry:
%byval-temp.sroa.0 = alloca [28 x i8], align 16
call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %byval-temp.sroa.0)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(28) %byval-temp.sroa.0, ptr noundef nonnull align 4 dereferenceable(28) @P, i64 28, i1 false), !tbaa.struct !9
%byval-temp.sroa.10.0.copyload = load i32, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 1, i64 3), align 4, !tbaa.struct !11
%byval-temp.sroa.11.0.copyload = load i32, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 2, i64 0), align 4, !tbaa.struct !12
%byval-temp.sroa.12.0.copyload = load i32, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 2, i64 1), align 4, !tbaa.struct !13
%byval-temp.sroa.13.0.copyload = load i32, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 2, i64 2), align 4, !tbaa.struct !14
%byval-temp.sroa.14.0.copyload = load i32, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 2, i64 3), align 4, !tbaa.struct !15
%byval-temp.sroa.15.0.copyload = load i32, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 3, i64 0), align 4, !tbaa.struct !16
%byval-temp.sroa.16.0.copyload = load i32, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 3, i64 1), align 4, !tbaa.struct !17
%byval-temp.sroa.17.0.copyload = load i32, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 3, i64 2), align 4, !tbaa.struct !18
%byval-temp.sroa.18.0.copyload = load i32, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 3, i64 3), align 4, !tbaa.struct !19
%byval-temp.sroa.0.12.sroa_idx117 = getelementptr inbounds i8, ptr %byval-temp.sroa.0, i64 12
%byval-temp.sroa.0.12.byval-temp.sroa.0.12. = load <4 x i32>, ptr %byval-temp.sroa.0.12.sroa_idx117, align 4
%0 = insertelement <4 x i32> %byval-temp.sroa.0.12.byval-temp.sroa.0.12., i32 %byval-temp.sroa.10.0.copyload, i64 1
%1 = insertelement <4 x i32> %0, i32 %byval-temp.sroa.14.0.copyload, i64 2
%2 = insertelement <4 x i32> %1, i32 %byval-temp.sroa.18.0.copyload, i64 3
%3 = icmp ne <4 x i32> %2, zeroinitializer
%4 = add nsw <4 x i32> %2, <i32 -1, i32 -1, i32 -1, i32 -1>
%.frozen125 = freeze <4 x i32> %4
%5 = sdiv <4 x i32> %.frozen125, <i32 4, i32 4, i32 4, i32 4>
%6 = add nsw <4 x i32> %5, <i32 0, i32 -1, i32 -2, i32 -3>
%7 = icmp slt <4 x i32> %6, zeroinitializer
%8 = xor <4 x i1> %7, <i1 true, i1 true, i1 true, i1 true>
%9 = select <4 x i1> %3, <4 x i1> %8, <4 x i1> zeroinitializer
%byval-temp.sroa.0.8.sroa_idx116 = getelementptr inbounds i8, ptr %byval-temp.sroa.0, i64 8
%byval-temp.sroa.0.8.byval-temp.sroa.0.8. = load <4 x i32>, ptr %byval-temp.sroa.0.8.sroa_idx116, align 8
%byval-temp.sroa.0.24.sroa_idx120 = getelementptr inbounds i8, ptr %byval-temp.sroa.0, i64 24
%byval-temp.sroa.0.24.byval-temp.sroa.0.24. = load i32, ptr %byval-temp.sroa.0.24.sroa_idx120, align 8, !tbaa !5
%10 = insertelement <4 x i32> %byval-temp.sroa.0.8.byval-temp.sroa.0.8., i32 %byval-temp.sroa.0.24.byval-temp.sroa.0.24., i64 1
%11 = insertelement <4 x i32> %10, i32 %byval-temp.sroa.13.0.copyload, i64 2
%12 = insertelement <4 x i32> %11, i32 %byval-temp.sroa.17.0.copyload, i64 3
%13 = icmp eq <4 x i32> %12, zeroinitializer
%14 = add nsw <4 x i32> %12, <i32 -1, i32 -1, i32 -1, i32 -1>
%.frozen = freeze <4 x i32> %14
%15 = sdiv <4 x i32> %.frozen, <i32 4, i32 4, i32 4, i32 4>
%16 = add nsw <4 x i32> %15, <i32 0, i32 -1, i32 -2, i32 -3>
%17 = icmp slt <4 x i32> %16, zeroinitializer
%18 = select <4 x i1> %13, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %17
%19 = xor <4 x i1> %13, <i1 true, i1 true, i1 true, i1 true>
%20 = select <4 x i1> %19, <4 x i1> %17, <4 x i1> zeroinitializer
%21 = mul <4 x i32> %15, <i32 4, i32 4, i32 4, i32 4>
%.decomposed = sub <4 x i32> %.frozen, %21
%22 = add nsw <4 x i32> %.decomposed, <i32 -2, i32 -2, i32 -2, i32 -2>
%23 = tail call <4 x i32> @llvm.abs.v4i32(<4 x i32> %22, i1 true)
%byval-temp.sroa.0.4.sroa_idx115 = getelementptr inbounds i8, ptr %byval-temp.sroa.0, i64 4
%byval-temp.sroa.0.4.byval-temp.sroa.0.4. = load <4 x i32>, ptr %byval-temp.sroa.0.4.sroa_idx115, align 4
%byval-temp.sroa.0.20.sroa_idx119 = getelementptr inbounds i8, ptr %byval-temp.sroa.0, i64 20
%byval-temp.sroa.0.20.byval-temp.sroa.0.20. = load i32, ptr %byval-temp.sroa.0.20.sroa_idx119, align 4, !tbaa !5
%24 = insertelement <4 x i32> %byval-temp.sroa.0.4.byval-temp.sroa.0.4., i32 %byval-temp.sroa.0.20.byval-temp.sroa.0.20., i64 1
%25 = insertelement <4 x i32> %24, i32 %byval-temp.sroa.12.0.copyload, i64 2
%26 = insertelement <4 x i32> %25, i32 %byval-temp.sroa.16.0.copyload, i64 3
%27 = icmp eq <4 x i32> %26, zeroinitializer
%28 = add nsw <4 x i32> %26, <i32 -1, i32 -1, i32 -1, i32 -1>
%.frozen121 = freeze <4 x i32> %28
%29 = sdiv <4 x i32> %.frozen121, <i32 4, i32 4, i32 4, i32 4>
%30 = add nsw <4 x i32> %29, <i32 0, i32 -1, i32 -2, i32 -3>
%31 = icmp slt <4 x i32> %30, zeroinitializer
%32 = select <4 x i1> %27, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %31
%33 = xor <4 x i1> %27, <i1 true, i1 true, i1 true, i1 true>
%34 = select <4 x i1> %33, <4 x i1> %31, <4 x i1> zeroinitializer
%35 = mul <4 x i32> %29, <i32 4, i32 4, i32 4, i32 4>
%.decomposed122 = sub <4 x i32> %.frozen121, %35
%36 = add nsw <4 x i32> %.decomposed122, <i32 -1, i32 -1, i32 -1, i32 -1>
%37 = tail call <4 x i32> @llvm.abs.v4i32(<4 x i32> %36, i1 true)
%byval-temp.sroa.0.0.byval-temp.sroa.0.0. = load <4 x i32>, ptr %byval-temp.sroa.0, align 16
%byval-temp.sroa.0.16.sroa_idx118 = getelementptr inbounds i8, ptr %byval-temp.sroa.0, i64 16
%byval-temp.sroa.0.16.byval-temp.sroa.0.16. = load i32, ptr %byval-temp.sroa.0.16.sroa_idx118, align 16, !tbaa !5
%38 = insertelement <4 x i32> %byval-temp.sroa.0.0.byval-temp.sroa.0.0., i32 %byval-temp.sroa.0.16.byval-temp.sroa.0.16., i64 1
%39 = insertelement <4 x i32> %38, i32 %byval-temp.sroa.11.0.copyload, i64 2
%40 = insertelement <4 x i32> %39, i32 %byval-temp.sroa.15.0.copyload, i64 3
%41 = icmp eq <4 x i32> %40, zeroinitializer
%42 = add nsw <4 x i32> %40, <i32 -1, i32 -1, i32 -1, i32 -1>
%.frozen123 = freeze <4 x i32> %42
%43 = sdiv <4 x i32> %.frozen123, <i32 4, i32 4, i32 4, i32 4>
%44 = add nsw <4 x i32> %43, <i32 0, i32 -1, i32 -2, i32 -3>
%45 = icmp slt <4 x i32> %44, zeroinitializer
%46 = select <4 x i1> %41, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %45
%47 = xor <4 x i1> %41, <i1 true, i1 true, i1 true, i1 true>
%48 = select <4 x i1> %47, <4 x i1> %45, <4 x i1> zeroinitializer
%49 = mul <4 x i32> %43, <i32 4, i32 4, i32 4, i32 4>
%.decomposed124 = sub <4 x i32> %.frozen123, %49
%50 = tail call <4 x i32> @llvm.abs.v4i32(<4 x i32> %.decomposed124, i1 true)
%51 = sub nsw <4 x i32> %50, %44
%predphi = select <4 x i1> %48, <4 x i32> %51, <4 x i32> zeroinitializer
%52 = add nsw <4 x i32> %50, %44
%predphi108 = select <4 x i1> %46, <4 x i32> %predphi, <4 x i32> %52
%53 = add <4 x i32> %37, %predphi108
%54 = sub <4 x i32> %53, %30
%predphi109 = select <4 x i1> %34, <4 x i32> %54, <4 x i32> %predphi108
%55 = add <4 x i32> %53, %30
%predphi110 = select <4 x i1> %32, <4 x i32> %predphi109, <4 x i32> %55
%56 = add <4 x i32> %23, %predphi110
%57 = sub <4 x i32> %56, %16
%predphi111 = select <4 x i1> %20, <4 x i32> %57, <4 x i32> %predphi110
%58 = add <4 x i32> %56, %16
%predphi112 = select <4 x i1> %18, <4 x i32> %predphi111, <4 x i32> %58
%59 = mul <4 x i32> %5, <i32 4, i32 4, i32 4, i32 4>
%.decomposed126 = sub <4 x i32> %.frozen125, %59
%60 = sub <4 x i32> %predphi112, %.decomposed126
%61 = add <4 x i32> %60, <i32 3, i32 3, i32 3, i32 3>
%62 = add <4 x i32> %61, %6
%63 = select <4 x i1> %3, <4 x i1> %7, <4 x i1> zeroinitializer
%64 = sub <4 x i32> %61, %6
%predphi113 = select <4 x i1> %63, <4 x i32> %64, <4 x i32> %predphi112
%predphi114 = select <4 x i1> %9, <4 x i32> %62, <4 x i32> %predphi113
%65 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %predphi114)
call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %byval-temp.sroa.0)
%cmp = icmp eq i32 %65, 0
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%add = add nsw i32 %65, %cnt
%cmp1 = icmp sgt i32 %add, %max
br i1 %cmp1, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end
%idxprom21 = sext i32 %y to i64
%idxprom23 = sext i32 %x to i64
%arrayidx24 = getelementptr inbounds [4 x [4 x i32]], ptr @P, i64 0, i64 %idxprom21, i64 %idxprom23
%add9 = add nsw i32 %n, 2
%rem = srem i32 %add9, 4
%cmp11 = icmp eq i32 %n, -1
%add37 = add nsw i32 %cnt, 1
%66 = load i32, ptr @dx, align 16, !tbaa !5
%add5 = add nsw i32 %66, %x
%67 = load i32, ptr @dy, align 16, !tbaa !5
%add8 = add nsw i32 %67, %y
%cmp10 = icmp ne i32 %rem, 0
%or.cond.not99 = or i1 %cmp11, %cmp10
%cmp12 = icmp sgt i32 %add5, -1
%or.cond63 = select i1 %or.cond.not99, i1 %cmp12, i1 false
%cmp14 = icmp slt i32 %add5, 4
%or.cond64 = select i1 %or.cond63, i1 %cmp14, i1 false
%cmp16 = icmp sgt i32 %add8, -1
%or.cond65 = select i1 %or.cond64, i1 %cmp16, i1 false
%cmp18 = icmp slt i32 %add8, 4
%or.cond66 = select i1 %or.cond65, i1 %cmp18, i1 false
br i1 %or.cond66, label %if.end20, label %for.inc
if.end20: ; preds = %for.cond.preheader
%68 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %add8 to i64
%idxprom27 = zext i32 %add5 to i64
%arrayidx28 = getelementptr inbounds [4 x [4 x i32]], ptr @P, i64 0, i64 %idxprom25, i64 %idxprom27
%69 = load i32, ptr %arrayidx28, align 4, !tbaa !5
store i32 %69, ptr %arrayidx24, align 4, !tbaa !5
store i32 %68, ptr %arrayidx28, align 4, !tbaa !5
%call38 = tail call i32 @dfs(i32 noundef %add5, i32 noundef %add8, i32 noundef %max, i32 noundef %add37, i32 noundef 0)
%cmp39.not = icmp eq i32 %call38, -1
br i1 %cmp39.not, label %if.end41, label %cleanup
if.end41: ; preds = %if.end20
%70 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%71 = load i32, ptr %arrayidx28, align 4, !tbaa !5
store i32 %71, ptr %arrayidx24, align 4, !tbaa !5
store i32 %70, ptr %arrayidx28, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.cond.preheader, %if.end41
%72 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 1), align 4, !tbaa !5
%add5.1 = add nsw i32 %72, %x
%73 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 1), align 4, !tbaa !5
%add8.1 = add nsw i32 %73, %y
%cmp10.1 = icmp ne i32 %rem, 1
%or.cond.not99.1 = or i1 %cmp11, %cmp10.1
%cmp12.1 = icmp sgt i32 %add5.1, -1
%or.cond63.1 = select i1 %or.cond.not99.1, i1 %cmp12.1, i1 false
%cmp14.1 = icmp slt i32 %add5.1, 4
%or.cond64.1 = select i1 %or.cond63.1, i1 %cmp14.1, i1 false
%cmp16.1 = icmp sgt i32 %add8.1, -1
%or.cond65.1 = select i1 %or.cond64.1, i1 %cmp16.1, i1 false
%cmp18.1 = icmp slt i32 %add8.1, 4
%or.cond66.1 = select i1 %or.cond65.1, i1 %cmp18.1, i1 false
br i1 %or.cond66.1, label %if.end20.1, label %for.inc.1
if.end20.1: ; preds = %for.inc
%74 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25.1 = zext i32 %add8.1 to i64
%idxprom27.1 = zext i32 %add5.1 to i64
%arrayidx28.1 = getelementptr inbounds [4 x [4 x i32]], ptr @P, i64 0, i64 %idxprom25.1, i64 %idxprom27.1
%75 = load i32, ptr %arrayidx28.1, align 4, !tbaa !5
store i32 %75, ptr %arrayidx24, align 4, !tbaa !5
store i32 %74, ptr %arrayidx28.1, align 4, !tbaa !5
%call38.1 = tail call i32 @dfs(i32 noundef %add5.1, i32 noundef %add8.1, i32 noundef %max, i32 noundef %add37, i32 noundef 1)
%cmp39.not.1 = icmp eq i32 %call38.1, -1
br i1 %cmp39.not.1, label %if.end41.1, label %cleanup
if.end41.1: ; preds = %if.end20.1
%76 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%77 = load i32, ptr %arrayidx28.1, align 4, !tbaa !5
store i32 %77, ptr %arrayidx24, align 4, !tbaa !5
store i32 %76, ptr %arrayidx28.1, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.end41.1, %for.inc
%78 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 2), align 8, !tbaa !5
%add5.2 = add nsw i32 %78, %x
%79 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 2), align 8, !tbaa !5
%add8.2 = add nsw i32 %79, %y
%cmp10.2 = icmp ne i32 %rem, 2
%or.cond.not99.2 = or i1 %cmp11, %cmp10.2
%cmp12.2 = icmp sgt i32 %add5.2, -1
%or.cond63.2 = select i1 %or.cond.not99.2, i1 %cmp12.2, i1 false
%cmp14.2 = icmp slt i32 %add5.2, 4
%or.cond64.2 = select i1 %or.cond63.2, i1 %cmp14.2, i1 false
%cmp16.2 = icmp sgt i32 %add8.2, -1
%or.cond65.2 = select i1 %or.cond64.2, i1 %cmp16.2, i1 false
%cmp18.2 = icmp slt i32 %add8.2, 4
%or.cond66.2 = select i1 %or.cond65.2, i1 %cmp18.2, i1 false
br i1 %or.cond66.2, label %if.end20.2, label %for.inc.2
if.end20.2: ; preds = %for.inc.1
%80 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25.2 = zext i32 %add8.2 to i64
%idxprom27.2 = zext i32 %add5.2 to i64
%arrayidx28.2 = getelementptr inbounds [4 x [4 x i32]], ptr @P, i64 0, i64 %idxprom25.2, i64 %idxprom27.2
%81 = load i32, ptr %arrayidx28.2, align 4, !tbaa !5
store i32 %81, ptr %arrayidx24, align 4, !tbaa !5
store i32 %80, ptr %arrayidx28.2, align 4, !tbaa !5
%call38.2 = tail call i32 @dfs(i32 noundef %add5.2, i32 noundef %add8.2, i32 noundef %max, i32 noundef %add37, i32 noundef 2)
%cmp39.not.2 = icmp eq i32 %call38.2, -1
br i1 %cmp39.not.2, label %if.end41.2, label %cleanup
if.end41.2: ; preds = %if.end20.2
%82 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%83 = load i32, ptr %arrayidx28.2, align 4, !tbaa !5
store i32 %83, ptr %arrayidx24, align 4, !tbaa !5
store i32 %82, ptr %arrayidx28.2, align 4, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.end41.2, %for.inc.1
%84 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 3), align 4, !tbaa !5
%add5.3 = add nsw i32 %84, %x
%85 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 3), align 4, !tbaa !5
%add8.3 = add nsw i32 %85, %y
%cmp10.3 = icmp ne i32 %rem, 3
%or.cond.not99.3 = or i1 %cmp11, %cmp10.3
%cmp12.3 = icmp sgt i32 %add5.3, -1
%or.cond63.3 = select i1 %or.cond.not99.3, i1 %cmp12.3, i1 false
%cmp14.3 = icmp slt i32 %add5.3, 4
%or.cond64.3 = select i1 %or.cond63.3, i1 %cmp14.3, i1 false
%cmp16.3 = icmp sgt i32 %add8.3, -1
%or.cond65.3 = select i1 %or.cond64.3, i1 %cmp16.3, i1 false
%cmp18.3 = icmp slt i32 %add8.3, 4
%or.cond66.3 = select i1 %or.cond65.3, i1 %cmp18.3, i1 false
br i1 %or.cond66.3, label %if.end20.3, label %cleanup
if.end20.3: ; preds = %for.inc.2
%86 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25.3 = zext i32 %add8.3 to i64
%idxprom27.3 = zext i32 %add5.3 to i64
%arrayidx28.3 = getelementptr inbounds [4 x [4 x i32]], ptr @P, i64 0, i64 %idxprom25.3, i64 %idxprom27.3
%87 = load i32, ptr %arrayidx28.3, align 4, !tbaa !5
store i32 %87, ptr %arrayidx24, align 4, !tbaa !5
store i32 %86, ptr %arrayidx28.3, align 4, !tbaa !5
%call38.3 = tail call i32 @dfs(i32 noundef %add5.3, i32 noundef %add8.3, i32 noundef %max, i32 noundef %add37, i32 noundef 3)
%cmp39.not.3 = icmp eq i32 %call38.3, -1
br i1 %cmp39.not.3, label %if.end41.3, label %cleanup
if.end41.3: ; preds = %if.end20.3
%88 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%89 = load i32, ptr %arrayidx28.3, align 4, !tbaa !5
store i32 %89, ptr %arrayidx24, align 4, !tbaa !5
store i32 %88, ptr %arrayidx28.3, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %if.end20, %if.end20.1, %if.end20.2, %if.end20.3, %if.end41.3, %for.inc.2, %if.end, %entry
%retval.0 = phi i32 [ %cnt, %entry ], [ -1, %if.end ], [ %call38, %if.end20 ], [ %call38.1, %if.end20.1 ], [ %call38.2, %if.end20.2 ], [ %call38.3, %if.end20.3 ], [ -1, %if.end41.3 ], [ -1, %for.inc.2 ]
ret i32 %retval.0
}
; 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) #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%a = alloca i32, align 4
%tP.sroa.0 = alloca [4 x [4 x i32]], align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #7
call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %tP.sroa.0)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
store i32 %0, ptr @P, align 4, !tbaa !5
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
store i32 %1, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 0, i64 1), align 4, !tbaa !5
%cmp6.1 = icmp eq i32 %1, 0
%spec.select.1 = zext i1 %cmp6.1 to i32
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%2 = load i32, ptr %a, align 4, !tbaa !5
store i32 %2, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 0, i64 2), align 4, !tbaa !5
%cmp6.2 = icmp eq i32 %2, 0
%spec.select.2 = select i1 %cmp6.2, i32 2, i32 %spec.select.1
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%3 = load i32, ptr %a, align 4, !tbaa !5
store i32 %3, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 0, i64 3), align 4, !tbaa !5
%cmp6.3 = icmp eq i32 %3, 0
%spec.select.3 = select i1 %cmp6.3, i32 3, i32 %spec.select.2
%call.142 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%4 = load i32, ptr %a, align 4, !tbaa !5
store i32 %4, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 1, i64 0), align 4, !tbaa !5
%cmp6.144 = icmp eq i32 %4, 0
%spec.select.145 = select i1 %cmp6.144, i32 0, i32 %spec.select.3
%call.1.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%5 = load i32, ptr %a, align 4, !tbaa !5
store i32 %5, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 1, i64 1), align 4, !tbaa !5
%cmp6.1.1 = icmp eq i32 %5, 0
%spec.select.1.1 = select i1 %cmp6.1.1, i32 1, i32 %spec.select.145
%call.2.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%6 = load i32, ptr %a, align 4, !tbaa !5
store i32 %6, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 1, i64 2), align 4, !tbaa !5
%cmp6.2.1 = icmp eq i32 %6, 0
%spec.select.2.1 = select i1 %cmp6.2.1, i32 2, i32 %spec.select.1.1
%call.3.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%7 = load i32, ptr %a, align 4, !tbaa !5
store i32 %7, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 1, i64 3), align 4, !tbaa !5
%cmp6.3.1 = icmp eq i32 %7, 0
%spec.select.3.1 = select i1 %cmp6.3.1, i32 3, i32 %spec.select.2.1
%8 = select i1 %cmp6.3.1, i1 true, i1 %cmp6.2.1
%9 = select i1 %8, i1 true, i1 %cmp6.1.1
%narrow = select i1 %9, i1 true, i1 %cmp6.144
%spec.select31.3.1 = zext i1 %narrow to i32
%call.247 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%10 = load i32, ptr %a, align 4, !tbaa !5
store i32 %10, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 2, i64 0), align 4, !tbaa !5
%cmp6.249 = icmp eq i32 %10, 0
%spec.select.250 = select i1 %cmp6.249, i32 0, i32 %spec.select.3.1
%call.1.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%11 = load i32, ptr %a, align 4, !tbaa !5
store i32 %11, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 2, i64 1), align 4, !tbaa !5
%cmp6.1.2 = icmp eq i32 %11, 0
%spec.select.1.2 = select i1 %cmp6.1.2, i32 1, i32 %spec.select.250
%call.2.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%12 = load i32, ptr %a, align 4, !tbaa !5
store i32 %12, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 2, i64 2), align 4, !tbaa !5
%cmp6.2.2 = icmp eq i32 %12, 0
%spec.select.2.2 = select i1 %cmp6.2.2, i32 2, i32 %spec.select.1.2
%call.3.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%13 = load i32, ptr %a, align 4, !tbaa !5
store i32 %13, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 2, i64 3), align 4, !tbaa !5
%cmp6.3.2 = icmp eq i32 %13, 0
%spec.select.3.2 = select i1 %cmp6.3.2, i32 3, i32 %spec.select.2.2
%14 = select i1 %cmp6.3.2, i1 true, i1 %cmp6.2.2
%15 = select i1 %14, i1 true, i1 %cmp6.1.2
%16 = select i1 %15, i1 true, i1 %cmp6.249
%spec.select31.3.2 = select i1 %16, i32 2, i32 %spec.select31.3.1
%call.352 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%17 = load i32, ptr %a, align 4, !tbaa !5
store i32 %17, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 3, i64 0), align 4, !tbaa !5
%cmp6.354 = icmp eq i32 %17, 0
%spec.select.355 = select i1 %cmp6.354, i32 0, i32 %spec.select.3.2
%call.1.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%18 = load i32, ptr %a, align 4, !tbaa !5
store i32 %18, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 3, i64 1), align 4, !tbaa !5
%cmp6.1.3 = icmp eq i32 %18, 0
%spec.select.1.3 = select i1 %cmp6.1.3, i32 1, i32 %spec.select.355
%call.2.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%19 = load i32, ptr %a, align 4, !tbaa !5
store i32 %19, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 3, i64 2), align 4, !tbaa !5
%cmp6.2.3 = icmp eq i32 %19, 0
%spec.select.2.3 = select i1 %cmp6.2.3, i32 2, i32 %spec.select.1.3
%call.3.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%20 = load i32, ptr %a, align 4, !tbaa !5
store i32 %20, ptr getelementptr inbounds (%struct.Pazzle, ptr @P, i64 0, i32 0, i64 3, i64 3), align 4, !tbaa !5
%cmp6.3.3 = icmp eq i32 %20, 0
%spec.select.3.3 = select i1 %cmp6.3.3, i32 3, i32 %spec.select.2.3
%21 = select i1 %cmp6.3.3, i1 true, i1 %cmp6.2.3
%22 = select i1 %21, i1 true, i1 %cmp6.1.3
%23 = select i1 %22, i1 true, i1 %cmp6.354
%spec.select31.3.3 = select i1 %23, i32 3, i32 %spec.select31.3.2
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(64) %tP.sroa.0, ptr noundef nonnull align 4 dereferenceable(64) @P, i64 64, i1 false), !tbaa.struct !9
br label %for.body12
for.cond10: ; preds = %for.body12
%inc19 = add nuw nsw i32 %i.138, 1
%exitcond.not = icmp eq i32 %inc19, 46
br i1 %exitcond.not, label %for.end20, label %for.body12, !llvm.loop !20
for.body12: ; preds = %entry, %for.cond10
%i.138 = phi i32 [ 1, %entry ], [ %inc19, %for.cond10 ]
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(64) @P, ptr noundef nonnull align 4 dereferenceable(64) %tP.sroa.0, i64 64, i1 false), !tbaa.struct !9
%call13 = call i32 @dfs(i32 noundef %spec.select.3.3, i32 noundef %spec.select31.3.3, i32 noundef %i.138, i32 noundef 0, i32 noundef -1)
%cmp14.not = icmp eq i32 %call13, -1
br i1 %cmp14.not, label %for.cond10, label %if.then15
if.then15: ; preds = %for.body12
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call13)
br label %for.end20
for.end20: ; preds = %for.cond10, %if.then15
call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %tP.sroa.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6
attributes #0 = { nofree nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree 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 = !{i64 0, i64 64, !10}
!10 = !{!7, !7, i64 0}
!11 = !{i64 0, i64 36, !10}
!12 = !{i64 0, i64 32, !10}
!13 = !{i64 0, i64 28, !10}
!14 = !{i64 0, i64 24, !10}
!15 = !{i64 0, i64 20, !10}
!16 = !{i64 0, i64 16, !10}
!17 = !{i64 0, i64 12, !10}
!18 = !{i64 0, i64 8, !10}
!19 = !{i64 0, i64 4, !10}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MN 205
#define INF 1<<25
#define init(a) memset(a,0x0f,sizeof(a))
#define min(a,b) (a<b?a:b)
int N,M,R,de[1005],S[MN][MN],L[MN][MN],i,j,k,x,y,s;
int dp[1005][205];
int main()
{
for(;scanf("%d%d",&N,&M),N;)
{
init(S);init(L);init(dp);
for(i=0;i<N;i++)L[i][i]=S[i][i]=0;
for(i=0;i<M;i++)
{
char t;
scanf("%d%d%d %c",&x,&y,&s,&t);
x--;y--;
if(t=='L')L[x][y]=L[y][x]=s;
else S[x][y]=S[y][x]=s;
}
for(scanf("%d",&R),i=0;i<R;de[i++]--)scanf("%d",&de[i]);
for(k=0;k<N;k++)
for(i=0;i<N;i++)
for(j=0;j<N;j++)
{
S[i][j]=min(S[i][j],S[i][k]+S[k][j]);
L[i][j]=min(L[i][j],L[i][k]+L[k][j]);
}
dp[0][de[0]]=0;
for(k=0;k<R-1;k++)
for(i=0;i<N;i++)
for(j=0;j<N;j++)
{
dp[k+1][i] = min(dp[k+1][i],dp[k][j]+L[de[k]][j]+S[j][i]+L[i][de[k+1]]);
if(i == j) dp[k+1][i] = min(dp[k+1][i], dp[k][j] + L[de[k]][de[k+1]]);
}
for(i=0,s=INF;i<N;i++)s=min(s,dp[R-1][i]);
printf("%d\n",s);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164798/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164798/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@N = dso_local global i32 0, align 4
@M = dso_local global i32 0, align 4
@S = dso_local local_unnamed_addr global [205 x [205 x i32]] zeroinitializer, align 16
@L = dso_local local_unnamed_addr global [205 x [205 x i32]] zeroinitializer, align 16
@dp = dso_local local_unnamed_addr global [1005 x [205 x i32]] zeroinitializer, align 16
@i = dso_local local_unnamed_addr global i32 0, align 4
@.str.1 = private unnamed_addr constant [10 x i8] c"%d%d%d %c\00", align 1
@x = dso_local global i32 0, align 4
@y = dso_local global i32 0, align 4
@s = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@R = dso_local global i32 0, align 4
@de = dso_local global [1005 x i32] zeroinitializer, align 16
@k = dso_local local_unnamed_addr global i32 0, align 4
@j = dso_local local_unnamed_addr global i32 0, align 4
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i8, align 1
%call367 = tail 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
%tobool.not368 = icmp eq i32 %0, 0
br i1 %tobool.not368, label %for.end306, label %for.body
for.body: ; preds = %entry, %for.end304
%1 = phi i32 [ %60, %for.end304 ], [ %0, %entry ]
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(168100) @S, i8 15, i64 168100, i1 false)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(168100) @L, i8 15, i64 168100, i1 false)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(824100) @dp, i8 15, i64 824100, i1 false)
%cmp327 = icmp sgt i32 %1, 0
br i1 %cmp327, label %for.body2.preheader, label %for.cond9.preheader
for.body2.preheader: ; preds = %for.body
%wide.trip.count = zext i32 %1 to i64
%xtraiter = and i64 %wide.trip.count, 1
%2 = icmp eq i32 %1, 1
br i1 %2, label %for.cond9.preheader.loopexit.unr-lcssa, label %for.body2.preheader.new
for.body2.preheader.new: ; preds = %for.body2.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body2
for.cond9.preheader.loopexit.unr-lcssa: ; preds = %for.body2, %for.body2.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body2.preheader ], [ %indvars.iv.next.1, %for.body2 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.body2.epil
for.body2.epil: ; preds = %for.cond9.preheader.loopexit.unr-lcssa
%arrayidx4.epil = getelementptr inbounds [205 x [205 x i32]], ptr @S, i64 0, i64 %indvars.iv.unr, i64 %indvars.iv.unr
store i32 0, ptr %arrayidx4.epil, align 4, !tbaa !5
%arrayidx8.epil = getelementptr inbounds [205 x [205 x i32]], ptr @L, i64 0, i64 %indvars.iv.unr, i64 %indvars.iv.unr
store i32 0, ptr %arrayidx8.epil, align 4, !tbaa !5
br label %for.cond9.preheader
for.cond9.preheader: ; preds = %for.body2.epil, %for.cond9.preheader.loopexit.unr-lcssa, %for.body
store i32 0, ptr @i, align 4, !tbaa !5
%3 = load i32, ptr @M, align 4, !tbaa !5
%cmp10329 = icmp sgt i32 %3, 0
br i1 %cmp10329, label %for.body11, label %for.end34
for.body2: ; preds = %for.body2, %for.body2.preheader.new
%indvars.iv = phi i64 [ 0, %for.body2.preheader.new ], [ %indvars.iv.next.1, %for.body2 ]
%niter = phi i64 [ 0, %for.body2.preheader.new ], [ %niter.next.1, %for.body2 ]
%arrayidx4 = getelementptr inbounds [205 x [205 x i32]], ptr @S, i64 0, i64 %indvars.iv, i64 %indvars.iv
store i32 0, ptr %arrayidx4, align 8, !tbaa !5
%arrayidx8 = getelementptr inbounds [205 x [205 x i32]], ptr @L, i64 0, i64 %indvars.iv, i64 %indvars.iv
store i32 0, ptr %arrayidx8, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx4.1 = getelementptr inbounds [205 x [205 x i32]], ptr @S, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next
store i32 0, ptr %arrayidx4.1, align 8, !tbaa !5
%arrayidx8.1 = getelementptr inbounds [205 x [205 x i32]], ptr @L, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next
store i32 0, ptr %arrayidx8.1, align 8, !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.cond9.preheader.loopexit.unr-lcssa, label %for.body2, !llvm.loop !9
for.body11: ; preds = %for.cond9.preheader, %for.body11
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %t) #5
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @x, ptr noundef nonnull @y, ptr noundef nonnull @s, ptr noundef nonnull %t)
%4 = load i32, ptr @x, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr @x, align 4, !tbaa !5
%5 = load i32, ptr @y, align 4, !tbaa !5
%dec13 = add nsw i32 %5, -1
store i32 %dec13, ptr @y, align 4, !tbaa !5
%6 = load i8, ptr %t, align 1, !tbaa !11
%cmp14 = icmp eq i8 %6, 76
%7 = load i32, ptr @s, align 4, !tbaa !5
%idxprom16 = sext i32 %dec13 to i64
%idxprom18 = sext i32 %dec to i64
%L.S = select i1 %cmp14, ptr @L, ptr @S
%arrayidx27 = getelementptr inbounds [205 x [205 x i32]], ptr %L.S, i64 0, i64 %idxprom16, i64 %idxprom18
store i32 %7, ptr %arrayidx27, align 4, !tbaa !5
%arrayidx31 = getelementptr inbounds [205 x [205 x i32]], ptr %L.S, i64 0, i64 %idxprom18, i64 %idxprom16
store i32 %7, ptr %arrayidx31, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %t) #5
%8 = load i32, ptr @i, align 4, !tbaa !5
%inc33 = add nsw i32 %8, 1
store i32 %inc33, ptr @i, align 4, !tbaa !5
%9 = load i32, ptr @M, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc33, %9
br i1 %cmp10, label %for.body11, label %for.end34, !llvm.loop !12
for.end34: ; preds = %for.body11, %for.cond9.preheader
%call35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @R)
store i32 0, ptr @i, align 4, !tbaa !5
%10 = load i32, ptr @R, align 4, !tbaa !5
%cmp37330 = icmp sgt i32 %10, 0
br i1 %cmp37330, label %for.body39, label %for.cond49.preheader
for.cond49.preheader: ; preds = %for.body39, %for.end34
%.lcssa = phi i32 [ %10, %for.end34 ], [ %41, %for.body39 ]
%11 = load i32, ptr @N, align 4, !tbaa !5
%cmp50339 = icmp slt i32 %11, 1
br i1 %cmp50339, label %for.end136.thread, label %for.cond53.preheader.us.preheader
for.cond53.preheader.us.preheader: ; preds = %for.cond49.preheader
%wide.trip.count384 = zext i32 %11 to i64
%12 = shl nuw nsw i64 %wide.trip.count384, 2
%min.iters.check447 = icmp ult i32 %11, 12
%n.vec450 = and i64 %wide.trip.count384, 4294967292
%cmp.n452 = icmp eq i64 %n.vec450, %wide.trip.count384
br label %for.cond53.preheader.us
for.cond53.preheader.us: ; preds = %for.cond53.preheader.us.preheader, %for.cond53.for.inc134_crit_edge.split.us.us
%indvars.iv381 = phi i64 [ 0, %for.cond53.preheader.us.preheader ], [ %indvars.iv.next382, %for.cond53.for.inc134_crit_edge.split.us.us ]
%13 = shl nuw nsw i64 %indvars.iv381, 2
%14 = add nuw i64 %13, 4
%15 = mul nuw nsw i64 %indvars.iv381, 820
%scevgep426 = getelementptr i8, ptr @S, i64 %15
%16 = add nuw i64 %12, %15
%scevgep427 = getelementptr i8, ptr @S, i64 %16
%scevgep432 = getelementptr i8, ptr @L, i64 %15
%scevgep433 = getelementptr i8, ptr @L, i64 %16
br label %for.cond57.preheader.us.us
for.cond57.preheader.us.us: ; preds = %for.cond57.for.inc131_crit_edge.us.us, %for.cond53.preheader.us
%indvars.iv376 = phi i64 [ %indvars.iv.next377, %for.cond57.for.inc131_crit_edge.us.us ], [ 0, %for.cond53.preheader.us ]
%arrayidx68.us.us = getelementptr inbounds [205 x [205 x i32]], ptr @S, i64 0, i64 %indvars.iv376, i64 %indvars.iv381
%arrayidx99.us.us = getelementptr inbounds [205 x [205 x i32]], ptr @L, i64 0, i64 %indvars.iv376, i64 %indvars.iv381
br i1 %min.iters.check447, label %for.body60.us.us.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.cond57.preheader.us.us
%17 = mul nuw nsw i64 %indvars.iv376, 820
%18 = add i64 %14, %17
%scevgep431 = getelementptr i8, ptr @L, i64 %18
%19 = add nuw i64 %13, %17
%scevgep430 = getelementptr i8, ptr @L, i64 %19
%20 = add nuw i64 %12, %17
%scevgep429 = getelementptr i8, ptr @L, i64 %20
%scevgep428 = getelementptr i8, ptr @L, i64 %17
%scevgep425 = getelementptr i8, ptr @S, i64 %18
%scevgep424 = getelementptr i8, ptr @S, i64 %19
%scevgep423 = getelementptr i8, ptr @S, i64 %20
%scevgep = getelementptr i8, ptr @S, i64 %17
%bound0 = icmp ult ptr %scevgep, %scevgep425
%bound1 = icmp ult ptr %scevgep424, %scevgep423
%found.conflict = and i1 %bound0, %bound1
%bound0434 = icmp ult ptr %scevgep, %scevgep427
%bound1435 = icmp ult ptr %scevgep426, %scevgep423
%found.conflict436 = and i1 %bound0434, %bound1435
%conflict.rdx = or i1 %found.conflict, %found.conflict436
%bound0437 = icmp ult ptr %scevgep428, %scevgep431
%bound1438 = icmp ult ptr %scevgep430, %scevgep429
%found.conflict439 = and i1 %bound0437, %bound1438
%conflict.rdx440 = or i1 %conflict.rdx, %found.conflict439
%bound0441 = icmp ult ptr %scevgep428, %scevgep433
%bound1442 = icmp ult ptr %scevgep432, %scevgep429
%found.conflict443 = and i1 %bound0441, %bound1442
%conflict.rdx444 = or i1 %conflict.rdx440, %found.conflict443
br i1 %conflict.rdx444, label %for.body60.us.us.preheader, label %vector.ph448
vector.ph448: ; preds = %vector.memcheck
%21 = load i32, ptr %arrayidx68.us.us, align 4, !tbaa !5, !alias.scope !13
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %21, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%22 = load i32, ptr %arrayidx99.us.us, align 4, !tbaa !5, !alias.scope !16
%broadcast.splatinsert459 = insertelement <4 x i32> poison, i32 %22, i64 0
%broadcast.splat460 = shufflevector <4 x i32> %broadcast.splatinsert459, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body453
vector.body453: ; preds = %vector.body453, %vector.ph448
%index454 = phi i64 [ 0, %vector.ph448 ], [ %index.next461, %vector.body453 ]
%23 = getelementptr inbounds [205 x [205 x i32]], ptr @S, i64 0, i64 %indvars.iv376, i64 %index454
%wide.load455 = load <4 x i32>, ptr %23, align 4, !tbaa !5, !alias.scope !18, !noalias !20
%24 = getelementptr inbounds [205 x [205 x i32]], ptr @S, i64 0, i64 %indvars.iv381, i64 %index454
%wide.load456 = load <4 x i32>, ptr %24, align 4, !tbaa !5, !alias.scope !22
%25 = add nsw <4 x i32> %wide.load456, %broadcast.splat
%26 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load455, <4 x i32> %25)
store <4 x i32> %26, ptr %23, align 4, !tbaa !5, !alias.scope !18, !noalias !20
%27 = getelementptr inbounds [205 x [205 x i32]], ptr @L, i64 0, i64 %indvars.iv376, i64 %index454
%wide.load457 = load <4 x i32>, ptr %27, align 4, !tbaa !5, !alias.scope !23, !noalias !25
%28 = getelementptr inbounds [205 x [205 x i32]], ptr @L, i64 0, i64 %indvars.iv381, i64 %index454
%wide.load458 = load <4 x i32>, ptr %28, align 4, !tbaa !5, !alias.scope !27
%29 = add nsw <4 x i32> %wide.load458, %broadcast.splat460
%30 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load457, <4 x i32> %29)
store <4 x i32> %30, ptr %27, align 4, !tbaa !5, !alias.scope !23, !noalias !25
%index.next461 = add nuw i64 %index454, 4
%31 = icmp eq i64 %index.next461, %n.vec450
br i1 %31, label %middle.block445, label %vector.body453, !llvm.loop !28
middle.block445: ; preds = %vector.body453
br i1 %cmp.n452, label %for.cond57.for.inc131_crit_edge.us.us, label %for.body60.us.us.preheader
for.body60.us.us.preheader: ; preds = %vector.memcheck, %for.cond57.preheader.us.us, %middle.block445
%indvars.iv371.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.cond57.preheader.us.us ], [ %n.vec450, %middle.block445 ]
br label %for.body60.us.us
for.body60.us.us: ; preds = %for.body60.us.us.preheader, %for.body60.us.us
%indvars.iv371 = phi i64 [ %indvars.iv.next372, %for.body60.us.us ], [ %indvars.iv371.ph, %for.body60.us.us.preheader ]
%arrayidx64.us.us = getelementptr inbounds [205 x [205 x i32]], ptr @S, i64 0, i64 %indvars.iv376, i64 %indvars.iv371
%32 = load i32, ptr %arrayidx64.us.us, align 4, !tbaa !5
%33 = load i32, ptr %arrayidx68.us.us, align 4, !tbaa !5
%arrayidx72.us.us = getelementptr inbounds [205 x [205 x i32]], ptr @S, i64 0, i64 %indvars.iv381, i64 %indvars.iv371
%34 = load i32, ptr %arrayidx72.us.us, align 4, !tbaa !5
%add.us.us = add nsw i32 %34, %33
%.add.us.us = call i32 @llvm.smin.i32(i32 %32, i32 %add.us.us)
store i32 %.add.us.us, ptr %arrayidx64.us.us, align 4, !tbaa !5
%arrayidx95.us.us = getelementptr inbounds [205 x [205 x i32]], ptr @L, i64 0, i64 %indvars.iv376, i64 %indvars.iv371
%35 = load i32, ptr %arrayidx95.us.us, align 4, !tbaa !5
%36 = load i32, ptr %arrayidx99.us.us, align 4, !tbaa !5
%arrayidx103.us.us = getelementptr inbounds [205 x [205 x i32]], ptr @L, i64 0, i64 %indvars.iv381, i64 %indvars.iv371
%37 = load i32, ptr %arrayidx103.us.us, align 4, !tbaa !5
%add104.us.us = add nsw i32 %37, %36
%cond123.us.us = call i32 @llvm.smin.i32(i32 %35, i32 %add104.us.us)
store i32 %cond123.us.us, ptr %arrayidx95.us.us, align 4, !tbaa !5
%indvars.iv.next372 = add nuw nsw i64 %indvars.iv371, 1
%exitcond375.not = icmp eq i64 %indvars.iv.next372, %wide.trip.count384
br i1 %exitcond375.not, label %for.cond57.for.inc131_crit_edge.us.us, label %for.body60.us.us, !llvm.loop !31
for.cond57.for.inc131_crit_edge.us.us: ; preds = %for.body60.us.us, %middle.block445
%indvars.iv.next377 = add nuw nsw i64 %indvars.iv376, 1
%exitcond380.not = icmp eq i64 %indvars.iv.next377, %wide.trip.count384
br i1 %exitcond380.not, label %for.cond53.for.inc134_crit_edge.split.us.us, label %for.cond57.preheader.us.us, !llvm.loop !32
for.cond53.for.inc134_crit_edge.split.us.us: ; preds = %for.cond57.for.inc131_crit_edge.us.us
%indvars.iv.next382 = add nuw nsw i64 %indvars.iv381, 1
%exitcond385.not = icmp eq i64 %indvars.iv.next382, %wide.trip.count384
br i1 %exitcond385.not, label %for.end136, label %for.cond53.preheader.us, !llvm.loop !33
for.body39: ; preds = %for.end34, %for.body39
%38 = phi i32 [ %inc44, %for.body39 ], [ 0, %for.end34 ]
%idxprom40 = sext i32 %38 to i64
%arrayidx41 = getelementptr inbounds [1005 x i32], ptr @de, i64 0, i64 %idxprom40
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx41)
%39 = load i32, ptr @i, align 4, !tbaa !5
%inc44 = add nsw i32 %39, 1
store i32 %inc44, ptr @i, align 4, !tbaa !5
%idxprom45 = sext i32 %39 to i64
%arrayidx46 = getelementptr inbounds [1005 x i32], ptr @de, i64 0, i64 %idxprom45
%40 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%dec47 = add nsw i32 %40, -1
store i32 %dec47, ptr %arrayidx46, align 4, !tbaa !5
%41 = load i32, ptr @R, align 4, !tbaa !5
%cmp37 = icmp slt i32 %inc44, %41
br i1 %cmp37, label %for.body39, label %for.cond49.preheader, !llvm.loop !34
for.end136: ; preds = %for.cond53.for.inc134_crit_edge.split.us.us
store i32 %11, ptr @j, align 4, !tbaa !5
%42 = load i32, ptr @de, align 16, !tbaa !5
%idxprom137 = sext i32 %42 to i64
%arrayidx138 = getelementptr inbounds [205 x i32], ptr @dp, i64 0, i64 %idxprom137
store i32 0, ptr %arrayidx138, align 4, !tbaa !5
%sub = add i32 %.lcssa, -1
%cmp140355 = icmp slt i32 %.lcssa, 2
%brmerge = or i1 %cmp140355, %cmp50339
%.mux = select i1 %cmp140355, i32 0, i32 %sub
br i1 %brmerge, label %for.end281, label %for.cond143.preheader.us.preheader
for.end136.thread: ; preds = %for.cond49.preheader
%43 = load i32, ptr @de, align 16, !tbaa !5
%idxprom137407 = sext i32 %43 to i64
%arrayidx138408 = getelementptr inbounds [205 x i32], ptr @dp, i64 0, i64 %idxprom137407
store i32 0, ptr %arrayidx138408, align 4, !tbaa !5
%sub409 = add i32 %.lcssa, -1
%cmp140355410 = icmp sgt i32 %.lcssa, 1
br i1 %cmp140355410, label %for.end281, label %for.end281.thread
for.end281.thread: ; preds = %for.end136.thread
store i32 0, ptr @k, align 4, !tbaa !5
store i32 0, ptr @i, align 4, !tbaa !5
store i32 33554432, ptr @s, align 4, !tbaa !5
br label %for.end304
for.cond143.preheader.us.preheader: ; preds = %for.end136
%wide.trip.count399 = zext i32 %sub to i64
%wide.trip.count394 = zext i32 %11 to i64
br label %for.cond143.preheader.us
for.cond143.preheader.us: ; preds = %for.cond143.preheader.us.preheader, %for.cond143.for.inc279_crit_edge.split.us.us
%44 = phi i32 [ %42, %for.cond143.preheader.us.preheader ], [ %45, %for.cond143.for.inc279_crit_edge.split.us.us ]
%indvars.iv396 = phi i64 [ 0, %for.cond143.preheader.us.preheader ], [ %indvars.iv.next397, %for.cond143.for.inc279_crit_edge.split.us.us ]
%indvars.iv.next397 = add nuw nsw i64 %indvars.iv396, 1
%arrayidx176.us = getelementptr inbounds [1005 x i32], ptr @de, i64 0, i64 %indvars.iv.next397
%idxprom162.us.us = sext i32 %44 to i64
%45 = load i32, ptr %arrayidx176.us, align 4, !tbaa !5
%idxprom177.us.us = sext i32 %45 to i64
%arrayidx240.us.us = getelementptr inbounds [205 x [205 x i32]], ptr @L, i64 0, i64 %idxprom162.us.us, i64 %idxprom177.us.us
br label %for.cond147.preheader.us.us
for.cond147.preheader.us.us: ; preds = %for.cond147.for.inc276_crit_edge.us.us, %for.cond143.preheader.us
%indvars.iv391 = phi i64 [ %indvars.iv.next392, %for.cond147.for.inc276_crit_edge.us.us ], [ 0, %for.cond143.preheader.us ]
%arrayidx155.us.us = getelementptr inbounds [1005 x [205 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next397, i64 %indvars.iv391
%arrayidx178.us.us = getelementptr inbounds [205 x [205 x i32]], ptr @L, i64 0, i64 %indvars.iv391, i64 %idxprom177.us.us
%46 = load i32, ptr %arrayidx178.us.us, align 4, !tbaa !5
%arrayidx155.promoted.us.us = load i32, ptr %arrayidx155.us.us, align 4, !tbaa !5
br label %for.body150.us.us
for.body150.us.us: ; preds = %for.inc273.us.us, %for.cond147.preheader.us.us
%indvars.iv386 = phi i64 [ %indvars.iv.next387, %for.inc273.us.us ], [ 0, %for.cond147.preheader.us.us ]
%.add241349.us.us = phi i32 [ %.add241348.us.us, %for.inc273.us.us ], [ %arrayidx155.promoted.us.us, %for.cond147.preheader.us.us ]
%arrayidx159.us.us = getelementptr inbounds [1005 x [205 x i32]], ptr @dp, i64 0, i64 %indvars.iv396, i64 %indvars.iv386
%47 = load i32, ptr %arrayidx159.us.us, align 4, !tbaa !5
%arrayidx165.us.us = getelementptr inbounds [205 x [205 x i32]], ptr @L, i64 0, i64 %idxprom162.us.us, i64 %indvars.iv386
%48 = load i32, ptr %arrayidx165.us.us, align 4, !tbaa !5
%add166.us.us = add nsw i32 %48, %47
%arrayidx170.us.us = getelementptr inbounds [205 x [205 x i32]], ptr @S, i64 0, i64 %indvars.iv386, i64 %indvars.iv391
%49 = load i32, ptr %arrayidx170.us.us, align 4, !tbaa !5
%add171.us.us = add nsw i32 %add166.us.us, %49
%add179.us.us = add nsw i32 %add171.us.us, %46
%.add179.us.us = call i32 @llvm.smin.i32(i32 %.add241349.us.us, i32 %add179.us.us)
store i32 %.add179.us.us, ptr %arrayidx155.us.us, align 4, !tbaa !5
%cmp220.us.us = icmp eq i64 %indvars.iv391, %indvars.iv386
br i1 %cmp220.us.us, label %if.then222.us.us, label %for.inc273.us.us
if.then222.us.us: ; preds = %for.body150.us.us
%50 = load i32, ptr %arrayidx159.us.us, align 4, !tbaa !5
%51 = load i32, ptr %arrayidx240.us.us, align 4, !tbaa !5
%add241.us.us = add nsw i32 %51, %50
%.add241.us.us = call i32 @llvm.smin.i32(i32 %.add179.us.us, i32 %add241.us.us)
store i32 %.add241.us.us, ptr %arrayidx155.us.us, align 4, !tbaa !5
br label %for.inc273.us.us
for.inc273.us.us: ; preds = %if.then222.us.us, %for.body150.us.us
%.add241348.us.us = phi i32 [ %.add179.us.us, %for.body150.us.us ], [ %.add241.us.us, %if.then222.us.us ]
%indvars.iv.next387 = add nuw nsw i64 %indvars.iv386, 1
%exitcond390.not = icmp eq i64 %indvars.iv.next387, %wide.trip.count394
br i1 %exitcond390.not, label %for.cond147.for.inc276_crit_edge.us.us, label %for.body150.us.us, !llvm.loop !35
for.cond147.for.inc276_crit_edge.us.us: ; preds = %for.inc273.us.us
%indvars.iv.next392 = add nuw nsw i64 %indvars.iv391, 1
%exitcond395.not = icmp eq i64 %indvars.iv.next392, %wide.trip.count394
br i1 %exitcond395.not, label %for.cond143.for.inc279_crit_edge.split.us.us, label %for.cond147.preheader.us.us, !llvm.loop !36
for.cond143.for.inc279_crit_edge.split.us.us: ; preds = %for.cond147.for.inc276_crit_edge.us.us
%exitcond400.not = icmp eq i64 %indvars.iv.next397, %wide.trip.count399
br i1 %exitcond400.not, label %for.cond139.for.end281_crit_edge.split.us, label %for.cond143.preheader.us, !llvm.loop !37
for.cond139.for.end281_crit_edge.split.us: ; preds = %for.cond143.for.inc279_crit_edge.split.us.us
store i32 %11, ptr @j, align 4, !tbaa !5
br label %for.end281
for.end281: ; preds = %for.end136, %for.cond139.for.end281_crit_edge.split.us, %for.end136.thread
%sub411 = phi i32 [ %sub, %for.end136 ], [ %sub, %for.cond139.for.end281_crit_edge.split.us ], [ %sub409, %for.end136.thread ]
%storemerge321.lcssa = phi i32 [ %.mux, %for.end136 ], [ %sub, %for.cond139.for.end281_crit_edge.split.us ], [ %sub409, %for.end136.thread ]
store i32 %storemerge321.lcssa, ptr @k, align 4, !tbaa !5
store i32 0, ptr @i, align 4, !tbaa !5
store i32 33554432, ptr @s, align 4, !tbaa !5
br i1 %cmp50339, label %for.end304, label %for.body285.lr.ph
for.body285.lr.ph: ; preds = %for.end281
%idxprom287 = sext i32 %sub411 to i64
%wide.trip.count404 = zext i32 %11 to i64
%min.iters.check = icmp ult i32 %11, 8
br i1 %min.iters.check, label %for.body285.preheader, label %vector.ph
vector.ph: ; preds = %for.body285.lr.ph
%n.vec = and i64 %wide.trip.count404, 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> [ <i32 33554432, i32 33554432, i32 33554432, i32 33554432>, %vector.ph ], [ %54, %vector.body ]
%vec.phi421 = phi <4 x i32> [ <i32 33554432, i32 33554432, i32 33554432, i32 33554432>, %vector.ph ], [ %55, %vector.body ]
%52 = getelementptr inbounds [1005 x [205 x i32]], ptr @dp, i64 0, i64 %idxprom287, i64 %index
%wide.load = load <4 x i32>, ptr %52, align 4, !tbaa !5
%53 = getelementptr inbounds i32, ptr %52, i64 4
%wide.load422 = load <4 x i32>, ptr %53, align 4, !tbaa !5
%54 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
%55 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi421, <4 x i32> %wide.load422)
%index.next = add nuw i64 %index, 8
%56 = icmp eq i64 %index.next, %n.vec
br i1 %56, label %middle.block, label %vector.body, !llvm.loop !38
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %54, <4 x i32> %55)
%57 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count404
br i1 %cmp.n, label %for.cond282.for.end304_crit_edge, label %for.body285.preheader
for.body285.preheader: ; preds = %for.body285.lr.ph, %middle.block
%indvars.iv401.ph = phi i64 [ 0, %for.body285.lr.ph ], [ %n.vec, %middle.block ]
%.363365.ph = phi i32 [ 33554432, %for.body285.lr.ph ], [ %57, %middle.block ]
br label %for.body285
for.body285: ; preds = %for.body285.preheader, %for.body285
%indvars.iv401 = phi i64 [ %indvars.iv.next402, %for.body285 ], [ %indvars.iv401.ph, %for.body285.preheader ]
%.363365 = phi i32 [ %., %for.body285 ], [ %.363365.ph, %for.body285.preheader ]
%arrayidx290 = getelementptr inbounds [1005 x [205 x i32]], ptr @dp, i64 0, i64 %idxprom287, i64 %indvars.iv401
%58 = load i32, ptr %arrayidx290, align 4, !tbaa !5
%. = call i32 @llvm.smin.i32(i32 %.363365, i32 %58)
%indvars.iv.next402 = add nuw nsw i64 %indvars.iv401, 1
%exitcond405.not = icmp eq i64 %indvars.iv.next402, %wide.trip.count404
br i1 %exitcond405.not, label %for.cond282.for.end304_crit_edge, label %for.body285, !llvm.loop !39
for.cond282.for.end304_crit_edge: ; preds = %for.body285, %middle.block
%..lcssa = phi i32 [ %57, %middle.block ], [ %., %for.body285 ]
store i32 %..lcssa, ptr @s, align 4, !tbaa !5
store i32 %11, ptr @i, align 4, !tbaa !5
br label %for.end304
for.end304: ; preds = %for.end281.thread, %for.cond282.for.end304_crit_edge, %for.end281
%59 = phi i32 [ %..lcssa, %for.cond282.for.end304_crit_edge ], [ 33554432, %for.end281 ], [ 33554432, %for.end281.thread ]
%call305 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %59)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N, ptr noundef nonnull @M)
%60 = load i32, ptr @N, align 4, !tbaa !5
%tobool.not = icmp eq i32 %60, 0
br i1 %tobool.not, label %for.end306, label %for.body, !llvm.loop !40
for.end306: ; preds = %for.end304, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
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 <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smin.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 nounwind willreturn memory(argmem: write) }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = !{!14}
!14 = distinct !{!14, !15}
!15 = distinct !{!15, !"LVerDomain"}
!16 = !{!17}
!17 = distinct !{!17, !15}
!18 = !{!19}
!19 = distinct !{!19, !15}
!20 = !{!14, !21}
!21 = distinct !{!21, !15}
!22 = !{!21}
!23 = !{!24}
!24 = distinct !{!24, !15}
!25 = !{!17, !26}
!26 = distinct !{!26, !15}
!27 = !{!26}
!28 = distinct !{!28, !10, !29, !30}
!29 = !{!"llvm.loop.isvectorized", i32 1}
!30 = !{!"llvm.loop.unroll.runtime.disable"}
!31 = distinct !{!31, !10, !29}
!32 = distinct !{!32, !10}
!33 = distinct !{!33, !10}
!34 = distinct !{!34, !10}
!35 = distinct !{!35, !10}
!36 = distinct !{!36, !10}
!37 = distinct !{!37, !10}
!38 = distinct !{!38, !10, !29, !30}
!39 = distinct !{!39, !10, !30, !29}
!40 = distinct !{!40, !10}
|
//ABC141-F
//Find the maximum subset XOR of a given set
//Thanks for
//https://www.geeksforgeeks.org/find-maximum-subset-xor-given-set/
//https://stackoverflow.com/questions/27470592/maximum-xor-among-all-subsets-of-an-array
//set many funcs template
//Ver.20190820
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
#define size 524288
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
void llswap(long long *a,long long *b){long long c;c=(*a);(*a)=(*b);(*b)=c;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
void dbswap(double *a,double *b){double c;c=(*a);(*a)=(*b);(*b)=c;}
void chswap(char *a,char *b){char c;c=(*a);(*a)=(*b);(*b)=c;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}
int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}
int chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}
int chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}
void shuffledget(int x[],int n){
int i,b[524288],p,c;
for(i=0;i<n;i++){
b[i]=i;
}
for(i=n;i>=1;i--){
p=rand()%i;
c=b[i-1];b[i-1]=b[p];b[p]=c;
}
for(i=0;i<n;i++){
scanf("%d",&x[b[i]]);
}
}
int dx4[4]={1,-1,0,0};
int dy4[4]={0,0,1,-1};
int dx8[8]={-1,-1,-1,0,0,1,1,1};
int dy8[8]={-1,0,1,-1,1,-1,0,1};
int search(int x,int a[],int n){
int st=0,fi=n-1,te;
while(st<=fi){
te=(st+fi)/2;
if(a[te]<x){st=te+1;}else{fi=te-1;}
}
return st;
}
void prarr(int arr[],int n){
int i;
for(i=0;i<n;i++){
if(i){printf(" ");}
printf("%d",arr[i]);
}
printf("\n");
return;
}
void getperm(int a[],int n){
int i,p;
for(i=0;i<n;i++){
a[i]=i;
}
for(i=n-1;i>=1;i--){
p=rand()%(i+1);
swap(&a[p],&a[i]);
}
}
typedef struct{
int val;
int node;
}sd;
int sdsortfnc(const void *a,const void *b){
if(((sd*)a)->val < ((sd*)b)->val){return -1;}
if(((sd*)a)->val > ((sd*)b)->val){return 1;}
return 0;
}
void coordinate_comp(int a[],int n){
int i,c=0;
sd dat[524288];
for(i=0;i<n;i++){
dat[i].val=a[i];
dat[i].node=i;
}
qsort(dat,n,sizeof(dat[0]),sdsortfnc);
a[dat[0].node]=c;
for(i=1;i<n;i++){
if(dat[i-1].val!=dat[i].val){c++;}
a[dat[i].node]=c;
}
}
int main(void){
//srand(time(0));
long long p,i,j,n,m,k,a[size],b,c,h,w,r=0,l,t;
scanf("%lld",&n);
k=0;
for(i=0;i<n;i++){
scanf("%lld",&a[i]);
k^=a[i];
}
for(i=0;i<n;i++){
for(j=0;j<60;j++){
if((k&(1ll<<j))==0){continue;}
if((a[i]&(1ll<<j))!=0){
a[i]^=(1ll<<j);
}
}
}
p=0;
for(i=59;i>=0;i--){
t=-1;
for(j=p;j<n;j++){
if((a[j]&(1ll<<i))==0){continue;}
if(t==-1){t=j;}
else if(a[t]<a[j]){t=j;}
}
if(t==-1){continue;}
llswap(&a[p],&a[t]);
for(j=0;j<n;j++){
if(j==p){continue;}
if((a[j]&(1ll<<i))!=0){a[j]^=a[p];}
}
p++;
}
w=0;
for(i=0;i<n;i++){w^=a[i];}
printf("%lld\n",k+w*2);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164840/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164840/source.c"
target datalayout = "e-m:e-p270: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.sd = type { i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@dx4 = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 -1, i32 0, i32 0], align 16
@dy4 = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 0, i32 1, i32 -1], align 16
@dx8 = 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
@dy8 = 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
@.str.3 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @zt(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i32 %a, %b
%sub = tail call i32 @llvm.abs.i32(i32 %sub5, i1 true)
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @round(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%mul = shl nsw i32 %rem, 1
%cmp.not = icmp sge i32 %mul, %b
%div1 = sdiv i32 %a, %b
%add = zext i1 %cmp.not to i32
%retval.0 = add nsw i32 %div1, %add
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ceil(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %a, %b
%add = zext i1 %cmp to i32
%retval.0 = add nsw i32 %div, %add
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i32 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i32 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i32 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i32 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i32 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i32 %a.addr.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i32 %b, 0
br i1 %cmp.not4.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i32 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5
gcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i32 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i32 %a, %a.addr.0.lcssa.i
%mul = mul nsw i32 %div, %b
ret i32 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nCr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i32 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i32 %a, 1
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i32 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i32 %add, %i.07
%mul = mul nsw i32 %r.08, %sub
%div = sdiv i32 %mul, %i.07
%inc = add nuw i32 %i.07, 1
%sub.1 = sub i32 %add, %inc
%mul.1 = mul nsw i32 %div, %sub.1
%div.1 = sdiv i32 %mul.1, %inc
%inc.1 = add nuw i32 %i.07, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i32 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i32 %add, %i.07.unr
%mul.epil = mul nsw i32 %r.08.unr, %sub.epil
%div.epil = sdiv i32 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nHr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i32 %b, %a
%cmp.not6.i = icmp slt i32 %b, 1
br i1 %cmp.not6.i, label %nCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i32 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i32 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i32 %add, %i.07.i
%mul.i = mul nsw i32 %sub.i, %r.08.i
%div.i = sdiv i32 %mul.i, %i.07.i
%inc.i = add nuw i32 %i.07.i, 1
%sub.i.1 = sub i32 %add, %inc.i
%mul.i.1 = mul nsw i32 %sub.i.1, %div.i
%div.i.1 = sdiv i32 %mul.i.1, %inc.i
%inc.i.1 = add nuw i32 %i.07.i, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !7
nCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %nCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %nCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i32 %add, %i.07.i.unr
%mul.i.epil = mul nsw i32 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i32 %mul.i.epil, %i.07.i.unr
br label %nCr.exit
nCr.exit: ; preds = %for.body.i.epil, %nCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i32 [ 1, %entry ], [ %div.i.lcssa.ph, %nCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i32 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @fact(i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i32 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %a, 8
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %a, -8
%ind.end = or i32 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = mul <4 x i32> %vec.phi, %vec.ind
%1 = mul <4 x i32> %vec.phi7, %step.add
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %a
br i1 %cmp.n, label %for.end, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%r.06.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader9, %for.body
%r.06 = phi i32 [ %mul, %for.body ], [ %r.06.ph, %for.body.preheader9 ]
%i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader9 ]
%mul = mul nsw i32 %r.06, %i.05
%inc = add nuw i32 %i.05, 1
%exitcond.not = icmp eq i32 %i.05, %a
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @pow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i32 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %b, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %b, -8
%ind.end = or i32 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, 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 i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%0 = mul <4 x i32> %vec.phi, %broadcast.splat
%1 = mul <4 x i32> %vec.phi6, %broadcast.splat
%index.next = add nuw i32 %index, 8
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %b
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%r.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.04.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%r.05 = phi i32 [ %mul, %for.body ], [ %r.05.ph, %for.body.preheader7 ]
%i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ]
%mul = mul nsw i32 %r.05, %a
%inc = add nuw i32 %i.04, 1
%exitcond.not = icmp eq i32 %i.04, %b
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsum(i32 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i32 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.05, 10
%add = add nsw i32 %r.06, %rem
%div = sdiv i32 %x.addr.05, 10
%x.addr.05.off = add i32 %x.addr.05, 9
%tobool.not = icmp ult i32 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsumb(i32 noundef %x, i32 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i32 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.06, %b
%add = add nsw i32 %rem, %r.07
%div = sdiv i32 %x.addr.06, %b
%tobool.not = icmp eq i32 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @sankaku(i32 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i32 %x, 1
%mul = mul nsw i32 %add, %x
%div = sdiv i32 %mul, 2
ret i32 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
store i32 %1, ptr %a, align 4, !tbaa !16
store i32 %0, ptr %b, align 4, !tbaa !16
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llzt(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i64 %a, %b
%sub = tail call i64 @llvm.abs.i64(i64 %sub5, i1 true)
ret i64 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llround(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%mul = shl nsw i64 %rem, 1
%cmp.not = icmp sge i64 %mul, %b
%div1 = sdiv i64 %a, %b
%add = zext i1 %cmp.not to i64
%retval.0 = add nsw i64 %div1, %add
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llceil(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %a, %b
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i64 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i64 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !20
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i64 %a.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lllcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i64 %b, 0
br i1 %cmp.not4.i, label %llgcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i64 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i64 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not.i, label %llgcd.exit, label %while.body.i, !llvm.loop !20
llgcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i64 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i64 %a, %a.addr.0.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnCr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i64 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i64 %a, 1
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i64 %add, %i.07
%mul = mul nsw i64 %r.08, %sub
%div = sdiv i64 %mul, %i.07
%inc = add nuw i64 %i.07, 1
%sub.1 = sub i64 %add, %inc
%mul.1 = mul nsw i64 %div, %sub.1
%div.1 = sdiv i64 %mul.1, %inc
%inc.1 = add nuw i64 %i.07, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !21
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i64 %add, %i.07.unr
%mul.epil = mul nsw i64 %r.08.unr, %sub.epil
%div.epil = sdiv i64 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnHr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i64 %b, %a
%cmp.not6.i = icmp slt i64 %b, 1
br i1 %cmp.not6.i, label %llnCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i64 %add, %i.07.i
%mul.i = mul nsw i64 %sub.i, %r.08.i
%div.i = sdiv i64 %mul.i, %i.07.i
%inc.i = add nuw i64 %i.07.i, 1
%sub.i.1 = sub i64 %add, %inc.i
%mul.i.1 = mul nsw i64 %sub.i.1, %div.i
%div.i.1 = sdiv i64 %mul.i.1, %inc.i
%inc.i.1 = add nuw i64 %i.07.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !21
llnCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %llnCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %llnCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i64 %add, %i.07.i.unr
%mul.i.epil = mul nsw i64 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i64 %mul.i.epil, %i.07.i.unr
br label %llnCr.exit
llnCr.exit: ; preds = %for.body.i.epil, %llnCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i64 [ 1, %entry ], [ %div.i.lcssa.ph, %llnCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i64 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llfact(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i64 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %a, 7
%0 = icmp ult i64 %a, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %a, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.06 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%i.05 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.06, %i.05
%inc = add nuw nsw i64 %i.05, 1
%mul.1 = mul nsw i64 %mul, %inc
%inc.1 = add nuw nsw i64 %i.05, 2
%mul.2 = mul nsw i64 %mul.1, %inc.1
%inc.2 = add nuw nsw i64 %i.05, 3
%mul.3 = mul nsw i64 %mul.2, %inc.2
%inc.3 = add nuw nsw i64 %i.05, 4
%mul.4 = mul nsw i64 %mul.3, %inc.3
%inc.4 = add nuw nsw i64 %i.05, 5
%mul.5 = mul nsw i64 %mul.4, %inc.4
%inc.5 = add nuw nsw i64 %i.05, 6
%mul.6 = mul nsw i64 %mul.5, %inc.5
%inc.6 = add nuw i64 %i.05, 7
%mul.7 = mul nsw i64 %mul.6, %inc.6
%inc.7 = add nuw i64 %i.05, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !22
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%i.05.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.06.unr, %for.end.loopexit.unr-lcssa ]
%i.05.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.06.epil, %i.05.epil
%inc.epil = add nuw i64 %i.05.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !23
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i64 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.05 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.05, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !25
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.05.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.05.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.05.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !26
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsum(i64 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i64 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.05, 10
%add = add nsw i64 %r.06, %rem
%div = sdiv i64 %x.addr.05, 10
%x.addr.05.off = add i64 %x.addr.05, 9
%tobool.not = icmp ult i64 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !27
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsumb(i64 noundef %x, i64 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i64 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.06, %b
%add = add nsw i64 %rem, %r.07
%div = sdiv i64 %x.addr.06, %b
%tobool.not = icmp eq i64 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !28
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llsankaku(i64 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i64 %x, 1
%mul = mul nsw i64 %add, %x
%div = sdiv i64 %mul, 2
ret i64 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @llswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
store i64 %1, ptr %a, align 8, !tbaa !29
store i64 %0, ptr %b, align 8, !tbaa !29
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp ogt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp olt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbzt(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp.i = fcmp ogt double %a, %b
%a.b.i = select i1 %cmp.i, double %a, double %b
%cmp.i4 = fcmp olt double %a, %b
%a.b.i5 = select i1 %cmp.i4, double %a, double %b
%sub = fsub double %a.b.i, %a.b.i5
ret double %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @dbswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
store double %1, ptr %a, align 8, !tbaa !31
store double %0, ptr %b, align 8, !tbaa !31
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @chswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
store i8 %1, ptr %a, align 1, !tbaa !33
store i8 %0, ptr %b, align 1, !tbaa !33
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp ogt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 {
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 #7
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #16
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @chsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
%cmp = icmp sgt i8 %0, %1
%cmp5 = icmp ne i8 %0, %1
%. = sext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @chsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
%cmp = icmp slt i8 %0, %1
%cmp5 = icmp ne i8 %0, %1
%. = sext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #8 {
entry:
%b = alloca [524288 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #17
%cmp40 = icmp sgt i32 %n, 0
br i1 %cmp40, label %for.body.preheader, label %for.end25
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader57, 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 i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 16, !tbaa !16
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 16, !tbaa !16
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !34
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.preheader57
for.body.preheader57: ; 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 %cmp40, label %for.body3.preheader, label %for.end25
for.body3.preheader: ; preds = %for.cond1.preheader
%3 = zext i32 %n to i64
br label %for.body3
for.body: ; preds = %for.body.preheader57, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader57 ]
%arrayidx = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx, align 4, !tbaa !16
%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 !35
for.cond15.preheader: ; preds = %for.body3
br i1 %cmp40, label %for.body17.preheader, label %for.end25
for.body17.preheader: ; preds = %for.cond15.preheader
%wide.trip.count54 = zext i32 %n to i64
br label %for.body17
for.body3: ; preds = %for.body3.preheader, %for.body3
%indvars.iv47 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next48, %for.body3 ]
%call = tail call i32 @rand() #17
%5 = trunc i64 %indvars.iv47 to i32
%rem = srem i32 %call, %5
%indvars.iv.next48 = add nsw i64 %indvars.iv47, -1
%idxprom4 = and i64 %indvars.iv.next48, 4294967295
%arrayidx5 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom4
%6 = load i32, ptr %arrayidx5, align 4, !tbaa !16
%idxprom6 = sext i32 %rem to i64
%arrayidx7 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom6
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !16
store i32 %7, ptr %arrayidx5, align 4, !tbaa !16
store i32 %6, ptr %arrayidx7, align 4, !tbaa !16
%cmp2 = icmp ugt i64 %indvars.iv47, 1
br i1 %cmp2, label %for.body3, label %for.cond15.preheader, !llvm.loop !36
for.body17: ; preds = %for.body17.preheader, %for.body17
%indvars.iv50 = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next51, %for.body17 ]
%arrayidx19 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv50
%8 = load i32, ptr %arrayidx19, align 4, !tbaa !16
%idxprom20 = sext i32 %8 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %x, i64 %idxprom20
%call22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx21)
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond55.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count54
br i1 %exitcond55.not, label %for.end25, label %for.body17, !llvm.loop !37
for.end25: ; preds = %for.body17, %entry, %for.cond1.preheader, %for.cond15.preheader
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #17
ret void
}
; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #9
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @search(i32 noundef %x, ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #11 {
entry:
%cmp.not9 = icmp slt i32 %n, 1
br i1 %cmp.not9, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%st.011 = phi i32 [ %st.1, %while.body ], [ 0, %while.body.preheader ]
%fi.010 = phi i32 [ %fi.1, %while.body ], [ %sub, %while.body.preheader ]
%add = add nsw i32 %st.011, %fi.010
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !16
%cmp1 = icmp slt i32 %0, %x
%add2 = add nsw i32 %div, 1
%sub3 = add nsw i32 %div, -1
%fi.1 = select i1 %cmp1, i32 %fi.010, i32 %sub3
%st.1 = select i1 %cmp1, i32 %add2, i32 %st.011
%cmp.not = icmp sgt i32 %st.1, %fi.1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !38
while.end: ; preds = %while.body, %entry
%st.0.lcssa = phi i32 [ 0, %entry ], [ %st.1, %while.body ]
ret i32 %st.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @prarr(ptr nocapture noundef readonly %arr, i32 noundef %n) local_unnamed_addr #12 {
entry:
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%.pre = load i32, ptr %arr, align 4, !tbaa !16
%call1.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %n, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar6 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !16
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%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 %if.end, !llvm.loop !39
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nounwind uwtable
define dso_local void @getperm(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #8 {
entry:
%cmp20 = icmp sgt i32 %n, 0
br i1 %cmp20, label %for.body.preheader, label %for.end9
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader30, 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 i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = getelementptr inbounds i32, ptr %a, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 4, !tbaa !16
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 4, !tbaa !16
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !41
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.preheader30
for.body.preheader30: ; 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
%cmp222 = icmp sgt i32 %n, 1
br i1 %cmp222, label %for.body3.preheader, label %for.end9
for.body3.preheader: ; preds = %for.cond1.preheader
%3 = zext i32 %n to i64
br label %for.body3
for.body: ; preds = %for.body.preheader30, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader30 ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx, align 4, !tbaa !16
%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 !42
for.body3: ; preds = %for.body3.preheader, %for.body3
%indvars.iv25 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next26, %for.body3 ]
%indvars.iv.next26 = add nsw i64 %indvars.iv25, -1
%call = tail call i32 @rand() #17
%5 = trunc i64 %indvars.iv25 to i32
%rem = srem i32 %call, %5
%idxprom4 = sext i32 %rem to i64
%arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %idxprom4
%idxprom6 = and i64 %indvars.iv.next26, 4294967295
%arrayidx7 = getelementptr inbounds i32, ptr %a, i64 %idxprom6
%6 = load i32, ptr %arrayidx5, align 4, !tbaa !16
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !16
store i32 %7, ptr %arrayidx5, align 4, !tbaa !16
store i32 %6, ptr %arrayidx7, align 4, !tbaa !16
%cmp2 = icmp ugt i64 %indvars.iv25, 2
br i1 %cmp2, label %for.body3, label %for.end9, !llvm.loop !43
for.end9: ; preds = %for.body3, %entry, %for.cond1.preheader
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sdsortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !44
%1 = load i32, ptr %b, align 4, !tbaa !44
%cmp = icmp slt i32 %0, %1
%cmp4 = icmp sgt i32 %0, %1
%. = zext i1 %cmp4 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @coordinate_comp(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #12 {
entry:
%dat = alloca [524288 x %struct.sd], align 16
call void @llvm.lifetime.start.p0(i64 4194304, ptr nonnull %dat) #17
%cmp46 = icmp sgt i32 %n, 0
br i1 %cmp46, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 4
br i1 %min.iters.check, label %for.body.preheader61, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
%0 = or i64 %index, 2
%1 = getelementptr inbounds i32, ptr %a, i64 %index
%wide.load = load <2 x i32>, ptr %1, align 4, !tbaa !16
%2 = getelementptr inbounds i32, ptr %1, i64 2
%wide.load59 = load <2 x i32>, ptr %2, align 4, !tbaa !16
%3 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %index
%4 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %0
%interleaved.vec = shufflevector <2 x i32> %wide.load, <2 x i32> %vec.ind, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec, ptr %3, align 16, !tbaa !16
%interleaved.vec60 = shufflevector <2 x i32> %wide.load59, <2 x i32> %step.add, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec60, ptr %4, align 16, !tbaa !16
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !46
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader61
for.body.preheader61: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader61, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader61 ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%6 = load i32, ptr %arrayidx, align 4, !tbaa !16
%arrayidx2 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv
store i32 %6, ptr %arrayidx2, align 8, !tbaa !44
%node = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv, i32 1
%7 = trunc i64 %indvars.iv to i32
store i32 %7, ptr %node, align 4, !tbaa !47
%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 !48
for.end: ; preds = %for.body, %middle.block, %entry
%conv = sext i32 %n to i64
call void @qsort(ptr noundef nonnull %dat, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @sdsortfnc) #17
%node6 = getelementptr inbounds %struct.sd, ptr %dat, i64 0, i32 1
%8 = load i32, ptr %node6, align 4, !tbaa !47
%idxprom7 = sext i32 %8 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %a, i64 %idxprom7
store i32 0, ptr %arrayidx8, align 4, !tbaa !16
%cmp1048 = icmp sgt i32 %n, 1
br i1 %cmp1048, label %for.body12.preheader, label %for.end29
for.body12.preheader: ; preds = %for.end
%wide.trip.count56 = zext i32 %n to i64
%.pre = load i32, ptr %dat, align 16, !tbaa !44
%9 = add nsw i64 %wide.trip.count56, -1
%xtraiter = and i64 %9, 1
%10 = icmp eq i32 %n, 2
br i1 %10, label %for.end29.loopexit.unr-lcssa, label %for.body12.preheader.new
for.body12.preheader.new: ; preds = %for.body12.preheader
%unroll_iter = and i64 %9, -2
br label %for.body12
for.body12: ; preds = %for.body12, %for.body12.preheader.new
%11 = phi i32 [ %.pre, %for.body12.preheader.new ], [ %14, %for.body12 ]
%indvars.iv52 = phi i64 [ 1, %for.body12.preheader.new ], [ %indvars.iv.next53.1, %for.body12 ]
%c.050 = phi i32 [ 0, %for.body12.preheader.new ], [ %spec.select.1, %for.body12 ]
%niter = phi i64 [ 0, %for.body12.preheader.new ], [ %niter.next.1, %for.body12 ]
%arrayidx17 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52
%12 = load i32, ptr %arrayidx17, align 8, !tbaa !44
%cmp19.not = icmp ne i32 %11, %12
%inc21 = zext i1 %cmp19.not to i32
%spec.select = add nuw nsw i32 %c.050, %inc21
%node24 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52, i32 1
%13 = load i32, ptr %node24, align 4, !tbaa !47
%idxprom25 = sext i32 %13 to i64
%arrayidx26 = getelementptr inbounds i32, ptr %a, i64 %idxprom25
store i32 %spec.select, ptr %arrayidx26, align 4, !tbaa !16
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%arrayidx17.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53
%14 = load i32, ptr %arrayidx17.1, align 8, !tbaa !44
%cmp19.not.1 = icmp ne i32 %12, %14
%inc21.1 = zext i1 %cmp19.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc21.1
%node24.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53, i32 1
%15 = load i32, ptr %node24.1, align 4, !tbaa !47
%idxprom25.1 = sext i32 %15 to i64
%arrayidx26.1 = getelementptr inbounds i32, ptr %a, i64 %idxprom25.1
store i32 %spec.select.1, ptr %arrayidx26.1, align 4, !tbaa !16
%indvars.iv.next53.1 = add nuw nsw i64 %indvars.iv52, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end29.loopexit.unr-lcssa, label %for.body12, !llvm.loop !49
for.end29.loopexit.unr-lcssa: ; preds = %for.body12, %for.body12.preheader
%.unr = phi i32 [ %.pre, %for.body12.preheader ], [ %14, %for.body12 ]
%indvars.iv52.unr = phi i64 [ 1, %for.body12.preheader ], [ %indvars.iv.next53.1, %for.body12 ]
%c.050.unr = phi i32 [ 0, %for.body12.preheader ], [ %spec.select.1, %for.body12 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.body12.epil
for.body12.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx17.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr
%16 = load i32, ptr %arrayidx17.epil, align 8, !tbaa !44
%cmp19.not.epil = icmp ne i32 %.unr, %16
%inc21.epil = zext i1 %cmp19.not.epil to i32
%spec.select.epil = add nuw nsw i32 %c.050.unr, %inc21.epil
%node24.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr, i32 1
%17 = load i32, ptr %node24.epil, align 4, !tbaa !47
%idxprom25.epil = sext i32 %17 to i64
%arrayidx26.epil = getelementptr inbounds i32, ptr %a, i64 %idxprom25.epil
store i32 %spec.select.epil, ptr %arrayidx26.epil, align 4, !tbaa !16
br label %for.end29
for.end29: ; preds = %for.body12.epil, %for.end29.loopexit.unr-lcssa, %for.end
call void @llvm.lifetime.end.p0(i64 4194304, ptr nonnull %dat) #17
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #13
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #12 {
entry:
%n = alloca i64, align 8
%a = alloca [524288 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #17
call void @llvm.lifetime.start.p0(i64 4194304, ptr nonnull %a) #17
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !29
%cmp122 = icmp sgt i64 %0, 0
br i1 %cmp122, label %for.body, label %for.cond25.preheader
for.cond3.preheader: ; preds = %for.body
%cmp4127 = icmp sgt i64 %2, 0
br i1 %cmp4127, label %for.cond6.preheader, label %for.cond25.preheader
for.body: ; preds = %entry, %for.body
%i.0124 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%k.0123 = phi i64 [ %xor, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %i.0124
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %arrayidx)
%1 = load i64, ptr %arrayidx, align 8, !tbaa !29
%xor = xor i64 %1, %k.0123
%inc = add nuw nsw i64 %i.0124, 1
%2 = load i64, ptr %n, align 8, !tbaa !29
%cmp = icmp slt i64 %inc, %2
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !50
for.cond6.preheader: ; preds = %for.cond3.preheader, %for.inc22
%i.1128 = phi i64 [ %inc23, %for.inc22 ], [ 0, %for.cond3.preheader ]
%arrayidx10 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %i.1128
br label %for.body8
for.cond25.preheader: ; preds = %for.inc22, %entry, %for.cond3.preheader
%cmp4127151 = phi i1 [ false, %for.cond3.preheader ], [ false, %entry ], [ %cmp4127, %for.inc22 ]
%.lcssa150 = phi i64 [ %2, %for.cond3.preheader ], [ %0, %entry ], [ %2, %for.inc22 ]
%k.0.lcssa149 = phi i64 [ %xor, %for.cond3.preheader ], [ 0, %entry ], [ %xor, %for.inc22 ]
%3 = add i64 %.lcssa150, -1
%xtraiter161 = and i64 %.lcssa150, 1
%4 = icmp eq i64 %3, 0
%unroll_iter163 = and i64 %.lcssa150, -2
%lcmp.mod162.not = icmp eq i64 %xtraiter161, 0
br label %for.cond28.preheader
for.body8: ; preds = %for.inc19.1, %for.cond6.preheader
%j.0126 = phi i64 [ 0, %for.cond6.preheader ], [ %inc20.1, %for.inc19.1 ]
%shl = shl nuw nsw i64 1, %j.0126
%and = and i64 %shl, %xor
%cmp9 = icmp eq i64 %and, 0
br i1 %cmp9, label %for.inc19, label %if.end
if.end: ; preds = %for.body8
%5 = load i64, ptr %arrayidx10, align 8, !tbaa !29
%and12 = and i64 %5, %shl
%cmp13.not = icmp eq i64 %and12, 0
br i1 %cmp13.not, label %for.inc19, label %if.then14
if.then14: ; preds = %if.end
%xor17 = xor i64 %5, %shl
store i64 %xor17, ptr %arrayidx10, align 8, !tbaa !29
br label %for.inc19
for.inc19: ; preds = %if.end, %if.then14, %for.body8
%inc20 = or i64 %j.0126, 1
%shl.1 = shl nuw nsw i64 1, %inc20
%and.1 = and i64 %shl.1, %xor
%cmp9.1 = icmp eq i64 %and.1, 0
br i1 %cmp9.1, label %for.inc19.1, label %if.end.1
if.end.1: ; preds = %for.inc19
%6 = load i64, ptr %arrayidx10, align 8, !tbaa !29
%and12.1 = and i64 %6, %shl.1
%cmp13.not.1 = icmp eq i64 %and12.1, 0
br i1 %cmp13.not.1, label %for.inc19.1, label %if.then14.1
if.then14.1: ; preds = %if.end.1
%xor17.1 = xor i64 %6, %shl.1
store i64 %xor17.1, ptr %arrayidx10, align 8, !tbaa !29
br label %for.inc19.1
for.inc19.1: ; preds = %if.then14.1, %if.end.1, %for.inc19
%inc20.1 = add nuw nsw i64 %j.0126, 2
%exitcond.not.1 = icmp eq i64 %inc20.1, 60
br i1 %exitcond.not.1, label %for.inc22, label %for.body8, !llvm.loop !51
for.inc22: ; preds = %for.inc19.1
%inc23 = add nuw nsw i64 %i.1128, 1
%exitcond142.not = icmp eq i64 %inc23, %2
br i1 %exitcond142.not, label %for.cond25.preheader, label %for.cond6.preheader, !llvm.loop !52
for.cond28.preheader: ; preds = %for.cond25.preheader, %for.inc72
%p.0136 = phi i64 [ 0, %for.cond25.preheader ], [ %p.1, %for.inc72 ]
%i.2135 = phi i64 [ 59, %for.cond25.preheader ], [ %dec, %for.inc72 ]
%cmp29129 = icmp slt i64 %p.0136, %.lcssa150
br i1 %cmp29129, label %for.body30.lr.ph, label %for.inc72
for.body30.lr.ph: ; preds = %for.cond28.preheader
%shl32 = shl nuw i64 1, %i.2135
%7 = sub i64 %.lcssa150, %p.0136
%xtraiter = and i64 %7, 1
%8 = icmp eq i64 %3, %p.0136
br i1 %8, label %for.end47.unr-lcssa, label %for.body30.lr.ph.new
for.body30.lr.ph.new: ; preds = %for.body30.lr.ph
%unroll_iter = and i64 %7, -2
br label %for.body30
for.cond74.preheader: ; preds = %for.inc72
br i1 %cmp4127151, label %for.body76.preheader, label %for.end81
for.body76.preheader: ; preds = %for.cond74.preheader
%min.iters.check = icmp ult i64 %.lcssa150, 4
br i1 %min.iters.check, label %for.body76.preheader156, label %vector.ph
vector.ph: ; preds = %for.body76.preheader
%n.vec = and i64 %.lcssa150, -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 ], [ %11, %vector.body ]
%vec.phi154 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%9 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %index
%wide.load = load <2 x i64>, ptr %9, align 16, !tbaa !29
%10 = getelementptr inbounds i64, ptr %9, i64 2
%wide.load155 = load <2 x i64>, ptr %10, align 16, !tbaa !29
%11 = xor <2 x i64> %wide.load, %vec.phi
%12 = xor <2 x i64> %wide.load155, %vec.phi154
%index.next = add nuw i64 %index, 4
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !53
middle.block: ; preds = %vector.body
%bin.rdx = xor <2 x i64> %12, %11
%14 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %.lcssa150, %n.vec
br i1 %cmp.n, label %for.end81.loopexit, label %for.body76.preheader156
for.body76.preheader156: ; preds = %for.body76.preheader, %middle.block
%i.3139.ph = phi i64 [ 0, %for.body76.preheader ], [ %n.vec, %middle.block ]
%w.0138.ph = phi i64 [ 0, %for.body76.preheader ], [ %14, %middle.block ]
br label %for.body76
for.body30: ; preds = %for.inc45.1, %for.body30.lr.ph.new
%t.0131 = phi i64 [ -1, %for.body30.lr.ph.new ], [ %t.1.1, %for.inc45.1 ]
%j.1130 = phi i64 [ %p.0136, %for.body30.lr.ph.new ], [ %inc46.1, %for.inc45.1 ]
%niter = phi i64 [ 0, %for.body30.lr.ph.new ], [ %niter.next.1, %for.inc45.1 ]
%arrayidx31 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %j.1130
%15 = load i64, ptr %arrayidx31, align 8, !tbaa !29
%and33 = and i64 %15, %shl32
%cmp34 = icmp eq i64 %and33, 0
br i1 %cmp34, label %for.inc45, label %if.end36
if.end36: ; preds = %for.body30
%cmp37 = icmp eq i64 %t.0131, -1
br i1 %cmp37, label %for.inc45, label %if.else
if.else: ; preds = %if.end36
%arrayidx39 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %t.0131
%16 = load i64, ptr %arrayidx39, align 8, !tbaa !29
%cmp41 = icmp slt i64 %16, %15
%spec.select = select i1 %cmp41, i64 %j.1130, i64 %t.0131
br label %for.inc45
for.inc45: ; preds = %if.else, %if.end36, %for.body30
%t.1 = phi i64 [ %t.0131, %for.body30 ], [ %j.1130, %if.end36 ], [ %spec.select, %if.else ]
%inc46 = add nsw i64 %j.1130, 1
%arrayidx31.1 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %inc46
%17 = load i64, ptr %arrayidx31.1, align 8, !tbaa !29
%and33.1 = and i64 %17, %shl32
%cmp34.1 = icmp eq i64 %and33.1, 0
br i1 %cmp34.1, label %for.inc45.1, label %if.end36.1
if.end36.1: ; preds = %for.inc45
%cmp37.1 = icmp eq i64 %t.1, -1
br i1 %cmp37.1, label %for.inc45.1, label %if.else.1
if.else.1: ; preds = %if.end36.1
%arrayidx39.1 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %t.1
%18 = load i64, ptr %arrayidx39.1, align 8, !tbaa !29
%cmp41.1 = icmp slt i64 %18, %17
%spec.select.1 = select i1 %cmp41.1, i64 %inc46, i64 %t.1
br label %for.inc45.1
for.inc45.1: ; preds = %if.else.1, %if.end36.1, %for.inc45
%t.1.1 = phi i64 [ %t.1, %for.inc45 ], [ %inc46, %if.end36.1 ], [ %spec.select.1, %if.else.1 ]
%inc46.1 = add nsw i64 %j.1130, 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.end47.unr-lcssa, label %for.body30, !llvm.loop !54
for.end47.unr-lcssa: ; preds = %for.inc45.1, %for.body30.lr.ph
%t.1.lcssa.ph = phi i64 [ undef, %for.body30.lr.ph ], [ %t.1.1, %for.inc45.1 ]
%t.0131.unr = phi i64 [ -1, %for.body30.lr.ph ], [ %t.1.1, %for.inc45.1 ]
%j.1130.unr = phi i64 [ %p.0136, %for.body30.lr.ph ], [ %inc46.1, %for.inc45.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end47, label %for.body30.epil
for.body30.epil: ; preds = %for.end47.unr-lcssa
%arrayidx31.epil = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %j.1130.unr
%19 = load i64, ptr %arrayidx31.epil, align 8, !tbaa !29
%and33.epil = and i64 %19, %shl32
%cmp34.epil = icmp eq i64 %and33.epil, 0
br i1 %cmp34.epil, label %for.end47, label %if.end36.epil
if.end36.epil: ; preds = %for.body30.epil
%cmp37.epil = icmp eq i64 %t.0131.unr, -1
br i1 %cmp37.epil, label %for.end47, label %if.else.epil
if.else.epil: ; preds = %if.end36.epil
%arrayidx39.epil = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %t.0131.unr
%20 = load i64, ptr %arrayidx39.epil, align 8, !tbaa !29
%cmp41.epil = icmp slt i64 %20, %19
%spec.select.epil = select i1 %cmp41.epil, i64 %j.1130.unr, i64 %t.0131.unr
br label %for.end47
for.end47: ; preds = %for.body30.epil, %if.end36.epil, %if.else.epil, %for.end47.unr-lcssa
%t.1.lcssa = phi i64 [ %t.1.lcssa.ph, %for.end47.unr-lcssa ], [ %t.0131.unr, %for.body30.epil ], [ %j.1130.unr, %if.end36.epil ], [ %spec.select.epil, %if.else.epil ]
%cmp48 = icmp eq i64 %t.1.lcssa, -1
br i1 %cmp48, label %for.inc72, label %if.end50
if.end50: ; preds = %for.end47
%arrayidx51 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %p.0136
%arrayidx52 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %t.1.lcssa
%21 = load i64, ptr %arrayidx51, align 8, !tbaa !29
%22 = load i64, ptr %arrayidx52, align 8, !tbaa !29
store i64 %22, ptr %arrayidx51, align 8, !tbaa !29
store i64 %21, ptr %arrayidx52, align 8, !tbaa !29
br i1 %cmp4127151, label %for.body55.lr.ph, label %for.end70
for.body55.lr.ph: ; preds = %if.end50
%shl60 = shl nuw i64 1, %i.2135
br i1 %4, label %for.end70.loopexit.unr-lcssa, label %for.body55
for.body55: ; preds = %for.body55.lr.ph, %for.inc68.1
%j.2134 = phi i64 [ %inc69.1, %for.inc68.1 ], [ 0, %for.body55.lr.ph ]
%niter164 = phi i64 [ %niter164.next.1, %for.inc68.1 ], [ 0, %for.body55.lr.ph ]
%cmp56 = icmp eq i64 %j.2134, %p.0136
br i1 %cmp56, label %for.inc68, label %if.end58
if.end58: ; preds = %for.body55
%arrayidx59 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %j.2134
%23 = load i64, ptr %arrayidx59, align 16, !tbaa !29
%and61 = and i64 %23, %shl60
%cmp62.not = icmp eq i64 %and61, 0
br i1 %cmp62.not, label %for.inc68, label %if.then63
if.then63: ; preds = %if.end58
%24 = load i64, ptr %arrayidx51, align 8, !tbaa !29
%xor66 = xor i64 %24, %23
store i64 %xor66, ptr %arrayidx59, align 16, !tbaa !29
br label %for.inc68
for.inc68: ; preds = %if.end58, %if.then63, %for.body55
%inc69 = or i64 %j.2134, 1
%cmp56.1 = icmp eq i64 %inc69, %p.0136
br i1 %cmp56.1, label %for.inc68.1, label %if.end58.1
if.end58.1: ; preds = %for.inc68
%arrayidx59.1 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %inc69
%25 = load i64, ptr %arrayidx59.1, align 8, !tbaa !29
%and61.1 = and i64 %25, %shl60
%cmp62.not.1 = icmp eq i64 %and61.1, 0
br i1 %cmp62.not.1, label %for.inc68.1, label %if.then63.1
if.then63.1: ; preds = %if.end58.1
%26 = load i64, ptr %arrayidx51, align 8, !tbaa !29
%xor66.1 = xor i64 %26, %25
store i64 %xor66.1, ptr %arrayidx59.1, align 8, !tbaa !29
br label %for.inc68.1
for.inc68.1: ; preds = %if.then63.1, %if.end58.1, %for.inc68
%inc69.1 = add nuw nsw i64 %j.2134, 2
%niter164.next.1 = add i64 %niter164, 2
%niter164.ncmp.1 = icmp eq i64 %niter164.next.1, %unroll_iter163
br i1 %niter164.ncmp.1, label %for.end70.loopexit.unr-lcssa, label %for.body55, !llvm.loop !55
for.end70.loopexit.unr-lcssa: ; preds = %for.inc68.1, %for.body55.lr.ph
%j.2134.unr = phi i64 [ 0, %for.body55.lr.ph ], [ %inc69.1, %for.inc68.1 ]
%cmp56.epil = icmp eq i64 %j.2134.unr, %p.0136
%or.cond = select i1 %lcmp.mod162.not, i1 true, i1 %cmp56.epil
br i1 %or.cond, label %for.end70, label %if.end58.epil
if.end58.epil: ; preds = %for.end70.loopexit.unr-lcssa
%arrayidx59.epil = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %j.2134.unr
%27 = load i64, ptr %arrayidx59.epil, align 8, !tbaa !29
%and61.epil = and i64 %27, %shl60
%cmp62.not.epil = icmp eq i64 %and61.epil, 0
br i1 %cmp62.not.epil, label %for.end70, label %if.then63.epil
if.then63.epil: ; preds = %if.end58.epil
%28 = load i64, ptr %arrayidx51, align 8, !tbaa !29
%xor66.epil = xor i64 %28, %27
store i64 %xor66.epil, ptr %arrayidx59.epil, align 8, !tbaa !29
br label %for.end70
for.end70: ; preds = %for.end70.loopexit.unr-lcssa, %if.then63.epil, %if.end58.epil, %if.end50
%inc71 = add nsw i64 %p.0136, 1
br label %for.inc72
for.inc72: ; preds = %for.cond28.preheader, %for.end47, %for.end70
%p.1 = phi i64 [ %p.0136, %for.end47 ], [ %inc71, %for.end70 ], [ %p.0136, %for.cond28.preheader ]
%dec = add nsw i64 %i.2135, -1
%cmp26.not = icmp eq i64 %i.2135, 0
br i1 %cmp26.not, label %for.cond74.preheader, label %for.cond28.preheader, !llvm.loop !56
for.body76: ; preds = %for.body76.preheader156, %for.body76
%i.3139 = phi i64 [ %inc80, %for.body76 ], [ %i.3139.ph, %for.body76.preheader156 ]
%w.0138 = phi i64 [ %xor78, %for.body76 ], [ %w.0138.ph, %for.body76.preheader156 ]
%arrayidx77 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %i.3139
%29 = load i64, ptr %arrayidx77, align 8, !tbaa !29
%xor78 = xor i64 %29, %w.0138
%inc80 = add nuw nsw i64 %i.3139, 1
%exitcond145.not = icmp eq i64 %inc80, %.lcssa150
br i1 %exitcond145.not, label %for.end81.loopexit, label %for.body76, !llvm.loop !57
for.end81.loopexit: ; preds = %for.body76, %middle.block
%xor78.lcssa = phi i64 [ %14, %middle.block ], [ %xor78, %for.body76 ]
%30 = shl nsw i64 %xor78.lcssa, 1
br label %for.end81
for.end81: ; preds = %for.end81.loopexit, %for.cond74.preheader
%w.0.lcssa = phi i64 [ 0, %for.cond74.preheader ], [ %30, %for.end81.loopexit ]
%add = add nsw i64 %w.0.lcssa, %k.0.lcssa149
%call82 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %add)
call void @llvm.lifetime.end.p0(i64 4194304, ptr nonnull %a) #17
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #17
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #14
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #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.abs.i32(i32, i1 immarg) #15
; 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 i64 @llvm.abs.i64(i64, i1 immarg) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.xor.v2i64(<2 x i64>) #15
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { 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 #12 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #13 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #14 = { nofree nounwind }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6, !9, !10}
!9 = !{!"llvm.loop.isvectorized", i32 1}
!10 = !{!"llvm.loop.unroll.runtime.disable"}
!11 = distinct !{!11, !6, !10, !9}
!12 = distinct !{!12, !6, !9, !10}
!13 = distinct !{!13, !6, !10, !9}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !18, i64 0}
!18 = !{!"omnipotent char", !19, i64 0}
!19 = !{!"Simple C/C++ TBAA"}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.unroll.disable"}
!25 = distinct !{!25, !6}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !6}
!28 = distinct !{!28, !6}
!29 = !{!30, !30, i64 0}
!30 = !{!"long long", !18, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"double", !18, i64 0}
!33 = !{!18, !18, i64 0}
!34 = distinct !{!34, !6, !9, !10}
!35 = distinct !{!35, !6, !10, !9}
!36 = distinct !{!36, !6}
!37 = distinct !{!37, !6}
!38 = distinct !{!38, !6}
!39 = distinct !{!39, !6, !40}
!40 = !{!"llvm.loop.peeled.count", i32 1}
!41 = distinct !{!41, !6, !9, !10}
!42 = distinct !{!42, !6, !10, !9}
!43 = distinct !{!43, !6}
!44 = !{!45, !17, i64 0}
!45 = !{!"", !17, i64 0, !17, i64 4}
!46 = distinct !{!46, !6, !9, !10}
!47 = !{!45, !17, i64 4}
!48 = distinct !{!48, !6, !10, !9}
!49 = distinct !{!49, !6}
!50 = distinct !{!50, !6}
!51 = distinct !{!51, !6}
!52 = distinct !{!52, !6}
!53 = distinct !{!53, !6, !9, !10}
!54 = distinct !{!54, !6}
!55 = distinct !{!55, !6}
!56 = distinct !{!56, !6}
!57 = distinct !{!57, !6, !10, !9}
|
#include <stdio.h>
int main(void)
{
int s[3];
int r = 0;
int d = 0;
while (scanf("%d,%d,%d", &s[0], &s[1], &s[2]) != EOF) {
if ((s[2] * s[2]) == (s[0] * s[0]) + (s[1] * s[1])) {
r++;
}
if (s[0] == s[1]) {
d++;
}
}
printf("%d\n", r);
printf("%d\n", d);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164884/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164884/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d,%d,%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [3 x i32], align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %s) #3
%arrayidx1 = getelementptr inbounds [3 x i32], ptr %s, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [3 x i32], ptr %s, i64 0, i64 2
%call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2)
%cmp.not23 = icmp eq i32 %call22, -1
br i1 %cmp.not23, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%d.025 = phi i32 [ %d.1, %while.body ], [ 0, %entry ]
%r.024 = phi i32 [ %spec.select, %while.body ], [ 0, %entry ]
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%1 = load i32, ptr %s, align 4, !tbaa !5
%mul7 = mul nsw i32 %1, %1
%2 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%mul10 = mul nsw i32 %2, %2
%add = add nuw nsw i32 %mul10, %mul7
%cmp11 = icmp eq i32 %mul, %add
%inc = zext i1 %cmp11 to i32
%spec.select = add nuw nsw i32 %r.024, %inc
%cmp14 = icmp eq i32 %1, %2
%inc16 = zext i1 %cmp14 to i32
%d.1 = add nuw nsw i32 %d.025, %inc16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2)
%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
%r.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %while.body ]
%d.0.lcssa = phi i32 [ 0, %entry ], [ %d.1, %while.body ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %r.0.lcssa)
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %d.0.lcssa)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int x,y,z,tyo = 0,hisi = 0;
while(scanf("%d,%d,%d",&x,&y,&z) != EOF){
if(x*x + y*y == z*z) tyo++;
if(x == y) hisi++;
}
printf("%d\n%d\n",tyo,hisi);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164927/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164927/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"%d\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #3
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%cmp.not12 = icmp eq i32 %call11, -1
br i1 %cmp.not12, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%hisi.014 = phi i32 [ %hisi.1, %while.body ], [ 0, %entry ]
%tyo.013 = phi i32 [ %spec.select, %while.body ], [ 0, %entry ]
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%1 = load i32, ptr %y, align 4, !tbaa !5
%mul1 = mul nsw i32 %1, %1
%add = add nuw nsw i32 %mul1, %mul
%2 = load i32, ptr %z, align 4, !tbaa !5
%mul2 = mul nsw i32 %2, %2
%cmp3 = icmp eq i32 %add, %mul2
%inc = zext i1 %cmp3 to i32
%spec.select = add nuw nsw i32 %tyo.013, %inc
%cmp4 = icmp eq i32 %0, %1
%inc6 = zext i1 %cmp4 to i32
%hisi.1 = add nuw nsw i32 %hisi.014, %inc6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%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
%tyo.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %while.body ]
%hisi.0.lcssa = phi i32 [ 0, %entry ], [ %hisi.1, %while.body ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %tyo.0.lcssa, i32 noundef %hisi.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int a,b,c,x=0,y=0;
while(scanf("%d,%d,%d",&a,&b,&c)==3)
{
if(a==b&&c<a+b)
y++;
else if(c*c==a*a+b*b)
x++;
}
printf("%d\n%d\n",x,y);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164992/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164992/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"%d\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%cmp15 = icmp eq i32 %call14, 3
br i1 %cmp15, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end9
%y.017 = phi i32 [ %y.1, %if.end9 ], [ 0, %entry ]
%x.016 = phi i32 [ %x.1, %if.end9 ], [ 0, %entry ]
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, %1
%.pre = load i32, ptr %c, align 4, !tbaa !5
%add = shl nsw i32 %0, 1
%cmp2 = icmp slt i32 %.pre, %add
%or.cond = select i1 %cmp1, i1 %cmp2, i1 false
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %while.body
%inc = add nsw i32 %y.017, 1
br label %if.end9
if.else: ; preds = %while.body
%mul = mul nsw i32 %.pre, %.pre
%mul3 = mul nsw i32 %0, %0
%mul4 = mul nsw i32 %1, %1
%add5 = add nuw nsw i32 %mul4, %mul3
%cmp6 = icmp eq i32 %mul, %add5
%inc8 = zext i1 %cmp6 to i32
%spec.select = add nsw i32 %x.016, %inc8
br label %if.end9
if.end9: ; preds = %if.else, %if.then
%x.1 = phi i32 [ %x.016, %if.then ], [ %spec.select, %if.else ]
%y.1 = phi i32 [ %inc, %if.then ], [ %y.017, %if.else ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%cmp = icmp eq i32 %call, 3
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %if.end9, %entry
%x.0.lcssa = phi i32 [ 0, %entry ], [ %x.1, %if.end9 ]
%y.0.lcssa = phi i32 [ 0, %entry ], [ %y.1, %if.end9 ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %x.0.lcssa, i32 noundef %y.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int main(void) {
int w, h, r;
char c;
int hisi = 0;
int chohou = 0;
while(scanf("%d%c%d%c%d\n", &w, &c, &h, &c, &r)==5) {
if(w*w+h*h==r*r) {
chohou++;
} else if(w==h && (w+h)>r) {
hisi++;
}
}
printf("%d\n%d\n", chohou, hisi);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165041/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165041/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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%c%d%c%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%w = alloca i32, align 4
%h = alloca i32, align 4
%r = alloca i32, align 4
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #3
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %c, ptr noundef nonnull %h, ptr noundef nonnull %c, ptr noundef nonnull %r)
%cmp15 = icmp eq i32 %call14, 5
br i1 %cmp15, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end9
%chohou.017 = phi i32 [ %chohou.1, %if.end9 ], [ 0, %entry ]
%hisi.016 = phi i32 [ %hisi.1, %if.end9 ], [ 0, %entry ]
%0 = load i32, ptr %w, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%1 = load i32, ptr %h, align 4, !tbaa !5
%mul1 = mul nsw i32 %1, %1
%add = add nuw nsw i32 %mul1, %mul
%2 = load i32, ptr %r, align 4, !tbaa !5
%mul2 = mul nsw i32 %2, %2
%cmp3 = icmp eq i32 %add, %mul2
br i1 %cmp3, label %if.then, label %if.else
if.then: ; preds = %while.body
%inc = add nsw i32 %chohou.017, 1
br label %if.end9
if.else: ; preds = %while.body
%cmp4 = icmp eq i32 %0, %1
%add5 = add nsw i32 %1, %0
%cmp6 = icmp sgt i32 %add5, %2
%or.cond = select i1 %cmp4, i1 %cmp6, i1 false
%inc8 = zext i1 %or.cond to i32
%spec.select = add nsw i32 %hisi.016, %inc8
br label %if.end9
if.end9: ; preds = %if.else, %if.then
%hisi.1 = phi i32 [ %hisi.016, %if.then ], [ %spec.select, %if.else ]
%chohou.1 = phi i32 [ %inc, %if.then ], [ %chohou.017, %if.else ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %c, ptr noundef nonnull %h, ptr noundef nonnull %c, ptr noundef nonnull %r)
%cmp = icmp eq i32 %call, 5
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %if.end9, %entry
%hisi.0.lcssa = phi i32 [ 0, %entry ], [ %hisi.1, %if.end9 ]
%chohou.0.lcssa = phi i32 [ 0, %entry ], [ %chohou.1, %if.end9 ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %chohou.0.lcssa, i32 noundef %hisi.0.lcssa)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int h, w, n, max;
scanf("%d %d %d",&h,&w,&n);
max = (h > w) ? h : w;
printf("%d\n", (n + max - 1) / max);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165085/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165085/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w, ptr noundef nonnull %n)
%0 = load i32, ptr %h, align 4
%1 = load i32, ptr %w, align 4
%cond = call i32 @llvm.smax.i32(i32 %0, i32 %1)
%2 = load i32, ptr %n, align 4, !tbaa !5
%add = add i32 %cond, -1
%sub = add i32 %add, %2
%div = sdiv i32 %sub, %cond
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n,h,w,i=0;
scanf("%d %d %d",&h,&w,&n);
int a[h][w];
if(h>w)
{
do
{
i++;
}while(h*i<n);
}
else
{
do
{
i++;
}while(w*i<n);
}
printf("%d",i);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165128/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165128/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%h = alloca i32, align 4
%w = 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 %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w, ptr noundef nonnull %n)
%0 = call ptr @llvm.stacksave.p0()
%1 = load i32, ptr %h, align 4, !tbaa !5
%2 = load i32, ptr %w, align 4, !tbaa !5
%cmp = icmp sgt i32 %1, %2
%3 = load i32, ptr %n, align 4, !tbaa !5
br i1 %cmp, label %do.body.preheader, label %do.body2.preheader
do.body2.preheader: ; preds = %entry
%smax = call i32 @llvm.smax.i32(i32 %2, i32 %3)
%4 = icmp slt i32 %2, %3
%umin = zext i1 %4 to i32
%5 = add i32 %2, %umin
%6 = sub i32 %smax, %5
br label %if.end
do.body.preheader: ; preds = %entry
%smax15 = call i32 @llvm.smax.i32(i32 %1, i32 %3)
%7 = icmp slt i32 %1, %3
%umin16 = zext i1 %7 to i32
%8 = add i32 %1, %umin16
%9 = sub i32 %smax15, %8
br label %if.end
if.end: ; preds = %do.body2.preheader, %do.body.preheader
%.sink = phi i32 [ %2, %do.body2.preheader ], [ %1, %do.body.preheader ]
%.sink18 = phi i32 [ %6, %do.body2.preheader ], [ %9, %do.body.preheader ]
%umin.sink = phi i32 [ %umin, %do.body2.preheader ], [ %umin16, %do.body.preheader ]
%umax = call i32 @llvm.umax.i32(i32 %.sink, i32 1)
%10 = udiv i32 %.sink18, %umax
%11 = add i32 %10, %umin.sink
%i.2 = add i32 %11, 1
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.2)
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.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"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int m,n,k;
int max;
scanf("%d%d%d",&m,&n,&k);
if(m>=n)
max=m;
else
max=n;
if(k%max==0)
printf("%d",k/max);
else
printf("%d",k/max+1);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165171/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165171/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %m, align 4, !tbaa !5
%1 = load i32, ptr %n, align 4, !tbaa !5
%. = call i32 @llvm.smax.i32(i32 %0, i32 %1)
%2 = load i32, ptr %k, align 4, !tbaa !5
%rem = srem i32 %2, %.
%cmp1 = icmp ne i32 %rem, 0
%div = sdiv i32 %2, %.
%add = zext i1 %cmp1 to i32
%add.sink = add nsw i32 %div, %add
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
float max, min;
float h;
int i;
i = 0;
while (scanf("%f", &h) != EOF){
if (i == 0){
max = min = h;
i++;
}
if (max < h){
max = h;
}
else if (min > h){
min = h;
}
}
printf("%f\n", max - min);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165214/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165214/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%f\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca float, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h)
%cmp.not13 = icmp ne i32 %call12, -1
call void @llvm.assume(i1 %cmp.not13)
%0 = load float, ptr %h, align 4
%call.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h)
%cmp.not.peel = icmp eq i32 %call.peel, -1
br i1 %cmp.not.peel, label %while.end.loopexit, label %while.body
while.body: ; preds = %entry, %if.end7
%min.015 = phi float [ %min.2, %if.end7 ], [ %0, %entry ]
%max.014 = phi float [ %max.2, %if.end7 ], [ %0, %entry ]
%1 = load float, ptr %h, align 4
%cmp2 = fcmp olt float %max.014, %1
br i1 %cmp2, label %if.end7, label %if.else
if.else: ; preds = %while.body
%cmp4 = fcmp ogt float %min.015, %1
br i1 %cmp4, label %if.then5, label %if.end7
if.then5: ; preds = %if.else
br label %if.end7
if.end7: ; preds = %while.body, %if.else, %if.then5
%max.2 = phi float [ %max.014, %if.then5 ], [ %max.014, %if.else ], [ %1, %while.body ]
%min.2 = phi float [ %1, %if.then5 ], [ %min.015, %if.else ], [ %min.015, %while.body ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !5
while.end.loopexit: ; preds = %if.end7, %entry
%max.2.lcssa = phi float [ %0, %entry ], [ %max.2, %if.end7 ]
%min.2.lcssa = phi float [ %0, %entry ], [ %min.2, %if.end7 ]
%2 = fsub float %max.2.lcssa, %min.2.lcssa
%3 = fpext float %2 to double
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #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 willreturn memory(inaccessiblemem: 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 = distinct !{!5, !6, !7}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
int main(void){
double a[50]={0};
double max=0,min;
int i=1;
scanf("%lf",&a[0]);
min=a[0];
max=a[0];
while(scanf("%lf",&a[i]) != EOF){
if(max < a[i])
max=a[i];
if(min >a[i])
min=a[i];
i++;
}
printf("%f\n",max-min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165258/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165258/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [50 x double], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %a, i8 0, i64 400, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load double, ptr %a, align 16, !tbaa !5
%arrayidx326 = getelementptr inbounds [50 x double], ptr %a, i64 0, i64 1
%call427 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx326)
%cmp.not28 = icmp eq i32 %call427, -1
br i1 %cmp.not28, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 1, %entry ]
%arrayidx332 = phi ptr [ %arrayidx3, %while.body ], [ %arrayidx326, %entry ]
%min.030 = phi double [ %min.1, %while.body ], [ %0, %entry ]
%max.029 = phi double [ %max.1, %while.body ], [ %0, %entry ]
%1 = load double, ptr %arrayidx332, align 8, !tbaa !5
%cmp7 = fcmp olt double %max.029, %1
%max.1 = select i1 %cmp7, double %1, double %max.029
%cmp12 = fcmp ogt double %min.030, %1
%min.1 = select i1 %cmp12, double %1, double %min.030
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx3 = getelementptr inbounds [50 x double], ptr %a, i64 0, i64 %indvars.iv.next
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3)
%cmp.not = icmp eq i32 %call4, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%max.0.lcssa = phi double [ %0, %entry ], [ %max.1, %while.body ]
%min.0.lcssa = phi double [ %0, %entry ], [ %min.1, %while.body ]
%sub = fsub double %max.0.lcssa, %min.0.lcssa
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sub)
call void @llvm.lifetime.end.p0(i64 400, 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
double max,min,data;
max=min=-1;
while(scanf("%lf",&data)!=EOF){
if(min>data){
min=data;
}else if(max==-1&&min==-1){
max=min=data;
}else if(max<data){
max=data;
}
}
printf("%.1f\n",max-min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165308/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165308/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8] c"%.1f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%data = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %data) #3
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data)
%cmp.not16 = icmp eq i32 %call15, -1
br i1 %cmp.not16, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end9
%min.018 = phi double [ %min.1, %if.end9 ], [ -1.000000e+00, %entry ]
%max.017 = phi double [ %max.1, %if.end9 ], [ -1.000000e+00, %entry ]
%0 = load double, ptr %data, align 8, !tbaa !5
%cmp1 = fcmp ogt double %min.018, %0
br i1 %cmp1, label %if.end9, label %if.else
if.else: ; preds = %while.body
%cmp2 = fcmp oeq double %max.017, -1.000000e+00
%cmp3 = fcmp oeq double %min.018, -1.000000e+00
%or.cond = and i1 %cmp2, %cmp3
br i1 %or.cond, label %if.end9, label %if.else5
if.else5: ; preds = %if.else
%cmp6 = fcmp olt double %max.017, %0
br i1 %cmp6, label %if.then7, label %if.end9
if.then7: ; preds = %if.else5
br label %if.end9
if.end9: ; preds = %if.else, %while.body, %if.then7, %if.else5
%max.1 = phi double [ %0, %if.then7 ], [ %max.017, %if.else5 ], [ %max.017, %while.body ], [ %0, %if.else ]
%min.1 = phi double [ %min.018, %if.then7 ], [ %min.018, %if.else5 ], [ %0, %while.body ], [ %0, %if.else ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !9
while.end.loopexit: ; preds = %if.end9
%1 = fsub double %max.1, %min.1
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%sub = phi double [ 0.000000e+00, %entry ], [ %1, %while.end.loopexit ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sub)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %data) #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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
float hight;
float max, min;
float ans;
int count = 0;
while (scanf("%f", &hight) != EOF){
if (count == 0){
max = min = hight;
count++;
}
else {
if (hight > max){
max = hight;
}
if (hight < min){
min = hight;
}
}
}
ans = max - min;
printf("%.1f\n", ans);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165359/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165359/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%f\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%.1f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%hight = alloca float, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %hight) #4
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %hight)
%cmp.not14 = icmp ne i32 %call13, -1
call void @llvm.assume(i1 %cmp.not14)
%0 = load float, ptr %hight, align 4, !tbaa !5
%call.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %hight)
%cmp.not.peel = icmp eq i32 %call.peel, -1
br i1 %cmp.not.peel, label %while.end.loopexit, label %if.else
if.else: ; preds = %entry, %if.else
%max.016 = phi float [ %max.1, %if.else ], [ %0, %entry ]
%min.015 = phi float [ %min.1, %if.else ], [ %0, %entry ]
%1 = load float, ptr %hight, align 4, !tbaa !5
%cmp2 = fcmp ogt float %1, %max.016
%max.1 = select i1 %cmp2, float %1, float %max.016
%cmp4 = fcmp olt float %1, %min.015
%min.1 = select i1 %cmp4, float %1, float %min.015
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %hight)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end.loopexit, label %if.else, !llvm.loop !9
while.end.loopexit: ; preds = %if.else, %entry
%min.1.lcssa = phi float [ %0, %entry ], [ %min.1, %if.else ]
%max.2.lcssa = phi float [ %0, %entry ], [ %max.1, %if.else ]
%2 = fsub float %max.2.lcssa, %min.1.lcssa
%3 = fpext float %2 to double
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %hight) #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 willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #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 willreturn memory(inaccessiblemem: 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
int main(){
int h,w;
scanf("%d%d",&h,&w);
char s[51][51]={0};
for(int i=0; i<h; i++){ scanf("%s", s[i]); }
for(int i=0; i<h; i++){
for(int j=0; j<w; j++){
if( s[i][j] != '.' ){ continue; }
int cnt=0;
//上3か所
for(int u=j-1; u<=j+1; u++){
if( i-1 >= 0 && u >= 0 && s[i-1][u] == '#' ){ cnt++; }
}
//左
if( j-1 >= 0 && s[i][j-1] == '#' ){ cnt++; }
//右
if( j+1 >= 0 && s[i][j+1] == '#' ){ cnt++; }
//下3か所
for(int u=j-1; u<=j+1; u++){
if( i+1 >= 0 && u >= 0 && s[i+1][u] == '#' ){ cnt++; }
}
s[i][j] = 48+cnt;
}
printf("%s\n",s[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165430/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165430/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%s = alloca [51 x [51 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #6
%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 2601, ptr nonnull %s) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2601) %s, i8 0, i64 2601, i1 false)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp154 = icmp sgt i32 %0, 0
br i1 %cmp154, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp4169 = icmp sgt i32 %1, 0
br i1 %cmp4169, label %for.cond7.preheader.preheader, label %for.cond.cleanup5
for.cond7.preheader.preheader: ; preds = %for.cond3.preheader
%arrayidx65.peel = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 0, i64 1
br label %for.cond7.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %h, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond7.preheader: ; preds = %for.cond7.preheader.preheader, %for.cond.cleanup9
%indvars.iv195 = phi i64 [ 0, %for.cond7.preheader.preheader ], [ %indvars.iv.next196.pre-phi, %for.cond.cleanup9 ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp8161 = icmp sgt i32 %3, 0
br i1 %cmp8161, label %for.body10.lr.ph, label %for.cond7.preheader.for.cond.cleanup9_crit_edge
for.cond7.preheader.for.cond.cleanup9_crit_edge: ; preds = %for.cond7.preheader
%.pre200 = add nuw nsw i64 %indvars.iv195, 1
br label %for.cond.cleanup9
for.body10.lr.ph: ; preds = %for.cond7.preheader
%cmp23.not = icmp eq i64 %indvars.iv195, 0
%4 = add i64 %indvars.iv195, 4294967295
%idxprom29 = and i64 %4, 4294967295
%5 = add nuw nsw i64 %indvars.iv195, 1
%wide.trip.count192 = zext i32 %3 to i64
br i1 %cmp23.not, label %for.body10.preheader, label %for.body10.us.preheader
for.body10.us.preheader: ; preds = %for.body10.lr.ph
%arrayidx14.us.peel = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv195, i64 0
%6 = load i8, ptr %arrayidx14.us.peel, align 1, !tbaa !11
%cmp15.not.us.peel = icmp eq i8 %6, 46
br i1 %cmp15.not.us.peel, label %for.inc98.us.2.peel, label %for.inc107.us.peel
for.inc98.us.2.peel: ; preds = %for.body10.us.preheader
%arrayidx32.us.1.peel = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %idxprom29, i64 0
%7 = load i8, ptr %arrayidx32.us.1.peel, align 1, !tbaa !11
%cmp34.us.1.peel = icmp eq i8 %7, 35
%inc37.us.1.peel = zext i1 %cmp34.us.1.peel to i8
%arrayidx32.us.2.peel = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %idxprom29, i64 1
%8 = load i8, ptr %arrayidx32.us.2.peel, align 1, !tbaa !11
%cmp34.us.2.peel = icmp eq i8 %8, 35
%inc37.us.2.peel = zext i1 %cmp34.us.2.peel to i8
%spec.select.us.2.peel = add nuw nsw i8 %inc37.us.1.peel, %inc37.us.2.peel
%arrayidx65.us.peel = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv195, i64 1
%9 = load i8, ptr %arrayidx65.us.peel, align 1, !tbaa !11
%cmp67.us.peel = icmp eq i8 %9, 35
%inc70.us.peel = zext i1 %cmp67.us.peel to i8
%spec.select152.us.peel = add nuw nsw i8 %spec.select.us.2.peel, %inc70.us.peel
%arrayidx91.us.1.peel = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %5, i64 0
%10 = load i8, ptr %arrayidx91.us.1.peel, align 1, !tbaa !11
%cmp93.us.1.peel = icmp eq i8 %10, 35
%inc96.us.1.peel = zext i1 %cmp93.us.1.peel to i8
%spec.select153.us.1.peel = add nuw nsw i8 %spec.select152.us.peel, %inc96.us.1.peel
%arrayidx91.us.2.peel = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %5, i64 1
%11 = load i8, ptr %arrayidx91.us.2.peel, align 1, !tbaa !11
%cmp93.us.2.peel = icmp eq i8 %11, 35
%inc96.us.2.peel = zext i1 %cmp93.us.2.peel to i8
%spec.select153.us.2.peel = add nuw nsw i8 %spec.select153.us.1.peel, %inc96.us.2.peel
%conv102.us.peel = add nuw nsw i8 %spec.select153.us.2.peel, 48
store i8 %conv102.us.peel, ptr %arrayidx14.us.peel, align 1, !tbaa !11
br label %for.inc107.us.peel
for.inc107.us.peel: ; preds = %for.inc98.us.2.peel, %for.body10.us.preheader
%exitcond.peel.not = icmp eq i32 %3, 1
br i1 %exitcond.peel.not, label %for.cond.cleanup9, label %for.body10.us
for.body10.preheader: ; preds = %for.body10.lr.ph
%12 = load i8, ptr %s, align 16, !tbaa !11
%cmp15.not.peel = icmp eq i8 %12, 46
br i1 %cmp15.not.peel, label %for.inc98.2.peel, label %for.inc107.peel
for.inc98.2.peel: ; preds = %for.body10.preheader
%13 = load i8, ptr %arrayidx65.peel, align 1, !tbaa !11
%cmp67.peel = icmp eq i8 %13, 35
%inc70.peel = zext i1 %cmp67.peel to i8
%arrayidx91.1.peel = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %5, i64 0
%14 = load i8, ptr %arrayidx91.1.peel, align 1, !tbaa !11
%cmp93.1.peel = icmp eq i8 %14, 35
%inc96.1.peel = zext i1 %cmp93.1.peel to i8
%spec.select153.1.peel = add nuw nsw i8 %inc70.peel, %inc96.1.peel
%arrayidx91.2.peel = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %5, i64 1
%15 = load i8, ptr %arrayidx91.2.peel, align 1, !tbaa !11
%cmp93.2.peel = icmp eq i8 %15, 35
%inc96.2.peel = zext i1 %cmp93.2.peel to i8
%spec.select153.2.peel = add nuw nsw i8 %spec.select153.1.peel, %inc96.2.peel
%conv102.peel = or i8 %spec.select153.2.peel, 48
store i8 %conv102.peel, ptr %s, align 16, !tbaa !11
br label %for.inc107.peel
for.inc107.peel: ; preds = %for.inc98.2.peel, %for.body10.preheader
%exitcond193.peel.not = icmp eq i32 %3, 1
br i1 %exitcond193.peel.not, label %for.cond.cleanup9, label %for.body10
for.body10.us: ; preds = %for.inc107.us.peel, %for.inc107.us
%indvars.iv175 = phi i64 [ %indvars.iv.next176.pre-phi, %for.inc107.us ], [ 1, %for.inc107.us.peel ]
%arrayidx14.us = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv195, i64 %indvars.iv175
%16 = load i8, ptr %arrayidx14.us, align 1, !tbaa !11
%cmp15.not.us = icmp eq i8 %16, 46
br i1 %cmp15.not.us, label %for.inc98.us.2, label %for.body10.us.for.inc107.us_crit_edge
for.body10.us.for.inc107.us_crit_edge: ; preds = %for.body10.us
%.pre201 = add nuw nsw i64 %indvars.iv175, 1
br label %for.inc107.us
for.inc98.us.2: ; preds = %for.body10.us
%17 = add nsw i64 %indvars.iv175, -1
%idxprom31.us = and i64 %17, 4294967295
%arrayidx32.us = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %idxprom29, i64 %idxprom31.us
%18 = load i8, ptr %arrayidx32.us, align 1, !tbaa !11
%arrayidx32.us.1 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %idxprom29, i64 %indvars.iv175
%19 = add nuw nsw i64 %indvars.iv175, 1
%20 = load <2 x i8>, ptr %arrayidx32.us.1, align 1, !tbaa !11
%idxprom49.us = and i64 %17, 4294967295
%arrayidx50.us = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv195, i64 %idxprom49.us
%21 = load i8, ptr %arrayidx50.us, align 1, !tbaa !11
%arrayidx65.us = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv195, i64 %19
%22 = load i8, ptr %arrayidx65.us, align 1, !tbaa !11
%idxprom90.us = and i64 %17, 4294967295
%arrayidx91.us = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %5, i64 %idxprom90.us
%23 = load i8, ptr %arrayidx91.us, align 1, !tbaa !11
%arrayidx91.us.1 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %5, i64 %indvars.iv175
%24 = load <2 x i8>, ptr %arrayidx91.us.1, align 1, !tbaa !11
%25 = shufflevector <2 x i8> %20, <2 x i8> poison, <8 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%26 = insertelement <8 x i8> %25, i8 %18, i64 2
%27 = insertelement <8 x i8> %26, i8 %21, i64 3
%28 = insertelement <8 x i8> %27, i8 %23, i64 4
%29 = insertelement <8 x i8> %28, i8 %22, i64 5
%30 = shufflevector <2 x i8> %24, <2 x i8> poison, <8 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%31 = shufflevector <8 x i8> %29, <8 x i8> %30, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 8, i32 9>
%32 = icmp eq <8 x i8> %31, <i8 35, i8 35, i8 35, i8 35, i8 35, i8 35, i8 35, i8 35>
%33 = bitcast <8 x i1> %32 to i8
%34 = call i8 @llvm.ctpop.i8(i8 %33), !range !12
%op.rdx = or i8 %34, 48
store i8 %op.rdx, ptr %arrayidx14.us, align 1, !tbaa !11
br label %for.inc107.us
for.inc107.us: ; preds = %for.body10.us.for.inc107.us_crit_edge, %for.inc98.us.2
%indvars.iv.next176.pre-phi = phi i64 [ %.pre201, %for.body10.us.for.inc107.us_crit_edge ], [ %19, %for.inc98.us.2 ]
%exitcond.not = icmp eq i64 %indvars.iv.next176.pre-phi, %wide.trip.count192
br i1 %exitcond.not, label %for.cond.cleanup9, label %for.body10.us, !llvm.loop !13
for.cond.cleanup5: ; preds = %for.cond.cleanup9, %entry, %for.cond3.preheader
call void @llvm.lifetime.end.p0(i64 2601, ptr nonnull %s) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
ret i32 0
for.cond.cleanup9: ; preds = %for.inc107.us, %for.inc107, %for.inc107.us.peel, %for.inc107.peel, %for.cond7.preheader.for.cond.cleanup9_crit_edge
%indvars.iv.next196.pre-phi = phi i64 [ %.pre200, %for.cond7.preheader.for.cond.cleanup9_crit_edge ], [ 1, %for.inc107.peel ], [ %5, %for.inc107.us.peel ], [ %5, %for.inc107 ], [ %5, %for.inc107.us ]
%arrayidx111 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv195
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx111)
%35 = load i32, ptr %h, align 4, !tbaa !5
%36 = sext i32 %35 to i64
%cmp4 = icmp slt i64 %indvars.iv.next196.pre-phi, %36
br i1 %cmp4, label %for.cond7.preheader, label %for.cond.cleanup5, !llvm.loop !15
for.body10: ; preds = %for.inc107.peel, %for.inc107
%indvars.iv186 = phi i64 [ %indvars.iv.next187.pre-phi, %for.inc107 ], [ 1, %for.inc107.peel ]
%arrayidx14 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 0, i64 %indvars.iv186
%37 = load i8, ptr %arrayidx14, align 1, !tbaa !11
%cmp15.not = icmp eq i8 %37, 46
br i1 %cmp15.not, label %for.inc98.2, label %for.body10.for.inc107_crit_edge
for.body10.for.inc107_crit_edge: ; preds = %for.body10
%.pre = add nuw nsw i64 %indvars.iv186, 1
br label %for.inc107
for.inc98.2: ; preds = %for.body10
%38 = add nsw i64 %indvars.iv186, -1
%39 = add nuw nsw i64 %indvars.iv186, 1
%idxprom49 = and i64 %38, 4294967295
%arrayidx50 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 0, i64 %idxprom49
%40 = load i8, ptr %arrayidx50, align 1, !tbaa !11
%cmp52 = icmp eq i8 %40, 35
%inc55 = zext i1 %cmp52 to i8
%arrayidx65 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 0, i64 %39
%41 = load i8, ptr %arrayidx65, align 1, !tbaa !11
%cmp67 = icmp eq i8 %41, 35
%inc70 = zext i1 %cmp67 to i8
%spec.select152 = add nuw nsw i8 %inc55, %inc70
%idxprom90 = and i64 %38, 4294967295
%arrayidx91 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %5, i64 %idxprom90
%42 = load i8, ptr %arrayidx91, align 1, !tbaa !11
%cmp93 = icmp eq i8 %42, 35
%inc96 = zext i1 %cmp93 to i8
%spec.select153 = add nuw nsw i8 %spec.select152, %inc96
%arrayidx91.1 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %5, i64 %indvars.iv186
%43 = load i8, ptr %arrayidx91.1, align 1, !tbaa !11
%cmp93.1 = icmp eq i8 %43, 35
%inc96.1 = zext i1 %cmp93.1 to i8
%spec.select153.1 = add nuw nsw i8 %spec.select153, %inc96.1
%arrayidx91.2 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %5, i64 %39
%44 = load i8, ptr %arrayidx91.2, align 1, !tbaa !11
%cmp93.2 = icmp eq i8 %44, 35
%inc96.2 = zext i1 %cmp93.2 to i8
%spec.select153.2 = add nuw nsw i8 %spec.select153.1, %inc96.2
%conv102 = add nuw nsw i8 %spec.select153.2, 48
store i8 %conv102, ptr %arrayidx14, align 1, !tbaa !11
br label %for.inc107
for.inc107: ; preds = %for.body10.for.inc107_crit_edge, %for.inc98.2
%indvars.iv.next187.pre-phi = phi i64 [ %.pre, %for.body10.for.inc107_crit_edge ], [ %39, %for.inc98.2 ]
%exitcond193.not = icmp eq i64 %indvars.iv.next187.pre-phi, %wide.trip.count192
br i1 %exitcond193.not, label %for.cond.cleanup9, label %for.body10, !llvm.loop !16
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.ctpop.i8(i8) #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 nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = !{i8 0, i8 9}
!13 = distinct !{!13, !10, !14}
!14 = !{!"llvm.loop.peeled.count", i32 1}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !14}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define BUF_SIZE 52
struct point {
int x;
int y;
};
struct point dir[8] = {
{-1, -1}, {-1, 0}, {-1, 1},
{0, -1} , {0, 1},
{1, -1}, {1, 0}, {1, 1}
};
int main(void) {
char line[BUF_SIZE];
FILE *fp = stdin;
if(!fgets(line, BUF_SIZE, fp)) return 0;
int row, col;
sscanf(line, "%d %d", &row, &col);
int mat[BUF_SIZE][BUF_SIZE] = {0};
int i, j;
for(i = 1; i <= row; i++) {
if(!fgets(line, BUF_SIZE, fp)) return 0;
char* tmp;
int s;
for(tmp = line, s = 1; *tmp != '\n'; tmp++, s++) {
if(*tmp == '#') {
mat[i][s] = -51;
for(j = 0; j < 8; j++) {
mat[i+dir[j].x][s+dir[j].y]++;
}
}
}
}
for(i = 1; i <= row; i++) {
for(j = 1; j <= col; j++) {
char ch = mat[i][j] < 0 ? '#' : '0'+mat[i][j];
putchar(ch);
}
putchar('\n');
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165481/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165481/source.c"
target datalayout = "e-m:e-p270: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.point = type { i32, i32 }
@dir = dso_local local_unnamed_addr global [8 x %struct.point] [%struct.point { i32 -1, i32 -1 }, %struct.point { i32 -1, i32 0 }, %struct.point { i32 -1, i32 1 }, %struct.point { i32 0, i32 -1 }, %struct.point { i32 0, i32 1 }, %struct.point { i32 1, i32 -1 }, %struct.point { i32 1, i32 0 }, %struct.point { i32 1, i32 1 }], align 16
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%line = alloca [52 x i8], align 16
%row = alloca i32, align 4
%col = alloca i32, align 4
%mat = alloca [52 x [52 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 52, ptr nonnull %line) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %line, i32 noundef 52, ptr noundef %0)
%tobool.not = icmp eq ptr %call, null
br i1 %tobool.not, label %cleanup73, label %if.end
if.end: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %row) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %col) #4
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line, ptr noundef nonnull @.str, ptr noundef nonnull %row, ptr noundef nonnull %col) #4
call void @llvm.lifetime.start.p0(i64 10816, ptr nonnull %mat) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(10816) %mat, i8 0, i64 10816, i1 false)
%1 = load i32, ptr %row, align 4, !tbaa !9
%cmp.not97 = icmp slt i32 %1, 1
br i1 %cmp.not97, label %cleanup, label %for.body
for.cond40.preheader: ; preds = %for.end36
%2 = icmp slt i32 %30, 1
br i1 %2, label %cleanup, label %for.cond44.preheader
for.body: ; preds = %if.end, %for.end36
%indvars.iv106 = phi i64 [ %indvars.iv.next107, %for.end36 ], [ 1, %if.end ]
%call4 = call ptr @fgets(ptr noundef nonnull %line, i32 noundef 52, ptr noundef %0)
%tobool5.not = icmp eq ptr %call4, null
br i1 %tobool5.not, label %cleanup, label %for.cond9.preheader
for.cond9.preheader: ; preds = %for.body
%3 = load i32, ptr @dir, align 16
%4 = trunc i64 %indvars.iv106 to i32
%add = add nsw i32 %3, %4
%idxprom25 = sext i32 %add to i64
%5 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 0, i32 1), align 4
%6 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 1), align 8
%add.1 = add nsw i32 %6, %4
%idxprom25.1 = sext i32 %add.1 to i64
%7 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 1, i32 1), align 4
%8 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 2), align 16
%add.2 = add nsw i32 %8, %4
%idxprom25.2 = sext i32 %add.2 to i64
%9 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 2, i32 1), align 4
%10 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 3), align 8
%add.3 = add nsw i32 %10, %4
%idxprom25.3 = sext i32 %add.3 to i64
%11 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 3, i32 1), align 4
%12 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 4), align 16
%add.4 = add nsw i32 %12, %4
%idxprom25.4 = sext i32 %add.4 to i64
%13 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 4, i32 1), align 4
%14 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 5), align 8
%add.5 = add nsw i32 %14, %4
%idxprom25.5 = sext i32 %add.5 to i64
%15 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 5, i32 1), align 4
%16 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 6), align 16
%add.6 = add nsw i32 %16, %4
%idxprom25.6 = sext i32 %add.6 to i64
%17 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 6, i32 1), align 4
%18 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 7), align 8
%add.7 = add nsw i32 %18, %4
%idxprom25.7 = sext i32 %add.7 to i64
%19 = load i32, ptr getelementptr inbounds ([8 x %struct.point], ptr @dir, i64 0, i64 7, i32 1), align 4
br label %for.cond9
for.cond9: ; preds = %for.cond9.preheader, %for.inc34
%indvars.iv = phi i64 [ 1, %for.cond9.preheader ], [ %indvars.iv.next, %for.inc34 ]
%tmp.0 = phi ptr [ %line, %for.cond9.preheader ], [ %incdec.ptr, %for.inc34 ]
%20 = load i8, ptr %tmp.0, align 1, !tbaa !11
switch i8 %20, label %for.inc34 [
i8 10, label %for.end36
i8 35, label %if.then16
]
if.then16: ; preds = %for.cond9
%arrayidx18 = getelementptr inbounds [52 x [52 x i32]], ptr %mat, i64 0, i64 %indvars.iv106, i64 %indvars.iv
store i32 -51, ptr %arrayidx18, align 4, !tbaa !9
%21 = trunc i64 %indvars.iv to i32
%add29 = add nsw i32 %5, %21
%idxprom30 = sext i32 %add29 to i64
%arrayidx31 = getelementptr inbounds [52 x [52 x i32]], ptr %mat, i64 0, i64 %idxprom25, i64 %idxprom30
%22 = load i32, ptr %arrayidx31, align 4, !tbaa !9
%inc = add nsw i32 %22, 1
store i32 %inc, ptr %arrayidx31, align 4, !tbaa !9
%add29.1 = add nsw i32 %7, %21
%idxprom30.1 = sext i32 %add29.1 to i64
%arrayidx31.1 = getelementptr inbounds [52 x [52 x i32]], ptr %mat, i64 0, i64 %idxprom25.1, i64 %idxprom30.1
%23 = load i32, ptr %arrayidx31.1, align 4, !tbaa !9
%inc.1 = add nsw i32 %23, 1
store i32 %inc.1, ptr %arrayidx31.1, align 4, !tbaa !9
%add29.2 = add nsw i32 %9, %21
%idxprom30.2 = sext i32 %add29.2 to i64
%arrayidx31.2 = getelementptr inbounds [52 x [52 x i32]], ptr %mat, i64 0, i64 %idxprom25.2, i64 %idxprom30.2
%24 = load i32, ptr %arrayidx31.2, align 4, !tbaa !9
%inc.2 = add nsw i32 %24, 1
store i32 %inc.2, ptr %arrayidx31.2, align 4, !tbaa !9
%add29.3 = add nsw i32 %11, %21
%idxprom30.3 = sext i32 %add29.3 to i64
%arrayidx31.3 = getelementptr inbounds [52 x [52 x i32]], ptr %mat, i64 0, i64 %idxprom25.3, i64 %idxprom30.3
%25 = load i32, ptr %arrayidx31.3, align 4, !tbaa !9
%inc.3 = add nsw i32 %25, 1
store i32 %inc.3, ptr %arrayidx31.3, align 4, !tbaa !9
%add29.4 = add nsw i32 %13, %21
%idxprom30.4 = sext i32 %add29.4 to i64
%arrayidx31.4 = getelementptr inbounds [52 x [52 x i32]], ptr %mat, i64 0, i64 %idxprom25.4, i64 %idxprom30.4
%26 = load i32, ptr %arrayidx31.4, align 4, !tbaa !9
%inc.4 = add nsw i32 %26, 1
store i32 %inc.4, ptr %arrayidx31.4, align 4, !tbaa !9
%add29.5 = add nsw i32 %15, %21
%idxprom30.5 = sext i32 %add29.5 to i64
%arrayidx31.5 = getelementptr inbounds [52 x [52 x i32]], ptr %mat, i64 0, i64 %idxprom25.5, i64 %idxprom30.5
%27 = load i32, ptr %arrayidx31.5, align 4, !tbaa !9
%inc.5 = add nsw i32 %27, 1
store i32 %inc.5, ptr %arrayidx31.5, align 4, !tbaa !9
%add29.6 = add nsw i32 %17, %21
%idxprom30.6 = sext i32 %add29.6 to i64
%arrayidx31.6 = getelementptr inbounds [52 x [52 x i32]], ptr %mat, i64 0, i64 %idxprom25.6, i64 %idxprom30.6
%28 = load i32, ptr %arrayidx31.6, align 4, !tbaa !9
%inc.6 = add nsw i32 %28, 1
store i32 %inc.6, ptr %arrayidx31.6, align 4, !tbaa !9
%add29.7 = add nsw i32 %19, %21
%idxprom30.7 = sext i32 %add29.7 to i64
%arrayidx31.7 = getelementptr inbounds [52 x [52 x i32]], ptr %mat, i64 0, i64 %idxprom25.7, i64 %idxprom30.7
%29 = load i32, ptr %arrayidx31.7, align 4, !tbaa !9
%inc.7 = add nsw i32 %29, 1
store i32 %inc.7, ptr %arrayidx31.7, align 4, !tbaa !9
br label %for.inc34
for.inc34: ; preds = %if.then16, %for.cond9
%incdec.ptr = getelementptr inbounds i8, ptr %tmp.0, i64 1
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br label %for.cond9, !llvm.loop !12
for.end36: ; preds = %for.cond9
%indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
%30 = load i32, ptr %row, align 4, !tbaa !9
%31 = sext i32 %30 to i64
%cmp.not.not = icmp slt i64 %indvars.iv106, %31
br i1 %cmp.not.not, label %for.body, label %for.cond40.preheader, !llvm.loop !14
for.cond44.preheader: ; preds = %for.cond40.preheader, %for.end64
%indvars.iv112 = phi i64 [ %indvars.iv.next113, %for.end64 ], [ 1, %for.cond40.preheader ]
%32 = load i32, ptr %col, align 4, !tbaa !9
%cmp45.not99 = icmp slt i32 %32, 1
br i1 %cmp45.not99, label %for.end64, label %for.body47
for.body47: ; preds = %for.cond44.preheader, %for.body47
%indvars.iv109 = phi i64 [ %indvars.iv.next110, %for.body47 ], [ 1, %for.cond44.preheader ]
%arrayidx51 = getelementptr inbounds [52 x [52 x i32]], ptr %mat, i64 0, i64 %indvars.iv112, i64 %indvars.iv109
%33 = load i32, ptr %arrayidx51, align 4, !tbaa !9
%cmp52 = icmp slt i32 %33, 0
%add58 = shl i32 %33, 24
%34 = add i32 %add58, 805306368
%35 = ashr exact i32 %34, 24
%conv60 = select i1 %cmp52, i32 35, i32 %35
%36 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i = call i32 @putc(i32 noundef %conv60, ptr noundef %36)
%indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
%37 = load i32, ptr %col, align 4, !tbaa !9
%38 = sext i32 %37 to i64
%cmp45.not.not = icmp slt i64 %indvars.iv109, %38
br i1 %cmp45.not.not, label %for.body47, label %for.end64, !llvm.loop !15
for.end64: ; preds = %for.body47, %for.cond44.preheader
%39 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i94 = call i32 @putc(i32 noundef 10, ptr noundef %39)
%indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
%40 = load i32, ptr %row, align 4, !tbaa !9
%41 = sext i32 %40 to i64
%cmp41.not.not = icmp slt i64 %indvars.iv112, %41
br i1 %cmp41.not.not, label %for.cond44.preheader, label %cleanup, !llvm.loop !16
cleanup: ; preds = %for.body, %for.end64, %if.end, %for.cond40.preheader
call void @llvm.lifetime.end.p0(i64 10816, ptr nonnull %mat) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %col) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %row) #4
br label %cleanup73
cleanup73: ; preds = %entry, %cleanup
call void @llvm.lifetime.end.p0(i64 52, ptr nonnull %line) #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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
|
#include <stdio.h>
#define MAXH 50
#define MAXW 50
int main(void){
int h, w;
scanf("%d %d", &h, &w);
char s[MAXH][MAXW + 1];
for(int i = 0; i < h; i++){
scanf("%s", s[i]);
}
int mine;
for(int i = 0; i < h; i++){
for(int j = 0; s[i][j] !='\0'; j++){
if(s[i][j] == '.'){
mine = 0;
for(int k = i - 1; k < i + 2; k++){
if(k < 0 || k >= h ) continue;
for(int l = j - 1; l < j + 2; l++){
if(l < 0 || l >= w || (k == i && l == j)) continue;
if(s[k][l] == '#') mine++;
}
}
s[i][j] = '0' + mine;
}
}
}
for(int i = 0; i < h; i++){
printf("%s\n", s[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165531/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165531/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%s = alloca [50 x [51 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
call void @llvm.lifetime.start.p0(i64 2550, ptr nonnull %s) #5
%0 = load i32, ptr %h, align 4
%cmp124 = icmp sgt i32 %0, 0
br i1 %cmp124, label %for.body, label %for.cond.cleanup85
for.cond3.preheader: ; preds = %for.body
%cmp4130 = icmp sgt i32 %4, 0
br i1 %cmp4130, label %for.cond7.preheader.lr.ph, label %for.cond.cleanup85
for.cond7.preheader.lr.ph: ; preds = %for.cond3.preheader
%1 = load i32, ptr %w, align 4
%2 = sext i32 %1 to i64
%3 = zext i32 %4 to i64
%wide.trip.count = zext i32 %4 to i64
br label %for.cond7.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %h, align 4
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !5
for.cond7.preheader: ; preds = %for.cond7.preheader.lr.ph, %for.cond.cleanup14
%indvars.iv197 = phi i64 [ 0, %for.cond7.preheader.lr.ph ], [ %indvars.iv.next198, %for.cond.cleanup14 ]
%cmp28.not = icmp eq i64 %indvars.iv197, 0
%6 = add nuw i64 %indvars.iv197, 4294967295
%idxprom52 = and i64 %6, 4294967295
%7 = add nuw nsw i64 %indvars.iv197, 1
%cmp30.not.2 = icmp ult i64 %7, %3
br label %for.cond7
for.cond82.preheader: ; preds = %for.cond.cleanup14
br i1 %cmp4130, label %for.body86, label %for.cond.cleanup85
for.cond7: ; preds = %for.cond7.preheader, %for.inc75
%indvars.iv187 = phi i64 [ 0, %for.cond7.preheader ], [ %indvars.iv.next188, %for.inc75 ]
%indvars.iv139 = phi i32 [ 2, %for.cond7.preheader ], [ %indvars.iv.next140, %for.inc75 ]
%8 = trunc i64 %indvars.iv187 to i32
%smax141 = call i32 @llvm.smax.i32(i32 %indvars.iv139, i32 %8)
%arrayidx11 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv197, i64 %indvars.iv187
%9 = load i8, ptr %arrayidx11, align 1, !tbaa !7
switch i8 %9, label %for.inc75 [
i8 0, label %for.cond.cleanup14
i8 46, label %if.then
]
for.cond.cleanup14: ; preds = %for.cond7
%indvars.iv.next198 = add nuw nsw i64 %indvars.iv197, 1
%exitcond202.not = icmp eq i64 %indvars.iv.next198, %wide.trip.count
br i1 %exitcond202.not, label %for.cond82.preheader, label %for.cond7.preheader, !llvm.loop !10
if.then: ; preds = %for.cond7
%10 = add nsw i64 %indvars.iv187, -1
br i1 %cmp28.not, label %for.body39.preheader.1, label %for.body39.us.preheader
for.body39.us.preheader: ; preds = %if.then
%cmp40.us = icmp sgt i64 %indvars.iv187, 0
%cmp43.not.us = icmp sle i64 %indvars.iv187, %2
%or.cond122.us = select i1 %cmp40.us, i1 %cmp43.not.us, i1 false
br i1 %or.cond122.us, label %lor.lhs.false45.us, label %for.inc62.us
lor.lhs.false45.us: ; preds = %for.body39.us.preheader
%idxprom54.us = and i64 %10, 4294967295
%arrayidx55.us = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %idxprom52, i64 %idxprom54.us
%11 = load i8, ptr %arrayidx55.us, align 1, !tbaa !7
%cmp57.us = icmp eq i8 %11, 35
%inc60.us = zext i1 %cmp57.us to i8
br label %for.inc62.us
for.inc62.us: ; preds = %lor.lhs.false45.us, %for.body39.us.preheader
%mine.2.us = phi i8 [ 0, %for.body39.us.preheader ], [ %inc60.us, %lor.lhs.false45.us ]
%12 = zext i32 %smax141 to i64
%exitcond.not = icmp eq i64 %indvars.iv187, %12
br i1 %exitcond.not, label %for.body39.preheader.1, label %for.body39.us.1, !llvm.loop !11
for.body39.us.1: ; preds = %for.inc62.us
%cmp43.not.us.1 = icmp slt i64 %indvars.iv187, %2
br i1 %cmp43.not.us.1, label %lor.lhs.false45.us.1, label %for.inc62.us.1
lor.lhs.false45.us.1: ; preds = %for.body39.us.1
%arrayidx55.us.1 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %idxprom52, i64 %indvars.iv187
%13 = load i8, ptr %arrayidx55.us.1, align 1, !tbaa !7
%cmp57.us.1 = icmp eq i8 %13, 35
%inc60.us.1 = zext i1 %cmp57.us.1 to i8
%spec.select.us.1 = add nuw nsw i8 %mine.2.us, %inc60.us.1
br label %for.inc62.us.1
for.inc62.us.1: ; preds = %lor.lhs.false45.us.1, %for.body39.us.1
%mine.2.us.1 = phi i8 [ %mine.2.us, %for.body39.us.1 ], [ %spec.select.us.1, %lor.lhs.false45.us.1 ]
%14 = add nuw nsw i64 %indvars.iv187, 1
%15 = trunc i64 %14 to i32
%cmp40.us.2 = icmp sgt i32 %15, -1
%cmp43.not.us.2 = icmp sgt i32 %1, %15
%or.cond122.us.2 = select i1 %cmp40.us.2, i1 %cmp43.not.us.2, i1 false
br i1 %or.cond122.us.2, label %lor.lhs.false45.us.2, label %for.body39.preheader.1
lor.lhs.false45.us.2: ; preds = %for.inc62.us.1
%arrayidx55.us.2 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %idxprom52, i64 %14
%16 = load i8, ptr %arrayidx55.us.2, align 1, !tbaa !7
%cmp57.us.2 = icmp eq i8 %16, 35
%inc60.us.2 = zext i1 %cmp57.us.2 to i8
%spec.select.us.2 = add nuw nsw i8 %mine.2.us.1, %inc60.us.2
br label %for.body39.preheader.1
for.body39.preheader.1: ; preds = %for.inc62.us, %lor.lhs.false45.us.2, %for.inc62.us.1, %if.then
%mine.3 = phi i8 [ 0, %if.then ], [ %mine.2.us, %for.inc62.us ], [ %mine.2.us.1, %for.inc62.us.1 ], [ %spec.select.us.2, %lor.lhs.false45.us.2 ]
%cmp40.1 = icmp slt i64 %indvars.iv187, 1
%cmp43.not.1 = icmp sgt i64 %indvars.iv187, %2
%or.cond122.not135.1 = select i1 %cmp40.1, i1 true, i1 %cmp43.not.1
br i1 %or.cond122.not135.1, label %for.inc62.1166, label %if.end51.1164
if.end51.1164: ; preds = %for.body39.preheader.1
%idxprom54.1159 = and i64 %10, 4294967295
%arrayidx55.1160 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv197, i64 %idxprom54.1159
%17 = load i8, ptr %arrayidx55.1160, align 1, !tbaa !7
%cmp57.1161 = icmp eq i8 %17, 35
%inc60.1162 = zext i1 %cmp57.1161 to i8
%spec.select.1163 = add nuw nsw i8 %mine.3, %inc60.1162
br label %for.inc62.1166
for.inc62.1166: ; preds = %if.end51.1164, %for.body39.preheader.1
%mine.2.1165 = phi i8 [ %mine.3, %for.body39.preheader.1 ], [ %spec.select.1163, %if.end51.1164 ]
%18 = zext i32 %smax141 to i64
%exitcond142.1.not = icmp eq i64 %indvars.iv187, %18
br i1 %exitcond142.1.not, label %for.inc65.1, label %for.inc62.1.1, !llvm.loop !11
for.inc62.1.1: ; preds = %for.inc62.1166
%19 = add nuw nsw i64 %indvars.iv187, 1
%20 = trunc i64 %19 to i32
%cmp43.not.2.1.not = icmp sgt i32 %1, %20
br i1 %cmp43.not.2.1.not, label %if.end51.2.1, label %for.inc65.1
if.end51.2.1: ; preds = %for.inc62.1.1
%arrayidx55.2.1 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv197, i64 %19
%21 = load i8, ptr %arrayidx55.2.1, align 1, !tbaa !7
%cmp57.2.1 = icmp eq i8 %21, 35
%inc60.2.1 = zext i1 %cmp57.2.1 to i8
%spec.select.2.1 = add nuw nsw i8 %mine.2.1165, %inc60.2.1
br label %for.inc65.1
for.inc65.1: ; preds = %for.inc62.1166, %if.end51.2.1, %for.inc62.1.1
%mine.2.lcssa.1 = phi i8 [ %mine.2.1165, %for.inc62.1166 ], [ %mine.2.1165, %for.inc62.1.1 ], [ %spec.select.2.1, %if.end51.2.1 ]
br i1 %cmp30.not.2, label %for.body39.us.preheader.2, label %for.inc65.2
for.body39.us.preheader.2: ; preds = %for.inc65.1
%cmp40.us.2167 = icmp sgt i64 %indvars.iv187, 0
%cmp43.not.us.2168 = icmp sle i64 %indvars.iv187, %2
%or.cond122.us.2169 = select i1 %cmp40.us.2167, i1 %cmp43.not.us.2168, i1 false
br i1 %or.cond122.us.2169, label %lor.lhs.false45.us.2175, label %for.inc62.us.2177
lor.lhs.false45.us.2175: ; preds = %for.body39.us.preheader.2
%idxprom54.us.2170 = and i64 %10, 4294967295
%arrayidx55.us.2171 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %7, i64 %idxprom54.us.2170
%22 = load i8, ptr %arrayidx55.us.2171, align 1, !tbaa !7
%cmp57.us.2172 = icmp eq i8 %22, 35
%inc60.us.2173 = zext i1 %cmp57.us.2172 to i8
%spec.select.us.2174 = add nuw nsw i8 %mine.2.lcssa.1, %inc60.us.2173
br label %for.inc62.us.2177
for.inc62.us.2177: ; preds = %lor.lhs.false45.us.2175, %for.body39.us.preheader.2
%mine.2.us.2176 = phi i8 [ %mine.2.lcssa.1, %for.body39.us.preheader.2 ], [ %spec.select.us.2174, %lor.lhs.false45.us.2175 ]
%23 = zext i32 %smax141 to i64
%exitcond.2.not = icmp eq i64 %indvars.iv187, %23
br i1 %exitcond.2.not, label %for.inc65.2, label %for.body39.us.1.2, !llvm.loop !11
for.body39.us.1.2: ; preds = %for.inc62.us.2177
%cmp43.not.us.1.2 = icmp slt i64 %indvars.iv187, %2
br i1 %cmp43.not.us.1.2, label %lor.lhs.false45.us.1.2, label %for.inc62.us.1.2
lor.lhs.false45.us.1.2: ; preds = %for.body39.us.1.2
%arrayidx55.us.1.2 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %7, i64 %indvars.iv187
%24 = load i8, ptr %arrayidx55.us.1.2, align 1, !tbaa !7
%cmp57.us.1.2 = icmp eq i8 %24, 35
%inc60.us.1.2 = zext i1 %cmp57.us.1.2 to i8
%spec.select.us.1.2 = add nuw nsw i8 %mine.2.us.2176, %inc60.us.1.2
br label %for.inc62.us.1.2
for.inc62.us.1.2: ; preds = %lor.lhs.false45.us.1.2, %for.body39.us.1.2
%mine.2.us.1.2 = phi i8 [ %mine.2.us.2176, %for.body39.us.1.2 ], [ %spec.select.us.1.2, %lor.lhs.false45.us.1.2 ]
%25 = add nuw nsw i64 %indvars.iv187, 1
%26 = trunc i64 %25 to i32
%cmp40.us.2.2 = icmp sgt i32 %26, -1
%cmp43.not.us.2.2 = icmp sgt i32 %1, %26
%or.cond122.us.2.2 = select i1 %cmp40.us.2.2, i1 %cmp43.not.us.2.2, i1 false
br i1 %or.cond122.us.2.2, label %lor.lhs.false45.us.2.2, label %for.inc65.2
lor.lhs.false45.us.2.2: ; preds = %for.inc62.us.1.2
%arrayidx55.us.2.2 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %7, i64 %25
%27 = load i8, ptr %arrayidx55.us.2.2, align 1, !tbaa !7
%cmp57.us.2.2 = icmp eq i8 %27, 35
%inc60.us.2.2 = zext i1 %cmp57.us.2.2 to i8
%spec.select.us.2.2 = add nuw nsw i8 %mine.2.us.1.2, %inc60.us.2.2
br label %for.inc65.2
for.inc65.2: ; preds = %for.inc62.us.2177, %lor.lhs.false45.us.2.2, %for.inc62.us.1.2, %for.inc65.1
%mine.3.2 = phi i8 [ %mine.2.lcssa.1, %for.inc65.1 ], [ %mine.2.us.2176, %for.inc62.us.2177 ], [ %mine.2.us.1.2, %for.inc62.us.1.2 ], [ %spec.select.us.2.2, %lor.lhs.false45.us.2.2 ]
%conv69 = add nuw nsw i8 %mine.3.2, 48
store i8 %conv69, ptr %arrayidx11, align 1, !tbaa !7
br label %for.inc75
for.inc75: ; preds = %for.cond7, %for.inc65.2
%indvars.iv.next188 = add nuw i64 %indvars.iv187, 1
%indvars.iv.next140 = add i32 %indvars.iv139, 1
br label %for.cond7, !llvm.loop !12
for.cond.cleanup85: ; preds = %for.body86, %entry, %for.cond3.preheader, %for.cond82.preheader
call void @llvm.lifetime.end.p0(i64 2550, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
ret i32 0
for.body86: ; preds = %for.cond82.preheader, %for.body86
%indvars.iv203 = phi i64 [ %indvars.iv.next204, %for.body86 ], [ 0, %for.cond82.preheader ]
%arrayidx88 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv203
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx88)
%indvars.iv.next204 = add nuw nsw i64 %indvars.iv203, 1
%28 = load i32, ptr %h, align 4, !tbaa !13
%29 = sext i32 %28 to i64
%cmp83 = icmp slt i64 %indvars.iv.next204, %29
br i1 %cmp83, label %for.body86, label %for.cond.cleanup85, !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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = distinct !{!10, !6}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !8, i64 0}
!15 = distinct !{!15, !6}
|
#include <stdio.h>
#define BOMB '#'
struct board {
int h;
int w;
char board[50][51];
};
struct board b = {
0,
0,
{}
};
int is_bomb(int y, int x)
{
if (b.board[y][x] == BOMB) {
return 1;
}
return 0;
}
int bomb_cnt(int y, int x)
{
int d[8][2] = {
{-1, -1},
{-1, 0},
{-1, 1},
{0, -1},
{0, 1},
{1, -1},
{1, 0},
{1, 1},
};
int cnt = 0;
for (int i = 0; i < 8; ++i) {
int dy = y + d[i][0];
int dx = x + d[i][1];
if (dy < 0 || dy > b.h || dx < 0 || dx > b.w) {
continue;
}
if (is_bomb(dy, dx)) {
cnt++;
}
}
return cnt;
}
int main(int argc, char const *argv[])
{
scanf("%d %d", &b.h, &b.w);
for (int i = 0; i < b.h; ++i) {
scanf("%s", b.board[i]);
}
struct board n = {
b.h,
b.w,
{}
};
for (int i = 0; i < b.h; ++i) {
for (int j = 0; j < b.w; ++j) {
if (is_bomb(i, j)) {
n.board[i][j] = BOMB;
} else {
sprintf(&n.board[i][j], "%d", bomb_cnt(i, j));
}
}
}
for (int i = 0; i < b.h; ++i) {
printf("%s\n", n.board[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165582/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165582/source.c"
target datalayout = "e-m:e-p270: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.board = type { i32, i32, [50 x [51 x i8]] }
@b = dso_local global %struct.board zeroinitializer, 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"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @is_bomb(i32 noundef %y, i32 noundef %x) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %y to i64
%idxprom1 = sext i32 %x to i64
%arrayidx2 = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %idxprom, i64 %idxprom1
%0 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 35
%. = zext i1 %cmp to i32
ret i32 %.
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @bomb_cnt(i32 noundef %y, i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @b, align 4
%1 = load i32, ptr getelementptr inbounds (%struct.board, ptr @b, i64 0, i32 1), align 4
%add = add nsw i32 %y, -1
%add5 = add nsw i32 %x, -1
%cmp6 = icmp slt i32 %y, 1
br i1 %cmp6, label %cleanup.2, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%cmp7 = icmp sgt i32 %add, %0
%cmp9 = icmp slt i32 %x, 1
%or.cond = or i1 %cmp7, %cmp9
%cmp11 = icmp sgt i32 %add5, %1
%or.cond27 = select i1 %or.cond, i1 true, i1 %cmp11
br i1 %or.cond27, label %lor.lhs.false.1, label %if.end
if.end: ; preds = %lor.lhs.false
%idxprom.i = zext i32 %add to i64
%idxprom1.i = zext i32 %add5 to i64
%arrayidx2.i = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %idxprom.i, i64 %idxprom1.i
%2 = load i8, ptr %arrayidx2.i, align 1, !tbaa !5
%cmp.i.not = icmp eq i8 %2, 35
%inc = zext i1 %cmp.i.not to i32
br label %lor.lhs.false.1
lor.lhs.false.1: ; preds = %lor.lhs.false, %if.end
%cnt.2.ph = phi i32 [ 0, %lor.lhs.false ], [ %inc, %if.end ]
%cmp7.1 = icmp sgt i32 %add, %0
%cmp9.1 = icmp slt i32 %x, 0
%or.cond.1 = or i1 %cmp7.1, %cmp9.1
%cmp11.1 = icmp slt i32 %1, %x
%or.cond27.1 = select i1 %or.cond.1, i1 true, i1 %cmp11.1
br i1 %or.cond27.1, label %lor.lhs.false.2, label %if.end.1
if.end.1: ; preds = %lor.lhs.false.1
%idxprom.i.1 = zext i32 %add to i64
%idxprom1.i.1 = zext i32 %x to i64
%arrayidx2.i.1 = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %idxprom.i.1, i64 %idxprom1.i.1
%3 = load i8, ptr %arrayidx2.i.1, align 1, !tbaa !5
%cmp.i.not.1 = icmp eq i8 %3, 35
%inc.1 = zext i1 %cmp.i.not.1 to i32
%spec.select.1 = add nuw nsw i32 %cnt.2.ph, %inc.1
br label %lor.lhs.false.2
lor.lhs.false.2: ; preds = %if.end.1, %lor.lhs.false.1
%cnt.2.1.ph = phi i32 [ %cnt.2.ph, %lor.lhs.false.1 ], [ %spec.select.1, %if.end.1 ]
%add5.234 = add nsw i32 %x, 1
%cmp7.2 = icmp sgt i32 %add, %0
%cmp9.2 = icmp slt i32 %x, -1
%or.cond.2 = or i1 %cmp7.2, %cmp9.2
%cmp11.2 = icmp sle i32 %1, %x
%or.cond27.2 = select i1 %or.cond.2, i1 true, i1 %cmp11.2
br i1 %or.cond27.2, label %lor.lhs.false.3, label %if.end.2
if.end.2: ; preds = %lor.lhs.false.2
%idxprom.i.2 = zext i32 %add to i64
%idxprom1.i.2 = zext i32 %add5.234 to i64
%arrayidx2.i.2 = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %idxprom.i.2, i64 %idxprom1.i.2
%4 = load i8, ptr %arrayidx2.i.2, align 1, !tbaa !5
%cmp.i.not.2 = icmp eq i8 %4, 35
%inc.2 = zext i1 %cmp.i.not.2 to i32
%spec.select.2 = add nuw nsw i32 %cnt.2.1.ph, %inc.2
br label %lor.lhs.false.3
cleanup.2: ; preds = %entry
%add5.2 = add nsw i32 %x, 1
%cmp6.3 = icmp slt i32 %y, 0
br i1 %cmp6.3, label %cleanup.4, label %lor.lhs.false.3
lor.lhs.false.3: ; preds = %lor.lhs.false.2, %if.end.2, %cleanup.2
%cnt.2.243 = phi i32 [ 0, %cleanup.2 ], [ %cnt.2.1.ph, %lor.lhs.false.2 ], [ %spec.select.2, %if.end.2 ]
%add5.23741 = phi i32 [ %add5.2, %cleanup.2 ], [ %add5.234, %lor.lhs.false.2 ], [ %add5.234, %if.end.2 ]
%cmp7.3 = icmp slt i32 %0, %y
%cmp9.3 = icmp slt i32 %x, 1
%or.cond.3 = or i1 %cmp7.3, %cmp9.3
%cmp11.3 = icmp sgt i32 %add5, %1
%or.cond27.3 = select i1 %or.cond.3, i1 true, i1 %cmp11.3
br i1 %or.cond27.3, label %lor.lhs.false.4, label %if.end.3
if.end.3: ; preds = %lor.lhs.false.3
%idxprom.i.3 = zext i32 %y to i64
%idxprom1.i.3 = zext i32 %add5 to i64
%arrayidx2.i.3 = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %idxprom.i.3, i64 %idxprom1.i.3
%5 = load i8, ptr %arrayidx2.i.3, align 1, !tbaa !5
%cmp.i.not.3 = icmp eq i8 %5, 35
%inc.3 = zext i1 %cmp.i.not.3 to i32
%spec.select.3 = add nuw nsw i32 %cnt.2.243, %inc.3
br label %lor.lhs.false.4
lor.lhs.false.4: ; preds = %lor.lhs.false.3, %if.end.3
%cnt.2.351 = phi i32 [ %spec.select.3, %if.end.3 ], [ %cnt.2.243, %lor.lhs.false.3 ]
%cmp7.4 = icmp slt i32 %0, %y
%cmp9.4 = icmp slt i32 %x, -1
%or.cond.4 = or i1 %cmp7.4, %cmp9.4
%cmp11.4 = icmp sle i32 %1, %x
%or.cond27.4 = select i1 %or.cond.4, i1 true, i1 %cmp11.4
br i1 %or.cond27.4, label %cleanup.4.thread, label %if.end.4
if.end.4: ; preds = %lor.lhs.false.4
%idxprom.i.4 = zext i32 %y to i64
%idxprom1.i.4 = zext i32 %add5.23741 to i64
%arrayidx2.i.4 = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %idxprom.i.4, i64 %idxprom1.i.4
%6 = load i8, ptr %arrayidx2.i.4, align 1, !tbaa !5
%cmp.i.not.4 = icmp eq i8 %6, 35
%inc.4 = zext i1 %cmp.i.not.4 to i32
%spec.select.4 = add nuw nsw i32 %cnt.2.351, %inc.4
br label %cleanup.4.thread
cleanup.4.thread: ; preds = %if.end.4, %lor.lhs.false.4
%cnt.2.4.ph = phi i32 [ %cnt.2.351, %lor.lhs.false.4 ], [ %spec.select.4, %if.end.4 ]
%add.554 = add nuw nsw i32 %y, 1
%7 = zext i32 %add.554 to i64
br label %lor.lhs.false.5
cleanup.4: ; preds = %cleanup.2
%cmp6.5.not = icmp eq i32 %y, -1
br i1 %cmp6.5.not, label %lor.lhs.false.5, label %cleanup.7
lor.lhs.false.5: ; preds = %cleanup.4.thread, %cleanup.4
%add.559 = phi i64 [ %7, %cleanup.4.thread ], [ 0, %cleanup.4 ]
%cnt.2.458 = phi i32 [ %cnt.2.4.ph, %cleanup.4.thread ], [ 0, %cleanup.4 ]
%add5.237424956 = phi i32 [ %add5.23741, %cleanup.4.thread ], [ %add5.2, %cleanup.4 ]
%cmp7.5 = icmp sle i32 %0, %y
%cmp9.5 = icmp slt i32 %x, 1
%or.cond.5 = or i1 %cmp7.5, %cmp9.5
%cmp11.5 = icmp sgt i32 %add5, %1
%or.cond27.5 = select i1 %or.cond.5, i1 true, i1 %cmp11.5
br i1 %or.cond27.5, label %lor.lhs.false.6, label %if.end.5
if.end.5: ; preds = %lor.lhs.false.5
%idxprom1.i.5 = zext i32 %add5 to i64
%arrayidx2.i.5 = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %add.559, i64 %idxprom1.i.5
%8 = load i8, ptr %arrayidx2.i.5, align 1, !tbaa !5
%cmp.i.not.5 = icmp eq i8 %8, 35
%inc.5 = zext i1 %cmp.i.not.5 to i32
%spec.select.5 = add nuw nsw i32 %cnt.2.458, %inc.5
br label %lor.lhs.false.6
lor.lhs.false.6: ; preds = %lor.lhs.false.5, %if.end.5
%cnt.2.573 = phi i32 [ %spec.select.5, %if.end.5 ], [ %cnt.2.458, %lor.lhs.false.5 ]
%cmp7.6 = icmp sle i32 %0, %y
%cmp9.6 = icmp slt i32 %x, 0
%or.cond.6 = or i1 %cmp7.6, %cmp9.6
%cmp11.6 = icmp slt i32 %1, %x
%or.cond27.6 = select i1 %or.cond.6, i1 true, i1 %cmp11.6
br i1 %or.cond27.6, label %lor.lhs.false.7, label %if.end.6
if.end.6: ; preds = %lor.lhs.false.6
%idxprom1.i.6 = zext i32 %x to i64
%arrayidx2.i.6 = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %add.559, i64 %idxprom1.i.6
%9 = load i8, ptr %arrayidx2.i.6, align 1, !tbaa !5
%cmp.i.not.6 = icmp eq i8 %9, 35
%inc.6 = zext i1 %cmp.i.not.6 to i32
%spec.select.6 = add nuw nsw i32 %cnt.2.573, %inc.6
br label %lor.lhs.false.7
lor.lhs.false.7: ; preds = %lor.lhs.false.6, %if.end.6
%cnt.2.6 = phi i32 [ %spec.select.6, %if.end.6 ], [ %cnt.2.573, %lor.lhs.false.6 ]
%cmp7.7 = icmp sle i32 %0, %y
%cmp9.7 = icmp slt i32 %x, -1
%or.cond.7 = or i1 %cmp7.7, %cmp9.7
%cmp11.7 = icmp sle i32 %1, %x
%or.cond27.7 = select i1 %or.cond.7, i1 true, i1 %cmp11.7
br i1 %or.cond27.7, label %cleanup.7, label %if.end.7
if.end.7: ; preds = %lor.lhs.false.7
%idxprom1.i.7 = zext i32 %add5.237424956 to i64
%arrayidx2.i.7 = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %add.559, i64 %idxprom1.i.7
%10 = load i8, ptr %arrayidx2.i.7, align 1, !tbaa !5
%cmp.i.not.7 = icmp eq i8 %10, 35
%inc.7 = zext i1 %cmp.i.not.7 to i32
%spec.select.7 = add nuw nsw i32 %cnt.2.6, %inc.7
br label %cleanup.7
cleanup.7: ; preds = %cleanup.4, %if.end.7, %lor.lhs.false.7
%cnt.2.7 = phi i32 [ %spec.select.7, %if.end.7 ], [ %cnt.2.6, %lor.lhs.false.7 ], [ 0, %cleanup.4 ]
ret i32 %cnt.2.7
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #2 {
entry:
%n = alloca %struct.board, align 4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @b, ptr noundef nonnull getelementptr inbounds (%struct.board, ptr @b, i64 0, i32 1))
%0 = load i32, ptr @b, align 4, !tbaa !8
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 2560, ptr nonnull %n) #6
br label %for.cond.cleanup33
for.cond.cleanup: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 2560, ptr nonnull %n) #6
%1 = getelementptr inbounds i8, ptr %n, i64 8
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(2560) %1, i8 0, i64 2552, i1 false)
store i32 %4, ptr %n, align 4, !tbaa !8
%w = getelementptr inbounds %struct.board, ptr %n, i64 0, i32 1
%2 = load i32, ptr getelementptr inbounds (%struct.board, ptr @b, i64 0, i32 1), align 4
store i32 %2, ptr %w, align 4, !tbaa !11
%cmp461 = icmp sgt i32 %4, 0
br i1 %cmp461, label %for.cond7.preheader.lr.ph, label %for.cond.cleanup33
for.cond7.preheader.lr.ph: ; preds = %for.cond.cleanup
%3 = icmp sgt i32 %2, 0
br i1 %3, label %for.cond7.preheader, label %for.body34.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr @b, align 4, !tbaa !8
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !12
for.cond7.preheader: ; preds = %for.cond7.preheader.lr.ph, %for.cond.cleanup9
%6 = phi i32 [ %11, %for.cond.cleanup9 ], [ %4, %for.cond7.preheader.lr.ph ]
%7 = phi i32 [ %12, %for.cond.cleanup9 ], [ %2, %for.cond7.preheader.lr.ph ]
%8 = phi i32 [ %13, %for.cond.cleanup9 ], [ %2, %for.cond7.preheader.lr.ph ]
%indvars.iv74 = phi i64 [ %indvars.iv.next75.pre-phi, %for.cond.cleanup9 ], [ 0, %for.cond7.preheader.lr.ph ]
%cmp859 = icmp sgt i32 %8, 0
br i1 %cmp859, label %for.body10.lr.ph, label %for.cond7.preheader.for.cond.cleanup9_crit_edge
for.cond7.preheader.for.cond.cleanup9_crit_edge: ; preds = %for.cond7.preheader
%.pre84 = add nuw nsw i64 %indvars.iv74, 1
br label %for.cond.cleanup9
for.body10.lr.ph: ; preds = %for.cond7.preheader
%9 = add nsw i64 %indvars.iv74, -1
%cmp6.i = icmp eq i64 %indvars.iv74, 0
%idxprom.i.i = and i64 %9, 4294967295
%10 = add nuw nsw i64 %indvars.iv74, 1
br label %for.body10
for.cond31.preheader: ; preds = %for.cond.cleanup9
%cmp3263 = icmp sgt i32 %11, 0
br i1 %cmp3263, label %for.body34.preheader, label %for.cond.cleanup33
for.body34.preheader: ; preds = %for.cond7.preheader.lr.ph, %for.cond31.preheader
br label %for.body34
for.cond.cleanup9.loopexit: ; preds = %for.inc24
%.pre82 = load i32, ptr @b, align 4, !tbaa !8
br label %for.cond.cleanup9
for.cond.cleanup9: ; preds = %for.cond7.preheader.for.cond.cleanup9_crit_edge, %for.cond.cleanup9.loopexit
%indvars.iv.next75.pre-phi = phi i64 [ %.pre84, %for.cond7.preheader.for.cond.cleanup9_crit_edge ], [ %10, %for.cond.cleanup9.loopexit ]
%11 = phi i32 [ %6, %for.cond7.preheader.for.cond.cleanup9_crit_edge ], [ %.pre82, %for.cond.cleanup9.loopexit ]
%12 = phi i32 [ %7, %for.cond7.preheader.for.cond.cleanup9_crit_edge ], [ %28, %for.cond.cleanup9.loopexit ]
%13 = phi i32 [ %8, %for.cond7.preheader.for.cond.cleanup9_crit_edge ], [ %28, %for.cond.cleanup9.loopexit ]
%14 = sext i32 %11 to i64
%cmp4 = icmp slt i64 %indvars.iv.next75.pre-phi, %14
br i1 %cmp4, label %for.cond7.preheader, label %for.cond31.preheader, !llvm.loop !14
for.body10: ; preds = %for.body10.lr.ph, %for.inc24
%15 = phi i32 [ %7, %for.body10.lr.ph ], [ %28, %for.inc24 ]
%indvars.iv68 = phi i64 [ 0, %for.body10.lr.ph ], [ %indvars.iv.next69, %for.inc24 ]
%arrayidx2.i = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %indvars.iv74, i64 %indvars.iv68
%16 = load i8, ptr %arrayidx2.i, align 1, !tbaa !5
%cmp.i.not = icmp eq i8 %16, 35
%arrayidx16 = getelementptr inbounds %struct.board, ptr %n, i64 0, i32 2, i64 %indvars.iv74, i64 %indvars.iv68
br i1 %cmp.i.not, label %if.then, label %if.else
if.then: ; preds = %for.body10
store i8 35, ptr %arrayidx16, align 1, !tbaa !5
br label %for.inc24
if.else: ; preds = %for.body10
%17 = load i32, ptr @b, align 4
%18 = add nsw i64 %indvars.iv68, -1
%.pre83 = sext i32 %17 to i64
br i1 %cmp6.i, label %lor.lhs.false.3.i, label %lor.lhs.false.i
lor.lhs.false.i: ; preds = %if.else
%cmp7.i = icmp sgt i64 %9, %.pre83
%cmp9.i = icmp eq i64 %indvars.iv68, 0
%or.cond.i = or i1 %cmp9.i, %cmp7.i
br i1 %or.cond.i, label %lor.lhs.false.1.i, label %if.end.i
if.end.i: ; preds = %lor.lhs.false.i
%idxprom1.i.i = and i64 %18, 4294967295
%arrayidx2.i.i = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %idxprom.i.i, i64 %idxprom1.i.i
%19 = load i8, ptr %arrayidx2.i.i, align 1, !tbaa !5
%cmp.i.not.i = icmp eq i8 %19, 35
%inc.i = zext i1 %cmp.i.not.i to i32
br label %lor.lhs.false.1.i
lor.lhs.false.1.i: ; preds = %if.end.i, %lor.lhs.false.i
%cnt.2.ph.i = phi i32 [ 0, %lor.lhs.false.i ], [ %inc.i, %if.end.i ]
br i1 %cmp7.i, label %lor.lhs.false.3.i, label %if.end.2.i
if.end.2.i: ; preds = %lor.lhs.false.1.i
%arrayidx2.i.1.i = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %idxprom.i.i, i64 %indvars.iv68
%20 = load i8, ptr %arrayidx2.i.1.i, align 1, !tbaa !5
%cmp.i.not.1.i = icmp eq i8 %20, 35
%inc.1.i = zext i1 %cmp.i.not.1.i to i32
%spec.select.1.i = add nuw nsw i32 %cnt.2.ph.i, %inc.1.i
%21 = add nuw nsw i64 %indvars.iv68, 1
%arrayidx2.i.2.i = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %idxprom.i.i, i64 %21
%22 = load i8, ptr %arrayidx2.i.2.i, align 1, !tbaa !5
%cmp.i.not.2.i = icmp eq i8 %22, 35
%inc.2.i = zext i1 %cmp.i.not.2.i to i32
%spec.select.2.i = add nuw nsw i32 %spec.select.1.i, %inc.2.i
br label %lor.lhs.false.3.i
lor.lhs.false.3.i: ; preds = %if.else, %lor.lhs.false.1.i, %if.end.2.i
%cnt.2.243.i = phi i32 [ %spec.select.2.i, %if.end.2.i ], [ %cnt.2.ph.i, %lor.lhs.false.1.i ], [ 0, %if.else ]
%add5.23741.i.in = trunc i64 %indvars.iv68 to i32
%add5.23741.i = add i32 %add5.23741.i.in, 1
%cmp7.3.i = icmp sgt i64 %indvars.iv74, %.pre83
%cmp9.3.i = icmp eq i64 %indvars.iv68, 0
%or.cond.3.i = or i1 %cmp9.3.i, %cmp7.3.i
br i1 %or.cond.3.i, label %lor.lhs.false.4.i, label %if.end.3.i
if.end.3.i: ; preds = %lor.lhs.false.3.i
%idxprom1.i.3.i = and i64 %18, 4294967295
%arrayidx2.i.3.i = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %indvars.iv74, i64 %idxprom1.i.3.i
%23 = load i8, ptr %arrayidx2.i.3.i, align 1, !tbaa !5
%cmp.i.not.3.i = icmp eq i8 %23, 35
%inc.3.i = zext i1 %cmp.i.not.3.i to i32
%spec.select.3.i = add nuw nsw i32 %cnt.2.243.i, %inc.3.i
br label %lor.lhs.false.4.i
lor.lhs.false.4.i: ; preds = %lor.lhs.false.3.i, %if.end.3.i
%cnt.2.351.i = phi i32 [ %spec.select.3.i, %if.end.3.i ], [ %cnt.2.243.i, %lor.lhs.false.3.i ]
br i1 %cmp7.3.i, label %cleanup.4.thread.i, label %if.end.4.i
if.end.4.i: ; preds = %lor.lhs.false.4.i
%idxprom1.i.4.i = zext i32 %add5.23741.i to i64
%arrayidx2.i.4.i = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %indvars.iv74, i64 %idxprom1.i.4.i
%24 = load i8, ptr %arrayidx2.i.4.i, align 1, !tbaa !5
%cmp.i.not.4.i = icmp eq i8 %24, 35
%inc.4.i = zext i1 %cmp.i.not.4.i to i32
%spec.select.4.i = add nuw nsw i32 %cnt.2.351.i, %inc.4.i
br label %cleanup.4.thread.i
cleanup.4.thread.i: ; preds = %if.end.4.i, %lor.lhs.false.4.i
%cnt.2.4.ph.i = phi i32 [ %cnt.2.351.i, %lor.lhs.false.4.i ], [ %spec.select.4.i, %if.end.4.i ]
%cmp7.5.i = icmp sge i64 %indvars.iv74, %.pre83
%or.cond.5.i = or i1 %cmp9.3.i, %cmp7.5.i
br i1 %or.cond.5.i, label %lor.lhs.false.6.i, label %if.end.5.i
if.end.5.i: ; preds = %cleanup.4.thread.i
%idxprom1.i.5.i = and i64 %18, 4294967295
%arrayidx2.i.5.i = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %10, i64 %idxprom1.i.5.i
%25 = load i8, ptr %arrayidx2.i.5.i, align 1, !tbaa !5
%cmp.i.not.5.i = icmp eq i8 %25, 35
%inc.5.i = zext i1 %cmp.i.not.5.i to i32
%spec.select.5.i = add nuw nsw i32 %cnt.2.4.ph.i, %inc.5.i
br label %lor.lhs.false.6.i
lor.lhs.false.6.i: ; preds = %cleanup.4.thread.i, %if.end.5.i
%cnt.2.573.i = phi i32 [ %spec.select.5.i, %if.end.5.i ], [ %cnt.2.4.ph.i, %cleanup.4.thread.i ]
br i1 %cmp7.5.i, label %bomb_cnt.exit, label %if.end.7.i
if.end.7.i: ; preds = %lor.lhs.false.6.i
%arrayidx2.i.6.i = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %10, i64 %indvars.iv68
%26 = load i8, ptr %arrayidx2.i.6.i, align 1, !tbaa !5
%cmp.i.not.6.i = icmp eq i8 %26, 35
%inc.6.i = zext i1 %cmp.i.not.6.i to i32
%spec.select.6.i = add nuw nsw i32 %cnt.2.573.i, %inc.6.i
%idxprom1.i.7.i = zext i32 %add5.23741.i to i64
%arrayidx2.i.7.i = getelementptr inbounds %struct.board, ptr @b, i64 0, i32 2, i64 %10, i64 %idxprom1.i.7.i
%27 = load i8, ptr %arrayidx2.i.7.i, align 1, !tbaa !5
%cmp.i.not.7.i = icmp eq i8 %27, 35
%inc.7.i = zext i1 %cmp.i.not.7.i to i32
%spec.select.7.i = add nuw nsw i32 %spec.select.6.i, %inc.7.i
br label %bomb_cnt.exit
bomb_cnt.exit: ; preds = %lor.lhs.false.6.i, %if.end.7.i
%cnt.2.7.i = phi i32 [ %spec.select.7.i, %if.end.7.i ], [ %cnt.2.573.i, %lor.lhs.false.6.i ]
%call23 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %arrayidx16, ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cnt.2.7.i) #6
%.pre = load i32, ptr getelementptr inbounds (%struct.board, ptr @b, i64 0, i32 1), align 4
br label %for.inc24
for.inc24: ; preds = %if.then, %bomb_cnt.exit
%28 = phi i32 [ %15, %if.then ], [ %.pre, %bomb_cnt.exit ]
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%29 = sext i32 %28 to i64
%cmp8 = icmp slt i64 %indvars.iv.next69, %29
br i1 %cmp8, label %for.body10, label %for.cond.cleanup9.loopexit, !llvm.loop !16
for.cond.cleanup33: ; preds = %for.body34, %for.cond.cleanup.thread, %for.cond.cleanup, %for.cond31.preheader
call void @llvm.lifetime.end.p0(i64 2560, ptr nonnull %n) #6
ret i32 0
for.body34: ; preds = %for.body34.preheader, %for.body34
%indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.body34 ], [ 0, %for.body34.preheader ]
%arrayidx37 = getelementptr inbounds %struct.board, ptr %n, i64 0, i32 2, i64 %indvars.iv79
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx37)
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%30 = load i32, ptr @b, align 4, !tbaa !8
%31 = sext i32 %30 to i64
%cmp32 = icmp slt i64 %indvars.iv.next80, %31
br i1 %cmp32, label %for.body34, label %for.cond.cleanup33, !llvm.loop !17
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 nounwind willreturn memory(argmem: write) }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !10, i64 0}
!9 = !{!"board", !10, i64 0, !10, i64 4, !6, i64 8}
!10 = !{!"int", !6, i64 0}
!11 = !{!9, !10, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
|
#include<stdio.h>
int main(void){
int W,H;
char c;
scanf("%d %d",&W,&H);
scanf(" %c",&c);
for(int i=1;i<H+1;i++){
for(int j=1;j<W+1;j++){
if(i==1){
if(j==1||j==W) printf("+");
else if(1<j&&W>j) printf("-");
if(j==W) printf("\n");
}
else if(i<H&&1<i){
if(j==1||j==W) printf("|");
else if(j==W/2+1&&i==H/2+1){printf("%c",c);}
else printf(".");
if(j==W) printf("\n");
}
else if(i==H){
if(j==1||j==W) printf("+");
else printf("-");
}
}
}
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165625/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165625/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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" %c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%W = alloca i32, align 4
%H = alloca i32, align 4
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %W, ptr noundef nonnull %H)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c)
%0 = load i32, ptr %H, align 4, !tbaa !5
%cmp.not104 = icmp slt i32 %0, 1
%1 = load i32, ptr %W, align 4
%2 = icmp slt i32 %1, 1
%or.cond = select i1 %cmp.not104, i1 true, i1 %2
br i1 %or.cond, label %for.cond.cleanup, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %for.cond.cleanup5
%3 = phi i32 [ %7, %for.cond.cleanup5 ], [ %1, %entry ]
%i.0105 = phi i32 [ %inc67, %for.cond.cleanup5 ], [ 1, %entry ]
%cmp4.not101 = icmp slt i32 %3, 1
br i1 %cmp4.not101, label %for.cond.cleanup5, label %for.body6.lr.ph
for.body6.lr.ph: ; preds = %for.cond2.preheader
%cmp7 = icmp eq i32 %i.0105, 1
br i1 %cmp7, label %for.body6.us, label %for.body6
for.body6.us: ; preds = %for.body6.lr.ph, %for.inc.us
%4 = phi i32 [ %6, %for.inc.us ], [ %3, %for.body6.lr.ph ]
%j.0102.us = phi i32 [ %inc.us, %for.inc.us ], [ 1, %for.body6.lr.ph ]
%cmp8.us = icmp eq i32 %j.0102.us, 1
%cmp9.us = icmp eq i32 %j.0102.us, %4
%or.cond.us = or i1 %cmp8.us, %cmp9.us
br i1 %or.cond.us, label %if.end16.us.sink.split, label %if.else.us
if.else.us: ; preds = %for.body6.us
%cmp13.us = icmp sgt i32 %4, %j.0102.us
br i1 %cmp13.us, label %if.end16.us.sink.split, label %if.end16.us
if.end16.us.sink.split: ; preds = %for.body6.us, %if.else.us
%.sink = phi i32 [ 45, %if.else.us ], [ 43, %for.body6.us ]
%putchar96.us = call i32 @putchar(i32 %.sink)
br label %if.end16.us
if.end16.us: ; preds = %if.end16.us.sink.split, %if.else.us
%5 = load i32, ptr %W, align 4, !tbaa !5
%cmp17.us = icmp eq i32 %j.0102.us, %5
br i1 %cmp17.us, label %if.then18.us, label %for.inc.us
if.then18.us: ; preds = %if.end16.us
%putchar97.us = call i32 @putchar(i32 10)
%.pre = load i32, ptr %W, align 4, !tbaa !5
br label %for.inc.us
for.inc.us: ; preds = %if.then18.us, %if.end16.us
%6 = phi i32 [ %.pre, %if.then18.us ], [ %5, %if.end16.us ]
%inc.us = add nuw nsw i32 %j.0102.us, 1
%cmp4.not.us.not = icmp slt i32 %j.0102.us, %6
br i1 %cmp4.not.us.not, label %for.body6.us, label %for.cond.cleanup5, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond.cleanup5, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
ret i32 0
for.cond.cleanup5: ; preds = %for.inc, %for.inc.us, %for.cond2.preheader
%7 = phi i32 [ %3, %for.cond2.preheader ], [ %6, %for.inc.us ], [ %13, %for.inc ]
%inc67 = add nuw nsw i32 %i.0105, 1
%8 = load i32, ptr %H, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.0105, %8
br i1 %cmp.not.not, label %for.cond2.preheader, label %for.cond.cleanup, !llvm.loop !11
for.body6: ; preds = %for.body6.lr.ph, %for.inc
%9 = phi i32 [ %13, %for.inc ], [ %3, %for.body6.lr.ph ]
%j.0102 = phi i32 [ %inc, %for.inc ], [ 1, %for.body6.lr.ph ]
%10 = load i32, ptr %H, align 4, !tbaa !5
%cmp22 = icmp slt i32 %i.0105, %10
br i1 %cmp22, label %if.then25, label %if.else49
if.then25: ; preds = %for.body6
%cmp26 = icmp eq i32 %j.0102, 1
%cmp28 = icmp eq i32 %j.0102, %9
%or.cond99 = or i1 %cmp26, %cmp28
br i1 %or.cond99, label %if.end43, label %if.else31
if.else31: ; preds = %if.then25
%div = sdiv i32 %9, 2
%add32 = add nsw i32 %div, 1
%cmp33 = icmp eq i32 %j.0102, %add32
br i1 %cmp33, label %land.lhs.true34, label %if.end43
land.lhs.true34: ; preds = %if.else31
%div35 = sdiv i32 %10, 2
%add36 = add nsw i32 %div35, 1
%cmp37 = icmp eq i32 %i.0105, %add36
br i1 %cmp37, label %if.then38, label %if.end43
if.then38: ; preds = %land.lhs.true34
%11 = load i8, ptr %c, align 1, !tbaa !13
%conv = sext i8 %11 to i32
br label %if.end43
if.end43: ; preds = %if.else31, %land.lhs.true34, %if.then25, %if.then38
%conv.sink = phi i32 [ %conv, %if.then38 ], [ 124, %if.then25 ], [ 46, %land.lhs.true34 ], [ 46, %if.else31 ]
%putchar92 = call i32 @putchar(i32 %conv.sink)
%12 = load i32, ptr %W, align 4, !tbaa !5
%cmp44 = icmp eq i32 %j.0102, %12
br i1 %cmp44, label %for.inc.sink.split, label %for.inc
if.else49: ; preds = %for.body6
%cmp50 = icmp eq i32 %i.0105, %10
br i1 %cmp50, label %if.then52, label %for.inc
if.then52: ; preds = %if.else49
%cmp53 = icmp eq i32 %j.0102, 1
%cmp56 = icmp eq i32 %j.0102, %9
%or.cond100 = or i1 %cmp53, %cmp56
%. = select i1 %or.cond100, i32 43, i32 45
br label %for.inc.sink.split
for.inc.sink.split: ; preds = %if.then52, %if.end43
%.sink111 = phi i32 [ 10, %if.end43 ], [ %., %if.then52 ]
%putchar89 = call i32 @putchar(i32 %.sink111)
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %if.else49, %if.end43
%inc = add nuw nsw i32 %j.0102, 1
%13 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not.not = icmp slt i32 %j.0102, %13
br i1 %cmp4.not.not, label %for.body6, label %for.cond.cleanup5, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = !{!7, !7, i64 0}
|
#include<stdio.h>
int main(){
int A,B,C,D;
scanf("%d %d %d %d",&A,&B,&C,&D);
int max,min;
if(A>C){
max = A;
}else{
max = C;
}
if(B>D){
min = D;
}else{
min = B;
}
if(max < min){
printf("%d",min-max);
}else{
printf("0");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165676/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165676/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
%D = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C, ptr noundef nonnull %D)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %C, align 4, !tbaa !5
%. = call i32 @llvm.smax.i32(i32 %0, i32 %1)
%2 = load i32, ptr %B, align 4, !tbaa !5
%3 = load i32, ptr %D, align 4, !tbaa !5
%min.0 = call i32 @llvm.smin.i32(i32 %2, i32 %3)
%cmp5 = icmp slt i32 %., %min.0
br i1 %cmp5, label %if.then6, label %if.else8
if.then6: ; preds = %entry
%sub = sub nsw i32 %min.0, %.
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
br label %if.end10
if.else8: ; preds = %entry
%putchar = call i32 @putchar(i32 48)
br label %if.end10
if.end10: ; preds = %if.else8, %if.then6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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"}
|
#include<stdio.h>
#include<math.h>
int main(){
int a,b,c,d,s,g;
scanf("%d%d%d%d",&a, &b, &c, &d);
if(d<a || b<c){
printf("0\n");
}
else{
if(a>c){
s=a;
}
else{
s=c;
}
if(b>d){
g=d;
}
else{
g=b;
}
printf("%d\n",g-s);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165719/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165719/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %d, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.then, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%2 = load i32, ptr %b, align 4, !tbaa !5
%3 = load i32, ptr %c, align 4, !tbaa !5
%cmp1 = icmp slt i32 %2, %3
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %lor.lhs.false, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end11
if.else: ; preds = %lor.lhs.false
%. = call i32 @llvm.smax.i32(i32 %1, i32 %3)
%g.0 = call i32 @llvm.smin.i32(i32 %2, i32 %0)
%sub = sub nsw i32 %g.0, %.
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub)
br label %if.end11
if.end11: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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"}
|
#include <stdio.h>
int main(){
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
if(c>=a&&c<=b&&d>=b){
printf("%d",b-c);
}
else if(d>=a&&d<=b&&c<=a){
printf("%d",d-a);
}
else if(a<c&&b>=c&&b<=d){
printf("%d",b-c);
}
else if(b>=d&&a>=c&&a<=d){
printf("%d",d-a);
}
else if(a<=c&&a<=d&&b>=c&&b>=d){
printf("%d",d-c);
}
else if(c<=a&&c<=b&&d>=a&&d>=b){
printf("%d",b-a);
}
else printf("0");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165762/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165762/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %c, align 4
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not = icmp slt i32 %0, %1
%.pre = load i32, ptr %d, align 4
%.pre85 = load i32, ptr %b, align 4
br i1 %cmp.not, label %if.else, label %land.lhs.true
land.lhs.true: ; preds = %entry
%cmp1.not = icmp sgt i32 %0, %.pre85
%cmp3.not = icmp slt i32 %.pre, %.pre85
%or.cond = select i1 %cmp1.not, i1 true, i1 %cmp3.not
br i1 %or.cond, label %if.else, label %if.then
if.then: ; preds = %land.lhs.true
%sub = sub nsw i32 %.pre85, %0
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
br label %if.end59
if.else: ; preds = %land.lhs.true, %entry
%cmp5.not = icmp slt i32 %.pre, %1
%cmp7.not = icmp sgt i32 %.pre, %.pre85
%or.cond75 = select i1 %cmp5.not, i1 true, i1 %cmp7.not
%cmp9.not = icmp sgt i32 %0, %1
%or.cond76 = or i1 %cmp9.not, %or.cond75
br i1 %or.cond76, label %if.else13, label %if.then10
if.then10: ; preds = %if.else
%sub11 = sub nsw i32 %.pre, %1
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub11)
br label %if.end59
if.else13: ; preds = %if.else
br i1 %cmp9.not, label %land.lhs.true15, label %if.else22
land.lhs.true15: ; preds = %if.else13
%cmp16.not = icmp slt i32 %.pre85, %0
%cmp18.not = icmp sgt i32 %.pre85, %.pre
%or.cond77 = or i1 %cmp16.not, %cmp18.not
br i1 %or.cond77, label %if.else31, label %if.then19
if.then19: ; preds = %land.lhs.true15
%sub20 = sub nsw i32 %.pre85, %0
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub20)
br label %if.end59
if.else22: ; preds = %if.else13
%or.cond78 = or i1 %cmp9.not, %cmp5.not
%or.cond81 = or i1 %cmp7.not, %or.cond78
br i1 %or.cond81, label %if.else31, label %if.then28
if.then28: ; preds = %if.else22
%sub29 = sub nsw i32 %.pre, %1
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub29)
br label %if.end59
if.else31: ; preds = %land.lhs.true15, %if.else22
%brmerge = or i1 %cmp.not, %cmp5.not
%cmp36.not = icmp slt i32 %.pre85, %0
%or.cond79 = or i1 %cmp36.not, %cmp7.not
%or.cond82 = select i1 %brmerge, i1 true, i1 %or.cond79
br i1 %or.cond82, label %if.else42, label %if.then39
if.then39: ; preds = %if.else31
%sub40 = sub nsw i32 %.pre, %0
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub40)
br label %if.end59
if.else42: ; preds = %if.else31
%or.cond83 = select i1 %cmp9.not, i1 true, i1 %cmp36.not
%cmp49.not = icmp slt i32 %.pre, %.pre85
%or.cond80 = or i1 %cmp5.not, %cmp49.not
%or.cond84 = select i1 %or.cond83, i1 true, i1 %or.cond80
br i1 %or.cond84, label %if.else53, label %if.then50
if.then50: ; preds = %if.else42
%sub51 = sub nsw i32 %.pre85, %1
%call52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub51)
br label %if.end59
if.else53: ; preds = %if.else42
%putchar = call i32 @putchar(i32 48)
br label %if.end59
if.end59: ; preds = %if.then10, %if.then28, %if.then50, %if.else53, %if.then39, %if.then19, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int a[3],i,t;
for(i=0;i<=3;i++)
scanf("%d",&a[i]);
if(a[0]<=a[2])
{
if(a[1]<=a[2])
t=0;
else if(a[1]>=a[3])
t=a[3]-a[2];
else
t=a[1]-a[2];
}
else
{
if(a[3]<=a[0])
t=0;
else if(a[3]>=a[1])
t=a[1]-a[0];
else
t=a[3]-a[0];
}
printf("%d",t);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165805/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165805/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i32], align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%arrayidx.1 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%arrayidx.2 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%arrayidx.3 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 3
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%cmp3.not = icmp sgt i32 %0, %1
br i1 %cmp3.not, label %if.else19, label %if.then
if.then: ; preds = %entry
%2 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp6.not = icmp sgt i32 %2, %1
br i1 %cmp6.not, label %if.else, label %if.end38
if.else: ; preds = %if.then
%3 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp10.not = icmp slt i32 %2, %3
br i1 %cmp10.not, label %if.else14, label %if.then11
if.then11: ; preds = %if.else
%sub = sub nsw i32 %3, %1
br label %if.end38
if.else14: ; preds = %if.else
%sub17 = sub nsw i32 %2, %1
br label %if.end38
if.else19: ; preds = %entry
%4 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp22.not = icmp sgt i32 %4, %0
br i1 %cmp22.not, label %if.else24, label %if.end38
if.else24: ; preds = %if.else19
%5 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp27.not = icmp slt i32 %4, %5
br i1 %cmp27.not, label %if.else32, label %if.then28
if.then28: ; preds = %if.else24
%sub31 = sub nsw i32 %5, %0
br label %if.end38
if.else32: ; preds = %if.else24
%sub35 = sub nsw i32 %4, %0
br label %if.end38
if.end38: ; preds = %if.else19, %if.then, %if.else32, %if.then28, %if.else14, %if.then11
%t.0 = phi i32 [ %sub, %if.then11 ], [ %sub17, %if.else14 ], [ %sub31, %if.then28 ], [ %sub35, %if.else32 ], [ 0, %if.then ], [ 0, %if.else19 ]
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %t.0)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int a,b,c,d;
while(scanf("%d%d%d%d",&a,&b,&c,&d)!=EOF)
{
if(c>=b||a>=d)
printf("0\n");
else if(c>=a&&d<=b)
printf("%d\n",d-c);
else if(a>=c&&b<=d)
printf("%d\n",b-a);
else if(c>=a&&c<=b&&b<=d)
printf("%d\n",b-c);
else
printf("%d\n",d-a);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165849/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165849/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call39 = 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)
%cmp.not40 = icmp eq i32 %call39, -1
br i1 %cmp.not40, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end29
%0 = load i32, ptr %c, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp1.not = icmp slt i32 %0, %1
br i1 %cmp1.not, label %lor.lhs.false, label %if.then
lor.lhs.false: ; preds = %while.body
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %d, align 4
%cmp2.not = icmp slt i32 %2, %3
br i1 %cmp2.not, label %if.else, label %if.then
if.then: ; preds = %lor.lhs.false, %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end29
if.else: ; preds = %lor.lhs.false
%cmp4.not = icmp slt i32 %0, %2
%cmp5.not = icmp sgt i32 %3, %1
%or.cond = or i1 %cmp4.not, %cmp5.not
br i1 %or.cond, label %if.else8, label %if.then6
if.then6: ; preds = %if.else
%sub = sub nsw i32 %3, %0
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub)
br label %if.end29
if.else8: ; preds = %if.else
%cmp9.not = icmp slt i32 %2, %0
%cmp11.not = icmp sgt i32 %1, %3
%or.cond38 = or i1 %cmp9.not, %cmp11.not
br i1 %or.cond38, label %if.else15, label %if.then12
if.then12: ; preds = %if.else8
%sub13 = sub nsw i32 %1, %2
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub13)
br label %if.end29
if.else15: ; preds = %if.else8
%or.cond41 = or i1 %cmp4.not, %cmp11.not
br i1 %or.cond41, label %if.else24, label %if.then21
if.then21: ; preds = %if.else15
%sub22 = sub nsw i32 %1, %0
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub22)
br label %if.end29
if.else24: ; preds = %if.else15
%sub25 = sub nsw i32 %3, %2
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub25)
br label %if.end29
if.end29: ; preds = %if.then6, %if.then21, %if.else24, %if.then12, %if.then
%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)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end29, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.