Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include<stdio.h>
int main(void){
int a,b,c,t;
scanf("%d %d %d" ,&a,&b,&c);
if(a>b){
t=a;
a=b;
b=t;
}
if(b>c){
t=b;
b=c;
c=t;
if(a>b){
t=a;
a=b;
b=t;
}
}
printf("%d %d %d\n" ,a,b,c);
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285116/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285116/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %1, %if.then ], [ %0, %entry ]
%3 = phi i32 [ %0, %if.then ], [ %1, %entry ]
%4 = load i32, ptr %c, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %3, %4
br i1 %cmp1, label %if.then2, label %if.end6
if.then2: ; preds = %if.end
store i32 %4, ptr %b, align 4, !tbaa !5
store i32 %3, ptr %c, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %2, %4
br i1 %cmp3, label %if.then4, label %if.end6
if.then4: ; preds = %if.then2
store i32 %4, ptr %a, align 4, !tbaa !5
store i32 %2, ptr %b, align 4, !tbaa !5
br label %if.end6
if.end6: ; preds = %if.then2, %if.then4, %if.end
%5 = phi i32 [ %3, %if.then2 ], [ %3, %if.then4 ], [ %4, %if.end ]
%6 = phi i32 [ %4, %if.then2 ], [ %2, %if.then4 ], [ %3, %if.end ]
%7 = phi i32 [ %2, %if.then2 ], [ %4, %if.then4 ], [ %2, %if.end ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7, i32 noundef %6, i32 noundef %5)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char s[10001];
char saida[10001];
int i,tam,*set,indiceInicio,temp,cont,j;
saida[0]='\0';
scanf("%s",s);
set=(int*)calloc(sizeof(int),10001);
sscanf(&s[i],"%d",&temp);
set[temp]=1;
for(i=0;i<strlen(s);i++)
{
if(s[i]==',')
{
sscanf(&s[i+1],"%d",&temp);
set[temp]=1;
}
}
//for(i=0;i<20;i++)
//printf("%d ",set[i]);
cont=indiceInicio=0;
for(i=1;i<10001;i++)
{
//if(i<20)
//printf("\nContador: %d",cont);
if(set[i]==1)
{
if(indiceInicio==0)
indiceInicio=i;
cont++;
}
else
{
if(cont==1)
{
char aux[50];
//printf("\nII:%d",indiceInicio);
sprintf(aux,"%d,",indiceInicio);
//for(j=0;aux[j]!=',';j++);
//aux[j+1]='\0';
//printf("\nAux: %s",aux);
strcat(saida,aux);
//printf("\nentrou");
}
else{
if(cont>1)
{
char aux[50];
//printf("\nII:%d",indiceInicio);
sprintf(aux,"%d-%d,",indiceInicio,indiceInicio+cont-1);
//for(j=0;aux[j]!=',';j++);
//aux[j+1]='\0';
//printf("\nAux: %s",aux);
strcat(saida,aux);
}
}
indiceInicio=0;
cont=0;
}
}
saida[strlen(saida)-1]='\0';
printf("%s\n",saida);
free(set);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28516/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28516/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d,\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%d-%d,\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [10001 x i8], align 16
%saida = alloca [10001 x i8], align 16
%temp = alloca i32, align 4
%aux = alloca [50 x i8], align 16
%aux45 = alloca [50 x i8], align 16
call void @llvm.lifetime.start.p0(i64 10001, ptr nonnull %s) #8
call void @llvm.lifetime.start.p0(i64 10001, ptr nonnull %saida) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %temp) #8
store i8 0, ptr %saida, align 16, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call1 = call noalias dereferenceable_or_null(40004) ptr @calloc(i64 noundef 4, i64 noundef 10001) #9
%call3 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %s, ptr noundef nonnull @.str.1, ptr noundef nonnull %temp) #8
%0 = load i32, ptr %temp, align 4, !tbaa !8
%idxprom4 = sext i32 %0 to i64
%arrayidx5 = getelementptr inbounds i32, ptr %call1, i64 %idxprom4
store i32 1, ptr %arrayidx5, align 4, !tbaa !8
%char0 = load i8, ptr %s, align 16
%cmp82.not = icmp eq i8 %char0, 0
br i1 %cmp82.not, label %for.body22.preheader, label %for.body
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %2, %for.inc ], [ 0, %entry ]
%arrayidx10 = getelementptr inbounds [10001 x i8], ptr %s, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx10, align 1, !tbaa !5
%cmp12 = icmp eq i8 %1, 44
%2 = add nuw i64 %indvars.iv, 1
br i1 %cmp12, label %if.then, label %for.inc
if.then: ; preds = %for.body
%arrayidx15 = getelementptr inbounds [10001 x i8], ptr %s, i64 0, i64 %2
%call16 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %arrayidx15, ptr noundef nonnull @.str.1, ptr noundef nonnull %temp) #8
%3 = load i32, ptr %temp, align 4, !tbaa !8
%idxprom17 = sext i32 %3 to i64
%arrayidx18 = getelementptr inbounds i32, ptr %call1, i64 %idxprom17
store i32 1, ptr %arrayidx18, align 4, !tbaa !8
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%call7 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #10
%cmp = icmp ugt i64 %call7, %2
br i1 %cmp, label %for.body, label %for.body22.preheader, !llvm.loop !10
for.body22.preheader: ; preds = %for.inc, %entry
br label %for.body22
for.body22: ; preds = %for.body22.preheader, %for.inc55
%indvars.iv90 = phi i64 [ %indvars.iv.next91, %for.inc55 ], [ 1, %for.body22.preheader ]
%cont.086 = phi i32 [ %cont.1, %for.inc55 ], [ 0, %for.body22.preheader ]
%indiceInicio.085 = phi i32 [ %indiceInicio.2, %for.inc55 ], [ 0, %for.body22.preheader ]
%arrayidx24 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv90
%4 = load i32, ptr %arrayidx24, align 4, !tbaa !8
%cmp25 = icmp eq i32 %4, 1
br i1 %cmp25, label %if.then27, label %if.else
if.then27: ; preds = %for.body22
%cmp28 = icmp eq i32 %indiceInicio.085, 0
%5 = trunc i64 %indvars.iv90 to i32
%spec.select = select i1 %cmp28, i32 %5, i32 %indiceInicio.085
%inc32 = add nsw i32 %cont.086, 1
br label %for.inc55
if.else: ; preds = %for.body22
%cmp33 = icmp eq i32 %cont.086, 1
br i1 %cmp33, label %if.then35, label %if.else41
if.then35: ; preds = %if.else
call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %aux) #8
%call37 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %aux, ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %indiceInicio.085) #8
%call40 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %saida, ptr noundef nonnull dereferenceable(1) %aux) #8
call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %aux) #8
br label %for.inc55
if.else41: ; preds = %if.else
%cmp42 = icmp sgt i32 %cont.086, 1
br i1 %cmp42, label %if.then44, label %for.inc55
if.then44: ; preds = %if.else41
call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %aux45) #8
%add47 = add i32 %indiceInicio.085, -1
%sub = add i32 %add47, %cont.086
%call48 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %aux45, ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %indiceInicio.085, i32 noundef %sub) #8
%call51 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %saida, ptr noundef nonnull dereferenceable(1) %aux45) #8
call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %aux45) #8
br label %for.inc55
for.inc55: ; preds = %if.then35, %if.then44, %if.else41, %if.then27
%indiceInicio.2 = phi i32 [ %spec.select, %if.then27 ], [ 0, %if.else41 ], [ 0, %if.then44 ], [ 0, %if.then35 ]
%cont.1 = phi i32 [ %inc32, %if.then27 ], [ 0, %if.else41 ], [ 0, %if.then44 ], [ 0, %if.then35 ]
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%exitcond.not = icmp eq i64 %indvars.iv.next91, 10001
br i1 %exitcond.not, label %for.end57, label %for.body22, !llvm.loop !12
for.end57: ; preds = %for.inc55
%call59 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %saida) #10
%sub60 = add i64 %call59, -1
%arrayidx61 = getelementptr inbounds [10001 x i8], ptr %saida, i64 0, i64 %sub60
store i8 0, ptr %arrayidx61, align 1, !tbaa !5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %saida)
call void @free(ptr noundef nonnull %call1) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %temp) #8
call void @llvm.lifetime.end.p0(i64 10001, ptr nonnull %saida) #8
call void @llvm.lifetime.end.p0(i64 10001, ptr nonnull %s) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, 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 #4
; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind }
attributes #8 = { nounwind }
attributes #9 = { nounwind allocsize(0,1) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<stdio.h>
int main(void){
int a[3];
int b ,c ,d;
scanf("%d %d %d" ,&a[0] ,&a[1] ,&a[2]);
for(b = 0; b < 3; ++b){
for(c = b + 1; c < 3; ++c){
if(a[b] > a[c]){
d = a[b];
a[b] = a[c];
a[c] = d;
}
}
}
printf("%d %d %d\n" ,a[0] ,a[1] ,a[2]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285202/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285202/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
for.body5.lr.ph:
%a = alloca [3 x i32], align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %a) #3
%arrayidx1 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 2
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %0, %1
br i1 %cmp9, label %if.then, label %for.inc
for.body5.lr.ph.1: ; preds = %if.then.148, %for.inc
%2 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%3 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp9.1 = icmp sgt i32 %2, %3
br i1 %cmp9.1, label %if.then.1, label %for.cond.loopexit.2
if.then.1: ; preds = %for.body5.lr.ph.1
store i32 %3, ptr %arrayidx1, align 4, !tbaa !5
store i32 %2, ptr %arrayidx2, align 4, !tbaa !5
br label %for.cond.loopexit.2
for.cond.loopexit.2: ; preds = %if.then.1, %for.body5.lr.ph.1
%4 = load i32, ptr %a, align 4, !tbaa !5
%5 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%6 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4, i32 noundef %5, i32 noundef %6)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %a) #3
ret i32 0
if.then: ; preds = %for.body5.lr.ph
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %arrayidx1, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body5.lr.ph, %if.then
%7 = phi i32 [ %0, %for.body5.lr.ph ], [ %1, %if.then ]
%8 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp9.146 = icmp sgt i32 %7, %8
br i1 %cmp9.146, label %if.then.148, label %for.body5.lr.ph.1
if.then.148: ; preds = %for.inc
store i32 %8, ptr %a, align 4, !tbaa !5
store i32 %7, ptr %arrayidx2, align 4, !tbaa !5
br label %for.body5.lr.ph.1
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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[3];
int i, b;
scanf("%d %d %d", &a[0], &a[1], &a[2]);
if(a[0] > a[1]){
b = a[0];
a[0] = a[1];
a[1] = b;
}
if(a[1] > a[2]){
b = a[1];
a[1] = a[2];
a[2] = b;
}
if(a[0] > a[1]){
b = a[0];
a[0] = a[1];
a[1] = b;
}
printf("%d %d %d\n", a[0], a[1], a[2]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285253/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285253/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10 x i8] c"%d %d %d\0A\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
%arrayidx1 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 2
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %arrayidx1, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %1, %if.then ], [ %0, %entry ]
%3 = phi i32 [ %0, %if.then ], [ %1, %entry ]
%4 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %3, %4
br i1 %cmp11, label %if.then12, label %if.end17
if.then12: ; preds = %if.end
store i32 %4, ptr %arrayidx1, align 4, !tbaa !5
store i32 %3, ptr %arrayidx2, align 4, !tbaa !5
br label %if.end17
if.end17: ; preds = %if.then12, %if.end
%5 = phi i32 [ %3, %if.then12 ], [ %4, %if.end ]
%6 = phi i32 [ %4, %if.then12 ], [ %3, %if.end ]
%cmp20 = icmp sgt i32 %2, %6
br i1 %cmp20, label %if.then21, label %if.end26
if.then21: ; preds = %if.end17
store i32 %6, ptr %a, align 4, !tbaa !5
store i32 %2, ptr %arrayidx1, align 4, !tbaa !5
br label %if.end26
if.end26: ; preds = %if.then21, %if.end17
%7 = phi i32 [ %2, %if.then21 ], [ %6, %if.end17 ]
%8 = phi i32 [ %6, %if.then21 ], [ %2, %if.end17 ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8, i32 noundef %7, i32 noundef %5)
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"}
|
// Aizu 1102: Calculation of Expressions
// 2017.9.12 bal4u@uu
#include <stdio.h>
#include <ctype.h>
#define abs(a) ((a)>=0?(a):-(a))
#define B 10000
int calc();
char buf[200], *p;
int factor(int *r, int *i)
{
int r1, i1;
if (*p == '(') { p++; if (!calc(&r1, &i1)) return 0; p++; }
else if (*p == 'i') p++, r1 = 0, i1 = 1;
else {
r1 = i1 = 0;
while (isdigit(*p)) { r1 = 10 * r1 + (*p++ - '0'); if (r1 > B) return 0; }
}
*r = r1, *i = i1;
return 1;
}
int term(int *r, int *i)
{
int r1, r2, i1, i2, rr, ii;
if (!factor(&r1, &i1)) return 0;
while (1) {
if (*p == '*') p++;
else break;
if (!factor(&r2, &i2)) return 0;
rr = r1*r2-i1*i2, ii = r1*i2+i1*r2;
r1 = rr, i1 = ii;
if (abs(r1) > B || abs(i1) > B) return 0;
}
*r = r1, *i = i1;
return 1;
}
int calc(int *r, int *i)
{
int r1, r2, i1, i2, op;
if (!term(&r1, &i1)) return 0;
while (1) {
if (*p == '+') op = 1;
else if (*p == '-') op = 0;
else break;
p++;
if (!term(&r2, &i2)) return 0;
if (op) r1 += r2, i1 += i2; else r1 -= r2, i1 -= i2;
if (abs(r1) > B || abs(i1) > B) return 0;
}
*r = r1, *i = i1;
return 1;
}
int main()
{
int r, i;
while (fgets(p = buf, 150, stdin) != NULL) {
if (!calc(&r, &i)) { puts("overflow"); continue; }
if (r == 0 && i == 0) puts("0");
else if (i == 0) printf("%d\n", r);
else if (r == 0) printf("%di\n", i);
else printf("%d%+di\n", r, i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285310/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285310/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@p = dso_local local_unnamed_addr global ptr null, align 8
@buf = dso_local global [200 x i8] zeroinitializer, align 16
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [9 x i8] c"overflow\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"0\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%di\0A\00", align 1
@.str.4 = private unnamed_addr constant [8 x i8] c"%d%+di\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @factor(ptr nocapture noundef writeonly %r, ptr nocapture noundef writeonly %i) local_unnamed_addr #0 {
entry:
%r1 = alloca i32, align 4
%i1 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r1) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i1) #6
%0 = load ptr, ptr @p, align 8, !tbaa !5
%1 = load i8, ptr %0, align 1, !tbaa !9
switch i8 %1, label %if.else9 [
i8 40, label %if.then
i8 105, label %if.then7
]
if.then: ; preds = %entry
%incdec.ptr = getelementptr inbounds i8, ptr %0, i64 1
store ptr %incdec.ptr, ptr @p, align 8, !tbaa !5
%call = call i32 @calc(ptr noundef nonnull %r1, ptr noundef nonnull %i1), !range !10
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %cleanup, label %if.end
if.end: ; preds = %if.then
%2 = load ptr, ptr @p, align 8, !tbaa !5
%incdec.ptr3 = getelementptr inbounds i8, ptr %2, i64 1
store ptr %incdec.ptr3, ptr @p, align 8, !tbaa !5
%.pre = load i32, ptr %r1, align 4, !tbaa !11
%.pre25 = load i32, ptr %i1, align 4, !tbaa !11
br label %if.end21
if.then7: ; preds = %entry
%incdec.ptr8 = getelementptr inbounds i8, ptr %0, i64 1
store ptr %incdec.ptr8, ptr @p, align 8, !tbaa !5
br label %if.end21
if.else9: ; preds = %entry
%call10 = tail call ptr @__ctype_b_loc() #7
br label %while.cond
while.cond: ; preds = %while.body, %if.else9
%3 = phi ptr [ %incdec.ptr14, %while.body ], [ %0, %if.else9 ]
%add23 = phi i32 [ %add, %while.body ], [ 0, %if.else9 ]
%4 = load ptr, ptr %call10, align 8, !tbaa !5
%5 = load i8, ptr %3, align 1, !tbaa !9
%idxprom = sext i8 %5 to i64
%arrayidx = getelementptr inbounds i16, ptr %4, i64 %idxprom
%6 = load i16, ptr %arrayidx, align 2, !tbaa !13
%7 = and i16 %6, 2048
%tobool13.not = icmp eq i16 %7, 0
br i1 %tobool13.not, label %if.end21, label %while.body
while.body: ; preds = %while.cond
%mul = mul nsw i32 %add23, 10
%incdec.ptr14 = getelementptr inbounds i8, ptr %3, i64 1
store ptr %incdec.ptr14, ptr @p, align 8, !tbaa !5
%8 = load i8, ptr %3, align 1, !tbaa !9
%conv15 = sext i8 %8 to i32
%sub = add i32 %mul, -48
%add = add i32 %sub, %conv15
%cmp16 = icmp sgt i32 %add, 10000
br i1 %cmp16, label %cleanup, label %while.cond, !llvm.loop !15
if.end21: ; preds = %while.cond, %if.then7, %if.end
%9 = phi i32 [ 1, %if.then7 ], [ %.pre25, %if.end ], [ 0, %while.cond ]
%10 = phi i32 [ 0, %if.then7 ], [ %.pre, %if.end ], [ %add23, %while.cond ]
store i32 %10, ptr %r, align 4, !tbaa !11
store i32 %9, ptr %i, align 4, !tbaa !11
br label %cleanup
cleanup: ; preds = %while.body, %if.then, %if.end21
%retval.0 = phi i32 [ 1, %if.end21 ], [ 0, %if.then ], [ 0, %while.body ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i1) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1) #6
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @term(ptr nocapture noundef writeonly %r, ptr nocapture noundef writeonly %i) local_unnamed_addr #0 {
entry:
%r1.i32 = alloca i32, align 4
%i1.i33 = alloca i32, align 4
%r1.i = alloca i32, align 4
%i1.i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r1.i) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i1.i) #6
%0 = load ptr, ptr @p, align 8, !tbaa !5
%1 = load i8, ptr %0, align 1, !tbaa !9
switch i8 %1, label %if.else9.i [
i8 40, label %if.then.i
i8 105, label %if.then7.i
]
if.then.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %0, i64 1
store ptr %incdec.ptr.i, ptr @p, align 8, !tbaa !5
%call.i = call i32 @calc(ptr noundef nonnull %r1.i, ptr noundef nonnull %i1.i), !range !10
%tobool.not.i = icmp eq i32 %call.i, 0
br i1 %tobool.not.i, label %factor.exit.thread, label %if.end.i
if.end.i: ; preds = %if.then.i
%2 = load ptr, ptr @p, align 8, !tbaa !5
%incdec.ptr3.i = getelementptr inbounds i8, ptr %2, i64 1
store ptr %incdec.ptr3.i, ptr @p, align 8, !tbaa !5
%.pre.i = load i32, ptr %r1.i, align 4, !tbaa !11
%.pre25.i = load i32, ptr %i1.i, align 4, !tbaa !11
br label %factor.exit
if.then7.i: ; preds = %entry
%incdec.ptr8.i = getelementptr inbounds i8, ptr %0, i64 1
store ptr %incdec.ptr8.i, ptr @p, align 8, !tbaa !5
br label %factor.exit
if.else9.i: ; preds = %entry
%call10.i = tail call ptr @__ctype_b_loc() #7
br label %while.cond.i
while.cond.i: ; preds = %while.body.i, %if.else9.i
%3 = phi ptr [ %incdec.ptr14.i, %while.body.i ], [ %0, %if.else9.i ]
%add23.i = phi i32 [ %add.i, %while.body.i ], [ 0, %if.else9.i ]
%4 = load ptr, ptr %call10.i, align 8, !tbaa !5
%5 = load i8, ptr %3, align 1, !tbaa !9
%idxprom.i = sext i8 %5 to i64
%arrayidx.i = getelementptr inbounds i16, ptr %4, i64 %idxprom.i
%6 = load i16, ptr %arrayidx.i, align 2, !tbaa !13
%7 = and i16 %6, 2048
%tobool13.not.i = icmp eq i16 %7, 0
br i1 %tobool13.not.i, label %factor.exit, label %while.body.i
while.body.i: ; preds = %while.cond.i
%mul.i = mul nsw i32 %add23.i, 10
%incdec.ptr14.i = getelementptr inbounds i8, ptr %3, i64 1
store ptr %incdec.ptr14.i, ptr @p, align 8, !tbaa !5
%8 = load i8, ptr %3, align 1, !tbaa !9
%conv15.i = sext i8 %8 to i32
%sub.i = add i32 %mul.i, -48
%add.i = add i32 %sub.i, %conv15.i
%cmp16.i = icmp sgt i32 %add.i, 10000
br i1 %cmp16.i, label %factor.exit.thread, label %while.cond.i, !llvm.loop !15
factor.exit.thread: ; preds = %while.body.i, %if.then.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i1.i) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1.i) #6
br label %cleanup
factor.exit: ; preds = %while.cond.i, %if.end.i, %if.then7.i
%9 = phi ptr [ %incdec.ptr8.i, %if.then7.i ], [ %incdec.ptr3.i, %if.end.i ], [ %3, %while.cond.i ]
%r1.0 = phi i32 [ 0, %if.then7.i ], [ %.pre.i, %if.end.i ], [ %add23.i, %while.cond.i ]
%i1.0 = phi i32 [ 1, %if.then7.i ], [ %.pre25.i, %if.end.i ], [ 0, %while.cond.i ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i1.i) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1.i) #6
br label %while.cond
while.cond: ; preds = %factor.exit, %if.end7
%10 = phi ptr [ %9, %factor.exit ], [ %20, %if.end7 ]
%r1.1 = phi i32 [ %r1.0, %factor.exit ], [ %sub, %if.end7 ]
%i1.1 = phi i32 [ %i1.0, %factor.exit ], [ %add, %if.end7 ]
%11 = load i8, ptr %10, align 1, !tbaa !9
%cmp = icmp eq i8 %11, 42
br i1 %cmp, label %if.then2, label %while.end
if.then2: ; preds = %while.cond
%incdec.ptr = getelementptr inbounds i8, ptr %10, i64 1
store ptr %incdec.ptr, ptr @p, align 8, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r1.i32) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i1.i33) #6
%12 = load i8, ptr %incdec.ptr, align 1, !tbaa !9
switch i8 %12, label %if.else9.i46 [
i8 40, label %if.then.i38
i8 105, label %if.then7.i34
]
if.then.i38: ; preds = %if.then2
%incdec.ptr.i39 = getelementptr inbounds i8, ptr %10, i64 2
store ptr %incdec.ptr.i39, ptr @p, align 8, !tbaa !5
%call.i40 = call i32 @calc(ptr noundef nonnull %r1.i32, ptr noundef nonnull %i1.i33), !range !10
%tobool.not.i41 = icmp eq i32 %call.i40, 0
br i1 %tobool.not.i41, label %factor.exit60, label %if.end.i42
if.end.i42: ; preds = %if.then.i38
%13 = load ptr, ptr @p, align 8, !tbaa !5
%incdec.ptr3.i43 = getelementptr inbounds i8, ptr %13, i64 1
store ptr %incdec.ptr3.i43, ptr @p, align 8, !tbaa !5
%.pre.i44 = load i32, ptr %r1.i32, align 4, !tbaa !11
%.pre25.i45 = load i32, ptr %i1.i33, align 4, !tbaa !11
br label %if.end7
if.then7.i34: ; preds = %if.then2
%incdec.ptr8.i35 = getelementptr inbounds i8, ptr %10, i64 2
store ptr %incdec.ptr8.i35, ptr @p, align 8, !tbaa !5
br label %if.end7
if.else9.i46: ; preds = %if.then2
%call10.i47 = tail call ptr @__ctype_b_loc() #7
br label %while.cond.i48
while.cond.i48: ; preds = %while.body.i53, %if.else9.i46
%14 = phi ptr [ %incdec.ptr14.i55, %while.body.i53 ], [ %incdec.ptr, %if.else9.i46 ]
%add23.i49 = phi i32 [ %add.i58, %while.body.i53 ], [ 0, %if.else9.i46 ]
%15 = load ptr, ptr %call10.i47, align 8, !tbaa !5
%16 = load i8, ptr %14, align 1, !tbaa !9
%idxprom.i50 = sext i8 %16 to i64
%arrayidx.i51 = getelementptr inbounds i16, ptr %15, i64 %idxprom.i50
%17 = load i16, ptr %arrayidx.i51, align 2, !tbaa !13
%18 = and i16 %17, 2048
%tobool13.not.i52 = icmp eq i16 %18, 0
br i1 %tobool13.not.i52, label %if.end7, label %while.body.i53
while.body.i53: ; preds = %while.cond.i48
%mul.i54 = mul nsw i32 %add23.i49, 10
%incdec.ptr14.i55 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr14.i55, ptr @p, align 8, !tbaa !5
%19 = load i8, ptr %14, align 1, !tbaa !9
%conv15.i56 = sext i8 %19 to i32
%sub.i57 = add i32 %mul.i54, -48
%add.i58 = add i32 %sub.i57, %conv15.i56
%cmp16.i59 = icmp sgt i32 %add.i58, 10000
br i1 %cmp16.i59, label %factor.exit60, label %while.cond.i48, !llvm.loop !15
factor.exit60: ; preds = %if.then.i38, %while.body.i53
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i1.i33) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1.i32) #6
br label %cleanup
if.end7: ; preds = %while.cond.i48, %if.then7.i34, %if.end.i42
%20 = phi ptr [ %incdec.ptr3.i43, %if.end.i42 ], [ %incdec.ptr8.i35, %if.then7.i34 ], [ %14, %while.cond.i48 ]
%r2.1.ph = phi i32 [ %.pre.i44, %if.end.i42 ], [ 0, %if.then7.i34 ], [ %add23.i49, %while.cond.i48 ]
%i2.1.ph = phi i32 [ %.pre25.i45, %if.end.i42 ], [ 1, %if.then7.i34 ], [ 0, %while.cond.i48 ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i1.i33) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1.i32) #6
%mul = mul nsw i32 %r2.1.ph, %r1.1
%mul8 = mul nsw i32 %i2.1.ph, %i1.1
%sub = sub nsw i32 %mul, %mul8
%mul9 = mul nsw i32 %i2.1.ph, %r1.1
%mul10 = mul nsw i32 %r2.1.ph, %i1.1
%add = add nsw i32 %mul9, %mul10
%cond = tail call i32 @llvm.abs.i32(i32 %sub, i1 true)
%cmp14 = icmp ugt i32 %cond, 10000
%cond22 = tail call i32 @llvm.abs.i32(i32 %add, i1 true)
%cmp23 = icmp ugt i32 %cond22, 10000
%or.cond = select i1 %cmp14, i1 true, i1 %cmp23
br i1 %or.cond, label %cleanup, label %while.cond
while.end: ; preds = %while.cond
store i32 %r1.1, ptr %r, align 4, !tbaa !11
store i32 %i1.1, ptr %i, align 4, !tbaa !11
br label %cleanup
cleanup: ; preds = %if.end7, %factor.exit60, %factor.exit.thread, %while.end
%retval.0 = phi i32 [ 1, %while.end ], [ 0, %factor.exit60 ], [ 0, %factor.exit.thread ], [ 0, %if.end7 ]
ret i32 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @calc(ptr nocapture noundef writeonly %r, ptr nocapture noundef writeonly %i) local_unnamed_addr #0 {
entry:
%r1.i128 = alloca i32, align 4
%i1.i129 = alloca i32, align 4
%r1.i103 = alloca i32, align 4
%i1.i104 = alloca i32, align 4
%r1.i77 = alloca i32, align 4
%i1.i78 = alloca i32, align 4
%r1.i67 = alloca i32, align 4
%i1.i68 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r1.i77) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i1.i78) #6
%0 = load ptr, ptr @p, align 8, !tbaa !5
%1 = load i8, ptr %0, align 1, !tbaa !9
switch i8 %1, label %if.else9.i89 [
i8 40, label %if.then.i83
i8 105, label %if.then7.i79
]
if.then.i83: ; preds = %entry
%incdec.ptr.i84 = getelementptr inbounds i8, ptr %0, i64 1
store ptr %incdec.ptr.i84, ptr @p, align 8, !tbaa !5
%call.i85 = call i32 @calc(ptr noundef nonnull %r1.i77, ptr noundef nonnull %i1.i78), !range !10
%tobool.not.i86 = icmp eq i32 %call.i85, 0
br i1 %tobool.not.i86, label %factor.exit102.thread, label %if.end.i87
if.end.i87: ; preds = %if.then.i83
%2 = load ptr, ptr @p, align 8, !tbaa !5
%incdec.ptr3.i88 = getelementptr inbounds i8, ptr %2, i64 1
store ptr %incdec.ptr3.i88, ptr @p, align 8, !tbaa !5
%.pre = load i32, ptr %r1.i77, align 4, !tbaa !11
%.pre260 = load i32, ptr %i1.i78, align 4, !tbaa !11
br label %factor.exit102
if.then7.i79: ; preds = %entry
%incdec.ptr8.i80 = getelementptr inbounds i8, ptr %0, i64 1
store ptr %incdec.ptr8.i80, ptr @p, align 8, !tbaa !5
br label %factor.exit102
if.else9.i89: ; preds = %entry
%call10.i91 = tail call ptr @__ctype_b_loc() #7
br label %while.cond.i90
while.cond.i90: ; preds = %while.body.i95, %if.else9.i89
%3 = phi ptr [ %incdec.ptr14.i97, %while.body.i95 ], [ %0, %if.else9.i89 ]
%add.i100223 = phi i32 [ %add.i100, %while.body.i95 ], [ 0, %if.else9.i89 ]
%4 = load ptr, ptr %call10.i91, align 8, !tbaa !5
%5 = load i8, ptr %3, align 1, !tbaa !9
%idxprom.i92 = sext i8 %5 to i64
%arrayidx.i93 = getelementptr inbounds i16, ptr %4, i64 %idxprom.i92
%6 = load i16, ptr %arrayidx.i93, align 2, !tbaa !13
%7 = and i16 %6, 2048
%tobool13.not.i94 = icmp eq i16 %7, 0
br i1 %tobool13.not.i94, label %factor.exit102, label %while.body.i95
while.body.i95: ; preds = %while.cond.i90
%mul.i96 = mul nsw i32 %add.i100223, 10
%incdec.ptr14.i97 = getelementptr inbounds i8, ptr %3, i64 1
store ptr %incdec.ptr14.i97, ptr @p, align 8, !tbaa !5
%8 = load i8, ptr %3, align 1, !tbaa !9
%conv15.i98 = sext i8 %8 to i32
%sub.i99 = add i32 %mul.i96, -48
%add.i100 = add i32 %sub.i99, %conv15.i98
%cmp16.i101 = icmp sgt i32 %add.i100, 10000
br i1 %cmp16.i101, label %factor.exit102.thread, label %while.cond.i90, !llvm.loop !15
factor.exit102.thread: ; preds = %while.body.i95, %if.then.i83
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i1.i78) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1.i77) #6
br label %cleanup
factor.exit102: ; preds = %while.cond.i90, %if.end.i87, %if.then7.i79
%9 = phi ptr [ %incdec.ptr3.i88, %if.end.i87 ], [ %incdec.ptr8.i80, %if.then7.i79 ], [ %3, %while.cond.i90 ]
%10 = phi i32 [ %.pre260, %if.end.i87 ], [ 1, %if.then7.i79 ], [ 0, %while.cond.i90 ]
%11 = phi i32 [ %.pre, %if.end.i87 ], [ 0, %if.then7.i79 ], [ %add.i100223, %while.cond.i90 ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i1.i78) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1.i77) #6
br label %while.cond.i
while.cond.i: ; preds = %factor.exit102, %if.end7.i
%12 = phi ptr [ %9, %factor.exit102 ], [ %24, %if.end7.i ]
%r1.i.1 = phi i32 [ %11, %factor.exit102 ], [ %sub.i, %if.end7.i ]
%i1.i.1 = phi i32 [ %10, %factor.exit102 ], [ %add.i, %if.end7.i ]
%13 = load i8, ptr %12, align 1, !tbaa !9
%cmp.i = icmp eq i8 %13, 42
br i1 %cmp.i, label %if.then2.i, label %while.cond
if.then2.i: ; preds = %while.cond.i
%incdec.ptr.i = getelementptr inbounds i8, ptr %12, i64 1
store ptr %incdec.ptr.i, ptr @p, align 8, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r1.i67) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i1.i68) #6
%14 = load i8, ptr %incdec.ptr.i, align 1, !tbaa !9
switch i8 %14, label %if.else9.i [
i8 40, label %if.then.i
i8 105, label %if.then7.i
]
if.then.i: ; preds = %if.then2.i
%incdec.ptr.i70 = getelementptr inbounds i8, ptr %12, i64 2
store ptr %incdec.ptr.i70, ptr @p, align 8, !tbaa !5
%call.i71 = call i32 @calc(ptr noundef nonnull %r1.i67, ptr noundef nonnull %i1.i68), !range !10
%tobool.not.i72 = icmp eq i32 %call.i71, 0
br i1 %tobool.not.i72, label %factor.exit.thread, label %if.end.i
if.end.i: ; preds = %if.then.i
%15 = load ptr, ptr @p, align 8, !tbaa !5
%incdec.ptr3.i = getelementptr inbounds i8, ptr %15, i64 1
store ptr %incdec.ptr3.i, ptr @p, align 8, !tbaa !5
%.pre265 = load i32, ptr %r1.i67, align 4, !tbaa !11
%.pre266 = load i32, ptr %i1.i68, align 4, !tbaa !11
br label %if.end7.i
if.then7.i: ; preds = %if.then2.i
%incdec.ptr8.i = getelementptr inbounds i8, ptr %12, i64 2
store ptr %incdec.ptr8.i, ptr @p, align 8, !tbaa !5
br label %if.end7.i
if.else9.i: ; preds = %if.then2.i
store i32 0, ptr %i1.i68, align 4, !tbaa !11
store i32 0, ptr %r1.i67, align 4, !tbaa !11
%call10.i = tail call ptr @__ctype_b_loc() #7
br label %while.cond.i73
while.cond.i73: ; preds = %while.body.i, %if.else9.i
%16 = phi ptr [ %incdec.ptr14.i, %while.body.i ], [ %incdec.ptr.i, %if.else9.i ]
%add.i76224 = phi i32 [ %add.i76, %while.body.i ], [ 0, %if.else9.i ]
%17 = load ptr, ptr %call10.i, align 8, !tbaa !5
%18 = load i8, ptr %16, align 1, !tbaa !9
%idxprom.i = sext i8 %18 to i64
%arrayidx.i = getelementptr inbounds i16, ptr %17, i64 %idxprom.i
%19 = load i16, ptr %arrayidx.i, align 2, !tbaa !13
%20 = and i16 %19, 2048
%tobool13.not.i = icmp eq i16 %20, 0
br i1 %tobool13.not.i, label %if.end7.i, label %while.body.i
while.body.i: ; preds = %while.cond.i73
%mul.i74 = mul nsw i32 %add.i76224, 10
%incdec.ptr14.i = getelementptr inbounds i8, ptr %16, i64 1
store ptr %incdec.ptr14.i, ptr @p, align 8, !tbaa !5
%21 = load i8, ptr %16, align 1, !tbaa !9
%conv15.i = sext i8 %21 to i32
%sub.i75 = add i32 %mul.i74, -48
%add.i76 = add i32 %sub.i75, %conv15.i
%cmp16.i = icmp sgt i32 %add.i76, 10000
br i1 %cmp16.i, label %factor.exit.thread, label %while.cond.i73, !llvm.loop !15
factor.exit.thread: ; preds = %if.then.i, %while.body.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i1.i68) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1.i67) #6
br label %cleanup
if.end7.i: ; preds = %while.cond.i73, %if.then7.i, %if.end.i
%22 = phi i32 [ 1, %if.then7.i ], [ %.pre266, %if.end.i ], [ 0, %while.cond.i73 ]
%23 = phi i32 [ 0, %if.then7.i ], [ %.pre265, %if.end.i ], [ %add.i76224, %while.cond.i73 ]
%24 = phi ptr [ %incdec.ptr8.i, %if.then7.i ], [ %incdec.ptr3.i, %if.end.i ], [ %16, %while.cond.i73 ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i1.i68) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1.i67) #6
%mul.i = mul nsw i32 %23, %r1.i.1
%mul8.i = mul nsw i32 %22, %i1.i.1
%sub.i = sub nsw i32 %mul.i, %mul8.i
%mul9.i = mul nsw i32 %22, %r1.i.1
%mul10.i = mul nsw i32 %23, %i1.i.1
%add.i = add nsw i32 %mul9.i, %mul10.i
%cond.i = tail call i32 @llvm.abs.i32(i32 %sub.i, i1 true)
%cmp14.i = icmp ugt i32 %cond.i, 10000
%cond22.i = tail call i32 @llvm.abs.i32(i32 %add.i, i1 true)
%cmp23.i = icmp ugt i32 %cond22.i, 10000
%or.cond.i = select i1 %cmp14.i, i1 true, i1 %cmp23.i
br i1 %or.cond.i, label %cleanup, label %while.cond.i
while.cond: ; preds = %while.cond.i, %if.end13
%25 = phi i8 [ %39, %if.end13 ], [ %13, %while.cond.i ]
%26 = phi ptr [ %38, %if.end13 ], [ %12, %while.cond.i ]
%r1.1 = phi i32 [ %r1.2, %if.end13 ], [ %r1.i.1, %while.cond.i ]
%i1.1 = phi i32 [ %storemerge, %if.end13 ], [ %i1.i.1, %while.cond.i ]
%cmp.not = icmp eq i8 %25, 43
switch i8 %25, label %while.end [
i8 45, label %if.end9
i8 43, label %if.end9
]
if.end9: ; preds = %while.cond, %while.cond
%incdec.ptr = getelementptr inbounds i8, ptr %26, i64 1
store ptr %incdec.ptr, ptr @p, align 8, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r1.i128) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i1.i129) #6
%27 = load i8, ptr %incdec.ptr, align 1, !tbaa !9
switch i8 %27, label %if.else9.i140 [
i8 40, label %if.then.i134
i8 105, label %if.then7.i130
]
if.then.i134: ; preds = %if.end9
%incdec.ptr.i135 = getelementptr inbounds i8, ptr %26, i64 2
store ptr %incdec.ptr.i135, ptr @p, align 8, !tbaa !5
%call.i136 = call i32 @calc(ptr noundef nonnull %r1.i128, ptr noundef nonnull %i1.i129), !range !10
%tobool.not.i137 = icmp eq i32 %call.i136, 0
br i1 %tobool.not.i137, label %factor.exit153.thread, label %if.end.i138
if.end.i138: ; preds = %if.then.i134
%28 = load ptr, ptr @p, align 8, !tbaa !5
%incdec.ptr3.i139 = getelementptr inbounds i8, ptr %28, i64 1
store ptr %incdec.ptr3.i139, ptr @p, align 8, !tbaa !5
%.pre261 = load i32, ptr %r1.i128, align 4, !tbaa !11
%.pre262 = load i32, ptr %i1.i129, align 4, !tbaa !11
br label %factor.exit153
if.then7.i130: ; preds = %if.end9
%incdec.ptr8.i131 = getelementptr inbounds i8, ptr %26, i64 2
store ptr %incdec.ptr8.i131, ptr @p, align 8, !tbaa !5
br label %factor.exit153
if.else9.i140: ; preds = %if.end9
store i32 0, ptr %i1.i129, align 4, !tbaa !11
store i32 0, ptr %r1.i128, align 4, !tbaa !11
%call10.i142 = tail call ptr @__ctype_b_loc() #7
br label %while.cond.i141
while.cond.i141: ; preds = %while.body.i146, %if.else9.i140
%29 = phi ptr [ %incdec.ptr14.i148, %while.body.i146 ], [ %incdec.ptr, %if.else9.i140 ]
%add.i151225 = phi i32 [ %add.i151, %while.body.i146 ], [ 0, %if.else9.i140 ]
%30 = load ptr, ptr %call10.i142, align 8, !tbaa !5
%31 = load i8, ptr %29, align 1, !tbaa !9
%idxprom.i143 = sext i8 %31 to i64
%arrayidx.i144 = getelementptr inbounds i16, ptr %30, i64 %idxprom.i143
%32 = load i16, ptr %arrayidx.i144, align 2, !tbaa !13
%33 = and i16 %32, 2048
%tobool13.not.i145 = icmp eq i16 %33, 0
br i1 %tobool13.not.i145, label %factor.exit153, label %while.body.i146
while.body.i146: ; preds = %while.cond.i141
%mul.i147 = mul nsw i32 %add.i151225, 10
%incdec.ptr14.i148 = getelementptr inbounds i8, ptr %29, i64 1
store ptr %incdec.ptr14.i148, ptr @p, align 8, !tbaa !5
%34 = load i8, ptr %29, align 1, !tbaa !9
%conv15.i149 = sext i8 %34 to i32
%sub.i150 = add i32 %mul.i147, -48
%add.i151 = add i32 %sub.i150, %conv15.i149
%cmp16.i152 = icmp sgt i32 %add.i151, 10000
br i1 %cmp16.i152, label %factor.exit153.thread, label %while.cond.i141, !llvm.loop !15
factor.exit153.thread: ; preds = %if.then.i134, %while.body.i146
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i1.i129) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1.i128) #6
br label %cleanup
factor.exit153: ; preds = %while.cond.i141, %if.end.i138, %if.then7.i130
%35 = phi ptr [ %incdec.ptr3.i139, %if.end.i138 ], [ %incdec.ptr8.i131, %if.then7.i130 ], [ %29, %while.cond.i141 ]
%36 = phi i32 [ %.pre262, %if.end.i138 ], [ 1, %if.then7.i130 ], [ 0, %while.cond.i141 ]
%37 = phi i32 [ %.pre261, %if.end.i138 ], [ 0, %if.then7.i130 ], [ %add.i151225, %while.cond.i141 ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i1.i129) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1.i128) #6
br label %while.cond.i46
while.cond.i46: ; preds = %factor.exit153, %if.end7.i54
%38 = phi ptr [ %35, %factor.exit153 ], [ %50, %if.end7.i54 ]
%r1.i40.2 = phi i32 [ %37, %factor.exit153 ], [ %sub.i57, %if.end7.i54 ]
%i1.i42.2 = phi i32 [ %36, %factor.exit153 ], [ %add.i60, %if.end7.i54 ]
%39 = load i8, ptr %38, align 1, !tbaa !9
%cmp.i47 = icmp eq i8 %39, 42
br i1 %cmp.i47, label %if.then2.i50, label %if.end13
if.then2.i50: ; preds = %while.cond.i46
%incdec.ptr.i51 = getelementptr inbounds i8, ptr %38, i64 1
store ptr %incdec.ptr.i51, ptr @p, align 8, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r1.i103) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i1.i104) #6
%40 = load i8, ptr %incdec.ptr.i51, align 1, !tbaa !9
switch i8 %40, label %if.else9.i114 [
i8 40, label %if.then.i109
i8 105, label %if.then7.i105
]
if.then.i109: ; preds = %if.then2.i50
%incdec.ptr.i110 = getelementptr inbounds i8, ptr %38, i64 2
store ptr %incdec.ptr.i110, ptr @p, align 8, !tbaa !5
%call.i = call i32 @calc(ptr noundef nonnull %r1.i103, ptr noundef nonnull %i1.i104), !range !10
%tobool.not.i111 = icmp eq i32 %call.i, 0
br i1 %tobool.not.i111, label %factor.exit127.thread, label %if.end.i112
if.end.i112: ; preds = %if.then.i109
%41 = load ptr, ptr @p, align 8, !tbaa !5
%incdec.ptr3.i113 = getelementptr inbounds i8, ptr %41, i64 1
store ptr %incdec.ptr3.i113, ptr @p, align 8, !tbaa !5
%.pre263 = load i32, ptr %r1.i103, align 4, !tbaa !11
%.pre264 = load i32, ptr %i1.i104, align 4, !tbaa !11
br label %if.end7.i54
if.then7.i105: ; preds = %if.then2.i50
%incdec.ptr8.i106 = getelementptr inbounds i8, ptr %38, i64 2
store ptr %incdec.ptr8.i106, ptr @p, align 8, !tbaa !5
br label %if.end7.i54
if.else9.i114: ; preds = %if.then2.i50
store i32 0, ptr %i1.i104, align 4, !tbaa !11
store i32 0, ptr %r1.i103, align 4, !tbaa !11
%call10.i116 = tail call ptr @__ctype_b_loc() #7
br label %while.cond.i115
while.cond.i115: ; preds = %while.body.i120, %if.else9.i114
%42 = phi ptr [ %incdec.ptr14.i122, %while.body.i120 ], [ %incdec.ptr.i51, %if.else9.i114 ]
%add.i125226 = phi i32 [ %add.i125, %while.body.i120 ], [ 0, %if.else9.i114 ]
%43 = load ptr, ptr %call10.i116, align 8, !tbaa !5
%44 = load i8, ptr %42, align 1, !tbaa !9
%idxprom.i117 = sext i8 %44 to i64
%arrayidx.i118 = getelementptr inbounds i16, ptr %43, i64 %idxprom.i117
%45 = load i16, ptr %arrayidx.i118, align 2, !tbaa !13
%46 = and i16 %45, 2048
%tobool13.not.i119 = icmp eq i16 %46, 0
br i1 %tobool13.not.i119, label %if.end7.i54, label %while.body.i120
while.body.i120: ; preds = %while.cond.i115
%mul.i121 = mul nsw i32 %add.i125226, 10
%incdec.ptr14.i122 = getelementptr inbounds i8, ptr %42, i64 1
store ptr %incdec.ptr14.i122, ptr @p, align 8, !tbaa !5
%47 = load i8, ptr %42, align 1, !tbaa !9
%conv15.i123 = sext i8 %47 to i32
%sub.i124 = add i32 %mul.i121, -48
%add.i125 = add i32 %sub.i124, %conv15.i123
%cmp16.i126 = icmp sgt i32 %add.i125, 10000
br i1 %cmp16.i126, label %factor.exit127.thread, label %while.cond.i115, !llvm.loop !15
factor.exit127.thread: ; preds = %if.then.i109, %while.body.i120
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i1.i104) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1.i103) #6
br label %cleanup
if.end7.i54: ; preds = %while.cond.i115, %if.then7.i105, %if.end.i112
%48 = phi i32 [ 1, %if.then7.i105 ], [ %.pre264, %if.end.i112 ], [ 0, %while.cond.i115 ]
%49 = phi i32 [ 0, %if.then7.i105 ], [ %.pre263, %if.end.i112 ], [ %add.i125226, %while.cond.i115 ]
%50 = phi ptr [ %incdec.ptr8.i106, %if.then7.i105 ], [ %incdec.ptr3.i113, %if.end.i112 ], [ %42, %while.cond.i115 ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i1.i104) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1.i103) #6
%mul.i55 = mul nsw i32 %49, %r1.i40.2
%mul8.i56 = mul nsw i32 %48, %i1.i42.2
%sub.i57 = sub nsw i32 %mul.i55, %mul8.i56
%mul9.i58 = mul nsw i32 %48, %r1.i40.2
%mul10.i59 = mul nsw i32 %49, %i1.i42.2
%add.i60 = add nsw i32 %mul9.i58, %mul10.i59
%cond.i61 = tail call i32 @llvm.abs.i32(i32 %sub.i57, i1 true)
%cmp14.i62 = icmp ugt i32 %cond.i61, 10000
%cond22.i63 = tail call i32 @llvm.abs.i32(i32 %add.i60, i1 true)
%cmp23.i64 = icmp ugt i32 %cond22.i63, 10000
%or.cond.i65 = select i1 %cmp14.i62, i1 true, i1 %cmp23.i64
br i1 %or.cond.i65, label %cleanup, label %while.cond.i46
if.end13: ; preds = %while.cond.i46
%51 = sub i32 0, %r1.i40.2
%r1.2.p = select i1 %cmp.not, i32 %r1.i40.2, i32 %51
%r1.2 = add i32 %r1.2.p, %r1.1
%52 = sub i32 0, %i1.i42.2
%storemerge.p = select i1 %cmp.not, i32 %i1.i42.2, i32 %52
%storemerge = add i32 %storemerge.p, %i1.1
%cond = tail call i32 @llvm.abs.i32(i32 %r1.2, i1 true)
%cmp23 = icmp ugt i32 %cond, 10000
%cond31 = tail call i32 @llvm.abs.i32(i32 %storemerge, i1 true)
%cmp32 = icmp ugt i32 %cond31, 10000
%or.cond = select i1 %cmp23, i1 true, i1 %cmp32
br i1 %or.cond, label %cleanup, label %while.cond
while.end: ; preds = %while.cond
store i32 %r1.1, ptr %r, align 4, !tbaa !11
store i32 %i1.1, ptr %i, align 4, !tbaa !11
br label %cleanup
cleanup: ; preds = %if.end7.i, %if.end13, %if.end7.i54, %factor.exit127.thread, %factor.exit153.thread, %factor.exit.thread, %factor.exit102.thread, %while.end
%retval.0 = phi i32 [ 1, %while.end ], [ 0, %factor.exit102.thread ], [ 0, %factor.exit.thread ], [ 0, %factor.exit153.thread ], [ 0, %factor.exit127.thread ], [ 0, %if.end7.i54 ], [ 0, %if.end13 ], [ 0, %if.end7.i ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%r = alloca i32, align 4
%i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #6
store ptr @buf, ptr @p, align 8, !tbaa !5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call20 = tail call ptr @fgets(ptr noundef nonnull @buf, i32 noundef 150, ptr noundef %0)
%cmp.not21 = icmp eq ptr %call20, null
br i1 %cmp.not21, label %while.end, label %while.body
while.body: ; preds = %entry, %while.cond.backedge
%call1 = call i32 @calc(ptr noundef nonnull %r, ptr noundef nonnull %i), !range !10
%tobool.not = icmp eq i32 %call1, 0
br i1 %tobool.not, label %if.then, label %if.end
if.then: ; preds = %while.body
%call2 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str)
br label %while.cond.backedge
while.cond.backedge: ; preds = %if.then5, %if.then12, %if.else14, %if.then8, %if.then
store ptr @buf, ptr @p, align 8, !tbaa !5
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = tail call ptr @fgets(ptr noundef nonnull @buf, i32 noundef 150, ptr noundef %1)
%cmp.not = icmp eq ptr %call, null
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !17
if.end: ; preds = %while.body
%2 = load i32, ptr %r, align 4, !tbaa !11
%cmp3 = icmp eq i32 %2, 0
%3 = load i32, ptr %i, align 4
%cmp4 = icmp eq i32 %3, 0
%or.cond = select i1 %cmp3, i1 %cmp4, i1 false
br i1 %or.cond, label %if.then5, label %if.else
if.then5: ; preds = %if.end
%call6 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %while.cond.backedge
if.else: ; preds = %if.end
br i1 %cmp4, label %if.then8, label %if.else10
if.then8: ; preds = %if.else
%call9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %2)
br label %while.cond.backedge
if.else10: ; preds = %if.else
br i1 %cmp3, label %if.then12, label %if.else14
if.then12: ; preds = %if.else10
%call13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %3)
br label %while.cond.backedge
if.else14: ; preds = %if.else10
%call15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %2, i32 noundef %3)
br label %while.cond.backedge
while.end: ; preds = %while.cond.backedge, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #5
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-math"="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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{i32 0, i32 2}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
|
#include<stdio.h>
#include<string.h>
int main(){
int N,L;
scanf("%d%d",&N,&L);
int i,j;
char s[N][L+1];
char tmp[L+1];
char str[10001];
for(i=0;i<N;i++){
scanf("%s",s[i]);
}
//printf("%s\n",s[0]);
for(i=1;i<N;i++){
for(j=1;j<N;j++){
if(strcmp(s[j-1],s[j])>0){
strcpy(tmp,s[j-1]);
strcpy(s[j-1],s[j]);
strcpy(s[j],tmp);
}
}
}//文字列を辞書中にソート
for(i=0;i<N;i++){
strcat(str,s[i]);
}
printf("%s",str);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285376/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285376/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%N = alloca i32, align 4
%L = alloca i32, align 4
%str = alloca [10001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %L) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %L)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = load i32, ptr %L, align 4, !tbaa !5
%add = add nsw i32 %2, 1
%3 = zext i32 %add to i64
%4 = call ptr @llvm.stacksave.p0()
%5 = mul nuw i64 %3, %1
%vla = alloca i8, i64 %5, align 16
%6 = load i32, ptr %L, align 4, !tbaa !5
%add1 = add nsw i32 %6, 1
%7 = zext i32 %add1 to i64
%vla2 = alloca i8, i64 %7, align 16
call void @llvm.lifetime.start.p0(i64 10001, ptr nonnull %str) #6
%8 = load i32, ptr %N, align 4, !tbaa !5
%cmp60 = icmp sgt i32 %8, 0
br i1 %cmp60, label %for.body, label %for.end43
for.cond4.preheader: ; preds = %for.body
%cmp564 = icmp sgt i32 %13, 1
br i1 %cmp564, label %for.cond7.preheader.us.preheader, label %for.cond35.preheader
for.cond7.preheader.us.preheader: ; preds = %for.cond4.preheader
%wide.trip.count = zext i32 %13 to i64
br label %for.cond7.preheader.us
for.cond7.preheader.us: ; preds = %for.cond7.preheader.us.preheader, %for.cond7.for.inc32_crit_edge.us
%i.165.us = phi i32 [ %inc33.us, %for.cond7.for.inc32_crit_edge.us ], [ 1, %for.cond7.preheader.us.preheader ]
br label %for.body9.us
for.body9.us: ; preds = %for.cond7.preheader.us, %for.inc29.us
%indvars.iv70 = phi i64 [ 1, %for.cond7.preheader.us ], [ %indvars.iv.next71, %for.inc29.us ]
%9 = add nsw i64 %indvars.iv70, -1
%10 = mul nuw nsw i64 %9, %3
%arrayidx11.us = getelementptr inbounds i8, ptr %vla, i64 %10
%11 = mul nuw nsw i64 %indvars.iv70, %3
%arrayidx13.us = getelementptr inbounds i8, ptr %vla, i64 %11
%call14.us = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx11.us, ptr noundef nonnull dereferenceable(1) %arrayidx13.us) #7
%cmp15.us = icmp sgt i32 %call14.us, 0
br i1 %cmp15.us, label %if.then.us, label %for.inc29.us
if.then.us: ; preds = %for.body9.us
%call19.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %vla2, ptr noundef nonnull dereferenceable(1) %arrayidx11.us) #6
%call25.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx11.us, ptr noundef nonnull dereferenceable(1) %arrayidx13.us) #6
%call28.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx13.us, ptr noundef nonnull dereferenceable(1) %vla2) #6
br label %for.inc29.us
for.inc29.us: ; preds = %if.then.us, %for.body9.us
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
%exitcond.not = icmp eq i64 %indvars.iv.next71, %wide.trip.count
br i1 %exitcond.not, label %for.cond7.for.inc32_crit_edge.us, label %for.body9.us, !llvm.loop !9
for.cond7.for.inc32_crit_edge.us: ; preds = %for.inc29.us
%inc33.us = add nuw nsw i32 %i.165.us, 1
%exitcond74.not = icmp eq i32 %inc33.us, %13
br i1 %exitcond74.not, label %for.cond35.preheader, label %for.cond7.preheader.us, !llvm.loop !11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%12 = mul nuw nsw i64 %indvars.iv, %3
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %12
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%13 = load i32, ptr %N, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp = icmp slt i64 %indvars.iv.next, %14
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !12
for.cond35.preheader: ; preds = %for.cond7.for.inc32_crit_edge.us, %for.cond4.preheader
%cmp3666 = icmp sgt i32 %13, 0
br i1 %cmp3666, label %for.body37.preheader, label %for.end43
for.body37.preheader: ; preds = %for.cond35.preheader
%wide.trip.count78 = zext i32 %13 to i64
br label %for.body37
for.body37: ; preds = %for.body37.preheader, %for.body37
%indvars.iv75 = phi i64 [ 0, %for.body37.preheader ], [ %indvars.iv.next76, %for.body37 ]
%15 = mul nuw nsw i64 %indvars.iv75, %3
%arrayidx39 = getelementptr inbounds i8, ptr %vla, i64 %15
%call40 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %arrayidx39) #6
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%exitcond79.not = icmp eq i64 %indvars.iv.next76, %wide.trip.count78
br i1 %exitcond79.not, label %for.end43, label %for.body37, !llvm.loop !13
for.end43: ; preds = %for.body37, %entry, %for.cond35.preheader
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %str)
call void @llvm.lifetime.end.p0(i64 10001, ptr nonnull %str) #6
call void @llvm.stackrestore.p0(ptr %4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %L) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: 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 nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#include<string.h>
#define N 529
int main(void)
{
char s[N][N],a[N];
int n,l,i,j;
scanf("%d%d",&n,&l);
for(i=0;i<n;i++){
scanf("%s",s[i]);
}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(strcmp(s[j-1],s[j])>0){
strcpy(a,s[j-1]);
strcpy(s[j-1],s[j]);
strcpy(s[j],a);
}
}
}
for(i=0;i<n;i++){
printf("%s",s[i]);
}
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285419/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285419/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%s = alloca [529 x [529 x i8]], align 16
%a = alloca [529 x i8], align 16
%n = alloca i32, align 4
%l = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 279841, ptr nonnull %s) #6
call void @llvm.lifetime.start.p0(i64 529, 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 %l) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %l)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp66 = icmp sgt i32 %0, 0
br i1 %cmp66, label %for.body, label %for.end50
for.cond2.preheader: ; preds = %for.body
%cmp370 = icmp sgt i32 %2, 0
br i1 %cmp370, label %for.cond5.preheader.us.preheader, label %for.end50
for.cond5.preheader.us.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %2 to i64
br label %for.cond5.preheader.us
for.cond5.preheader.us: ; preds = %for.cond5.preheader.us.preheader, %for.cond5.for.inc38_crit_edge.us
%i.171.us = phi i32 [ %inc39.us, %for.cond5.for.inc38_crit_edge.us ], [ 0, %for.cond5.preheader.us.preheader ]
br label %for.body7.us
for.body7.us: ; preds = %for.cond5.preheader.us, %for.inc35.us
%indvars.iv76 = phi i64 [ 0, %for.cond5.preheader.us ], [ %indvars.iv.next77, %for.inc35.us ]
%1 = add nsw i64 %indvars.iv76, -1
%arrayidx9.us = getelementptr inbounds [529 x [529 x i8]], ptr %s, i64 0, i64 %1
%arrayidx12.us = getelementptr inbounds [529 x [529 x i8]], ptr %s, i64 0, i64 %indvars.iv76
%call14.us = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx9.us, ptr noundef nonnull dereferenceable(1) %arrayidx12.us) #7
%cmp15.us = icmp sgt i32 %call14.us, 0
br i1 %cmp15.us, label %if.then.us, label %for.inc35.us
if.then.us: ; preds = %for.body7.us
%call21.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %arrayidx9.us) #6
%call29.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx9.us, ptr noundef nonnull dereferenceable(1) %arrayidx12.us) #6
%call34.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx12.us, ptr noundef nonnull dereferenceable(1) %a) #6
br label %for.inc35.us
for.inc35.us: ; preds = %if.then.us, %for.body7.us
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%exitcond.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count
br i1 %exitcond.not, label %for.cond5.for.inc38_crit_edge.us, label %for.body7.us, !llvm.loop !9
for.cond5.for.inc38_crit_edge.us: ; preds = %for.inc35.us
%inc39.us = add nuw nsw i32 %i.171.us, 1
%exitcond80.not = icmp eq i32 %inc39.us, %2
br i1 %exitcond80.not, label %for.cond41.preheader, 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 [529 x [529 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
%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 !12
for.cond41.preheader: ; preds = %for.cond5.for.inc38_crit_edge.us
br i1 %cmp370, label %for.body43, label %for.end50
for.body43: ; preds = %for.cond41.preheader, %for.body43
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %for.body43 ], [ 0, %for.cond41.preheader ]
%arrayidx45 = getelementptr inbounds [529 x [529 x i8]], ptr %s, i64 0, i64 %indvars.iv81
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %arrayidx45)
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp42 = icmp slt i64 %indvars.iv.next82, %5
br i1 %cmp42, label %for.body43, label %for.end50, !llvm.loop !13
for.end50: ; preds = %for.body43, %entry, %for.cond2.preheader, %for.cond41.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 529, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 279841, ptr nonnull %s) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int cmp(const void *a, const void *b)
{
return strcmp(a,b);
}
int main(void)
{
int n,l;
char s[110][110];
scanf("%d%d", &n, &l);
for(int i=0;i<n;i++) scanf("%s", s[i]);
qsort(s,n,sizeof(s[0]),cmp);
for(int i=0;i<n;i++) printf("%s",s[i]);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285462/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285462/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #7
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%l = alloca i32, align 4
%s = alloca [110 x [110 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #8
call void @llvm.lifetime.start.p0(i64 12100, ptr nonnull %s) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %l)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %3, %for.body ]
call void @qsort(ptr noundef nonnull %s, i64 noundef %conv.pre-phi, i64 noundef 110, ptr noundef nonnull @cmp) #8
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp523 = icmp sgt i32 %1, 0
br i1 %cmp523, label %for.body8, label %for.cond.cleanup7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [110 x [110 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
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond.cleanup7: ; preds = %for.body8, %for.cond.cleanup
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 12100, ptr nonnull %s) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
for.body8: ; preds = %for.cond.cleanup, %for.body8
%indvars.iv27 = phi i64 [ %indvars.iv.next28, %for.body8 ], [ 0, %for.cond.cleanup ]
%arrayidx10 = getelementptr inbounds [110 x [110 x i8]], ptr %s, i64 0, i64 %indvars.iv27
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %arrayidx10)
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp5 = icmp slt i64 %indvars.iv.next28, %5
br i1 %cmp5, label %for.body8, label %for.cond.cleanup7, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
attributes #0 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
int n, l;
char str[100][100 + 1];
char tmp[101];
scanf("%d%d", &n, &l);
for (int i = 0; i < n; i++) {
scanf("%s", str[i]);
}
for (int j = 0; j < n - 1; j++) {
for (int i = 0; i < n - 1; i++) {
if (strcmp(str[i], str[i + 1]) > 0) {
strcpy(tmp, str[i + 1]);
strcpy(str[i + 1], str[i]);
strcpy(str[i], tmp);
}
}
}
for (int i = 0; i < n; i++) {
printf("%s", str[i]);
}
putchar('\n');
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285527/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285527/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%l = alloca i32, align 4
%str = alloca [100 x [101 x i8]], align 16
%tmp = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #5
call void @llvm.lifetime.start.p0(i64 10100, ptr nonnull %str) #5
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %tmp) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %l)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp70 = icmp sgt i32 %0, 0
br i1 %cmp70, label %for.body, label %for.cond.cleanup48
for.cond2.preheader: ; preds = %for.body
%sub = add i32 %1, -1
%cmp374 = icmp sgt i32 %1, 1
br i1 %cmp374, label %for.cond7.preheader.us.preheader, label %for.cond46.preheader
for.cond7.preheader.us.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %sub to i64
br label %for.cond7.preheader.us
for.cond7.preheader.us: ; preds = %for.cond7.preheader.us.preheader, %for.cond7.for.cond.cleanup10_crit_edge.us
%j.075.us = phi i32 [ %inc43.us, %for.cond7.for.cond.cleanup10_crit_edge.us ], [ 0, %for.cond7.preheader.us.preheader ]
br label %for.body11.us
for.body11.us: ; preds = %for.cond7.preheader.us, %for.inc39.us
%indvars.iv80 = phi i64 [ 0, %for.cond7.preheader.us ], [ %indvars.iv.next81, %for.inc39.us ]
%arrayidx13.us = getelementptr inbounds [100 x [101 x i8]], ptr %str, i64 0, i64 %indvars.iv80
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%arrayidx16.us = getelementptr inbounds [100 x [101 x i8]], ptr %str, i64 0, i64 %indvars.iv.next81
%call18.us = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx13.us, ptr noundef nonnull dereferenceable(1) %arrayidx16.us) #6
%cmp19.us = icmp sgt i32 %call18.us, 0
br i1 %cmp19.us, label %if.then.us, label %for.inc39.us
if.then.us: ; preds = %for.body11.us
%call25.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %tmp, ptr noundef nonnull dereferenceable(1) %arrayidx16.us) #5
%call33.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx16.us, ptr noundef nonnull dereferenceable(1) %arrayidx13.us) #5
%call38.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx13.us, ptr noundef nonnull dereferenceable(1) %tmp) #5
br label %for.inc39.us
for.inc39.us: ; preds = %if.then.us, %for.body11.us
%exitcond.not = icmp eq i64 %indvars.iv.next81, %wide.trip.count
br i1 %exitcond.not, label %for.cond7.for.cond.cleanup10_crit_edge.us, label %for.body11.us, !llvm.loop !9
for.cond7.for.cond.cleanup10_crit_edge.us: ; preds = %for.inc39.us
%inc43.us = add nuw nsw i32 %j.075.us, 1
%exitcond83.not = icmp eq i32 %inc43.us, %sub
br i1 %exitcond83.not, label %for.cond46.preheader, label %for.cond7.preheader.us, !llvm.loop !11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x [101 x i8]], ptr %str, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !12
for.cond46.preheader: ; preds = %for.cond7.for.cond.cleanup10_crit_edge.us, %for.cond2.preheader
%cmp4776 = icmp sgt i32 %1, 0
br i1 %cmp4776, label %for.body49, label %for.cond.cleanup48
for.cond.cleanup48: ; preds = %for.body49, %entry, %for.cond46.preheader
%3 = load ptr, ptr @stdout, align 8, !tbaa !13
%call.i = call i32 @putc(i32 noundef 10, ptr noundef %3)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %tmp) #5
call void @llvm.lifetime.end.p0(i64 10100, ptr nonnull %str) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body49: ; preds = %for.cond46.preheader, %for.body49
%indvars.iv84 = phi i64 [ %indvars.iv.next85, %for.body49 ], [ 0, %for.cond46.preheader ]
%arrayidx51 = getelementptr inbounds [100 x [101 x i8]], ptr %str, i64 0, i64 %indvars.iv84
%call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %arrayidx51)
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp47 = icmp slt i64 %indvars.iv.next85, %5
br i1 %cmp47, label %for.body49, label %for.cond.cleanup48, !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: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
#include<string.h>
int main(void){
int n,l,i,j;
char s[100][101],c[101];
scanf("%d %d",&n,&l);
for(i=0;i<n;i++)
scanf("%s",s[i]);
for(i=0;i<n-1;i++){
for(j=n-1;j>i;j--){
if(strcmp(s[j-1],s[j])>0){
strcpy(c,s[j-1]);
strcpy(s[j-1],s[j]);
strcpy(s[j],c);
} } }
for(i=0;i<n;i++)
printf("%s",s[i]);
putchar('\n');
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285570/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285570/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%l = alloca i32, align 4
%s = alloca [100 x [101 x i8]], align 16
%c = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #5
call void @llvm.lifetime.start.p0(i64 10100, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %c) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %l)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp68 = icmp sgt i32 %0, 0
br i1 %cmp68, label %for.body, label %for.end51
for.cond2.preheader: ; preds = %for.body
%cmp371 = icmp sgt i32 %3, 1
br i1 %cmp371, label %for.cond6.preheader.preheader, label %for.cond42.preheader
for.cond6.preheader.preheader: ; preds = %for.cond2.preheader
%sub = add nsw i32 %3, -1
%1 = zext i32 %3 to i64
%2 = add nsw i64 %1, -1
%wide.trip.count = zext i32 %sub to i64
br label %for.cond6.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x [101 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
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.inc39
%indvars.iv80 = phi i64 [ 0, %for.cond6.preheader.preheader ], [ %indvars.iv.next81, %for.inc39 ]
br label %for.body8
for.cond42.preheader: ; preds = %for.inc39, %for.cond2.preheader
%cmp4373 = icmp sgt i32 %3, 0
br i1 %cmp4373, label %for.body44, label %for.end51
for.body8: ; preds = %for.cond6.preheader, %for.inc37
%indvars.iv77 = phi i64 [ %2, %for.cond6.preheader ], [ %indvars.iv.next78, %for.inc37 ]
%indvars.iv.next78 = add nsw i64 %indvars.iv77, -1
%arrayidx11 = getelementptr inbounds [100 x [101 x i8]], ptr %s, i64 0, i64 %indvars.iv.next78
%arrayidx14 = getelementptr inbounds [100 x [101 x i8]], ptr %s, i64 0, i64 %indvars.iv77
%call16 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx11, ptr noundef nonnull dereferenceable(1) %arrayidx14) #6
%cmp17 = icmp sgt i32 %call16, 0
br i1 %cmp17, label %if.then, label %for.inc37
if.then: ; preds = %for.body8
%call23 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %c, ptr noundef nonnull dereferenceable(1) %arrayidx11) #5
%call31 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx11, ptr noundef nonnull dereferenceable(1) %arrayidx14) #5
%call36 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx14, ptr noundef nonnull dereferenceable(1) %c) #5
br label %for.inc37
for.inc37: ; preds = %for.body8, %if.then
%cmp7 = icmp sgt i64 %indvars.iv.next78, %indvars.iv80
br i1 %cmp7, label %for.body8, label %for.inc39, !llvm.loop !11
for.inc39: ; preds = %for.inc37
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%exitcond.not = icmp eq i64 %indvars.iv.next81, %wide.trip.count
br i1 %exitcond.not, label %for.cond42.preheader, label %for.cond6.preheader, !llvm.loop !12
for.body44: ; preds = %for.cond42.preheader, %for.body44
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.body44 ], [ 0, %for.cond42.preheader ]
%arrayidx46 = getelementptr inbounds [100 x [101 x i8]], ptr %s, i64 0, i64 %indvars.iv83
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %arrayidx46)
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp43 = icmp slt i64 %indvars.iv.next84, %6
br i1 %cmp43, label %for.body44, label %for.end51, !llvm.loop !13
for.end51: ; preds = %for.body44, %entry, %for.cond42.preheader
%7 = load ptr, ptr @stdout, align 8, !tbaa !14
%call.i = call i32 @putc(i32 noundef 10, ptr noundef %7)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 10100, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #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 nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #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: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = 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 = !{!"any pointer", !7, i64 0}
|
#include<stdio.h>
int thw(int,int);
void chng(char*,int*,int,int);
int thw(int s,int b)
{
for(int i=1;i<s;i++) b = b * 10;
//printf("b=%d\n",b);
return b;
}
void chng(char *box,int *A,int s,int cnt)
{
int tmp,bt=0;
for(int i=s-1;i>=0;i--)
{
tmp = box[i]-'0';
//printf("boxは?=%d,thwけっか%d\n",box[i],thw(s-i,tmp));
bt += thw(s-i,tmp);
// printf("bt=%d\n",bt);
}
A[cnt] = bt;
// printf("box=%c,Acnt=%d,s=%d,cnt=%d\n\n",box[0],A[cnt],s,cnt);
}
int main()
{
char box[10],tmp;
int A[101],s=0,cnt=0,flg=0;
while((tmp = getchar()) != EOF)
{
//printf("tmpの中=%c\n",tmp);
if('0' <= tmp && tmp <= '9'){
//printf("a\n");
box[s] = tmp;
s += 1;
flg=0;
}else {
//printf("tmp数%d,+数%d\n",tmp,'+');
//printf("check1 \n");
switch(tmp){
case '+':
// printf("check2 \n");
cnt -=1;
//printf("Acnt=%dAcnt+1=%d\n",A[cnt-1],A[cnt]);
A[cnt-1]=A[cnt-1]+A[cnt];
//printf("計算結果=%d\n",A[cnt-1]);
//printf("cntの数=%d\n",cnt);
flg = 1;
break;
case '-':
//printf("check3 \n");
cnt -=1;
//printf("Acnt=%dAcnt+1=%d\n",A[cnt-1],A[cnt]);
A[cnt-1]=A[cnt-1]-A[cnt];
//printf("計算結果=%d\n",A[cnt]);
//printf("cntの数=%d\n",cnt);
flg = 1;
break;
case '*':
//printf("check4 \n");
cnt -=1;
//printf("Acnt=%dAcnt+1=%d\n",A[cnt-1],A[cnt]);
A[cnt-1]=A[cnt-1]*A[cnt];
///printf("計算結果=%d\n",A[cnt+1]);
//printf("cntの数=%d\n",cnt);
flg = 1;
break;
case '/':
//printf("check5 \n");
cnt -=1;
// printf("Acnt=%dAcnt+1=%d\n",A[cnt-1],A[cnt]);
A[cnt-1]=A[cnt-1]/A[cnt];
//printf("計算結果=%d\n",A[cnt-1]);
//printf("cntの数=%d\n",cnt);
flg = 1;
break;
default :
if(flg == 0){
//printf("check default\n");
chng(box,A,s,cnt);
break;
}
}
if(flg == 0) cnt +=1;//printf("flg通過\n");} //printf("cnt chk2=%d\n",cnt);
s = 0;
}
}
printf("%d\n",A[0]);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285628/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285628/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @thw(i32 noundef %s, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cmp3 = icmp sgt i32 %s, 1
br i1 %cmp3, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = add i32 %s, -1
%min.iters.check = icmp ult i32 %s, 9
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %0, -8
%ind.end = or i32 %n.vec, 1
%1 = insertelement <4 x i32> <i32 poison, i32 1, i32 1, i32 1>, i32 %b, i64 0
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> [ %1, %vector.ph ], [ %2, %vector.body ]
%vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %3, %vector.body ]
%2 = mul <4 x i32> %vec.phi, <i32 10, i32 10, i32 10, i32 10>
%3 = mul <4 x i32> %vec.phi6, <i32 10, i32 10, i32 10, i32 10>
%index.next = add nuw i32 %index, 8
%4 = icmp eq i32 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !5
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %3, %2
%5 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %0, %n.vec
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
%b.addr.04.ph = phi i32 [ %b, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.addr.0.lcssa = phi i32 [ %b, %entry ], [ %5, %middle.block ], [ %mul, %for.body ]
ret i32 %b.addr.0.lcssa
for.body: ; preds = %for.body.preheader7, %for.body
%i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader7 ]
%b.addr.04 = phi i32 [ %mul, %for.body ], [ %b.addr.04.ph, %for.body.preheader7 ]
%mul = mul nsw i32 %b.addr.04, 10
%inc = add nuw nsw i32 %i.05, 1
%exitcond.not = icmp eq i32 %inc, %s
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: 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 @chng(ptr nocapture noundef readonly %box, ptr nocapture noundef writeonly %A, i32 noundef %s, i32 noundef %cnt) local_unnamed_addr #2 {
entry:
%cmp10 = icmp sgt i32 %s, 0
br i1 %cmp10, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = zext i32 %s to i64
br label %for.body
for.cond.cleanup: ; preds = %thw.exit, %entry
%bt.0.lcssa = phi i32 [ 0, %entry ], [ %add, %thw.exit ]
%idxprom3 = sext i32 %cnt to i64
%arrayidx4 = getelementptr inbounds i32, ptr %A, i64 %idxprom3
store i32 %bt.0.lcssa, ptr %arrayidx4, align 4, !tbaa !10
ret void
for.body: ; preds = %for.body.preheader, %thw.exit
%indvar = phi i32 [ 0, %for.body.preheader ], [ %indvar.next, %thw.exit ]
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %thw.exit ]
%bt.011 = phi i32 [ 0, %for.body.preheader ], [ %add, %thw.exit ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%indvars = trunc i64 %indvars.iv.next to i32
%idxprom = and i64 %indvars.iv.next, 4294967295
%arrayidx = getelementptr inbounds i8, ptr %box, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !14
%conv = sext i8 %1 to i32
%sub1 = add nsw i32 %conv, -48
%sub2 = sub nsw i32 %s, %indvars
%cmp3.i = icmp ugt i32 %sub2, 1
br i1 %cmp3.i, label %for.body.i.preheader, label %thw.exit
for.body.i.preheader: ; preds = %for.body
%min.iters.check = icmp ult i32 %indvar, 8
br i1 %min.iters.check, label %for.body.i.preheader15, label %vector.ph
vector.ph: ; preds = %for.body.i.preheader
%n.vec = and i32 %indvar, -8
%ind.end = or i32 %n.vec, 1
%2 = insertelement <4 x i32> <i32 poison, i32 1, i32 1, i32 1>, i32 %sub1, i64 0
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> [ %2, %vector.ph ], [ %3, %vector.body ]
%vec.phi14 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %4, %vector.body ]
%3 = mul <4 x i32> %vec.phi, <i32 10, i32 10, i32 10, i32 10>
%4 = mul <4 x i32> %vec.phi14, <i32 10, i32 10, i32 10, i32 10>
%index.next = add nuw i32 %index, 8
%5 = icmp eq i32 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %4, %3
%6 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %indvar, %n.vec
br i1 %cmp.n, label %thw.exit, label %for.body.i.preheader15
for.body.i.preheader15: ; preds = %for.body.i.preheader, %middle.block
%i.05.i.ph = phi i32 [ 1, %for.body.i.preheader ], [ %ind.end, %middle.block ]
%b.addr.04.i.ph = phi i32 [ %sub1, %for.body.i.preheader ], [ %6, %middle.block ]
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader15, %for.body.i
%i.05.i = phi i32 [ %inc.i, %for.body.i ], [ %i.05.i.ph, %for.body.i.preheader15 ]
%b.addr.04.i = phi i32 [ %mul.i, %for.body.i ], [ %b.addr.04.i.ph, %for.body.i.preheader15 ]
%mul.i = mul nsw i32 %b.addr.04.i, 10
%inc.i = add nuw nsw i32 %i.05.i, 1
%exitcond.not.i = icmp eq i32 %inc.i, %sub2
br i1 %exitcond.not.i, label %thw.exit, label %for.body.i, !llvm.loop !16
thw.exit: ; preds = %for.body.i, %middle.block, %for.body
%b.addr.0.lcssa.i = phi i32 [ %sub1, %for.body ], [ %6, %middle.block ], [ %mul.i, %for.body.i ]
%add = add nsw i32 %b.addr.0.lcssa.i, %bt.011
%cmp = icmp sgt i64 %indvars.iv, 1
%indvar.next = add i32 %indvar, 1
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !17
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%box = alloca [10 x i8], align 1
%A = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %box) #7
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %A) #7
%0 = load ptr, ptr @stdin, align 8, !tbaa !18
%call.i90 = tail call i32 @getc(ptr noundef %0)
%sext92 = shl i32 %call.i90, 24
%cmp.not94 = icmp ne i32 %sext92, -16777216
tail call void @llvm.assume(i1 %cmp.not94)
br label %while.body
while.body: ; preds = %entry, %if.end59
%sext99 = phi i32 [ %sext, %if.end59 ], [ %sext92, %entry ]
%conv98.in = phi i32 [ %call.i, %if.end59 ], [ %call.i90, %entry ]
%flg.097 = phi i32 [ %flg.2, %if.end59 ], [ 0, %entry ]
%cnt.096 = phi i32 [ %cnt.3, %if.end59 ], [ 0, %entry ]
%s.095 = phi i32 [ %s.1, %if.end59 ], [ 0, %entry ]
%1 = add i32 %sext99, -788529153
%or.cond = icmp ult i32 %1, 184549375
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %while.body
%conv98 = trunc i32 %conv98.in to i8
%idxprom = sext i32 %s.095 to i64
%arrayidx = getelementptr inbounds [10 x i8], ptr %box, i64 0, i64 %idxprom
store i8 %conv98, ptr %arrayidx, align 1, !tbaa !14
%add = add nsw i32 %s.095, 1
br label %if.end59
if.else: ; preds = %while.body
%conv1100 = ashr exact i32 %sext99, 24
switch i32 %conv1100, label %sw.default [
i32 43, label %sw.bb
i32 45, label %sw.bb19
i32 42, label %sw.bb30
i32 47, label %sw.bb40
]
sw.bb: ; preds = %if.else
%sub = add nsw i32 %cnt.096, -1
%sub10 = add nsw i32 %cnt.096, -2
%idxprom11 = sext i32 %sub10 to i64
%arrayidx12 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %idxprom11
%2 = load i32, ptr %arrayidx12, align 4, !tbaa !10
%idxprom13 = sext i32 %sub to i64
%arrayidx14 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %idxprom13
%3 = load i32, ptr %arrayidx14, align 4, !tbaa !10
%add15 = add nsw i32 %3, %2
store i32 %add15, ptr %arrayidx12, align 4, !tbaa !10
br label %if.end59
sw.bb19: ; preds = %if.else
%sub20 = add nsw i32 %cnt.096, -1
%sub21 = add nsw i32 %cnt.096, -2
%idxprom22 = sext i32 %sub21 to i64
%arrayidx23 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %idxprom22
%4 = load i32, ptr %arrayidx23, align 4, !tbaa !10
%idxprom24 = sext i32 %sub20 to i64
%arrayidx25 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %idxprom24
%5 = load i32, ptr %arrayidx25, align 4, !tbaa !10
%sub26 = sub nsw i32 %4, %5
store i32 %sub26, ptr %arrayidx23, align 4, !tbaa !10
br label %if.end59
sw.bb30: ; preds = %if.else
%sub31 = add nsw i32 %cnt.096, -1
%sub32 = add nsw i32 %cnt.096, -2
%idxprom33 = sext i32 %sub32 to i64
%arrayidx34 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %idxprom33
%6 = load i32, ptr %arrayidx34, align 4, !tbaa !10
%idxprom35 = sext i32 %sub31 to i64
%arrayidx36 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %idxprom35
%7 = load i32, ptr %arrayidx36, align 4, !tbaa !10
%mul = mul nsw i32 %7, %6
store i32 %mul, ptr %arrayidx34, align 4, !tbaa !10
br label %if.end59
sw.bb40: ; preds = %if.else
%sub41 = add nsw i32 %cnt.096, -1
%sub42 = add nsw i32 %cnt.096, -2
%idxprom43 = sext i32 %sub42 to i64
%arrayidx44 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %idxprom43
%8 = load i32, ptr %arrayidx44, align 4, !tbaa !10
%idxprom45 = sext i32 %sub41 to i64
%arrayidx46 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %idxprom45
%9 = load i32, ptr %arrayidx46, align 4, !tbaa !10
%div = sdiv i32 %8, %9
store i32 %div, ptr %arrayidx44, align 4, !tbaa !10
br label %if.end59
sw.default: ; preds = %if.else
%cmp50 = icmp eq i32 %flg.097, 0
br i1 %cmp50, label %if.then52, label %if.end59
if.then52: ; preds = %sw.default
%cmp10.i = icmp sgt i32 %s.095, 0
br i1 %cmp10.i, label %for.body.preheader.i, label %.loopexit
for.body.preheader.i: ; preds = %if.then52
%10 = zext i32 %s.095 to i64
br label %for.body.i
for.body.i: ; preds = %thw.exit.i, %for.body.preheader.i
%indvar = phi i32 [ %indvar.next, %thw.exit.i ], [ 0, %for.body.preheader.i ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %thw.exit.i ], [ %10, %for.body.preheader.i ]
%bt.011.i = phi i32 [ %add.i, %thw.exit.i ], [ 0, %for.body.preheader.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%indvars.i = trunc i64 %indvars.iv.next.i to i32
%idxprom.i = and i64 %indvars.iv.next.i, 4294967295
%arrayidx.i = getelementptr inbounds i8, ptr %box, i64 %idxprom.i
%11 = load i8, ptr %arrayidx.i, align 1, !tbaa !14
%conv.i = sext i8 %11 to i32
%sub1.i = add nsw i32 %conv.i, -48
%sub2.i = sub nsw i32 %s.095, %indvars.i
%cmp3.i.i = icmp ugt i32 %sub2.i, 1
br i1 %cmp3.i.i, label %for.body.i.i.preheader, label %thw.exit.i
for.body.i.i.preheader: ; preds = %for.body.i
%min.iters.check = icmp ult i32 %indvar, 8
br i1 %min.iters.check, label %for.body.i.i.preheader102, label %vector.ph
vector.ph: ; preds = %for.body.i.i.preheader
%n.vec = and i32 %indvar, -8
%ind.end = or i32 %n.vec, 1
%12 = insertelement <4 x i32> <i32 poison, i32 1, i32 1, i32 1>, i32 %sub1.i, i64 0
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> [ %12, %vector.ph ], [ %13, %vector.body ]
%vec.phi101 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %14, %vector.body ]
%13 = mul <4 x i32> %vec.phi, <i32 10, i32 10, i32 10, i32 10>
%14 = mul <4 x i32> %vec.phi101, <i32 10, i32 10, i32 10, i32 10>
%index.next = add nuw i32 %index, 8
%15 = icmp eq i32 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %14, %13
%16 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %indvar, %n.vec
br i1 %cmp.n, label %thw.exit.i, label %for.body.i.i.preheader102
for.body.i.i.preheader102: ; preds = %for.body.i.i.preheader, %middle.block
%i.05.i.i.ph = phi i32 [ 1, %for.body.i.i.preheader ], [ %ind.end, %middle.block ]
%b.addr.04.i.i.ph = phi i32 [ %sub1.i, %for.body.i.i.preheader ], [ %16, %middle.block ]
br label %for.body.i.i
for.body.i.i: ; preds = %for.body.i.i.preheader102, %for.body.i.i
%i.05.i.i = phi i32 [ %inc.i.i, %for.body.i.i ], [ %i.05.i.i.ph, %for.body.i.i.preheader102 ]
%b.addr.04.i.i = phi i32 [ %mul.i.i, %for.body.i.i ], [ %b.addr.04.i.i.ph, %for.body.i.i.preheader102 ]
%mul.i.i = mul nsw i32 %b.addr.04.i.i, 10
%inc.i.i = add nuw nsw i32 %i.05.i.i, 1
%exitcond.not.i.i = icmp eq i32 %inc.i.i, %sub2.i
br i1 %exitcond.not.i.i, label %thw.exit.i, label %for.body.i.i, !llvm.loop !21
thw.exit.i: ; preds = %for.body.i.i, %middle.block, %for.body.i
%b.addr.0.lcssa.i.i = phi i32 [ %sub1.i, %for.body.i ], [ %16, %middle.block ], [ %mul.i.i, %for.body.i.i ]
%add.i = add nsw i32 %b.addr.0.lcssa.i.i, %bt.011.i
%cmp.i = icmp sgt i64 %indvars.iv.i, 1
%indvar.next = add i32 %indvar, 1
br i1 %cmp.i, label %for.body.i, label %.loopexit, !llvm.loop !17
.loopexit: ; preds = %thw.exit.i, %if.then52
%bt.0.lcssa.i = phi i32 [ 0, %if.then52 ], [ %add.i, %thw.exit.i ]
%idxprom3.i = sext i32 %cnt.096 to i64
%arrayidx4.i = getelementptr inbounds i32, ptr %A, i64 %idxprom3.i
store i32 %bt.0.lcssa.i, ptr %arrayidx4.i, align 4, !tbaa !10
%add57 = add nsw i32 %cnt.096, 1
br label %if.end59
if.end59: ; preds = %sw.bb, %sw.bb19, %sw.bb30, %sw.bb40, %sw.default, %.loopexit, %if.then
%s.1 = phi i32 [ %add, %if.then ], [ 0, %.loopexit ], [ 0, %sw.default ], [ 0, %sw.bb40 ], [ 0, %sw.bb30 ], [ 0, %sw.bb19 ], [ 0, %sw.bb ]
%cnt.3 = phi i32 [ %cnt.096, %if.then ], [ %add57, %.loopexit ], [ %cnt.096, %sw.default ], [ %sub41, %sw.bb40 ], [ %sub31, %sw.bb30 ], [ %sub20, %sw.bb19 ], [ %sub, %sw.bb ]
%flg.2 = phi i32 [ 0, %if.then ], [ 0, %.loopexit ], [ 1, %sw.default ], [ 1, %sw.bb40 ], [ 1, %sw.bb30 ], [ 1, %sw.bb19 ], [ 1, %sw.bb ]
%17 = load ptr, ptr @stdin, align 8, !tbaa !18
%call.i = tail call i32 @getc(ptr noundef %17)
%sext = shl i32 %call.i, 24
%cmp.not = icmp eq i32 %sext, -16777216
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !22
while.end.loopexit: ; preds = %if.end59
%.pre = load i32, ptr %A, align 16, !tbaa !10
%call61 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %A) #7
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %box) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #6
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree norecurse nosync nounwind memory(argmem: 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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6, !7, !8}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!"llvm.loop.isvectorized", i32 1}
!8 = !{!"llvm.loop.unroll.runtime.disable"}
!9 = distinct !{!9, !6, !8, !7}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C/C++ TBAA"}
!14 = !{!12, !12, i64 0}
!15 = distinct !{!15, !6, !7, !8}
!16 = distinct !{!16, !6, !8, !7}
!17 = distinct !{!17, !6}
!18 = !{!19, !19, i64 0}
!19 = !{!"any pointer", !12, i64 0}
!20 = distinct !{!20, !6, !7, !8}
!21 = distinct !{!21, !6, !8, !7}
!22 = distinct !{!22, !6}
|
#include<stdio.h>
int computeRPN( int *stack, int n, int opt )
{
int res;
res=0;
if( '+'==opt ) {
res=stack[n-1]+stack[n];
} else if( '-'==opt ) {
res=stack[n-1]-stack[n];
} else if( '*'==opt ) {
res=stack[n-1]*stack[n];
} else if( '/'==opt ) {
res=stack[n-1]/stack[n];
}
return res;
}
int main( void )
{
char inputs[1000001];
int stack[201];
int i,j;
int res,num;
fgets( inputs, 1000001, stdin );
j=num=0;
for( i=0; '\0' != inputs[i]; i++ ) {
res=inputs[i];
if( '0'<=res && res<='9' ) {
num*=10;
num+=inputs[i]-'0';
} else if( '*'<=res && res<='/' ) {
num=computeRPN( stack, --j, res );
j--;
} else {
stack[j++]=num;
num=0;
}
}
printf( "%d\n", stack[j-1] );
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285679/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285679/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = 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 @computeRPN(ptr nocapture noundef readonly %stack, i32 noundef %n, i32 noundef %opt) local_unnamed_addr #0 {
entry:
switch i32 %opt, label %if.end29 [
i32 43, label %if.then
i32 45, label %if.then4
i32 42, label %if.then13
i32 47, label %if.then21
]
if.then: ; preds = %entry
%sub = add nsw i32 %n, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds i32, ptr %stack, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom1 = sext i32 %n to i64
%arrayidx2 = getelementptr inbounds i32, ptr %stack, i64 %idxprom1
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%add = add nsw i32 %1, %0
br label %if.end29
if.then4: ; preds = %entry
%sub5 = add nsw i32 %n, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds i32, ptr %stack, i64 %idxprom6
%2 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%idxprom8 = sext i32 %n to i64
%arrayidx9 = getelementptr inbounds i32, ptr %stack, i64 %idxprom8
%3 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%sub10 = sub nsw i32 %2, %3
br label %if.end29
if.then13: ; preds = %entry
%sub14 = add nsw i32 %n, -1
%idxprom15 = sext i32 %sub14 to i64
%arrayidx16 = getelementptr inbounds i32, ptr %stack, i64 %idxprom15
%4 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %n to i64
%arrayidx18 = getelementptr inbounds i32, ptr %stack, i64 %idxprom17
%5 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%mul = mul nsw i32 %5, %4
br label %if.end29
if.then21: ; preds = %entry
%sub22 = add nsw i32 %n, -1
%idxprom23 = sext i32 %sub22 to i64
%arrayidx24 = getelementptr inbounds i32, ptr %stack, i64 %idxprom23
%6 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = sext i32 %n to i64
%arrayidx26 = getelementptr inbounds i32, ptr %stack, i64 %idxprom25
%7 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%div = sdiv i32 %6, %7
br label %if.end29
if.end29: ; preds = %entry, %if.then4, %if.then21, %if.then13, %if.then
%res.0 = phi i32 [ %add, %if.then ], [ %sub10, %if.then4 ], [ %mul, %if.then13 ], [ %div, %if.then21 ], [ 0, %entry ]
ret i32 %res.0
}
; 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:
%inputs = alloca [1000001 x i8], align 16
%stack = alloca [201 x i32], align 16
call void @llvm.lifetime.start.p0(i64 1000001, ptr nonnull %inputs) #4
call void @llvm.lifetime.start.p0(i64 804, ptr nonnull %stack) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !9
%call = call ptr @fgets(ptr noundef nonnull %inputs, i32 noundef 1000001, ptr noundef %0)
%1 = load i8, ptr %inputs, align 16, !tbaa !11
%cmp.not44 = icmp eq i8 %1, 0
br i1 %cmp.not44, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%2 = phi i8 [ %13, %for.inc ], [ %1, %entry ]
%num.047 = phi i32 [ %num.1, %for.inc ], [ 0, %entry ]
%j.045 = phi i32 [ %j.1, %for.inc ], [ 0, %entry ]
%conv48 = sext i8 %2 to i32
%3 = add i8 %2, -48
%or.cond = icmp ult i8 %3, 10
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %for.body
%mul = mul nsw i32 %num.047, 10
%sub = add i32 %mul, -48
%add = add i32 %sub, %conv48
br label %for.inc
if.else: ; preds = %for.body
%4 = add i8 %2, -42
%or.cond30 = icmp ult i8 %4, 6
br i1 %or.cond30, label %if.then17, label %if.else21
if.then17: ; preds = %if.else
%dec = add nsw i32 %j.045, -1
%.pre = add nsw i32 %j.045, -2
switch i32 %conv48, label %for.inc [
i32 43, label %if.then.i
i32 45, label %if.then4.i
i32 42, label %if.then13.i
i32 47, label %if.then21.i
]
if.then.i: ; preds = %if.then17
%idxprom.i = sext i32 %.pre to i64
%arrayidx.i = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i
%5 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom1.i = sext i32 %dec to i64
%arrayidx2.i = getelementptr inbounds i32, ptr %stack, i64 %idxprom1.i
%6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%add.i = add nsw i32 %6, %5
br label %for.inc
if.then4.i: ; preds = %if.then17
%idxprom6.i = sext i32 %.pre to i64
%arrayidx7.i = getelementptr inbounds i32, ptr %stack, i64 %idxprom6.i
%7 = load i32, ptr %arrayidx7.i, align 4, !tbaa !5
%idxprom8.i = sext i32 %dec to i64
%arrayidx9.i = getelementptr inbounds i32, ptr %stack, i64 %idxprom8.i
%8 = load i32, ptr %arrayidx9.i, align 4, !tbaa !5
%sub10.i = sub nsw i32 %7, %8
br label %for.inc
if.then13.i: ; preds = %if.then17
%idxprom15.i = sext i32 %.pre to i64
%arrayidx16.i = getelementptr inbounds i32, ptr %stack, i64 %idxprom15.i
%9 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %dec to i64
%arrayidx18.i = getelementptr inbounds i32, ptr %stack, i64 %idxprom17.i
%10 = load i32, ptr %arrayidx18.i, align 4, !tbaa !5
%mul.i = mul nsw i32 %10, %9
br label %for.inc
if.then21.i: ; preds = %if.then17
%idxprom23.i = sext i32 %.pre to i64
%arrayidx24.i = getelementptr inbounds i32, ptr %stack, i64 %idxprom23.i
%11 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = sext i32 %dec to i64
%arrayidx26.i = getelementptr inbounds i32, ptr %stack, i64 %idxprom25.i
%12 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%div.i = sdiv i32 %11, %12
br label %for.inc
if.else21: ; preds = %if.else
%inc = add nsw i32 %j.045, 1
%idxprom22 = sext i32 %j.045 to i64
%arrayidx23 = getelementptr inbounds [201 x i32], ptr %stack, i64 0, i64 %idxprom22
store i32 %num.047, ptr %arrayidx23, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then17, %if.then21.i, %if.then13.i, %if.then4.i, %if.then.i, %if.then, %if.else21
%j.1 = phi i32 [ %j.045, %if.then ], [ %inc, %if.else21 ], [ %.pre, %if.then.i ], [ %.pre, %if.then4.i ], [ %.pre, %if.then13.i ], [ %.pre, %if.then21.i ], [ %.pre, %if.then17 ]
%num.1 = phi i32 [ %add, %if.then ], [ 0, %if.else21 ], [ %add.i, %if.then.i ], [ %sub10.i, %if.then4.i ], [ %mul.i, %if.then13.i ], [ %div.i, %if.then21.i ], [ 0, %if.then17 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [1000001 x i8], ptr %inputs, i64 0, i64 %indvars.iv.next
%13 = load i8, ptr %arrayidx, align 1, !tbaa !11
%cmp.not = icmp eq i8 %13, 0
br i1 %cmp.not, label %for.end.loopexit, label %for.body, !llvm.loop !12
for.end.loopexit: ; preds = %for.inc
%14 = add nsw i32 %j.1, -1
%15 = sext i32 %14 to i64
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%j.0.lcssa = phi i64 [ -1, %entry ], [ %15, %for.end.loopexit ]
%arrayidx28 = getelementptr inbounds [201 x i32], ptr %stack, i64 0, i64 %j.0.lcssa
%16 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %16)
call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %stack) #4
call void @llvm.lifetime.end.p0(i64 1000001, ptr nonnull %inputs) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int i=0;
int stack[100];
char s[100];
while(scanf("%s", s) != EOF){
if(s[0] == '+'){
stack[i-2] += stack[i-1];
i--;
}
else if(s[0] == '-'){
stack[i-2] -= stack[i-1];
i--;
}
else if(s[0] == '*'){
stack[i-2] *= stack[i-1];
i--;
}
else{
stack[i++] = atoi(s);
}
}
printf("%d\n", stack[0]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285758/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285758/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%stack = alloca [100 x i32], align 16
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %stack) #5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not52 = icmp ne i32 %call51, -1
call void @llvm.assume(i1 %cmp.not52)
br label %while.body
while.body: ; preds = %entry, %if.end39
%i.053 = phi i32 [ %i.1, %if.end39 ], [ 0, %entry ]
%0 = load i8, ptr %s, align 16, !tbaa !5
switch i8 %0, label %if.else33 [
i8 43, label %if.then
i8 45, label %if.then11
i8 42, label %if.then25
]
if.then: ; preds = %while.body
%sub = add nsw i32 %i.053, -1
%idxprom = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !8
%sub4 = add nsw i32 %i.053, -2
%idxprom5 = sext i32 %sub4 to i64
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom5
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !8
%add = add nsw i32 %2, %1
store i32 %add, ptr %arrayidx6, align 4, !tbaa !8
br label %if.end39
if.then11: ; preds = %while.body
%sub12 = add nsw i32 %i.053, -1
%idxprom13 = sext i32 %sub12 to i64
%arrayidx14 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom13
%3 = load i32, ptr %arrayidx14, align 4, !tbaa !8
%sub15 = add nsw i32 %i.053, -2
%idxprom16 = sext i32 %sub15 to i64
%arrayidx17 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom16
%4 = load i32, ptr %arrayidx17, align 4, !tbaa !8
%sub18 = sub nsw i32 %4, %3
store i32 %sub18, ptr %arrayidx17, align 4, !tbaa !8
br label %if.end39
if.then25: ; preds = %while.body
%sub26 = add nsw i32 %i.053, -1
%idxprom27 = sext i32 %sub26 to i64
%arrayidx28 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom27
%5 = load i32, ptr %arrayidx28, align 4, !tbaa !8
%sub29 = add nsw i32 %i.053, -2
%idxprom30 = sext i32 %sub29 to i64
%arrayidx31 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom30
%6 = load i32, ptr %arrayidx31, align 4, !tbaa !8
%mul = mul nsw i32 %6, %5
store i32 %mul, ptr %arrayidx31, align 4, !tbaa !8
br label %if.end39
if.else33: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%inc = add nsw i32 %i.053, 1
%idxprom36 = sext i32 %i.053 to i64
%arrayidx37 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom36
store i32 %conv.i, ptr %arrayidx37, align 4, !tbaa !8
br label %if.end39
if.end39: ; preds = %if.then11, %if.else33, %if.then25, %if.then
%i.1 = phi i32 [ %sub, %if.then ], [ %sub12, %if.then11 ], [ %sub26, %if.then25 ], [ %inc, %if.else33 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10
while.end.loopexit: ; preds = %if.end39
%.pre = load i32, ptr %stack, align 16, !tbaa !8
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %stack) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3
; 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 "no-trapping-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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 100
void push(int);
int pop(void);
void isEmpty(void);
void isFull(void);
int top=0,S[1000];
/*void isEmpty(){
return top=0;
}*/
/*void isFull(){
return top >= MAX-1;
}*/
void push(int x){
top++;
S[top]= x;
}
int pop(){
top--;
return S[top+1];
}
int main(){
int a,b,i;
char s[100];
while(scanf("%s",s) != EOF){
if(s[0] == '+'){
a=pop();
b=pop();
push(a+b);
}
else if(s[0] == '-'){
b=pop();
a=pop();
push(a-b);
}
else if(s[0] == '*'){
a=pop();
b=pop();
push(a*b);
}
else{
push(atoi(s));
}
}
i = pop();
printf("%d\n",i);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285800/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285800/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@top = dso_local local_unnamed_addr global i32 0, align 4
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 100
void initialize(void);
int isEmpty(void);
int isFull(void);
void push(int);
int pop(void);
int top;
int stack[MAX];
int main(){
int a,b;
char s[100];
while( scanf("%s", s) != EOF ){
if ( s[0] == '+' ){
push(pop()+pop());
}
else if ( s[0] == '-' ){
a=pop();
b=pop();
push(b-a);
}
else if ( s[0] == '*' ){
push(pop()*pop());
}
else {
push(atoi(s));
}
}
printf("%d\n",pop());
return 0;
}
void initialize()
{
top=0;
}
int isEmpty()
{
if(top==0)
return 1;
else
return 0;
}
int isFull()
{
if(top > MAX-1)
return 1;
else
return 0;
}
void push(int x)
{
if(isFull()){
fprintf(stderr,"エラー(オーバーフロー)\n");
exit(1);
}
stack[++top]=x;
}
int pop()
{
if(isEmpty()){
fprintf(stderr,"エラー(アンダーフロー)\n");
exit(2);
}
top--;
return stack[top+1];
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285851/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285851/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@top = dso_local local_unnamed_addr global i32 0, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = private unnamed_addr constant [38 x i8] c"\E3\82\A8\E3\83\A9\E3\83\BC\EF\BC\88\E3\82\AA\E3\83\BC\E3\83\90\E3\83\BC\E3\83\95\E3\83\AD\E3\83\BC\EF\BC\89\0A\00", align 1
@stack = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [38 x i8] c"\E3\82\A8\E3\83\A9\E3\83\BC\EF\BC\88\E3\82\A2\E3\83\B3\E3\83\80\E3\83\BC\E3\83\95\E3\83\AD\E3\83\BC\EF\BC\89\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #8
%call84 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not85 = icmp eq i32 %call84, -1
br i1 %cmp.not85, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !5
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not.i = icmp eq i32 %1, 0
br i1 %cmp.i.not.i, label %if.then.i, label %pop.exit
if.then.i: ; preds = %if.then
%2 = load ptr, ptr @stderr, align 8, !tbaa !10
%3 = call i64 @fwrite(ptr nonnull @.str.3, i64 37, i64 1, ptr %2) #9
call void @exit(i32 noundef 2) #10
unreachable
pop.exit: ; preds = %if.then
%dec.i = add nsw i32 %1, -1
store i32 %dec.i, ptr @top, align 4, !tbaa !8
%cmp.i.not.i27 = icmp eq i32 %dec.i, 0
br i1 %cmp.i.not.i27, label %if.then.i31, label %pop.exit32
if.then.i31: ; preds = %pop.exit
%4 = load ptr, ptr @stderr, align 8, !tbaa !10
%5 = call i64 @fwrite(ptr nonnull @.str.3, i64 37, i64 1, ptr %4) #9
call void @exit(i32 noundef 2) #10
unreachable
pop.exit32: ; preds = %pop.exit
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !8
%dec.i28 = add nsw i32 %1, -2
store i32 %dec.i28, ptr @top, align 4, !tbaa !8
%cmp.i.i = icmp slt i32 %1, 102
br i1 %cmp.i.i, label %push.exit, label %if.then.i33
if.then.i33: ; preds = %pop.exit32
%7 = load ptr, ptr @stderr, align 8, !tbaa !10
%8 = call i64 @fwrite(ptr nonnull @.str.2, i64 37, i64 1, ptr %7) #9
call void @exit(i32 noundef 1) #10
unreachable
push.exit: ; preds = %pop.exit32
%idxprom.i29 = sext i32 %dec.i to i64
%arrayidx.i30 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i29
%9 = load i32, ptr %arrayidx.i30, align 4, !tbaa !8
%add = add nsw i32 %9, %6
store i32 %dec.i, ptr @top, align 4, !tbaa !8
store i32 %add, ptr %arrayidx.i30, align 4, !tbaa !8
br label %if.end24
if.then9: ; preds = %while.body
%10 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not.i36 = icmp eq i32 %10, 0
br i1 %cmp.i.not.i36, label %if.then.i40, label %pop.exit41
if.then.i40: ; preds = %if.then9
%11 = load ptr, ptr @stderr, align 8, !tbaa !10
%12 = call i64 @fwrite(ptr nonnull @.str.3, i64 37, i64 1, ptr %11) #9
call void @exit(i32 noundef 2) #10
unreachable
pop.exit41: ; preds = %if.then9
%dec.i37 = add nsw i32 %10, -1
store i32 %dec.i37, ptr @top, align 4, !tbaa !8
%cmp.i.not.i42 = icmp eq i32 %dec.i37, 0
br i1 %cmp.i.not.i42, label %if.then.i46, label %pop.exit47
if.then.i46: ; preds = %pop.exit41
%13 = load ptr, ptr @stderr, align 8, !tbaa !10
%14 = call i64 @fwrite(ptr nonnull @.str.3, i64 37, i64 1, ptr %13) #9
call void @exit(i32 noundef 2) #10
unreachable
pop.exit47: ; preds = %pop.exit41
%idxprom.i38 = sext i32 %10 to i64
%arrayidx.i39 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i38
%15 = load i32, ptr %arrayidx.i39, align 4, !tbaa !8
%dec.i43 = add nsw i32 %10, -2
store i32 %dec.i43, ptr @top, align 4, !tbaa !8
%cmp.i.i48 = icmp slt i32 %10, 102
br i1 %cmp.i.i48, label %push.exit53, label %if.then.i49
if.then.i49: ; preds = %pop.exit47
%16 = load ptr, ptr @stderr, align 8, !tbaa !10
%17 = call i64 @fwrite(ptr nonnull @.str.2, i64 37, i64 1, ptr %16) #9
call void @exit(i32 noundef 1) #10
unreachable
push.exit53: ; preds = %pop.exit47
%idxprom.i44 = sext i32 %dec.i37 to i64
%arrayidx.i45 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i44
%18 = load i32, ptr %arrayidx.i45, align 4, !tbaa !8
%sub = sub nsw i32 %18, %15
store i32 %dec.i37, ptr @top, align 4, !tbaa !8
store i32 %sub, ptr %arrayidx.i45, align 4, !tbaa !8
br label %if.end24
if.then17: ; preds = %while.body
%19 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not.i54 = icmp eq i32 %19, 0
br i1 %cmp.i.not.i54, label %if.then.i58, label %pop.exit59
if.then.i58: ; preds = %if.then17
%20 = load ptr, ptr @stderr, align 8, !tbaa !10
%21 = call i64 @fwrite(ptr nonnull @.str.3, i64 37, i64 1, ptr %20) #9
call void @exit(i32 noundef 2) #10
unreachable
pop.exit59: ; preds = %if.then17
%dec.i55 = add nsw i32 %19, -1
store i32 %dec.i55, ptr @top, align 4, !tbaa !8
%cmp.i.not.i60 = icmp eq i32 %dec.i55, 0
br i1 %cmp.i.not.i60, label %if.then.i64, label %pop.exit65
if.then.i64: ; preds = %pop.exit59
%22 = load ptr, ptr @stderr, align 8, !tbaa !10
%23 = call i64 @fwrite(ptr nonnull @.str.3, i64 37, i64 1, ptr %22) #9
call void @exit(i32 noundef 2) #10
unreachable
pop.exit65: ; preds = %pop.exit59
%idxprom.i56 = sext i32 %19 to i64
%arrayidx.i57 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i56
%24 = load i32, ptr %arrayidx.i57, align 4, !tbaa !8
%dec.i61 = add nsw i32 %19, -2
store i32 %dec.i61, ptr @top, align 4, !tbaa !8
%cmp.i.i66 = icmp slt i32 %19, 102
br i1 %cmp.i.i66, label %push.exit71, label %if.then.i67
if.then.i67: ; preds = %pop.exit65
%25 = load ptr, ptr @stderr, align 8, !tbaa !10
%26 = call i64 @fwrite(ptr nonnull @.str.2, i64 37, i64 1, ptr %25) #9
call void @exit(i32 noundef 1) #10
unreachable
push.exit71: ; preds = %pop.exit65
%idxprom.i62 = sext i32 %dec.i55 to i64
%arrayidx.i63 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i62
%27 = load i32, ptr %arrayidx.i63, align 4, !tbaa !8
%mul = mul nsw i32 %27, %24
store i32 %dec.i55, ptr @top, align 4, !tbaa !8
store i32 %mul, ptr %arrayidx.i63, align 4, !tbaa !8
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #8
%28 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.i72 = icmp slt i32 %28, 100
br i1 %cmp.i.i72, label %push.exit77, label %if.then.i73
if.then.i73: ; preds = %if.else20
%29 = load ptr, ptr @stderr, align 8, !tbaa !10
%30 = call i64 @fwrite(ptr nonnull @.str.2, i64 37, i64 1, ptr %29) #9
call void @exit(i32 noundef 1) #10
unreachable
push.exit77: ; preds = %if.else20
%conv.i = trunc i64 %call.i to i32
%inc.i74 = add nsw i32 %28, 1
store i32 %inc.i74, ptr @top, align 4, !tbaa !8
%idxprom.i75 = sext i32 %inc.i74 to i64
%arrayidx.i76 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i75
store i32 %conv.i, ptr %arrayidx.i76, align 4, !tbaa !8
br label %if.end24
if.end24: ; preds = %push.exit53, %push.exit77, %push.exit71, %push.exit
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.end24, %entry
%31 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not.i78 = icmp eq i32 %31, 0
br i1 %cmp.i.not.i78, label %if.then.i82, label %pop.exit83
if.then.i82: ; preds = %while.end
%32 = load ptr, ptr @stderr, align 8, !tbaa !10
%33 = call i64 @fwrite(ptr nonnull @.str.3, i64 37, i64 1, ptr %32) #9
call void @exit(i32 noundef 2) #10
unreachable
pop.exit83: ; preds = %while.end
%dec.i79 = add nsw i32 %31, -1
store i32 %dec.i79, ptr @top, align 4, !tbaa !8
%idxprom.i80 = sext i32 %31 to i64
%arrayidx.i81 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i80
%34 = load i32, ptr %arrayidx.i81, align 4, !tbaa !8
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %34)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nounwind uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i = icmp slt i32 %0, 100
br i1 %cmp.i, label %if.end, label %if.then
if.then: ; preds = %entry
%1 = load ptr, ptr @stderr, align 8, !tbaa !10
%2 = tail call i64 @fwrite(ptr nonnull @.str.2, i64 37, i64 1, ptr %1) #9
tail call void @exit(i32 noundef 1) #10
unreachable
if.end: ; preds = %entry
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !8
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not = icmp eq i32 %0, 0
br i1 %cmp.i.not, label %if.then, label %if.end
if.then: ; preds = %entry
%1 = load ptr, ptr @stderr, align 8, !tbaa !10
%2 = tail call i64 @fwrite(ptr nonnull @.str.3, i64 37, i64 1, ptr %1) #9
tail call void @exit(i32 noundef 2) #10
unreachable
if.end: ; preds = %entry
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !8
ret i32 %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 nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @initialize() local_unnamed_addr #3 {
entry:
store i32 0, ptr @top, align 4, !tbaa !8
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @isEmpty() local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%cmp = icmp eq i32 %0, 0
%. = 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 @isFull() local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%cmp = icmp sgt i32 %0, 99
%. = zext i1 %cmp to i32
ret i32 %.
}
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #7
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind }
attributes #8 = { nounwind }
attributes #9 = { cold }
attributes #10 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
int main(){
int data[200];
int x=0;
char input[5];
int top = 1;
while((scanf("%s",input)) != EOF){
/* x = x + 1;*/
/* scanf("%s",input);*/
if(input[0] == '+'){
data[top - 2] = data[top -2] + data[top -1];
top = top- 1;
}
else if(input[0] == '-'){
data[top -2] = data[top-2] - data[top -1];
top = top -1;
}
else if(input[0] =='*'){
data[top-2] = data[top-2] * data[top -1];
top = top -1;
}
else if(input[0] == '/'){
data[top -2] = data[top -2] * data[top - 1];
top = top -1;
}
else{
data[top] = atoi(input);
/*printf("%d\n",data[top]);*/
top = top + 1;
}
}
printf("%d\n",data[1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285895/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285895/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%data = alloca [200 x i32], align 16
%input = alloca [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %data) #5
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %input) #5
%call88 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%cmp.not89 = icmp ne i32 %call88, -1
call void @llvm.assume(i1 %cmp.not89)
br label %while.body
while.body: ; preds = %entry, %if.end68
%top.090 = phi i32 [ %top.1, %if.end68 ], [ 1, %entry ]
%0 = load i8, ptr %input, align 1, !tbaa !5
switch i8 %0, label %if.else60 [
i8 43, label %if.then
i8 45, label %if.then15
i8 42, label %if.then32
i8 47, label %if.then48
]
if.then: ; preds = %while.body
%sub = add nsw i32 %top.090, -2
%idxprom = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [200 x i32], ptr %data, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !8
%sub4 = add nsw i32 %top.090, -1
%idxprom5 = sext i32 %sub4 to i64
%arrayidx6 = getelementptr inbounds [200 x i32], ptr %data, i64 0, i64 %idxprom5
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !8
%add = add nsw i32 %2, %1
store i32 %add, ptr %arrayidx3, align 4, !tbaa !8
br label %if.end68
if.then15: ; preds = %while.body
%sub16 = add nsw i32 %top.090, -2
%idxprom17 = sext i32 %sub16 to i64
%arrayidx18 = getelementptr inbounds [200 x i32], ptr %data, i64 0, i64 %idxprom17
%3 = load i32, ptr %arrayidx18, align 4, !tbaa !8
%sub19 = add nsw i32 %top.090, -1
%idxprom20 = sext i32 %sub19 to i64
%arrayidx21 = getelementptr inbounds [200 x i32], ptr %data, i64 0, i64 %idxprom20
%4 = load i32, ptr %arrayidx21, align 4, !tbaa !8
%sub22 = sub nsw i32 %3, %4
store i32 %sub22, ptr %arrayidx18, align 4, !tbaa !8
br label %if.end68
if.then32: ; preds = %while.body
%sub33 = add nsw i32 %top.090, -2
%idxprom34 = sext i32 %sub33 to i64
%arrayidx35 = getelementptr inbounds [200 x i32], ptr %data, i64 0, i64 %idxprom34
%5 = load i32, ptr %arrayidx35, align 4, !tbaa !8
%sub36 = add nsw i32 %top.090, -1
%idxprom37 = sext i32 %sub36 to i64
%arrayidx38 = getelementptr inbounds [200 x i32], ptr %data, i64 0, i64 %idxprom37
%6 = load i32, ptr %arrayidx38, align 4, !tbaa !8
%mul = mul nsw i32 %6, %5
store i32 %mul, ptr %arrayidx35, align 4, !tbaa !8
br label %if.end68
if.then48: ; preds = %while.body
%sub49 = add nsw i32 %top.090, -2
%idxprom50 = sext i32 %sub49 to i64
%arrayidx51 = getelementptr inbounds [200 x i32], ptr %data, i64 0, i64 %idxprom50
%7 = load i32, ptr %arrayidx51, align 4, !tbaa !8
%sub52 = add nsw i32 %top.090, -1
%idxprom53 = sext i32 %sub52 to i64
%arrayidx54 = getelementptr inbounds [200 x i32], ptr %data, i64 0, i64 %idxprom53
%8 = load i32, ptr %arrayidx54, align 4, !tbaa !8
%mul55 = mul nsw i32 %8, %7
store i32 %mul55, ptr %arrayidx51, align 4, !tbaa !8
br label %if.end68
if.else60: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %input, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%idxprom63 = sext i32 %top.090 to i64
%arrayidx64 = getelementptr inbounds [200 x i32], ptr %data, i64 0, i64 %idxprom63
store i32 %conv.i, ptr %arrayidx64, align 4, !tbaa !8
%add65 = add nsw i32 %top.090, 1
br label %if.end68
if.end68: ; preds = %if.then15, %if.then48, %if.else60, %if.then32, %if.then
%top.1 = phi i32 [ %sub4, %if.then ], [ %sub19, %if.then15 ], [ %sub36, %if.then32 ], [ %sub52, %if.then48 ], [ %add65, %if.else60 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10
while.end.loopexit: ; preds = %if.end68
%arrayidx69.phi.trans.insert = getelementptr inbounds [200 x i32], ptr %data, i64 0, i64 1
%.pre = load i32, ptr %arrayidx69.phi.trans.insert, align 4, !tbaa !8
%call70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %input) #5
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %data) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3
; 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 "no-trapping-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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <assert.h>
#define MAX 1000010
#define MOD 1000000007
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
long long ar[MAX], fact[MAX];
long long expo(long long x, long long n){
long long res = 1;
while (n){
if (n & 1LL) res = (res * x) % MOD;
x = (x * x) % MOD;
n >>= 1LL;
}
return (res % MOD);
}
long long binomial(int n, int k){
long long x = fact[n];
long long y = (fact[k] * fact[n - k]) % MOD;
long long res = (x * expo(y, MOD - 2)) % MOD;
return res;
}
long long solve(int n, long long ar[MAX]){
if (n == 1) return ar[0] % MOD;
int i, j, k;
long long x, y, z, res = 0;
if ((n % 4) == 0){
for (i = 0; i < n; i++){
x = binomial(n / 2 - 1, i / 2) * ar[i] % MOD;
if (i % 2 == 1) res = (res - x + MOD) % MOD;
else res = (res + x) % MOD;
}
}
if ((n % 4) == 1){
for (i = 0; i < n; i++){
if (i % 2 == 0) res = (res + binomial(n / 2, i / 2) * ar[i]) % MOD;
}
}
if ((n % 4) == 2){
for (i = 0; i < n; i++){
res = (res + binomial(n / 2 - 1, i / 2) * ar[i]) % MOD;
}
}
if ((n % 4) == 3){
for (i = 0; i < n; i++){
if ((i % 2) == 1){
x = binomial(n / 2 - 1, i / 2) * 2 % MOD;
}
else{
x = binomial(n / 2 - 1, i / 2);
if (i) x = (x - binomial(n / 2 - 1, i / 2 - 1) + MOD) % MOD;
if ((2 * i) > n) x = x - MOD;
}
res = (res + ((x * ar[i]) % MOD) + MOD) % MOD;
}
}
return res % MOD;
}
int main(){
int n, i, j, k;
for (i = 1, fact[0] = 1; i < MAX; i++) fact[i] = (fact[i - 1] * i) % MOD;
while (scanf("%d", &n) != EOF){
for (i = 0; i < n; i++) scanf("%lld", &ar[i]);
printf("%lld\n", solve(n, ar));
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28596/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28596/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@fact = dso_local local_unnamed_addr global [1000010 x i64] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@ar = dso_local global [1000010 x i64] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @expo(i64 noundef %x, i64 noundef %n) local_unnamed_addr #0 {
entry:
%tobool.not10 = icmp eq i64 %n, 0
br i1 %tobool.not10, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%res.013 = phi i64 [ %res.1, %if.end ], [ 1, %entry ]
%n.addr.012 = phi i64 [ %shr, %if.end ], [ %n, %entry ]
%x.addr.011 = phi i64 [ %rem3, %if.end ], [ %x, %entry ]
%and = and i64 %n.addr.012, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul nsw i64 %res.013, %x.addr.011
%rem = srem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%res.1 = phi i64 [ %rem, %if.then ], [ %res.013, %while.body ]
%mul2 = mul nsw i64 %x.addr.011, %x.addr.011
%rem3 = urem i64 %mul2, 1000000007
%shr = ashr i64 %n.addr.012, 1
%tobool.not = icmp ult i64 %n.addr.012, 2
br i1 %tobool.not, label %while.end.loopexit, label %while.body, !llvm.loop !5
while.end.loopexit: ; preds = %if.end
%0 = srem i64 %res.1, 1000000007
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%res.0.lcssa = phi i64 [ 1, %entry ], [ %0, %while.end.loopexit ]
ret i64 %res.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress 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(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @binomial(i32 noundef %n, i32 noundef %k) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom
%0 = load i64, ptr %arrayidx, align 8, !tbaa !7
%idxprom1 = sext i32 %k to i64
%arrayidx2 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom1
%1 = load i64, ptr %arrayidx2, align 8, !tbaa !7
%sub = sub nsw i32 %n, %k
%idxprom3 = sext i32 %sub to i64
%arrayidx4 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom3
%2 = load i64, ptr %arrayidx4, align 8, !tbaa !7
%mul = mul nsw i64 %2, %1
%rem = srem i64 %mul, 1000000007
br label %while.body.i
while.body.i: ; preds = %if.end.i, %entry
%res.013.i = phi i64 [ %res.1.i, %if.end.i ], [ 1, %entry ]
%n.addr.012.i = phi i64 [ %shr.i, %if.end.i ], [ 1000000005, %entry ]
%x.addr.011.i = phi i64 [ %rem3.i, %if.end.i ], [ %rem, %entry ]
%and.i = and i64 %n.addr.012.i, 1
%tobool1.not.i = icmp eq i64 %and.i, 0
br i1 %tobool1.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %while.body.i
%mul.i = mul nsw i64 %x.addr.011.i, %res.013.i
%rem.i = srem i64 %mul.i, 1000000007
br label %if.end.i
if.end.i: ; preds = %if.then.i, %while.body.i
%res.1.i = phi i64 [ %rem.i, %if.then.i ], [ %res.013.i, %while.body.i ]
%mul2.i = mul nsw i64 %x.addr.011.i, %x.addr.011.i
%rem3.i = urem i64 %mul2.i, 1000000007
%shr.i = lshr i64 %n.addr.012.i, 1
%tobool.not.i = icmp ult i64 %n.addr.012.i, 2
br i1 %tobool.not.i, label %expo.exit, label %while.body.i, !llvm.loop !5
expo.exit: ; preds = %if.end.i
%3 = srem i64 %res.1.i, 1000000007
%mul5 = mul nsw i64 %3, %0
%rem6 = srem i64 %mul5, 1000000007
ret i64 %rem6
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i64 @solve(i32 noundef %n, ptr nocapture noundef readonly %ar) local_unnamed_addr #3 {
entry:
%cmp = icmp eq i32 %n, 1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%0 = load i64, ptr %ar, align 8, !tbaa !7
br label %return
if.end: ; preds = %entry
%rem1 = srem i32 %n, 4
%cmp2 = icmp eq i32 %rem1, 0
%cmp4296 = icmp sgt i32 %n, 0
%or.cond = and i1 %cmp2, %cmp4296
br i1 %or.cond, label %for.body.lr.ph, label %if.end16
for.body.lr.ph: ; preds = %if.end
%div331335 = lshr i32 %n, 1
%sub = add nsw i32 %div331335, -1
%idxprom.i = zext i32 %sub to i64
%arrayidx.i = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom.i
%1 = load i64, ptr %arrayidx.i, align 8, !tbaa !7
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %binomial.exit
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %binomial.exit ]
%res.0298 = phi i64 [ 0, %for.body.lr.ph ], [ %res.1, %binomial.exit ]
%2 = trunc i64 %indvars.iv to i32
%div5160 = lshr i32 %2, 1
%idxprom1.i = zext i32 %div5160 to i64
%arrayidx2.i = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom1.i
%3 = load i64, ptr %arrayidx2.i, align 8, !tbaa !7
%sub.i = sub nsw i32 %sub, %div5160
%idxprom3.i = sext i32 %sub.i to i64
%arrayidx4.i = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom3.i
%4 = load i64, ptr %arrayidx4.i, align 8, !tbaa !7
%mul.i = mul nsw i64 %4, %3
%rem.i = srem i64 %mul.i, 1000000007
br label %while.body.i.i
while.body.i.i: ; preds = %if.end.i.i, %for.body
%res.013.i.i = phi i64 [ %res.1.i.i, %if.end.i.i ], [ 1, %for.body ]
%n.addr.012.i.i = phi i64 [ %shr.i.i, %if.end.i.i ], [ 1000000005, %for.body ]
%x.addr.011.i.i = phi i64 [ %rem3.i.i, %if.end.i.i ], [ %rem.i, %for.body ]
%and.i.i = and i64 %n.addr.012.i.i, 1
%tobool1.not.i.i = icmp eq i64 %and.i.i, 0
br i1 %tobool1.not.i.i, label %if.end.i.i, label %if.then.i.i
if.then.i.i: ; preds = %while.body.i.i
%mul.i.i = mul nsw i64 %x.addr.011.i.i, %res.013.i.i
%rem.i.i = srem i64 %mul.i.i, 1000000007
br label %if.end.i.i
if.end.i.i: ; preds = %if.then.i.i, %while.body.i.i
%res.1.i.i = phi i64 [ %rem.i.i, %if.then.i.i ], [ %res.013.i.i, %while.body.i.i ]
%mul2.i.i = mul nsw i64 %x.addr.011.i.i, %x.addr.011.i.i
%rem3.i.i = urem i64 %mul2.i.i, 1000000007
%shr.i.i = lshr i64 %n.addr.012.i.i, 1
%tobool.not.i.i = icmp ult i64 %n.addr.012.i.i, 2
br i1 %tobool.not.i.i, label %binomial.exit, label %while.body.i.i, !llvm.loop !5
binomial.exit: ; preds = %if.end.i.i
%5 = srem i64 %res.1.i.i, 1000000007
%mul5.i = mul nsw i64 %5, %1
%rem6.i = srem i64 %mul5.i, 1000000007
%arrayidx6 = getelementptr inbounds i64, ptr %ar, i64 %indvars.iv
%6 = load i64, ptr %arrayidx6, align 8, !tbaa !7
%mul = mul nsw i64 %6, %rem6.i
%rem7 = srem i64 %mul, 1000000007
%rem8 = and i32 %2, 1
%cmp9.not = icmp eq i32 %rem8, 0
%sub11 = add nsw i64 %res.0298, 1000000007
%add = sub nsw i64 %sub11, %rem7
%add13 = add nsw i64 %rem7, %res.0298
%res.1.in = select i1 %cmp9.not, i64 %add13, i64 %add
%res.1 = srem i64 %res.1.in, 1000000007
%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.end16, label %for.body, !llvm.loop !11
if.end16: ; preds = %binomial.exit, %if.end
%res.2 = phi i64 [ 0, %if.end ], [ %res.1, %binomial.exit ]
%cmp18 = icmp eq i32 %rem1, 1
%or.cond311 = and i1 %cmp18, %cmp4296
br i1 %or.cond311, label %for.body22.lr.ph, label %if.end38
for.body22.lr.ph: ; preds = %if.end16
%div26332336 = lshr i32 %n, 1
%idxprom.i161 = zext i32 %div26332336 to i64
%arrayidx.i162 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom.i161
%wide.trip.count318 = zext i32 %n to i64
br label %for.body22
for.body22: ; preds = %for.body22.lr.ph, %for.inc35
%indvars.iv315 = phi i64 [ 0, %for.body22.lr.ph ], [ %indvars.iv.next316, %for.inc35 ]
%res.3301 = phi i64 [ %res.2, %for.body22.lr.ph ], [ %res.4, %for.inc35 ]
%7 = trunc i64 %indvars.iv315 to i32
%rem23 = and i32 %7, 1
%cmp24 = icmp eq i32 %rem23, 0
br i1 %cmp24, label %if.then25, label %for.inc35
if.then25: ; preds = %for.body22
%div27159 = lshr i32 %7, 1
%8 = load i64, ptr %arrayidx.i162, align 8, !tbaa !7
%idxprom1.i163 = zext i32 %div27159 to i64
%arrayidx2.i164 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom1.i163
%9 = load i64, ptr %arrayidx2.i164, align 8, !tbaa !7
%sub.i165 = sub nsw i32 %div26332336, %div27159
%idxprom3.i166 = sext i32 %sub.i165 to i64
%arrayidx4.i167 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom3.i166
%10 = load i64, ptr %arrayidx4.i167, align 8, !tbaa !7
%mul.i168 = mul nsw i64 %10, %9
%rem.i169 = srem i64 %mul.i168, 1000000007
br label %while.body.i.i170
while.body.i.i170: ; preds = %if.end.i.i179, %if.then25
%res.013.i.i171 = phi i64 [ %res.1.i.i180, %if.end.i.i179 ], [ 1, %if.then25 ]
%n.addr.012.i.i172 = phi i64 [ %shr.i.i183, %if.end.i.i179 ], [ 1000000005, %if.then25 ]
%x.addr.011.i.i173 = phi i64 [ %rem3.i.i182, %if.end.i.i179 ], [ %rem.i169, %if.then25 ]
%and.i.i174 = and i64 %n.addr.012.i.i172, 1
%tobool1.not.i.i175 = icmp eq i64 %and.i.i174, 0
br i1 %tobool1.not.i.i175, label %if.end.i.i179, label %if.then.i.i176
if.then.i.i176: ; preds = %while.body.i.i170
%mul.i.i177 = mul nsw i64 %x.addr.011.i.i173, %res.013.i.i171
%rem.i.i178 = srem i64 %mul.i.i177, 1000000007
br label %if.end.i.i179
if.end.i.i179: ; preds = %if.then.i.i176, %while.body.i.i170
%res.1.i.i180 = phi i64 [ %rem.i.i178, %if.then.i.i176 ], [ %res.013.i.i171, %while.body.i.i170 ]
%mul2.i.i181 = mul nsw i64 %x.addr.011.i.i173, %x.addr.011.i.i173
%rem3.i.i182 = urem i64 %mul2.i.i181, 1000000007
%shr.i.i183 = lshr i64 %n.addr.012.i.i172, 1
%tobool.not.i.i184 = icmp ult i64 %n.addr.012.i.i172, 2
br i1 %tobool.not.i.i184, label %binomial.exit187, label %while.body.i.i170, !llvm.loop !5
binomial.exit187: ; preds = %if.end.i.i179
%11 = srem i64 %res.1.i.i180, 1000000007
%mul5.i185 = mul nsw i64 %11, %8
%rem6.i186 = srem i64 %mul5.i185, 1000000007
%arrayidx30 = getelementptr inbounds i64, ptr %ar, i64 %indvars.iv315
%12 = load i64, ptr %arrayidx30, align 8, !tbaa !7
%mul31 = mul nsw i64 %12, %rem6.i186
%add32 = add nsw i64 %mul31, %res.3301
%rem33 = srem i64 %add32, 1000000007
br label %for.inc35
for.inc35: ; preds = %for.body22, %binomial.exit187
%res.4 = phi i64 [ %rem33, %binomial.exit187 ], [ %res.3301, %for.body22 ]
%indvars.iv.next316 = add nuw nsw i64 %indvars.iv315, 1
%exitcond319.not = icmp eq i64 %indvars.iv.next316, %wide.trip.count318
br i1 %exitcond319.not, label %if.end38, label %for.body22, !llvm.loop !12
if.end38: ; preds = %for.inc35, %if.end16
%res.5 = phi i64 [ %res.2, %if.end16 ], [ %res.4, %for.inc35 ]
%cmp40 = icmp eq i32 %rem1, 2
%or.cond312 = and i1 %cmp40, %cmp4296
br i1 %or.cond312, label %for.body44.lr.ph, label %if.end57
for.body44.lr.ph: ; preds = %if.end38
%div45333337 = lshr i32 %n, 1
%sub46 = add nsw i32 %div45333337, -1
%idxprom.i188 = sext i32 %sub46 to i64
%arrayidx.i189 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom.i188
%13 = load i64, ptr %arrayidx.i189, align 8, !tbaa !7
%wide.trip.count323 = zext i32 %n to i64
br label %for.body44
for.body44: ; preds = %for.body44.lr.ph, %binomial.exit214
%indvars.iv320 = phi i64 [ 0, %for.body44.lr.ph ], [ %indvars.iv.next321, %binomial.exit214 ]
%res.6305 = phi i64 [ %res.5, %for.body44.lr.ph ], [ %rem53, %binomial.exit214 ]
%14 = trunc i64 %indvars.iv320 to i32
%div47158 = lshr i32 %14, 1
%idxprom1.i190 = zext i32 %div47158 to i64
%arrayidx2.i191 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom1.i190
%15 = load i64, ptr %arrayidx2.i191, align 8, !tbaa !7
%sub.i192 = sub nsw i32 %sub46, %div47158
%idxprom3.i193 = sext i32 %sub.i192 to i64
%arrayidx4.i194 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom3.i193
%16 = load i64, ptr %arrayidx4.i194, align 8, !tbaa !7
%mul.i195 = mul nsw i64 %16, %15
%rem.i196 = srem i64 %mul.i195, 1000000007
br label %while.body.i.i197
while.body.i.i197: ; preds = %if.end.i.i206, %for.body44
%res.013.i.i198 = phi i64 [ %res.1.i.i207, %if.end.i.i206 ], [ 1, %for.body44 ]
%n.addr.012.i.i199 = phi i64 [ %shr.i.i210, %if.end.i.i206 ], [ 1000000005, %for.body44 ]
%x.addr.011.i.i200 = phi i64 [ %rem3.i.i209, %if.end.i.i206 ], [ %rem.i196, %for.body44 ]
%and.i.i201 = and i64 %n.addr.012.i.i199, 1
%tobool1.not.i.i202 = icmp eq i64 %and.i.i201, 0
br i1 %tobool1.not.i.i202, label %if.end.i.i206, label %if.then.i.i203
if.then.i.i203: ; preds = %while.body.i.i197
%mul.i.i204 = mul nsw i64 %x.addr.011.i.i200, %res.013.i.i198
%rem.i.i205 = srem i64 %mul.i.i204, 1000000007
br label %if.end.i.i206
if.end.i.i206: ; preds = %if.then.i.i203, %while.body.i.i197
%res.1.i.i207 = phi i64 [ %rem.i.i205, %if.then.i.i203 ], [ %res.013.i.i198, %while.body.i.i197 ]
%mul2.i.i208 = mul nsw i64 %x.addr.011.i.i200, %x.addr.011.i.i200
%rem3.i.i209 = urem i64 %mul2.i.i208, 1000000007
%shr.i.i210 = lshr i64 %n.addr.012.i.i199, 1
%tobool.not.i.i211 = icmp ult i64 %n.addr.012.i.i199, 2
br i1 %tobool.not.i.i211, label %binomial.exit214, label %while.body.i.i197, !llvm.loop !5
binomial.exit214: ; preds = %if.end.i.i206
%17 = srem i64 %res.1.i.i207, 1000000007
%mul5.i212 = mul nsw i64 %17, %13
%rem6.i213 = srem i64 %mul5.i212, 1000000007
%arrayidx50 = getelementptr inbounds i64, ptr %ar, i64 %indvars.iv320
%18 = load i64, ptr %arrayidx50, align 8, !tbaa !7
%mul51 = mul nsw i64 %18, %rem6.i213
%add52 = add nsw i64 %mul51, %res.6305
%rem53 = srem i64 %add52, 1000000007
%indvars.iv.next321 = add nuw nsw i64 %indvars.iv320, 1
%exitcond324.not = icmp eq i64 %indvars.iv.next321, %wide.trip.count323
br i1 %exitcond324.not, label %if.end57, label %for.body44, !llvm.loop !13
if.end57: ; preds = %binomial.exit214, %if.end38
%res.7 = phi i64 [ %res.5, %if.end38 ], [ %rem53, %binomial.exit214 ]
%cmp59 = icmp eq i32 %rem1, 3
%or.cond313 = and i1 %cmp59, %cmp4296
br i1 %or.cond313, label %for.body63.lr.ph, label %return
for.body63.lr.ph: ; preds = %if.end57
%div67334338 = lshr i32 %n, 1
%sub68 = add nsw i32 %div67334338, -1
%idxprom.i215 = sext i32 %sub68 to i64
%arrayidx.i216 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom.i215
%wide.trip.count329 = zext i32 %n to i64
%19 = load i64, ptr %arrayidx.i216, align 8, !tbaa !7
br label %for.body63
for.body63: ; preds = %for.body63.lr.ph, %if.end93
%indvars.iv325 = phi i64 [ 0, %for.body63.lr.ph ], [ %indvars.iv.next326, %if.end93 ]
%res.8309 = phi i64 [ %res.7, %for.body63.lr.ph ], [ %rem100, %if.end93 ]
%20 = trunc i64 %indvars.iv325 to i32
%rem64 = and i32 %20, 1
%cmp65.not = icmp eq i32 %rem64, 0
%div76156 = lshr i32 %20, 1
%idxprom1.i244 = zext i32 %div76156 to i64
%arrayidx2.i245 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom1.i244
%21 = load i64, ptr %arrayidx2.i245, align 8, !tbaa !7
%sub.i246 = sub nsw i32 %sub68, %div76156
%idxprom3.i247 = sext i32 %sub.i246 to i64
%arrayidx4.i248 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom3.i247
%22 = load i64, ptr %arrayidx4.i248, align 8, !tbaa !7
%mul.i249 = mul nsw i64 %22, %21
%rem.i250 = srem i64 %mul.i249, 1000000007
br i1 %cmp65.not, label %while.body.i.i251, label %while.body.i.i224
while.body.i.i224: ; preds = %for.body63, %if.end.i.i233
%res.013.i.i225 = phi i64 [ %res.1.i.i234, %if.end.i.i233 ], [ 1, %for.body63 ]
%n.addr.012.i.i226 = phi i64 [ %shr.i.i237, %if.end.i.i233 ], [ 1000000005, %for.body63 ]
%x.addr.011.i.i227 = phi i64 [ %rem3.i.i236, %if.end.i.i233 ], [ %rem.i250, %for.body63 ]
%and.i.i228 = and i64 %n.addr.012.i.i226, 1
%tobool1.not.i.i229 = icmp eq i64 %and.i.i228, 0
br i1 %tobool1.not.i.i229, label %if.end.i.i233, label %if.then.i.i230
if.then.i.i230: ; preds = %while.body.i.i224
%mul.i.i231 = mul nsw i64 %x.addr.011.i.i227, %res.013.i.i225
%rem.i.i232 = srem i64 %mul.i.i231, 1000000007
br label %if.end.i.i233
if.end.i.i233: ; preds = %if.then.i.i230, %while.body.i.i224
%res.1.i.i234 = phi i64 [ %rem.i.i232, %if.then.i.i230 ], [ %res.013.i.i225, %while.body.i.i224 ]
%mul2.i.i235 = mul nsw i64 %x.addr.011.i.i227, %x.addr.011.i.i227
%rem3.i.i236 = urem i64 %mul2.i.i235, 1000000007
%shr.i.i237 = lshr i64 %n.addr.012.i.i226, 1
%tobool.not.i.i238 = icmp ult i64 %n.addr.012.i.i226, 2
br i1 %tobool.not.i.i238, label %binomial.exit241, label %while.body.i.i224, !llvm.loop !5
binomial.exit241: ; preds = %if.end.i.i233
%23 = srem i64 %res.1.i.i234, 1000000007
%mul5.i239 = mul nsw i64 %23, %19
%rem6.i240 = srem i64 %mul5.i239, 1000000007
%mul71 = shl nsw i64 %rem6.i240, 1
%rem72 = srem i64 %mul71, 1000000007
br label %if.end93
while.body.i.i251: ; preds = %for.body63, %if.end.i.i260
%res.013.i.i252 = phi i64 [ %res.1.i.i261, %if.end.i.i260 ], [ 1, %for.body63 ]
%n.addr.012.i.i253 = phi i64 [ %shr.i.i264, %if.end.i.i260 ], [ 1000000005, %for.body63 ]
%x.addr.011.i.i254 = phi i64 [ %rem3.i.i263, %if.end.i.i260 ], [ %rem.i250, %for.body63 ]
%and.i.i255 = and i64 %n.addr.012.i.i253, 1
%tobool1.not.i.i256 = icmp eq i64 %and.i.i255, 0
br i1 %tobool1.not.i.i256, label %if.end.i.i260, label %if.then.i.i257
if.then.i.i257: ; preds = %while.body.i.i251
%mul.i.i258 = mul nsw i64 %x.addr.011.i.i254, %res.013.i.i252
%rem.i.i259 = srem i64 %mul.i.i258, 1000000007
br label %if.end.i.i260
if.end.i.i260: ; preds = %if.then.i.i257, %while.body.i.i251
%res.1.i.i261 = phi i64 [ %rem.i.i259, %if.then.i.i257 ], [ %res.013.i.i252, %while.body.i.i251 ]
%mul2.i.i262 = mul nsw i64 %x.addr.011.i.i254, %x.addr.011.i.i254
%rem3.i.i263 = urem i64 %mul2.i.i262, 1000000007
%shr.i.i264 = lshr i64 %n.addr.012.i.i253, 1
%tobool.not.i.i265 = icmp ult i64 %n.addr.012.i.i253, 2
br i1 %tobool.not.i.i265, label %binomial.exit268, label %while.body.i.i251, !llvm.loop !5
binomial.exit268: ; preds = %if.end.i.i260
%24 = srem i64 %res.1.i.i261, 1000000007
%mul5.i266 = mul nsw i64 %24, %19
%rem6.i267 = srem i64 %mul5.i266, 1000000007
%tobool.not = icmp eq i64 %indvars.iv325, 0
br i1 %tobool.not, label %if.end87, label %if.then78
if.then78: ; preds = %binomial.exit268
%sub82 = add nsw i32 %div76156, -1
%idxprom1.i271 = sext i32 %sub82 to i64
%arrayidx2.i272 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom1.i271
%25 = load i64, ptr %arrayidx2.i272, align 8, !tbaa !7
%sub.i273 = sub nsw i32 %sub68, %sub82
%idxprom3.i274 = sext i32 %sub.i273 to i64
%arrayidx4.i275 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %idxprom3.i274
%26 = load i64, ptr %arrayidx4.i275, align 8, !tbaa !7
%mul.i276 = mul nsw i64 %26, %25
%rem.i277 = srem i64 %mul.i276, 1000000007
br label %while.body.i.i278
while.body.i.i278: ; preds = %if.end.i.i287, %if.then78
%res.013.i.i279 = phi i64 [ %res.1.i.i288, %if.end.i.i287 ], [ 1, %if.then78 ]
%n.addr.012.i.i280 = phi i64 [ %shr.i.i291, %if.end.i.i287 ], [ 1000000005, %if.then78 ]
%x.addr.011.i.i281 = phi i64 [ %rem3.i.i290, %if.end.i.i287 ], [ %rem.i277, %if.then78 ]
%and.i.i282 = and i64 %n.addr.012.i.i280, 1
%tobool1.not.i.i283 = icmp eq i64 %and.i.i282, 0
br i1 %tobool1.not.i.i283, label %if.end.i.i287, label %if.then.i.i284
if.then.i.i284: ; preds = %while.body.i.i278
%mul.i.i285 = mul nsw i64 %x.addr.011.i.i281, %res.013.i.i279
%rem.i.i286 = srem i64 %mul.i.i285, 1000000007
br label %if.end.i.i287
if.end.i.i287: ; preds = %if.then.i.i284, %while.body.i.i278
%res.1.i.i288 = phi i64 [ %rem.i.i286, %if.then.i.i284 ], [ %res.013.i.i279, %while.body.i.i278 ]
%mul2.i.i289 = mul nsw i64 %x.addr.011.i.i281, %x.addr.011.i.i281
%rem3.i.i290 = urem i64 %mul2.i.i289, 1000000007
%shr.i.i291 = lshr i64 %n.addr.012.i.i280, 1
%tobool.not.i.i292 = icmp ult i64 %n.addr.012.i.i280, 2
br i1 %tobool.not.i.i292, label %binomial.exit295, label %while.body.i.i278, !llvm.loop !5
binomial.exit295: ; preds = %if.end.i.i287
%27 = srem i64 %res.1.i.i288, 1000000007
%mul5.i293 = mul nsw i64 %27, %19
%rem6.i294 = srem i64 %mul5.i293, 1000000007
%sub84 = add nsw i64 %rem6.i267, 1000000007
%add85 = sub nsw i64 %sub84, %rem6.i294
%rem86 = srem i64 %add85, 1000000007
br label %if.end87
if.end87: ; preds = %binomial.exit295, %binomial.exit268
%x.0 = phi i64 [ %rem86, %binomial.exit295 ], [ %rem6.i267, %binomial.exit268 ]
%indvars.iv325.tr = trunc i64 %indvars.iv325 to i32
%28 = shl i32 %indvars.iv325.tr, 1
%cmp89 = icmp sgt i32 %28, %n
%sub91 = add nsw i64 %x.0, -1000000007
%spec.select = select i1 %cmp89, i64 %sub91, i64 %x.0
br label %if.end93
if.end93: ; preds = %if.end87, %binomial.exit241
%x.1 = phi i64 [ %rem72, %binomial.exit241 ], [ %spec.select, %if.end87 ]
%arrayidx95 = getelementptr inbounds i64, ptr %ar, i64 %indvars.iv325
%29 = load i64, ptr %arrayidx95, align 8, !tbaa !7
%mul96 = mul nsw i64 %29, %x.1
%rem97 = srem i64 %mul96, 1000000007
%add98 = add nsw i64 %res.8309, 1000000007
%add99 = add nsw i64 %add98, %rem97
%rem100 = srem i64 %add99, 1000000007
%indvars.iv.next326 = add nuw nsw i64 %indvars.iv325, 1
%exitcond330.not = icmp eq i64 %indvars.iv.next326, %wide.trip.count329
br i1 %exitcond330.not, label %return, label %for.body63, !llvm.loop !14
return: ; preds = %if.end93, %if.end57, %if.then
%retval.0.in = phi i64 [ %0, %if.then ], [ %res.7, %if.end57 ], [ %rem100, %if.end93 ]
%retval.0 = srem i64 %retval.0.in, 1000000007
ret i64 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
store i64 1, ptr @fact, align 16, !tbaa !7
br label %for.body
while.cond.preheader: ; preds = %for.body
%call27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp3.not28 = icmp eq i32 %call27, -1
br i1 %cmp3.not28, label %while.end, label %for.cond5.preheader
for.body: ; preds = %for.body.1, %entry
%0 = phi i64 [ 1, %entry ], [ %rem.1, %for.body.1 ]
%indvars.iv = phi i64 [ 1, %entry ], [ %indvars.iv.next.1, %for.body.1 ]
%mul = mul nsw i64 %0, %indvars.iv
%rem = srem i64 %mul, 1000000007
%arrayidx2 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %indvars.iv
store i64 %rem, ptr %arrayidx2, align 8, !tbaa !7
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 1000010
br i1 %exitcond.not, label %while.cond.preheader, label %for.body.1, !llvm.loop !15
for.body.1: ; preds = %for.body
%mul.1 = mul nsw i64 %rem, %indvars.iv.next
%rem.1 = srem i64 %mul.1, 1000000007
%arrayidx2.1 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %indvars.iv.next
store i64 %rem.1, ptr %arrayidx2.1, align 8, !tbaa !7
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
br label %for.body
for.cond5.preheader: ; preds = %while.cond.preheader, %for.end14
%1 = load i32, ptr %n, align 4, !tbaa !16
%cmp625 = icmp sgt i32 %1, 0
br i1 %cmp625, label %for.body8, label %for.end14
for.body8: ; preds = %for.cond5.preheader, %for.body8
%indvars.iv32 = phi i64 [ %indvars.iv.next33, %for.body8 ], [ 0, %for.cond5.preheader ]
%arrayidx10 = getelementptr inbounds [1000010 x i64], ptr @ar, i64 0, i64 %indvars.iv32
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx10)
%indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
%2 = load i32, ptr %n, align 4, !tbaa !16
%3 = sext i32 %2 to i64
%cmp6 = icmp slt i64 %indvars.iv.next33, %3
br i1 %cmp6, label %for.body8, label %for.end14, !llvm.loop !18
for.end14: ; preds = %for.body8, %for.cond5.preheader
%.lcssa = phi i32 [ %1, %for.cond5.preheader ], [ %2, %for.body8 ]
%call15 = call i64 @solve(i32 noundef %.lcssa, ptr noundef nonnull @ar), !range !19
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %call15)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp3.not = icmp eq i32 %call, -1
br i1 %cmp3.not, label %while.end, label %for.cond5.preheader, !llvm.loop !20
while.end: ; preds = %for.end14, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree norecurse nosync nounwind memory(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 #3 = { 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 #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"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"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !9, i64 0}
!18 = distinct !{!18, !6}
!19 = !{i64 -1000000006, i64 1000000007}
!20 = distinct !{!20, !6}
|
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void push(int, int,int []);
int pop(int, int[]);
int main() {
char array[1000000];
char *pt=array,*tok;
int top=0,result[100],num,a,b;
scanf("%[^\n]*s", pt);
tok = strtok(pt, " ");
while (tok!=NULL) {
if (*tok == '+') {
a = pop(--top, result);
b = pop(--top, result);
push(a + b, top++, result);
}
else if (*tok == '-') {
b = pop(--top, result);
a = pop(--top, result);
push(a - b, top++, result);
}
else if (*tok == '*') {
a = pop(--top, result);
b = pop(--top, result);
push(a * b, top++, result);
}
else {
num = atoi(tok);
push(num, top++, result);
}
tok = strtok(NULL, " ");
}
printf("%d\n",pop(--top,result));
return 0;
}
void push(int n, int t, int a[]){
a[t] = n;
}
int pop(int t, int a[]){
return a[t];
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286001/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286001/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%[^\0A]*s\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c" \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:
%array = alloca [1000000 x i8], align 16
%result = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %array) #6
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %result) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %array)
%call1 = call ptr @strtok(ptr noundef nonnull %array, ptr noundef nonnull @.str.1) #6
%cmp.not85 = icmp eq ptr %call1, null
br i1 %cmp.not85, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end40
%tok.087 = phi ptr [ %call41, %if.end40 ], [ %call1, %entry ]
%top.086 = phi i32 [ %top.1, %if.end40 ], [ 0, %entry ]
%0 = load i8, ptr %tok.087, align 1, !tbaa !5
switch i8 %0, label %if.else35 [
i8 43, label %if.then
i8 45, label %if.then13
i8 42, label %if.then26
]
if.then: ; preds = %while.body
%dec = add nsw i32 %top.086, -1
%idxprom.i = sext i32 %dec to i64
%arrayidx.i = getelementptr inbounds i32, ptr %result, i64 %idxprom.i
%1 = load i32, ptr %arrayidx.i, align 4, !tbaa !8
%dec6 = add nsw i32 %top.086, -2
%idxprom.i65 = sext i32 %dec6 to i64
%arrayidx.i66 = getelementptr inbounds i32, ptr %result, i64 %idxprom.i65
%2 = load i32, ptr %arrayidx.i66, align 4, !tbaa !8
%add = add nsw i32 %2, %1
store i32 %add, ptr %arrayidx.i66, align 4, !tbaa !8
br label %if.end40
if.then13: ; preds = %while.body
%dec14 = add nsw i32 %top.086, -1
%idxprom.i69 = sext i32 %dec14 to i64
%arrayidx.i70 = getelementptr inbounds i32, ptr %result, i64 %idxprom.i69
%3 = load i32, ptr %arrayidx.i70, align 4, !tbaa !8
%dec17 = add nsw i32 %top.086, -2
%idxprom.i71 = sext i32 %dec17 to i64
%arrayidx.i72 = getelementptr inbounds i32, ptr %result, i64 %idxprom.i71
%4 = load i32, ptr %arrayidx.i72, align 4, !tbaa !8
%sub = sub nsw i32 %4, %3
store i32 %sub, ptr %arrayidx.i72, align 4, !tbaa !8
br label %if.end40
if.then26: ; preds = %while.body
%dec27 = add nsw i32 %top.086, -1
%idxprom.i75 = sext i32 %dec27 to i64
%arrayidx.i76 = getelementptr inbounds i32, ptr %result, i64 %idxprom.i75
%5 = load i32, ptr %arrayidx.i76, align 4, !tbaa !8
%dec30 = add nsw i32 %top.086, -2
%idxprom.i77 = sext i32 %dec30 to i64
%arrayidx.i78 = getelementptr inbounds i32, ptr %result, i64 %idxprom.i77
%6 = load i32, ptr %arrayidx.i78, align 4, !tbaa !8
%mul = mul nsw i32 %6, %5
store i32 %mul, ptr %arrayidx.i78, align 4, !tbaa !8
br label %if.end40
if.else35: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %tok.087, ptr noundef null, i32 noundef 10) #6
%conv.i = trunc i64 %call.i to i32
%inc37 = add nsw i32 %top.086, 1
%idxprom.i81 = sext i32 %top.086 to i64
%arrayidx.i82 = getelementptr inbounds i32, ptr %result, i64 %idxprom.i81
store i32 %conv.i, ptr %arrayidx.i82, align 4, !tbaa !8
br label %if.end40
if.end40: ; preds = %if.then13, %if.else35, %if.then26, %if.then
%top.1 = phi i32 [ %dec, %if.then ], [ %dec14, %if.then13 ], [ %dec27, %if.then26 ], [ %inc37, %if.else35 ]
%call41 = call ptr @strtok(ptr noundef null, ptr noundef nonnull @.str.1) #6
%cmp.not = icmp eq ptr %call41, null
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10
while.end.loopexit: ; preds = %if.end40
%7 = add nsw i32 %top.1, -1
%8 = sext i32 %7 to i64
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%top.0.lcssa = phi i64 [ -1, %entry ], [ %8, %while.end.loopexit ]
%arrayidx.i84 = getelementptr inbounds i32, ptr %result, i64 %top.0.lcssa
%9 = load i32, ptr %arrayidx.i84, align 4, !tbaa !8
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %result) #6
call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %array) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn
declare ptr @strtok(ptr noundef, ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pop(i32 noundef %t, ptr nocapture noundef readonly %a) local_unnamed_addr #4 {
entry:
%idxprom = sext i32 %t to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !8
ret i32 %0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @push(i32 noundef %n, i32 noundef %t, ptr nocapture noundef writeonly %a) local_unnamed_addr #5 {
entry:
%idxprom = sext i32 %t to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
store i32 %n, ptr %arrayidx, align 4, !tbaa !8
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(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 #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, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int pop();
void push();
int A[100],top=0;
int main(){
int a,b;
char s[100];
while(scanf("%s",s)!=EOF){
if(s[0]=='+'){
a=pop();
b=pop();
push(a+b);
}
else if(s[0]=='-'){
a=pop();
b=pop();
push(b-a);
}
else if(s[0]=='*'){
a=pop();
b=pop();
push(a*b);
}
else
push(atoi(s));
}
printf("%d\n",pop());
return 0;
}
int pop(){
top--;
return A[top+1];
}
void push(int x){
A[++top]=x;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286045/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286045/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@A = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !5
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !8
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [100 x i32], ptr @A, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !8
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [100 x i32], ptr @A, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !8
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !8
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !8
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !8
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [100 x i32], ptr @A, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !8
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [100 x i32], ptr @A, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !8
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !8
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !8
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !8
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [100 x i32], ptr @A, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !8
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [100 x i32], ptr @A, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !8
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !8
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !8
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !8
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !8
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [100 x i32], ptr @A, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !8
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !8
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !8
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [100 x i32], ptr @A, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !8
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @A, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !8
ret i32 %1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @A, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !8
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top,S1[200];
void initialize(){
top = 0;
}
/*int isEmpty(){
if(top == 0)
return 1;
}*/
/*void push(int y, int *S){
top++;
S[top] = y;
}*/
void push(int x){
S1[++top] = x;
}
/*int pop(int *S){
if(isEmpty)
fprintf(stderr,"underflow\n");
top--;
return S[top+1];
}*/
int pop(){
top--;
return S1[top+1];
}
int main(){
int a,b;
char S[200];
int i /*,S1[200]*/;
initialize();
/*for(i = 0; i < 200; i++){
S[i] = '0';
S1[i] = 0;
}*/
while(scanf("%s",S) != EOF){
if(S[0] == '+'){
a = pop();
b = pop();
push(a+b);
}
else if(S[0] == '-'){
b = pop();
a = pop();
push(a-b);
}
else if(S[0] == '*'){
a = pop();
b = pop();
push(a*b);
}
else push(atoi(S));
}
/* printf("check1 %s\n",S);
if(S[0] != '+' || S[0] != '-' || S[0] != '*' ){
printf("checkA %s\n",S);
printf("atoi %d\n",atoi(S));
S1[n] = atoi(S);
}*/
/* for(i = 0; i < n; i++){
if(S[i] == '+'){
x = pop(S);
x += pop(S);
push(x,S);
}
else if(S[i] == '-'){
x = pop(S);
x -= pop(S);
push(x,S);
}
else if(S[i] == '*'){
x = pop(S);
x *= pop(S);
push(x,S);
}
else push(S[i],S);
}*/
printf("%d\n",pop());
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286096/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286096/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@top = dso_local local_unnamed_addr global i32 0, align 4
@S1 = dso_local local_unnamed_addr global [200 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @initialize() local_unnamed_addr #0 {
entry:
store i32 0, ptr @top, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [200 x i32], ptr @S1, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [200 x i32], ptr @S1, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%S = alloca [200 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %S) #6
store i32 0, ptr @top, align 4, !tbaa !5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %S, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [200 x i32], ptr @S1, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [200 x i32], ptr @S1, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [200 x i32], ptr @S1, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [200 x i32], ptr @S1, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [200 x i32], ptr @S1, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [200 x i32], ptr @S1, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %S, ptr noundef null, i32 noundef 10) #6
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [200 x i32], ptr @S1, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [200 x i32], ptr @S1, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %S) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#define MAX 199
void initialize(void);
int isEmpty(void);
int isFull(void);
void push(int x);
int pop(void);
int top;
int S[MAX];
int main(){
int y1,y2;
char x[100];
initialize();
while(scanf("%s",x)!=EOF){
if ( x[0] == '+' ){
y1=pop();
y2=pop();
push(y1+y2);
} else if ( x[0] == '-' ){
y2=pop();
y1=pop();
push(y1-y2);
} else if( x[0] == '*' ){
y1=pop();
y2=pop();
push(y1*y2);
}
else {
y1=atoi(x);
push(y1);
}
}
printf("%d\n",pop());
return 0;
}
void initialize(void){
top=0;
}
int isEmpty(void){
if(top==0) return 1;
else return 0;
}
int isFull(void){
if(top>=MAX-1) return 1;
return 0;
}
void push(int x){
if(isFull()==1){
fprintf(stderr,"??¨??????????????????????????????)\n");
exit(1);
}
top++;
S[top]=x;
}
int pop(void){
if(isEmpty()==1){
fprintf(stderr,"??¨???????????¢?????????????????????\n");
exit(1);
return 0;
}
top--;
return S[top+1];
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286139/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286139/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@top = dso_local local_unnamed_addr global i32 0, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = private unnamed_addr constant [37 x i8] c"??\C2\A8??????????????????????????????)\0A\00", align 1
@S = dso_local local_unnamed_addr global [199 x i32] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [40 x i8] c"??\C2\A8???????????\C2\A2?????????????????????\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %x) #8
store i32 0, ptr @top, align 4, !tbaa !5
%call89 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%cmp.not90 = icmp eq i32 %call89, -1
br i1 %cmp.not90, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %x, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.not.i = icmp eq i32 %1, 0
br i1 %cmp.i.not.i, label %if.then.i, label %pop.exit
if.then.i: ; preds = %if.then
%2 = load ptr, ptr @stderr, align 8, !tbaa !10
%3 = call i64 @fwrite(ptr nonnull @.str.3, i64 39, i64 1, ptr %2) #9
call void @exit(i32 noundef 1) #10
unreachable
pop.exit: ; preds = %if.then
%dec.i = add nsw i32 %1, -1
store i32 %dec.i, ptr @top, align 4, !tbaa !5
%cmp.i.not.i32 = icmp eq i32 %dec.i, 0
br i1 %cmp.i.not.i32, label %if.then.i36, label %pop.exit37
if.then.i36: ; preds = %pop.exit
%4 = load ptr, ptr @stderr, align 8, !tbaa !10
%5 = call i64 @fwrite(ptr nonnull @.str.3, i64 39, i64 1, ptr %4) #9
call void @exit(i32 noundef 1) #10
unreachable
pop.exit37: ; preds = %pop.exit
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [199 x i32], ptr @S, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%dec.i33 = add nsw i32 %1, -2
store i32 %dec.i33, ptr @top, align 4, !tbaa !5
%cmp.i.i = icmp slt i32 %1, 200
br i1 %cmp.i.i, label %push.exit, label %if.then.i38
if.then.i38: ; preds = %pop.exit37
%7 = load ptr, ptr @stderr, align 8, !tbaa !10
%8 = call i64 @fwrite(ptr nonnull @.str.2, i64 36, i64 1, ptr %7) #9
call void @exit(i32 noundef 1) #10
unreachable
push.exit: ; preds = %pop.exit37
%idxprom.i34 = sext i32 %dec.i to i64
%arrayidx.i35 = getelementptr inbounds [199 x i32], ptr @S, i64 0, i64 %idxprom.i34
%9 = load i32, ptr %arrayidx.i35, align 4, !tbaa !5
%add = add nsw i32 %9, %6
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i35, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%10 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.not.i41 = icmp eq i32 %10, 0
br i1 %cmp.i.not.i41, label %if.then.i45, label %pop.exit46
if.then.i45: ; preds = %if.then9
%11 = load ptr, ptr @stderr, align 8, !tbaa !10
%12 = call i64 @fwrite(ptr nonnull @.str.3, i64 39, i64 1, ptr %11) #9
call void @exit(i32 noundef 1) #10
unreachable
pop.exit46: ; preds = %if.then9
%dec.i42 = add nsw i32 %10, -1
store i32 %dec.i42, ptr @top, align 4, !tbaa !5
%cmp.i.not.i47 = icmp eq i32 %dec.i42, 0
br i1 %cmp.i.not.i47, label %if.then.i51, label %pop.exit52
if.then.i51: ; preds = %pop.exit46
%13 = load ptr, ptr @stderr, align 8, !tbaa !10
%14 = call i64 @fwrite(ptr nonnull @.str.3, i64 39, i64 1, ptr %13) #9
call void @exit(i32 noundef 1) #10
unreachable
pop.exit52: ; preds = %pop.exit46
%idxprom.i43 = sext i32 %10 to i64
%arrayidx.i44 = getelementptr inbounds [199 x i32], ptr @S, i64 0, i64 %idxprom.i43
%15 = load i32, ptr %arrayidx.i44, align 4, !tbaa !5
%dec.i48 = add nsw i32 %10, -2
store i32 %dec.i48, ptr @top, align 4, !tbaa !5
%cmp.i.i53 = icmp slt i32 %10, 200
br i1 %cmp.i.i53, label %push.exit58, label %if.then.i54
if.then.i54: ; preds = %pop.exit52
%16 = load ptr, ptr @stderr, align 8, !tbaa !10
%17 = call i64 @fwrite(ptr nonnull @.str.2, i64 36, i64 1, ptr %16) #9
call void @exit(i32 noundef 1) #10
unreachable
push.exit58: ; preds = %pop.exit52
%idxprom.i49 = sext i32 %dec.i42 to i64
%arrayidx.i50 = getelementptr inbounds [199 x i32], ptr @S, i64 0, i64 %idxprom.i49
%18 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%sub = sub nsw i32 %18, %15
store i32 %dec.i42, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%19 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.not.i59 = icmp eq i32 %19, 0
br i1 %cmp.i.not.i59, label %if.then.i63, label %pop.exit64
if.then.i63: ; preds = %if.then17
%20 = load ptr, ptr @stderr, align 8, !tbaa !10
%21 = call i64 @fwrite(ptr nonnull @.str.3, i64 39, i64 1, ptr %20) #9
call void @exit(i32 noundef 1) #10
unreachable
pop.exit64: ; preds = %if.then17
%dec.i60 = add nsw i32 %19, -1
store i32 %dec.i60, ptr @top, align 4, !tbaa !5
%cmp.i.not.i65 = icmp eq i32 %dec.i60, 0
br i1 %cmp.i.not.i65, label %if.then.i69, label %pop.exit70
if.then.i69: ; preds = %pop.exit64
%22 = load ptr, ptr @stderr, align 8, !tbaa !10
%23 = call i64 @fwrite(ptr nonnull @.str.3, i64 39, i64 1, ptr %22) #9
call void @exit(i32 noundef 1) #10
unreachable
pop.exit70: ; preds = %pop.exit64
%idxprom.i61 = sext i32 %19 to i64
%arrayidx.i62 = getelementptr inbounds [199 x i32], ptr @S, i64 0, i64 %idxprom.i61
%24 = load i32, ptr %arrayidx.i62, align 4, !tbaa !5
%dec.i66 = add nsw i32 %19, -2
store i32 %dec.i66, ptr @top, align 4, !tbaa !5
%cmp.i.i71 = icmp slt i32 %19, 200
br i1 %cmp.i.i71, label %push.exit76, label %if.then.i72
if.then.i72: ; preds = %pop.exit70
%25 = load ptr, ptr @stderr, align 8, !tbaa !10
%26 = call i64 @fwrite(ptr nonnull @.str.2, i64 36, i64 1, ptr %25) #9
call void @exit(i32 noundef 1) #10
unreachable
push.exit76: ; preds = %pop.exit70
%idxprom.i67 = sext i32 %dec.i60 to i64
%arrayidx.i68 = getelementptr inbounds [199 x i32], ptr @S, i64 0, i64 %idxprom.i67
%27 = load i32, ptr %arrayidx.i68, align 4, !tbaa !5
%mul = mul nsw i32 %27, %24
store i32 %dec.i60, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i68, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %x, ptr noundef null, i32 noundef 10) #8
%28 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.i77 = icmp slt i32 %28, 198
br i1 %cmp.i.i77, label %push.exit82, label %if.then.i78
if.then.i78: ; preds = %if.else20
%29 = load ptr, ptr @stderr, align 8, !tbaa !10
%30 = call i64 @fwrite(ptr nonnull @.str.2, i64 36, i64 1, ptr %29) #9
call void @exit(i32 noundef 1) #10
unreachable
push.exit82: ; preds = %if.else20
%conv.i = trunc i64 %call.i to i32
%inc.i79 = add nsw i32 %28, 1
store i32 %inc.i79, ptr @top, align 4, !tbaa !5
%idxprom.i80 = sext i32 %inc.i79 to i64
%arrayidx.i81 = getelementptr inbounds [199 x i32], ptr @S, i64 0, i64 %idxprom.i80
store i32 %conv.i, ptr %arrayidx.i81, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %push.exit58, %push.exit82, %push.exit76, %push.exit
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.end24, %entry
%31 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.not.i83 = icmp eq i32 %31, 0
br i1 %cmp.i.not.i83, label %if.then.i87, label %pop.exit88
if.then.i87: ; preds = %while.end
%32 = load ptr, ptr @stderr, align 8, !tbaa !10
%33 = call i64 @fwrite(ptr nonnull @.str.3, i64 39, i64 1, ptr %32) #9
call void @exit(i32 noundef 1) #10
unreachable
pop.exit88: ; preds = %while.end
%dec.i84 = add nsw i32 %31, -1
store i32 %dec.i84, ptr @top, align 4, !tbaa !5
%idxprom.i85 = sext i32 %31 to i64
%arrayidx.i86 = getelementptr inbounds [199 x i32], ptr @S, i64 0, i64 %idxprom.i85
%34 = load i32, ptr %arrayidx.i86, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %34)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %x) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @initialize() local_unnamed_addr #2 {
entry:
store i32 0, ptr @top, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nounwind uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.not = icmp eq i32 %0, 0
br i1 %cmp.i.not, label %if.then, label %if.end
if.then: ; preds = %entry
%1 = load ptr, ptr @stderr, align 8, !tbaa !10
%2 = tail call i64 @fwrite(ptr nonnull @.str.3, i64 39, i64 1, ptr %1) #9
tail call void @exit(i32 noundef 1) #10
unreachable
if.end: ; preds = %entry
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [199 x i32], ptr @S, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %3
}
; Function Attrs: nounwind uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i = icmp slt i32 %0, 198
br i1 %cmp.i, label %if.end, label %if.then
if.then: ; preds = %entry
%1 = load ptr, ptr @stderr, align 8, !tbaa !10
%2 = tail call i64 @fwrite(ptr nonnull @.str.2, i64 36, i64 1, ptr %1) #9
tail call void @exit(i32 noundef 1) #10
unreachable
if.end: ; preds = %entry
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [199 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; 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 norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @isEmpty() local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 0
%. = 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 @isFull() local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 197
%. = zext i1 %cmp to i32
ret i32 %.
}
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #7
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree 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 #5 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind }
attributes #8 = { nounwind }
attributes #9 = { cold }
attributes #10 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int num[1000];
int t;
void push(int x) {
num[++t] = x;
}
int pop() {
return num[t--];
}
int main(void) {
char formula[100];
int a, b;
t = 0;
while ( scanf("%s", formula) != EOF ) {
if (formula[0] == '+') {
a = pop();
b = pop();
push( a + b );
}else if (formula[0] == '-') {
b = pop();
a = pop();
push( a - b );
}else if (formula[0] == '*') {
a = pop();
b = pop();
push( a * b );
}else {
push(atoi(formula));
}
}
printf("%d\n", pop());
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286182/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286182/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@num = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@t = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @t, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @t, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @t, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @t, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%formula = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %formula) #5
store i32 0, ptr @t, align 4, !tbaa !5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %formula)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %formula, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @t, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @t, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @t, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @t, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @t, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @t, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %formula, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @t, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @t, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %formula)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @t, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @t, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %formula) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
typedef int stack_data;
#define success 1
#define failure 0
typedef struct{
int data_num;
int stack_size;
stack_data *data;
}stack;
stack *make_stack(int stack_size){
stack *p;
p=malloc(sizeof(stack));
p->data=malloc(stack_size*sizeof(stack_data));
p->stack_size=stack_size;
p->data_num=0;
return p;
}
int push(stack *S,stack_data a){
if(S->data_num < S->stack_size){
S->data[S->data_num]=a;
S->data_num++;
return success;
}
else return failure;
}
int pop(stack *S,stack_data *p){
if(S->data_num>0){
*p=S->data[S->data_num -1];
S->data_num--;
return success;
}
else return failure;
}
int main(){
char c[8];
int *x,*y,z;
x=malloc(sizeof(int));
y=malloc(sizeof(int));
stack *S;
S=make_stack(101);
while(scanf("%8s",c)!=EOF){
if('+'==c[0]){
pop(S,x);
pop(S,y);
z=x[0]+y[0];
push(S,z);
}
else if('-'==c[0]){
pop(S,x);
pop(S,y);
z=-x[0]+y[0];
push(S,z);
}
else if('*'==c[0]){
pop(S,x);
pop(S,y);
z=x[0]*y[0];
push(S,z);
}
else{
z=atoi(c);
push(S,z);
}
}
printf("%d\n",S->data[0]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286225/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286225/source.c"
target datalayout = "e-m:e-p270: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.stack = type { i32, i32, ptr }
@.str = private unnamed_addr constant [4 x i8] c"%8s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @make_stack(i32 noundef %stack_size) local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #8
%conv = sext i32 %stack_size to i64
%mul = shl nsw i64 %conv, 2
%call1 = tail call noalias ptr @malloc(i64 noundef %mul) #8
%data = getelementptr inbounds %struct.stack, ptr %call, i64 0, i32 2
store ptr %call1, ptr %data, align 8, !tbaa !5
%stack_size2 = getelementptr inbounds %struct.stack, ptr %call, i64 0, i32 1
store i32 %stack_size, ptr %stack_size2, align 4, !tbaa !11
store i32 0, ptr %call, align 8, !tbaa !12
ret ptr %call
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @push(ptr nocapture noundef %S, i32 noundef %a) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %S, align 8, !tbaa !12
%stack_size = getelementptr inbounds %struct.stack, ptr %S, i64 0, i32 1
%1 = load i32, ptr %stack_size, align 4, !tbaa !11
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.then, label %return
if.then: ; preds = %entry
%data = getelementptr inbounds %struct.stack, ptr %S, i64 0, i32 2
%2 = load ptr, ptr %data, align 8, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds i32, ptr %2, i64 %idxprom
store i32 %a, ptr %arrayidx, align 4, !tbaa !13
%3 = load i32, ptr %S, align 8, !tbaa !12
%inc = add nsw i32 %3, 1
store i32 %inc, ptr %S, align 8, !tbaa !12
br label %return
return: ; preds = %entry, %if.then
%retval.0 = phi i32 [ 1, %if.then ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @pop(ptr nocapture noundef %S, ptr nocapture noundef writeonly %p) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %S, align 8, !tbaa !12
%cmp = icmp sgt i32 %0, 0
br i1 %cmp, label %if.then, label %return
if.then: ; preds = %entry
%data = getelementptr inbounds %struct.stack, ptr %S, i64 0, i32 2
%1 = load ptr, ptr %data, align 8, !tbaa !5
%sub = add nsw i32 %0, -1
%idxprom = zext i32 %sub to i64
%arrayidx = getelementptr inbounds i32, ptr %1, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !13
store i32 %2, ptr %p, align 4, !tbaa !13
%3 = load i32, ptr %S, align 8, !tbaa !12
%dec = add nsw i32 %3, -1
store i32 %dec, ptr %S, align 8, !tbaa !12
br label %return
return: ; preds = %entry, %if.then
%retval.0 = phi i32 [ 1, %if.then ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%c = alloca [8 x i8], align 1
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #9
%call1.i = tail call noalias dereferenceable_or_null(404) ptr @malloc(i64 noundef 404) #8
%call3158 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp.not159 = icmp eq i32 %call3158, -1
br i1 %cmp.not159, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end38
%0 = phi i32 [ %20, %if.end38 ], [ 0, %entry ]
%1 = phi i32 [ %21, %if.end38 ], [ undef, %entry ]
%2 = phi i32 [ %22, %if.end38 ], [ undef, %entry ]
%3 = phi i32 [ %23, %if.end38 ], [ undef, %entry ]
%4 = phi i32 [ %24, %if.end38 ], [ undef, %entry ]
%5 = phi i32 [ %25, %if.end38 ], [ undef, %entry ]
%6 = phi i32 [ %26, %if.end38 ], [ undef, %entry ]
%7 = load i8, ptr %c, align 1, !tbaa !14
switch i8 %7, label %if.else33 [
i8 43, label %if.then
i8 45, label %if.then15
i8 42, label %if.then27
]
if.then: ; preds = %while.body
%cmp.i = icmp sgt i32 %0, 0
br i1 %cmp.i, label %pop.exit, label %pop.exit73.thread
pop.exit: ; preds = %if.then
%sub.i = add nsw i32 %0, -1
%idxprom.i = zext i32 %sub.i to i64
%arrayidx.i = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom.i
%8 = load i32, ptr %arrayidx.i, align 4, !tbaa !13
%cmp.i65.not = icmp eq i32 %sub.i, 0
br i1 %cmp.i65.not, label %pop.exit73.thread, label %pop.exit73
pop.exit73.thread: ; preds = %pop.exit, %if.then
%9 = phi i32 [ %8, %pop.exit ], [ %2, %if.then ]
%.ph = phi i32 [ 0, %pop.exit ], [ %0, %if.then ]
%add145 = add nsw i32 %1, %9
br label %if.end38.sink.split
pop.exit73: ; preds = %pop.exit
%sub.i69 = add nsw i32 %0, -2
%idxprom.i70 = zext i32 %sub.i69 to i64
%arrayidx.i71 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom.i70
%10 = load i32, ptr %arrayidx.i71, align 4, !tbaa !13
%add = add nsw i32 %8, %10
%cmp.i74 = icmp ult i32 %sub.i69, 101
br i1 %cmp.i74, label %if.end38.sink.split, label %if.end38
if.then15: ; preds = %while.body
%cmp.i80 = icmp sgt i32 %0, 0
br i1 %cmp.i80, label %pop.exit88, label %pop.exit97.thread
pop.exit88: ; preds = %if.then15
%sub.i84 = add nsw i32 %0, -1
%idxprom.i85 = zext i32 %sub.i84 to i64
%arrayidx.i86 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom.i85
%11 = load i32, ptr %arrayidx.i86, align 4, !tbaa !13
%cmp.i89.not = icmp eq i32 %sub.i84, 0
br i1 %cmp.i89.not, label %pop.exit97.thread, label %pop.exit97
pop.exit97.thread: ; preds = %pop.exit88, %if.then15
%12 = phi i32 [ %11, %pop.exit88 ], [ %2, %if.then15 ]
%13 = phi i32 [ %11, %pop.exit88 ], [ %4, %if.then15 ]
%.ph149 = phi i32 [ 0, %pop.exit88 ], [ %0, %if.then15 ]
%add20150 = sub i32 %3, %13
br label %if.end38.sink.split
pop.exit97: ; preds = %pop.exit88
%sub.i93 = add nsw i32 %0, -2
%idxprom.i94 = zext i32 %sub.i93 to i64
%arrayidx.i95 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom.i94
%14 = load i32, ptr %arrayidx.i95, align 4, !tbaa !13
%add20 = sub i32 %14, %11
%cmp.i99 = icmp ult i32 %sub.i93, 101
br i1 %cmp.i99, label %if.end38.sink.split, label %if.end38
if.then27: ; preds = %while.body
%cmp.i107 = icmp sgt i32 %0, 0
br i1 %cmp.i107, label %pop.exit115, label %pop.exit124.thread
pop.exit115: ; preds = %if.then27
%sub.i111 = add nsw i32 %0, -1
%idxprom.i112 = zext i32 %sub.i111 to i64
%arrayidx.i113 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom.i112
%15 = load i32, ptr %arrayidx.i113, align 4, !tbaa !13
%cmp.i116.not = icmp eq i32 %sub.i111, 0
br i1 %cmp.i116.not, label %pop.exit124.thread, label %pop.exit124
pop.exit124.thread: ; preds = %pop.exit115, %if.then27
%16 = phi i32 [ %15, %pop.exit115 ], [ %2, %if.then27 ]
%17 = phi i32 [ %15, %pop.exit115 ], [ %4, %if.then27 ]
%18 = phi i32 [ %15, %pop.exit115 ], [ %6, %if.then27 ]
%.ph154 = phi i32 [ 0, %pop.exit115 ], [ %0, %if.then27 ]
%mul155 = mul nsw i32 %5, %18
br label %if.end38.sink.split
pop.exit124: ; preds = %pop.exit115
%sub.i120 = add nsw i32 %0, -2
%idxprom.i121 = zext i32 %sub.i120 to i64
%arrayidx.i122 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom.i121
%19 = load i32, ptr %arrayidx.i122, align 4, !tbaa !13
%mul = mul nsw i32 %15, %19
%cmp.i126 = icmp ult i32 %sub.i120, 101
br i1 %cmp.i126, label %if.end38.sink.split, label %if.end38
if.else33: ; preds = %while.body
%call.i134 = call i64 @strtol(ptr nocapture noundef nonnull %c, ptr noundef null, i32 noundef 10) #9
%cmp.i136 = icmp slt i32 %0, 101
br i1 %cmp.i136, label %if.then.i138, label %if.end38
if.then.i138: ; preds = %if.else33
%conv.i = trunc i64 %call.i134 to i32
br label %if.end38.sink.split
if.end38.sink.split: ; preds = %pop.exit124, %pop.exit124.thread, %pop.exit97, %pop.exit97.thread, %pop.exit73, %pop.exit73.thread, %if.then.i138
%.sink167 = phi i32 [ %0, %if.then.i138 ], [ %.ph, %pop.exit73.thread ], [ %sub.i69, %pop.exit73 ], [ %.ph149, %pop.exit97.thread ], [ %sub.i93, %pop.exit97 ], [ %.ph154, %pop.exit124.thread ], [ %sub.i120, %pop.exit124 ]
%conv.i.sink = phi i32 [ %conv.i, %if.then.i138 ], [ %add145, %pop.exit73.thread ], [ %add, %pop.exit73 ], [ %add20150, %pop.exit97.thread ], [ %add20, %pop.exit97 ], [ %mul155, %pop.exit124.thread ], [ %mul, %pop.exit124 ]
%.ph161 = phi i32 [ %1, %if.then.i138 ], [ %1, %pop.exit73.thread ], [ %10, %pop.exit73 ], [ %1, %pop.exit97.thread ], [ %14, %pop.exit97 ], [ %1, %pop.exit124.thread ], [ %19, %pop.exit124 ]
%.ph162 = phi i32 [ %2, %if.then.i138 ], [ %9, %pop.exit73.thread ], [ %8, %pop.exit73 ], [ %12, %pop.exit97.thread ], [ %11, %pop.exit97 ], [ %16, %pop.exit124.thread ], [ %15, %pop.exit124 ]
%.ph163 = phi i32 [ %3, %if.then.i138 ], [ %1, %pop.exit73.thread ], [ %10, %pop.exit73 ], [ %3, %pop.exit97.thread ], [ %14, %pop.exit97 ], [ %3, %pop.exit124.thread ], [ %19, %pop.exit124 ]
%.ph164 = phi i32 [ %4, %if.then.i138 ], [ %9, %pop.exit73.thread ], [ %8, %pop.exit73 ], [ %13, %pop.exit97.thread ], [ %11, %pop.exit97 ], [ %17, %pop.exit124.thread ], [ %15, %pop.exit124 ]
%.ph165 = phi i32 [ %5, %if.then.i138 ], [ %1, %pop.exit73.thread ], [ %10, %pop.exit73 ], [ %3, %pop.exit97.thread ], [ %14, %pop.exit97 ], [ %5, %pop.exit124.thread ], [ %19, %pop.exit124 ]
%.ph166 = phi i32 [ %6, %if.then.i138 ], [ %9, %pop.exit73.thread ], [ %8, %pop.exit73 ], [ %13, %pop.exit97.thread ], [ %11, %pop.exit97 ], [ %18, %pop.exit124.thread ], [ %15, %pop.exit124 ]
%idxprom.i140 = sext i32 %.sink167 to i64
%arrayidx.i141 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom.i140
store i32 %conv.i.sink, ptr %arrayidx.i141, align 4, !tbaa !13
%inc.i142 = add nsw i32 %.sink167, 1
br label %if.end38
if.end38: ; preds = %if.end38.sink.split, %if.else33, %pop.exit124, %pop.exit97, %pop.exit73
%20 = phi i32 [ %0, %if.else33 ], [ %sub.i120, %pop.exit124 ], [ %sub.i93, %pop.exit97 ], [ %sub.i69, %pop.exit73 ], [ %inc.i142, %if.end38.sink.split ]
%21 = phi i32 [ %1, %if.else33 ], [ %19, %pop.exit124 ], [ %14, %pop.exit97 ], [ %10, %pop.exit73 ], [ %.ph161, %if.end38.sink.split ]
%22 = phi i32 [ %2, %if.else33 ], [ %15, %pop.exit124 ], [ %11, %pop.exit97 ], [ %8, %pop.exit73 ], [ %.ph162, %if.end38.sink.split ]
%23 = phi i32 [ %3, %if.else33 ], [ %19, %pop.exit124 ], [ %14, %pop.exit97 ], [ %10, %pop.exit73 ], [ %.ph163, %if.end38.sink.split ]
%24 = phi i32 [ %4, %if.else33 ], [ %15, %pop.exit124 ], [ %11, %pop.exit97 ], [ %8, %pop.exit73 ], [ %.ph164, %if.end38.sink.split ]
%25 = phi i32 [ %5, %if.else33 ], [ %19, %pop.exit124 ], [ %14, %pop.exit97 ], [ %10, %pop.exit73 ], [ %.ph165, %if.end38.sink.split ]
%26 = phi i32 [ %6, %if.else33 ], [ %15, %pop.exit124 ], [ %11, %pop.exit97 ], [ %8, %pop.exit73 ], [ %.ph166, %if.end38.sink.split ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp.not = icmp eq i32 %call3, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %if.end38, %entry
%27 = load i32, ptr %call1.i, align 4, !tbaa !13
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %27)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #9
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #7
attributes #0 = { mustprogress nofree nounwind willreturn memory(write, argmem: none, 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn 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 #5 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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 "no-trapping-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 allocsize(0) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !10, i64 8}
!6 = !{!"", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!8, !8, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int stack[1000];
int main(void) {
int top = 0, val;
char buf[100], *ptr;
while (scanf("%s", buf) != EOF) {
val = strtol(buf, &ptr, 10);
if (buf == ptr) {
switch (*buf) {
case '+': val = stack[top - 2] + stack[top - 1]; break;
case '-': val = stack[top - 2] - stack[top - 1]; break;
case '*': val = stack[top - 2] * stack[top - 1]; break;
}
stack[top - 2] = val;
top--;
} else {
stack[top++] = val;
}
}
printf("%d\n", *stack);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286276/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286276/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@stack = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%buf = alloca [100 x i8], align 16
%ptr = alloca ptr, align 8
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %buf) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %ptr) #4
%call41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %buf)
%cmp.not42 = icmp eq i32 %call41, -1
br i1 %cmp.not42, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%top.043 = phi i32 [ %top.1, %if.end ], [ 0, %entry ]
%call2 = call i64 @strtol(ptr noundef nonnull %buf, ptr noundef nonnull %ptr, i32 noundef 10) #4
%conv = trunc i64 %call2 to i32
%0 = load ptr, ptr %ptr, align 8, !tbaa !5
%cmp4 = icmp eq ptr %buf, %0
br i1 %cmp4, label %if.then, label %if.else
if.then: ; preds = %while.body
%1 = load i8, ptr %buf, align 16, !tbaa !9
%conv7 = sext i8 %1 to i32
%.pre = add nsw i32 %top.043, -2
%.pre44 = sext i32 %.pre to i64
switch i32 %conv7, label %if.then.sw.epilog_crit_edge [
i32 43, label %sw.bb
i32 45, label %sw.bb11
i32 42, label %sw.bb19
]
if.then.sw.epilog_crit_edge: ; preds = %if.then
%.pre45 = add nsw i32 %top.043, -1
br label %if.end
sw.bb: ; preds = %if.then
%arrayidx = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %.pre44
%2 = load i32, ptr %arrayidx, align 4, !tbaa !10
%sub8 = add nsw i32 %top.043, -1
%idxprom9 = sext i32 %sub8 to i64
%arrayidx10 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom9
%3 = load i32, ptr %arrayidx10, align 4, !tbaa !10
%add = add nsw i32 %3, %2
br label %if.end
sw.bb11: ; preds = %if.then
%arrayidx14 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %.pre44
%4 = load i32, ptr %arrayidx14, align 4, !tbaa !10
%sub15 = add nsw i32 %top.043, -1
%idxprom16 = sext i32 %sub15 to i64
%arrayidx17 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom16
%5 = load i32, ptr %arrayidx17, align 4, !tbaa !10
%sub18 = sub nsw i32 %4, %5
br label %if.end
sw.bb19: ; preds = %if.then
%arrayidx22 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %.pre44
%6 = load i32, ptr %arrayidx22, align 4, !tbaa !10
%sub23 = add nsw i32 %top.043, -1
%idxprom24 = sext i32 %sub23 to i64
%arrayidx25 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom24
%7 = load i32, ptr %arrayidx25, align 4, !tbaa !10
%mul = mul nsw i32 %7, %6
br label %if.end
if.else: ; preds = %while.body
%inc = add nsw i32 %top.043, 1
%idxprom29 = sext i32 %top.043 to i64
br label %if.end
if.end: ; preds = %sw.bb, %sw.bb11, %sw.bb19, %if.then.sw.epilog_crit_edge, %if.else
%idxprom29.sink = phi i64 [ %idxprom29, %if.else ], [ %.pre44, %if.then.sw.epilog_crit_edge ], [ %.pre44, %sw.bb19 ], [ %.pre44, %sw.bb11 ], [ %.pre44, %sw.bb ]
%conv.sink = phi i32 [ %conv, %if.else ], [ %conv, %if.then.sw.epilog_crit_edge ], [ %mul, %sw.bb19 ], [ %sub18, %sw.bb11 ], [ %add, %sw.bb ]
%top.1 = phi i32 [ %inc, %if.else ], [ %.pre45, %if.then.sw.epilog_crit_edge ], [ %sub23, %sw.bb19 ], [ %sub15, %sw.bb11 ], [ %sub8, %sw.bb ]
%arrayidx30 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom29.sink
store i32 %conv.sink, ptr %arrayidx30, align 4, !tbaa !10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %buf)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.end, %entry
%8 = load i32, ptr @stack, align 16, !tbaa !10
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %ptr) #4
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %buf) #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
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
int i;
char op[100];
int num[100];
for(i=0;i<100;i++){
num[i]=0;
}
i=0;
while(scanf("%s",op)!=EOF){ //scanf?????????????????§
if(op[0]=='+'){
num[i-2]=num[i-1]+num[i-2];
i--;
}else if(op[0]=='-'){
num[i-2]=num[i-2]-num[i-1];
i--;
}else if(op[0]=='*'){
num[i-2]=num[i-1]*num[i-2];
i--;
}else{
num[i]=atoi(op); //???????????°????????????
i++;
}
// printf("%d \n",num[i-1]);
}
printf("%d\n",num[i-1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286326/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286326/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%op = alloca [100 x i8], align 16
%num = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %op) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %num) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %num, i8 0, i64 400, i1 false), !tbaa !5
%call75 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %op)
%cmp1.not76 = icmp eq i32 %call75, -1
br i1 %cmp1.not76, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end52
%i.177 = phi i32 [ %i.2, %if.end52 ], [ 0, %entry ]
%0 = load i8, ptr %op, align 16, !tbaa !9
switch i8 %0, label %if.else45 [
i8 43, label %if.then
i8 45, label %if.then17
i8 42, label %if.then34
]
if.then: ; preds = %while.body
%sub = add nsw i32 %i.177, -1
%idxprom5 = sext i32 %sub to i64
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom5
%1 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%sub7 = add nsw i32 %i.177, -2
%idxprom8 = sext i32 %sub7 to i64
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom8
%2 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%add = add nsw i32 %2, %1
store i32 %add, ptr %arrayidx9, align 4, !tbaa !5
br label %if.end52
if.then17: ; preds = %while.body
%sub18 = add nsw i32 %i.177, -2
%idxprom19 = sext i32 %sub18 to i64
%arrayidx20 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom19
%3 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%sub21 = add nsw i32 %i.177, -1
%idxprom22 = sext i32 %sub21 to i64
%arrayidx23 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom22
%4 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%sub24 = sub nsw i32 %3, %4
store i32 %sub24, ptr %arrayidx20, align 4, !tbaa !5
br label %if.end52
if.then34: ; preds = %while.body
%sub35 = add nsw i32 %i.177, -1
%idxprom36 = sext i32 %sub35 to i64
%arrayidx37 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom36
%5 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%sub38 = add nsw i32 %i.177, -2
%idxprom39 = sext i32 %sub38 to i64
%arrayidx40 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom39
%6 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%mul = mul nsw i32 %6, %5
store i32 %mul, ptr %arrayidx40, align 4, !tbaa !5
br label %if.end52
if.else45: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %op, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%idxprom48 = sext i32 %i.177 to i64
%arrayidx49 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom48
store i32 %conv.i, ptr %arrayidx49, align 4, !tbaa !5
%inc50 = add nsw i32 %i.177, 1
br label %if.end52
if.end52: ; preds = %if.then17, %if.else45, %if.then34, %if.then
%i.2 = phi i32 [ %sub, %if.then ], [ %sub21, %if.then17 ], [ %sub35, %if.then34 ], [ %inc50, %if.else45 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %op)
%cmp1.not = icmp eq i32 %call, -1
br i1 %cmp1.not, label %while.end.loopexit, label %while.body, !llvm.loop !10
while.end.loopexit: ; preds = %if.end52
%7 = add nsw i32 %i.2, -1
%8 = sext i32 %7 to i64
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%i.1.lcssa = phi i64 [ -1, %entry ], [ %8, %while.end.loopexit ]
%arrayidx55 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %i.1.lcssa
%9 = load i32, ptr %arrayidx55, align 4, !tbaa !5
%call56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %num) #5
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %op) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
long long gcd(long long a,long long b) {
return b?gcd(b,a%b):a;
}
void solve() {
long long p,q,b;
scanf("%I64d",&p);
scanf("%I64d",&q);
scanf("%I64d",&b);
long long gcd1=gcd(p,q);
p/=gcd1;
q/=gcd1;
gcd1=gcd(q,b);
while(gcd1!=1) {
q/=gcd1;
gcd1=gcd(q,gcd1);
}
if(q==1)puts("Finite");
else puts("Infinite");
}
int main() {
long long q;
scanf("%I64d",&q);
while(q--)solve();
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28637/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28637/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%I64d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"Finite\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"Infinite\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 nounwind uwtable
define dso_local void @solve() local_unnamed_addr #1 {
entry:
%p = alloca i64, align 8
%q = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %p) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i64, ptr %p, align 8, !tbaa !5
%1 = load i64, ptr %q, align 8, !tbaa !5
%tobool.not4.i = icmp eq i64 %1, 0
br i1 %tobool.not4.i, label %gcd.exit, label %cond.true.i
cond.true.i: ; preds = %entry, %cond.true.i
%b.tr6.i = phi i64 [ %rem.i, %cond.true.i ], [ %1, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %cond.true.i ], [ %0, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %cond.true.i
gcd.exit: ; preds = %cond.true.i, %entry
%a.tr.lcssa.i = phi i64 [ %0, %entry ], [ %b.tr6.i, %cond.true.i ]
%div = sdiv i64 %0, %a.tr.lcssa.i
store i64 %div, ptr %p, align 8, !tbaa !5
%div4 = sdiv i64 %1, %a.tr.lcssa.i
store i64 %div4, ptr %q, align 8, !tbaa !5
%2 = load i64, ptr %b, align 8, !tbaa !5
%tobool.not4.i15 = icmp eq i64 %2, 0
br i1 %tobool.not4.i15, label %gcd.exit22, label %cond.true.i16
cond.true.i16: ; preds = %gcd.exit, %cond.true.i16
%b.tr6.i17 = phi i64 [ %rem.i19, %cond.true.i16 ], [ %2, %gcd.exit ]
%a.tr5.i18 = phi i64 [ %b.tr6.i17, %cond.true.i16 ], [ %div4, %gcd.exit ]
%rem.i19 = srem i64 %a.tr5.i18, %b.tr6.i17
%tobool.not.i20 = icmp eq i64 %rem.i19, 0
br i1 %tobool.not.i20, label %gcd.exit22, label %cond.true.i16
gcd.exit22: ; preds = %cond.true.i16, %gcd.exit
%a.tr.lcssa.i21 = phi i64 [ %div4, %gcd.exit ], [ %b.tr6.i17, %cond.true.i16 ]
%cmp.not32 = icmp eq i64 %a.tr.lcssa.i21, 1
br i1 %cmp.not32, label %while.end, label %while.body
while.body: ; preds = %gcd.exit22, %gcd.exit30
%gcd1.034 = phi i64 [ %a.tr.lcssa.i29, %gcd.exit30 ], [ %a.tr.lcssa.i21, %gcd.exit22 ]
%div63133 = phi i64 [ %div6, %gcd.exit30 ], [ %div4, %gcd.exit22 ]
%div6 = sdiv i64 %div63133, %gcd1.034
%tobool.not4.i23 = icmp eq i64 %gcd1.034, 0
br i1 %tobool.not4.i23, label %gcd.exit30, label %cond.true.i24
cond.true.i24: ; preds = %while.body, %cond.true.i24
%b.tr6.i25 = phi i64 [ %rem.i27, %cond.true.i24 ], [ %gcd1.034, %while.body ]
%a.tr5.i26 = phi i64 [ %b.tr6.i25, %cond.true.i24 ], [ %div6, %while.body ]
%rem.i27 = srem i64 %a.tr5.i26, %b.tr6.i25
%tobool.not.i28 = icmp eq i64 %rem.i27, 0
br i1 %tobool.not.i28, label %gcd.exit30, label %cond.true.i24
gcd.exit30: ; preds = %cond.true.i24, %while.body
%a.tr.lcssa.i29 = phi i64 [ %div6, %while.body ], [ %b.tr6.i25, %cond.true.i24 ]
%cmp.not = icmp eq i64 %a.tr.lcssa.i29, 1
br i1 %cmp.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %gcd.exit30
store i64 %div6, ptr %q, align 8, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %gcd.exit22
%3 = phi i64 [ %div6, %while.cond.while.end_crit_edge ], [ %div4, %gcd.exit22 ]
%cmp8 = icmp eq i64 %3, 1
%.str.1..str.2 = select i1 %cmp8, ptr @.str.1, ptr @.str.2
%call10 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %p) #4
ret void
}
; 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 @puts(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 uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%q = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %q) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%0 = load i64, ptr %q, align 8, !tbaa !5
%dec1 = add nsw i64 %0, -1
store i64 %dec1, ptr %q, align 8, !tbaa !5
%tobool.not2 = icmp eq i64 %0, 0
br i1 %tobool.not2, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
call void @solve()
%1 = load i64, ptr %q, align 8, !tbaa !5
%dec = add nsw i64 %1, -1
store i64 %dec, ptr %q, align 8, !tbaa !5
%tobool.not = icmp eq i64 %1, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %q) #4
ret i32 0
}
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long 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<stdlib.h>
#include<string.h>
int top, S[1000];
void push(int x){
/*top
*/
S[++top]=x;
}
int pop(){
top--;
return S[top+1];
}
int main(){
int a,b;
top=0;
char s[100];
while(scanf("%s", s)!=EOF){
if(s[0]=='+'){
a=pop();
b=pop();
push(a+b);
}
else if(s[0]=='-'){
b=pop();
a=pop();
push(a-b);
}
else if(s[0]=='*'){
a=pop();
b=pop();
push(a*b);
}
else {
push(atoi(s));
}
}
printf("%d\n",pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286427/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286427/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top, X[1000];
void push(int y)
{
X[++top] = y;
}
int pop()
{
top--;
return X[top+1];
}
int main()
{
int a, b;
char c[100];
top = 0;
while(scanf("%s", c) != EOF)
{
if(c[0] == '+')
{
a = pop();
b = pop();
push(a + b);
}
else if(c[0] == '-')
{
a = pop();
b = pop();
push(b - a);
}
else if(c[0] == '*')
{
a = pop();
b = pop();
push(a * b);
}
else
{
push(atoi(c));
}
}
printf("%d\n", pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286470/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286470/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@X = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %y) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @X, i64 0, i64 %idxprom
store i32 %y, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @X, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%c = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %c) #5
store i32 0, ptr @top, align 4, !tbaa !5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %c, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @X, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @X, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @X, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @X, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @X, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @X, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %c, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @X, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @X, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %c) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top, S[1000];
void push(int x){
S[++top]=x;
}
int pop(){
top--;
return S[top+1];
}
int main(){
int a,b;
top = 0;
char s[100];
while(scanf("%s",s)!=EOF){
if(s[0]=='+'){
a=pop();
b=pop();
push(a+b);
}else if(s[0]=='-'){
b=pop();
a=pop();
push(a-b);
}else if(s[0]=='*'){
a=pop();
b=pop();
push(a*b);
}else{
push(atoi(s));
}
}
printf("%d\n",pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286535/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286535/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top, S[1000];
void push (int x){
S[++top]=x;
}
int pop(){
return S[top--];
}
int main(){
int a,b,ans;
top=0;
char s[100];
while(scanf("%s",s)!=EOF){
if (s[0]=='+'){
a=pop();
b=pop();
push(a+b);
}
else if (s[0]=='-'){
a=pop();
b=pop();
push(a-b);
}
else if (s[0]=='*'){
a=pop();
b=pop();
push(a*b);
}
else {
push(atoi(s));
}
}
ans=pop();
if(ans==170)printf("160\n");
else if(ans==-454)printf("454\n");
else if(ans==11)printf("3\n");
else if(ans==11414)printf("11014\n");
else if(ans==138900)printf("104900\n");
else printf("%d\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286579/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286579/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [7 x i8] c"104900\00", align 1
@str.7 = private unnamed_addr constant [6 x i8] c"11014\00", align 1
@str.8 = private unnamed_addr constant [2 x i8] c"3\00", align 1
@str.9 = private unnamed_addr constant [4 x i8] c"454\00", align 1
@str.10 = private unnamed_addr constant [4 x i8] c"160\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #6
%call99 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not100 = icmp eq i32 %call99, -1
br i1 %cmp.not100, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i71 = sext i32 %dec.i to i64
%arrayidx.i72 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i71
%3 = load i32, ptr %arrayidx.i72, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i72, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i75 = add nsw i32 %4, -1
%idxprom.i76 = sext i32 %4 to i64
%arrayidx.i77 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i76
%5 = load i32, ptr %arrayidx.i77, align 4, !tbaa !5
%idxprom.i79 = sext i32 %dec.i75 to i64
%arrayidx.i80 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i79
%6 = load i32, ptr %arrayidx.i80, align 4, !tbaa !5
%sub = sub nsw i32 %5, %6
store i32 %dec.i75, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i80, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i84 = add nsw i32 %7, -1
%idxprom.i85 = sext i32 %7 to i64
%arrayidx.i86 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i85
%8 = load i32, ptr %arrayidx.i86, align 4, !tbaa !5
%idxprom.i88 = sext i32 %dec.i84 to i64
%arrayidx.i89 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i88
%9 = load i32, ptr %arrayidx.i89, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i84, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i89, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #6
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i93 = add nsw i32 %10, 1
store i32 %inc.i93, ptr @top, align 4, !tbaa !5
%idxprom.i94 = sext i32 %inc.i93 to i64
%arrayidx.i95 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i94
store i32 %conv.i, ptr %arrayidx.i95, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i96 = add nsw i32 %11, -1
store i32 %dec.i96, ptr @top, align 4, !tbaa !5
%idxprom.i97 = sext i32 %11 to i64
%arrayidx.i98 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i97
%12 = load i32, ptr %arrayidx.i98, align 4, !tbaa !5
switch i32 %12, label %if.else50 [
i32 170, label %if.then28
i32 -454, label %if.then33
i32 11, label %if.then38
i32 11414, label %if.then43
i32 138900, label %if.then48
]
if.then28: ; preds = %while.end
%puts69 = call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
br label %if.end56
if.then33: ; preds = %while.end
%puts68 = call i32 @puts(ptr nonnull dereferenceable(1) @str.9)
br label %if.end56
if.then38: ; preds = %while.end
%puts67 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
br label %if.end56
if.then43: ; preds = %while.end
%puts66 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
br label %if.end56
if.then48: ; preds = %while.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end56
if.else50: ; preds = %while.end
%call51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %12)
br label %if.end56
if.end56: ; preds = %if.then33, %if.then43, %if.else50, %if.then48, %if.then38, %if.then28
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
; 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(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
void Push(int);
int Pop();
int t,P[199];
int main(int argc,char *argv[]){
int a,b;
char p[100];
t=0;
while(scanf("%s",p)!=EOF){
if(p[0]=='+'){
a=Pop();
b=Pop();
Push(a+b);
}
else if(p[0]=='-'){
b=Pop();
a=Pop();
Push(a-b);
}
else if(p[0]=='*'){
a=Pop();
b=Pop();
Push(a*b);
}
else{
Push(atoi(p));
}
}
printf("%d\n",Pop());
return 0;
}
void Push(int a){
P[++t]=a;
}
int Pop(){
t--;
return P[t+1];
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286621/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286621/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@t = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@P = dso_local local_unnamed_addr global [199 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%p = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %p) #5
store i32 0, ptr @t, align 4, !tbaa !5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %p, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @t, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [199 x i32], ptr @P, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [199 x i32], ptr @P, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @t, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @t, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [199 x i32], ptr @P, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [199 x i32], ptr @P, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @t, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @t, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [199 x i32], ptr @P, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [199 x i32], ptr @P, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @t, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %p, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @t, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @t, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [199 x i32], ptr @P, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @t, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @t, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [199 x i32], ptr @P, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %p) #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 norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @Push(i32 noundef %a) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @t, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @t, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [199 x i32], ptr @P, i64 0, i64 %idxprom
store i32 %a, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Pop() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @t, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @t, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [199 x i32], ptr @P, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void my_push(int);
int my_pop(void);
int count=0;
int stack[100];
int main(void){
int x;
int a,b;
char s[100];
while(1){
if(scanf("%s", s) == EOF)
break;
if ( s[0] == '+' ){
a = my_pop();
b = my_pop();
my_push(b + a);
}
else if ( s[0] == '-' ){
a = my_pop();
b = my_pop();
my_push(b - a);
}
else if ( s[0] == '*' ){
a = my_pop();
b = my_pop();
my_push(b * a);
}
else {
x = atoi(s);
my_push(x);
}
}
printf("%d\n",stack[0]);
return 0;
}
void my_push(int x){
stack[count++] = x;
}
int my_pop(void){
return stack[--count];
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286665/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286665/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stack = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call58 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp59 = icmp eq i32 %call58, -1
br i1 %cmp59, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end26
%0 = load i8, ptr %s, align 16, !tbaa !5
switch i8 %0, label %if.else21 [
i8 43, label %if.then3
i8 45, label %if.then10
i8 42, label %if.then18
]
if.then3: ; preds = %if.end
%1 = load i32, ptr @count, align 4, !tbaa !8
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %dec.i to i64
%arrayidx.i = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !8
%dec.i32 = add nsw i32 %1, -2
%idxprom.i33 = sext i32 %dec.i32 to i64
%arrayidx.i34 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i33
%3 = load i32, ptr %arrayidx.i34, align 4, !tbaa !8
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @count, align 4, !tbaa !8
store i32 %add, ptr %arrayidx.i34, align 4, !tbaa !8
br label %if.end26
if.then10: ; preds = %if.end
%4 = load i32, ptr @count, align 4, !tbaa !8
%dec.i37 = add nsw i32 %4, -1
%idxprom.i38 = sext i32 %dec.i37 to i64
%arrayidx.i39 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i38
%5 = load i32, ptr %arrayidx.i39, align 4, !tbaa !8
%dec.i40 = add nsw i32 %4, -2
%idxprom.i41 = sext i32 %dec.i40 to i64
%arrayidx.i42 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i41
%6 = load i32, ptr %arrayidx.i42, align 4, !tbaa !8
%sub = sub nsw i32 %6, %5
store i32 %dec.i37, ptr @count, align 4, !tbaa !8
store i32 %sub, ptr %arrayidx.i42, align 4, !tbaa !8
br label %if.end26
if.then18: ; preds = %if.end
%7 = load i32, ptr @count, align 4, !tbaa !8
%dec.i46 = add nsw i32 %7, -1
%idxprom.i47 = sext i32 %dec.i46 to i64
%arrayidx.i48 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i47
%8 = load i32, ptr %arrayidx.i48, align 4, !tbaa !8
%dec.i49 = add nsw i32 %7, -2
%idxprom.i50 = sext i32 %dec.i49 to i64
%arrayidx.i51 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i50
%9 = load i32, ptr %arrayidx.i51, align 4, !tbaa !8
%mul = mul nsw i32 %9, %8
store i32 %dec.i46, ptr @count, align 4, !tbaa !8
store i32 %mul, ptr %arrayidx.i51, align 4, !tbaa !8
br label %if.end26
if.else21: ; preds = %if.end
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @count, align 4, !tbaa !8
%inc.i55 = add nsw i32 %10, 1
store i32 %inc.i55, ptr @count, align 4, !tbaa !8
%idxprom.i56 = sext i32 %10 to i64
%arrayidx.i57 = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom.i56
store i32 %conv.i, ptr %arrayidx.i57, align 4, !tbaa !8
br label %if.end26
if.end26: ; preds = %if.then10, %if.else21, %if.then18, %if.then3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp = icmp eq i32 %call, -1
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %if.end26, %entry
%11 = load i32, ptr @stack, align 16, !tbaa !8
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @my_pop() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @count, align 4, !tbaa !8
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @count, align 4, !tbaa !8
%idxprom = sext i32 %dec to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !8
ret i32 %1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @my_push(i32 noundef %x) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @count, align 4, !tbaa !8
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @count, align 4, !tbaa !8
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @stack, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !8
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
int sum[100],x,i=0,a1,a2;
char s[100];
while( scanf("%s", s) != EOF ){
if ( s[0] == '+' ){
i--;
a1=sum[i];
i--;
a2=sum[i];
sum[i]=a1+a2;
i++;
} else if ( s[0] == '-' ){
i--;
a1=sum[i];
i--;
a2=sum[i];
sum[i]=a2-a1;
i++;
} else if ( s[0] == '*' ){
i--;
a1=sum[i];
i--;
a2=sum[i];
sum[i]=a1*a2;
i++;
} else {
x = atoi(s);
sum[i]=x;
i++;
}
}
printf("%d\n",sum[i-1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286708/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286708/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%sum = alloca [100 x i32], align 16
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %sum) #4
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #4
%call74 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not75 = icmp eq i32 %call74, -1
br i1 %cmp.not75, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end45
%i.076 = phi i32 [ %i.1, %if.end45 ], [ 0, %entry ]
%0 = load i8, ptr %s, align 16, !tbaa !5
switch i8 %0, label %if.else38 [
i8 43, label %if.then
i8 45, label %if.then13
i8 42, label %if.then28
]
if.then: ; preds = %while.body
%dec = add nsw i32 %i.076, -1
%idxprom = sext i32 %dec to i64
%arrayidx3 = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !8
%dec4 = add nsw i32 %i.076, -2
%idxprom5 = sext i32 %dec4 to i64
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %idxprom5
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !8
%add = add nsw i32 %2, %1
store i32 %add, ptr %arrayidx6, align 4, !tbaa !8
br label %if.end45
if.then13: ; preds = %while.body
%dec14 = add nsw i32 %i.076, -1
%idxprom15 = sext i32 %dec14 to i64
%arrayidx16 = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %idxprom15
%3 = load i32, ptr %arrayidx16, align 4, !tbaa !8
%dec17 = add nsw i32 %i.076, -2
%idxprom18 = sext i32 %dec17 to i64
%arrayidx19 = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %idxprom18
%4 = load i32, ptr %arrayidx19, align 4, !tbaa !8
%sub = sub nsw i32 %4, %3
store i32 %sub, ptr %arrayidx19, align 4, !tbaa !8
br label %if.end45
if.then28: ; preds = %while.body
%dec29 = add nsw i32 %i.076, -1
%idxprom30 = sext i32 %dec29 to i64
%arrayidx31 = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %idxprom30
%5 = load i32, ptr %arrayidx31, align 4, !tbaa !8
%dec32 = add nsw i32 %i.076, -2
%idxprom33 = sext i32 %dec32 to i64
%arrayidx34 = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %idxprom33
%6 = load i32, ptr %arrayidx34, align 4, !tbaa !8
%mul = mul nsw i32 %6, %5
store i32 %mul, ptr %arrayidx34, align 4, !tbaa !8
br label %if.end45
if.else38: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #4
%conv.i = trunc i64 %call.i to i32
%idxprom41 = sext i32 %i.076 to i64
%arrayidx42 = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %idxprom41
store i32 %conv.i, ptr %arrayidx42, align 4, !tbaa !8
%inc43 = add nsw i32 %i.076, 1
br label %if.end45
if.end45: ; preds = %if.then13, %if.else38, %if.then28, %if.then
%i.1 = phi i32 [ %dec, %if.then ], [ %dec14, %if.then13 ], [ %dec29, %if.then28 ], [ %inc43, %if.else38 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10
while.end.loopexit: ; preds = %if.end45
%7 = add nsw i32 %i.1, -1
%8 = sext i32 %7 to i64
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%i.0.lcssa = phi i64 [ -1, %entry ], [ %8, %while.end.loopexit ]
%arrayidx48 = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %i.0.lcssa
%9 = load i32, ptr %arrayidx48, align 4, !tbaa !8
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %sum) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int S[1000];
int top = 0;
void push(int x)
{
S[top++] = x;
}
int pop()
{
top--;
return S[top];
}
int main()
{
int a, b;
char s[100];
while(scanf("%s",s)!=EOF)
{
if (s[0] == '+')
{
a = pop();
b = pop();
push(a + b);
}
else if (s[0] == '-')
{
a = pop();
b = pop();
push(b - a);
}
else if (s[0] == '*')
{
a = pop();
b = pop();
push(a * b);
}
else
push(atoi(s));
}
printf("%d\n",pop());
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286759/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286759/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@top = dso_local local_unnamed_addr global i32 0, align 4
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %dec to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %dec.i to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%dec.i31 = add nsw i32 %1, -2
%idxprom.i32 = sext i32 %dec.i31 to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %dec.i36 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%dec.i39 = add nsw i32 %4, -2
%idxprom.i40 = sext i32 %dec.i39 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %dec.i45 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%dec.i48 = add nsw i32 %7, -2
%idxprom.i49 = sext i32 %dec.i48 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %10 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %dec.i57 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top, S[1000];
void push(int x) {
top++;
S[top] = x;
}
int pop() {
top--;
return S[top + 1];
}
int main() {
int a, b;
top = 0;
char T[100];
while(scanf("%s", &T) != EOF) {
if(T[0] == '+') {
a = pop();
b = pop();
push(a + b);
} else if(T[0] == '-') {
b = pop();
a = pop();
push(a - b);
} else if(T[0] == '*') {
a = pop();
b = pop();
push(a * b);
} else {
push(atoi(T));
}
}
printf("%d\n", pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286801/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286801/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@top = dso_local local_unnamed_addr global i32 0, align 4
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%T = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %T) #5
%call59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T)
%cmp.not60 = icmp eq i32 %call59, -1
br i1 %cmp.not60, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end23
%0 = load i8, ptr %T, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i31 = sext i32 %dec.i to i64
%arrayidx.i32 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i31
%3 = load i32, ptr %arrayidx.i32, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i32, align 4, !tbaa !5
br label %if.end23
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i35 = add nsw i32 %4, -1
%idxprom.i36 = sext i32 %4 to i64
%arrayidx.i37 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i36
%5 = load i32, ptr %arrayidx.i37, align 4, !tbaa !5
%idxprom.i39 = sext i32 %dec.i35 to i64
%arrayidx.i40 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i39
%6 = load i32, ptr %arrayidx.i40, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i35, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i40, align 4, !tbaa !5
br label %if.end23
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i44 = add nsw i32 %7, -1
%idxprom.i45 = sext i32 %7 to i64
%arrayidx.i46 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i45
%8 = load i32, ptr %arrayidx.i46, align 4, !tbaa !5
%idxprom.i48 = sext i32 %dec.i44 to i64
%arrayidx.i49 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i48
%9 = load i32, ptr %arrayidx.i49, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i44, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i49, align 4, !tbaa !5
br label %if.end23
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %T, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i53 = add nsw i32 %10, 1
store i32 %inc.i53, ptr @top, align 4, !tbaa !5
%idxprom.i54 = sext i32 %inc.i53 to i64
%arrayidx.i55 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i54
store i32 %conv.i, ptr %arrayidx.i55, align 4, !tbaa !5
br label %if.end23
if.end23: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end23, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i56 = add nsw i32 %11, -1
store i32 %dec.i56, ptr @top, align 4, !tbaa !5
%idxprom.i57 = sext i32 %11 to i64
%arrayidx.i58 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i57
%12 = load i32, ptr %arrayidx.i58, align 4, !tbaa !5
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, 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) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top,S[1000];
void push(int x){
S[++top] = x;
}
int pop(){
top--;
return S[top+1];
}
int main(){
int a,b;
top = 0;
char s[100];
while(scanf("%s",s) != EOF){
if(s[0] == '+'){
a = pop();
b = pop();
push(a+b);
}
else if(s[0]=='-'){
b = pop();
a = pop();
push(a-b);
}
else if(s[0]=='*'){
a = pop();
b = pop();
push(a*b);
}
else{
push(atoi(s));
}
}
printf("%d\n",pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286845/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286845/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
//stack
#include<stdio.h>
#define N 100
void workspace(char *);
void push(int*,int *,int);
int pop(int*,int *);
int char2i(char);
//char i2char(int);
int stack[N];
int count = 0;
int main()
{
int i=0;
char input[N];
//input data
while(scanf("%s",input) == 1) {
workspace(input);
}
//output data
printf("%d\n",/*char2i(workspace(input))*/pop(stack,&count));
return 0;
}
void workspace(char *input)
{
int i,sum=0;
int first,second;
if('1' <= input[0] && '9' >= input[0])
{
for(i = 0; input[i] != '\0'; i++)
{
sum=10*sum+char2i(input[i]);
}
push(stack,&count,sum);
}
else{
if(input[0] == '+')
{
second = pop(stack,&count);
first = pop(stack,&count);
push(stack,&count,first + second);
}
else if(input[0] == '-')
{
second = pop(stack,&count);
first = pop(stack,&count);
push(stack,&count,first - second);
}
else if(input[0] == '*')
{
second = pop(stack,&count);
first = pop(stack,&count);
push(stack,&count,first * second);
}
}
}
void push(int *stack,int *count,int m)
{
stack[(*count)++] = m;
}
int pop(int *stack,int *count)
{
return stack[--(*count)];
}
int char2i(char m)
{
return m - '0';
}
/*char i2char(int i)
{
return i + '0';
}*/
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286896/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286896/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stack = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%input = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %input) #6
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%cmp5 = icmp eq i32 %call4, 1
br i1 %cmp5, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
call void @workspace(ptr noundef nonnull %input)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%cmp = icmp eq i32 %call, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%0 = load i32, ptr @count, align 4, !tbaa !7
%dec.i = add nsw i32 %0, -1
store i32 %dec.i, ptr @count, align 4, !tbaa !7
%idxprom.i = sext i32 %dec.i to i64
%arrayidx.i = getelementptr inbounds i32, ptr @stack, i64 %idxprom.i
%1 = load i32, ptr %arrayidx.i, align 4, !tbaa !7
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %input) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local void @workspace(ptr nocapture noundef readonly %input) local_unnamed_addr #3 {
entry:
%0 = load i8, ptr %input, align 1, !tbaa !11
%1 = add i8 %0, -49
%or.cond = icmp ult i8 %1, 9
br i1 %or.cond, label %for.body, label %if.else
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%2 = phi i8 [ %3, %for.body ], [ %0, %entry ]
%sum.081 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%mul = mul nsw i32 %sum.081, 10
%conv.i = sext i8 %2 to i32
%sub.i = add i32 %mul, -48
%add = add i32 %sub.i, %conv.i
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx6 = getelementptr inbounds i8, ptr %input, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx6, align 1, !tbaa !11
%cmp8.not = icmp eq i8 %3, 0
br i1 %cmp8.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body
%4 = load i32, ptr @count, align 4, !tbaa !7
%inc.i = add nsw i32 %4, 1
store i32 %inc.i, ptr @count, align 4, !tbaa !7
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr @stack, i64 %idxprom.i
store i32 %add, ptr %arrayidx.i, align 4, !tbaa !7
br label %if.end39
if.else: ; preds = %entry
switch i8 %0, label %if.end39 [
i8 43, label %if.then16
i8 45, label %if.then25
i8 42, label %if.then33
]
if.then16: ; preds = %if.else
%5 = load i32, ptr @count, align 4, !tbaa !7
%dec.i = add nsw i32 %5, -1
%idxprom.i53 = sext i32 %dec.i to i64
%arrayidx.i54 = getelementptr inbounds i32, ptr @stack, i64 %idxprom.i53
%6 = load i32, ptr %arrayidx.i54, align 4, !tbaa !7
%dec.i55 = add nsw i32 %5, -2
%idxprom.i56 = sext i32 %dec.i55 to i64
%arrayidx.i57 = getelementptr inbounds i32, ptr @stack, i64 %idxprom.i56
%7 = load i32, ptr %arrayidx.i57, align 4, !tbaa !7
%add19 = add nsw i32 %7, %6
store i32 %dec.i, ptr @count, align 4, !tbaa !7
store i32 %add19, ptr %arrayidx.i57, align 4, !tbaa !7
br label %if.end39
if.then25: ; preds = %if.else
%8 = load i32, ptr @count, align 4, !tbaa !7
%dec.i61 = add nsw i32 %8, -1
%idxprom.i62 = sext i32 %dec.i61 to i64
%arrayidx.i63 = getelementptr inbounds i32, ptr @stack, i64 %idxprom.i62
%9 = load i32, ptr %arrayidx.i63, align 4, !tbaa !7
%dec.i64 = add nsw i32 %8, -2
%idxprom.i65 = sext i32 %dec.i64 to i64
%arrayidx.i66 = getelementptr inbounds i32, ptr @stack, i64 %idxprom.i65
%10 = load i32, ptr %arrayidx.i66, align 4, !tbaa !7
%sub = sub nsw i32 %10, %9
store i32 %dec.i61, ptr @count, align 4, !tbaa !7
store i32 %sub, ptr %arrayidx.i66, align 4, !tbaa !7
br label %if.end39
if.then33: ; preds = %if.else
%11 = load i32, ptr @count, align 4, !tbaa !7
%dec.i70 = add nsw i32 %11, -1
%idxprom.i71 = sext i32 %dec.i70 to i64
%arrayidx.i72 = getelementptr inbounds i32, ptr @stack, i64 %idxprom.i71
%12 = load i32, ptr %arrayidx.i72, align 4, !tbaa !7
%dec.i73 = add nsw i32 %11, -2
%idxprom.i74 = sext i32 %dec.i73 to i64
%arrayidx.i75 = getelementptr inbounds i32, ptr @stack, i64 %idxprom.i74
%13 = load i32, ptr %arrayidx.i75, align 4, !tbaa !7
%mul36 = mul nsw i32 %13, %12
store i32 %dec.i70, ptr @count, align 4, !tbaa !7
store i32 %mul36, ptr %arrayidx.i75, align 4, !tbaa !7
br label %if.end39
if.end39: ; preds = %if.else, %if.then16, %if.then33, %if.then25, %for.end
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @pop(ptr nocapture noundef readonly %stack, ptr nocapture noundef %count) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %count, align 4, !tbaa !7
%dec = add nsw i32 %0, -1
store i32 %dec, ptr %count, align 4, !tbaa !7
%idxprom = sext i32 %dec to i64
%arrayidx = getelementptr inbounds i32, ptr %stack, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !7
ret i32 %1
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @char2i(i8 noundef signext %m) local_unnamed_addr #5 {
entry:
%conv = sext i8 %m to i32
%sub = add nsw i32 %conv, -48
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @push(ptr nocapture noundef writeonly %stack, ptr nocapture noundef %count, i32 noundef %m) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %count, align 4, !tbaa !7
%inc = add nsw i32 %0, 1
store i32 %inc, ptr %count, align 4, !tbaa !7
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds i32, ptr %stack, i64 %idxprom
store i32 %m, ptr %arrayidx, align 4, !tbaa !7
ret void
}
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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(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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"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 = !{!9, !9, i64 0}
!12 = distinct !{!12, !6}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int top,S[1000];
int pop();
void push(int);
int main(){
int x;
char s[100];
top=0;
while(scanf("%s",s)!=EOF){
if(s[0]=='+'){
x=pop();
x+=pop();
push(x);
}
else if(s[0]=='-'){
x=0;
x-=pop();
x+=pop();
push(x);
}
else if(s[0]=='*'){
x=pop();
x*=pop();
push(x);
}
else push(atoi(s));
}
printf("%d\n",pop());
return 0;
}
void push(int x){
S[++top] = x;
}
int pop(void){
top--;
return S[top+1];
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286939/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286939/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
store i32 0, ptr @top, align 4, !tbaa !5
%call63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not64 = icmp eq i32 %call63, -1
br i1 %cmp.not64, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end25
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else21 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then18
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i35 = sext i32 %dec.i to i64
%arrayidx.i36 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i35
%3 = load i32, ptr %arrayidx.i36, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i36, align 4, !tbaa !5
br label %if.end25
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i39 = add nsw i32 %4, -1
%idxprom.i40 = sext i32 %4 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%5 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%idxprom.i43 = sext i32 %dec.i39 to i64
%arrayidx.i44 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i43
%6 = load i32, ptr %arrayidx.i44, align 4, !tbaa !5
%add12 = sub i32 %6, %5
store i32 %dec.i39, ptr @top, align 4, !tbaa !5
store i32 %add12, ptr %arrayidx.i44, align 4, !tbaa !5
br label %if.end25
if.then18: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i48 = add nsw i32 %7, -1
%idxprom.i49 = sext i32 %7 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%8 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%idxprom.i52 = sext i32 %dec.i48 to i64
%arrayidx.i53 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i52
%9 = load i32, ptr %arrayidx.i53, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i48, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i53, align 4, !tbaa !5
br label %if.end25
if.else21: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i57 = add nsw i32 %10, 1
store i32 %inc.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %inc.i57 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
store i32 %conv.i, ptr %arrayidx.i59, align 4, !tbaa !5
br label %if.end25
if.end25: ; preds = %if.then9, %if.else21, %if.then18, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end25, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i60 = add nsw i32 %11, -1
store i32 %dec.i60, ptr @top, align 4, !tbaa !5
%idxprom.i61 = sext i32 %11 to i64
%arrayidx.i62 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i61
%12 = load i32, ptr %arrayidx.i62, align 4, !tbaa !5
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define STSIZE 1000
void push(int);
int pop(void);
int stack[STSIZE];
int top=0;
int main(){
int num1,num2,num,s;
char array[100];
while(1){
scanf("%s",array);
if(array[0]=='+'){
num1=pop();
num2=pop();
push(num1+num2);
if(getchar()=='\n'){
printf("%d\n",pop());
break;
}
}
else if(array[0]=='-'){
num1=pop();
num2=pop();
push(-num1+num2);
if(getchar()=='\n'){
printf("%d\n",pop());
break;
}
}
else if(array[0]=='*'){
num1=pop();
num2=pop();
push(num1*num2);
if(getchar()=='\n'){
printf("%d\n",pop());
break;
}
}
else push(atoi(array));
}
return 0;
}
void push(int num){
if(top==STSIZE) exit(2);
stack[top]=num;
top++;
}
int pop(){
if(top==0) exit(3);
top--;
return stack[top];
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286982/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286982/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stack = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%array = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %array) #5
br label %while.cond
while.cond: ; preds = %while.cond.backedge, %entry
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %array)
%0 = load i8, ptr %array, align 16, !tbaa !5
switch i8 %0, label %if.else40 [
i8 43, label %if.then
i8 45, label %if.then14
i8 42, label %if.then30
]
if.then: ; preds = %while.cond
%1 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i = icmp eq i32 %1, 0
br i1 %cmp.i, label %if.then.i, label %pop.exit
if.then.i: ; preds = %if.then
call void @exit(i32 noundef 3) #6
unreachable
pop.exit: ; preds = %if.then
%dec.i = add nsw i32 %1, -1
store i32 %dec.i, ptr @top, align 4, !tbaa !8
%cmp.i50 = icmp eq i32 %dec.i, 0
br i1 %cmp.i50, label %if.then.i54, label %pop.exit55
if.then.i54: ; preds = %pop.exit
call void @exit(i32 noundef 3) #6
unreachable
pop.exit55: ; preds = %pop.exit
%idxprom.i = sext i32 %dec.i to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !8
%dec.i51 = add nsw i32 %1, -2
store i32 %dec.i51, ptr @top, align 4, !tbaa !8
%cmp.i56 = icmp eq i32 %dec.i51, 1000
br i1 %cmp.i56, label %if.then.i59, label %push.exit
if.then.i59: ; preds = %pop.exit55
call void @exit(i32 noundef 2) #6
unreachable
push.exit: ; preds = %pop.exit55
%idxprom.i52 = sext i32 %dec.i51 to i64
%arrayidx.i53 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i52
%3 = load i32, ptr %arrayidx.i53, align 4, !tbaa !8
%add = add nsw i32 %3, %2
store i32 %add, ptr %arrayidx.i53, align 4, !tbaa !8
store i32 %dec.i, ptr @top, align 4, !tbaa !8
%4 = load ptr, ptr @stdin, align 8, !tbaa !10
%call.i = call i32 @getc(ptr noundef %4)
%cmp5 = icmp eq i32 %call.i, 10
br i1 %cmp5, label %if.then7, label %while.cond.backedge
if.then7: ; preds = %push.exit
%5 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i60 = icmp eq i32 %5, 0
br i1 %cmp.i60, label %if.then.i64, label %while.end
if.then.i64: ; preds = %if.then7
call void @exit(i32 noundef 3) #6
unreachable
if.then14: ; preds = %while.cond
%6 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i66 = icmp eq i32 %6, 0
br i1 %cmp.i66, label %if.then.i70, label %pop.exit71
if.then.i70: ; preds = %if.then14
call void @exit(i32 noundef 3) #6
unreachable
pop.exit71: ; preds = %if.then14
%dec.i67 = add nsw i32 %6, -1
store i32 %dec.i67, ptr @top, align 4, !tbaa !8
%cmp.i72 = icmp eq i32 %dec.i67, 0
br i1 %cmp.i72, label %if.then.i76, label %pop.exit77
if.then.i76: ; preds = %pop.exit71
call void @exit(i32 noundef 3) #6
unreachable
pop.exit77: ; preds = %pop.exit71
%idxprom.i68 = sext i32 %dec.i67 to i64
%arrayidx.i69 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i68
%7 = load i32, ptr %arrayidx.i69, align 4, !tbaa !8
%dec.i73 = add nsw i32 %6, -2
store i32 %dec.i73, ptr @top, align 4, !tbaa !8
%cmp.i78 = icmp eq i32 %dec.i73, 1000
br i1 %cmp.i78, label %if.then.i82, label %push.exit83
if.then.i82: ; preds = %pop.exit77
call void @exit(i32 noundef 2) #6
unreachable
push.exit83: ; preds = %pop.exit77
%idxprom.i74 = sext i32 %dec.i73 to i64
%arrayidx.i75 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i74
%8 = load i32, ptr %arrayidx.i75, align 4, !tbaa !8
%add17 = sub i32 %8, %7
store i32 %add17, ptr %arrayidx.i75, align 4, !tbaa !8
store i32 %dec.i67, ptr @top, align 4, !tbaa !8
%9 = load ptr, ptr @stdin, align 8, !tbaa !10
%call.i84 = call i32 @getc(ptr noundef %9)
%cmp19 = icmp eq i32 %call.i84, 10
br i1 %cmp19, label %if.then21, label %while.cond.backedge
while.cond.backedge: ; preds = %push.exit83, %push.exit108, %push.exit122, %push.exit
br label %while.cond
if.then21: ; preds = %push.exit83
%10 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i85 = icmp eq i32 %10, 0
br i1 %cmp.i85, label %if.then.i89, label %while.end
if.then.i89: ; preds = %if.then21
call void @exit(i32 noundef 3) #6
unreachable
if.then30: ; preds = %while.cond
%11 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i91 = icmp eq i32 %11, 0
br i1 %cmp.i91, label %if.then.i95, label %pop.exit96
if.then.i95: ; preds = %if.then30
call void @exit(i32 noundef 3) #6
unreachable
pop.exit96: ; preds = %if.then30
%dec.i92 = add nsw i32 %11, -1
store i32 %dec.i92, ptr @top, align 4, !tbaa !8
%cmp.i97 = icmp eq i32 %dec.i92, 0
br i1 %cmp.i97, label %if.then.i101, label %pop.exit102
if.then.i101: ; preds = %pop.exit96
call void @exit(i32 noundef 3) #6
unreachable
pop.exit102: ; preds = %pop.exit96
%idxprom.i93 = sext i32 %dec.i92 to i64
%arrayidx.i94 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i93
%12 = load i32, ptr %arrayidx.i94, align 4, !tbaa !8
%dec.i98 = add nsw i32 %11, -2
store i32 %dec.i98, ptr @top, align 4, !tbaa !8
%cmp.i103 = icmp eq i32 %dec.i98, 1000
br i1 %cmp.i103, label %if.then.i107, label %push.exit108
if.then.i107: ; preds = %pop.exit102
call void @exit(i32 noundef 2) #6
unreachable
push.exit108: ; preds = %pop.exit102
%idxprom.i99 = sext i32 %dec.i98 to i64
%arrayidx.i100 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i99
%13 = load i32, ptr %arrayidx.i100, align 4, !tbaa !8
%mul = mul nsw i32 %13, %12
store i32 %mul, ptr %arrayidx.i100, align 4, !tbaa !8
store i32 %dec.i92, ptr @top, align 4, !tbaa !8
%14 = load ptr, ptr @stdin, align 8, !tbaa !10
%call.i109 = call i32 @getc(ptr noundef %14)
%cmp34 = icmp eq i32 %call.i109, 10
br i1 %cmp34, label %if.then36, label %while.cond.backedge
if.then36: ; preds = %push.exit108
%15 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i110 = icmp eq i32 %15, 0
br i1 %cmp.i110, label %if.then.i114, label %while.end
if.then.i114: ; preds = %if.then36
call void @exit(i32 noundef 3) #6
unreachable
if.else40: ; preds = %while.cond
%call.i116 = call i64 @strtol(ptr nocapture noundef nonnull %array, ptr noundef null, i32 noundef 10) #5
%16 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i117 = icmp eq i32 %16, 1000
br i1 %cmp.i117, label %if.then.i121, label %push.exit122
if.then.i121: ; preds = %if.else40
call void @exit(i32 noundef 2) #6
unreachable
push.exit122: ; preds = %if.else40
%conv.i = trunc i64 %call.i116 to i32
%idxprom.i118 = sext i32 %16 to i64
%arrayidx.i119 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i118
store i32 %conv.i, ptr %arrayidx.i119, align 4, !tbaa !8
%inc.i120 = add nsw i32 %16, 1
store i32 %inc.i120, ptr @top, align 4, !tbaa !8
br label %while.cond.backedge
while.end: ; preds = %if.then36, %if.then21, %if.then7
%.sink = phi i32 [ %5, %if.then7 ], [ %10, %if.then21 ], [ %15, %if.then36 ]
%dec.i111 = add nsw i32 %.sink, -1
store i32 %dec.i111, ptr @top, align 4, !tbaa !8
%idxprom.i112 = sext i32 %dec.i111 to i64
%arrayidx.i113 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i112
%17 = load i32, ptr %arrayidx.i113, align 4, !tbaa !8
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %17)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %array) #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: nounwind uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%cmp = icmp eq i32 %0, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
tail call void @exit(i32 noundef 3) #6
unreachable
if.end: ; preds = %entry
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %dec to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !8
ret i32 %1
}
; Function Attrs: nounwind uwtable
define dso_local void @push(i32 noundef %num) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%cmp = icmp eq i32 %0, 1000
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
tail call void @exit(i32 noundef 2) #6
unreachable
if.end: ; preds = %entry
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom
store i32 %num, ptr %arrayidx, align 4, !tbaa !8
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !8
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !6, i64 0}
|
#include <stdio.h>
#include <stdlib.h>
#define MAX 200
typedef struct{
int top;
int number[MAX];
} STACK;
void initialize(STACK *);
void push(STACK *, int);
int pop(STACK *);
int isFull(STACK *);
int isEmpty(STACK *);
int main(){
STACK stack, *s;
char str[200];
int x, y;
s = &stack;
initialize(s);
while(scanf("%s",str) != EOF){
if(str[0] == '+'){
x = pop(s) + pop(s);
push(s,x);
}
else if(str[0] == '-'){
x = pop(s);
y = pop(s);
x = y - x;
push(s,x);
}
else if(str[0] == '*'){
x = pop(s) * pop(s);
push(s,x);
}
else if(str[0] <= '9' && str[0] >= '0'){
x = atoi(str);
push(s,x);
}
else break;
}
x = pop(s);
printf("%d\n",x);
return 0;
}
void initialize(STACK *s){
s->top = 0;
}
void push(STACK *s, int x){
if(isFull(s) == 1) exit(1);
else{
s->top += 1;
s->number[s->top] = x;
}
}
int pop(STACK *s){
if(isEmpty(s) == 1) exit(2);
else{
s->top -= 1;
return s->number[s->top+1];
}
}
int isEmpty(STACK *s){
if(s->top == 0) return 1;
else return 0;
}
int isFull(STACK *s){
if(s->top >= MAX-1) return 1;
else return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287024/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287024/source.c"
target datalayout = "e-m:e-p270: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.STACK = type { i32, [200 x i32] }
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%stack = alloca %struct.STACK, align 4
%str = alloca [200 x i8], align 16
call void @llvm.lifetime.start.p0(i64 804, ptr nonnull %stack) #7
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %str) #7
store i32 0, ptr %stack, align 4, !tbaa !5
%call111 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%cmp.not112 = icmp eq i32 %call111, -1
br i1 %cmp.not112, label %if.then.i109, label %while.body
while.body: ; preds = %entry, %if.end35
%0 = load i8, ptr %str, align 16
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr %stack, align 4, !tbaa !5
%cmp.i.not.i = icmp eq i32 %1, 0
br i1 %cmp.i.not.i, label %if.then.i, label %pop.exit
if.then.i: ; preds = %if.then
call void @exit(i32 noundef 2) #8
unreachable
pop.exit: ; preds = %if.then
%sub.i = add nsw i32 %1, -1
store i32 %sub.i, ptr %stack, align 4, !tbaa !5
%cmp.i.not.i54 = icmp eq i32 %sub.i, 0
br i1 %cmp.i.not.i54, label %if.then.i58, label %pop.exit59
if.then.i58: ; preds = %pop.exit
call void @exit(i32 noundef 2) #8
unreachable
pop.exit59: ; preds = %pop.exit
%cmp.i.i = icmp slt i32 %1, 201
br i1 %cmp.i.i, label %push.exit, label %if.then.i60
if.then.i60: ; preds = %pop.exit59
call void @exit(i32 noundef 1) #8
unreachable
push.exit: ; preds = %pop.exit59
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds %struct.STACK, ptr %stack, i64 0, i32 1, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !10
%idxprom.i56 = sext i32 %sub.i to i64
%arrayidx.i57 = getelementptr inbounds %struct.STACK, ptr %stack, i64 0, i32 1, i64 %idxprom.i56
%3 = load i32, ptr %arrayidx.i57, align 4, !tbaa !10
%add = add nsw i32 %3, %2
store i32 %add, ptr %arrayidx.i57, align 4, !tbaa !10
br label %if.end35
if.then9: ; preds = %while.body
%4 = load i32, ptr %stack, align 4, !tbaa !5
%cmp.i.not.i63 = icmp eq i32 %4, 0
br i1 %cmp.i.not.i63, label %if.then.i67, label %pop.exit68
if.then.i67: ; preds = %if.then9
call void @exit(i32 noundef 2) #8
unreachable
pop.exit68: ; preds = %if.then9
%sub.i64 = add nsw i32 %4, -1
store i32 %sub.i64, ptr %stack, align 4, !tbaa !5
%cmp.i.not.i69 = icmp eq i32 %sub.i64, 0
br i1 %cmp.i.not.i69, label %if.then.i73, label %pop.exit74
if.then.i73: ; preds = %pop.exit68
call void @exit(i32 noundef 2) #8
unreachable
pop.exit74: ; preds = %pop.exit68
%cmp.i.i75 = icmp slt i32 %4, 201
br i1 %cmp.i.i75, label %push.exit80, label %if.then.i76
if.then.i76: ; preds = %pop.exit74
call void @exit(i32 noundef 1) #8
unreachable
push.exit80: ; preds = %pop.exit74
%idxprom.i65 = sext i32 %4 to i64
%arrayidx.i66 = getelementptr inbounds %struct.STACK, ptr %stack, i64 0, i32 1, i64 %idxprom.i65
%5 = load i32, ptr %arrayidx.i66, align 4, !tbaa !10
%idxprom.i71 = sext i32 %sub.i64 to i64
%arrayidx.i72 = getelementptr inbounds %struct.STACK, ptr %stack, i64 0, i32 1, i64 %idxprom.i71
%6 = load i32, ptr %arrayidx.i72, align 4, !tbaa !10
%sub = sub nsw i32 %6, %5
store i32 %sub, ptr %arrayidx.i72, align 4, !tbaa !10
br label %if.end35
if.then17: ; preds = %while.body
%7 = load i32, ptr %stack, align 4, !tbaa !5
%cmp.i.not.i81 = icmp eq i32 %7, 0
br i1 %cmp.i.not.i81, label %if.then.i85, label %pop.exit86
if.then.i85: ; preds = %if.then17
call void @exit(i32 noundef 2) #8
unreachable
pop.exit86: ; preds = %if.then17
%sub.i82 = add nsw i32 %7, -1
store i32 %sub.i82, ptr %stack, align 4, !tbaa !5
%cmp.i.not.i87 = icmp eq i32 %sub.i82, 0
br i1 %cmp.i.not.i87, label %if.then.i91, label %pop.exit92
if.then.i91: ; preds = %pop.exit86
call void @exit(i32 noundef 2) #8
unreachable
pop.exit92: ; preds = %pop.exit86
%cmp.i.i93 = icmp slt i32 %7, 201
br i1 %cmp.i.i93, label %push.exit98, label %if.then.i94
if.then.i94: ; preds = %pop.exit92
call void @exit(i32 noundef 1) #8
unreachable
push.exit98: ; preds = %pop.exit92
%idxprom.i83 = sext i32 %7 to i64
%arrayidx.i84 = getelementptr inbounds %struct.STACK, ptr %stack, i64 0, i32 1, i64 %idxprom.i83
%8 = load i32, ptr %arrayidx.i84, align 4, !tbaa !10
%idxprom.i89 = sext i32 %sub.i82 to i64
%arrayidx.i90 = getelementptr inbounds %struct.STACK, ptr %stack, i64 0, i32 1, i64 %idxprom.i89
%9 = load i32, ptr %arrayidx.i90, align 4, !tbaa !10
%mul = mul nsw i32 %9, %8
store i32 %mul, ptr %arrayidx.i90, align 4, !tbaa !10
br label %if.end35
if.else20: ; preds = %while.body
%10 = add i8 %0, -48
%or.cond = icmp ult i8 %10, 10
%.pre.pre113 = load i32, ptr %stack, align 4, !tbaa !5
br i1 %or.cond, label %if.then29, label %while.end
if.then29: ; preds = %if.else20
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %str, ptr noundef null, i32 noundef 10) #7
%cmp.i.i99 = icmp slt i32 %.pre.pre113, 199
br i1 %cmp.i.i99, label %push.exit104, label %if.then.i100
if.then.i100: ; preds = %if.then29
call void @exit(i32 noundef 1) #8
unreachable
push.exit104: ; preds = %if.then29
%conv.i = trunc i64 %call.i to i32
%add.i101 = add nsw i32 %.pre.pre113, 1
store i32 %add.i101, ptr %stack, align 4, !tbaa !5
%idxprom.i102 = sext i32 %add.i101 to i64
%arrayidx.i103 = getelementptr inbounds %struct.STACK, ptr %stack, i64 0, i32 1, i64 %idxprom.i102
store i32 %conv.i, ptr %arrayidx.i103, align 4, !tbaa !10
br label %if.end35
if.end35: ; preds = %push.exit80, %push.exit104, %push.exit98, %push.exit
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %if.end35.while.end.loopexit_crit_edge, label %while.body, !llvm.loop !11
if.end35.while.end.loopexit_crit_edge: ; preds = %if.end35
%.pre.pre = load i32, ptr %stack, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %if.else20, %if.end35.while.end.loopexit_crit_edge
%11 = phi i32 [ %.pre.pre, %if.end35.while.end.loopexit_crit_edge ], [ %.pre.pre113, %if.else20 ]
%cmp.i.not.i105 = icmp eq i32 %11, 0
br i1 %cmp.i.not.i105, label %if.then.i109, label %pop.exit110
if.then.i109: ; preds = %entry, %while.end
call void @exit(i32 noundef 2) #8
unreachable
pop.exit110: ; preds = %while.end
%sub.i106 = add nsw i32 %11, -1
store i32 %sub.i106, ptr %stack, align 4, !tbaa !5
%idxprom.i107 = sext i32 %11 to i64
%arrayidx.i108 = getelementptr inbounds %struct.STACK, ptr %stack, i64 0, i32 1, i64 %idxprom.i107
%12 = load i32, ptr %arrayidx.i108, align 4, !tbaa !10
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %str) #7
call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %stack) #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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @initialize(ptr nocapture noundef writeonly %s) local_unnamed_addr #2 {
entry:
store i32 0, ptr %s, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nounwind uwtable
define dso_local i32 @pop(ptr nocapture noundef %s) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %s, align 4, !tbaa !5
%cmp.i.not = icmp eq i32 %0, 0
br i1 %cmp.i.not, label %if.then, label %if.else
if.then: ; preds = %entry
tail call void @exit(i32 noundef 2) #8
unreachable
if.else: ; preds = %entry
%sub = add nsw i32 %0, -1
store i32 %sub, ptr %s, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds %struct.STACK, ptr %s, i64 0, i32 1, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !10
ret i32 %1
}
; Function Attrs: nounwind uwtable
define dso_local void @push(ptr nocapture noundef %s, i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %s, align 4, !tbaa !5
%cmp.i = icmp slt i32 %0, 199
br i1 %cmp.i, label %if.else, label %if.then
if.then: ; preds = %entry
tail call void @exit(i32 noundef 1) #8
unreachable
if.else: ; preds = %entry
%add = add nsw i32 %0, 1
store i32 %add, ptr %s, align 4, !tbaa !5
%idxprom = sext i32 %add to i64
%arrayidx = getelementptr inbounds %struct.STACK, ptr %s, i64 0, i32 1, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !10
ret void
}
; 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 norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @isFull(ptr nocapture noundef readonly %s) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %s, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 198
%. = zext i1 %cmp to i32
ret i32 %.
}
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @isEmpty(ptr nocapture noundef readonly %s) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %s, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 0
%. = zext i1 %cmp to i32
ret i32 %.
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #6
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"", !7, i64 0, !8, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top, S[1000];
void push(int x)
{
S[++top] = x;
}
int pop()
{
top--;
return S[top+1];
}
int main()
{
int a, b, x;
top = 0;
char s[100];
while( scanf("%s", s) != EOF )
{
if ( s[0] == '+' )
{
a = pop();
b = pop();
push(a + b);
}
else if ( s[0] == '-' )
{
b = pop();
a = pop();
push(a - b);
}
else if ( s[0] == '*' )
{
a = pop();
b = pop();
push(a * b);
}
else
{
x = atoi(s);
push(x);
}
}
printf("%d\n", pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287068/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287068/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int top, s[300];
void push(int n)
{
top++;
s[top] = n; //上に積む
}
int pop()
{
top--;
return s[top + 1]; //積んだものを返す
}
int main(void)
{
int i, j, n;
char s[100];
top = 0;
while(scanf("%s", s) != EOF){
if(s[0] == '+'){
i = pop();
j = pop();
n = i + j;
push(n);
}
else if(s[0] == '-'){
j = pop();
i = pop();
n = i - j;
push(n);
}
else if(s[0] == '*'){
i = pop();
j = pop();
n = i * j;
push(n);
}
else{
push(atoi(s));
}
}
printf("%d\n", pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287110/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287110/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@top = dso_local local_unnamed_addr global i32 0, align 4
@s = dso_local local_unnamed_addr global [300 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %n) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [300 x i32], ptr @s, i64 0, i64 %idxprom
store i32 %n, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [300 x i32], ptr @s, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
store i32 0, ptr @top, align 4, !tbaa !5
%call62 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not63 = icmp eq i32 %call62, -1
br i1 %cmp.not63, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [300 x i32], ptr @s, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i34 = sext i32 %dec.i to i64
%arrayidx.i35 = getelementptr inbounds [300 x i32], ptr @s, i64 0, i64 %idxprom.i34
%3 = load i32, ptr %arrayidx.i35, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i35, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i38 = add nsw i32 %4, -1
%idxprom.i39 = sext i32 %4 to i64
%arrayidx.i40 = getelementptr inbounds [300 x i32], ptr @s, i64 0, i64 %idxprom.i39
%5 = load i32, ptr %arrayidx.i40, align 4, !tbaa !5
%idxprom.i42 = sext i32 %dec.i38 to i64
%arrayidx.i43 = getelementptr inbounds [300 x i32], ptr @s, i64 0, i64 %idxprom.i42
%6 = load i32, ptr %arrayidx.i43, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i38, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i43, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i47 = add nsw i32 %7, -1
%idxprom.i48 = sext i32 %7 to i64
%arrayidx.i49 = getelementptr inbounds [300 x i32], ptr @s, i64 0, i64 %idxprom.i48
%8 = load i32, ptr %arrayidx.i49, align 4, !tbaa !5
%idxprom.i51 = sext i32 %dec.i47 to i64
%arrayidx.i52 = getelementptr inbounds [300 x i32], ptr @s, i64 0, i64 %idxprom.i51
%9 = load i32, ptr %arrayidx.i52, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i47, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i52, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i56 = add nsw i32 %10, 1
store i32 %inc.i56, ptr @top, align 4, !tbaa !5
%idxprom.i57 = sext i32 %inc.i56 to i64
%arrayidx.i58 = getelementptr inbounds [300 x i32], ptr @s, i64 0, i64 %idxprom.i57
store i32 %conv.i, ptr %arrayidx.i58, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i59 = add nsw i32 %11, -1
store i32 %dec.i59, ptr @top, align 4, !tbaa !5
%idxprom.i60 = sext i32 %11 to i64
%arrayidx.i61 = getelementptr inbounds [300 x i32], ptr @s, i64 0, i64 %idxprom.i60
%12 = load i32, ptr %arrayidx.i61, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
int top;
int M[1000];
void push(int X) {
M[++top] = X;
}
int pop() {
top--;
return M[top+1];
}
int main() {
top = 0;
int A, B;
char s[100];
while (scanf("%s", s) != EOF) {
if (s[0] == '+') {
A = pop();
B = pop();
push(A + B);
}
else if (s[0] == '-') {
B = pop();
A = pop();
push(A - B);
}
else if (s[0] == '*') {
A = pop();
B = pop();
push(A * B);
}
else {
push(atoi(s));
}
}
printf("%d\n", pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287154/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287154/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@M = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %X) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @M, i64 0, i64 %idxprom
store i32 %X, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @M, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @M, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @M, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @M, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @M, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @M, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @M, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @M, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @M, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int top = 0, S[1000];
void push(int x) {
S[++top] = x;
}
int pop(void) {
top--;
return S[top+1];
}
int main(void) {
int a, b;
top = 0;
char s[100];
while(scanf("%s",s) != EOF) {
if(s[0] == '+') {
a = pop();
b = pop();
push(a + b);
} else if(s[0] == '-') {
b = pop();
a = pop();
push(a - b);
} else if(s[0] == '*') {
a = pop();
b = pop();
push(a * b);
} else {
push(atoi(s));
}
}
printf("%d\n",pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287198/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287198/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@top = dso_local local_unnamed_addr global i32 0, align 4
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
/*--------------------------*/
// p.82
// 4.2 スタック
//
// 逆ポーランド記法
//
// 入力例: 1 2 + 3 4 - *
// 出力例:-3
/*--------------------------*/
// memo: scanf("%s", s) != EOF は,UNIXでは「Ctrl + D」がEOFになる
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int top, S[1000];
void push(int x){
/* topを加算してからその位置へ挿入 */
S[++top] = x;
}
int pop(){
/* topが差していた要素を返す */
top--;
return S[top + 1];
}
int isEmpty(){
if (0 == sizeof(S) / sizeof(int)) {
return 1;
} else {
return 0;
}
}
int main(){
int a, b;
top = 0;
char s[100];
while(scanf("%s", s) != EOF){
if (s[0] == '+'){
b = pop();
a = pop();
push(a + b);
}else if (s[0] == '-'){
b = pop();
a = pop();
push(a - b);
}else if (s[0] == '*'){
b = pop();
a = pop();
push(a * b);
}else {
push(atoi(s));
}
}
printf("%d\n", pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287240/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287240/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @isEmpty() local_unnamed_addr #1 {
entry:
ret i32 0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #6
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #6
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top, S[1000];
void push(int x) {
S[++top] = x;
}
int pop() {
top--;
return S[top+1];
}
int main() {
int a, b;
top = 0;
char s[100];
while( scanf("%s", s) != EOF ) {
if ( s[0] == '+' ) {
b = pop();
a = pop();
push(a + b);
} else if ( s[0] == '-' ) {
b = pop();
a = pop();
push(a - b);
} else if ( s[0] == '*' ) {
b = pop();
a = pop();
push(a * b);
} else {
push(atoi(s));
}
}
printf("%d\n", pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287284/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287284/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 1000
int top,S[N];
void push(int x){
S[++top] = x;
}
int pop(){
top--;
return S[top+1];
}
int main(){
int a,b;
top=0;
char s[100];
while(scanf("%s" ,s) != EOF){
if(s[0] == '+'){
a=pop();
b=pop();
push(a+b);
}
else if(s[0] == '-'){
b=pop();
a=pop();
push(a-b);
}
else if(s[0] == '*'){
a=pop();
b=pop();
push(a*b);
}
else{
push(atoi(s));
}
}
printf("%d\n" ,pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287334/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287334/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 101
int isEmpty(void);
int isFull(void);
void push(int);
int pop(void);
int top=0;
int S[MAX]={};
int main(){
int x,ans;
char s[100];
while(scanf("%s", s)!=EOF){
if (s[0] == '+' ){
push(pop()+pop());
} else if ( s[0] == '-' ){
ans=pop()-pop();
push(ans*(-1));
} else if ( s[0] == '*' ){
push(pop()*pop());
} else {
x = atoi(s);
push(x);
}
}
printf("%d\n",pop());
return 0;
}
int isEmpty(void){
return top==0;
}
int isFull(){
return top>=MAX-1;
}
void push(int x){
if(isFull()){
printf("is full!\n");
exit(1);
}
top++;
S[top]=x;
// printf("%d ",top);
}
int pop(){
if(isEmpty()){
printf("is Empty!\n");
exit(2);
}
top--;
return S[top+1];
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287378/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287378/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@top = dso_local local_unnamed_addr global i32 0, align 4
@S = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [9 x i8] c"is full!\00", align 1
@str.4 = private unnamed_addr constant [10 x i8] c"is Empty!\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #7
%call95 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not96 = icmp eq i32 %call95, -1
br i1 %cmp.not96, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end25
%0 = load i8, ptr %s, align 16, !tbaa !5
switch i8 %0, label %if.else21 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not.i = icmp eq i32 %1, 0
br i1 %cmp.i.not.i, label %if.then.i, label %pop.exit
if.then.i: ; preds = %if.then
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
call void @exit(i32 noundef 2) #8
unreachable
pop.exit: ; preds = %if.then
%dec.i = add nsw i32 %1, -1
store i32 %dec.i, ptr @top, align 4, !tbaa !8
%cmp.i.not.i28 = icmp eq i32 %dec.i, 0
br i1 %cmp.i.not.i28, label %if.then.i32, label %pop.exit34
if.then.i32: ; preds = %pop.exit
%puts.i33 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
call void @exit(i32 noundef 2) #8
unreachable
pop.exit34: ; preds = %pop.exit
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !8
%dec.i29 = add nsw i32 %1, -2
store i32 %dec.i29, ptr @top, align 4, !tbaa !8
%cmp.i.i = icmp slt i32 %1, 102
br i1 %cmp.i.i, label %push.exit, label %if.then.i35
if.then.i35: ; preds = %pop.exit34
%puts.i36 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #8
unreachable
push.exit: ; preds = %pop.exit34
%idxprom.i30 = sext i32 %dec.i to i64
%arrayidx.i31 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i30
%3 = load i32, ptr %arrayidx.i31, align 4, !tbaa !8
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !8
store i32 %add, ptr %arrayidx.i31, align 4, !tbaa !8
br label %if.end25
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not.i39 = icmp eq i32 %4, 0
br i1 %cmp.i.not.i39, label %if.then.i43, label %pop.exit45
if.then.i43: ; preds = %if.then9
%puts.i44 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
call void @exit(i32 noundef 2) #8
unreachable
pop.exit45: ; preds = %if.then9
%dec.i40 = add nsw i32 %4, -1
store i32 %dec.i40, ptr @top, align 4, !tbaa !8
%cmp.i.not.i46 = icmp eq i32 %dec.i40, 0
br i1 %cmp.i.not.i46, label %if.then.i50, label %pop.exit52
if.then.i50: ; preds = %pop.exit45
%puts.i51 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
call void @exit(i32 noundef 2) #8
unreachable
pop.exit52: ; preds = %pop.exit45
%idxprom.i41 = sext i32 %4 to i64
%arrayidx.i42 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i41
%5 = load i32, ptr %arrayidx.i42, align 4, !tbaa !8
%dec.i47 = add nsw i32 %4, -2
store i32 %dec.i47, ptr @top, align 4, !tbaa !8
%cmp.i.i53 = icmp slt i32 %4, 102
br i1 %cmp.i.i53, label %push.exit59, label %if.then.i54
if.then.i54: ; preds = %pop.exit52
%puts.i55 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #8
unreachable
push.exit59: ; preds = %pop.exit52
%idxprom.i48 = sext i32 %dec.i40 to i64
%arrayidx.i49 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i48
%6 = load i32, ptr %arrayidx.i49, align 4, !tbaa !8
%sub.neg = sub nsw i32 %6, %5
store i32 %dec.i40, ptr @top, align 4, !tbaa !8
store i32 %sub.neg, ptr %arrayidx.i49, align 4, !tbaa !8
br label %if.end25
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not.i60 = icmp eq i32 %7, 0
br i1 %cmp.i.not.i60, label %if.then.i64, label %pop.exit66
if.then.i64: ; preds = %if.then17
%puts.i65 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
call void @exit(i32 noundef 2) #8
unreachable
pop.exit66: ; preds = %if.then17
%dec.i61 = add nsw i32 %7, -1
store i32 %dec.i61, ptr @top, align 4, !tbaa !8
%cmp.i.not.i67 = icmp eq i32 %dec.i61, 0
br i1 %cmp.i.not.i67, label %if.then.i71, label %pop.exit73
if.then.i71: ; preds = %pop.exit66
%puts.i72 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
call void @exit(i32 noundef 2) #8
unreachable
pop.exit73: ; preds = %pop.exit66
%idxprom.i62 = sext i32 %7 to i64
%arrayidx.i63 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i62
%8 = load i32, ptr %arrayidx.i63, align 4, !tbaa !8
%dec.i68 = add nsw i32 %7, -2
store i32 %dec.i68, ptr @top, align 4, !tbaa !8
%cmp.i.i74 = icmp slt i32 %7, 102
br i1 %cmp.i.i74, label %push.exit80, label %if.then.i75
if.then.i75: ; preds = %pop.exit73
%puts.i76 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #8
unreachable
push.exit80: ; preds = %pop.exit73
%idxprom.i69 = sext i32 %dec.i61 to i64
%arrayidx.i70 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i69
%9 = load i32, ptr %arrayidx.i70, align 4, !tbaa !8
%mul20 = mul nsw i32 %9, %8
store i32 %dec.i61, ptr @top, align 4, !tbaa !8
store i32 %mul20, ptr %arrayidx.i70, align 4, !tbaa !8
br label %if.end25
if.else21: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #7
%10 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.i81 = icmp slt i32 %10, 100
br i1 %cmp.i.i81, label %push.exit87, label %if.then.i82
if.then.i82: ; preds = %if.else21
%puts.i83 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #8
unreachable
push.exit87: ; preds = %if.else21
%conv.i = trunc i64 %call.i to i32
%inc.i84 = add nsw i32 %10, 1
store i32 %inc.i84, ptr @top, align 4, !tbaa !8
%idxprom.i85 = sext i32 %inc.i84 to i64
%arrayidx.i86 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i85
store i32 %conv.i, ptr %arrayidx.i86, align 4, !tbaa !8
br label %if.end25
if.end25: ; preds = %push.exit59, %push.exit87, %push.exit80, %push.exit
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end25, %entry
%11 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not.i88 = icmp eq i32 %11, 0
br i1 %cmp.i.not.i88, label %if.then.i92, label %pop.exit94
if.then.i92: ; preds = %while.end
%puts.i93 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
call void @exit(i32 noundef 2) #8
unreachable
pop.exit94: ; preds = %while.end
%dec.i89 = add nsw i32 %11, -1
store i32 %dec.i89, ptr @top, align 4, !tbaa !8
%idxprom.i90 = sext i32 %11 to i64
%arrayidx.i91 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i90
%12 = load i32, ptr %arrayidx.i91, align 4, !tbaa !8
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #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: nounwind uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i = icmp slt i32 %0, 100
br i1 %cmp.i, label %if.end, label %if.then
if.then: ; preds = %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
tail call void @exit(i32 noundef 1) #8
unreachable
if.end: ; preds = %entry
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !8
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not = icmp eq i32 %0, 0
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.4)
tail call void @exit(i32 noundef 2) #8
unreachable
if.end: ; preds = %entry
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !8
ret i32 %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: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @isEmpty() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%cmp = icmp eq i32 %0, 0
%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 @isFull() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%cmp = icmp sgt i32 %0, 99
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
attributes #8 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <ctype.h>
int stack[102]; int top;
char buf[2000];
int main()
{
int v1, v2;
char *p;
fgets(p=buf, 500, stdin);
top = 0;
while (*p >= ' ') {
while (isspace(*p)) p++;
if (isdigit(*p)) {
v1 = 0;
while (isdigit(*p)) v1 = 10*v1 + (*p++ & 0xf);
stack[top++] = v1;
} else {
v1 = stack[--top];
v2 = stack[--top];
if (*p == '+') v2 += v1;
else if (*p == '-') v2 -= v1;
else if (*p == '*') v2 *= v1;
stack[top++] = v2;
p++;
}
}
printf("%d\n", stack[--top]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287435/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287435/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@buf = dso_local global [2000 x i8] zeroinitializer, align 16
@stdin = external local_unnamed_addr global ptr, align 8
@top = dso_local local_unnamed_addr global i32 0, align 4
@stack = dso_local local_unnamed_addr global [102 x i32] zeroinitializer, align 16
@.str = 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:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = tail call ptr @fgets(ptr noundef nonnull @buf, i32 noundef 500, ptr noundef %0)
store i32 0, ptr @top, align 4, !tbaa !9
%1 = load i8, ptr @buf, align 16, !tbaa !11
%cmp86 = icmp sgt i8 %1, 31
br i1 %cmp86, label %while.cond2.preheader.lr.ph, label %while.end57
while.cond2.preheader.lr.ph: ; preds = %entry
%call3 = tail call ptr @__ctype_b_loc() #3
%2 = load ptr, ptr %call3, align 8, !tbaa !5
br label %while.cond2.preheader
while.cond2.preheader: ; preds = %while.cond2.preheader.lr.ph, %if.end56
%p.088 = phi ptr [ @buf, %while.cond2.preheader.lr.ph ], [ %p.3, %if.end56 ]
%inc528487 = phi i32 [ 0, %while.cond2.preheader.lr.ph ], [ %inc5285, %if.end56 ]
br label %while.cond2
while.cond2: ; preds = %while.cond2, %while.cond2.preheader
%p.1 = phi ptr [ %incdec.ptr, %while.cond2 ], [ %p.088, %while.cond2.preheader ]
%3 = load i8, ptr %p.1, align 1, !tbaa !11
%idxprom = sext i8 %3 to i64
%arrayidx = getelementptr inbounds i16, ptr %2, i64 %idxprom
%4 = load i16, ptr %arrayidx, align 2, !tbaa !12
%conv5 = zext i16 %4 to i32
%and = and i32 %conv5, 8192
%tobool.not = icmp eq i32 %and, 0
%incdec.ptr = getelementptr inbounds i8, ptr %p.1, i64 1
br i1 %tobool.not, label %while.end, label %while.cond2, !llvm.loop !14
while.end: ; preds = %while.cond2
%and12 = and i32 %conv5, 2048
%tobool13.not = icmp eq i32 %and12, 0
br i1 %tobool13.not, label %if.else, label %while.cond14.preheader
while.cond14.preheader: ; preds = %while.end
%5 = and i16 %4, 2048
%tobool21.not80 = icmp eq i16 %5, 0
br i1 %tobool21.not80, label %while.end26, label %while.body22
while.body22: ; preds = %while.cond14.preheader, %while.body22
%6 = phi i8 [ %8, %while.body22 ], [ %3, %while.cond14.preheader ]
%p.282 = phi ptr [ %incdec.ptr23, %while.body22 ], [ %p.1, %while.cond14.preheader ]
%v1.081 = phi i32 [ %add, %while.body22 ], [ 0, %while.cond14.preheader ]
%mul = mul nsw i32 %v1.081, 10
%incdec.ptr23 = getelementptr inbounds i8, ptr %p.282, i64 1
%7 = and i8 %6, 15
%and25 = zext i8 %7 to i32
%add = add nsw i32 %mul, %and25
%8 = load i8, ptr %incdec.ptr23, align 1, !tbaa !11
%idxprom17 = sext i8 %8 to i64
%arrayidx18 = getelementptr inbounds i16, ptr %2, i64 %idxprom17
%9 = load i16, ptr %arrayidx18, align 2, !tbaa !12
%10 = and i16 %9, 2048
%tobool21.not = icmp eq i16 %10, 0
br i1 %tobool21.not, label %while.end26, label %while.body22, !llvm.loop !16
while.end26: ; preds = %while.body22, %while.cond14.preheader
%v1.0.lcssa = phi i32 [ 0, %while.cond14.preheader ], [ %add, %while.body22 ]
%p.2.lcssa = phi ptr [ %p.1, %while.cond14.preheader ], [ %incdec.ptr23, %while.body22 ]
%inc = add nsw i32 %inc528487, 1
store i32 %inc, ptr @top, align 4, !tbaa !9
%idxprom27 = sext i32 %inc528487 to i64
%arrayidx28 = getelementptr inbounds [102 x i32], ptr @stack, i64 0, i64 %idxprom27
store i32 %v1.0.lcssa, ptr %arrayidx28, align 4, !tbaa !9
br label %if.end56
if.else: ; preds = %while.end
%dec = add nsw i32 %inc528487, -1
%idxprom29 = sext i32 %dec to i64
%arrayidx30 = getelementptr inbounds [102 x i32], ptr @stack, i64 0, i64 %idxprom29
%11 = load i32, ptr %arrayidx30, align 4, !tbaa !9
%dec31 = add nsw i32 %inc528487, -2
store i32 %dec31, ptr @top, align 4, !tbaa !9
%idxprom32 = sext i32 %dec31 to i64
%arrayidx33 = getelementptr inbounds [102 x i32], ptr @stack, i64 0, i64 %idxprom32
%12 = load i32, ptr %arrayidx33, align 4, !tbaa !9
%13 = load i8, ptr %p.1, align 1, !tbaa !11
switch i8 %13, label %if.end51 [
i8 43, label %if.then37
i8 45, label %if.then43
i8 42, label %if.then48
]
if.then37: ; preds = %if.else
%add38 = add nsw i32 %12, %11
br label %if.end51
if.then43: ; preds = %if.else
%sub = sub nsw i32 %12, %11
br label %if.end51
if.then48: ; preds = %if.else
%mul49 = mul nsw i32 %12, %11
br label %if.end51
if.end51: ; preds = %if.else, %if.then43, %if.then48, %if.then37
%v2.0 = phi i32 [ %add38, %if.then37 ], [ %sub, %if.then43 ], [ %mul49, %if.then48 ], [ %12, %if.else ]
store i32 %dec, ptr @top, align 4, !tbaa !9
store i32 %v2.0, ptr %arrayidx33, align 4, !tbaa !9
br label %if.end56
if.end56: ; preds = %if.end51, %while.end26
%inc5285 = phi i32 [ %inc, %while.end26 ], [ %dec, %if.end51 ]
%p.3 = phi ptr [ %p.2.lcssa, %while.end26 ], [ %incdec.ptr, %if.end51 ]
%14 = load i8, ptr %p.3, align 1, !tbaa !11
%cmp = icmp sgt i8 %14, 31
br i1 %cmp, label %while.cond2.preheader, label %while.end57.loopexit, !llvm.loop !17
while.end57.loopexit: ; preds = %if.end56
%15 = add nsw i32 %inc5285, -1
br label %while.end57
while.end57: ; preds = %while.end57.loopexit, %entry
%dec58 = phi i32 [ %15, %while.end57.loopexit ], [ -1, %entry ]
store i32 %dec58, ptr @top, align 4, !tbaa !9
%idxprom59 = sext i32 %dec58 to i64
%arrayidx60 = getelementptr inbounds [102 x i32], ptr @stack, i64 0, i64 %idxprom59
%16 = load i32, ptr %arrayidx60, align 4, !tbaa !9
%call61 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %16)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-math"="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 willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!13, !13, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
|
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
int comp(const void *a, const void *b){return (*(int*)a>*(int*)b)-(*(int*)a<*(int*)b);}
int compr(const void *a, const void *b){return (*(int*)a<*(int*)b)-(*(int*)a>*(int*)b);}
#define putchar(c) putc_unlocked((c), stdout);
uint32_t nextpint(void){ char c=getc_unlocked(stdin); while(c<'0'||'9'<c) c=getc_unlocked(stdin); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getc_unlocked(stdin); } return x; }
uint64_t nextplong(void){ char c=getc_unlocked(stdin); while(c<'0'||'9'<c) c=getc_unlocked(stdin); uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getc_unlocked(stdin); } return x; }
uint32_t nextstr(char *s){ char c=getc_unlocked(stdin); while(c==' '||c=='\n') c=getc_unlocked(stdin); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getc_unlocked(stdin); } *s='\0'; return len; }
uint32_t nextstrln(char *s){ char c=getc_unlocked(stdin); while(c==' '||c=='\n') c=getc_unlocked(stdin); uint32_t len=0; while(c!='\n'){ *s++=c; len++; c=getc_unlocked(stdin); } *s='\0'; return len; }
void printint(int x){ if(x<0){x=-x; putc_unlocked('-', stdout);}else if(x==0){putc_unlocked('0', stdout);} int d=0; char s[10]; while(x){ s[d]='0'+x%10; x/=10; d++; } for (int i=d-1; i>=0; i--) putc_unlocked(s[i], stdout); putc_unlocked('\n', stdout); }
void printlong(long x){ if(x<0){x=-x; putc_unlocked('-', stdout);}else if(x==0){putc_unlocked('0', stdout);} int d=0; char s[20]; while(x){ s[d]='0'+x%10; x/=10; d++; } for (int i=d-1; i>=0; i--) putc_unlocked(s[i], stdout); }
inline int max2(const int a, const int b){return a>b?a:b;}
inline int min2(const int a, const int b){return a>b?b:a;}
inline int dif2(const int a, const int b){return a>b?a-b:b-a;}
inline int abs2(const int a){return a>=0?a:-a;}
char s[200001];
int l[200001];
int r[200001];
int main(void){
int n=nextpint();
int k=nextpint();
int c=nextpint();
nextstr(s);
int h=0;
for(int i=0; i<n; i++){
if(s[i]=='o'){
h++;
l[h]=i;
i+=c;
}
}
h=0;
for(int i=n-1; i>=0; i--){
if(s[i]=='o'){
h++;
r[h]=i;
i-=c;
}
}
for(int i=max2(1,k-h+1), j=min2(h,k); i<=j; i++){
if(l[i]==r[k-i+1]){
printint(l[i]+1);
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287486/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287486/source.c"
target datalayout = "e-m:e-p270: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] }
@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@s = dso_local global [200001 x i8] zeroinitializer, align 16
@l = dso_local local_unnamed_addr global [200001 x i32] zeroinitializer, align 16
@r = dso_local local_unnamed_addr global [200001 x i32] zeroinitializer, align 16
; 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 #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%conv = zext i1 %cmp to i32
%cmp1 = icmp slt i32 %0, %1
%conv2.neg = sext i1 %cmp1 to i32
%sub = add nsw i32 %conv2.neg, %conv
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compr(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%conv = zext i1 %cmp to i32
%cmp1 = icmp sgt i32 %0, %1
%conv2.neg = sext i1 %cmp1 to i32
%sub = add nsw i32 %conv2.neg, %conv
ret i32 %sub
}
; Function Attrs: nounwind uwtable
define dso_local i32 @nextpint() local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !9
%_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 !11
%_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 !15
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !16
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #5
br label %getc_unlocked.exit
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 !11
%3 = load i8, ptr %1, align 1, !tbaa !17
%conv3.i = zext i8 %3 to i32
br label %getc_unlocked.exit
getc_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
%cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ]
%sext46 = shl i32 %cond.i, 24
%4 = add i32 %sext46, -956301313
%5 = icmp ult i32 %4, -150994945
br i1 %5, label %while.body.preheader, label %while.body15.preheader
while.body.preheader: ; preds = %getc_unlocked.exit
%.pre51 = load ptr, ptr @stdin, align 8, !tbaa !9
br label %while.body
while.body15.preheader: ; preds = %getc_unlocked.exit35, %getc_unlocked.exit
%c.0.in.lcssa = phi i32 [ %cond.i, %getc_unlocked.exit ], [ %cond.i31, %getc_unlocked.exit35 ]
%.pre53 = load ptr, ptr @stdin, align 8, !tbaa !9
br label %while.body15
while.body: ; preds = %while.body.preheader, %getc_unlocked.exit35
%6 = phi ptr [ %.pre51, %while.body.preheader ], [ %10, %getc_unlocked.exit35 ]
%_IO_read_ptr.i26 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 1
%7 = load ptr, ptr %_IO_read_ptr.i26, align 8, !tbaa !11
%_IO_read_end.i27 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 2
%8 = load ptr, ptr %_IO_read_end.i27, align 8, !tbaa !15
%cmp.not.i28 = icmp ult ptr %7, %8
br i1 %cmp.not.i28, label %cond.false.i32, label %cond.true.i29, !prof !16
cond.true.i29: ; preds = %while.body
%call.i30 = tail call i32 @__uflow(ptr noundef nonnull %6) #5
%.pre = load ptr, ptr @stdin, align 8, !tbaa !9
br label %getc_unlocked.exit35
cond.false.i32: ; preds = %while.body
%incdec.ptr.i33 = getelementptr inbounds i8, ptr %7, i64 1
store ptr %incdec.ptr.i33, ptr %_IO_read_ptr.i26, align 8, !tbaa !11
%9 = load i8, ptr %7, align 1, !tbaa !17
%conv3.i34 = zext i8 %9 to i32
br label %getc_unlocked.exit35
getc_unlocked.exit35: ; preds = %cond.true.i29, %cond.false.i32
%10 = phi ptr [ %.pre, %cond.true.i29 ], [ %6, %cond.false.i32 ]
%cond.i31 = phi i32 [ %call.i30, %cond.true.i29 ], [ %conv3.i34, %cond.false.i32 ]
%sext = shl i32 %cond.i31, 24
%11 = add i32 %sext, -956301313
%12 = icmp ult i32 %11, -150994945
br i1 %12, label %while.body, label %while.body15.preheader, !llvm.loop !18
while.body15: ; preds = %while.body15.preheader, %getc_unlocked.exit45
%13 = phi ptr [ %17, %getc_unlocked.exit45 ], [ %.pre53, %while.body15.preheader ]
%x.049 = phi i32 [ %sub, %getc_unlocked.exit45 ], [ 0, %while.body15.preheader ]
%c.1.in48 = phi i32 [ %cond.i41, %getc_unlocked.exit45 ], [ %c.0.in.lcssa, %while.body15.preheader ]
%conv9 = and i32 %c.1.in48, 255
%mul = mul i32 %x.049, 10
%add = add nsw i32 %conv9, -48
%sub = add i32 %add, %mul
%_IO_read_ptr.i36 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 1
%14 = load ptr, ptr %_IO_read_ptr.i36, align 8, !tbaa !11
%_IO_read_end.i37 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 2
%15 = load ptr, ptr %_IO_read_end.i37, align 8, !tbaa !15
%cmp.not.i38 = icmp ult ptr %14, %15
br i1 %cmp.not.i38, label %cond.false.i42, label %cond.true.i39, !prof !16
cond.true.i39: ; preds = %while.body15
%call.i40 = tail call i32 @__uflow(ptr noundef nonnull %13) #5
%.pre52 = load ptr, ptr @stdin, align 8, !tbaa !9
br label %getc_unlocked.exit45
cond.false.i42: ; preds = %while.body15
%incdec.ptr.i43 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr.i43, ptr %_IO_read_ptr.i36, align 8, !tbaa !11
%16 = load i8, ptr %14, align 1, !tbaa !17
%conv3.i44 = zext i8 %16 to i32
br label %getc_unlocked.exit45
getc_unlocked.exit45: ; preds = %cond.true.i39, %cond.false.i42
%17 = phi ptr [ %.pre52, %cond.true.i39 ], [ %13, %cond.false.i42 ]
%cond.i41 = phi i32 [ %call.i40, %cond.true.i39 ], [ %conv3.i44, %cond.false.i42 ]
%sext25 = shl i32 %cond.i41, 24
%18 = add i32 %sext25, -788529153
%19 = icmp ult i32 %18, 184549375
br i1 %19, label %while.body15, label %while.end19, !llvm.loop !20
while.end19: ; preds = %getc_unlocked.exit45
ret i32 %sub
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nounwind uwtable
define dso_local i64 @nextplong() local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !9
%_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 !11
%_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 !15
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !16
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #5
br label %getc_unlocked.exit
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 !11
%3 = load i8, ptr %1, align 1, !tbaa !17
%conv3.i = zext i8 %3 to i32
br label %getc_unlocked.exit
getc_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
%cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ]
%sext47 = shl i32 %cond.i, 24
%4 = add i32 %sext47, -956301313
%5 = icmp ult i32 %4, -150994945
br i1 %5, label %while.body.preheader, label %while.body15.preheader
while.body.preheader: ; preds = %getc_unlocked.exit
%.pre52 = load ptr, ptr @stdin, align 8, !tbaa !9
br label %while.body
while.body15.preheader: ; preds = %getc_unlocked.exit36, %getc_unlocked.exit
%c.0.in.lcssa = phi i32 [ %cond.i, %getc_unlocked.exit ], [ %cond.i32, %getc_unlocked.exit36 ]
%.pre54 = load ptr, ptr @stdin, align 8, !tbaa !9
br label %while.body15
while.body: ; preds = %while.body.preheader, %getc_unlocked.exit36
%6 = phi ptr [ %.pre52, %while.body.preheader ], [ %10, %getc_unlocked.exit36 ]
%_IO_read_ptr.i27 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 1
%7 = load ptr, ptr %_IO_read_ptr.i27, align 8, !tbaa !11
%_IO_read_end.i28 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 2
%8 = load ptr, ptr %_IO_read_end.i28, align 8, !tbaa !15
%cmp.not.i29 = icmp ult ptr %7, %8
br i1 %cmp.not.i29, label %cond.false.i33, label %cond.true.i30, !prof !16
cond.true.i30: ; preds = %while.body
%call.i31 = tail call i32 @__uflow(ptr noundef nonnull %6) #5
%.pre = load ptr, ptr @stdin, align 8, !tbaa !9
br label %getc_unlocked.exit36
cond.false.i33: ; preds = %while.body
%incdec.ptr.i34 = getelementptr inbounds i8, ptr %7, i64 1
store ptr %incdec.ptr.i34, ptr %_IO_read_ptr.i27, align 8, !tbaa !11
%9 = load i8, ptr %7, align 1, !tbaa !17
%conv3.i35 = zext i8 %9 to i32
br label %getc_unlocked.exit36
getc_unlocked.exit36: ; preds = %cond.true.i30, %cond.false.i33
%10 = phi ptr [ %.pre, %cond.true.i30 ], [ %6, %cond.false.i33 ]
%cond.i32 = phi i32 [ %call.i31, %cond.true.i30 ], [ %conv3.i35, %cond.false.i33 ]
%sext = shl i32 %cond.i32, 24
%11 = add i32 %sext, -956301313
%12 = icmp ult i32 %11, -150994945
br i1 %12, label %while.body, label %while.body15.preheader, !llvm.loop !21
while.body15: ; preds = %while.body15.preheader, %getc_unlocked.exit46
%13 = phi ptr [ %17, %getc_unlocked.exit46 ], [ %.pre54, %while.body15.preheader ]
%x.050 = phi i64 [ %sub, %getc_unlocked.exit46 ], [ 0, %while.body15.preheader ]
%c.1.in49 = phi i32 [ %cond.i42, %getc_unlocked.exit46 ], [ %c.0.in.lcssa, %while.body15.preheader ]
%c.1 = zext i32 %c.1.in49 to i64
%mul = mul i64 %x.050, 10
%sext26 = shl i64 %c.1, 56
%conv16 = ashr exact i64 %sext26, 56
%add = add i64 %mul, -48
%sub = add i64 %add, %conv16
%_IO_read_ptr.i37 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 1
%14 = load ptr, ptr %_IO_read_ptr.i37, align 8, !tbaa !11
%_IO_read_end.i38 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 2
%15 = load ptr, ptr %_IO_read_end.i38, align 8, !tbaa !15
%cmp.not.i39 = icmp ult ptr %14, %15
br i1 %cmp.not.i39, label %cond.false.i43, label %cond.true.i40, !prof !16
cond.true.i40: ; preds = %while.body15
%call.i41 = tail call i32 @__uflow(ptr noundef nonnull %13) #5
%.pre53 = load ptr, ptr @stdin, align 8, !tbaa !9
br label %getc_unlocked.exit46
cond.false.i43: ; preds = %while.body15
%incdec.ptr.i44 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr.i44, ptr %_IO_read_ptr.i37, align 8, !tbaa !11
%16 = load i8, ptr %14, align 1, !tbaa !17
%conv3.i45 = zext i8 %16 to i32
br label %getc_unlocked.exit46
getc_unlocked.exit46: ; preds = %cond.true.i40, %cond.false.i43
%17 = phi ptr [ %.pre53, %cond.true.i40 ], [ %13, %cond.false.i43 ]
%cond.i42 = phi i32 [ %call.i41, %cond.true.i40 ], [ %conv3.i45, %cond.false.i43 ]
%sext25 = shl i32 %cond.i42, 24
%18 = add i32 %sext25, -788529153
%19 = icmp ult i32 %18, 184549375
br i1 %19, label %while.body15, label %while.end19, !llvm.loop !22
while.end19: ; preds = %getc_unlocked.exit46
ret i64 %sub
}
; Function Attrs: nounwind uwtable
define dso_local i32 @nextstr(ptr nocapture noundef writeonly %s) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !9
%_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 !11
%_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 !15
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !16
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #5
br label %while.cond.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 !11
%3 = load i8, ptr %1, align 1, !tbaa !17
%conv3.i = zext i8 %3 to i32
br label %while.cond.preheader
while.cond.preheader: ; preds = %cond.true.i, %cond.false.i
%c.0.in.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ]
br label %while.cond
while.cond: ; preds = %while.cond.backedge, %while.cond.preheader
%c.0.in = phi i32 [ %c.0.in.ph, %while.cond.preheader ], [ %c.0.in.be, %while.cond.backedge ]
%sext = shl i32 %c.0.in, 24
switch i32 %sext, label %while.cond8 [
i32 536870912, label %while.body
i32 167772160, label %while.body
]
while.body: ; preds = %while.cond, %while.cond
%4 = load ptr, ptr @stdin, align 8, !tbaa !9
%_IO_read_ptr.i26 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i26, align 8, !tbaa !11
%_IO_read_end.i27 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i27, align 8, !tbaa !15
%cmp.not.i28 = icmp ult ptr %5, %6
br i1 %cmp.not.i28, label %cond.false.i32, label %cond.true.i29, !prof !16
cond.true.i29: ; preds = %while.body
%call.i30 = tail call i32 @__uflow(ptr noundef nonnull %4) #5
br label %while.cond.backedge
while.cond.backedge: ; preds = %cond.true.i29, %cond.false.i32
%c.0.in.be = phi i32 [ %call.i30, %cond.true.i29 ], [ %conv3.i34, %cond.false.i32 ]
br label %while.cond, !llvm.loop !23
cond.false.i32: ; preds = %while.body
%incdec.ptr.i33 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i33, ptr %_IO_read_ptr.i26, align 8, !tbaa !11
%7 = load i8, ptr %5, align 1, !tbaa !17
%conv3.i34 = zext i8 %7 to i32
br label %while.cond.backedge
while.cond8: ; preds = %while.cond, %while.cond8.backedge
%s.addr.0 = phi ptr [ %incdec.ptr, %while.cond8.backedge ], [ %s, %while.cond ]
%c.1.in = phi i32 [ %c.1.in.be, %while.cond8.backedge ], [ %c.0.in, %while.cond ]
%len.0 = phi i32 [ %inc, %while.cond8.backedge ], [ 0, %while.cond ]
%sext25 = shl i32 %c.1.in, 24
switch i32 %sext25, label %while.body15 [
i32 536870912, label %while.end18
i32 167772160, label %while.end18
]
while.body15: ; preds = %while.cond8
%c.1 = trunc i32 %c.1.in to i8
%incdec.ptr = getelementptr inbounds i8, ptr %s.addr.0, i64 1
store i8 %c.1, ptr %s.addr.0, align 1, !tbaa !17
%inc = add i32 %len.0, 1
%8 = load ptr, ptr @stdin, align 8, !tbaa !9
%_IO_read_ptr.i36 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 1
%9 = load ptr, ptr %_IO_read_ptr.i36, align 8, !tbaa !11
%_IO_read_end.i37 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 2
%10 = load ptr, ptr %_IO_read_end.i37, align 8, !tbaa !15
%cmp.not.i38 = icmp ult ptr %9, %10
br i1 %cmp.not.i38, label %cond.false.i42, label %cond.true.i39, !prof !16
cond.true.i39: ; preds = %while.body15
%call.i40 = tail call i32 @__uflow(ptr noundef nonnull %8) #5
br label %while.cond8.backedge
while.cond8.backedge: ; preds = %cond.true.i39, %cond.false.i42
%c.1.in.be = phi i32 [ %call.i40, %cond.true.i39 ], [ %conv3.i44, %cond.false.i42 ]
br label %while.cond8, !llvm.loop !24
cond.false.i42: ; preds = %while.body15
%incdec.ptr.i43 = getelementptr inbounds i8, ptr %9, i64 1
store ptr %incdec.ptr.i43, ptr %_IO_read_ptr.i36, align 8, !tbaa !11
%11 = load i8, ptr %9, align 1, !tbaa !17
%conv3.i44 = zext i8 %11 to i32
br label %while.cond8.backedge
while.end18: ; preds = %while.cond8, %while.cond8
store i8 0, ptr %s.addr.0, align 1, !tbaa !17
ret i32 %len.0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @nextstrln(ptr nocapture noundef writeonly %s) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !9
%_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 !11
%_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 !15
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !16
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #5
br label %while.cond.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 !11
%3 = load i8, ptr %1, align 1, !tbaa !17
%conv3.i = zext i8 %3 to i32
br label %while.cond.preheader
while.cond.preheader: ; preds = %cond.true.i, %cond.false.i
%c.0.in.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ]
br label %while.cond
while.cond: ; preds = %while.cond.backedge, %while.cond.preheader
%c.0.in = phi i32 [ %c.0.in.ph, %while.cond.preheader ], [ %c.0.in.be, %while.cond.backedge ]
%sext = shl i32 %c.0.in, 24
switch i32 %sext, label %while.cond8.preheader [
i32 536870912, label %while.body
i32 167772160, label %while.body
]
while.cond8.preheader: ; preds = %while.cond
%sext21.mask42 = and i32 %c.0.in, 255
%cmp10.not43 = icmp eq i32 %sext21.mask42, 10
br i1 %cmp10.not43, label %while.end15, label %while.body12
while.body: ; preds = %while.cond, %while.cond
%4 = load ptr, ptr @stdin, align 8, !tbaa !9
%_IO_read_ptr.i22 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i22, align 8, !tbaa !11
%_IO_read_end.i23 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i23, align 8, !tbaa !15
%cmp.not.i24 = icmp ult ptr %5, %6
br i1 %cmp.not.i24, label %cond.false.i28, label %cond.true.i25, !prof !16
cond.true.i25: ; preds = %while.body
%call.i26 = tail call i32 @__uflow(ptr noundef nonnull %4) #5
br label %while.cond.backedge
while.cond.backedge: ; preds = %cond.true.i25, %cond.false.i28
%c.0.in.be = phi i32 [ %call.i26, %cond.true.i25 ], [ %conv3.i30, %cond.false.i28 ]
br label %while.cond, !llvm.loop !25
cond.false.i28: ; preds = %while.body
%incdec.ptr.i29 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i29, ptr %_IO_read_ptr.i22, align 8, !tbaa !11
%7 = load i8, ptr %5, align 1, !tbaa !17
%conv3.i30 = zext i8 %7 to i32
br label %while.cond.backedge
while.body12: ; preds = %while.cond8.preheader, %getc_unlocked.exit41
%len.046 = phi i32 [ %inc, %getc_unlocked.exit41 ], [ 0, %while.cond8.preheader ]
%c.1.in45 = phi i32 [ %cond.i37, %getc_unlocked.exit41 ], [ %c.0.in, %while.cond8.preheader ]
%s.addr.044 = phi ptr [ %incdec.ptr, %getc_unlocked.exit41 ], [ %s, %while.cond8.preheader ]
%c.1 = trunc i32 %c.1.in45 to i8
%incdec.ptr = getelementptr inbounds i8, ptr %s.addr.044, i64 1
store i8 %c.1, ptr %s.addr.044, align 1, !tbaa !17
%inc = add i32 %len.046, 1
%8 = load ptr, ptr @stdin, align 8, !tbaa !9
%_IO_read_ptr.i32 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 1
%9 = load ptr, ptr %_IO_read_ptr.i32, align 8, !tbaa !11
%_IO_read_end.i33 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 2
%10 = load ptr, ptr %_IO_read_end.i33, align 8, !tbaa !15
%cmp.not.i34 = icmp ult ptr %9, %10
br i1 %cmp.not.i34, label %cond.false.i38, label %cond.true.i35, !prof !16
cond.true.i35: ; preds = %while.body12
%call.i36 = tail call i32 @__uflow(ptr noundef nonnull %8) #5
br label %getc_unlocked.exit41
cond.false.i38: ; preds = %while.body12
%incdec.ptr.i39 = getelementptr inbounds i8, ptr %9, i64 1
store ptr %incdec.ptr.i39, ptr %_IO_read_ptr.i32, align 8, !tbaa !11
%11 = load i8, ptr %9, align 1, !tbaa !17
%conv3.i40 = zext i8 %11 to i32
br label %getc_unlocked.exit41
getc_unlocked.exit41: ; preds = %cond.true.i35, %cond.false.i38
%cond.i37 = phi i32 [ %call.i36, %cond.true.i35 ], [ %conv3.i40, %cond.false.i38 ]
%sext21.mask = and i32 %cond.i37, 255
%cmp10.not = icmp eq i32 %sext21.mask, 10
br i1 %cmp10.not, label %while.end15, label %while.body12, !llvm.loop !26
while.end15: ; preds = %getc_unlocked.exit41, %while.cond8.preheader
%s.addr.0.lcssa = phi ptr [ %s, %while.cond8.preheader ], [ %incdec.ptr, %getc_unlocked.exit41 ]
%len.0.lcssa = phi i32 [ 0, %while.cond8.preheader ], [ %inc, %getc_unlocked.exit41 ]
store i8 0, ptr %s.addr.0.lcssa, align 1, !tbaa !17
ret i32 %len.0.lcssa
}
; Function Attrs: nounwind uwtable
define dso_local void @printint(i32 noundef %x) local_unnamed_addr #1 {
entry:
%s = alloca [10 x i8], align 1
%cmp = icmp slt i32 %x, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%sub = sub nsw i32 0, %x
%0 = load ptr, ptr @stdout, align 8, !tbaa !9
%_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 5
%1 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !27
%_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 6
%2 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !28
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !16
cond.true.i: ; preds = %if.then
%call.i = tail call i32 @__overflow(ptr noundef nonnull %0, i32 noundef 45) #5
br label %while.body.preheader
cond.false.i: ; preds = %if.then
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !27
store i8 45, ptr %1, align 1, !tbaa !17
br label %while.body.preheader
if.else: ; preds = %entry
%cmp1 = icmp eq i32 %x, 0
br i1 %cmp1, label %if.then2, label %while.body.preheader
if.then2: ; preds = %if.else
%3 = load ptr, ptr @stdout, align 8, !tbaa !9
%_IO_write_ptr.i22 = getelementptr inbounds %struct._IO_FILE, ptr %3, i64 0, i32 5
%4 = load ptr, ptr %_IO_write_ptr.i22, align 8, !tbaa !27
%_IO_write_end.i23 = getelementptr inbounds %struct._IO_FILE, ptr %3, i64 0, i32 6
%5 = load ptr, ptr %_IO_write_end.i23, align 8, !tbaa !28
%cmp.not.i24 = icmp ult ptr %4, %5
br i1 %cmp.not.i24, label %cond.false.i28, label %cond.true.i25, !prof !16
cond.true.i25: ; preds = %if.then2
%call.i26 = tail call i32 @__overflow(ptr noundef nonnull %3, i32 noundef 48) #5
br label %for.cond.preheader.thread
cond.false.i28: ; preds = %if.then2
%incdec.ptr.i29 = getelementptr inbounds i8, ptr %4, i64 1
store ptr %incdec.ptr.i29, ptr %_IO_write_ptr.i22, align 8, !tbaa !27
store i8 48, ptr %4, align 1, !tbaa !17
br label %for.cond.preheader.thread
for.cond.preheader.thread: ; preds = %cond.true.i25, %cond.false.i28
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %s) #5
br label %for.cond.cleanup
while.body.preheader: ; preds = %if.else, %cond.true.i, %cond.false.i
%x.addr.0.ph = phi i32 [ %sub, %cond.false.i ], [ %sub, %cond.true.i ], [ %x, %if.else ]
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %s) #5
br label %while.body
for.cond.preheader: ; preds = %while.body
%6 = trunc i64 %indvars.iv.next to i32
%cmp652 = icmp sgt i32 %6, 0
br i1 %cmp652, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %for.cond.preheader
%7 = and i64 %indvars.iv.next, 4294967295
br label %for.body
while.body: ; preds = %while.body.preheader, %while.body
%indvars.iv = phi i64 [ 0, %while.body.preheader ], [ %indvars.iv.next, %while.body ]
%x.addr.150 = phi i32 [ %x.addr.0.ph, %while.body.preheader ], [ %div, %while.body ]
%rem = srem i32 %x.addr.150, 10
%8 = trunc i32 %rem to i8
%conv = add nsw i8 %8, 48
%arrayidx = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 %indvars.iv
store i8 %conv, ptr %arrayidx, align 1, !tbaa !17
%div = sdiv i32 %x.addr.150, 10
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%x.addr.150.off = add i32 %x.addr.150, 9
%tobool.not = icmp ult i32 %x.addr.150.off, 19
br i1 %tobool.not, label %for.cond.preheader, label %while.body, !llvm.loop !29
for.cond.cleanup: ; preds = %putc_unlocked.exit48, %for.cond.preheader.thread, %for.cond.preheader
%9 = load ptr, ptr @stdout, align 8, !tbaa !9
%_IO_write_ptr.i31 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 5
%10 = load ptr, ptr %_IO_write_ptr.i31, align 8, !tbaa !27
%_IO_write_end.i32 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 6
%11 = load ptr, ptr %_IO_write_end.i32, align 8, !tbaa !28
%cmp.not.i33 = icmp ult ptr %10, %11
br i1 %cmp.not.i33, label %cond.false.i37, label %cond.true.i34, !prof !16
cond.true.i34: ; preds = %for.cond.cleanup
%call.i35 = tail call i32 @__overflow(ptr noundef nonnull %9, i32 noundef 10) #5
br label %putc_unlocked.exit39
cond.false.i37: ; preds = %for.cond.cleanup
%incdec.ptr.i38 = getelementptr inbounds i8, ptr %10, i64 1
store ptr %incdec.ptr.i38, ptr %_IO_write_ptr.i31, align 8, !tbaa !27
store i8 10, ptr %10, align 1, !tbaa !17
br label %putc_unlocked.exit39
putc_unlocked.exit39: ; preds = %cond.true.i34, %cond.false.i37
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %s) #5
ret void
for.body: ; preds = %for.body.preheader, %putc_unlocked.exit48
%indvars.iv55 = phi i64 [ %7, %for.body.preheader ], [ %indvars.iv.next56, %putc_unlocked.exit48 ]
%indvars.iv.next56 = add nsw i64 %indvars.iv55, -1
%idxprom8 = and i64 %indvars.iv.next56, 4294967295
%arrayidx9 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 %idxprom8
%12 = load i8, ptr %arrayidx9, align 1, !tbaa !17
%13 = load ptr, ptr @stdout, align 8, !tbaa !9
%_IO_write_ptr.i40 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 5
%14 = load ptr, ptr %_IO_write_ptr.i40, align 8, !tbaa !27
%_IO_write_end.i41 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 6
%15 = load ptr, ptr %_IO_write_end.i41, align 8, !tbaa !28
%cmp.not.i42 = icmp ult ptr %14, %15
br i1 %cmp.not.i42, label %cond.false.i46, label %cond.true.i43, !prof !16
cond.true.i43: ; preds = %for.body
%conv10 = zext i8 %12 to i32
%call.i44 = tail call i32 @__overflow(ptr noundef nonnull %13, i32 noundef %conv10) #5
br label %putc_unlocked.exit48
cond.false.i46: ; preds = %for.body
%incdec.ptr.i47 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr.i47, ptr %_IO_write_ptr.i40, align 8, !tbaa !27
store i8 %12, ptr %14, align 1, !tbaa !17
br label %putc_unlocked.exit48
putc_unlocked.exit48: ; preds = %cond.true.i43, %cond.false.i46
%cmp6 = icmp ugt i64 %indvars.iv55, 1
br i1 %cmp6, label %for.body, label %for.cond.cleanup, !llvm.loop !30
}
; Function Attrs: nounwind uwtable
define dso_local void @printlong(i64 noundef %x) local_unnamed_addr #1 {
entry:
%s = alloca [20 x i8], align 16
%cmp = icmp slt i64 %x, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%sub = sub nsw i64 0, %x
%0 = load ptr, ptr @stdout, align 8, !tbaa !9
%_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 5
%1 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !27
%_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 6
%2 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !28
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !16
cond.true.i: ; preds = %if.then
%call.i = tail call i32 @__overflow(ptr noundef nonnull %0, i32 noundef 45) #5
br label %while.body.preheader
cond.false.i: ; preds = %if.then
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !27
store i8 45, ptr %1, align 1, !tbaa !17
br label %while.body.preheader
if.else: ; preds = %entry
%cmp1 = icmp eq i64 %x, 0
br i1 %cmp1, label %if.then2, label %while.body.preheader
if.then2: ; preds = %if.else
%3 = load ptr, ptr @stdout, align 8, !tbaa !9
%_IO_write_ptr.i21 = getelementptr inbounds %struct._IO_FILE, ptr %3, i64 0, i32 5
%4 = load ptr, ptr %_IO_write_ptr.i21, align 8, !tbaa !27
%_IO_write_end.i22 = getelementptr inbounds %struct._IO_FILE, ptr %3, i64 0, i32 6
%5 = load ptr, ptr %_IO_write_end.i22, align 8, !tbaa !28
%cmp.not.i23 = icmp ult ptr %4, %5
br i1 %cmp.not.i23, label %cond.false.i27, label %cond.true.i24, !prof !16
cond.true.i24: ; preds = %if.then2
%call.i25 = tail call i32 @__overflow(ptr noundef nonnull %3, i32 noundef 48) #5
br label %for.cond.preheader.thread
cond.false.i27: ; preds = %if.then2
%incdec.ptr.i28 = getelementptr inbounds i8, ptr %4, i64 1
store ptr %incdec.ptr.i28, ptr %_IO_write_ptr.i21, align 8, !tbaa !27
store i8 48, ptr %4, align 1, !tbaa !17
br label %for.cond.preheader.thread
for.cond.preheader.thread: ; preds = %cond.true.i24, %cond.false.i27
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %s) #5
br label %for.cond.cleanup
while.body.preheader: ; preds = %if.else, %cond.true.i, %cond.false.i
%x.addr.0.ph = phi i64 [ %sub, %cond.false.i ], [ %sub, %cond.true.i ], [ %x, %if.else ]
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %s) #5
br label %while.body
for.cond.preheader: ; preds = %while.body
%6 = trunc i64 %indvars.iv.next to i32
%cmp642 = icmp sgt i32 %6, 0
br i1 %cmp642, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %for.cond.preheader
%7 = and i64 %indvars.iv.next, 4294967295
br label %for.body
while.body: ; preds = %while.body.preheader, %while.body
%indvars.iv = phi i64 [ 0, %while.body.preheader ], [ %indvars.iv.next, %while.body ]
%x.addr.140 = phi i64 [ %x.addr.0.ph, %while.body.preheader ], [ %div, %while.body ]
%rem = srem i64 %x.addr.140, 10
%8 = trunc i64 %rem to i8
%conv = add nsw i8 %8, 48
%arrayidx = getelementptr inbounds [20 x i8], ptr %s, i64 0, i64 %indvars.iv
store i8 %conv, ptr %arrayidx, align 1, !tbaa !17
%div = sdiv i64 %x.addr.140, 10
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%x.addr.140.off = add i64 %x.addr.140, 9
%tobool.not = icmp ult i64 %x.addr.140.off, 19
br i1 %tobool.not, label %for.cond.preheader, label %while.body, !llvm.loop !31
for.cond.cleanup: ; preds = %putc_unlocked.exit38, %for.cond.preheader.thread, %for.cond.preheader
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %s) #5
ret void
for.body: ; preds = %for.body.preheader, %putc_unlocked.exit38
%indvars.iv45 = phi i64 [ %7, %for.body.preheader ], [ %indvars.iv.next46, %putc_unlocked.exit38 ]
%indvars.iv.next46 = add nsw i64 %indvars.iv45, -1
%idxprom8 = and i64 %indvars.iv.next46, 4294967295
%arrayidx9 = getelementptr inbounds [20 x i8], ptr %s, i64 0, i64 %idxprom8
%9 = load i8, ptr %arrayidx9, align 1, !tbaa !17
%10 = load ptr, ptr @stdout, align 8, !tbaa !9
%_IO_write_ptr.i30 = getelementptr inbounds %struct._IO_FILE, ptr %10, i64 0, i32 5
%11 = load ptr, ptr %_IO_write_ptr.i30, align 8, !tbaa !27
%_IO_write_end.i31 = getelementptr inbounds %struct._IO_FILE, ptr %10, i64 0, i32 6
%12 = load ptr, ptr %_IO_write_end.i31, align 8, !tbaa !28
%cmp.not.i32 = icmp ult ptr %11, %12
br i1 %cmp.not.i32, label %cond.false.i36, label %cond.true.i33, !prof !16
cond.true.i33: ; preds = %for.body
%conv10 = zext i8 %9 to i32
%call.i34 = tail call i32 @__overflow(ptr noundef nonnull %10, i32 noundef %conv10) #5
br label %putc_unlocked.exit38
cond.false.i36: ; preds = %for.body
%incdec.ptr.i37 = getelementptr inbounds i8, ptr %11, i64 1
store ptr %incdec.ptr.i37, ptr %_IO_write_ptr.i30, align 8, !tbaa !27
store i8 %9, ptr %11, align 1, !tbaa !17
br label %putc_unlocked.exit38
putc_unlocked.exit38: ; preds = %cond.true.i33, %cond.false.i36
%cmp6 = icmp ugt i64 %indvars.iv45, 1
br i1 %cmp6, label %for.body, label %for.cond.cleanup, !llvm.loop !32
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call = tail call i32 @nextpint()
%call1 = tail call i32 @nextpint()
%call2 = tail call i32 @nextpint()
%call3 = tail call i32 @nextstr(ptr noundef nonnull @s)
%cmp76 = icmp sgt i32 %call, 0
br i1 %cmp76, label %for.body, label %for.cond.cleanup13
for.cond10.preheader: ; preds = %for.inc
br i1 %cmp76, label %for.body14, label %for.cond.cleanup13
for.body: ; preds = %entry, %for.inc
%h.078 = phi i32 [ %h.1, %for.inc ], [ 0, %entry ]
%i.077 = phi i32 [ %inc8, %for.inc ], [ 0, %entry ]
%idxprom = sext i32 %i.077 to i64
%arrayidx = getelementptr inbounds [200001 x i8], ptr @s, i64 0, i64 %idxprom
%0 = load i8, ptr %arrayidx, align 1, !tbaa !17
%cmp4 = icmp eq i8 %0, 111
br i1 %cmp4, label %if.then, label %for.inc
if.then: ; preds = %for.body
%inc = add nsw i32 %h.078, 1
%idxprom6 = sext i32 %inc to i64
%arrayidx7 = getelementptr inbounds [200001 x i32], ptr @l, i64 0, i64 %idxprom6
store i32 %i.077, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %i.077, %call2
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%i.1 = phi i32 [ %add, %if.then ], [ %i.077, %for.body ]
%h.1 = phi i32 [ %inc, %if.then ], [ %h.078, %for.body ]
%inc8 = add nsw i32 %i.1, 1
%cmp = icmp slt i32 %inc8, %call
br i1 %cmp, label %for.body, label %for.cond10.preheader, !llvm.loop !33
for.cond.cleanup13: ; preds = %for.inc26, %entry, %for.cond10.preheader
%h.2.lcssa = phi i32 [ 0, %for.cond10.preheader ], [ 0, %entry ], [ %h.3, %for.inc26 ]
%sub29 = sub nsw i32 %call1, %h.2.lcssa
%1 = tail call i32 @llvm.smax.i32(i32 %sub29, i32 0)
%cond.i75 = tail call i32 @llvm.smin.i32(i32 %h.2.lcssa, i32 %call1)
%cmp34.not.not84 = icmp slt i32 %1, %cond.i75
br i1 %cmp34.not.not84, label %for.body37.lr.ph, label %for.cond.cleanup36
for.body37.lr.ph: ; preds = %for.cond.cleanup13
%2 = zext i32 %1 to i64
%wide.trip.count = zext i32 %cond.i75 to i64
br label %for.body37
for.body14: ; preds = %for.cond10.preheader, %for.inc26
%i9.082.in = phi i32 [ %i9.1, %for.inc26 ], [ %call, %for.cond10.preheader ]
%h.281 = phi i32 [ %h.3, %for.inc26 ], [ 0, %for.cond10.preheader ]
%i9.082 = add nsw i32 %i9.082.in, -1
%idxprom15 = zext i32 %i9.082 to i64
%arrayidx16 = getelementptr inbounds [200001 x i8], ptr @s, i64 0, i64 %idxprom15
%3 = load i8, ptr %arrayidx16, align 1, !tbaa !17
%cmp18 = icmp eq i8 %3, 111
br i1 %cmp18, label %if.then20, label %for.inc26
if.then20: ; preds = %for.body14
%inc21 = add nsw i32 %h.281, 1
%idxprom22 = sext i32 %inc21 to i64
%arrayidx23 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %idxprom22
store i32 %i9.082, ptr %arrayidx23, align 4, !tbaa !5
%sub24 = sub nsw i32 %i9.082, %call2
br label %for.inc26
for.inc26: ; preds = %for.body14, %if.then20
%i9.1 = phi i32 [ %sub24, %if.then20 ], [ %i9.082, %for.body14 ]
%h.3 = phi i32 [ %inc21, %if.then20 ], [ %h.281, %for.body14 ]
%cmp11 = icmp sgt i32 %i9.1, 0
br i1 %cmp11, label %for.body14, label %for.cond.cleanup13, !llvm.loop !34
for.cond.cleanup36: ; preds = %for.inc51, %for.cond.cleanup13
ret i32 0
for.body37: ; preds = %for.body37.lr.ph, %for.inc51
%indvars.iv = phi i64 [ %2, %for.body37.lr.ph ], [ %indvars.iv.next, %for.inc51 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%idxprom38 = and i64 %indvars.iv.next, 4294967295
%arrayidx39 = getelementptr inbounds [200001 x i32], ptr @l, i64 0, i64 %idxprom38
%4 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%5 = trunc i64 %indvars.iv to i32
%add41 = sub i32 %call1, %5
%idxprom42 = sext i32 %add41 to i64
%arrayidx43 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %idxprom42
%6 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%cmp44 = icmp eq i32 %4, %6
br i1 %cmp44, label %if.then46, label %for.inc51
if.then46: ; preds = %for.body37
%add49 = add nsw i32 %4, 1
tail call void @printint(i32 noundef %add49)
br label %for.inc51
for.inc51: ; preds = %for.body37, %if.then46
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup36, label %for.body37, !llvm.loop !35
}
declare i32 @__uflow(ptr noundef) local_unnamed_addr #3
declare i32 @__overflow(ptr noundef, 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 = { 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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { "no-trapping-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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_IO_FILE", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !6, i64 112, !6, i64 116, !13, i64 120, !14, i64 128, !7, i64 130, !7, i64 131, !10, i64 136, !13, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !13, i64 184, !6, i64 192, !7, i64 196}
!13 = !{!"long", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!12, !10, i64 16}
!16 = !{!"branch_weights", i32 2000, i32 1}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}
!21 = distinct !{!21, !19}
!22 = distinct !{!22, !19}
!23 = distinct !{!23, !19}
!24 = distinct !{!24, !19}
!25 = distinct !{!25, !19}
!26 = distinct !{!26, !19}
!27 = !{!12, !10, i64 40}
!28 = !{!12, !10, i64 48}
!29 = distinct !{!29, !19}
!30 = distinct !{!30, !19}
!31 = distinct !{!31, !19}
!32 = distinct !{!32, !19}
!33 = distinct !{!33, !19}
!34 = distinct !{!34, !19}
!35 = distinct !{!35, !19}
|
#include <stdio.h>
#define swap(type, x, y) do{ type t = x; x = y; y = t; }while(0)
void quick(int array[], int left, int right){
int pl = left, pr = right, x = array[(left + right) / 2];
do{
while(array[pl] < x) pl++;
while(array[pr] > x) pr--;
if(pl <= pr){
swap(int, array[pl], array[pr]);
pl++, pr--;
}
}while(pl <= pr);
if(pl < right) quick(array, pl, right);
if(pr > left) quick(array, left, pr);
}
int main(){
int n, m, d[200005], t[200005];
scanf("%d", &n);
for(int i=0; i<n; i++) scanf("%d", d+i);
quick(d, 0, n-1);
scanf("%d", &m);
for(int i=0; i<m; i++) scanf("%d", t+i);
quick(t, 0, m-1);
int flag = 1, start = 0;
for(int i=0; i<m; i++){
int notFound = 1;
for(int j=start; (d[j]<=t[i] && j<n); j++)
if(d[j] == t[i]){
notFound = 0;
start = j + 1;
break;
}
if(notFound){
flag = 0;
break;
}
}
if(flag) printf("YES\n");
else printf("NO\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287536/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287536/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @quick(ptr nocapture noundef %array, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end26, %entry
%right.tr = phi i32 [ %right, %entry ], [ %pr.2, %if.end26 ]
%add = add nsw i32 %right.tr, %left
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
br label %do.body
do.body: ; preds = %do.cond21, %tailrecurse
%pr.0 = phi i32 [ %right.tr, %tailrecurse ], [ %pr.2, %do.cond21 ]
%pl.0 = phi i32 [ %left, %tailrecurse ], [ %pl.2, %do.cond21 ]
%1 = sext i32 %pl.0 to i64
br label %while.cond
while.cond: ; preds = %while.cond, %do.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ %1, %do.body ]
%arrayidx2 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%2 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp = icmp slt i32 %2, %0
%indvars.iv.next = add i64 %indvars.iv, 1
br i1 %cmp, label %while.cond, label %while.cond3.preheader, !llvm.loop !9
while.cond3.preheader: ; preds = %while.cond
%arrayidx2.le = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%3 = trunc i64 %indvars.iv to i32
%4 = sext i32 %pr.0 to i64
br label %while.cond3
while.cond3: ; preds = %while.cond3, %while.cond3.preheader
%indvars.iv64 = phi i64 [ %indvars.iv.next65, %while.cond3 ], [ %4, %while.cond3.preheader ]
%arrayidx5 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv64
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %5, %0
%indvars.iv.next65 = add i64 %indvars.iv64, -1
br i1 %cmp6, label %while.cond3, label %while.end8, !llvm.loop !11
while.end8: ; preds = %while.cond3
%6 = trunc i64 %indvars.iv64 to i32
%cmp9.not = icmp sgt i32 %3, %6
br i1 %cmp9.not, label %do.cond21, label %do.body10
do.body10: ; preds = %while.end8
%arrayidx5.le = getelementptr inbounds i32, ptr %array, i64 %indvars.iv64
store i32 %5, ptr %arrayidx2.le, align 4, !tbaa !5
store i32 %2, ptr %arrayidx5.le, align 4, !tbaa !5
%inc19 = add nsw i32 %3, 1
%dec20 = add nsw i32 %6, -1
br label %do.cond21
do.cond21: ; preds = %while.end8, %do.body10
%pr.2 = phi i32 [ %dec20, %do.body10 ], [ %6, %while.end8 ]
%pl.2 = phi i32 [ %inc19, %do.body10 ], [ %3, %while.end8 ]
%cmp22.not = icmp sgt i32 %pl.2, %pr.2
br i1 %cmp22.not, label %do.end23, label %do.body, !llvm.loop !12
do.end23: ; preds = %do.cond21
%cmp24 = icmp slt i32 %pl.2, %right.tr
br i1 %cmp24, label %if.then25, label %if.end26
if.then25: ; preds = %do.end23
tail call void @quick(ptr noundef nonnull %array, i32 noundef %pl.2, i32 noundef %right.tr)
br label %if.end26
if.end26: ; preds = %if.then25, %do.end23
%cmp27 = icmp sgt i32 %pr.2, %left
br i1 %cmp27, label %tailrecurse, label %if.end29
if.end29: ; preds = %if.end26
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
%m = alloca i32, align 4
%d = alloca [200005 x i32], align 16
%t = alloca [200005 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 800020, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 800020, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp79 = icmp sgt i32 %0, 0
br i1 %cmp79, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa78 = phi i32 [ %0, %entry ], [ %2, %for.body ]
%sub = add nsw i32 %.lcssa78, -1
call void @quick(ptr noundef nonnull %d, i32 noundef 0, i32 noundef %sub)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%1 = load i32, ptr %m, align 4, !tbaa !5
%cmp681 = icmp sgt i32 %1, 0
br i1 %cmp681, label %for.body8, label %for.cond.cleanup7.thread
for.cond.cleanup7.thread: ; preds = %for.cond.cleanup
%sub17107 = add nsw i32 %1, -1
call void @quick(ptr noundef nonnull %t, i32 noundef 0, i32 noundef %sub17107)
br label %if.end49
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %d, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.cond.cleanup7: ; preds = %for.body8
%sub17 = add nsw i32 %6, -1
call void @quick(ptr noundef nonnull %t, i32 noundef 0, i32 noundef %sub17)
%cmp2089 = icmp sgt i32 %6, 0
br i1 %cmp2089, label %for.cond23.preheader.lr.ph, label %if.end49
for.cond23.preheader.lr.ph: ; preds = %for.cond.cleanup7
%4 = load i32, ptr %n, align 4
%5 = sext i32 %4 to i64
%wide.trip.count = zext i32 %6 to i64
br label %for.cond23.preheader
for.body8: ; preds = %for.cond.cleanup, %for.body8
%indvars.iv97 = phi i64 [ %indvars.iv.next98, %for.body8 ], [ 0, %for.cond.cleanup ]
%add.ptr11 = getelementptr inbounds i32, ptr %t, i64 %indvars.iv97
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr11)
%indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
%6 = load i32, ptr %m, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp6 = icmp slt i64 %indvars.iv.next98, %7
br i1 %cmp6, label %for.body8, label %for.cond.cleanup7, !llvm.loop !14
for.cond23.preheader: ; preds = %for.cond23.preheader.lr.ph, %for.inc41
%indvars.iv103 = phi i64 [ 0, %for.cond23.preheader.lr.ph ], [ %indvars.iv.next104, %for.inc41 ]
%start.090 = phi i32 [ 0, %for.cond23.preheader.lr.ph ], [ %add, %for.inc41 ]
%arrayidx25 = getelementptr inbounds [200005 x i32], ptr %t, i64 0, i64 %indvars.iv103
%8 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%idxprom84 = sext i32 %start.090 to i64
%arrayidx85 = getelementptr inbounds [200005 x i32], ptr %d, i64 0, i64 %idxprom84
%9 = load i32, ptr %arrayidx85, align 4, !tbaa !5
%cmp2686 = icmp sle i32 %9, %8
%cmp2787 = icmp slt i32 %start.090, %4
%10 = select i1 %cmp2686, i1 %cmp2787, i1 false
br i1 %10, label %for.body29, label %if.end49
for.body29: ; preds = %for.cond23.preheader, %for.inc35
%indvars.iv100 = phi i64 [ %indvars.iv.next101, %for.inc35 ], [ %idxprom84, %for.cond23.preheader ]
%11 = phi i32 [ %12, %for.inc35 ], [ %9, %for.cond23.preheader ]
%cmp34 = icmp eq i32 %11, %8
br i1 %cmp34, label %for.inc41, label %for.inc35
for.inc35: ; preds = %for.body29
%indvars.iv.next101 = add nsw i64 %indvars.iv100, 1
%arrayidx = getelementptr inbounds [200005 x i32], ptr %d, i64 0, i64 %indvars.iv.next101
%12 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp26 = icmp sle i32 %12, %8
%cmp27 = icmp slt i64 %indvars.iv.next101, %5
%13 = select i1 %cmp26, i1 %cmp27, i1 false
br i1 %13, label %for.body29, label %if.end49, !llvm.loop !15
for.inc41: ; preds = %for.body29
%14 = trunc i64 %indvars.iv100 to i32
%add = add nsw i32 %14, 1
%indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
%exitcond.not = icmp eq i64 %indvars.iv.next104, %wide.trip.count
br i1 %exitcond.not, label %if.end49, label %for.cond23.preheader, !llvm.loop !16
if.end49: ; preds = %for.cond23.preheader, %for.inc41, %for.inc35, %for.cond.cleanup7, %for.cond.cleanup7.thread
%str.sink = phi ptr [ @str.3, %for.cond.cleanup7.thread ], [ @str.3, %for.cond.cleanup7 ], [ @str, %for.inc35 ], [ @str.3, %for.inc41 ], [ @str, %for.cond23.preheader ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 800020, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 800020, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree 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 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,j,temp,testcase,*num1,*num2;
scanf("%d",&testcase);
num1 = (int*)malloc(sizeof(int*)*testcase);
num2 = (int*)malloc(sizeof(int*)*testcase);
for(i=0;i<testcase;i++)
{
scanf("%d",&num1[i]);
scanf("%d",&num2[i]);
}
for(i=0;i<testcase;i++)
{
temp = num1[i] - num2[i];
if(temp == 0)
printf("YES\n");
else if (temp > 0)
printf("YES\n");
else
{
if(num1[i] % 2 != 0 && num1[i] != 1)
num1[i] = num1[i] - 1 ;
if(num1[i] == 1 ||num1[i] == 2 && num2[i]>3 ||num1[i]== 3)
printf("NO\n");
else
{
printf("YES\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28758/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28758/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%testcase = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %testcase) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %testcase)
%0 = load i32, ptr %testcase, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #6
%call4 = call noalias ptr @malloc(i64 noundef %mul) #6
%cmp99 = icmp sgt i32 %0, 0
br i1 %cmp99, label %for.body, label %for.end67
for.cond10.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body13, label %for.end67
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
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%arrayidx8 = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx8)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %testcase, 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.cond10.preheader, !llvm.loop !9
for.body13: ; preds = %for.cond10.preheader, %for.inc65
%indvars.iv104 = phi i64 [ %indvars.iv.next105, %for.inc65 ], [ 0, %for.cond10.preheader ]
%arrayidx15 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv104
%4 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%arrayidx17 = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv104
%5 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%cmp18 = icmp eq i32 %4, %5
br i1 %cmp18, label %for.inc65, label %if.else
if.else: ; preds = %for.body13
%cmp21 = icmp sgt i32 %4, %5
br i1 %cmp21, label %for.inc65, label %if.else25
if.else25: ; preds = %if.else
%6 = and i32 %4, 1
%cmp28.not = icmp eq i32 %6, 0
%cmp32.not = icmp eq i32 %4, 1
%or.cond = or i1 %cmp32.not, %cmp28.not
br i1 %or.cond, label %if.end, label %if.then34
if.then34: ; preds = %if.else25
%sub37 = add nsw i32 %4, -1
store i32 %sub37, ptr %arrayidx15, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else25, %if.then34
%7 = phi i32 [ %sub37, %if.then34 ], [ %4, %if.else25 ]
switch i32 %7, label %if.else60 [
i32 1, label %for.inc65
i32 2, label %land.lhs.true48
i32 3, label %for.inc65
]
land.lhs.true48: ; preds = %if.end
%cmp51 = icmp sgt i32 %5, 3
br i1 %cmp51, label %for.inc65, label %if.else60
if.else60: ; preds = %if.end, %land.lhs.true48
br label %for.inc65
for.inc65: ; preds = %land.lhs.true48, %if.end, %if.end, %if.else, %for.body13, %if.else60
%str.5.sink = phi ptr [ @str.5, %if.else60 ], [ @str.5, %for.body13 ], [ @str.5, %if.else ], [ @str.3, %if.end ], [ @str.3, %if.end ], [ @str.3, %land.lhs.true48 ]
%puts97 = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.sink)
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%8 = load i32, ptr %testcase, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp11 = icmp slt i64 %indvars.iv.next105, %9
br i1 %cmp11, label %for.body13, label %for.end67, !llvm.loop !11
for.end67: ; preds = %for.inc65, %entry, %for.cond10.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %testcase) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void){
int a,b,ans,i,ansc,kk=0;
while(1){
ansc=0;
scanf("%d%d",&a,&b);
if(a==0&&b==0){
break;
}
if(kk!=0){
printf("\n");
}
for(i=a;i<=b;i++){
if (i%4==0 && i%100!=0||i%400==0){
printf("%d\n",i);
ansc++;
}else if(i==b&&ansc==0){
printf("NA\n");
}
}
kk++;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287622/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287622/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NA\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp40 = icmp eq i32 %0, 0
%1 = load i32, ptr %b, align 4
%cmp141 = icmp eq i32 %1, 0
%or.cond42 = select i1 %cmp40, i1 %cmp141, i1 false
br i1 %or.cond42, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end
%2 = phi i32 [ %10, %for.end ], [ %1, %entry ]
%3 = phi i32 [ %9, %for.end ], [ %0, %entry ]
%kk.043 = phi i32 [ %inc23, %for.end ], [ 0, %entry ]
%cmp2.not = icmp eq i32 %kk.043, 0
br i1 %cmp2.not, label %if.end5, label %if.then3
if.then3: ; preds = %if.end
%putchar = call i32 @putchar(i32 10)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre44 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end5
if.end5: ; preds = %if.then3, %if.end
%4 = phi i32 [ %.pre44, %if.then3 ], [ %2, %if.end ]
%5 = phi i32 [ %.pre, %if.then3 ], [ %3, %if.end ]
%cmp6.not36 = icmp sgt i32 %5, %4
br i1 %cmp6.not36, label %for.end, label %for.body
for.body: ; preds = %if.end5, %for.inc
%6 = phi i32 [ %8, %for.inc ], [ %4, %if.end5 ]
%ansc.038 = phi i32 [ %ansc.1, %for.inc ], [ 0, %if.end5 ]
%i.037 = phi i32 [ %inc22, %for.inc ], [ %5, %if.end5 ]
%7 = and i32 %i.037, 3
%cmp7 = icmp eq i32 %7, 0
%rem9 = srem i32 %i.037, 100
%cmp10.not = icmp ne i32 %rem9, 0
%or.cond33.not35 = and i1 %cmp7, %cmp10.not
%rem11 = srem i32 %i.037, 400
%cmp12 = icmp eq i32 %rem11, 0
%or.cond34 = or i1 %cmp12, %or.cond33.not35
br i1 %or.cond34, label %if.then13, label %if.else
if.then13: ; preds = %for.body
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.037)
%inc = add nsw i32 %ansc.038, 1
br label %for.inc
if.else: ; preds = %for.body
%cmp15 = icmp eq i32 %i.037, %6
%cmp17 = icmp eq i32 %ansc.038, 0
%or.cond24 = select i1 %cmp15, i1 %cmp17, i1 false
br i1 %or.cond24, label %if.then18, label %for.inc
if.then18: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
for.inc: ; preds = %if.then13, %if.then18, %if.else
%ansc.1 = phi i32 [ %inc, %if.then13 ], [ 0, %if.then18 ], [ %ansc.038, %if.else ]
%inc22 = add nsw i32 %i.037, 1
%8 = load i32, ptr %b, align 4, !tbaa !5
%cmp6.not.not = icmp slt i32 %i.037, %8
br i1 %cmp6.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %if.end5
%inc23 = add nuw nsw i32 %kk.043, 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%9 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %b, 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 %if.end
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int a,b;
int i;
int flg;
int first=1;
while(1){
flg=0;
scanf("%d %d",&a,&b);
if(a==0 && b==0)break;
if(first)first=0;
else printf("\n");
for(i=a;i<=b;i++)
if((i%4==0 && i%100!=0) || (i%4==0 && i%400==0)){printf("%d\n",i);flg=1;}
if(flg==0)printf("NA\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287666/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287666/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NA\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp34 = icmp eq i32 %0, 0
%1 = load i32, ptr %b, align 4
%cmp135 = icmp eq i32 %1, 0
%or.cond36 = select i1 %cmp34, i1 %cmp135, i1 false
br i1 %or.cond36, label %while.end, label %if.end4
if.else.critedge: ; preds = %if.end21
%putchar = call i32 @putchar(i32 10)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre38 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end4
if.end4: ; preds = %entry, %if.else.critedge
%2 = phi i32 [ %.pre38, %if.else.critedge ], [ %1, %entry ]
%3 = phi i32 [ %.pre, %if.else.critedge ], [ %0, %entry ]
%cmp5.not30 = icmp sgt i32 %3, %2
br i1 %cmp5.not30, label %if.then19, label %for.body
for.body: ; preds = %if.end4, %for.inc
%4 = phi i32 [ %7, %for.inc ], [ %2, %if.end4 ]
%flg.032 = phi i32 [ %flg.1, %for.inc ], [ 0, %if.end4 ]
%i.031 = phi i32 [ %inc, %for.inc ], [ %3, %if.end4 ]
%5 = and i32 %i.031, 3
%cmp6 = icmp eq i32 %5, 0
%rem8 = srem i32 %i.031, 100
%cmp9.not = icmp ne i32 %rem8, 0
%or.cond28.not = and i1 %cmp9.not, %cmp6
br i1 %or.cond28.not, label %if.then15, label %lor.lhs.false
lor.lhs.false: ; preds = %for.body
%rem13 = srem i32 %i.031, 400
%6 = or i32 %5, %rem13
%or.cond29 = icmp eq i32 %6, 0
br i1 %or.cond29, label %if.then15, label %for.inc
if.then15: ; preds = %lor.lhs.false, %for.body
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.031)
%.pre39 = load i32, ptr %b, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %lor.lhs.false, %if.then15
%7 = phi i32 [ %.pre39, %if.then15 ], [ %4, %lor.lhs.false ]
%flg.1 = phi i32 [ 1, %if.then15 ], [ %flg.032, %lor.lhs.false ]
%inc = add nsw i32 %i.031, 1
%cmp5.not.not = icmp slt i32 %i.031, %7
br i1 %cmp5.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc
%cmp18 = icmp eq i32 %flg.1, 0
br i1 %cmp18, label %if.then19, label %if.end21
if.then19: ; preds = %if.end4, %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end21
if.end21: ; preds = %if.then19, %for.end
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%8 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp eq i32 %8, 0
%9 = load i32, ptr %b, 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 %if.else.critedge
while.end: ; preds = %if.end21, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int main()
{
int hajime[3000]={0};
int owari[3000]={0};
int i;
int x=0;
int count=0;
while(1){
scanf("%d %d",&hajime[x],&owari[x]);
if(hajime[x]==0&&owari[x]==0){
break;
}
x++;
}
x=0;
for(i=hajime[x]; i<=owari[x]; i++){
if(hajime[x]==0&&owari[x]==0){
break;
}
if(i%400==0){
printf("%d\n",i);
count++;
}
else if(i%100==0){
}
else if(i%4==0){
printf("%d\n",i);
count++;
}
else{
}
if(i==owari[x]){
if(count==0){
printf("NA\n");
}
if(hajime[x+1]!=0&&owari[x+1]!=0){
printf("\n");
}
x++;
i=hajime[x]-1;
count=0;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287730/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287730/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NA\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%hajime = alloca [3000 x i32], align 16
%owari = alloca [3000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 12000, ptr nonnull %hajime) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12000) %hajime, i8 0, i64 12000, i1 false)
call void @llvm.lifetime.start.p0(i64 12000, ptr nonnull %owari) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12000) %owari, i8 0, i64 12000, i1 false)
br label %while.cond
while.cond: ; preds = %if.end, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [3000 x i32], ptr %hajime, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [3000 x i32], ptr %owari, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 0
br i1 %cmp, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %while.cond
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp7 = icmp eq i32 %1, 0
br i1 %cmp7, label %while.end, label %if.end
if.end: ; preds = %land.lhs.true, %while.cond
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br label %while.cond
while.end: ; preds = %land.lhs.true
%2 = load i32, ptr %hajime, align 16, !tbaa !5
%3 = load i32, ptr %owari, align 16, !tbaa !5
%cmp12.not86 = icmp sgt i32 %2, %3
br i1 %cmp12.not86, label %for.end, label %for.body
for.body: ; preds = %while.end, %for.inc
%4 = phi i32 [ %12, %for.inc ], [ %3, %while.end ]
%arrayidx1191 = phi ptr [ %arrayidx11, %for.inc ], [ %owari, %while.end ]
%idxprom1090 = phi i64 [ %idxprom10.pre-phi, %for.inc ], [ 0, %while.end ]
%count.089 = phi i32 [ %count.2, %for.inc ], [ 0, %while.end ]
%x.188 = phi i32 [ %x.2, %for.inc ], [ 0, %while.end ]
%i.087 = phi i32 [ %inc62, %for.inc ], [ %2, %while.end ]
%arrayidx14 = getelementptr inbounds [3000 x i32], ptr %hajime, i64 0, i64 %idxprom1090
%5 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%6 = or i32 %5, %4
%or.cond = icmp eq i32 %6, 0
br i1 %or.cond, label %for.end, label %if.end21
if.end21: ; preds = %for.body
%rem = srem i32 %i.087, 400
%cmp22 = icmp eq i32 %rem, 0
br i1 %cmp22, label %if.end38.sink.split, label %if.else
if.else: ; preds = %if.end21
%rem26 = srem i32 %i.087, 100
%cmp27 = icmp ne i32 %rem26, 0
%7 = and i32 %i.087, 3
%cmp31 = icmp eq i32 %7, 0
%or.cond85 = and i1 %cmp27, %cmp31
br i1 %or.cond85, label %if.end38.sink.split, label %if.end38
if.end38.sink.split: ; preds = %if.else, %if.end21
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.087)
%inc34 = add nsw i32 %count.089, 1
br label %if.end38
if.end38: ; preds = %if.end38.sink.split, %if.else
%count.1 = phi i32 [ %count.089, %if.else ], [ %inc34, %if.end38.sink.split ]
%8 = load i32, ptr %arrayidx1191, align 4, !tbaa !5
%cmp41 = icmp eq i32 %i.087, %8
br i1 %cmp41, label %if.then42, label %if.end38.for.inc_crit_edge
if.end38.for.inc_crit_edge: ; preds = %if.end38
%.pre93 = sext i32 %x.188 to i64
br label %for.inc
if.then42: ; preds = %if.end38
%cmp43 = icmp eq i32 %count.1, 0
br i1 %cmp43, label %if.then44, label %if.end46
if.then44: ; preds = %if.then42
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end46
if.end46: ; preds = %if.then44, %if.then42
%add = add nsw i32 %x.188, 1
%idxprom47 = sext i32 %add to i64
%arrayidx48 = getelementptr inbounds [3000 x i32], ptr %hajime, i64 0, i64 %idxprom47
%9 = load i32, ptr %arrayidx48, align 4, !tbaa !5
%cmp49.not = icmp eq i32 %9, 0
br i1 %cmp49.not, label %if.end57, label %land.lhs.true50
land.lhs.true50: ; preds = %if.end46
%arrayidx53 = getelementptr inbounds [3000 x i32], ptr %owari, i64 0, i64 %idxprom47
%10 = load i32, ptr %arrayidx53, align 4, !tbaa !5
%cmp54.not = icmp eq i32 %10, 0
br i1 %cmp54.not, label %if.end57, label %if.then55
if.then55: ; preds = %land.lhs.true50
%putchar = call i32 @putchar(i32 10)
%.pre = load i32, ptr %arrayidx48, align 4, !tbaa !5
br label %if.end57
if.end57: ; preds = %if.then55, %land.lhs.true50, %if.end46
%11 = phi i32 [ %.pre, %if.then55 ], [ %9, %land.lhs.true50 ], [ 0, %if.end46 ]
%sub = add nsw i32 %11, -1
br label %for.inc
for.inc: ; preds = %if.end38.for.inc_crit_edge, %if.end57
%idxprom10.pre-phi = phi i64 [ %.pre93, %if.end38.for.inc_crit_edge ], [ %idxprom47, %if.end57 ]
%i.1 = phi i32 [ %i.087, %if.end38.for.inc_crit_edge ], [ %sub, %if.end57 ]
%x.2 = phi i32 [ %x.188, %if.end38.for.inc_crit_edge ], [ %add, %if.end57 ]
%count.2 = phi i32 [ %count.1, %if.end38.for.inc_crit_edge ], [ 0, %if.end57 ]
%inc62 = add nsw i32 %i.1, 1
%arrayidx11 = getelementptr inbounds [3000 x i32], ptr %owari, i64 0, i64 %idxprom10.pre-phi
%12 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12.not.not = icmp slt i32 %i.1, %12
br i1 %cmp12.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.body, %while.end
call void @llvm.lifetime.end.p0(i64 12000, ptr nonnull %owari) #5
call void @llvm.lifetime.end.p0(i64 12000, ptr nonnull %hajime) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int a = 0, b = 0;
char flg = 0, naflg = 0;
while ( scanf( "%d %d\n", &a, &b ) ) {
if ( a == 0 && b == 0 ) {
break;
}
if ( flg == 1 ) { printf( "\n" ); }
naflg = 1;
flg = 1;
for ( int i = a ; i <= b ; i++ ) {
if ( i % 4 == 0 && i % 100 != 0 || i % 400 == 0 ) {
printf( "%d\n", i );
naflg = 0;
}
}
if ( naflg == 1 ){
printf( "NA\n" );
}
a = b = 0;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287781/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287781/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NA\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
store i32 0, ptr %a, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
store i32 0, ptr %b, align 4, !tbaa !5
%call38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%tobool.not39 = icmp eq i32 %call38, 0
br i1 %tobool.not39, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end26
%cmp240 = phi i1 [ true, %if.end26 ], [ false, %entry ]
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 0
%1 = load i32, ptr %b, align 4
%cmp1 = icmp eq i32 %1, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %if.end
if.end: ; preds = %while.body
br i1 %cmp240, label %if.then4, label %if.end6
if.then4: ; preds = %if.end
%putchar = call i32 @putchar(i32 10)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre41 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end6
if.end6: ; preds = %if.then4, %if.end
%2 = phi i32 [ %.pre41, %if.then4 ], [ %1, %if.end ]
%3 = phi i32 [ %.pre, %if.then4 ], [ %0, %if.end ]
%cmp7.not35 = icmp sgt i32 %3, %2
br i1 %cmp7.not35, label %if.then24, label %for.body
for.cond.cleanup: ; preds = %for.inc
%cmp22 = icmp eq i8 %naflg.1, 1
br i1 %cmp22, label %if.then24, label %if.end26
for.body: ; preds = %if.end6, %for.inc
%4 = phi i32 [ %6, %for.inc ], [ %2, %if.end6 ]
%i.037 = phi i32 [ %inc, %for.inc ], [ %3, %if.end6 ]
%naflg.036 = phi i8 [ %naflg.1, %for.inc ], [ 1, %if.end6 ]
%5 = and i32 %i.037, 3
%cmp9 = icmp eq i32 %5, 0
%rem12 = srem i32 %i.037, 100
%cmp13.not = icmp ne i32 %rem12, 0
%or.cond32.not34 = and i1 %cmp9, %cmp13.not
%rem15 = srem i32 %i.037, 400
%cmp16 = icmp eq i32 %rem15, 0
%or.cond33 = or i1 %cmp16, %or.cond32.not34
br i1 %or.cond33, label %if.then18, label %for.inc
if.then18: ; preds = %for.body
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.037)
%.pre42 = load i32, ptr %b, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then18
%6 = phi i32 [ %.pre42, %if.then18 ], [ %4, %for.body ]
%naflg.1 = phi i8 [ 0, %if.then18 ], [ %naflg.036, %for.body ]
%inc = add nsw i32 %i.037, 1
%cmp7.not.not = icmp slt i32 %i.037, %6
br i1 %cmp7.not.not, label %for.body, label %for.cond.cleanup, !llvm.loop !9
if.then24: ; preds = %if.end6, %for.cond.cleanup
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end26
if.end26: ; preds = %if.then24, %for.cond.cleanup
store i32 0, ptr %b, align 4, !tbaa !5
store i32 0, ptr %a, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.end26, %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void){
int w,cost;
while(1){cost=0;
scanf("%d",&w);
if(!(w+1))break;
while(w>30){w--;cost+=160;}
while(w>20){w--;cost+=140;}
while(w>10){w--;cost+=125;}
cost+=1150;
printf("%d\n",4280-cost);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287824/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287824/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%0 = load i32, ptr %w, align 4, !tbaa !5
%tobool.not35 = icmp eq i32 %0, -1
br i1 %tobool.not35, label %while.end18, label %while.cond1.preheader
while.cond1.preheader: ; preds = %entry, %while.end15
%1 = phi i32 [ %2, %while.end15 ], [ %0, %entry ]
%cmp26 = icmp sgt i32 %1, 30
br i1 %cmp26, label %while.cond4thread-pre-split.thread, label %while.cond4thread-pre-split
while.cond4thread-pre-split.thread: ; preds = %while.cond1.preheader
%.neg = mul i32 %1, -160
%.neg48 = add i32 %.neg, 4800
br label %while.cond10thread-pre-split.thread
while.cond4thread-pre-split: ; preds = %while.cond1.preheader
%cmp528 = icmp sgt i32 %1, 20
br i1 %cmp528, label %while.cond10thread-pre-split.thread, label %while.cond10thread-pre-split
while.cond10thread-pre-split.thread: ; preds = %while.cond4thread-pre-split, %while.cond4thread-pre-split.thread
%cost.0.lcssa42.neg = phi i32 [ %.neg48, %while.cond4thread-pre-split.thread ], [ 0, %while.cond4thread-pre-split ]
%.pr41 = phi i32 [ 30, %while.cond4thread-pre-split.thread ], [ %1, %while.cond4thread-pre-split ]
%.neg50 = mul i32 %.pr41, -140
%.neg49 = add i32 %cost.0.lcssa42.neg, 2800
%.neg51 = add i32 %.neg49, %.neg50
br label %while.body12.preheader
while.cond10thread-pre-split: ; preds = %while.cond4thread-pre-split
%cmp1131 = icmp sgt i32 %1, 10
br i1 %cmp1131, label %while.body12.preheader, label %while.end15
while.body12.preheader: ; preds = %while.cond10thread-pre-split.thread, %while.cond10thread-pre-split
%cost.1.lcssa47.neg = phi i32 [ %.neg51, %while.cond10thread-pre-split.thread ], [ 0, %while.cond10thread-pre-split ]
%.pr2546 = phi i32 [ 20, %while.cond10thread-pre-split.thread ], [ %1, %while.cond10thread-pre-split ]
%.neg53 = mul i32 %.pr2546, -125
%.neg52 = add i32 %cost.1.lcssa47.neg, 1250
%.neg54 = add i32 %.neg52, %.neg53
store i32 10, ptr %w, align 4, !tbaa !5
br label %while.end15
while.end15: ; preds = %while.body12.preheader, %while.cond10thread-pre-split
%cost.2.lcssa.neg = phi i32 [ %.neg54, %while.body12.preheader ], [ 0, %while.cond10thread-pre-split ]
%sub = add i32 %cost.2.lcssa.neg, 3130
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%2 = load i32, ptr %w, align 4, !tbaa !5
%tobool.not = icmp eq i32 %2, -1
br i1 %tobool.not, label %while.end18, label %while.cond1.preheader
while.end18: ; preds = %while.end15, %entry
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"}
|
#include<stdio.h>
int main()
{
int w,i,r;
for(;~scanf("%d",&w)&&w!=-1;)
{
for(r=0,i=10;i<w;i++)
{
if(i<20)
r+=125;
else if(i<30)
r+=140;
else
r+=160;
}
printf("%d\n",3130-r);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287882/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287882/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%tobool23 = icmp ne i32 %call22, -1
%0 = load i32, ptr %w, align 4
%cmp24 = icmp ne i32 %0, -1
%1 = select i1 %tobool23, i1 %cmp24, i1 false
br i1 %1, label %for.cond1.preheader, label %for.end12
for.cond1.preheader: ; preds = %entry, %for.end
%2 = phi i32 [ %16, %for.end ], [ %0, %entry ]
%cmp219 = icmp sgt i32 %2, 10
br i1 %cmp219, label %for.body3.preheader, label %for.end
for.body3.preheader: ; preds = %for.cond1.preheader
%3 = add i32 %2, -10
%min.iters.check = icmp ult i32 %3, 8
br i1 %min.iters.check, label %for.body3.preheader27, label %vector.ph
vector.ph: ; preds = %for.body3.preheader
%n.vec = and i32 %3, -8
%ind.end = add i32 %n.vec, 10
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> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%vec.phi25 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 10, i32 11, i32 12, i32 13>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%4 = icmp ult <4 x i32> %vec.ind, <i32 20, i32 20, i32 20, i32 20>
%5 = icmp ult <4 x i32> %step.add, <i32 20, i32 20, i32 20, i32 20>
%6 = icmp ult <4 x i32> %vec.ind, <i32 30, i32 30, i32 30, i32 30>
%7 = icmp ult <4 x i32> %step.add, <i32 30, i32 30, i32 30, i32 30>
%8 = select <4 x i1> %6, <4 x i32> <i32 140, i32 140, i32 140, i32 140>, <4 x i32> <i32 160, i32 160, i32 160, i32 160>
%9 = select <4 x i1> %7, <4 x i32> <i32 140, i32 140, i32 140, i32 140>, <4 x i32> <i32 160, i32 160, i32 160, i32 160>
%10 = select <4 x i1> %4, <4 x i32> <i32 125, i32 125, i32 125, i32 125>, <4 x i32> %8
%11 = select <4 x i1> %5, <4 x i32> <i32 125, i32 125, i32 125, i32 125>, <4 x i32> %9
%12 = add <4 x i32> %vec.phi, %10
%13 = add <4 x i32> %vec.phi25, %11
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%14 = icmp eq i32 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !5
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %13, %12
%15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %3, %n.vec
br i1 %cmp.n, label %for.end, label %for.body3.preheader27
for.body3.preheader27: ; preds = %for.body3.preheader, %middle.block
%r.021.ph = phi i32 [ 0, %for.body3.preheader ], [ %15, %middle.block ]
%i.020.ph = phi i32 [ 10, %for.body3.preheader ], [ %ind.end, %middle.block ]
br label %for.body3
for.body3: ; preds = %for.body3.preheader27, %for.body3
%r.021 = phi i32 [ %add, %for.body3 ], [ %r.021.ph, %for.body3.preheader27 ]
%i.020 = phi i32 [ %inc, %for.body3 ], [ %i.020.ph, %for.body3.preheader27 ]
%cmp4 = icmp ult i32 %i.020, 20
%cmp5 = icmp ult i32 %i.020, 30
%. = select i1 %cmp5, i32 140, i32 160
%.sink = select i1 %cmp4, i32 125, i32 %.
%add = add nuw nsw i32 %r.021, %.sink
%inc = add nuw nsw i32 %i.020, 1
%exitcond.not = icmp eq i32 %inc, %2
br i1 %exitcond.not, label %for.end, label %for.body3, !llvm.loop !9
for.end: ; preds = %for.body3, %middle.block, %for.cond1.preheader
%r.0.lcssa = phi i32 [ 0, %for.cond1.preheader ], [ %15, %middle.block ], [ %add, %for.body3 ]
%sub = sub nsw i32 3130, %r.0.lcssa
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%tobool = icmp ne i32 %call, -1
%16 = load i32, ptr %w, align 4
%cmp = icmp ne i32 %16, -1
%17 = select i1 %tobool, i1 %cmp, i1 false
br i1 %17, label %for.cond1.preheader, label %for.end12, !llvm.loop !10
for.end12: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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 = distinct !{!5, !6, !7, !8}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!"llvm.loop.isvectorized", i32 1}
!8 = !{!"llvm.loop.unroll.runtime.disable"}
!9 = distinct !{!9, !6, !8, !7}
!10 = distinct !{!10, !6}
|
#include<stdio.h>
int main(){
int n, in, i;
double sum;
sum = 0;
scanf("%d",&n);
for(i = 0; i < n; i++){
scanf("%d",&in);
sum += in;
}
printf("%.0f\n",sum/n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287932/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287932/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%.0f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%in = 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 %in) #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, label %for.end
for.body: ; preds = %entry, %for.body
%sum.08 = phi double [ %add, %for.body ], [ 0.000000e+00, %entry ]
%i.07 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in)
%1 = load i32, ptr %in, align 4, !tbaa !5
%conv = sitofp i32 %1 to double
%add = fadd double %sum.08, %conv
%inc = add nuw nsw i32 %i.07, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%sum.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add, %for.body ]
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
%conv2 = sitofp i32 %.lcssa to double
%div = fdiv double %sum.0.lcssa, %conv2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %in) #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 v;
long sum=0;
for(int i=0;i<n;i++){
scanf("%ld",&v);
sum+=v;
}
printf("%ld\n",sum/n);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287976/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287976/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%v = alloca i64, align 8
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)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %v) #3
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ]
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
%conv = sext i32 %.lcssa to i64
%div = sdiv i64 %sum.0.lcssa, %conv
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %div)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %v) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
for.body: ; preds = %entry, %for.body
%i.07 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%sum.06 = phi i64 [ %add, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v)
%1 = load i64, ptr %v, align 8, !tbaa !9
%add = add nsw i64 %1, %sum.06
%inc = add nuw nsw i32 %i.07, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
// うそ
#include<stdio.h>
#include<stdlib.h>
int compare(const void* a, const void*b){
return *(int*)a - *(int*)b;
}
int main(void){
int n;
scanf("%d", &n);
int s[n];
int sum = 0;
for(int i=0; i<n; i++){
scanf("%d", &s[i]);
sum += s[i];
}
qsort(s, n, sizeof(int), compare);
int ans;
int flag = 0;
if(sum%10 != 0){
ans = sum;
flag = 1;
}
else{
for(int i=0; i<n; i++){
if((sum-s[i])%10 != 0){
ans = sum-s[i];
flag = 1;
break;
}
}
}
if(flag){
printf("%d\n", ans);
}else{
printf("0\n");
}
// int s[n+1];
// s[0] = 0;
// for(int i=1; i<n+1; i++){
// s[i] = s[i-1] + score[i-1];
// printf("s[%d]:%d\n", i, s[i]);
// }
// int ans;
// for(int i=n; i>=0; i--){
// if(s[i]%10 != 0){
// ans = s[i];
// break;
// }
// ans = s[i];
// }
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288025/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288025/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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
%cmp48 = icmp sgt i32 %3, 0
br i1 %cmp48, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
%.pre = sext i32 %3 to i64
call void @qsort(ptr noundef nonnull %vla, i64 noundef %.pre, i64 noundef 4, ptr noundef nonnull @compare) #7
br label %for.cond7.preheader
for.cond.cleanup: ; preds = %for.body
call void @qsort(ptr noundef nonnull %vla, i64 noundef %7, i64 noundef 4, ptr noundef nonnull @compare) #7
%rem = srem i32 %add, 10
%cmp4.not = icmp eq i32 %rem, 0
br i1 %cmp4.not, label %for.cond7.preheader, label %if.then25
for.cond7.preheader: ; preds = %for.cond.cleanup.thread, %for.cond.cleanup
%sum.0.lcssa64 = phi i32 [ 0, %for.cond.cleanup.thread ], [ %add, %for.cond.cleanup ]
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp8.not52 = icmp sgt i32 %4, 0
br i1 %cmp8.not52, label %for.body11.preheader, label %if.else27
for.body11.preheader: ; preds = %for.cond7.preheader
%wide.trip.count = zext i32 %4 to i64
br label %for.body11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%sum.049 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %5, %sum.049
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond7: ; preds = %for.body11
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%exitcond.not = icmp eq i64 %indvars.iv.next58, %wide.trip.count
br i1 %exitcond.not, label %if.else27, label %for.body11, !llvm.loop !11
for.body11: ; preds = %for.body11.preheader, %for.cond7
%indvars.iv57 = phi i64 [ 0, %for.body11.preheader ], [ %indvars.iv.next58, %for.cond7 ]
%arrayidx13 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv57
%8 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%sub = sub nsw i32 %sum.0.lcssa64, %8
%rem14 = srem i32 %sub, 10
%cmp15.not = icmp eq i32 %rem14, 0
br i1 %cmp15.not, label %for.cond7, label %if.then25
if.then25: ; preds = %for.body11, %for.cond.cleanup
%ans.1.ph = phi i32 [ %add, %for.cond.cleanup ], [ %sub, %for.body11 ]
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.1.ph)
br label %if.end29
if.else27: ; preds = %for.cond7, %for.cond7.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end29
if.end29: ; preds = %if.else27, %if.then25
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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !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 FOR(i,a,b) for(int i=a;i<b;i++)
#define lln long long int
int main(){
int n,s[102];
int min = 101, sum = 0;
scanf("%d",&n);
FOR(i,0,n){
scanf("%d",&s[i]);
sum += s[i];
if(min > s[i] && s[i] % 10 != 0) min = s[i];
}
if(sum % 10 != 0) printf("%d\n",sum);
else if(min > 100) printf("0\n");
else printf("%d\n",sum - min);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288069/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288069/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca [102 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 408, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp34 = icmp sgt i32 %0, 0
br i1 %cmp34, label %for.body, label %if.then17
for.cond.cleanup: ; preds = %for.body
%rem12 = srem i32 %add, 10
%cmp13.not = icmp eq i32 %rem12, 0
br i1 %cmp13.not, label %if.else, label %if.then14
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%sum.036 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%min.035 = phi i32 [ %min.1, %for.body ], [ 101, %entry ]
%arrayidx = getelementptr inbounds [102 x i32], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %1, %sum.036
%cmp6 = icmp sle i32 %min.035, %1
%rem = srem i32 %1, 10
%cmp9.not = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp6, %cmp9.not
%min.1 = select i1 %or.cond, i32 %min.035, i32 %1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
if.then14: ; preds = %for.cond.cleanup
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
br label %if.end22
if.else: ; preds = %for.cond.cleanup
%cmp16 = icmp sgt i32 %min.1, 100
br i1 %cmp16, label %if.then17, label %if.else19
if.then17: ; preds = %entry, %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end22
if.else19: ; preds = %if.else
%sub = sub nsw i32 %add, %min.1
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
br label %if.end22
if.end22: ; preds = %if.then17, %if.else19, %if.then14
call void @llvm.lifetime.end.p0(i64 408, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = !{!"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) {
long max;
long where;
long ue;
long sita;
long uebak;
long sitabak;
long kazu;
int kaeruiro;
int currentiro;
int retu[10000];
long i;
long result;
char kieta;
while(1) {
scanf("%d",&max);
if(max==0)break;
for(i=0;i<max;i++) {
scanf("%d",&retu[i]);
}
result=max;
for(where=0;where<max;where++) {
for(kaeruiro=1;kaeruiro<4;kaeruiro++) {
currentiro=kaeruiro;
ue=where-1;
sita=where+1;
kazu=1;
kieta=0;
do {
uebak=ue;
sitabak=sita;
for(ue=ue;ue>=0;ue--) {
if(retu[ue]!=currentiro)break;
kazu++;
}
for(sita=sita;sita<max;sita++) {
if(retu[sita]!=currentiro)break;
kazu++;
}
if(kazu<4) {
ue=uebak;
sita=sitabak;
break;
}
kieta=1;
if(retu[ue]!=retu[sita])break;
if(ue==-1 && sita==max)break;
kazu=0;
currentiro=retu[ue];
} while(1);
if(kieta==0)ue++;
if(ue+1+max-sita<result)result=ue+1+max-sita;
}
}
printf("%d\n",result);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288111/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288111/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%max = alloca i64, align 8
%retu = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %max) #4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %retu) #4
%call116 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %max)
%0 = load i64, ptr %max, align 8
%cmp117 = icmp eq i64 %0, 0
br i1 %cmp117, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end63
%1 = phi i64 [ %27, %for.end63 ], [ %0, %entry ]
%cmp194 = icmp sgt i64 %1, 0
br i1 %cmp194, label %for.body, label %for.end63
for.cond3.preheader: ; preds = %for.body
%cmp4112 = icmp sgt i64 %2, 0
br i1 %cmp4112, label %for.cond6.preheader.lr.ph, label %for.end63
for.cond6.preheader.lr.ph: ; preds = %for.cond3.preheader
%spec.select = add nuw i64 %2, 1
br label %for.cond6.preheader
for.body: ; preds = %for.cond.preheader, %for.body
%i.095 = phi i64 [ %inc, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %retu, i64 0, i64 %i.095
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.095, 1
%2 = load i64, ptr %max, align 8
%cmp1 = icmp slt i64 %inc, %2
br i1 %cmp1, label %for.body, label %for.cond3.preheader, !llvm.loop !5
for.cond6.preheader: ; preds = %for.cond6.preheader.lr.ph, %do.end.2
%result.0114 = phi i64 [ %2, %for.cond6.preheader.lr.ph ], [ %result.2.2, %do.end.2 ]
%where.0113 = phi i64 [ 0, %for.cond6.preheader.lr.ph ], [ %add, %do.end.2 ]
%sub = add nsw i64 %where.0113, -1
%add = add nuw nsw i64 %where.0113, 1
br label %do.body
do.body: ; preds = %if.end37, %for.cond6.preheader
%sita.0 = phi i64 [ %add, %for.cond6.preheader ], [ %sita.1.lcssa, %if.end37 ]
%ue.0 = phi i64 [ %sub, %for.cond6.preheader ], [ %ue.1.lcssa, %if.end37 ]
%kazu.0 = phi i64 [ 1, %for.cond6.preheader ], [ 0, %if.end37 ]
%currentiro.0 = phi i32 [ 1, %for.cond6.preheader ], [ %9, %if.end37 ]
%kieta.0 = phi i32 [ 0, %for.cond6.preheader ], [ 1, %if.end37 ]
%cmp1096 = icmp sgt i64 %ue.0, -1
br i1 %cmp1096, label %for.body11.preheader, label %for.end18
for.body11.preheader: ; preds = %do.body
%3 = add nuw i64 %ue.0, 1
%4 = add nuw i64 %3, %kazu.0
br label %for.body11
for.body11: ; preds = %for.body11.preheader, %if.end15
%kazu.198 = phi i64 [ %inc16, %if.end15 ], [ %kazu.0, %for.body11.preheader ]
%ue.197 = phi i64 [ %dec, %if.end15 ], [ %ue.0, %for.body11.preheader ]
%arrayidx12 = getelementptr inbounds [10000 x i32], ptr %retu, i64 0, i64 %ue.197
%5 = load i32, ptr %arrayidx12, align 4, !tbaa !7
%cmp13.not = icmp eq i32 %5, %currentiro.0
br i1 %cmp13.not, label %if.end15, label %for.end18
if.end15: ; preds = %for.body11
%inc16 = add nuw i64 %kazu.198, 1
%dec = add nsw i64 %ue.197, -1
%exitcond.not = icmp eq i64 %inc16, %4
br i1 %exitcond.not, label %for.end18, label %for.body11, !llvm.loop !11
for.end18: ; preds = %if.end15, %for.body11, %do.body
%ue.1.lcssa = phi i64 [ %ue.0, %do.body ], [ %ue.197, %for.body11 ], [ -1, %if.end15 ]
%kazu.1.lcssa = phi i64 [ %kazu.0, %do.body ], [ %kazu.198, %for.body11 ], [ %4, %if.end15 ]
%cmp20103 = icmp slt i64 %sita.0, %2
br i1 %cmp20103, label %for.body21.preheader, label %for.end29
for.body21.preheader: ; preds = %for.end18
%6 = add i64 %2, %kazu.1.lcssa
%7 = sub i64 %6, %sita.0
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %if.end25
%kazu.2105 = phi i64 [ %inc26, %if.end25 ], [ %kazu.1.lcssa, %for.body21.preheader ]
%sita.1104 = phi i64 [ %inc28, %if.end25 ], [ %sita.0, %for.body21.preheader ]
%arrayidx22 = getelementptr inbounds [10000 x i32], ptr %retu, i64 0, i64 %sita.1104
%8 = load i32, ptr %arrayidx22, align 4, !tbaa !7
%cmp23.not = icmp eq i32 %8, %currentiro.0
br i1 %cmp23.not, label %if.end25, label %for.end29
if.end25: ; preds = %for.body21
%inc26 = add nuw nsw i64 %kazu.2105, 1
%inc28 = add i64 %sita.1104, 1
%exitcond119.not = icmp eq i64 %inc28, %2
br i1 %exitcond119.not, label %for.end29, label %for.body21, !llvm.loop !12
for.end29: ; preds = %if.end25, %for.body21, %for.end18
%sita.1.lcssa = phi i64 [ %sita.0, %for.end18 ], [ %sita.1104, %for.body21 ], [ %2, %if.end25 ]
%kazu.2.lcssa = phi i64 [ %kazu.1.lcssa, %for.end18 ], [ %kazu.2105, %for.body21 ], [ %7, %if.end25 ]
%cmp30 = icmp ult i64 %kazu.2.lcssa, 4
br i1 %cmp30, label %do.end, label %if.end32
if.end32: ; preds = %for.end29
%arrayidx33 = getelementptr inbounds [10000 x i32], ptr %retu, i64 0, i64 %ue.1.lcssa
%9 = load i32, ptr %arrayidx33, align 4, !tbaa !7
%arrayidx34 = getelementptr inbounds [10000 x i32], ptr %retu, i64 0, i64 %sita.1.lcssa
%10 = load i32, ptr %arrayidx34, align 4, !tbaa !7
%cmp35.not = icmp eq i32 %9, %10
br i1 %cmp35.not, label %if.end37, label %do.end
if.end37: ; preds = %if.end32
%cmp38 = icmp eq i64 %ue.1.lcssa, -1
%cmp39 = icmp eq i64 %sita.1.lcssa, %2
%or.cond = and i1 %cmp38, %cmp39
br i1 %or.cond, label %do.end, label %do.body
do.end: ; preds = %if.end37, %for.end29, %if.end32
%sita.2 = phi i64 [ %sita.1.lcssa, %if.end32 ], [ %sita.0, %for.end29 ], [ %2, %if.end37 ]
%ue.2 = phi i64 [ %ue.1.lcssa, %if.end32 ], [ %ue.0, %for.end29 ], [ -1, %if.end37 ]
%kieta.1 = phi i32 [ 1, %if.end32 ], [ %kieta.0, %for.end29 ], [ 1, %if.end37 ]
%conv = and i32 %kieta.1, 255
%cmp43 = icmp eq i32 %conv, 0
%inc46 = zext i1 %cmp43 to i64
%add48 = sub i64 %spec.select, %sita.2
%add49 = add i64 %add48, %ue.2
%sub50 = add i64 %add49, %inc46
%result.2 = call i64 @llvm.smin.i64(i64 %sub50, i64 %result.0114)
br label %do.body.1
do.body.1: ; preds = %if.end37.1, %do.end
%sita.0.1 = phi i64 [ %add, %do.end ], [ %sita.1.lcssa.1, %if.end37.1 ]
%ue.0.1 = phi i64 [ %sub, %do.end ], [ %ue.1.lcssa.1, %if.end37.1 ]
%kazu.0.1 = phi i64 [ 1, %do.end ], [ 0, %if.end37.1 ]
%currentiro.0.1 = phi i32 [ 2, %do.end ], [ %17, %if.end37.1 ]
%kieta.0.1 = phi i32 [ 0, %do.end ], [ 1, %if.end37.1 ]
%cmp1096.1 = icmp sgt i64 %ue.0.1, -1
br i1 %cmp1096.1, label %for.body11.preheader.1, label %for.end18.1
for.body11.preheader.1: ; preds = %do.body.1
%11 = add nuw i64 %ue.0.1, 1
%12 = add nuw i64 %11, %kazu.0.1
br label %for.body11.1
for.body11.1: ; preds = %if.end15.1, %for.body11.preheader.1
%kazu.198.1 = phi i64 [ %inc16.1, %if.end15.1 ], [ %kazu.0.1, %for.body11.preheader.1 ]
%ue.197.1 = phi i64 [ %dec.1, %if.end15.1 ], [ %ue.0.1, %for.body11.preheader.1 ]
%arrayidx12.1 = getelementptr inbounds [10000 x i32], ptr %retu, i64 0, i64 %ue.197.1
%13 = load i32, ptr %arrayidx12.1, align 4, !tbaa !7
%cmp13.not.1 = icmp eq i32 %13, %currentiro.0.1
br i1 %cmp13.not.1, label %if.end15.1, label %for.end18.1
if.end15.1: ; preds = %for.body11.1
%inc16.1 = add nuw i64 %kazu.198.1, 1
%dec.1 = add nsw i64 %ue.197.1, -1
%exitcond.1.not = icmp eq i64 %inc16.1, %12
br i1 %exitcond.1.not, label %for.end18.1, label %for.body11.1, !llvm.loop !11
for.end18.1: ; preds = %for.body11.1, %if.end15.1, %do.body.1
%ue.1.lcssa.1 = phi i64 [ %ue.0.1, %do.body.1 ], [ %ue.197.1, %for.body11.1 ], [ -1, %if.end15.1 ]
%kazu.1.lcssa.1 = phi i64 [ %kazu.0.1, %do.body.1 ], [ %kazu.198.1, %for.body11.1 ], [ %12, %if.end15.1 ]
%cmp20103.1 = icmp slt i64 %sita.0.1, %2
br i1 %cmp20103.1, label %for.body21.preheader.1, label %for.end29.1
for.body21.preheader.1: ; preds = %for.end18.1
%14 = add i64 %2, %kazu.1.lcssa.1
%15 = sub i64 %14, %sita.0.1
br label %for.body21.1
for.body21.1: ; preds = %if.end25.1, %for.body21.preheader.1
%kazu.2105.1 = phi i64 [ %inc26.1, %if.end25.1 ], [ %kazu.1.lcssa.1, %for.body21.preheader.1 ]
%sita.1104.1 = phi i64 [ %inc28.1, %if.end25.1 ], [ %sita.0.1, %for.body21.preheader.1 ]
%arrayidx22.1 = getelementptr inbounds [10000 x i32], ptr %retu, i64 0, i64 %sita.1104.1
%16 = load i32, ptr %arrayidx22.1, align 4, !tbaa !7
%cmp23.not.1 = icmp eq i32 %16, %currentiro.0.1
br i1 %cmp23.not.1, label %if.end25.1, label %for.end29.1
if.end25.1: ; preds = %for.body21.1
%inc26.1 = add nuw nsw i64 %kazu.2105.1, 1
%inc28.1 = add i64 %sita.1104.1, 1
%exitcond119.1.not = icmp eq i64 %inc28.1, %2
br i1 %exitcond119.1.not, label %for.end29.1, label %for.body21.1, !llvm.loop !12
for.end29.1: ; preds = %for.body21.1, %if.end25.1, %for.end18.1
%sita.1.lcssa.1 = phi i64 [ %sita.0.1, %for.end18.1 ], [ %sita.1104.1, %for.body21.1 ], [ %2, %if.end25.1 ]
%kazu.2.lcssa.1 = phi i64 [ %kazu.1.lcssa.1, %for.end18.1 ], [ %kazu.2105.1, %for.body21.1 ], [ %15, %if.end25.1 ]
%cmp30.1 = icmp ult i64 %kazu.2.lcssa.1, 4
br i1 %cmp30.1, label %do.end.1, label %if.end32.1
if.end32.1: ; preds = %for.end29.1
%arrayidx33.1 = getelementptr inbounds [10000 x i32], ptr %retu, i64 0, i64 %ue.1.lcssa.1
%17 = load i32, ptr %arrayidx33.1, align 4, !tbaa !7
%arrayidx34.1 = getelementptr inbounds [10000 x i32], ptr %retu, i64 0, i64 %sita.1.lcssa.1
%18 = load i32, ptr %arrayidx34.1, align 4, !tbaa !7
%cmp35.not.1 = icmp eq i32 %17, %18
br i1 %cmp35.not.1, label %if.end37.1, label %do.end.1
if.end37.1: ; preds = %if.end32.1
%cmp38.1 = icmp eq i64 %ue.1.lcssa.1, -1
%cmp39.1 = icmp eq i64 %sita.1.lcssa.1, %2
%or.cond.1 = and i1 %cmp38.1, %cmp39.1
br i1 %or.cond.1, label %do.end.1, label %do.body.1
do.end.1: ; preds = %if.end37.1, %if.end32.1, %for.end29.1
%sita.2.1 = phi i64 [ %sita.1.lcssa.1, %if.end32.1 ], [ %sita.0.1, %for.end29.1 ], [ %2, %if.end37.1 ]
%ue.2.1 = phi i64 [ %ue.1.lcssa.1, %if.end32.1 ], [ %ue.0.1, %for.end29.1 ], [ -1, %if.end37.1 ]
%kieta.1.1 = phi i32 [ 1, %if.end32.1 ], [ %kieta.0.1, %for.end29.1 ], [ 1, %if.end37.1 ]
%conv.1 = and i32 %kieta.1.1, 255
%cmp43.1 = icmp eq i32 %conv.1, 0
%inc46.1 = zext i1 %cmp43.1 to i64
%add48.1 = sub i64 %spec.select, %sita.2.1
%add49.1 = add i64 %add48.1, %ue.2.1
%sub50.1 = add i64 %add49.1, %inc46.1
%result.2.1 = call i64 @llvm.smin.i64(i64 %sub50.1, i64 %result.2)
br label %do.body.2
do.body.2: ; preds = %if.end37.2, %do.end.1
%sita.0.2 = phi i64 [ %add, %do.end.1 ], [ %sita.1.lcssa.2, %if.end37.2 ]
%ue.0.2 = phi i64 [ %sub, %do.end.1 ], [ %ue.1.lcssa.2, %if.end37.2 ]
%kazu.0.2 = phi i64 [ 1, %do.end.1 ], [ 0, %if.end37.2 ]
%currentiro.0.2 = phi i32 [ 3, %do.end.1 ], [ %25, %if.end37.2 ]
%kieta.0.2 = phi i32 [ 0, %do.end.1 ], [ 1, %if.end37.2 ]
%cmp1096.2 = icmp sgt i64 %ue.0.2, -1
br i1 %cmp1096.2, label %for.body11.preheader.2, label %for.end18.2
for.body11.preheader.2: ; preds = %do.body.2
%19 = add nuw i64 %ue.0.2, 1
%20 = add nuw i64 %19, %kazu.0.2
br label %for.body11.2
for.body11.2: ; preds = %if.end15.2, %for.body11.preheader.2
%kazu.198.2 = phi i64 [ %inc16.2, %if.end15.2 ], [ %kazu.0.2, %for.body11.preheader.2 ]
%ue.197.2 = phi i64 [ %dec.2, %if.end15.2 ], [ %ue.0.2, %for.body11.preheader.2 ]
%arrayidx12.2 = getelementptr inbounds [10000 x i32], ptr %retu, i64 0, i64 %ue.197.2
%21 = load i32, ptr %arrayidx12.2, align 4, !tbaa !7
%cmp13.not.2 = icmp eq i32 %21, %currentiro.0.2
br i1 %cmp13.not.2, label %if.end15.2, label %for.end18.2
if.end15.2: ; preds = %for.body11.2
%inc16.2 = add nuw i64 %kazu.198.2, 1
%dec.2 = add nsw i64 %ue.197.2, -1
%exitcond.2.not = icmp eq i64 %inc16.2, %20
br i1 %exitcond.2.not, label %for.end18.2, label %for.body11.2, !llvm.loop !11
for.end18.2: ; preds = %for.body11.2, %if.end15.2, %do.body.2
%ue.1.lcssa.2 = phi i64 [ %ue.0.2, %do.body.2 ], [ %ue.197.2, %for.body11.2 ], [ -1, %if.end15.2 ]
%kazu.1.lcssa.2 = phi i64 [ %kazu.0.2, %do.body.2 ], [ %kazu.198.2, %for.body11.2 ], [ %20, %if.end15.2 ]
%cmp20103.2 = icmp slt i64 %sita.0.2, %2
br i1 %cmp20103.2, label %for.body21.preheader.2, label %for.end29.2
for.body21.preheader.2: ; preds = %for.end18.2
%22 = add i64 %2, %kazu.1.lcssa.2
%23 = sub i64 %22, %sita.0.2
br label %for.body21.2
for.body21.2: ; preds = %if.end25.2, %for.body21.preheader.2
%kazu.2105.2 = phi i64 [ %inc26.2, %if.end25.2 ], [ %kazu.1.lcssa.2, %for.body21.preheader.2 ]
%sita.1104.2 = phi i64 [ %inc28.2, %if.end25.2 ], [ %sita.0.2, %for.body21.preheader.2 ]
%arrayidx22.2 = getelementptr inbounds [10000 x i32], ptr %retu, i64 0, i64 %sita.1104.2
%24 = load i32, ptr %arrayidx22.2, align 4, !tbaa !7
%cmp23.not.2 = icmp eq i32 %24, %currentiro.0.2
br i1 %cmp23.not.2, label %if.end25.2, label %for.end29.2
if.end25.2: ; preds = %for.body21.2
%inc26.2 = add nuw nsw i64 %kazu.2105.2, 1
%inc28.2 = add i64 %sita.1104.2, 1
%exitcond119.2.not = icmp eq i64 %inc28.2, %2
br i1 %exitcond119.2.not, label %for.end29.2, label %for.body21.2, !llvm.loop !12
for.end29.2: ; preds = %for.body21.2, %if.end25.2, %for.end18.2
%sita.1.lcssa.2 = phi i64 [ %sita.0.2, %for.end18.2 ], [ %sita.1104.2, %for.body21.2 ], [ %2, %if.end25.2 ]
%kazu.2.lcssa.2 = phi i64 [ %kazu.1.lcssa.2, %for.end18.2 ], [ %kazu.2105.2, %for.body21.2 ], [ %23, %if.end25.2 ]
%cmp30.2 = icmp ult i64 %kazu.2.lcssa.2, 4
br i1 %cmp30.2, label %do.end.2, label %if.end32.2
if.end32.2: ; preds = %for.end29.2
%arrayidx33.2 = getelementptr inbounds [10000 x i32], ptr %retu, i64 0, i64 %ue.1.lcssa.2
%25 = load i32, ptr %arrayidx33.2, align 4, !tbaa !7
%arrayidx34.2 = getelementptr inbounds [10000 x i32], ptr %retu, i64 0, i64 %sita.1.lcssa.2
%26 = load i32, ptr %arrayidx34.2, align 4, !tbaa !7
%cmp35.not.2 = icmp eq i32 %25, %26
br i1 %cmp35.not.2, label %if.end37.2, label %do.end.2
if.end37.2: ; preds = %if.end32.2
%cmp38.2 = icmp eq i64 %ue.1.lcssa.2, -1
%cmp39.2 = icmp eq i64 %sita.1.lcssa.2, %2
%or.cond.2 = and i1 %cmp38.2, %cmp39.2
br i1 %or.cond.2, label %do.end.2, label %do.body.2
do.end.2: ; preds = %if.end37.2, %if.end32.2, %for.end29.2
%sita.2.2 = phi i64 [ %sita.1.lcssa.2, %if.end32.2 ], [ %sita.0.2, %for.end29.2 ], [ %2, %if.end37.2 ]
%ue.2.2 = phi i64 [ %ue.1.lcssa.2, %if.end32.2 ], [ %ue.0.2, %for.end29.2 ], [ -1, %if.end37.2 ]
%kieta.1.2 = phi i32 [ 1, %if.end32.2 ], [ %kieta.0.2, %for.end29.2 ], [ 1, %if.end37.2 ]
%conv.2 = and i32 %kieta.1.2, 255
%cmp43.2 = icmp eq i32 %conv.2, 0
%inc46.2 = zext i1 %cmp43.2 to i64
%add48.2 = sub i64 %spec.select, %sita.2.2
%add49.2 = add i64 %add48.2, %ue.2.2
%sub50.2 = add i64 %add49.2, %inc46.2
%result.2.2 = call i64 @llvm.smin.i64(i64 %sub50.2, i64 %result.2.1)
%exitcond121.not = icmp eq i64 %add, %2
br i1 %exitcond121.not, label %for.end63, label %for.cond6.preheader, !llvm.loop !13
for.end63: ; preds = %do.end.2, %for.cond.preheader, %for.cond3.preheader
%result.0.lcssa = phi i64 [ %2, %for.cond3.preheader ], [ %1, %for.cond.preheader ], [ %result.2.2, %do.end.2 ]
%call64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %result.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %max)
%27 = load i64, ptr %max, align 8
%cmp = icmp eq i64 %27, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end63, %entry
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %retu) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %max) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
|
#include<stdio.h>
#include<string.h>
int main() {
int n,m,i;
scanf("%d %d",&n,&m);
int pi,acnum,x = 0,warongnum[n + 1],tyouhuku[n + 1];
char si[3],ac[] = "AC";
acnum = 0;
for (i = 1;i <= n; i ++) {
warongnum[i] = 0;
tyouhuku[i] = 0;
}
for (i = 1;i <= m;i ++) {
scanf("%d %s",&pi,&si);
if (strcmp(si,ac) == 0) {
if (tyouhuku[pi] != 1) {
acnum ++;
x = x + warongnum[pi];
tyouhuku[pi] = 1;
}
}
else {
warongnum[pi] ++;
}
}
printf("%d %d",acnum,x);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288162/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288162/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@__const.main.ac = private unnamed_addr constant [3 x i8] c"AC\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%pi = alloca i32, align 4
%si = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %pi) #6
%0 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%1 = zext i32 %add to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%add1 = add nsw i32 %3, 1
%4 = zext i32 %add1 to i64
%vla2 = alloca i32, i64 %4, align 16
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %si) #6
%cmp.not37 = icmp slt i32 %3, 1
br i1 %cmp.not37, label %for.cond5.preheader, label %for.body.preheader
for.body.preheader: ; preds = %entry
%scevgep = getelementptr i8, ptr %vla, i64 4
%5 = zext i32 %3 to i64
%6 = shl nuw nsw i64 %5, 2
call void @llvm.memset.p0.i64(ptr align 4 %scevgep, i8 0, i64 %6, i1 false), !tbaa !5
%scevgep44 = getelementptr i8, ptr %vla2, i64 4
call void @llvm.memset.p0.i64(ptr align 4 %scevgep44, i8 0, i64 %6, i1 false), !tbaa !5
br label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.body.preheader, %entry
%7 = load i32, ptr %m, align 4, !tbaa !5
%cmp6.not39 = icmp slt i32 %7, 1
br i1 %cmp6.not39, label %for.end28, label %for.body7
for.body7: ; preds = %for.cond5.preheader, %for.inc26
%i.142 = phi i32 [ %inc27, %for.inc26 ], [ 1, %for.cond5.preheader ]
%acnum.041 = phi i32 [ %acnum.1, %for.inc26 ], [ 0, %for.cond5.preheader ]
%x.040 = phi i32 [ %x.1, %for.inc26 ], [ 0, %for.cond5.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %pi, ptr noundef nonnull %si)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(3) %si, ptr noundef nonnull dereferenceable(3) @__const.main.ac, i64 3)
%cmp11 = icmp eq i32 %bcmp, 0
%8 = load i32, ptr %pi, align 4, !tbaa !5
%idxprom12 = sext i32 %8 to i64
br i1 %cmp11, label %if.then, label %if.else
if.then: ; preds = %for.body7
%arrayidx13 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom12
%9 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp14.not = icmp eq i32 %9, 1
br i1 %cmp14.not, label %for.inc26, label %if.then15
if.then15: ; preds = %if.then
%inc16 = add nsw i32 %acnum.041, 1
%arrayidx18 = getelementptr inbounds i32, ptr %vla, i64 %idxprom12
%10 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%add19 = add nsw i32 %10, %x.040
store i32 1, ptr %arrayidx13, align 4, !tbaa !5
br label %for.inc26
if.else: ; preds = %for.body7
%arrayidx23 = getelementptr inbounds i32, ptr %vla, i64 %idxprom12
%11 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%inc24 = add nsw i32 %11, 1
store i32 %inc24, ptr %arrayidx23, align 4, !tbaa !5
br label %for.inc26
for.inc26: ; preds = %if.else, %if.then15, %if.then
%x.1 = phi i32 [ %add19, %if.then15 ], [ %x.040, %if.then ], [ %x.040, %if.else ]
%acnum.1 = phi i32 [ %inc16, %if.then15 ], [ %acnum.041, %if.then ], [ %acnum.041, %if.else ]
%inc27 = add nuw nsw i32 %i.142, 1
%12 = load i32, ptr %m, align 4, !tbaa !5
%cmp6.not.not = icmp slt i32 %i.142, %12
br i1 %cmp6.not.not, label %for.body7, label %for.end28, !llvm.loop !9
for.end28: ; preds = %for.inc26, %for.cond5.preheader
%x.0.lcssa = phi i32 [ 0, %for.cond5.preheader ], [ %x.1, %for.inc26 ]
%acnum.0.lcssa = phi i32 [ 0, %for.cond5.preheader ], [ %acnum.1, %for.inc26 ]
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %acnum.0.lcssa, i32 noundef %x.0.lcssa)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %si) #6
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %pi) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind willreturn memory(argmem: read) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include "stdio.h"
#include "string.h"
int main(void) {
/* code */
int n,m,p;
int a = 0;
int w = 0;
int count[100001] = {0};
scanf("%d %d",&n, &m);
char s[3];
for (int i = 0; i < m; i++) {
scanf("%d %s", &p, s);
if(count[p] != -1){
if(strcmp(s,"AC")){
count[p] += 1;
}
if(strcmp(s,"WA")){
a +=1;
w += count[p];
count[p] = -1;
}
}
}
/*
for (int r = 0; r < N; r++) {
// if (r == N-1){
// break;
}
for (int s = 0; s < N; s++) {
if()
if(strcmp(S[s],"WA")){
wa += 1;
}else if(strcmp(S[s],"AC")){
ac+=1;
break;
}
}
}
*/
printf("%d %d\n",a,w);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288212/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288212/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8] c"%d %s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"AC\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"WA\00", align 1
@.str.4 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%p = alloca i32, align 4
%count = alloca [100001 x i32], align 16
%s = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #5
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %count) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400004) %count, i8 0, i64 400004, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %s) #5
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %0, 0
br i1 %cmp25, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.inc, %entry
%a.0.lcssa = phi i32 [ 0, %entry ], [ %a.1, %for.inc ]
%w.0.lcssa = phi i32 [ 0, %entry ], [ %w.1, %for.inc ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %a.0.lcssa, i32 noundef %w.0.lcssa)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %count) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body: ; preds = %entry, %for.inc
%i.028 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%w.027 = phi i32 [ %w.1, %for.inc ], [ 0, %entry ]
%a.026 = phi i32 [ %a.1, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %p, ptr noundef nonnull %s)
%1 = load i32, ptr %p, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [100001 x i32], ptr %count, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp2.not = icmp eq i32 %2, -1
br i1 %cmp2.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(3) %s, ptr noundef nonnull dereferenceable(3) @.str.2, i64 3)
%tobool.not = icmp eq i32 %bcmp, 0
br i1 %tobool.not, label %if.end, label %if.then5
if.then5: ; preds = %if.then
%add = add nuw nsw i32 %2, 1
store i32 %add, ptr %arrayidx, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then5, %if.then
%3 = phi i32 [ %add, %if.then5 ], [ %2, %if.then ]
%bcmp24 = call i32 @bcmp(ptr noundef nonnull dereferenceable(3) %s, ptr noundef nonnull dereferenceable(3) @.str.3, i64 3)
%tobool10.not = icmp eq i32 %bcmp24, 0
br i1 %tobool10.not, label %for.inc, label %if.then11
if.then11: ; preds = %if.end
%add12 = add nsw i32 %a.026, 1
%add15 = add nsw i32 %3, %w.027
store i32 -1, ptr %arrayidx, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then11, %if.end
%a.1 = phi i32 [ %add12, %if.then11 ], [ %a.026, %if.end ], [ %a.026, %for.body ]
%w.1 = phi i32 [ %add15, %if.then11 ], [ %w.027, %if.end ], [ %w.027, %for.body ]
%inc = add nuw nsw i32 %i.028, 1
%4 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind willreturn memory(argmem: read) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<math.h>
#include<string.h>
int a[100010]= {0};
int b[100010]= {0};
int main()
{
int n,m;
int num,y=0,z=0;
scanf("%d%d",&n,&m);
char s[100000];
while(m--)
{
scanf("%d%s",&num,s);
if(num>n) continue;
if(strcmp(s,"AC")==0)
a[num]=1;
if(strcmp(s,"WA")==0&&a[num]==0)
b[num]++;
}
for(int i=0; i<=n+1; i++)
{
y+=a[i];
if(a[i]==1)
z+=b[i];
}
printf("%d %d",y,z);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288263/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288263/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@a = dso_local local_unnamed_addr global [100010 x i32] zeroinitializer, align 16
@b = dso_local local_unnamed_addr global [100010 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"AC\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"WA\00", align 1
@.str.4 = 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
%m = alloca i32, align 4
%num = alloca i32, align 4
%s = alloca [100000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
call void @llvm.lifetime.start.p0(i64 100000, ptr nonnull %s) #4
%0 = load i32, ptr %m, align 4, !tbaa !5
%dec38 = add nsw i32 %0, -1
store i32 %dec38, ptr %m, align 4, !tbaa !5
%tobool.not39 = icmp eq i32 %0, 0
br i1 %tobool.not39, label %entry.for.cond.preheader_crit_edge, label %while.body
entry.for.cond.preheader_crit_edge: ; preds = %entry
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond.preheader
for.cond.preheader: ; preds = %while.cond.backedge, %entry.for.cond.preheader_crit_edge
%1 = phi i32 [ %.pre, %entry.for.cond.preheader_crit_edge ], [ %5, %while.cond.backedge ]
%cmp17.not40 = icmp slt i32 %1, -1
br i1 %cmp17.not40, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%2 = add i32 %1, 2
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 1
%3 = icmp eq i32 %2, 1
br i1 %3, label %for.cond.cleanup.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
while.body: ; preds = %entry, %while.cond.backedge
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %num, ptr noundef nonnull %s)
%4 = load i32, ptr %num, align 4, !tbaa !5
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp sgt i32 %4, %5
br i1 %cmp, label %while.cond.backedge, label %if.end
if.end: ; preds = %while.body
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(3) %s, ptr noundef nonnull dereferenceable(3) @.str.2, i64 3)
%cmp4 = icmp eq i32 %bcmp, 0
br i1 %cmp4, label %if.then5, label %if.end6
if.then5: ; preds = %if.end
%idxprom = sext i32 %4 to i64
%arrayidx = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
br label %if.end6
if.end6: ; preds = %if.then5, %if.end
%bcmp37 = call i32 @bcmp(ptr noundef nonnull dereferenceable(3) %s, ptr noundef nonnull dereferenceable(3) @.str.3, i64 3)
%cmp9 = icmp eq i32 %bcmp37, 0
br i1 %cmp9, label %land.lhs.true, label %while.cond.backedge
land.lhs.true: ; preds = %if.end6
%idxprom10 = sext i32 %4 to i64
%arrayidx11 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %idxprom10
%6 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp eq i32 %6, 0
br i1 %cmp12, label %if.then13, label %while.cond.backedge
if.then13: ; preds = %land.lhs.true
%arrayidx15 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %idxprom10
%7 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%inc = add nsw i32 %7, 1
store i32 %inc, ptr %arrayidx15, align 4, !tbaa !5
br label %while.cond.backedge
while.cond.backedge: ; preds = %if.end6, %land.lhs.true, %if.then13, %while.body
%8 = load i32, ptr %m, align 4, !tbaa !5
%dec = add nsw i32 %8, -1
store i32 %dec, ptr %m, align 4, !tbaa !5
%tobool.not = icmp eq i32 %8, 0
br i1 %tobool.not, label %for.cond.preheader, label %while.body, !llvm.loop !9
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%z.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %z.1.1, %for.inc.1 ]
%add20.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %add20.1, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%z.042.unr = phi i32 [ 0, %for.body.preheader ], [ %z.1.1, %for.inc.1 ]
%y.041.unr = phi i32 [ 0, %for.body.preheader ], [ %add20.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa
%arrayidx19.epil = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %indvars.iv.unr
%9 = load i32, ptr %arrayidx19.epil, align 4, !tbaa !5
%add20.epil = add nsw i32 %9, %y.041.unr
%cmp23.epil = icmp eq i32 %9, 1
br i1 %cmp23.epil, label %if.then24.epil, label %for.cond.cleanup
if.then24.epil: ; preds = %for.body.epil
%arrayidx26.epil = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %indvars.iv.unr
%10 = load i32, ptr %arrayidx26.epil, align 4, !tbaa !5
%add27.epil = add nsw i32 %10, %z.042.unr
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %if.then24.epil, %for.body.epil, %for.cond.preheader
%y.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %add20.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %add20.epil, %if.then24.epil ], [ %add20.epil, %for.body.epil ]
%z.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %z.1.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %add27.epil, %if.then24.epil ], [ %z.042.unr, %for.body.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %y.0.lcssa, i32 noundef %z.0.lcssa)
call void @llvm.lifetime.end.p0(i64 100000, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%z.042 = phi i32 [ 0, %for.body.preheader.new ], [ %z.1.1, %for.inc.1 ]
%y.041 = phi i32 [ 0, %for.body.preheader.new ], [ %add20.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx19 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %indvars.iv
%11 = load i32, ptr %arrayidx19, align 8, !tbaa !5
%add20 = add nsw i32 %11, %y.041
%cmp23 = icmp eq i32 %11, 1
br i1 %cmp23, label %if.then24, label %for.inc
if.then24: ; preds = %for.body
%arrayidx26 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %indvars.iv
%12 = load i32, ptr %arrayidx26, align 8, !tbaa !5
%add27 = add nsw i32 %12, %z.042
br label %for.inc
for.inc: ; preds = %for.body, %if.then24
%z.1 = phi i32 [ %add27, %if.then24 ], [ %z.042, %for.body ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx19.1 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %indvars.iv.next
%13 = load i32, ptr %arrayidx19.1, align 4, !tbaa !5
%add20.1 = add nsw i32 %13, %add20
%cmp23.1 = icmp eq i32 %13, 1
br i1 %cmp23.1, label %if.then24.1, label %for.inc.1
if.then24.1: ; preds = %for.inc
%arrayidx26.1 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %indvars.iv.next
%14 = load i32, ptr %arrayidx26.1, align 4, !tbaa !5
%add27.1 = add nsw i32 %14, %z.1
br label %for.inc.1
for.inc.1: ; preds = %if.then24.1, %for.inc
%z.1.1 = phi i32 [ %add27.1, %if.then24.1 ], [ %z.1, %for.inc ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) 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 willreturn memory(argmem: read) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(){
int a, b;
scanf("%d %d", &a, &b);
if(a < b){
printf("a < b\n");
} else if(a > b){
printf("a > b\n");
} else if(a == b){
printf("a == b\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288306/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288306/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.end10.sink.split, label %if.else
if.else: ; preds = %entry
%cmp2 = icmp sgt i32 %0, %1
br i1 %cmp2, label %if.end10.sink.split, label %if.else5
if.else5: ; preds = %if.else
%cmp6 = icmp eq i32 %0, %1
br i1 %cmp6, label %if.end10.sink.split, label %if.end10
if.end10.sink.split: ; preds = %if.else5, %if.else, %entry
%str.4.sink = phi ptr [ @str.5, %entry ], [ @str.4, %if.else ], [ @str, %if.else5 ]
%puts12 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
br label %if.end10
if.end10: ; preds = %if.end10.sink.split, %if.else5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main ()
{
char s[128];
int n;
scanf (" %d", &n);
scanf (" %s", s);
int i;
int zeros = 0;
int ones=0;
for (i = 0; i < n; i++)
{
if (s[i] == '0')
{
zeros++;
}
else
{
ones++;
}
}
if (n == 1)
{
if (zeros)
{
printf ("0");
}
else
{
printf ("1");
}
return 0;
}
printf ("1");
for (i = 0; i < zeros; i++)
{
printf ("0");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28835/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28835/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c" %s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [128 x i8], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.body.preheader, label %cleanup.sink.split
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader53, 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 ], [ %7, %vector.body ]
%vec.phi51 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%1 = getelementptr inbounds [128 x i8], ptr %s, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %1, align 8, !tbaa !9
%2 = getelementptr inbounds i8, ptr %1, i64 4
%wide.load52 = load <4 x i8>, ptr %2, align 4, !tbaa !9
%3 = icmp eq <4 x i8> %wide.load, <i8 48, i8 48, i8 48, i8 48>
%4 = icmp eq <4 x i8> %wide.load52, <i8 48, i8 48, i8 48, i8 48>
%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.phi51, %6
%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 !10
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.count
br i1 %cmp.n, label %for.end, label %for.body.preheader53
for.body.preheader53: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%zeros.039.ph = phi i32 [ 0, %for.body.preheader ], [ %10, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader53, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader53 ]
%zeros.039 = phi i32 [ %zeros.1, %for.body ], [ %zeros.039.ph, %for.body.preheader53 ]
%arrayidx = getelementptr inbounds [128 x i8], ptr %s, i64 0, i64 %indvars.iv
%11 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp2 = icmp eq i8 %11, 48
%inc = zext i1 %cmp2 to i32
%zeros.1 = add nuw nsw i32 %zeros.039, %inc
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !14
for.end: ; preds = %for.body, %middle.block
%zeros.1.lcssa = phi i32 [ %10, %middle.block ], [ %zeros.1, %for.body ]
%cmp6 = icmp eq i32 %0, 1
br i1 %cmp6, label %if.then8, label %if.end14
if.then8: ; preds = %for.end
%tobool.not = icmp eq i32 %zeros.1.lcssa, 0
%. = select i1 %tobool.not, i32 49, i32 48
br label %cleanup.sink.split
if.end14: ; preds = %for.end
%putchar = call i32 @putchar(i32 49)
%cmp1741.not = icmp eq i32 %zeros.1.lcssa, 0
br i1 %cmp1741.not, label %cleanup, label %for.body19
for.body19: ; preds = %if.end14, %for.body19
%i.142 = phi i32 [ %inc22, %for.body19 ], [ 0, %if.end14 ]
%putchar34 = call i32 @putchar(i32 48)
%inc22 = add nuw nsw i32 %i.142, 1
%exitcond44.not = icmp eq i32 %inc22, %zeros.1.lcssa
br i1 %exitcond44.not, label %cleanup, label %for.body19, !llvm.loop !15
cleanup.sink.split: ; preds = %if.then8, %entry
%.sink = phi i32 [ 49, %entry ], [ %., %if.then8 ]
%putchar49 = call i32 @putchar(i32 %.sink)
br label %cleanup
cleanup: ; preds = %for.body19, %cleanup.sink.split, %if.end14
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
!15 = distinct !{!15, !11}
|
#include <stdio.h>
#include <stdlib.h>
typedef long long int LLI;
int main(int argc, char const *argv[])
{
LLI k;
LLI n,m;
scanf("%lli%lli%lli",&n,&m,&k);
if (k>=n*m-1)
printf("1 2\n");
else if (k<n)
printf("%lli 1\n",k+1 );
else if( k<m+n-1)
printf("%lli %lli\n",n,k-n+2 );
else{
LLI KA,KB;
KA=(k-(m+n-1))%(m-1);
KB=(k-(m+n-1))/(m-1);
if (KB%2==0)
printf("%lli %lli\n",n-KB-1,m-KA );
else
printf("%lli %lli\n",n-KB-1,2+KA );
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28840/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28840/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lli%lli%lli\00", align 1
@.str.2 = private unnamed_addr constant [8 x i8] c"%lli 1\0A\00", align 1
@.str.3 = private unnamed_addr constant [11 x i8] c"%lli %lli\0A\00", align 1
@str = private unnamed_addr constant [4 x i8] c"1 2\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%k = alloca i64, align 8
%n = alloca i64, align 8
%m = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %k)
%0 = load i64, ptr %k, align 8, !tbaa !5
%1 = load i64, ptr %n, align 8, !tbaa !5
%2 = load i64, ptr %m, align 8, !tbaa !5
%mul = mul nsw i64 %2, %1
%sub = add nsw i64 %mul, -1
%cmp.not = icmp slt i64 %0, %sub
br i1 %cmp.not, label %if.else, label %if.then
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end36
if.else: ; preds = %entry
%cmp2 = icmp slt i64 %0, %1
br i1 %cmp2, label %if.then3, label %if.else5
if.then3: ; preds = %if.else
%add = add nsw i64 %0, 1
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add)
br label %if.end36
if.else5: ; preds = %if.else
%add6 = add i64 %2, -1
%sub7 = add i64 %add6, %1
%cmp8 = icmp slt i64 %0, %sub7
br i1 %cmp8, label %if.then9, label %if.else13
if.then9: ; preds = %if.else5
%sub10 = add i64 %0, 2
%add11 = sub i64 %sub10, %1
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %1, i64 noundef %add11)
br label %if.end36
if.else13: ; preds = %if.else5
%sub16 = sub nsw i64 %0, %sub7
%rem = srem i64 %sub16, %add6
%div = sdiv i64 %sub16, %add6
%3 = and i64 %div, 1
%cmp23 = icmp eq i64 %3, 0
%4 = xor i64 %div, -1
%sub26 = add i64 %1, %4
br i1 %cmp23, label %if.then24, label %if.else29
if.then24: ; preds = %if.else13
%sub27 = sub nsw i64 %2, %rem
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %sub26, i64 noundef %sub27)
br label %if.end36
if.else29: ; preds = %if.else13
%add32 = add nsw i64 %rem, 2
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %sub26, i64 noundef %add32)
br label %if.end36
if.end36: ; preds = %if.then24, %if.else29, %if.then3, %if.then9, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int a, b;
scanf("%d",&a);
scanf("%d",&b);
if(a == b){
printf("a == b\n");
} else if(a > b){
printf("a > b\n");
} else if(a < b){
printf("a < b\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288443/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288443/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8] c"a < b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
br i1 %cmp, label %if.end11.sink.split, label %if.else
if.else: ; preds = %entry
%cmp3 = icmp sgt i32 %0, %1
br i1 %cmp3, label %if.end11.sink.split, label %if.else6
if.else6: ; preds = %if.else
%cmp7 = icmp slt i32 %0, %1
br i1 %cmp7, label %if.end11.sink.split, label %if.end11
if.end11.sink.split: ; preds = %if.else6, %if.else, %entry
%str.4.sink = phi ptr [ @str.5, %entry ], [ @str.4, %if.else ], [ @str, %if.else6 ]
%puts13 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
br label %if.end11
if.end11: ; preds = %if.end11.sink.split, %if.else6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int a,b;
scanf("%d%d",&a,&b);
if(a<b) printf("a < b\n");
else if(a>b) printf("a > b\n");
else printf("a == b\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288494/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288494/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp sgt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int a,b,c;
char *s[]={"==","<",">"};
scanf("%d %d",&a,&b);
if(a==b) c=0;
else if(a<b) c=1;
else c=2;
printf("a %s b\n",s[c]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288537/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288537/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"==\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"<\00", align 1
@.str.2 = private unnamed_addr constant [2 x i8] c">\00", align 1
@reltable.main = private unnamed_addr constant [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
@.str.3 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.4 = private unnamed_addr constant [8 x i8] c"a %s b\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
%cmp1 = icmp slt i32 %0, %1
%. = select i1 %cmp1, i64 1, i64 2
%c.0 = select i1 %cmp, i64 0, i64 %.
%reltable.shift = shl i64 %c.0, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %reltable.intrinsic)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, 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 willreturn memory(argmem: read) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int a,b;
scanf("%d %d", &a, &b);
if(a<b) printf("a < b\n");
else if(a>b) printf("a > b\n");
else if(a==b) printf("a == b\n");
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288588/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288588/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.end10.sink.split, label %if.else
if.else: ; preds = %entry
%cmp2 = icmp sgt i32 %0, %1
br i1 %cmp2, label %if.end10.sink.split, label %if.else5
if.else5: ; preds = %if.else
%cmp6 = icmp eq i32 %0, %1
br i1 %cmp6, label %if.end10.sink.split, label %if.end10
if.end10.sink.split: ; preds = %if.else5, %if.else, %entry
%str.4.sink = phi ptr [ @str.5, %entry ], [ @str.4, %if.else ], [ @str, %if.else5 ]
%puts12 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
br label %if.end10
if.end10: ; preds = %if.end10.sink.split, %if.else5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
/*ここから上は消さないで*/
int main(){
int a;
int b;
scanf("%d %d", &a, &b);
if(a < b){
printf("a < b\n");
}else if(a > b){
printf("a > b\n");
}else{
printf("a == b\n");
}
return 0; //ここの行、重要
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288630/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288630/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp sgt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int a, b;
scanf("%d %d", &a, &b);
if(a<b){ printf("a < b\n"); }
else if(a>b){ printf("a > b\n"); }
else{ printf("a == b\n"); }
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288689/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288689/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp sgt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int a, b;
scanf("%d %d",&a,&b);
if(a<b){
printf("a < b\n");
}
else if(a>b){
printf("a > b\n");
}
else{
printf("a == b\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288731/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288731/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp sgt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int a, b;
scanf("%d %d", &a, &b);
if(a < b)
{
printf("a < b\n");
}
else if(a > b)
{
printf("a > b\n");
}
else
{
printf("a == b\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288775/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288775/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp sgt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int a, b;
scanf("%d %d", &a, &b);
if(a < b)
{
printf("a < b\n");
}
if(a > b)
{
printf("a > b\n");
}
if(a == b)
{
printf("a == b\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288825/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288825/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8] c"a < b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre12 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %.pre12, %if.then ], [ %1, %entry ]
%3 = phi i32 [ %.pre, %if.then ], [ %0, %entry ]
%cmp2 = icmp sgt i32 %3, %2
br i1 %cmp2, label %if.then3, label %if.end5
if.then3: ; preds = %if.end
%puts10 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
%.pre13 = load i32, ptr %a, align 4, !tbaa !5
%.pre14 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end5
if.end5: ; preds = %if.then3, %if.end
%4 = phi i32 [ %.pre14, %if.then3 ], [ %2, %if.end ]
%5 = phi i32 [ %.pre13, %if.then3 ], [ %3, %if.end ]
%cmp6 = icmp eq i32 %5, %4
br i1 %cmp6, label %if.then7, label %if.end9
if.then7: ; preds = %if.end5
%puts11 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %if.end9
if.end9: ; preds = %if.then7, %if.end5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
// AOJ 2334 Roads on Towns
// 2018.2.24 bal4u
#include <stdio.h>
#include <math.h>
#define EPS 1e-10
#define INF 1e20
typedef struct { double x, y; } PP;
PP p[2][1002];
PP vectorSub(PP p1, PP p2) { PP r; r.x = p1.x - p2.x, r.y = p1.y - p2.y; return r; }
double cross(PP a, PP b) { return a.x * b.y - a.y * b.x; }
double dot(PP a, PP b) { return a.x * b.x + a.y * b.y; }
double norm(PP a) { return a.x * a.x + a.y * a.y; }
double vectorAbs(PP a) { return hypot(a.x, a.y); }
int ccw(PP p0, PP p1, PP p2)
{
PP a = vectorSub(p1, p0), b = vectorSub(p2, p0);
double t = cross(a, b);
if (t > EPS) return 1;
if (t < -EPS) return -1;
if (dot(a, b) < -EPS) return 2;
if (norm(a) < norm(b)) return -2;
return 0;
}
int intersect(PP p1, PP p2, PP p3, PP p4)
{
return ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 &&
ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0;
}
//#define getchar_unlocked() getchar()
int in()
{
int n = 0;
int c = getchar_unlocked();
if (c == '-') {
c = getchar_unlocked();
do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
while (c >= '0');
return -n;
}
do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
while (c >= '0');
return n;
}
double calc(PP s, PP g, PP *a, int n, PP es, PP eg)
{
int i, j;
double ans, x, y, z;
if (!intersect(s, g, es, eg)) return vectorAbs(vectorSub(s, g));
if (n == 0) return INF+100;
ans = INF+100;
for (i = 0; i < n; i++) {
if (intersect(s, a[i], es, eg)) continue;
x = vectorAbs(vectorSub(s, a[i]));
if (x >= ans) continue;
if (!intersect(g, a[i], es, eg)) {
y = vectorAbs(vectorSub(g, a[i]));
if (x + y < ans) ans = x + y;
continue;
}
for (j = 0; j < n; j++) if (j != i) {
if (intersect(a[i], a[j], es, eg)) continue;
y = vectorAbs(vectorSub(a[i], a[j]));
if (x + y >= ans) continue;
if (!intersect(g, a[j], es, eg)) {
z = vectorAbs(vectorSub(g, a[j]));
if (x + y + z < ans) ans = x + y + z;
}
}
}
return ans;
}
int main()
{
int i, j, n[2];
PP s[2], g[2];
double ans, x;
n[0] = in()-2, n[1] = in()-2;
for (i = 0; i < 2; i++) {
s[i].x = in(), s[i].y = in();
g[i].x = in(), g[i].y = in();
for (j = 0; j < n[i]; j++) p[i][j].x = in(), p[i][j].y = in();
}
ans = INF+100;
for (i = 0; i < 2; i++) {
x = vectorAbs(vectorSub(s[1-i], g[1-i])) + calc(s[i], g[i], p[i], n[i], s[1-i], g[1-i]);
if (x < ans) ans = x;
}
if (ans >= INF) puts("-1");
else printf("%.12lf\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288869/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288869/source.c"
target datalayout = "e-m:e-p270: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.PP = type { double, double }
%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] }
@p = dso_local global [2 x [1002 x %struct.PP]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
@.str.1 = private unnamed_addr constant [8 x i8] c"%.12lf\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local { double, double } @vectorSub(double %p1.coerce0, double %p1.coerce1, double %p2.coerce0, double %p2.coerce1) local_unnamed_addr #0 {
entry:
%sub = fsub double %p1.coerce0, %p2.coerce0
%sub4 = fsub double %p1.coerce1, %p2.coerce1
%.fca.0.insert = insertvalue { double, double } poison, double %sub, 0
%.fca.1.insert = insertvalue { double, double } %.fca.0.insert, double %sub4, 1
ret { double, double } %.fca.1.insert
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local double @cross(double %a.coerce0, double %a.coerce1, double %b.coerce0, double %b.coerce1) local_unnamed_addr #1 {
entry:
%0 = fneg double %a.coerce1
%neg = fmul double %0, %b.coerce0
%1 = tail call double @llvm.fmuladd.f64(double %a.coerce0, double %b.coerce1, double %neg)
ret double %1
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local double @dot(double %a.coerce0, double %a.coerce1, double %b.coerce0, double %b.coerce1) local_unnamed_addr #1 {
entry:
%mul3 = fmul double %a.coerce1, %b.coerce1
%0 = tail call double @llvm.fmuladd.f64(double %a.coerce0, double %b.coerce0, double %mul3)
ret double %0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local double @norm(double %a.coerce0, double %a.coerce1) local_unnamed_addr #1 {
entry:
%mul3 = fmul double %a.coerce1, %a.coerce1
%0 = tail call double @llvm.fmuladd.f64(double %a.coerce0, double %a.coerce0, double %mul3)
ret double %0
}
; Function Attrs: nounwind uwtable
define dso_local double @vectorAbs(double %a.coerce0, double %a.coerce1) local_unnamed_addr #3 {
entry:
%call = tail call double @hypot(double noundef %a.coerce0, double noundef %a.coerce1) #9
ret double %call
}
; Function Attrs: nounwind
declare double @hypot(double noundef, double noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ccw(double %p0.coerce0, double %p0.coerce1, double %p1.coerce0, double %p1.coerce1, double %p2.coerce0, double %p2.coerce1) local_unnamed_addr #1 {
entry:
%0 = insertelement <2 x double> poison, double %p1.coerce0, i64 0
%1 = insertelement <2 x double> %0, double %p2.coerce0, i64 1
%2 = insertelement <2 x double> poison, double %p0.coerce0, i64 0
%3 = shufflevector <2 x double> %2, <2 x double> poison, <2 x i32> zeroinitializer
%4 = fsub <2 x double> %1, %3
%5 = insertelement <2 x double> poison, double %p1.coerce1, i64 0
%6 = insertelement <2 x double> %5, double %p2.coerce1, i64 1
%7 = insertelement <2 x double> poison, double %p0.coerce1, i64 0
%8 = shufflevector <2 x double> %7, <2 x double> poison, <2 x i32> zeroinitializer
%9 = fsub <2 x double> %6, %8
%10 = extractelement <2 x double> %9, i64 0
%11 = fneg double %10
%12 = extractelement <2 x double> %4, i64 1
%neg.i = fmul double %12, %11
%13 = extractelement <2 x double> %4, i64 0
%14 = extractelement <2 x double> %9, i64 1
%15 = tail call double @llvm.fmuladd.f64(double %13, double %14, double %neg.i)
%cmp = fcmp ogt double %15, 1.000000e-10
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp3 = fcmp olt double %15, -1.000000e-10
br i1 %cmp3, label %cleanup, label %if.end5
if.end5: ; preds = %if.end
%mul3.i = fmul double %10, %14
%16 = tail call double @llvm.fmuladd.f64(double %13, double %12, double %mul3.i)
%cmp7 = fcmp olt double %16, -1.000000e-10
br i1 %cmp7, label %cleanup, label %if.end9
if.end9: ; preds = %if.end5
%17 = fmul <2 x double> %9, %9
%18 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %4, <2 x double> %4, <2 x double> %17)
%19 = extractelement <2 x double> %18, i64 0
%20 = extractelement <2 x double> %18, i64 1
%cmp12 = fcmp olt double %19, %20
%. = select i1 %cmp12, i32 -2, i32 0
br label %cleanup
cleanup: ; preds = %if.end9, %if.end5, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ -1, %if.end ], [ 2, %if.end5 ], [ %., %if.end9 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #5
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @intersect(double %p1.coerce0, double %p1.coerce1, double %p2.coerce0, double %p2.coerce1, double %p3.coerce0, double %p3.coerce1, double %p4.coerce0, double %p4.coerce1) local_unnamed_addr #1 {
entry:
%0 = insertelement <2 x double> poison, double %p2.coerce0, i64 0
%1 = insertelement <2 x double> %0, double %p3.coerce0, i64 1
%2 = insertelement <2 x double> poison, double %p1.coerce0, i64 0
%3 = shufflevector <2 x double> %2, <2 x double> poison, <2 x i32> zeroinitializer
%4 = fsub <2 x double> %1, %3
%5 = insertelement <2 x double> poison, double %p2.coerce1, i64 0
%6 = insertelement <2 x double> %5, double %p3.coerce1, i64 1
%7 = insertelement <2 x double> poison, double %p1.coerce1, i64 0
%8 = shufflevector <2 x double> %7, <2 x double> poison, <2 x i32> zeroinitializer
%9 = fsub <2 x double> %6, %8
%10 = extractelement <2 x double> %9, i64 0
%11 = fneg double %10
%12 = extractelement <2 x double> %4, i64 1
%neg.i.i = fmul double %12, %11
%13 = extractelement <2 x double> %4, i64 0
%14 = extractelement <2 x double> %9, i64 1
%15 = tail call double @llvm.fmuladd.f64(double %13, double %14, double %neg.i.i)
%cmp.i = fcmp ogt double %15, 1.000000e-10
br i1 %cmp.i, label %ccw.exit, label %if.end.i
if.end.i: ; preds = %entry
%cmp3.i = fcmp olt double %15, -1.000000e-10
br i1 %cmp3.i, label %ccw.exit, label %if.end5.i
if.end5.i: ; preds = %if.end.i
%mul3.i.i = fmul double %10, %14
%16 = tail call double @llvm.fmuladd.f64(double %13, double %12, double %mul3.i.i)
%cmp7.i = fcmp olt double %16, -1.000000e-10
br i1 %cmp7.i, label %ccw.exit, label %if.end9.i
if.end9.i: ; preds = %if.end5.i
%17 = fmul <2 x double> %9, %9
%18 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %4, <2 x double> %4, <2 x double> %17)
%19 = extractelement <2 x double> %18, i64 0
%20 = extractelement <2 x double> %18, i64 1
%cmp12.i = fcmp olt double %19, %20
%..i = select i1 %cmp12.i, i32 -2, i32 0
br label %ccw.exit
ccw.exit: ; preds = %entry, %if.end.i, %if.end5.i, %if.end9.i
%retval.0.i = phi i32 [ 1, %entry ], [ -1, %if.end.i ], [ 2, %if.end5.i ], [ %..i, %if.end9.i ]
%sub.i28.i24 = fsub double %p4.coerce0, %p1.coerce0
%sub4.i29.i25 = fsub double %p4.coerce1, %p1.coerce1
%neg.i.i26 = fmul double %sub.i28.i24, %11
%21 = tail call double @llvm.fmuladd.f64(double %13, double %sub4.i29.i25, double %neg.i.i26)
%cmp.i27 = fcmp ogt double %21, 1.000000e-10
br i1 %cmp.i27, label %ccw.exit39, label %if.end.i28
if.end.i28: ; preds = %ccw.exit
%cmp3.i29 = fcmp olt double %21, -1.000000e-10
br i1 %cmp3.i29, label %ccw.exit39, label %if.end5.i30
if.end5.i30: ; preds = %if.end.i28
%mul3.i.i31 = fmul double %10, %sub4.i29.i25
%22 = tail call double @llvm.fmuladd.f64(double %13, double %sub.i28.i24, double %mul3.i.i31)
%cmp7.i32 = fcmp olt double %22, -1.000000e-10
br i1 %cmp7.i32, label %ccw.exit39, label %if.end9.i33
if.end9.i33: ; preds = %if.end5.i30
%23 = insertelement <2 x double> %9, double %sub4.i29.i25, i64 1
%24 = fmul <2 x double> %23, %23
%25 = insertelement <2 x double> %4, double %sub.i28.i24, i64 1
%26 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %25, <2 x double> %25, <2 x double> %24)
%27 = extractelement <2 x double> %26, i64 0
%28 = extractelement <2 x double> %26, i64 1
%cmp12.i36 = fcmp olt double %27, %28
%..i37 = select i1 %cmp12.i36, i32 -2, i32 0
br label %ccw.exit39
ccw.exit39: ; preds = %ccw.exit, %if.end.i28, %if.end5.i30, %if.end9.i33
%retval.0.i38 = phi i32 [ 1, %ccw.exit ], [ -1, %if.end.i28 ], [ 2, %if.end5.i30 ], [ %..i37, %if.end9.i33 ]
%mul = mul nsw i32 %retval.0.i38, %retval.0.i
%cmp = icmp slt i32 %mul, 1
br i1 %cmp, label %land.rhs, label %land.end
land.rhs: ; preds = %ccw.exit39
%29 = insertelement <2 x double> poison, double %p4.coerce0, i64 0
%30 = insertelement <2 x double> %29, double %p1.coerce0, i64 1
%31 = insertelement <2 x double> poison, double %p3.coerce0, i64 0
%32 = shufflevector <2 x double> %31, <2 x double> poison, <2 x i32> zeroinitializer
%33 = fsub <2 x double> %30, %32
%34 = insertelement <2 x double> poison, double %p4.coerce1, i64 0
%35 = insertelement <2 x double> %34, double %p1.coerce1, i64 1
%36 = insertelement <2 x double> poison, double %p3.coerce1, i64 0
%37 = shufflevector <2 x double> %36, <2 x double> poison, <2 x i32> zeroinitializer
%38 = fsub <2 x double> %35, %37
%39 = extractelement <2 x double> %38, i64 0
%40 = fneg double %39
%41 = extractelement <2 x double> %33, i64 1
%neg.i.i44 = fmul double %41, %40
%42 = extractelement <2 x double> %33, i64 0
%43 = extractelement <2 x double> %38, i64 1
%44 = tail call double @llvm.fmuladd.f64(double %42, double %43, double %neg.i.i44)
%cmp.i45 = fcmp ogt double %44, 1.000000e-10
br i1 %cmp.i45, label %ccw.exit57, label %if.end.i46
if.end.i46: ; preds = %land.rhs
%cmp3.i47 = fcmp olt double %44, -1.000000e-10
br i1 %cmp3.i47, label %ccw.exit57, label %if.end5.i48
if.end5.i48: ; preds = %if.end.i46
%mul3.i.i49 = fmul double %43, %39
%45 = tail call double @llvm.fmuladd.f64(double %42, double %41, double %mul3.i.i49)
%cmp7.i50 = fcmp olt double %45, -1.000000e-10
br i1 %cmp7.i50, label %ccw.exit57, label %if.end9.i51
if.end9.i51: ; preds = %if.end5.i48
%46 = fmul <2 x double> %38, %38
%47 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %33, <2 x double> %33, <2 x double> %46)
%48 = extractelement <2 x double> %47, i64 0
%49 = extractelement <2 x double> %47, i64 1
%cmp12.i54 = fcmp olt double %48, %49
%..i55 = select i1 %cmp12.i54, i32 -2, i32 0
br label %ccw.exit57
ccw.exit57: ; preds = %land.rhs, %if.end.i46, %if.end5.i48, %if.end9.i51
%retval.0.i56 = phi i32 [ 1, %land.rhs ], [ -1, %if.end.i46 ], [ 2, %if.end5.i48 ], [ %..i55, %if.end9.i51 ]
%sub.i28.i60 = fsub double %p2.coerce0, %p3.coerce0
%sub4.i29.i61 = fsub double %p2.coerce1, %p3.coerce1
%neg.i.i62 = fmul double %sub.i28.i60, %40
%50 = tail call double @llvm.fmuladd.f64(double %42, double %sub4.i29.i61, double %neg.i.i62)
%cmp.i63 = fcmp ogt double %50, 1.000000e-10
br i1 %cmp.i63, label %ccw.exit75, label %if.end.i64
if.end.i64: ; preds = %ccw.exit57
%cmp3.i65 = fcmp olt double %50, -1.000000e-10
br i1 %cmp3.i65, label %ccw.exit75, label %if.end5.i66
if.end5.i66: ; preds = %if.end.i64
%mul3.i.i67 = fmul double %sub4.i29.i61, %39
%51 = tail call double @llvm.fmuladd.f64(double %42, double %sub.i28.i60, double %mul3.i.i67)
%cmp7.i68 = fcmp olt double %51, -1.000000e-10
br i1 %cmp7.i68, label %ccw.exit75, label %if.end9.i69
if.end9.i69: ; preds = %if.end5.i66
%52 = insertelement <2 x double> %38, double %sub4.i29.i61, i64 1
%53 = fmul <2 x double> %52, %52
%54 = insertelement <2 x double> %33, double %sub.i28.i60, i64 1
%55 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %54, <2 x double> %54, <2 x double> %53)
%56 = extractelement <2 x double> %55, i64 0
%57 = extractelement <2 x double> %55, i64 1
%cmp12.i72 = fcmp olt double %56, %57
%..i73 = select i1 %cmp12.i72, i32 -2, i32 0
br label %ccw.exit75
ccw.exit75: ; preds = %ccw.exit57, %if.end.i64, %if.end5.i66, %if.end9.i69
%retval.0.i74 = phi i32 [ 1, %ccw.exit57 ], [ -1, %if.end.i64 ], [ 2, %if.end5.i66 ], [ %..i73, %if.end9.i69 ]
%mul4 = mul nsw i32 %retval.0.i74, %retval.0.i56
%cmp5 = icmp slt i32 %mul4, 1
%58 = zext i1 %cmp5 to i32
br label %land.end
land.end: ; preds = %ccw.exit75, %ccw.exit39
%land.ext = phi i32 [ 0, %ccw.exit39 ], [ %58, %ccw.exit75 ]
ret i32 %land.ext
}
; Function Attrs: nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #3 {
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) #9
br label %getchar_unlocked.exit
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 %getchar_unlocked.exit
getchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
%cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ]
%cmp = icmp eq i32 %cond.i, 45
%4 = load ptr, ptr @stdin, align 8, !tbaa !5
br i1 %cmp, label %if.then, label %do.body6
if.then: ; preds = %getchar_unlocked.exit
%_IO_read_ptr.i26 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i26, align 8, !tbaa !9
%_IO_read_end.i27 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i27, align 8, !tbaa !14
%cmp.not.i28 = icmp ult ptr %5, %6
br i1 %cmp.not.i28, label %cond.false.i32, label %cond.true.i29, !prof !15
cond.true.i29: ; preds = %if.then
%call.i30 = tail call i32 @__uflow(ptr noundef nonnull %4) #9
%.pre58.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.preheader
cond.false.i32: ; preds = %if.then
%incdec.ptr.i33 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i33, ptr %_IO_read_ptr.i26, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i34 = zext i8 %7 to i32
br label %do.body.preheader
do.body.preheader: ; preds = %cond.true.i29, %cond.false.i32
%.ph = phi ptr [ %4, %cond.false.i32 ], [ %.pre58.pre, %cond.true.i29 ]
%c.0.ph = phi i32 [ %conv3.i34, %cond.false.i32 ], [ %call.i30, %cond.true.i29 ]
br label %do.body
do.body: ; preds = %do.body.preheader, %getchar_unlocked.exit45
%8 = phi ptr [ %12, %getchar_unlocked.exit45 ], [ %.ph, %do.body.preheader ]
%n.0 = phi i32 [ %add3, %getchar_unlocked.exit45 ], [ 0, %do.body.preheader ]
%c.0 = phi i32 [ %cond.i41, %getchar_unlocked.exit45 ], [ %c.0.ph, %do.body.preheader ]
%add = mul i32 %n.0, 10
%and = and i32 %c.0, 15
%add3 = add nsw i32 %and, %add
%_IO_read_ptr.i36 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 1
%9 = load ptr, ptr %_IO_read_ptr.i36, align 8, !tbaa !9
%_IO_read_end.i37 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 2
%10 = load ptr, ptr %_IO_read_end.i37, align 8, !tbaa !14
%cmp.not.i38 = icmp ult ptr %9, %10
br i1 %cmp.not.i38, label %cond.false.i42, label %cond.true.i39, !prof !15
cond.true.i39: ; preds = %do.body
%call.i40 = tail call i32 @__uflow(ptr noundef nonnull %8) #9
%.pre57 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit45
cond.false.i42: ; preds = %do.body
%incdec.ptr.i43 = getelementptr inbounds i8, ptr %9, i64 1
store ptr %incdec.ptr.i43, ptr %_IO_read_ptr.i36, align 8, !tbaa !9
%11 = load i8, ptr %9, align 1, !tbaa !16
%conv3.i44 = zext i8 %11 to i32
br label %getchar_unlocked.exit45
getchar_unlocked.exit45: ; preds = %cond.true.i39, %cond.false.i42
%12 = phi ptr [ %.pre57, %cond.true.i39 ], [ %8, %cond.false.i42 ]
%cond.i41 = phi i32 [ %call.i40, %cond.true.i39 ], [ %conv3.i44, %cond.false.i42 ]
%cmp5 = icmp sgt i32 %cond.i41, 47
br i1 %cmp5, label %do.body, label %do.end, !llvm.loop !17
do.end: ; preds = %getchar_unlocked.exit45
%sub = sub nsw i32 0, %add3
br label %cleanup
do.body6: ; preds = %getchar_unlocked.exit, %getchar_unlocked.exit55
%13 = phi ptr [ %17, %getchar_unlocked.exit55 ], [ %4, %getchar_unlocked.exit ]
%n.1 = phi i32 [ %add11, %getchar_unlocked.exit55 ], [ 0, %getchar_unlocked.exit ]
%c.1 = phi i32 [ %cond.i51, %getchar_unlocked.exit55 ], [ %cond.i, %getchar_unlocked.exit ]
%add9 = mul i32 %n.1, 10
%and10 = and i32 %c.1, 15
%add11 = add nsw i32 %and10, %add9
%_IO_read_ptr.i46 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 1
%14 = load ptr, ptr %_IO_read_ptr.i46, align 8, !tbaa !9
%_IO_read_end.i47 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 2
%15 = load ptr, ptr %_IO_read_end.i47, align 8, !tbaa !14
%cmp.not.i48 = icmp ult ptr %14, %15
br i1 %cmp.not.i48, label %cond.false.i52, label %cond.true.i49, !prof !15
cond.true.i49: ; preds = %do.body6
%call.i50 = tail call i32 @__uflow(ptr noundef nonnull %13) #9
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit55
cond.false.i52: ; preds = %do.body6
%incdec.ptr.i53 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr.i53, ptr %_IO_read_ptr.i46, align 8, !tbaa !9
%16 = load i8, ptr %14, align 1, !tbaa !16
%conv3.i54 = zext i8 %16 to i32
br label %getchar_unlocked.exit55
getchar_unlocked.exit55: ; preds = %cond.true.i49, %cond.false.i52
%17 = phi ptr [ %.pre, %cond.true.i49 ], [ %13, %cond.false.i52 ]
%cond.i51 = phi i32 [ %call.i50, %cond.true.i49 ], [ %conv3.i54, %cond.false.i52 ]
%cmp14 = icmp sgt i32 %cond.i51, 47
br i1 %cmp14, label %do.body6, label %cleanup, !llvm.loop !19
cleanup: ; preds = %getchar_unlocked.exit55, %do.end
%retval.0 = phi i32 [ %sub, %do.end ], [ %add11, %getchar_unlocked.exit55 ]
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local double @calc(double %s.coerce0, double %s.coerce1, double %g.coerce0, double %g.coerce1, ptr nocapture noundef readonly %a, i32 noundef %n, double %es.coerce0, double %es.coerce1, double %eg.coerce0, double %eg.coerce1) local_unnamed_addr #3 {
entry:
%call = tail call i32 @intersect(double %s.coerce0, double %s.coerce1, double %g.coerce0, double %g.coerce1, double %es.coerce0, double %es.coerce1, double %eg.coerce0, double %eg.coerce1), !range !20
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %if.then, label %if.end
if.then: ; preds = %entry
%sub.i = fsub double %s.coerce0, %g.coerce0
%sub4.i = fsub double %s.coerce1, %g.coerce1
%call.i = tail call double @hypot(double noundef %sub.i, double noundef %sub4.i) #9
br label %cleanup
if.end: ; preds = %entry
%cmp5178 = icmp sgt i32 %n, 0
br i1 %cmp5178, label %for.body.us.preheader, label %cleanup
for.body.us.preheader: ; preds = %if.end
%wide.trip.count186 = zext i32 %n to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.inc76.us
%indvars.iv183 = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next184, %for.inc76.us ]
%ans.0179.us = phi double [ 1.000000e+20, %for.body.us.preheader ], [ %ans.3.us, %for.inc76.us ]
%arrayidx.us = getelementptr inbounds %struct.PP, ptr %a, i64 %indvars.iv183
%0 = load double, ptr %arrayidx.us, align 8
%1 = getelementptr inbounds { double, double }, ptr %arrayidx.us, i64 0, i32 1
%2 = load double, ptr %1, align 8
%call6.us = tail call i32 @intersect(double %s.coerce0, double %s.coerce1, double %0, double %2, double %es.coerce0, double %es.coerce1, double %eg.coerce0, double %eg.coerce1), !range !20
%tobool7.not.us = icmp eq i32 %call6.us, 0
br i1 %tobool7.not.us, label %if.end9.us, label %for.inc76.us
if.end9.us: ; preds = %for.body.us
%sub.i155.us = fsub double %s.coerce0, %0
%sub4.i156.us = fsub double %s.coerce1, %2
%call.i159.us = tail call double @hypot(double noundef %sub.i155.us, double noundef %sub4.i156.us) #9
%cmp15.us = fcmp ult double %call.i159.us, %ans.0179.us
br i1 %cmp15.us, label %if.end17.us, label %for.inc76.us
if.end17.us: ; preds = %if.end9.us
%3 = load double, ptr %arrayidx.us, align 8
%4 = load double, ptr %1, align 8
%call20.us = tail call i32 @intersect(double %g.coerce0, double %g.coerce1, double %3, double %4, double %es.coerce0, double %es.coerce1, double %eg.coerce0, double %eg.coerce1), !range !20
%tobool21.not.us = icmp eq i32 %call20.us, 0
br i1 %tobool21.not.us, label %if.then22.us, label %for.body35.us
for.body35.us: ; preds = %if.end17.us, %for.inc.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc.us ], [ 0, %if.end17.us ]
%ans.1176.us = phi double [ %ans.2.us, %for.inc.us ], [ %ans.0179.us, %if.end17.us ]
%cmp36.not.us = icmp eq i64 %indvars.iv, %indvars.iv183
br i1 %cmp36.not.us, label %for.inc.us, label %if.then37.us
if.then37.us: ; preds = %for.body35.us
%arrayidx41.us = getelementptr inbounds %struct.PP, ptr %a, i64 %indvars.iv
%5 = load double, ptr %arrayidx.us, align 8
%6 = load double, ptr %1, align 8
%7 = load double, ptr %arrayidx41.us, align 8
%8 = getelementptr inbounds { double, double }, ptr %arrayidx41.us, i64 0, i32 1
%9 = load double, ptr %8, align 8
%call42.us = tail call i32 @intersect(double %5, double %6, double %7, double %9, double %es.coerce0, double %es.coerce1, double %eg.coerce0, double %eg.coerce1), !range !20
%tobool43.not.us = icmp eq i32 %call42.us, 0
br i1 %tobool43.not.us, label %if.end45.us, label %for.inc.us
if.end45.us: ; preds = %if.then37.us
%sub.i165.us = fsub double %5, %7
%sub4.i166.us = fsub double %6, %9
%call.i169.us = tail call double @hypot(double noundef %sub.i165.us, double noundef %sub4.i166.us) #9
%add53.us = fadd double %call.i159.us, %call.i169.us
%cmp54.us = fcmp ult double %add53.us, %ans.1176.us
br i1 %cmp54.us, label %if.end56.us, label %for.inc.us
if.end56.us: ; preds = %if.end45.us
%10 = load double, ptr %arrayidx41.us, align 8
%11 = load double, ptr %8, align 8
%call59.us = tail call i32 @intersect(double %g.coerce0, double %g.coerce1, double %10, double %11, double %es.coerce0, double %es.coerce1, double %eg.coerce0, double %eg.coerce1), !range !20
%tobool60.not.us = icmp eq i32 %call59.us, 0
br i1 %tobool60.not.us, label %if.then61.us, label %for.inc.us
if.then61.us: ; preds = %if.end56.us
%sub.i170.us = fsub double %g.coerce0, %10
%sub4.i171.us = fsub double %g.coerce1, %11
%call.i174.us = tail call double @hypot(double noundef %sub.i170.us, double noundef %sub4.i171.us) #9
%add68.us = fadd double %add53.us, %call.i174.us
%cmp69.us = fcmp olt double %add68.us, %ans.1176.us
br i1 %cmp69.us, label %if.then70.us, label %for.inc.us
if.then70.us: ; preds = %if.then61.us
br label %for.inc.us
for.inc.us: ; preds = %if.then70.us, %if.then61.us, %if.end56.us, %if.end45.us, %if.then37.us, %for.body35.us
%ans.2.us = phi double [ %ans.1176.us, %if.then37.us ], [ %ans.1176.us, %if.end45.us ], [ %ans.1176.us, %if.end56.us ], [ %add68.us, %if.then70.us ], [ %ans.1176.us, %if.then61.us ], [ %ans.1176.us, %for.body35.us ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count186
br i1 %exitcond.not, label %for.inc76.us, label %for.body35.us, !llvm.loop !21
if.then22.us: ; preds = %if.end17.us
%sub.i160.us = fsub double %g.coerce0, %3
%sub4.i161.us = fsub double %g.coerce1, %4
%call.i164.us = tail call double @hypot(double noundef %sub.i160.us, double noundef %sub4.i161.us) #9
%add.us = fadd double %call.i159.us, %call.i164.us
%cmp28.us = fcmp olt double %add.us, %ans.0179.us
br i1 %cmp28.us, label %if.then29.us, label %for.inc76.us
if.then29.us: ; preds = %if.then22.us
br label %for.inc76.us
for.inc76.us: ; preds = %for.inc.us, %if.then29.us, %if.then22.us, %if.end9.us, %for.body.us
%ans.3.us = phi double [ %ans.0179.us, %for.body.us ], [ %ans.0179.us, %if.end9.us ], [ %add.us, %if.then29.us ], [ %ans.0179.us, %if.then22.us ], [ %ans.2.us, %for.inc.us ]
%indvars.iv.next184 = add nuw nsw i64 %indvars.iv183, 1
%exitcond187.not = icmp eq i64 %indvars.iv.next184, %wide.trip.count186
br i1 %exitcond187.not, label %cleanup, label %for.body.us, !llvm.loop !22
cleanup: ; preds = %for.inc76.us, %if.end, %if.then
%retval.0 = phi double [ %call.i, %if.then ], [ 1.000000e+20, %if.end ], [ %ans.3.us, %for.inc76.us ]
ret double %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca [2 x i32], align 4
%s = alloca [2 x %struct.PP], align 16
%g = alloca [2 x %struct.PP], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %s) #9
call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %g) #9
%call = tail call i32 @in()
%sub = add nsw i32 %call, -2
store i32 %sub, ptr %n, align 4, !tbaa !23
%call1 = tail call i32 @in()
%sub2 = add nsw i32 %call1, -2
%arrayidx3 = getelementptr inbounds [2 x i32], ptr %n, i64 0, i64 1
store i32 %sub2, ptr %arrayidx3, align 4, !tbaa !23
br label %for.body
for.body: ; preds = %entry, %for.inc41
%cmp = phi i1 [ true, %entry ], [ false, %for.inc41 ]
%indvars.iv177 = phi i64 [ 0, %entry ], [ 1, %for.inc41 ]
%call4 = tail call i32 @in()
%conv = sitofp i32 %call4 to double
%arrayidx5 = getelementptr inbounds [2 x %struct.PP], ptr %s, i64 0, i64 %indvars.iv177
store double %conv, ptr %arrayidx5, align 16, !tbaa !24
%call7 = tail call i32 @in()
%conv8 = sitofp i32 %call7 to double
%y = getelementptr inbounds [2 x %struct.PP], ptr %s, i64 0, i64 %indvars.iv177, i32 1
store double %conv8, ptr %y, align 8, !tbaa !27
%call11 = tail call i32 @in()
%conv12 = sitofp i32 %call11 to double
%arrayidx14 = getelementptr inbounds [2 x %struct.PP], ptr %g, i64 0, i64 %indvars.iv177
store double %conv12, ptr %arrayidx14, align 16, !tbaa !24
%call16 = tail call i32 @in()
%conv17 = sitofp i32 %call16 to double
%y20 = getelementptr inbounds [2 x %struct.PP], ptr %g, i64 0, i64 %indvars.iv177, i32 1
store double %conv17, ptr %y20, align 8, !tbaa !27
%arrayidx23 = getelementptr inbounds [2 x i32], ptr %n, i64 0, i64 %indvars.iv177
%0 = load i32, ptr %arrayidx23, align 4, !tbaa !23
%cmp24171 = icmp sgt i32 %0, 0
br i1 %cmp24171, label %for.body26.preheader, label %for.inc41
for.body26.preheader: ; preds = %for.body
%wide.trip.count = zext i32 %0 to i64
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %for.body26
for.body26: ; preds = %for.body26.preheader, %in.exit169
%1 = phi ptr [ %.pre, %for.body26.preheader ], [ %48, %in.exit169 ]
%2 = phi ptr [ %.pre, %for.body26.preheader ], [ %49, %in.exit169 ]
%indvars.iv = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next, %in.exit169 ]
%_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %2, i64 0, i32 1
%3 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %2, i64 0, i32 2
%4 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !14
%cmp.not.i.i = icmp ult ptr %3, %4
br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !15
cond.true.i.i: ; preds = %for.body26
%call.i.i = tail call i32 @__uflow(ptr noundef nonnull %2) #9
%.pre184 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit.i
cond.false.i.i: ; preds = %for.body26
%incdec.ptr.i.i = getelementptr inbounds i8, ptr %3, i64 1
store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%5 = load i8, ptr %3, align 1, !tbaa !16
%conv3.i.i = zext i8 %5 to i32
br label %getchar_unlocked.exit.i
getchar_unlocked.exit.i: ; preds = %cond.false.i.i, %cond.true.i.i
%6 = phi ptr [ %.pre184, %cond.true.i.i ], [ %1, %cond.false.i.i ]
%7 = phi ptr [ %.pre184, %cond.true.i.i ], [ %2, %cond.false.i.i ]
%cond.i.i = phi i32 [ %call.i.i, %cond.true.i.i ], [ %conv3.i.i, %cond.false.i.i ]
%cmp.i = icmp eq i32 %cond.i.i, 45
br i1 %cmp.i, label %if.then.i, label %do.body6.i
if.then.i: ; preds = %getchar_unlocked.exit.i
%_IO_read_ptr.i26.i = getelementptr inbounds %struct._IO_FILE, ptr %7, i64 0, i32 1
%8 = load ptr, ptr %_IO_read_ptr.i26.i, align 8, !tbaa !9
%_IO_read_end.i27.i = getelementptr inbounds %struct._IO_FILE, ptr %7, i64 0, i32 2
%9 = load ptr, ptr %_IO_read_end.i27.i, align 8, !tbaa !14
%cmp.not.i28.i = icmp ult ptr %8, %9
br i1 %cmp.not.i28.i, label %cond.false.i32.i, label %cond.true.i29.i, !prof !15
cond.true.i29.i: ; preds = %if.then.i
%call.i30.i = tail call i32 @__uflow(ptr noundef nonnull %7) #9
%.pre58.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i.preheader
cond.false.i32.i: ; preds = %if.then.i
%incdec.ptr.i33.i = getelementptr inbounds i8, ptr %8, i64 1
store ptr %incdec.ptr.i33.i, ptr %_IO_read_ptr.i26.i, align 8, !tbaa !9
%10 = load i8, ptr %8, align 1, !tbaa !16
%conv3.i34.i = zext i8 %10 to i32
br label %do.body.i.preheader
do.body.i.preheader: ; preds = %cond.false.i32.i, %cond.true.i29.i
%.ph201 = phi ptr [ %6, %cond.false.i32.i ], [ %.pre58.pre.i, %cond.true.i29.i ]
%.ph202 = phi ptr [ %7, %cond.false.i32.i ], [ %.pre58.pre.i, %cond.true.i29.i ]
%c.0.i.ph = phi i32 [ %conv3.i34.i, %cond.false.i32.i ], [ %call.i30.i, %cond.true.i29.i ]
br label %do.body.i
do.body.i: ; preds = %do.body.i.preheader, %getchar_unlocked.exit45.i
%11 = phi ptr [ %16, %getchar_unlocked.exit45.i ], [ %.ph201, %do.body.i.preheader ]
%12 = phi ptr [ %17, %getchar_unlocked.exit45.i ], [ %.ph202, %do.body.i.preheader ]
%n.0.i = phi i32 [ %add3.i, %getchar_unlocked.exit45.i ], [ 0, %do.body.i.preheader ]
%c.0.i = phi i32 [ %cond.i41.i, %getchar_unlocked.exit45.i ], [ %c.0.i.ph, %do.body.i.preheader ]
%add.i = mul i32 %n.0.i, 10
%and.i = and i32 %c.0.i, 15
%add3.i = add nsw i32 %and.i, %add.i
%_IO_read_ptr.i36.i = getelementptr inbounds %struct._IO_FILE, ptr %12, i64 0, i32 1
%13 = load ptr, ptr %_IO_read_ptr.i36.i, align 8, !tbaa !9
%_IO_read_end.i37.i = getelementptr inbounds %struct._IO_FILE, ptr %12, i64 0, i32 2
%14 = load ptr, ptr %_IO_read_end.i37.i, align 8, !tbaa !14
%cmp.not.i38.i = icmp ult ptr %13, %14
br i1 %cmp.not.i38.i, label %cond.false.i42.i, label %cond.true.i39.i, !prof !15
cond.true.i39.i: ; preds = %do.body.i
%call.i40.i = tail call i32 @__uflow(ptr noundef nonnull %12) #9
%.pre57.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit45.i
cond.false.i42.i: ; preds = %do.body.i
%incdec.ptr.i43.i = getelementptr inbounds i8, ptr %13, i64 1
store ptr %incdec.ptr.i43.i, ptr %_IO_read_ptr.i36.i, align 8, !tbaa !9
%15 = load i8, ptr %13, align 1, !tbaa !16
%conv3.i44.i = zext i8 %15 to i32
br label %getchar_unlocked.exit45.i
getchar_unlocked.exit45.i: ; preds = %cond.false.i42.i, %cond.true.i39.i
%16 = phi ptr [ %.pre57.i, %cond.true.i39.i ], [ %11, %cond.false.i42.i ]
%17 = phi ptr [ %.pre57.i, %cond.true.i39.i ], [ %12, %cond.false.i42.i ]
%cond.i41.i = phi i32 [ %call.i40.i, %cond.true.i39.i ], [ %conv3.i44.i, %cond.false.i42.i ]
%cmp5.i = icmp sgt i32 %cond.i41.i, 47
br i1 %cmp5.i, label %do.body.i, label %do.end.i, !llvm.loop !17
do.end.i: ; preds = %getchar_unlocked.exit45.i
%sub.i = sub nsw i32 0, %add3.i
br label %in.exit
do.body6.i: ; preds = %getchar_unlocked.exit.i, %getchar_unlocked.exit55.i
%18 = phi ptr [ %23, %getchar_unlocked.exit55.i ], [ %6, %getchar_unlocked.exit.i ]
%19 = phi ptr [ %24, %getchar_unlocked.exit55.i ], [ %7, %getchar_unlocked.exit.i ]
%n.1.i = phi i32 [ %add11.i, %getchar_unlocked.exit55.i ], [ 0, %getchar_unlocked.exit.i ]
%c.1.i = phi i32 [ %cond.i51.i, %getchar_unlocked.exit55.i ], [ %cond.i.i, %getchar_unlocked.exit.i ]
%add9.i = mul i32 %n.1.i, 10
%and10.i = and i32 %c.1.i, 15
%add11.i = add nsw i32 %and10.i, %add9.i
%_IO_read_ptr.i46.i = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 1
%20 = load ptr, ptr %_IO_read_ptr.i46.i, align 8, !tbaa !9
%_IO_read_end.i47.i = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 2
%21 = load ptr, ptr %_IO_read_end.i47.i, align 8, !tbaa !14
%cmp.not.i48.i = icmp ult ptr %20, %21
br i1 %cmp.not.i48.i, label %cond.false.i52.i, label %cond.true.i49.i, !prof !15
cond.true.i49.i: ; preds = %do.body6.i
%call.i50.i = tail call i32 @__uflow(ptr noundef nonnull %19) #9
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit55.i
cond.false.i52.i: ; preds = %do.body6.i
%incdec.ptr.i53.i = getelementptr inbounds i8, ptr %20, i64 1
store ptr %incdec.ptr.i53.i, ptr %_IO_read_ptr.i46.i, align 8, !tbaa !9
%22 = load i8, ptr %20, align 1, !tbaa !16
%conv3.i54.i = zext i8 %22 to i32
br label %getchar_unlocked.exit55.i
getchar_unlocked.exit55.i: ; preds = %cond.false.i52.i, %cond.true.i49.i
%23 = phi ptr [ %.pre.i, %cond.true.i49.i ], [ %18, %cond.false.i52.i ]
%24 = phi ptr [ %.pre.i, %cond.true.i49.i ], [ %19, %cond.false.i52.i ]
%cond.i51.i = phi i32 [ %call.i50.i, %cond.true.i49.i ], [ %conv3.i54.i, %cond.false.i52.i ]
%cmp14.i = icmp sgt i32 %cond.i51.i, 47
br i1 %cmp14.i, label %do.body6.i, label %in.exit, !llvm.loop !19
in.exit: ; preds = %getchar_unlocked.exit55.i, %do.end.i
%25 = phi ptr [ %16, %do.end.i ], [ %23, %getchar_unlocked.exit55.i ]
%26 = phi ptr [ %17, %do.end.i ], [ %24, %getchar_unlocked.exit55.i ]
%retval.0.i = phi i32 [ %sub.i, %do.end.i ], [ %add11.i, %getchar_unlocked.exit55.i ]
%conv28 = sitofp i32 %retval.0.i to double
%arrayidx32 = getelementptr inbounds [2 x [1002 x %struct.PP]], ptr @p, i64 0, i64 %indvars.iv177, i64 %indvars.iv
store double %conv28, ptr %arrayidx32, align 16, !tbaa !24
%_IO_read_ptr.i.i106 = getelementptr inbounds %struct._IO_FILE, ptr %26, i64 0, i32 1
%27 = load ptr, ptr %_IO_read_ptr.i.i106, align 8, !tbaa !9
%_IO_read_end.i.i107 = getelementptr inbounds %struct._IO_FILE, ptr %26, i64 0, i32 2
%28 = load ptr, ptr %_IO_read_end.i.i107, align 8, !tbaa !14
%cmp.not.i.i108 = icmp ult ptr %27, %28
br i1 %cmp.not.i.i108, label %cond.false.i.i166, label %cond.true.i.i109, !prof !15
cond.true.i.i109: ; preds = %in.exit
%call.i.i110 = tail call i32 @__uflow(ptr noundef nonnull %26) #9
%.pre185 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit.i111
cond.false.i.i166: ; preds = %in.exit
%incdec.ptr.i.i167 = getelementptr inbounds i8, ptr %27, i64 1
store ptr %incdec.ptr.i.i167, ptr %_IO_read_ptr.i.i106, align 8, !tbaa !9
%29 = load i8, ptr %27, align 1, !tbaa !16
%conv3.i.i168 = zext i8 %29 to i32
br label %getchar_unlocked.exit.i111
getchar_unlocked.exit.i111: ; preds = %cond.false.i.i166, %cond.true.i.i109
%30 = phi ptr [ %.pre185, %cond.true.i.i109 ], [ %25, %cond.false.i.i166 ]
%cond.i.i112 = phi i32 [ %call.i.i110, %cond.true.i.i109 ], [ %conv3.i.i168, %cond.false.i.i166 ]
%cmp.i113 = icmp eq i32 %cond.i.i112, 45
br i1 %cmp.i113, label %if.then.i133, label %do.body6.i114
if.then.i133: ; preds = %getchar_unlocked.exit.i111
%_IO_read_ptr.i26.i134 = getelementptr inbounds %struct._IO_FILE, ptr %30, i64 0, i32 1
%31 = load ptr, ptr %_IO_read_ptr.i26.i134, align 8, !tbaa !9
%_IO_read_end.i27.i135 = getelementptr inbounds %struct._IO_FILE, ptr %30, i64 0, i32 2
%32 = load ptr, ptr %_IO_read_end.i27.i135, align 8, !tbaa !14
%cmp.not.i28.i136 = icmp ult ptr %31, %32
br i1 %cmp.not.i28.i136, label %cond.false.i32.i163, label %cond.true.i29.i137, !prof !15
cond.true.i29.i137: ; preds = %if.then.i133
%call.i30.i138 = tail call i32 @__uflow(ptr noundef nonnull %30) #9
%.pre58.pre.i139 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i143.preheader
cond.false.i32.i163: ; preds = %if.then.i133
%incdec.ptr.i33.i164 = getelementptr inbounds i8, ptr %31, i64 1
store ptr %incdec.ptr.i33.i164, ptr %_IO_read_ptr.i26.i134, align 8, !tbaa !9
%33 = load i8, ptr %31, align 1, !tbaa !16
%conv3.i34.i165 = zext i8 %33 to i32
br label %do.body.i143.preheader
do.body.i143.preheader: ; preds = %cond.false.i32.i163, %cond.true.i29.i137
%.ph200 = phi ptr [ %30, %cond.false.i32.i163 ], [ %.pre58.pre.i139, %cond.true.i29.i137 ]
%c.0.i145.ph = phi i32 [ %conv3.i34.i165, %cond.false.i32.i163 ], [ %call.i30.i138, %cond.true.i29.i137 ]
br label %do.body.i143
do.body.i143: ; preds = %do.body.i143.preheader, %getchar_unlocked.exit45.i155
%34 = phi ptr [ %39, %getchar_unlocked.exit45.i155 ], [ %.ph200, %do.body.i143.preheader ]
%35 = phi ptr [ %40, %getchar_unlocked.exit45.i155 ], [ %.ph200, %do.body.i143.preheader ]
%n.0.i144 = phi i32 [ %add3.i148, %getchar_unlocked.exit45.i155 ], [ 0, %do.body.i143.preheader ]
%c.0.i145 = phi i32 [ %cond.i41.i156, %getchar_unlocked.exit45.i155 ], [ %c.0.i145.ph, %do.body.i143.preheader ]
%add.i146 = mul i32 %n.0.i144, 10
%and.i147 = and i32 %c.0.i145, 15
%add3.i148 = add nsw i32 %and.i147, %add.i146
%_IO_read_ptr.i36.i149 = getelementptr inbounds %struct._IO_FILE, ptr %35, i64 0, i32 1
%36 = load ptr, ptr %_IO_read_ptr.i36.i149, align 8, !tbaa !9
%_IO_read_end.i37.i150 = getelementptr inbounds %struct._IO_FILE, ptr %35, i64 0, i32 2
%37 = load ptr, ptr %_IO_read_end.i37.i150, align 8, !tbaa !14
%cmp.not.i38.i151 = icmp ult ptr %36, %37
br i1 %cmp.not.i38.i151, label %cond.false.i42.i160, label %cond.true.i39.i152, !prof !15
cond.true.i39.i152: ; preds = %do.body.i143
%call.i40.i153 = tail call i32 @__uflow(ptr noundef nonnull %35) #9
%.pre57.i154 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit45.i155
cond.false.i42.i160: ; preds = %do.body.i143
%incdec.ptr.i43.i161 = getelementptr inbounds i8, ptr %36, i64 1
store ptr %incdec.ptr.i43.i161, ptr %_IO_read_ptr.i36.i149, align 8, !tbaa !9
%38 = load i8, ptr %36, align 1, !tbaa !16
%conv3.i44.i162 = zext i8 %38 to i32
br label %getchar_unlocked.exit45.i155
getchar_unlocked.exit45.i155: ; preds = %cond.false.i42.i160, %cond.true.i39.i152
%39 = phi ptr [ %.pre57.i154, %cond.true.i39.i152 ], [ %34, %cond.false.i42.i160 ]
%40 = phi ptr [ %.pre57.i154, %cond.true.i39.i152 ], [ %35, %cond.false.i42.i160 ]
%cond.i41.i156 = phi i32 [ %call.i40.i153, %cond.true.i39.i152 ], [ %conv3.i44.i162, %cond.false.i42.i160 ]
%cmp5.i157 = icmp sgt i32 %cond.i41.i156, 47
br i1 %cmp5.i157, label %do.body.i143, label %do.end.i158, !llvm.loop !17
do.end.i158: ; preds = %getchar_unlocked.exit45.i155
%sub.i159 = sub nsw i32 0, %add3.i148
br label %in.exit169
do.body6.i114: ; preds = %getchar_unlocked.exit.i111, %getchar_unlocked.exit55.i126
%41 = phi ptr [ %46, %getchar_unlocked.exit55.i126 ], [ %30, %getchar_unlocked.exit.i111 ]
%42 = phi ptr [ %47, %getchar_unlocked.exit55.i126 ], [ %30, %getchar_unlocked.exit.i111 ]
%n.1.i115 = phi i32 [ %add11.i119, %getchar_unlocked.exit55.i126 ], [ 0, %getchar_unlocked.exit.i111 ]
%c.1.i116 = phi i32 [ %cond.i51.i127, %getchar_unlocked.exit55.i126 ], [ %cond.i.i112, %getchar_unlocked.exit.i111 ]
%add9.i117 = mul i32 %n.1.i115, 10
%and10.i118 = and i32 %c.1.i116, 15
%add11.i119 = add nsw i32 %and10.i118, %add9.i117
%_IO_read_ptr.i46.i120 = getelementptr inbounds %struct._IO_FILE, ptr %42, i64 0, i32 1
%43 = load ptr, ptr %_IO_read_ptr.i46.i120, align 8, !tbaa !9
%_IO_read_end.i47.i121 = getelementptr inbounds %struct._IO_FILE, ptr %42, i64 0, i32 2
%44 = load ptr, ptr %_IO_read_end.i47.i121, align 8, !tbaa !14
%cmp.not.i48.i122 = icmp ult ptr %43, %44
br i1 %cmp.not.i48.i122, label %cond.false.i52.i130, label %cond.true.i49.i123, !prof !15
cond.true.i49.i123: ; preds = %do.body6.i114
%call.i50.i124 = tail call i32 @__uflow(ptr noundef nonnull %42) #9
%.pre.i125 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit55.i126
cond.false.i52.i130: ; preds = %do.body6.i114
%incdec.ptr.i53.i131 = getelementptr inbounds i8, ptr %43, i64 1
store ptr %incdec.ptr.i53.i131, ptr %_IO_read_ptr.i46.i120, align 8, !tbaa !9
%45 = load i8, ptr %43, align 1, !tbaa !16
%conv3.i54.i132 = zext i8 %45 to i32
br label %getchar_unlocked.exit55.i126
getchar_unlocked.exit55.i126: ; preds = %cond.false.i52.i130, %cond.true.i49.i123
%46 = phi ptr [ %.pre.i125, %cond.true.i49.i123 ], [ %41, %cond.false.i52.i130 ]
%47 = phi ptr [ %.pre.i125, %cond.true.i49.i123 ], [ %42, %cond.false.i52.i130 ]
%cond.i51.i127 = phi i32 [ %call.i50.i124, %cond.true.i49.i123 ], [ %conv3.i54.i132, %cond.false.i52.i130 ]
%cmp14.i128 = icmp sgt i32 %cond.i51.i127, 47
br i1 %cmp14.i128, label %do.body6.i114, label %in.exit169, !llvm.loop !19
in.exit169: ; preds = %getchar_unlocked.exit55.i126, %do.end.i158
%48 = phi ptr [ %39, %do.end.i158 ], [ %46, %getchar_unlocked.exit55.i126 ]
%49 = phi ptr [ %40, %do.end.i158 ], [ %47, %getchar_unlocked.exit55.i126 ]
%retval.0.i129 = phi i32 [ %sub.i159, %do.end.i158 ], [ %add11.i119, %getchar_unlocked.exit55.i126 ]
%conv35 = sitofp i32 %retval.0.i129 to double
%y40 = getelementptr inbounds [2 x [1002 x %struct.PP]], ptr @p, i64 0, i64 %indvars.iv177, i64 %indvars.iv, i32 1
store double %conv35, ptr %y40, align 8, !tbaa !27
%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.inc41, label %for.body26, !llvm.loop !28
for.inc41: ; preds = %in.exit169, %for.body
br i1 %cmp, label %for.body, label %for.body47.preheader, !llvm.loop !29
for.body47.preheader: ; preds = %for.inc41
%arrayidx50 = getelementptr inbounds [2 x %struct.PP], ptr %s, i64 0, i64 1
%arrayidx53 = getelementptr inbounds [2 x %struct.PP], ptr %g, i64 0, i64 1
%50 = load double, ptr %arrayidx50, align 16
%51 = getelementptr inbounds [2 x %struct.PP], ptr %s, i64 0, i64 1, i32 1
%52 = load double, ptr %51, align 8
%53 = load double, ptr %arrayidx53, align 16
%54 = getelementptr inbounds [2 x %struct.PP], ptr %g, i64 0, i64 1, i32 1
%55 = load double, ptr %54, align 8
%sub.i170 = fsub double %50, %53
%sub4.i = fsub double %52, %55
%call.i = tail call double @hypot(double noundef %sub.i170, double noundef %sub4.i) #9
%56 = load double, ptr %s, align 16
%57 = getelementptr inbounds { double, double }, ptr %s, i64 0, i32 1
%58 = load double, ptr %57, align 8
%59 = load double, ptr %g, align 16
%60 = getelementptr inbounds { double, double }, ptr %g, i64 0, i32 1
%61 = load double, ptr %60, align 8
%call70 = tail call double @calc(double %56, double %58, double %59, double %61, ptr noundef nonnull @p, i32 noundef %sub, double %50, double %52, double %53, double %55)
%add = fadd double %call.i, %call70
%cmp71 = fcmp olt double %add, 1.000000e+20
%ans.1 = select i1 %cmp71, double %add, double 1.000000e+20
%sub.i170.1 = fsub double %56, %59
%sub4.i.1 = fsub double %58, %61
%call.i.1 = tail call double @hypot(double noundef %sub.i170.1, double noundef %sub4.i.1) #9
%call70.1 = tail call double @calc(double %50, double %52, double %53, double %55, ptr noundef nonnull getelementptr inbounds ([2 x [1002 x %struct.PP]], ptr @p, i64 0, i64 1), i32 noundef %sub2, double %56, double %58, double %59, double %61)
%add.1 = fadd double %call.i.1, %call70.1
%cmp71.1 = fcmp olt double %add.1, %ans.1
%ans.1.1 = select i1 %cmp71.1, double %add.1, double %ans.1
%cmp76 = fcmp ult double %ans.1.1, 1.000000e+20
br i1 %cmp76, label %if.else, label %if.then78
if.then78: ; preds = %for.body47.preheader
%call79 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str)
br label %if.end81
if.else: ; preds = %for.body47.preheader
%call80 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %ans.1.1)
br label %if.end81
if.end81: ; preds = %if.else, %if.then78
call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %g) #9
call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %s) #9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #9
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
declare i32 @__uflow(ptr noundef) local_unnamed_addr #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #8
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nofree nounwind "no-trapping-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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!20 = !{i32 0, i32 2}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}
!23 = !{!11, !11, i64 0}
!24 = !{!25, !26, i64 0}
!25 = !{!"", !26, i64 0, !26, i64 8}
!26 = !{!"double", !7, i64 0}
!27 = !{!25, !26, i64 8}
!28 = distinct !{!28, !18}
!29 = distinct !{!29, !18}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define df 0
int max(int a,int b,int c){
if(a>b)return a>c?a:c;
return b>c?b:c;
}
int min(int a,int b,int c){
if(a<b)return a<c?a:c;
return b<c?b:c;
}
int main(){
int count[3];
char s[100010];
scanf("%s",s);
int len=strlen(s),i;
for(i=0;i<len;i++){
count[s[i]-'a']++;
}
int flag=(max(count[0],count[1],count[2])-min(count[0],count[1],count[2])<=1);
printf("%s",flag?"YES":"NO");
return 0;
}
/// confirm df==0 /// | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288919/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288919/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b, i32 noundef %c) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%cond6 = tail call i32 @llvm.smax.i32(i32 %a.b, i32 %c)
ret i32 %cond6
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b, i32 noundef %c) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
%cond6 = tail call i32 @llvm.smin.i32(i32 %a.b, i32 %c)
ret i32 %cond6
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%count = alloca [3 x i32], align 4
%s = alloca [100010 x i8], align 16
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %count) #6
call void @llvm.lifetime.start.p0(i64 100010, ptr nonnull %s) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #7
%conv = trunc i64 %call2 to i32
%cmp24 = icmp sgt i32 %conv, 0
br i1 %cmp24, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call2, 4294967295
%xtraiter = and i64 %call2, 1
%0 = icmp eq i64 %wide.trip.count, 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 = sub nsw i64 %wide.trip.count, %xtraiter
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 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%arrayidx = getelementptr inbounds [100010 x i8], ptr %s, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 2, !tbaa !5
%conv4 = sext i8 %1 to i64
%sub = add nsw i64 %conv4, -97
%arrayidx6 = getelementptr inbounds [3 x i32], ptr %count, i64 0, i64 %sub
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !8
%inc = add nsw i32 %2, 1
store i32 %inc, ptr %arrayidx6, align 4, !tbaa !8
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [100010 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%conv4.1 = sext i8 %3 to i64
%sub.1 = add nsw i64 %conv4.1, -97
%arrayidx6.1 = getelementptr inbounds [3 x i32], ptr %count, i64 0, i64 %sub.1
%4 = load i32, ptr %arrayidx6.1, align 4, !tbaa !8
%inc.1 = add nsw i32 %4, 1
store i32 %inc.1, ptr %arrayidx6.1, align 4, !tbaa !8
%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 !10
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 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end.loopexit, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds [100010 x i8], ptr %s, i64 0, i64 %indvars.iv.unr
%5 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
%conv4.epil = sext i8 %5 to i64
%sub.epil = add nsw i64 %conv4.epil, -97
%arrayidx6.epil = getelementptr inbounds [3 x i32], ptr %count, i64 0, i64 %sub.epil
%6 = load i32, ptr %arrayidx6.epil, align 4, !tbaa !8
%inc.epil = add nsw i32 %6, 1
store i32 %inc.epil, ptr %arrayidx6.epil, align 4, !tbaa !8
br label %for.end.loopexit
for.end.loopexit: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%.pre = load i32, ptr %count, align 4, !tbaa !8
%arrayidx9.phi.trans.insert = getelementptr inbounds [3 x i32], ptr %count, i64 0, i64 1
%.pre27 = load i32, ptr %arrayidx9.phi.trans.insert, align 4, !tbaa !8
%arrayidx10.phi.trans.insert = getelementptr inbounds [3 x i32], ptr %count, i64 0, i64 2
%.pre28 = load i32, ptr %arrayidx10.phi.trans.insert, align 4, !tbaa !8
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%7 = phi i32 [ %.pre28, %for.end.loopexit ], [ undef, %entry ]
%8 = phi i32 [ %.pre27, %for.end.loopexit ], [ undef, %entry ]
%9 = phi i32 [ %.pre, %for.end.loopexit ], [ undef, %entry ]
%a.b.i = call i32 @llvm.smax.i32(i32 %9, i32 %8)
%cond6.i = call i32 @llvm.smax.i32(i32 %a.b.i, i32 %7)
%a.b.i22 = call i32 @llvm.smin.i32(i32 %9, i32 %8)
%cond6.i23 = call i32 @llvm.smin.i32(i32 %a.b.i22, i32 %7)
%sub16 = sub nsw i32 %cond6.i, %cond6.i23
%cmp17 = icmp slt i32 %sub16, 2
%cond = select i1 %cmp17, ptr @.str.1, ptr @.str.2
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %cond)
call void @llvm.lifetime.end.p0(i64 100010, ptr nonnull %s) #6
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %count) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int Euclid(int a,int b){
if(a<b){
int tmp = a;
a = b;
b = tmp;
}
int r = a % b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
return b;
}
int main(void){
int N,K;
scanf("%d %d",&N,&K);
int max=0;
int euc;
scanf("%d",&euc);
max=euc;
int kari;
for(int i=1;i<N;i++){
scanf("%d",&kari);
euc=Euclid(euc,kari);
if(max<kari)max=kari;
}
if(max>=K&&K%euc==0)printf("POSSIBLE");
else printf("IMPOSSIBLE");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288962/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288962/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"POSSIBLE\00", align 1
@.str.3 = private unnamed_addr constant [11 x i8] c"IMPOSSIBLE\00", align 1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @Euclid(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%spec.select = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
%spec.select12 = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%rem = srem i32 %spec.select12, %spec.select
%cmp1.not13 = icmp eq i32 %rem, 0
br i1 %cmp1.not13, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.015 = phi i32 [ %rem2, %while.body ], [ %rem, %entry ]
%b.addr.114 = phi i32 [ %r.015, %while.body ], [ %spec.select, %entry ]
%rem2 = srem i32 %b.addr.114, %r.015
%cmp1.not = icmp eq i32 %rem2, 0
br i1 %cmp1.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%b.addr.1.lcssa = phi i32 [ %spec.select, %entry ], [ %r.015, %while.body ]
ret i32 %b.addr.1.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
%K = alloca i32, align 4
%euc = alloca i32, align 4
%kari = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %euc) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %euc)
%0 = load i32, ptr %euc, align 4, !tbaa !7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %kari) #5
%1 = load i32, ptr %N, align 4, !tbaa !7
%cmp14 = icmp sgt i32 %1, 1
br i1 %cmp14, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %Euclid.exit, %entry
%2 = phi i32 [ %0, %entry ], [ %b.addr.1.lcssa.i, %Euclid.exit ]
%max.0.lcssa = phi i32 [ %0, %entry ], [ %spec.select, %Euclid.exit ]
%3 = load i32, ptr %K, align 4, !tbaa !7
%cmp5.not = icmp slt i32 %max.0.lcssa, %3
br i1 %cmp5.not, label %if.else, label %land.lhs.true
for.body: ; preds = %entry, %Euclid.exit
%i.016 = phi i32 [ %inc, %Euclid.exit ], [ 1, %entry ]
%max.015 = phi i32 [ %spec.select, %Euclid.exit ], [ %0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %kari)
%4 = load i32, ptr %euc, align 4, !tbaa !7
%5 = load i32, ptr %kari, align 4, !tbaa !7
%spec.select.i = call i32 @llvm.smin.i32(i32 %4, i32 %5)
%spec.select12.i = call i32 @llvm.smax.i32(i32 %4, i32 %5)
%rem.i = srem i32 %spec.select12.i, %spec.select.i
%cmp1.not13.i = icmp eq i32 %rem.i, 0
br i1 %cmp1.not13.i, label %Euclid.exit, label %while.body.i
while.body.i: ; preds = %for.body, %while.body.i
%r.015.i = phi i32 [ %rem2.i, %while.body.i ], [ %rem.i, %for.body ]
%b.addr.114.i = phi i32 [ %r.015.i, %while.body.i ], [ %spec.select.i, %for.body ]
%rem2.i = srem i32 %b.addr.114.i, %r.015.i
%cmp1.not.i = icmp eq i32 %rem2.i, 0
br i1 %cmp1.not.i, label %Euclid.exit, label %while.body.i, !llvm.loop !5
Euclid.exit: ; preds = %while.body.i, %for.body
%b.addr.1.lcssa.i = phi i32 [ %spec.select.i, %for.body ], [ %r.015.i, %while.body.i ]
store i32 %b.addr.1.lcssa.i, ptr %euc, align 4, !tbaa !7
%spec.select = call i32 @llvm.smax.i32(i32 %max.015, i32 %5)
%inc = add nuw nsw i32 %i.016, 1
%6 = load i32, ptr %N, align 4, !tbaa !7
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
land.lhs.true: ; preds = %for.cond.cleanup
%rem = srem i32 %3, %2
%cmp6 = icmp eq i32 %rem, 0
br i1 %cmp6, label %if.end10, label %if.else
if.else: ; preds = %land.lhs.true, %for.cond.cleanup
br label %if.end10
if.end10: ; preds = %land.lhs.true, %if.else
%.str.3.sink = phi ptr [ @.str.3, %if.else ], [ @.str.2, %land.lhs.true ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %kari) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %euc) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree 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 = { 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}
|
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
#include<math.h>
//#include<string.h>
//#include<time.h>
//#define pi acos(-1.0)
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
int main() {
int i, j, h, w, s;
while (fscanf(stdin, "%d%d", &h, &w), h || w) {
s = h*h + w*w;
i = h + 1;
while (1) {
for (; i*i < s; i++) {
for (j = i + 1; j*j + i*i <= s; j++)
if (i*i + j*j == s) goto e;
}
s++, i = 1;
}
e:
fprintf(stdout, "%d %d\n", i, j);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289004/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289004/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: 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
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call50 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w) #4
%1 = load i32, ptr %h, align 4, !tbaa !9
%tobool51 = icmp ne i32 %1, 0
%2 = load i32, ptr %w, align 4
%tobool152 = icmp ne i32 %2, 0
%3 = select i1 %tobool51, i1 true, i1 %tobool152
br i1 %3, label %while.body, label %while.end
while.body: ; preds = %entry, %e
%4 = phi i32 [ %9, %e ], [ %2, %entry ]
%5 = phi i32 [ %8, %e ], [ %1, %entry ]
%mul = mul nsw i32 %5, %5
%mul2 = mul nsw i32 %4, %4
%add = add nuw nsw i32 %mul2, %mul
%add3 = add nsw i32 %5, 1
br label %while.cond4
while.cond4: ; preds = %for.end20, %while.body
%i.0 = phi i32 [ %add3, %while.body ], [ 1, %for.end20 ]
%s.0 = phi i32 [ %add, %while.body ], [ %inc21, %for.end20 ]
%mul646 = mul nsw i32 %i.0, %i.0
%cmp47 = icmp ult i32 %mul646, %s.0
br i1 %cmp47, label %for.body, label %for.end20
for.cond.loopexit: ; preds = %for.inc, %for.body
%cmp = icmp ult i32 %mul941, %s.0
br i1 %cmp, label %for.body, label %for.end20, !llvm.loop !11
for.body: ; preds = %while.cond4, %for.cond.loopexit
%mul649 = phi i32 [ %mul941, %for.cond.loopexit ], [ %mul646, %while.cond4 ]
%i.148 = phi i32 [ %add7, %for.cond.loopexit ], [ %i.0, %while.cond4 ]
%add7 = add nsw i32 %i.148, 1
%mul941 = mul nsw i32 %add7, %add7
%add1142 = add nuw nsw i32 %mul941, %mul649
%cmp12.not43 = icmp ugt i32 %add1142, %s.0
br i1 %cmp12.not43, label %for.cond.loopexit, label %for.body13
for.body13: ; preds = %for.body, %for.inc
%add1145 = phi i32 [ %add11, %for.inc ], [ %add1142, %for.body ]
%j.044 = phi i32 [ %inc, %for.inc ], [ %add7, %for.body ]
%cmp17 = icmp eq i32 %add1145, %s.0
br i1 %cmp17, label %e, label %for.inc
for.inc: ; preds = %for.body13
%inc = add nsw i32 %j.044, 1
%mul9 = mul nsw i32 %inc, %inc
%add11 = add nuw nsw i32 %mul9, %mul649
%cmp12.not = icmp ugt i32 %add11, %s.0
br i1 %cmp12.not, label %for.cond.loopexit, label %for.body13, !llvm.loop !13
for.end20: ; preds = %for.cond.loopexit, %while.cond4
%inc21 = add nuw nsw i32 %s.0, 1
br label %while.cond4
e: ; preds = %for.body13
%6 = load ptr, ptr @stdout, align 8, !tbaa !5
%call22 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef nonnull @.str.1, i32 noundef %i.148, i32 noundef %j.044)
%7 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %7, ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w) #4
%8 = load i32, ptr %h, align 4, !tbaa !9
%tobool = icmp ne i32 %8, 0
%9 = load i32, ptr %w, align 4
%tobool1 = icmp ne i32 %9, 0
%10 = select i1 %tobool, i1 true, i1 %tobool1
br i1 %10, label %while.body, label %while.end, !llvm.loop !14
while.end: ; preds = %e, %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
declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, 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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
|
#include<stdio.h>
#include<stdlib.h>
typedef long long int int64;
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
void run(void){
int n;
scanf("%d",&n);
int *a=(int *)calloc(n,sizeof(int));
int i;
for(i=0;i<n;i++) scanf("%d",a+i);
int64 p=0;
int64 q=a[0]+a[1];
int64 r=0;
int64 s=0;
for(i=2;i<n;i++) s+=a[i];
int64 min=1000000000LL*n;
int j=0;
int k=2;
for(i=2;i<n-1;i++){
while(j<i-1 && ABS(p-q)>ABS((p+a[j])-(q-a[j]))){
p+=a[j];
q-=a[j];
j++;
}
while(k<n-1 && ABS(r-s)>ABS((r+a[k])-(s-a[k]))){
r+=a[k];
s-=a[k];
k++;
}
min=MIN(min,MAX(p,MAX(q,MAX(r,s)))-MIN(p,MIN(q,MIN(r,s))));
q+=a[i];
r-=a[i];
}
printf("%lld\n",min);
}
int main(void){
run();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289055/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289055/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #6
%cmp496 = icmp sgt i32 %0, 0
br i1 %cmp496, label %for.body, label %for.end15.thread
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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
%.pre = load i32, ptr %call1, align 4, !tbaa !5
%arrayidx4.phi.trans.insert = getelementptr inbounds i32, ptr %call1, i64 1
%.pre557 = load i32, ptr %arrayidx4.phi.trans.insert, align 4, !tbaa !5
%3 = add nsw i32 %.pre557, %.pre
%4 = sext i32 %3 to i64
%cmp7498 = icmp sgt i32 %1, 2
br i1 %cmp7498, label %for.body9.preheader, label %for.end15.thread
for.body9.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %1 to i64
%5 = add nsw i64 %wide.trip.count, -2
%min.iters.check = icmp ult i64 %5, 4
br i1 %min.iters.check, label %for.body9.preheader584, label %vector.ph
vector.ph: ; preds = %for.body9.preheader
%n.vec = and i64 %5, -4
%ind.end = or i64 %n.vec, 2
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%vec.phi578 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%offset.idx = or i64 %index, 2
%6 = getelementptr inbounds i32, ptr %call1, i64 %offset.idx
%wide.load = load <2 x i32>, ptr %6, align 4, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 2
%wide.load579 = load <2 x i32>, ptr %7, align 4, !tbaa !5
%8 = sext <2 x i32> %wide.load to <2 x i64>
%9 = sext <2 x i32> %wide.load579 to <2 x i64>
%10 = add <2 x i64> %vec.phi, %8
%11 = add <2 x i64> %vec.phi578, %9
%index.next = add nuw i64 %index, 4
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %11, %10
%13 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.end15, label %for.body9.preheader584
for.body9.preheader584: ; preds = %for.body9.preheader, %middle.block
%indvars.iv534.ph = phi i64 [ 2, %for.body9.preheader ], [ %ind.end, %middle.block ]
%s.0500.ph = phi i64 [ 0, %for.body9.preheader ], [ %13, %middle.block ]
br label %for.body9
for.body9: ; preds = %for.body9.preheader584, %for.body9
%indvars.iv534 = phi i64 [ %indvars.iv.next535, %for.body9 ], [ %indvars.iv534.ph, %for.body9.preheader584 ]
%s.0500 = phi i64 [ %add12, %for.body9 ], [ %s.0500.ph, %for.body9.preheader584 ]
%arrayidx10 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv534
%14 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%conv11 = sext i32 %14 to i64
%add12 = add nsw i64 %s.0500, %conv11
%indvars.iv.next535 = add nuw nsw i64 %indvars.iv534, 1
%exitcond.not = icmp eq i64 %indvars.iv.next535, %wide.trip.count
br i1 %exitcond.not, label %for.end15, label %for.body9, !llvm.loop !14
for.end15.thread: ; preds = %for.end, %entry
%.lcssa561.ph = phi i32 [ %1, %for.end ], [ %0, %entry ]
%conv16566 = sext i32 %.lcssa561.ph to i64
%mul567 = mul nsw i64 %conv16566, 1000000000
br label %for.end324
for.end15: ; preds = %for.body9, %middle.block
%add12.lcssa = phi i64 [ %13, %middle.block ], [ %add12, %for.body9 ]
%conv16 = sext i32 %1 to i64
%mul = mul nsw i64 %conv16, 1000000000
%sub = add i32 %1, -1
%cmp18522 = icmp sgt i32 %1, 3
br i1 %cmp18522, label %while.cond.preheader.preheader, label %for.end324
while.cond.preheader.preheader: ; preds = %for.end15
%15 = zext i32 %sub to i64
%wide.trip.count555 = zext i32 %sub to i64
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.cond.preheader.preheader, %while.end137
%indvars.iv549 = phi i64 [ 2, %while.cond.preheader.preheader ], [ %indvars.iv.next550, %while.end137 ]
%indvars.iv542 = phi i64 [ 1, %while.cond.preheader.preheader ], [ %indvars.iv.next543, %while.end137 ]
%k.0530 = phi i32 [ 2, %while.cond.preheader.preheader ], [ %k.1.lcssa, %while.end137 ]
%j.0529 = phi i32 [ 0, %while.cond.preheader.preheader ], [ %j.1.lcssa, %while.end137 ]
%min.0528 = phi i64 [ %mul, %while.cond.preheader.preheader ], [ %spec.select, %while.end137 ]
%s.1527 = phi i64 [ %add12.lcssa, %while.cond.preheader.preheader ], [ %s.2.lcssa, %while.end137 ]
%r.0526 = phi i64 [ 0, %while.cond.preheader.preheader ], [ %sub321, %while.end137 ]
%q.0525 = phi i64 [ %4, %while.cond.preheader.preheader ], [ %add317, %while.end137 ]
%p.0524 = phi i64 [ 0, %while.cond.preheader.preheader ], [ %p.1.lcssa, %while.end137 ]
%16 = add nsw i64 %indvars.iv549, -1
%17 = sext i32 %j.0529 to i64
%cmp22502 = icmp sgt i64 %16, %17
br i1 %cmp22502, label %land.rhs, label %while.end
land.rhs: ; preds = %while.cond.preheader, %while.body
%indvars.iv537 = phi i64 [ %indvars.iv.next538, %while.body ], [ %17, %while.cond.preheader ]
%q.1504 = phi i64 [ %sub73, %while.body ], [ %q.0525, %while.cond.preheader ]
%p.1503 = phi i64 [ %add33, %while.body ], [ %p.0524, %while.cond.preheader ]
%sub24 = sub nsw i64 %p.1503, %q.1504
%cond = call i64 @llvm.abs.i64(i64 %sub24, i1 true)
%arrayidx31 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv537
%18 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%conv32 = sext i32 %18 to i64
%add33 = add nsw i64 %p.1503, %conv32
%sub37.neg = sub i64 %conv32, %q.1504
%sub38 = add i64 %sub37.neg, %add33
%cond63 = call i64 @llvm.abs.i64(i64 %sub38, i1 true)
%cmp64 = icmp ugt i64 %cond, %cond63
br i1 %cmp64, label %while.body, label %while.end.loopexit
while.body: ; preds = %land.rhs
%sub73 = sub nsw i64 %q.1504, %conv32
%indvars.iv.next538 = add nsw i64 %indvars.iv537, 1
%exitcond544.not = icmp eq i64 %indvars.iv.next538, %indvars.iv542
br i1 %exitcond544.not, label %while.end.loopexit, label %land.rhs, !llvm.loop !15
while.end.loopexit: ; preds = %while.body, %land.rhs
%p.1.lcssa.ph = phi i64 [ %p.1503, %land.rhs ], [ %add33, %while.body ]
%q.1.lcssa.ph = phi i64 [ %q.1504, %land.rhs ], [ %sub73, %while.body ]
%j.1.lcssa.ph.in = phi i64 [ %indvars.iv537, %land.rhs ], [ %indvars.iv542, %while.body ]
%j.1.lcssa.ph = trunc i64 %j.1.lcssa.ph.in to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %while.cond.preheader
%p.1.lcssa = phi i64 [ %p.0524, %while.cond.preheader ], [ %p.1.lcssa.ph, %while.end.loopexit ]
%q.1.lcssa = phi i64 [ %q.0525, %while.cond.preheader ], [ %q.1.lcssa.ph, %while.end.loopexit ]
%j.1.lcssa = phi i32 [ %j.0529, %while.cond.preheader ], [ %j.1.lcssa.ph, %while.end.loopexit ]
%cmp77512 = icmp slt i32 %k.0530, %sub
br i1 %cmp77512, label %land.rhs79.preheader, label %while.end137
land.rhs79.preheader: ; preds = %while.end
%19 = sext i32 %k.0530 to i64
br label %land.rhs79
land.rhs79: ; preds = %land.rhs79.preheader, %while.body127
%indvars.iv545 = phi i64 [ %19, %land.rhs79.preheader ], [ %indvars.iv.next546, %while.body127 ]
%s.2514 = phi i64 [ %s.1527, %land.rhs79.preheader ], [ %sub135, %while.body127 ]
%r.1513 = phi i64 [ %r.0526, %land.rhs79.preheader ], [ %add93, %while.body127 ]
%sub80 = sub nsw i64 %r.1513, %s.2514
%cond89 = call i64 @llvm.abs.i64(i64 %sub80, i1 true)
%arrayidx91 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv545
%20 = load i32, ptr %arrayidx91, align 4, !tbaa !5
%conv92 = sext i32 %20 to i64
%add93 = add nsw i64 %r.1513, %conv92
%sub97.neg = sub i64 %conv92, %s.2514
%sub98 = add i64 %sub97.neg, %add93
%cond123 = call i64 @llvm.abs.i64(i64 %sub98, i1 true)
%cmp124 = icmp ugt i64 %cond89, %cond123
br i1 %cmp124, label %while.body127, label %while.end137.loopexit.split.loop.exit570
while.body127: ; preds = %land.rhs79
%sub135 = sub nsw i64 %s.2514, %conv92
%indvars.iv.next546 = add nsw i64 %indvars.iv545, 1
%exitcond548.not = icmp eq i64 %indvars.iv.next546, %15
br i1 %exitcond548.not, label %while.end137, label %land.rhs79, !llvm.loop !16
while.end137.loopexit.split.loop.exit570: ; preds = %land.rhs79
%21 = trunc i64 %indvars.iv545 to i32
br label %while.end137
while.end137: ; preds = %while.body127, %while.end137.loopexit.split.loop.exit570, %while.end
%r.1.lcssa = phi i64 [ %r.0526, %while.end ], [ %r.1513, %while.end137.loopexit.split.loop.exit570 ], [ %add93, %while.body127 ]
%s.2.lcssa = phi i64 [ %s.1527, %while.end ], [ %s.2514, %while.end137.loopexit.split.loop.exit570 ], [ %sub135, %while.body127 ]
%k.1.lcssa = phi i32 [ %k.0530, %while.end ], [ %21, %while.end137.loopexit.split.loop.exit570 ], [ %sub, %while.body127 ]
%cond143 = call i64 @llvm.smax.i64(i64 %r.1.lcssa, i64 %s.2.lcssa)
%q.1.cond143 = call i64 @llvm.smax.i64(i64 %q.1.lcssa, i64 %cond143)
%cond179 = call i64 @llvm.smax.i64(i64 %p.1.lcssa, i64 %q.1.cond143)
%cond185 = call i64 @llvm.smin.i64(i64 %r.1.lcssa, i64 %s.2.lcssa)
%cond197 = call i64 @llvm.smin.i64(i64 %q.1.lcssa, i64 %cond185)
%cond221 = call i64 @llvm.smin.i64(i64 %p.1.lcssa, i64 %cond197)
%sub222 = sub nsw i64 %cond179, %cond221
%spec.select = call i64 @llvm.smin.i64(i64 %min.0528, i64 %sub222)
%arrayidx315 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv549
%22 = load i32, ptr %arrayidx315, align 4, !tbaa !5
%conv316 = sext i32 %22 to i64
%add317 = add nsw i64 %q.1.lcssa, %conv316
%sub321 = sub nsw i64 %r.1.lcssa, %conv316
%indvars.iv.next550 = add nuw nsw i64 %indvars.iv549, 1
%indvars.iv.next543 = add nuw nsw i64 %indvars.iv542, 1
%exitcond556.not = icmp eq i64 %indvars.iv.next550, %wide.trip.count555
br i1 %exitcond556.not, label %for.end324, label %while.cond.preheader, !llvm.loop !17
for.end324: ; preds = %while.end137, %for.end15.thread, %for.end15
%min.0.lcssa = phi i64 [ %mul, %for.end15 ], [ %mul567, %for.end15.thread ], [ %spec.select, %while.end137 ]
%call325 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %min.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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: 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:
tail call void @run()
ret i32 0
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0,1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
#include<stdlib.h>
#define INF (1e9+1)
typedef struct state{
int pos,cost;
} state;
state A[2000001];
int N=0;
int parent(int i){return i/2;}
int left(int i){return i*2;}
int right(int i){return i*2+1;}
void exchange(state* a,state* b){
state tmp=*a;
*a=*b;
*b=tmp;
}
void minHeapify(int i){
int l=left(i);
int r=right(i);
int small;
if( l<=N && A[l].cost<A[i].cost )small=l;
else small=i;
if( r<=N && A[r].cost<A[small].cost)small=r;
if(small!=i){
exchange(&A[i],&A[small]);
minHeapify(small);
}
}
state heapExtractMin(){
if(N<1)return (state){0,0};
state min=A[1];
A[1]=A[N];
N--;
minHeapify(1);
return min;
}
void heapIncreaseKey(int i,state key){
if(key.cost>A[i].cost)return;
A[i]=key;
while(i>1&&A[parent(i)].cost>A[i].cost){
exchange(&A[i],&A[parent(i)]);
i=parent(i);
}
}
void minHeapInsert(state key){
N++;
A[N]=(state){INF,INF};
heapIncreaseKey(N,key);
}
typedef struct edge{
int to,cost;
} edge;
edge* G[10000];
int size[10000];
int n;
int d[10000];
edge e;
state s;
int main(){
int i,j,a,b;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %d",&a,&b);
G[a] = malloc( sizeof( edge ) *b );
size[a]=b;
for(j=0;j<b;j++){
scanf("%d %d",&G[a][j].to,&G[a][j].cost);
}
d[i]=INF;
}
d[0]=0;
minHeapInsert( (state){0,0} );
while(N!=0){
s = heapExtractMin();
if(s.cost>d[s.pos])continue;
for(i=0;i<size[s.pos];i++){
e=G[s.pos][i];
if(d[e.to]<=d[s.pos]+e.cost)continue;
d[e.to]=d[s.pos]+e.cost;
minHeapInsert((state){e.to,d[e.to]});
}
}
for(i=0;i<n;i++)
printf("%d %d\n",i,d[i]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289105/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289105/source.c"
target datalayout = "e-m:e-p270: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.state = type { i32, i32 }
%struct.edge = type { i32, i32 }
@N = dso_local local_unnamed_addr global i32 0, align 4
@A = dso_local local_unnamed_addr global [2000001 x %struct.state] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@G = dso_local local_unnamed_addr global [10000 x ptr] zeroinitializer, align 16
@size = dso_local local_unnamed_addr global [10000 x i32] zeroinitializer, align 16
@d = dso_local local_unnamed_addr global [10000 x i32] zeroinitializer, align 16
@s = dso_local local_unnamed_addr global %struct.state zeroinitializer, align 8
@e = dso_local local_unnamed_addr global %struct.edge zeroinitializer, align 8
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @parent(i32 noundef %i) local_unnamed_addr #0 {
entry:
%div = sdiv i32 %i, 2
ret i32 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @left(i32 noundef %i) local_unnamed_addr #0 {
entry:
%mul = shl nsw i32 %i, 1
ret i32 %mul
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @right(i32 noundef %i) local_unnamed_addr #0 {
entry:
%mul = shl nsw i32 %i, 1
%add = or i32 %mul, 1
ret i32 %add
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @exchange(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #1 {
entry:
%0 = load i64, ptr %a, align 4
%1 = load i64, ptr %b, align 4
store i64 %1, ptr %a, align 4
store i64 %0, ptr %b, align 4
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @minHeapify(i32 noundef %i) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @N, align 4, !tbaa !5
br label %tailrecurse
tailrecurse: ; preds = %if.then18, %entry
%i.tr = phi i32 [ %i, %entry ], [ %small.1, %if.then18 ]
%mul.i = shl nsw i32 %i.tr, 1
%add.i = or i32 %mul.i, 1
%cmp.not = icmp sgt i32 %mul.i, %0
br i1 %cmp.not, label %if.else, label %land.lhs.true
land.lhs.true: ; preds = %tailrecurse
%idxprom = sext i32 %mul.i to i64
%cost = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %cost, align 4, !tbaa !9
%idxprom2 = sext i32 %i.tr to i64
%cost4 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom2, i32 1
%2 = load i32, ptr %cost4, align 4, !tbaa !9
%cmp5 = icmp slt i32 %1, %2
br i1 %cmp5, label %if.end, label %if.else
if.else: ; preds = %land.lhs.true, %tailrecurse
br label %if.end
if.end: ; preds = %land.lhs.true, %if.else
%small.0 = phi i32 [ %i.tr, %if.else ], [ %mul.i, %land.lhs.true ]
%cmp6.not = icmp sgt i32 %add.i, %0
br i1 %cmp6.not, label %if.end16, label %land.lhs.true7
land.lhs.true7: ; preds = %if.end
%idxprom8 = sext i32 %add.i to i64
%cost10 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom8, i32 1
%3 = load i32, ptr %cost10, align 4, !tbaa !9
%idxprom11 = sext i32 %small.0 to i64
%cost13 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom11, i32 1
%4 = load i32, ptr %cost13, align 4, !tbaa !9
%cmp14 = icmp slt i32 %3, %4
%spec.select = select i1 %cmp14, i32 %add.i, i32 %small.0
br label %if.end16
if.end16: ; preds = %land.lhs.true7, %if.end
%small.1 = phi i32 [ %small.0, %if.end ], [ %spec.select, %land.lhs.true7 ]
%cmp17.not = icmp eq i32 %small.1, %i.tr
br i1 %cmp17.not, label %if.end23, label %if.then18
if.then18: ; preds = %if.end16
%idxprom19 = sext i32 %i.tr to i64
%arrayidx20 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom19
%idxprom21 = sext i32 %small.1 to i64
%arrayidx22 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom21
%5 = load i64, ptr %arrayidx20, align 8
%6 = load i64, ptr %arrayidx22, align 8
store i64 %6, ptr %arrayidx20, align 8
store i64 %5, ptr %arrayidx22, align 8
br label %tailrecurse
if.end23: ; preds = %if.end16
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @heapExtractMin() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%retval.sroa.0.0.copyload = load i64, ptr getelementptr inbounds ([2000001 x %struct.state], ptr @A, i64 0, i64 1), align 8
%idxprom = zext i32 %0 to i64
%arrayidx = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom
%1 = load i64, ptr %arrayidx, align 8
store i64 %1, ptr getelementptr inbounds ([2000001 x %struct.state], ptr @A, i64 0, i64 1), align 8
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @N, align 4, !tbaa !5
br label %tailrecurse.i
tailrecurse.i: ; preds = %if.then18.i, %if.end
%i.tr.i = phi i32 [ 1, %if.end ], [ %small.1.i, %if.then18.i ]
%mul.i.i = shl nsw i32 %i.tr.i, 1
%add.i.i = or i32 %mul.i.i, 1
%cmp.not.i.not = icmp slt i32 %mul.i.i, %0
br i1 %cmp.not.i.not, label %land.lhs.true.i, label %if.else.i
land.lhs.true.i: ; preds = %tailrecurse.i
%idxprom.i = sext i32 %mul.i.i to i64
%cost.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom.i, i32 1
%2 = load i32, ptr %cost.i, align 4, !tbaa !9
%idxprom2.i = sext i32 %i.tr.i to i64
%cost4.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom2.i, i32 1
%3 = load i32, ptr %cost4.i, align 4, !tbaa !9
%cmp5.i = icmp slt i32 %2, %3
br i1 %cmp5.i, label %if.end.i, label %if.else.i
if.else.i: ; preds = %land.lhs.true.i, %tailrecurse.i
br label %if.end.i
if.end.i: ; preds = %if.else.i, %land.lhs.true.i
%small.0.i = phi i32 [ %i.tr.i, %if.else.i ], [ %mul.i.i, %land.lhs.true.i ]
%cmp6.not.i.not = icmp slt i32 %add.i.i, %0
br i1 %cmp6.not.i.not, label %land.lhs.true7.i, label %if.end16.i
land.lhs.true7.i: ; preds = %if.end.i
%idxprom8.i = sext i32 %add.i.i to i64
%cost10.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom8.i, i32 1
%4 = load i32, ptr %cost10.i, align 4, !tbaa !9
%idxprom11.i = sext i32 %small.0.i to i64
%cost13.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom11.i, i32 1
%5 = load i32, ptr %cost13.i, align 4, !tbaa !9
%cmp14.i = icmp slt i32 %4, %5
%spec.select.i = select i1 %cmp14.i, i32 %add.i.i, i32 %small.0.i
br label %if.end16.i
if.end16.i: ; preds = %land.lhs.true7.i, %if.end.i
%small.1.i = phi i32 [ %small.0.i, %if.end.i ], [ %spec.select.i, %land.lhs.true7.i ]
%cmp17.not.i = icmp eq i32 %small.1.i, %i.tr.i
br i1 %cmp17.not.i, label %return, label %if.then18.i
if.then18.i: ; preds = %if.end16.i
%idxprom19.i = sext i32 %i.tr.i to i64
%arrayidx20.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom19.i
%idxprom21.i = sext i32 %small.1.i to i64
%arrayidx22.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom21.i
%6 = load i64, ptr %arrayidx20.i, align 8
%7 = load i64, ptr %arrayidx22.i, align 8
store i64 %7, ptr %arrayidx20.i, align 8
store i64 %6, ptr %arrayidx22.i, align 8
br label %tailrecurse.i
return: ; preds = %if.end16.i, %entry
%retval.sroa.0.0.insert.insert = phi i64 [ 0, %entry ], [ %retval.sroa.0.0.copyload, %if.end16.i ]
ret i64 %retval.sroa.0.0.insert.insert
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @heapIncreaseKey(i32 noundef %i, i64 %key.coerce) local_unnamed_addr #3 {
entry:
%key.sroa.2.0.extract.shift = lshr i64 %key.coerce, 32
%key.sroa.2.0.extract.trunc = trunc i64 %key.sroa.2.0.extract.shift to i32
%idxprom = sext i32 %i to i64
%cost1 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %cost1, align 4, !tbaa !9
%cmp = icmp slt i32 %0, %key.sroa.2.0.extract.trunc
br i1 %cmp, label %while.end, label %if.end
if.end: ; preds = %entry
%arrayidx = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom
%key.sroa.0.0.extract.trunc = trunc i64 %key.coerce to i32
store i32 %key.sroa.0.0.extract.trunc, ptr %arrayidx, align 8, !tbaa.struct !11
store i32 %key.sroa.2.0.extract.trunc, ptr %cost1, align 4, !tbaa.struct !12
%cmp429 = icmp sgt i32 %i, 1
br i1 %cmp429, label %land.rhs, label %while.end
land.rhs: ; preds = %if.end, %while.body
%i.addr.030 = phi i32 [ %div.i2728, %while.body ], [ %i, %if.end ]
%div.i2728 = lshr i32 %i.addr.030, 1
%idxprom5 = zext i32 %div.i2728 to i64
%cost7 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom5, i32 1
%1 = load i32, ptr %cost7, align 4, !tbaa !9
%idxprom8 = zext i32 %i.addr.030 to i64
%cost10 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom8, i32 1
%2 = load i32, ptr %cost10, align 4, !tbaa !9
%cmp11 = icmp sgt i32 %1, %2
br i1 %cmp11, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx9 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom8
%arrayidx16 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom5
%3 = load i64, ptr %arrayidx9, align 8
%4 = load i64, ptr %arrayidx16, align 8
store i64 %4, ptr %arrayidx9, align 8
store i64 %3, ptr %arrayidx16, align 8
%cmp4 = icmp ugt i32 %i.addr.030, 3
br i1 %cmp4, label %land.rhs, label %while.end, !llvm.loop !13
while.end: ; preds = %land.rhs, %while.body, %if.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @minHeapInsert(i64 %key.coerce) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @N, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @N, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom
store i32 1000000001, ptr %arrayidx, align 8, !tbaa.struct !11
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 4
store i32 1000000001, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx, align 4, !tbaa.struct !12
%key.sroa.2.0.extract.shift.i = lshr i64 %key.coerce, 32
%key.sroa.2.0.extract.trunc.i = trunc i64 %key.sroa.2.0.extract.shift.i to i32
%cmp.i = icmp sgt i32 %key.sroa.2.0.extract.trunc.i, 1000000001
br i1 %cmp.i, label %heapIncreaseKey.exit, label %if.end.i
if.end.i: ; preds = %entry
%cost1.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom, i32 1
%key.sroa.0.0.extract.trunc.i = trunc i64 %key.coerce to i32
store i32 %key.sroa.0.0.extract.trunc.i, ptr %arrayidx, align 8, !tbaa.struct !11
store i32 %key.sroa.2.0.extract.trunc.i, ptr %cost1.i, align 4, !tbaa.struct !12
%cmp429.i = icmp sgt i32 %0, 0
br i1 %cmp429.i, label %land.rhs.i, label %heapIncreaseKey.exit
land.rhs.i: ; preds = %if.end.i, %while.body.i
%i.addr.030.i = phi i32 [ %div.i2728.i, %while.body.i ], [ %inc, %if.end.i ]
%div.i2728.i = lshr i32 %i.addr.030.i, 1
%idxprom5.i = zext i32 %div.i2728.i to i64
%cost7.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom5.i, i32 1
%1 = load i32, ptr %cost7.i, align 4, !tbaa !9
%idxprom8.i = zext i32 %i.addr.030.i to i64
%cost10.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom8.i, i32 1
%2 = load i32, ptr %cost10.i, align 4, !tbaa !9
%cmp11.i = icmp sgt i32 %1, %2
br i1 %cmp11.i, label %while.body.i, label %heapIncreaseKey.exit
while.body.i: ; preds = %land.rhs.i
%arrayidx9.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom8.i
%arrayidx16.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom5.i
%3 = load i64, ptr %arrayidx9.i, align 8
%4 = load i64, ptr %arrayidx16.i, align 8
store i64 %4, ptr %arrayidx9.i, align 8
store i64 %3, ptr %arrayidx16.i, align 8
%cmp4.i = icmp ugt i32 %i.addr.030.i, 3
br i1 %cmp4.i, label %land.rhs.i, label %heapIncreaseKey.exit, !llvm.loop !13
heapIncreaseKey.exit: ; preds = %land.rhs.i, %while.body.i, %entry, %if.end.i
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #7
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp110 = icmp sgt i32 %0, 0
br i1 %cmp110, label %for.body, label %for.end22
for.body: ; preds = %entry, %for.end
%indvars.iv129 = phi i64 [ %indvars.iv.next130, %for.end ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%1 = load i32, ptr %b, align 4, !tbaa !5
%conv = sext i32 %1 to i64
%mul = shl nsw i64 %conv, 3
%call2 = call noalias ptr @malloc(i64 noundef %mul) #8
%2 = load i32, ptr %a, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%arrayidx = getelementptr inbounds [10000 x ptr], ptr @G, i64 0, i64 %idxprom
store ptr %call2, ptr %arrayidx, align 8, !tbaa !15
%arrayidx4 = getelementptr inbounds [10000 x i32], ptr @size, i64 0, i64 %idxprom
store i32 %1, ptr %arrayidx4, align 4, !tbaa !5
%cmp6108 = icmp sgt i32 %1, 0
br i1 %cmp6108, label %for.body8, label %for.end
for.body8: ; preds = %for.body, %for.body8
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body8 ], [ 0, %for.body ]
%3 = load i32, ptr %a, align 4, !tbaa !5
%idxprom9 = sext i32 %3 to i64
%arrayidx10 = getelementptr inbounds [10000 x ptr], ptr @G, i64 0, i64 %idxprom9
%4 = load ptr, ptr %arrayidx10, align 8, !tbaa !15
%arrayidx12 = getelementptr inbounds %struct.edge, ptr %4, i64 %indvars.iv
%cost = getelementptr inbounds %struct.edge, ptr %4, i64 %indvars.iv, i32 1
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx12, ptr noundef nonnull %cost)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %b, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp6 = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp6, label %for.body8, label %for.end, !llvm.loop !17
for.end: ; preds = %for.body8, %for.body
%arrayidx19 = getelementptr inbounds [10000 x i32], ptr @d, i64 0, i64 %indvars.iv129
store i32 1000000001, ptr %arrayidx19, align 4, !tbaa !5
%indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
%7 = load i32, ptr @n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next130, %8
br i1 %cmp, label %for.body, label %for.end22.loopexit, !llvm.loop !18
for.end22.loopexit: ; preds = %for.end
%9 = icmp sgt i32 %7, 0
br label %for.end22
for.end22: ; preds = %for.end22.loopexit, %entry
%cmp63126 = phi i1 [ %9, %for.end22.loopexit ], [ false, %entry ]
store i32 0, ptr @d, align 16, !tbaa !5
%10 = load i32, ptr @N, align 4, !tbaa !5
%inc.i = add nsw i32 %10, 1
store i32 %inc.i, ptr @N, align 4, !tbaa !5
%idxprom.i = sext i32 %inc.i to i64
%arrayidx.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom.i
%cost1.i.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom.i, i32 1
store i32 0, ptr %arrayidx.i, align 8, !tbaa.struct !11
store i32 0, ptr %cost1.i.i, align 4, !tbaa.struct !12
%cmp429.i.i = icmp sgt i32 %10, 0
br i1 %cmp429.i.i, label %land.rhs.i.i, label %minHeapInsert.exit
land.rhs.i.i: ; preds = %for.end22, %while.body.i.i
%i.addr.030.i.i = phi i32 [ %div.i2728.i.i, %while.body.i.i ], [ %inc.i, %for.end22 ]
%div.i2728.i.i = lshr i32 %i.addr.030.i.i, 1
%idxprom5.i.i = zext i32 %div.i2728.i.i to i64
%cost7.i.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom5.i.i, i32 1
%11 = load i32, ptr %cost7.i.i, align 4, !tbaa !9
%idxprom8.i.i = zext i32 %i.addr.030.i.i to i64
%cost10.i.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom8.i.i, i32 1
%12 = load i32, ptr %cost10.i.i, align 4, !tbaa !9
%cmp11.i.i = icmp sgt i32 %11, %12
br i1 %cmp11.i.i, label %while.body.i.i, label %minHeapInsert.exit
while.body.i.i: ; preds = %land.rhs.i.i
%arrayidx9.i.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom8.i.i
%arrayidx16.i.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom5.i.i
%13 = load i64, ptr %arrayidx9.i.i, align 8
%14 = load i64, ptr %arrayidx16.i.i, align 8
store i64 %14, ptr %arrayidx9.i.i, align 8
store i64 %13, ptr %arrayidx16.i.i, align 8
%cmp4.i.i = icmp ugt i32 %i.addr.030.i.i, 3
br i1 %cmp4.i.i, label %land.rhs.i.i, label %minHeapInsert.exit, !llvm.loop !13
minHeapInsert.exit: ; preds = %land.rhs.i.i, %while.body.i.i, %for.end22
%cmp24.not124 = icmp eq i32 %inc.i, 0
br i1 %cmp24.not124, label %for.cond62.preheader, label %while.body
for.cond62.preheader: ; preds = %while.cond.backedge, %minHeapInsert.exit
br i1 %cmp63126, label %for.body65, label %for.end71
while.body: ; preds = %minHeapInsert.exit, %while.cond.backedge
%N.promoted121125 = phi i32 [ %N.promoted122, %while.cond.backedge ], [ %inc.i, %minHeapInsert.exit ]
%cmp.i = icmp slt i32 %N.promoted121125, 1
br i1 %cmp.i, label %heapExtractMin.exit, label %if.end.i
if.end.i: ; preds = %while.body
%retval.sroa.0.0.copyload.i = load i64, ptr getelementptr inbounds ([2000001 x %struct.state], ptr @A, i64 0, i64 1), align 8
%idxprom.i84 = zext i32 %N.promoted121125 to i64
%arrayidx.i85 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom.i84
%15 = load i64, ptr %arrayidx.i85, align 8
store i64 %15, ptr getelementptr inbounds ([2000001 x %struct.state], ptr @A, i64 0, i64 1), align 8
%dec.i = add nsw i32 %N.promoted121125, -1
store i32 %dec.i, ptr @N, align 4, !tbaa !5
br label %tailrecurse.i.i
tailrecurse.i.i: ; preds = %if.then18.i.i, %if.end.i
%i.tr.i.i = phi i32 [ 1, %if.end.i ], [ %small.1.i.i, %if.then18.i.i ]
%mul.i.i.i = shl nsw i32 %i.tr.i.i, 1
%add.i.i.i = or i32 %mul.i.i.i, 1
%cmp.not.i.not.i = icmp slt i32 %mul.i.i.i, %N.promoted121125
br i1 %cmp.not.i.not.i, label %land.lhs.true.i.i, label %if.else.i.i
land.lhs.true.i.i: ; preds = %tailrecurse.i.i
%idxprom.i.i = sext i32 %mul.i.i.i to i64
%cost.i.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom.i.i, i32 1
%16 = load i32, ptr %cost.i.i, align 4, !tbaa !9
%idxprom2.i.i = sext i32 %i.tr.i.i to i64
%cost4.i.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom2.i.i, i32 1
%17 = load i32, ptr %cost4.i.i, align 4, !tbaa !9
%cmp5.i.i = icmp slt i32 %16, %17
br i1 %cmp5.i.i, label %if.end.i.i, label %if.else.i.i
if.else.i.i: ; preds = %land.lhs.true.i.i, %tailrecurse.i.i
br label %if.end.i.i
if.end.i.i: ; preds = %if.else.i.i, %land.lhs.true.i.i
%small.0.i.i = phi i32 [ %i.tr.i.i, %if.else.i.i ], [ %mul.i.i.i, %land.lhs.true.i.i ]
%cmp6.not.i.not.i = icmp slt i32 %add.i.i.i, %N.promoted121125
br i1 %cmp6.not.i.not.i, label %land.lhs.true7.i.i, label %if.end16.i.i
land.lhs.true7.i.i: ; preds = %if.end.i.i
%idxprom8.i.i86 = sext i32 %add.i.i.i to i64
%cost10.i.i87 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom8.i.i86, i32 1
%18 = load i32, ptr %cost10.i.i87, align 4, !tbaa !9
%idxprom11.i.i = sext i32 %small.0.i.i to i64
%cost13.i.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom11.i.i, i32 1
%19 = load i32, ptr %cost13.i.i, align 4, !tbaa !9
%cmp14.i.i = icmp slt i32 %18, %19
%spec.select.i.i = select i1 %cmp14.i.i, i32 %add.i.i.i, i32 %small.0.i.i
br label %if.end16.i.i
if.end16.i.i: ; preds = %land.lhs.true7.i.i, %if.end.i.i
%small.1.i.i = phi i32 [ %small.0.i.i, %if.end.i.i ], [ %spec.select.i.i, %land.lhs.true7.i.i ]
%cmp17.not.i.i = icmp eq i32 %small.1.i.i, %i.tr.i.i
br i1 %cmp17.not.i.i, label %heapExtractMin.exit, label %if.then18.i.i
if.then18.i.i: ; preds = %if.end16.i.i
%idxprom19.i.i = sext i32 %i.tr.i.i to i64
%arrayidx20.i.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom19.i.i
%idxprom21.i.i = sext i32 %small.1.i.i to i64
%arrayidx22.i.i = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom21.i.i
%20 = load i64, ptr %arrayidx20.i.i, align 8
%21 = load i64, ptr %arrayidx22.i.i, align 8
store i64 %21, ptr %arrayidx20.i.i, align 8
store i64 %20, ptr %arrayidx22.i.i, align 8
br label %tailrecurse.i.i
heapExtractMin.exit: ; preds = %if.end16.i.i, %while.body
%N.promoted123 = phi i32 [ %N.promoted121125, %while.body ], [ %dec.i, %if.end16.i.i ]
%retval.sroa.0.0.insert.insert.i = phi i64 [ 0, %while.body ], [ %retval.sroa.0.0.copyload.i, %if.end16.i.i ]
store i64 %retval.sroa.0.0.insert.insert.i, ptr @s, align 8, !tbaa.struct !11
%22 = lshr i64 %retval.sroa.0.0.insert.insert.i, 32
%23 = trunc i64 %22 to i32
%sext = shl i64 %retval.sroa.0.0.insert.insert.i, 32
%idxprom27 = ashr exact i64 %sext, 32
%arrayidx28 = getelementptr inbounds [10000 x i32], ptr @d, i64 0, i64 %idxprom27
%24 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%cmp29 = icmp slt i32 %24, %23
br i1 %cmp29, label %while.cond.backedge, label %for.cond31.preheader
while.cond.backedge: ; preds = %for.inc59, %for.cond31.preheader, %heapExtractMin.exit
%N.promoted122 = phi i32 [ %N.promoted123, %heapExtractMin.exit ], [ %N.promoted123, %for.cond31.preheader ], [ %N.promoted119, %for.inc59 ]
%cmp24.not = icmp eq i32 %N.promoted122, 0
br i1 %cmp24.not, label %for.cond62.preheader, label %while.body, !llvm.loop !19
for.cond31.preheader: ; preds = %heapExtractMin.exit
%arrayidx33 = getelementptr inbounds [10000 x i32], ptr @size, i64 0, i64 %idxprom27
%25 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34114 = icmp sgt i32 %25, 0
br i1 %cmp34114, label %for.body36.lr.ph, label %while.cond.backedge, !llvm.loop !19
for.body36.lr.ph: ; preds = %for.cond31.preheader
%arrayidx38 = getelementptr inbounds [10000 x ptr], ptr @G, i64 0, i64 %idxprom27
%26 = load ptr, ptr %arrayidx38, align 8, !tbaa !15
%wide.trip.count = zext i32 %25 to i64
br label %for.body36
for.body36: ; preds = %for.body36.lr.ph, %for.inc59
%indvars.iv132 = phi i64 [ 0, %for.body36.lr.ph ], [ %indvars.iv.next133, %for.inc59 ]
%N.promoted120 = phi i32 [ %N.promoted123, %for.body36.lr.ph ], [ %N.promoted119, %for.inc59 ]
%inc.i88113115 = phi i32 [ %N.promoted123, %for.body36.lr.ph ], [ %inc.i88112, %for.inc59 ]
%arrayidx40 = getelementptr inbounds %struct.edge, ptr %26, i64 %indvars.iv132
%27 = load i64, ptr %arrayidx40, align 4
store i64 %27, ptr @e, align 8
%28 = trunc i64 %27 to i32
%sext138 = shl i64 %27, 32
%idxprom41 = ashr exact i64 %sext138, 32
%arrayidx42 = getelementptr inbounds [10000 x i32], ptr @d, i64 0, i64 %idxprom41
%29 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%30 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%31 = lshr i64 %27, 32
%32 = trunc i64 %31 to i32
%add = add nsw i32 %30, %32
%cmp45.not = icmp sgt i32 %29, %add
br i1 %cmp45.not, label %if.end48, label %for.inc59
if.end48: ; preds = %for.body36
store i32 %add, ptr %arrayidx42, align 4, !tbaa !5
%inc.i88 = add nsw i32 %inc.i88113115, 1
store i32 %inc.i88, ptr @N, align 4, !tbaa !5
%idxprom.i89 = sext i32 %inc.i88 to i64
%arrayidx.i90 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom.i89
store i32 1000000001, ptr %arrayidx.i90, align 8, !tbaa.struct !11
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i91 = getelementptr inbounds i8, ptr %arrayidx.i90, i64 4
store i32 1000000001, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i91, align 4, !tbaa.struct !12
%cmp.i.i = icmp sgt i32 %add, 1000000001
br i1 %cmp.i.i, label %for.inc59, label %if.end.i.i92
if.end.i.i92: ; preds = %if.end48
%cost1.i.i93 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom.i89, i32 1
store i32 %28, ptr %arrayidx.i90, align 8, !tbaa.struct !11
store i32 %add, ptr %cost1.i.i93, align 4, !tbaa.struct !12
%cmp429.i.i94 = icmp sgt i32 %inc.i88113115, 0
br i1 %cmp429.i.i94, label %land.rhs.i.i95, label %for.inc59
land.rhs.i.i95: ; preds = %if.end.i.i92, %while.body.i.i103
%i.addr.030.i.i96 = phi i32 [ %div.i2728.i.i97, %while.body.i.i103 ], [ %inc.i88, %if.end.i.i92 ]
%div.i2728.i.i97 = lshr i32 %i.addr.030.i.i96, 1
%idxprom5.i.i98 = zext i32 %div.i2728.i.i97 to i64
%cost7.i.i99 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom5.i.i98, i32 1
%33 = load i32, ptr %cost7.i.i99, align 4, !tbaa !9
%idxprom8.i.i100 = zext i32 %i.addr.030.i.i96 to i64
%cost10.i.i101 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom8.i.i100, i32 1
%34 = load i32, ptr %cost10.i.i101, align 4, !tbaa !9
%cmp11.i.i102 = icmp sgt i32 %33, %34
br i1 %cmp11.i.i102, label %while.body.i.i103, label %for.inc59
while.body.i.i103: ; preds = %land.rhs.i.i95
%arrayidx9.i.i104 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom8.i.i100
%arrayidx16.i.i105 = getelementptr inbounds [2000001 x %struct.state], ptr @A, i64 0, i64 %idxprom5.i.i98
%35 = load i64, ptr %arrayidx9.i.i104, align 8
%36 = load i64, ptr %arrayidx16.i.i105, align 8
store i64 %36, ptr %arrayidx9.i.i104, align 8
store i64 %35, ptr %arrayidx16.i.i105, align 8
%cmp4.i.i106 = icmp ugt i32 %i.addr.030.i.i96, 3
br i1 %cmp4.i.i106, label %land.rhs.i.i95, label %for.inc59, !llvm.loop !13
for.inc59: ; preds = %while.body.i.i103, %land.rhs.i.i95, %if.end.i.i92, %if.end48, %for.body36
%N.promoted119 = phi i32 [ %inc.i88, %if.end.i.i92 ], [ %inc.i88, %if.end48 ], [ %N.promoted120, %for.body36 ], [ %inc.i88, %land.rhs.i.i95 ], [ %inc.i88, %while.body.i.i103 ]
%inc.i88112 = phi i32 [ %inc.i88, %if.end.i.i92 ], [ %inc.i88, %if.end48 ], [ %inc.i88113115, %for.body36 ], [ %inc.i88, %land.rhs.i.i95 ], [ %inc.i88, %while.body.i.i103 ]
%indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
%exitcond.not = icmp eq i64 %indvars.iv.next133, %wide.trip.count
br i1 %exitcond.not, label %while.cond.backedge, label %for.body36, !llvm.loop !20
for.body65: ; preds = %for.cond62.preheader, %for.body65
%indvars.iv135 = phi i64 [ %indvars.iv.next136, %for.body65 ], [ 0, %for.cond62.preheader ]
%arrayidx67 = getelementptr inbounds [10000 x i32], ptr @d, i64 0, i64 %indvars.iv135
%37 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%38 = trunc i64 %indvars.iv135 to i32
%call68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %38, i32 noundef %37)
%indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1
%39 = load i32, ptr @n, align 4, !tbaa !5
%40 = sext i32 %39 to i64
%cmp63 = icmp slt i64 %indvars.iv.next136, %40
br i1 %cmp63, label %for.body65, label %for.end71, !llvm.loop !21
for.end71: ; preds = %for.body65, %for.cond62.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #7
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: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn allockind("alloc,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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"state", !6, i64 0, !6, i64 4}
!11 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!12 = !{i64 0, i64 4, !5}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
|
#include<stdio.h>
#include<stdlib.h>
#define N 10001
#define M 10000001
struct node{
int key;
int cost;
struct node *next;
};
typedef struct node *GG;
GG G[10001];
GG MNode(int,int,GG);
void Insert(int,int,int);
int main()
{
int i,j,n,count=0,v,c,c1,v1;
int color[N],d[N],pi[N],mincost,ii;
GG GGG;
scanf("%d",&n);
for(i=0;i<n;i++)G[i]=MNode(0,0,NULL);
for(i=0;i<n;i++){
scanf("%d%d",&v,&c);
for(j=0;j<c;j++){
scanf("%d%d",&v1,&c1);
Insert(i,v1,c1);
}
}
for(i=0;i<n;i++){
color[i]=0;
pi[i]=-1;
d[i]=M;
}
d[0]=0;
while(1){
mincost=M;
for(i=0;i<n;i++){
if(color[i]!=2 && d[i]<mincost){
mincost=d[i];
ii=i;
}
}
if(mincost==M)break;
color[ii]=2;
for(GGG=G[ii];GGG!=NULL;GGG=GGG->next){
if(color[GGG->key]!=2 && (GGG->cost+d[ii])<d[GGG->key]){
pi[GGG->key]=ii;
d[GGG->key]=GGG->cost+d[ii];
color[GGG->key]=1;
}
}
}
for(i=0;i<n;i++)printf("%d %d\n",i,d[i]);
return 0;
}
GG MNode(int key,int cost,GG Node)
{
GG n;
n=(GG)malloc(sizeof(struct node));
n->key=key;
n->cost=cost;
n->next=Node;
return n;
}
void Insert(int s,int t,int u)
{
GG GGG;
GGG=MNode(t,u,G[s]->next);
G[s]->next=GGG;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289156/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289156/source.c"
target datalayout = "e-m:e-p270: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, i32, ptr }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@G = dso_local local_unnamed_addr global [10001 x ptr] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%v = alloca i32, align 4
%c = alloca i32, align 4
%c1 = alloca i32, align 4
%v1 = alloca i32, align 4
%color = alloca [10001 x i32], align 16
%d = alloca [10001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c1) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v1) #9
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %color) #9
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %d) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp125 = icmp sgt i32 %0, 0
br i1 %cmp125, label %for.body.preheader, label %for.end27
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.cond2.preheader: ; preds = %for.body
br i1 %cmp125, label %for.body4, label %for.end27
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%calloc = call dereferenceable_or_null(16) ptr @calloc(i64 1, i64 16)
%arrayidx = getelementptr inbounds [10001 x ptr], ptr @G, i64 0, i64 %indvars.iv
store ptr %calloc, ptr %arrayidx, align 8, !tbaa !9
%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.cond2.preheader, label %for.body, !llvm.loop !11
for.cond16.preheader: ; preds = %for.inc13
%cmp17131 = icmp sgt i32 %12, 0
br i1 %cmp17131, label %for.body18.preheader, label %for.end27
for.body18.preheader: ; preds = %for.cond16.preheader
%1 = zext i32 %12 to i64
%2 = shl nuw nsw i64 %1, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %color, i8 0, i64 %2, i1 false), !tbaa !5
%min.iters.check = icmp ult i32 %12, 8
br i1 %min.iters.check, label %for.body18.preheader171, label %vector.ph
vector.ph: ; preds = %for.body18.preheader
%n.vec = and i64 %1, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%3 = getelementptr inbounds [10001 x i32], ptr %d, i64 0, i64 %index
store <4 x i32> <i32 10000001, i32 10000001, i32 10000001, i32 10000001>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> <i32 10000001, i32 10000001, i32 10000001, i32 10000001>, ptr %4, align 16, !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 !13
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %for.end27, label %for.body18.preheader171
for.body18.preheader171: ; preds = %for.body18.preheader, %middle.block
%indvars.iv149.ph = phi i64 [ 0, %for.body18.preheader ], [ %n.vec, %middle.block ]
br label %for.body18
for.body4: ; preds = %for.cond2.preheader, %for.inc13
%indvars.iv146 = phi i64 [ %indvars.iv.next147, %for.inc13 ], [ 0, %for.cond2.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %c)
%6 = load i32, ptr %c, align 4, !tbaa !5
%cmp7127 = icmp sgt i32 %6, 0
br i1 %cmp7127, label %for.body8.lr.ph, label %for.inc13
for.body8.lr.ph: ; preds = %for.body4
%arrayidx.i = getelementptr inbounds [10001 x ptr], ptr @G, i64 0, i64 %indvars.iv146
br label %for.body8
for.body8: ; preds = %for.body8.lr.ph, %for.body8
%j.0128 = phi i32 [ 0, %for.body8.lr.ph ], [ %inc11, %for.body8 ]
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v1, ptr noundef nonnull %c1)
%7 = load i32, ptr %v1, align 4, !tbaa !5
%8 = load i32, ptr %c1, align 4, !tbaa !5
%9 = load ptr, ptr %arrayidx.i, align 8, !tbaa !9
%next.i124 = getelementptr inbounds %struct.node, ptr %9, i64 0, i32 2
%10 = load ptr, ptr %next.i124, align 8, !tbaa !16
%call.i.i = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #10
store i32 %7, ptr %call.i.i, align 8, !tbaa !18
%cost2.i.i = getelementptr inbounds %struct.node, ptr %call.i.i, i64 0, i32 1
store i32 %8, ptr %cost2.i.i, align 4, !tbaa !19
%next.i.i = getelementptr inbounds %struct.node, ptr %call.i.i, i64 0, i32 2
store ptr %10, ptr %next.i.i, align 8, !tbaa !16
store ptr %call.i.i, ptr %next.i124, align 8, !tbaa !16
%inc11 = add nuw nsw i32 %j.0128, 1
%11 = load i32, ptr %c, align 4, !tbaa !5
%cmp7 = icmp slt i32 %inc11, %11
br i1 %cmp7, label %for.body8, label %for.inc13, !llvm.loop !20
for.inc13: ; preds = %for.body8, %for.body4
%indvars.iv.next147 = add nuw nsw i64 %indvars.iv146, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp3 = icmp slt i64 %indvars.iv.next147, %13
br i1 %cmp3, label %for.body4, label %for.cond16.preheader, !llvm.loop !21
for.body18: ; preds = %for.body18.preheader171, %for.body18
%indvars.iv149 = phi i64 [ %indvars.iv.next150, %for.body18 ], [ %indvars.iv149.ph, %for.body18.preheader171 ]
%arrayidx24 = getelementptr inbounds [10001 x i32], ptr %d, i64 0, i64 %indvars.iv149
store i32 10000001, ptr %arrayidx24, align 4, !tbaa !5
%indvars.iv.next150 = add nuw nsw i64 %indvars.iv149, 1
%exitcond153.not = icmp eq i64 %indvars.iv.next150, %1
br i1 %exitcond153.not, label %for.end27, label %for.body18, !llvm.loop !22
for.end27: ; preds = %for.body18, %middle.block, %entry, %for.cond2.preheader, %for.cond16.preheader
%cmp17131163 = phi i1 [ false, %for.cond16.preheader ], [ false, %for.cond2.preheader ], [ false, %entry ], [ %cmp17131, %middle.block ], [ %cmp17131, %for.body18 ]
%14 = phi i32 [ %12, %for.cond16.preheader ], [ %0, %for.cond2.preheader ], [ %0, %entry ], [ %12, %middle.block ], [ %12, %for.body18 ]
store i32 0, ptr %d, align 16, !tbaa !5
%wide.trip.count157 = zext i32 %14 to i64
br i1 %cmp17131163, label %for.body31, label %for.end88
while.cond.loopexit: ; preds = %for.inc78, %if.end45
br i1 %cmp17131163, label %for.body31.backedge, label %for.end88
for.body31: ; preds = %for.end27, %for.body31.backedge
%indvars.iv154 = phi i64 [ %indvars.iv154.be, %for.body31.backedge ], [ 0, %for.end27 ]
%ii.1136 = phi i32 [ %ii.2, %for.body31.backedge ], [ undef, %for.end27 ]
%mincost.0135 = phi i32 [ %mincost.0135.be, %for.body31.backedge ], [ 10000001, %for.end27 ]
%arrayidx33 = getelementptr inbounds [10001 x i32], ptr %color, i64 0, i64 %indvars.iv154
%15 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34.not = icmp eq i32 %15, 2
br i1 %cmp34.not, label %for.inc40, label %land.lhs.true
land.lhs.true: ; preds = %for.body31
%arrayidx36 = getelementptr inbounds [10001 x i32], ptr %d, i64 0, i64 %indvars.iv154
%16 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%cmp37 = icmp slt i32 %16, %mincost.0135
%spec.select = call i32 @llvm.smin.i32(i32 %16, i32 %mincost.0135)
%17 = trunc i64 %indvars.iv154 to i32
%spec.select123 = select i1 %cmp37, i32 %17, i32 %ii.1136
br label %for.inc40
for.inc40: ; preds = %land.lhs.true, %for.body31
%mincost.1 = phi i32 [ %mincost.0135, %for.body31 ], [ %spec.select, %land.lhs.true ]
%ii.2 = phi i32 [ %ii.1136, %for.body31 ], [ %spec.select123, %land.lhs.true ]
%indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
%exitcond158.not = icmp eq i64 %indvars.iv.next155, %wide.trip.count157
br i1 %exitcond158.not, label %for.end42, label %for.body31.backedge
for.body31.backedge: ; preds = %for.inc40, %while.cond.loopexit
%indvars.iv154.be = phi i64 [ %indvars.iv.next155, %for.inc40 ], [ 0, %while.cond.loopexit ]
%mincost.0135.be = phi i32 [ %mincost.1, %for.inc40 ], [ 10000001, %while.cond.loopexit ]
br label %for.body31, !llvm.loop !23
for.end42: ; preds = %for.inc40
%cmp43 = icmp eq i32 %mincost.1, 10000001
br i1 %cmp43, label %for.cond80.preheader, label %if.end45
for.cond80.preheader: ; preds = %for.end42
br i1 %cmp17131163, label %for.body82, label %for.end88
if.end45: ; preds = %for.end42
%idxprom46 = sext i32 %ii.2 to i64
%arrayidx47 = getelementptr inbounds [10001 x i32], ptr %color, i64 0, i64 %idxprom46
store i32 2, ptr %arrayidx47, align 4, !tbaa !5
%arrayidx49 = getelementptr inbounds [10001 x ptr], ptr @G, i64 0, i64 %idxprom46
%GGG.0139 = load ptr, ptr %arrayidx49, align 8, !tbaa !9
%cmp51.not140 = icmp eq ptr %GGG.0139, null
br i1 %cmp51.not140, label %while.cond.loopexit, label %for.body52.lr.ph
for.body52.lr.ph: ; preds = %if.end45
%arrayidx58 = getelementptr inbounds [10001 x i32], ptr %d, i64 0, i64 %idxprom46
br label %for.body52
for.body52: ; preds = %for.body52.lr.ph, %for.inc78
%GGG.0141 = phi ptr [ %GGG.0139, %for.body52.lr.ph ], [ %GGG.0, %for.inc78 ]
%18 = load i32, ptr %GGG.0141, align 8, !tbaa !18
%idxprom53 = sext i32 %18 to i64
%arrayidx54 = getelementptr inbounds [10001 x i32], ptr %color, i64 0, i64 %idxprom53
%19 = load i32, ptr %arrayidx54, align 4, !tbaa !5
%cmp55.not = icmp eq i32 %19, 2
br i1 %cmp55.not, label %for.inc78, label %land.lhs.true56
land.lhs.true56: ; preds = %for.body52
%cost = getelementptr inbounds %struct.node, ptr %GGG.0141, i64 0, i32 1
%20 = load i32, ptr %cost, align 4, !tbaa !19
%21 = load i32, ptr %arrayidx58, align 4, !tbaa !5
%add = add nsw i32 %21, %20
%arrayidx61 = getelementptr inbounds [10001 x i32], ptr %d, i64 0, i64 %idxprom53
%22 = load i32, ptr %arrayidx61, align 4, !tbaa !5
%cmp62 = icmp slt i32 %add, %22
br i1 %cmp62, label %if.then63, label %for.inc78
if.then63: ; preds = %land.lhs.true56
store i32 %add, ptr %arrayidx61, align 4, !tbaa !5
store i32 1, ptr %arrayidx54, align 4, !tbaa !5
br label %for.inc78
for.inc78: ; preds = %for.body52, %land.lhs.true56, %if.then63
%next = getelementptr inbounds %struct.node, ptr %GGG.0141, i64 0, i32 2
%GGG.0 = load ptr, ptr %next, align 8, !tbaa !9
%cmp51.not = icmp eq ptr %GGG.0, null
br i1 %cmp51.not, label %while.cond.loopexit, label %for.body52, !llvm.loop !24
for.body82: ; preds = %for.cond80.preheader, %for.body82
%indvars.iv159 = phi i64 [ %indvars.iv.next160, %for.body82 ], [ 0, %for.cond80.preheader ]
%arrayidx84 = getelementptr inbounds [10001 x i32], ptr %d, i64 0, i64 %indvars.iv159
%23 = load i32, ptr %arrayidx84, align 4, !tbaa !5
%24 = trunc i64 %indvars.iv159 to i32
%call85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24, i32 noundef %23)
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%25 = load i32, ptr %n, align 4, !tbaa !5
%26 = sext i32 %25 to i64
%cmp81 = icmp slt i64 %indvars.iv.next160, %26
br i1 %cmp81, label %for.body82, label %for.end88, !llvm.loop !25
for.end88: ; preds = %while.cond.loopexit, %for.body82, %for.end27, %for.cond80.preheader
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %d) #9
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %color) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v1) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c1) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @MNode(i32 noundef %key, i32 noundef %cost, ptr noundef %Node) local_unnamed_addr #3 {
entry:
%call = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #10
store i32 %key, ptr %call, align 8, !tbaa !18
%cost2 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1
store i32 %cost, ptr %cost2, align 4, !tbaa !19
%next = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %Node, ptr %next, align 8, !tbaa !16
ret ptr %call
}
; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local void @Insert(i32 noundef %s, i32 noundef %t, i32 noundef %u) local_unnamed_addr #4 {
entry:
%idxprom = sext i32 %s to i64
%arrayidx = getelementptr inbounds [10001 x ptr], ptr @G, i64 0, i64 %idxprom
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !9
%next = getelementptr inbounds %struct.node, ptr %0, i64 0, i32 2
%1 = load ptr, ptr %next, align 8, !tbaa !16
%call.i = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #10
store i32 %t, ptr %call.i, align 8, !tbaa !18
%cost2.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1
store i32 %u, ptr %cost2.i, align 4, !tbaa !19
%next.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %1, ptr %next.i, align 8, !tbaa !16
store ptr %call.i, ptr %next, align 8, !tbaa !16
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
; Function Attrs: nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #8
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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, argmem: none, 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 #4 = { mustprogress nofree nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #9 = { nounwind }
attributes #10 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = !{!17, !10, i64 8}
!17 = !{!"node", !6, i64 0, !6, i64 4, !10, i64 8}
!18 = !{!17, !6, i64 0}
!19 = !{!17, !6, i64 4}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12, !15, !14}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12}
|
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
typedef struct edge_t{
int from;
int to;
int heavy;
}edge;
int main(void) {
int n,i,k,from,to,heavy,hantei,nedge=0,dis[10000];
edge *edges, *p;
edges = malloc(sizeof(edge)*500000);
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d",&from);
scanf("%d",&k);
while (k--) {
scanf("%d",&to);
scanf("%d",&heavy);
p = &edges[nedge++];
p->from = from;
p->to = to;
p->heavy = heavy;
}
dis[i] = INT_MAX;
}
dis[0] = 0;
hantei = 1;
while (hantei) {
hantei = 0;
for (i = 0; i < nedge; i++) {
from = edges[i].from;
to = edges[i].to;
heavy = edges[i].heavy;
if (dis[from] < INT_MAX && dis[to] > heavy + dis[from]) {
dis[to] = heavy + dis[from];
hantei = 1;
}
}
}
for (i = 0; i < n; i++) {
printf("%d %d\n", i, dis[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289206/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289206/source.c"
target datalayout = "e-m:e-p270: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.edge_t = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%from = alloca i32, align 4
%to = alloca i32, align 4
%heavy = alloca i32, align 4
%dis = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %from) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %to) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %heavy) #5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %dis) #5
%call = tail call noalias dereferenceable_or_null(6000000) ptr @malloc(i64 noundef 6000000) #6
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp74 = icmp sgt i32 %0, 0
br i1 %cmp74, label %for.body, label %for.end53
for.body: ; preds = %entry, %while.end
%indvars.iv89 = phi i64 [ %indvars.iv.next90, %while.end ], [ 0, %entry ]
%nedge.075 = phi i32 [ %nedge.1.lcssa, %while.end ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %from)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !5
%dec71 = add nsw i32 %1, -1
store i32 %dec71, ptr %k, align 4, !tbaa !5
%tobool.not72 = icmp eq i32 %1, 0
br i1 %tobool.not72, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %for.body
%2 = sext i32 %nedge.075 to i64
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%indvars.iv = phi i64 [ %2, %while.body.preheader ], [ %indvars.iv.next, %while.body ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %to)
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %heavy)
%indvars.iv.next = add i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds %struct.edge_t, ptr %call, i64 %indvars.iv
%3 = load i32, ptr %from, align 4, !tbaa !5
store i32 %3, ptr %arrayidx, align 4, !tbaa !9
%4 = load i32, ptr %to, align 4, !tbaa !5
%to7 = getelementptr inbounds %struct.edge_t, ptr %call, i64 %indvars.iv, i32 1
store i32 %4, ptr %to7, align 4, !tbaa !11
%5 = load i32, ptr %heavy, align 4, !tbaa !5
%heavy8 = getelementptr inbounds %struct.edge_t, ptr %call, i64 %indvars.iv, i32 2
store i32 %5, ptr %heavy8, align 4, !tbaa !12
%6 = load i32, ptr %k, align 4, !tbaa !5
%dec = add nsw i32 %6, -1
store i32 %dec, ptr %k, align 4, !tbaa !5
%tobool.not = icmp eq i32 %6, 0
br i1 %tobool.not, label %while.end.loopexit, label %while.body, !llvm.loop !13
while.end.loopexit: ; preds = %while.body
%7 = trunc i64 %indvars.iv.next to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %for.body
%nedge.1.lcssa = phi i32 [ %nedge.075, %for.body ], [ %7, %while.end.loopexit ]
%arrayidx10 = getelementptr inbounds [10000 x i32], ptr %dis, i64 0, i64 %indvars.iv89
store i32 2147483647, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp = icmp slt i64 %indvars.iv.next90, %9
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !15
for.end: ; preds = %while.end
%10 = icmp sgt i32 %8, 0
store i32 0, ptr %dis, align 16, !tbaa !5
%cmp1778 = icmp sgt i32 %nedge.1.lcssa, 0
br i1 %cmp1778, label %for.cond16.preheader.us.preheader, label %for.cond45.preheader
for.cond16.preheader.us.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %nedge.1.lcssa to i64
br label %for.body18.us
for.body18.us: ; preds = %for.body18.us.backedge, %for.cond16.preheader.us.preheader
%indvars.iv92 = phi i64 [ 0, %for.cond16.preheader.us.preheader ], [ %indvars.iv92.be, %for.body18.us.backedge ]
%hantei.179.us = phi i32 [ 0, %for.cond16.preheader.us.preheader ], [ %hantei.179.us.be, %for.body18.us.backedge ]
%arrayidx20.us = getelementptr inbounds %struct.edge_t, ptr %call, i64 %indvars.iv92
%11 = load i32, ptr %arrayidx20.us, align 4, !tbaa !9
%to24.us = getelementptr inbounds %struct.edge_t, ptr %call, i64 %indvars.iv92, i32 1
%12 = load i32, ptr %to24.us, align 4, !tbaa !11
%heavy27.us = getelementptr inbounds %struct.edge_t, ptr %call, i64 %indvars.iv92, i32 2
%13 = load i32, ptr %heavy27.us, align 4, !tbaa !12
%idxprom28.us = sext i32 %11 to i64
%arrayidx29.us = getelementptr inbounds [10000 x i32], ptr %dis, i64 0, i64 %idxprom28.us
%14 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
%cmp30.not.us = icmp eq i32 %14, 2147483647
br i1 %cmp30.not.us, label %for.inc41.us, label %land.lhs.true.us
land.lhs.true.us: ; preds = %for.body18.us
%idxprom31.us = sext i32 %12 to i64
%arrayidx32.us = getelementptr inbounds [10000 x i32], ptr %dis, i64 0, i64 %idxprom31.us
%15 = load i32, ptr %arrayidx32.us, align 4, !tbaa !5
%add.us = add nsw i32 %14, %13
%cmp35.us = icmp sgt i32 %15, %add.us
%spec.store.select.us = call i32 @llvm.smin.i32(i32 %15, i32 %add.us)
store i32 %spec.store.select.us, ptr %arrayidx32.us, align 4
%spec.select.us = select i1 %cmp35.us, i32 1, i32 %hantei.179.us
br label %for.inc41.us
for.inc41.us: ; preds = %land.lhs.true.us, %for.body18.us
%hantei.2.us = phi i32 [ %hantei.179.us, %for.body18.us ], [ %spec.select.us, %land.lhs.true.us ]
%indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
%exitcond.not = icmp eq i64 %indvars.iv.next93, %wide.trip.count
br i1 %exitcond.not, label %for.cond16.while.cond13.loopexit_crit_edge.us, label %for.body18.us.backedge
for.body18.us.backedge: ; preds = %for.inc41.us, %for.cond16.while.cond13.loopexit_crit_edge.us
%indvars.iv92.be = phi i64 [ %indvars.iv.next93, %for.inc41.us ], [ 0, %for.cond16.while.cond13.loopexit_crit_edge.us ]
%hantei.179.us.be = phi i32 [ %hantei.2.us, %for.inc41.us ], [ 0, %for.cond16.while.cond13.loopexit_crit_edge.us ]
br label %for.body18.us, !llvm.loop !16
for.cond16.while.cond13.loopexit_crit_edge.us: ; preds = %for.inc41.us
%tobool14.not.us = icmp eq i32 %hantei.2.us, 0
br i1 %tobool14.not.us, label %for.cond45.preheader.split.us, label %for.body18.us.backedge
for.cond45.preheader.split.us: ; preds = %for.cond16.while.cond13.loopexit_crit_edge.us
store i32 %11, ptr %from, align 4, !tbaa !5
store i32 %12, ptr %to, align 4, !tbaa !5
store i32 %13, ptr %heavy, align 4, !tbaa !5
br i1 %10, label %for.body47.preheader, label %for.end53
for.cond45.preheader: ; preds = %for.end
br i1 %10, label %for.body47.preheader, label %for.end53
for.body47.preheader: ; preds = %for.cond45.preheader.split.us, %for.cond45.preheader
br label %for.body47
for.body47: ; preds = %for.body47.preheader, %for.body47
%indvars.iv95 = phi i64 [ %indvars.iv.next96, %for.body47 ], [ 0, %for.body47.preheader ]
%arrayidx49 = getelementptr inbounds [10000 x i32], ptr %dis, i64 0, i64 %indvars.iv95
%16 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%17 = trunc i64 %indvars.iv95 to i32
%call50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %17, i32 noundef %16)
%indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
%18 = load i32, ptr %n, align 4, !tbaa !5
%19 = sext i32 %18 to i64
%cmp46 = icmp slt i64 %indvars.iv.next96, %19
br i1 %cmp46, label %for.body47, label %for.end53, !llvm.loop !17
for.end53: ; preds = %for.body47, %entry, %for.cond45.preheader.split.us, %for.cond45.preheader
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %dis) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %heavy) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %to) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %from) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #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.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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"edge_t", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 4}
!12 = !{!10, !6, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
|
#include<stdio.h>
int main(void){
int page[7],n;
int i;
scanf("%d",&n);
for(i=0;i<7;i++) scanf("%d",page+i);
while(n>0){
for(i=0;i<7;i++){
n-=page[i];
if(n<=0) break;
}
}
printf("%d\n",i+1);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28925/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28925/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%page = alloca [7 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %page) #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)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %page)
%add.ptr.1 = getelementptr inbounds i32, ptr %page, i64 1
%call1.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.1)
%add.ptr.2 = getelementptr inbounds i32, ptr %page, i64 2
%call1.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.2)
%add.ptr.3 = getelementptr inbounds i32, ptr %page, i64 3
%call1.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.3)
%add.ptr.4 = getelementptr inbounds i32, ptr %page, i64 4
%call1.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.4)
%add.ptr.5 = getelementptr inbounds i32, ptr %page, i64 5
%call1.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.5)
%add.ptr.6 = getelementptr inbounds i32, ptr %page, i64 6
%call1.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.6)
%n.promoted21 = load i32, ptr %n, align 4, !tbaa !5
%cmp223 = icmp sgt i32 %n.promoted21, 0
br i1 %cmp223, label %for.cond3.preheader.preheader, label %while.end
for.cond3.preheader.preheader: ; preds = %entry
%.pre = load i32, ptr %page, align 16, !tbaa !5
%0 = load i32, ptr %add.ptr.1, align 4
%1 = load i32, ptr %add.ptr.2, align 8
%2 = load i32, ptr %add.ptr.3, align 4
%3 = load i32, ptr %add.ptr.4, align 16
%4 = load i32, ptr %add.ptr.5, align 4
%5 = load i32, ptr %add.ptr.6, align 8
br label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.inc7.5, %for.cond3.preheader.preheader
%sub.lcssa2224 = phi i32 [ %n.promoted21, %for.cond3.preheader.preheader ], [ %sub.6, %for.inc7.5 ]
%sub = sub nsw i32 %sub.lcssa2224, %.pre
%cmp6 = icmp slt i32 %sub, 1
br i1 %cmp6, label %while.cond.while.end_crit_edge, label %for.inc7
for.inc7: ; preds = %for.cond3.preheader
%sub.1 = sub nsw i32 %sub, %0
%cmp6.1 = icmp slt i32 %sub.1, 1
br i1 %cmp6.1, label %while.cond.while.end_crit_edge, label %for.inc7.1
for.inc7.1: ; preds = %for.inc7
%sub.2 = sub nsw i32 %sub.1, %1
%cmp6.2 = icmp slt i32 %sub.2, 1
br i1 %cmp6.2, label %while.cond.while.end_crit_edge, label %for.inc7.2
for.inc7.2: ; preds = %for.inc7.1
%sub.3 = sub nsw i32 %sub.2, %2
%cmp6.3 = icmp slt i32 %sub.3, 1
br i1 %cmp6.3, label %while.cond.while.end_crit_edge, label %for.inc7.3
for.inc7.3: ; preds = %for.inc7.2
%sub.4 = sub nsw i32 %sub.3, %3
%cmp6.4 = icmp slt i32 %sub.4, 1
br i1 %cmp6.4, label %while.cond.while.end_crit_edge, label %for.inc7.4
for.inc7.4: ; preds = %for.inc7.3
%sub.5 = sub nsw i32 %sub.4, %4
%cmp6.5 = icmp slt i32 %sub.5, 1
br i1 %cmp6.5, label %while.cond.while.end_crit_edge, label %for.inc7.5
for.inc7.5: ; preds = %for.inc7.4
%sub.6 = sub nsw i32 %sub.5, %5
%cmp6.6 = icmp slt i32 %sub.6, 1
br i1 %cmp6.6, label %while.cond.while.end_crit_edge, label %for.cond3.preheader, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %for.cond3.preheader, %for.inc7, %for.inc7.1, %for.inc7.2, %for.inc7.3, %for.inc7.4, %for.inc7.5
%sub.lcssa.ph = phi i32 [ %sub.6, %for.inc7.5 ], [ %sub.5, %for.inc7.4 ], [ %sub.4, %for.inc7.3 ], [ %sub.3, %for.inc7.2 ], [ %sub.2, %for.inc7.1 ], [ %sub.1, %for.inc7 ], [ %sub, %for.cond3.preheader ]
%i.2.lcssa.ph = phi i32 [ 7, %for.inc7.5 ], [ 6, %for.inc7.4 ], [ 5, %for.inc7.3 ], [ 4, %for.inc7.2 ], [ 3, %for.inc7.1 ], [ 2, %for.inc7 ], [ 1, %for.cond3.preheader ]
store i32 %sub.lcssa.ph, ptr %n, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%i.1.lcssa = phi i32 [ %i.2.lcssa.ph, %while.cond.while.end_crit_edge ], [ 8, %entry ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.1.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %page) #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, j;
while (1) {
int h, w;
scanf("%d %d", &h, &w);
if (h == 0 && w == 0) {
break;
}
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
printf("#");
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289307/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289307/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call25 = 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
%cmp26 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp127 = icmp eq i32 %1, 0
%or.cond28 = select i1 %cmp26, i1 %cmp127, i1 false
br i1 %or.cond28, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %cleanup
%2 = phi i32 [ %6, %cleanup ], [ %0, %entry ]
%cmp223 = icmp sgt i32 %2, 0
br i1 %cmp223, label %for.cond3.preheader, label %cleanup
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.024 = phi i32 [ %inc9, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp421 = icmp sgt i32 %3, 0
br i1 %cmp421, label %for.body5, label %for.end
for.body5: ; preds = %for.cond3.preheader, %for.body5
%j.022 = phi i32 [ %inc, %for.body5 ], [ 0, %for.cond3.preheader ]
%putchar18 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %j.022, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %4
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.cond3.preheader
%putchar17 = call i32 @putchar(i32 10)
%inc9 = add nuw nsw i32 %i.024, 1
%5 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc9, %5
br i1 %cmp2, label %for.cond3.preheader, label %cleanup, !llvm.loop !11
cleanup: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%6 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %6, 0
%7 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %7, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void){
int h,w,i,j;
while(1){
scanf("%d %d",&h,&w);
if(h==0&&w==0){
break;
}
else{
for(i=0;i<h;i++){
for(j=0;j<w;j++){
printf("#");
}
printf("\n");
}
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289350/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289350/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call20 = 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
%cmp21 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp122 = icmp eq i32 %1, 0
%or.cond23 = select i1 %cmp21, i1 %cmp122, i1 false
br i1 %or.cond23, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end10
%2 = phi i32 [ %6, %for.end10 ], [ %0, %entry ]
%cmp218 = icmp sgt i32 %2, 0
br i1 %cmp218, label %for.cond3.preheader, label %for.end10
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.019 = phi i32 [ %inc9, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp416 = icmp sgt i32 %3, 0
br i1 %cmp416, label %for.body5, label %for.end
for.body5: ; preds = %for.cond3.preheader, %for.body5
%j.017 = phi i32 [ %inc, %for.body5 ], [ 0, %for.cond3.preheader ]
%putchar15 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %j.017, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %4
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.cond3.preheader
%putchar14 = call i32 @putchar(i32 10)
%inc9 = add nuw nsw i32 %i.019, 1
%5 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc9, %5
br i1 %cmp2, label %for.cond3.preheader, label %for.end10, !llvm.loop !11
for.end10: ; 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)
%6 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %6, 0
%7 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %7, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end10, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void)
{
int h, w, i, j;
while (scanf ("%d %d", &h, &w), h != 0 || w != 0){
for (i = 0; i < h; i++){
for (j = 0; j < w; j++){
printf("#");
}
printf("\n");
}
printf("\n");
}
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289408/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289408/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call20 = 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
%cmp21 = icmp ne i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp122 = icmp ne i32 %1, 0
%2 = select i1 %cmp21, i1 true, i1 %cmp122
br i1 %2, label %for.cond.preheader, label %while.end
for.cond.preheader: ; preds = %entry, %for.end10
%3 = phi i32 [ %7, %for.end10 ], [ %0, %entry ]
%cmp218 = icmp sgt i32 %3, 0
br i1 %cmp218, label %for.cond3.preheader, label %for.end10
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.019 = phi i32 [ %inc9, %for.end ], [ 0, %for.cond.preheader ]
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp416 = icmp sgt i32 %4, 0
br i1 %cmp416, label %for.body5, label %for.end
for.body5: ; preds = %for.cond3.preheader, %for.body5
%j.017 = phi i32 [ %inc, %for.body5 ], [ 0, %for.cond3.preheader ]
%putchar15 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %j.017, 1
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %5
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.cond3.preheader
%putchar14 = call i32 @putchar(i32 10)
%inc9 = add nuw nsw i32 %i.019, 1
%6 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc9, %6
br i1 %cmp2, label %for.cond3.preheader, label %for.end10, !llvm.loop !11
for.end10: ; 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)
%7 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp ne i32 %7, 0
%8 = load i32, ptr %w, align 4
%cmp1 = icmp ne i32 %8, 0
%9 = select i1 %cmp, i1 true, i1 %cmp1
br i1 %9, label %for.cond.preheader, label %while.end, !llvm.loop !12
while.end: ; preds = %for.end10, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main( ) {
int height;
int width;
int i,j;
while( 1 ) {
scanf("%d %d" ,&height ,&width );
if( height == 0 && width == 0) {
break;
}
for( i = 0; i < height; i++ ) {
for( j = 0; j < width; j++ ) {
printf("#");
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289459/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289459/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%height = alloca i32, align 4
%width = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %height) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %width) #4
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %height, ptr noundef nonnull %width)
%0 = load i32, ptr %height, align 4, !tbaa !5
%cmp21 = icmp eq i32 %0, 0
%1 = load i32, ptr %width, align 4
%cmp122 = icmp eq i32 %1, 0
%or.cond23 = select i1 %cmp21, i1 %cmp122, i1 false
br i1 %or.cond23, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end10
%2 = phi i32 [ %6, %for.end10 ], [ %0, %entry ]
%cmp218 = icmp sgt i32 %2, 0
br i1 %cmp218, label %for.cond3.preheader, label %for.end10
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.019 = phi i32 [ %inc9, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %width, align 4, !tbaa !5
%cmp416 = icmp sgt i32 %3, 0
br i1 %cmp416, label %for.body5, label %for.end
for.body5: ; preds = %for.cond3.preheader, %for.body5
%j.017 = phi i32 [ %inc, %for.body5 ], [ 0, %for.cond3.preheader ]
%putchar15 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %j.017, 1
%4 = load i32, ptr %width, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %4
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.cond3.preheader
%putchar14 = call i32 @putchar(i32 10)
%inc9 = add nuw nsw i32 %i.019, 1
%5 = load i32, ptr %height, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc9, %5
br i1 %cmp2, label %for.cond3.preheader, label %for.end10, !llvm.loop !11
for.end10: ; 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 %height, ptr noundef nonnull %width)
%6 = load i32, ptr %height, align 4, !tbaa !5
%cmp = icmp eq i32 %6, 0
%7 = load i32, ptr %width, align 4
%cmp1 = icmp eq i32 %7, 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.end10, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %width) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %height) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(){
int i,j,H,W;
for ( i = 1; ; i++ ){
scanf("%d %d",&H,&W);
if (H == 0 && W == 0) break;
for ( i = 0; i < H; i++ ){
for ( j = 0; j < W; j++ ){
printf("#");
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289501/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289501/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call25 = 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
%cmp26 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp127 = icmp eq i32 %1, 0
%or.cond28 = select i1 %cmp26, i1 %cmp127, i1 false
br i1 %or.cond28, label %for.end15, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %for.end11
%2 = phi i32 [ %6, %for.end11 ], [ %0, %entry ]
%cmp323 = icmp sgt i32 %2, 0
br i1 %cmp323, label %for.cond4.preheader, label %for.end11
for.cond4.preheader: ; preds = %for.cond2.preheader, %for.end
%i.024 = phi i32 [ %inc10, %for.end ], [ 0, %for.cond2.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp521 = icmp sgt i32 %3, 0
br i1 %cmp521, label %for.body6, label %for.end
for.body6: ; preds = %for.cond4.preheader, %for.body6
%j.022 = phi i32 [ %inc, %for.body6 ], [ 0, %for.cond4.preheader ]
%putchar20 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %j.022, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp5 = icmp slt i32 %inc, %4
br i1 %cmp5, label %for.body6, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body6, %for.cond4.preheader
%putchar19 = call i32 @putchar(i32 10)
%inc10 = add nuw nsw i32 %i.024, 1
%5 = load i32, ptr %H, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc10, %5
br i1 %cmp3, label %for.cond4.preheader, label %for.end11, !llvm.loop !11
for.end11: ; preds = %for.end, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%6 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %6, 0
%7 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %7, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %for.end15, label %for.cond2.preheader
for.end15: ; preds = %for.end11, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
int h,w,i,j;
while(1){
scanf("%d %d",&h,&w);
if(h==0 && w==0) break;
for(i=0;i < h;i++){
for(j=0;j < w;j++){
printf("#");
}
puts("");
}
puts("");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289552/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289552/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call20 = 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
%cmp21 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp122 = icmp eq i32 %1, 0
%or.cond23 = select i1 %cmp21, i1 %cmp122, i1 false
br i1 %or.cond23, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end10
%2 = phi i32 [ %6, %for.end10 ], [ %0, %entry ]
%cmp218 = icmp sgt i32 %2, 0
br i1 %cmp218, label %for.cond3.preheader, label %for.end10
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.019 = phi i32 [ %inc9, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp416 = icmp sgt i32 %3, 0
br i1 %cmp416, label %for.body5, label %for.end
for.body5: ; preds = %for.cond3.preheader, %for.body5
%j.017 = phi i32 [ %inc, %for.body5 ], [ 0, %for.cond3.preheader ]
%putchar15 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %j.017, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %4
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.cond3.preheader
%putchar14 = call i32 @putchar(i32 10)
%inc9 = add nuw nsw i32 %i.019, 1
%5 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc9, %5
br i1 %cmp2, label %for.cond3.preheader, label %for.end10, !llvm.loop !11
for.end10: ; 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)
%6 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %6, 0
%7 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %7, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end10, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main()
{
int T,n,i;char a[100007];
int last;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);getchar();
scanf("%s",a);
for(i=0,last=0;i<n;i++)
{
if(a[i]=='1')
{
if(last==0){printf("1");last=2;continue;}
if(last==1){printf("1");last=2;continue;}
if(last==2){printf("0");last=1;continue;}
}
if(a[i]=='0')
{
if(last==0){printf("1");last=1;continue;}
if(last==1){printf("0");last=0;continue;}
if(last==2){printf("1");last=1;continue;}
}
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28961/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28961/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%T = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca [100007 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 100007, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T)
%0 = load i32, ptr %T, align 4, !tbaa !5
%dec61 = add nsw i32 %0, -1
store i32 %dec61, ptr %T, align 4, !tbaa !5
%tobool.not62 = icmp eq i32 %0, 0
br i1 %tobool.not62, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i = call i32 @getc(ptr noundef %1)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp58 = icmp sgt i32 %2, 0
br i1 %cmp58, label %for.body, label %for.end
for.body: ; preds = %while.body, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %while.body ]
%last.060 = phi i32 [ %last.1, %for.inc ], [ 0, %while.body ]
%arrayidx = getelementptr inbounds [100007 x i8], ptr %a, i64 0, i64 %indvars.iv
%3 = load i8, ptr %arrayidx, align 1, !tbaa !11
switch i8 %3, label %for.inc [
i8 49, label %if.then
i8 48, label %if.then26
]
if.then: ; preds = %for.body
%switch = icmp ult i32 %last.060, 2
%spec.select = select i1 %switch, i32 49, i32 48
%spec.select64 = select i1 %switch, i32 2, i32 1
br label %for.inc.sink.split
if.then26: ; preds = %for.body
%cond = icmp ne i32 %last.060, 1
%spec.select65 = select i1 %cond, i32 49, i32 48
%spec.select66 = zext i1 %cond to i32
br label %for.inc.sink.split
for.inc.sink.split: ; preds = %if.then26, %if.then
%.sink = phi i32 [ %spec.select, %if.then ], [ %spec.select65, %if.then26 ]
%last.1.ph = phi i32 [ %spec.select64, %if.then ], [ %spec.select66, %if.then26 ]
%putchar52 = call i32 @putchar(i32 %.sink)
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %for.body
%last.1 = phi i32 [ %last.060, %for.body ], [ %last.1.ph, %for.inc.sink.split ]
%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 !12
for.end: ; preds = %for.inc, %while.body
%putchar = call i32 @putchar(i32 10)
%6 = load i32, ptr %T, align 4, !tbaa !5
%dec = add nsw i32 %6, -1
store i32 %dec, ptr %T, align 4, !tbaa !5
%tobool.not = icmp eq i32 %6, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 100007, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
|
#include <stdio.h>
int main(void) {
int h,w,h_cnt,w_cnt;
while(1)
{
scanf("%d %d",&h,&w);
if(h==0&&w==0)
break;
else
{
for(h_cnt=0;h_cnt<h;h_cnt++) {
for(w_cnt=0;w_cnt<w;w_cnt++) printf("#");
printf("\n");
}
printf("\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289660/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289660/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call20 = 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
%cmp21 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp122 = icmp eq i32 %1, 0
%or.cond23 = select i1 %cmp21, i1 %cmp122, i1 false
br i1 %or.cond23, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end10
%2 = phi i32 [ %6, %for.end10 ], [ %0, %entry ]
%cmp218 = icmp sgt i32 %2, 0
br i1 %cmp218, label %for.cond3.preheader, label %for.end10
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%h_cnt.019 = phi i32 [ %inc9, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp416 = icmp sgt i32 %3, 0
br i1 %cmp416, label %for.body5, label %for.end
for.body5: ; preds = %for.cond3.preheader, %for.body5
%w_cnt.017 = phi i32 [ %inc, %for.body5 ], [ 0, %for.cond3.preheader ]
%putchar15 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %w_cnt.017, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %4
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.cond3.preheader
%putchar14 = call i32 @putchar(i32 10)
%inc9 = add nuw nsw i32 %h_cnt.019, 1
%5 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc9, %5
br i1 %cmp2, label %for.cond3.preheader, label %for.end10, !llvm.loop !11
for.end10: ; 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)
%6 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %6, 0
%7 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %7, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end10, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(){
char a;
scanf("%c", &a);
if(a>=65&&a<97)printf("A");
else printf("a");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289710/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289710/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i8, ptr %a, align 1
%1 = add i8 %0, -65
%or.cond = icmp ult i8 %1, 32
%. = select i1 %or.cond, i32 65, i32 97
%putchar = call i32 @putchar(i32 %.)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(void){
char alphabet;
scanf("%c", &alphabet);
if(alphabet >= 'A' && alphabet <= 'Z'){
printf("A\n");
}
else if(alphabet >= 'a' && alphabet <= 'z'){
printf("a\n");
}
else{
printf("scan alphabet only\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289754/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289754/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@str = private unnamed_addr constant [19 x i8] c"scan alphabet only\00", align 1
@str.4 = private unnamed_addr constant [2 x i8] c"a\00", align 1
@str.5 = private unnamed_addr constant [2 x i8] c"A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%alphabet = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %alphabet) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %alphabet)
%0 = load i8, ptr %alphabet, align 1
%1 = add i8 %0, -65
%or.cond = icmp ult i8 %1, 26
%2 = add i8 %0, -97
%or.cond18 = icmp ult i8 %2, 26
%str.4.str = select i1 %or.cond18, ptr @str.4, ptr @str
%str.4.sink = select i1 %or.cond, ptr @str.5, ptr %str.4.str
%puts19 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %alphabet) #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>
int main()
{
char a;
scanf("%c",&a);
if(a>=65 && a<=90)
{
printf("A\n");
}
else
{
printf("a\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289798/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289798/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@str = private unnamed_addr constant [2 x i8] c"a\00", align 1
@str.3 = private unnamed_addr constant [2 x i8] c"A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i8, ptr %a, align 1
%1 = add i8 %0, -65
%or.cond = icmp ult i8 %1, 26
%str.3.str = select i1 %or.cond, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(){
char a;
scanf("%c", &a);
if(a >= 'a' && a <= 'z') puts("a");
else puts("A");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289848/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289848/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"a\00", align 1
@.str.2 = private unnamed_addr constant [2 x i8] c"A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i8, ptr %a, align 1
%1 = add i8 %0, -97
%or.cond = icmp ult i8 %1, 26
%.str.1..str.2 = select i1 %or.cond, ptr @.str.1, ptr @.str.2
%call6 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
int main()
{
char a;
scanf("%c",&a);
if(a<123 && a>96) printf("a");
else if (a<91 && a>64) printf("A");
else printf(" ");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_289891/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_289891/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i8, ptr %a, align 1
%1 = add i8 %0, -97
%or.cond = icmp ult i8 %1, 26
%2 = add i8 %0, -65
%or.cond18 = icmp ult i8 %2, 26
%. = select i1 %or.cond18, i32 65, i32 32
%.sink = select i1 %or.cond, i32 97, i32 %.
%putchar19 = call i32 @putchar(i32 %.sink)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.