Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#define ll long long
long long min(long long a, long long b){
if(a < b) return a;
else return b;
}
long long max(long long a, long long b){
if(a < b) return b;
else return a;
}
int main(){
int n,k;
scanf("%d",&n);
char s[101];
scanf("%s",s);
k=strlen(s);
if(n>=k){
printf("%s",s);
}
else{
for(int i=0;i<n;i++){
printf("%c",s[i]);
}
printf("...");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217076/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217076/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"...\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%b.a = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %b.a
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%s = alloca [101 x i8], align 16
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)
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #7
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #8
%conv = trunc i64 %call3 to i32
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not = icmp slt i32 %0, %conv
br i1 %cmp.not, label %for.cond.preheader, label %if.then
for.cond.preheader: ; preds = %entry
%cmp714 = icmp sgt i32 %0, 0
br i1 %cmp714, label %for.body, label %for.cond.cleanup
if.then: ; preds = %entry
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %s)
br label %if.end
for.cond.cleanup: ; preds = %for.body, %for.cond.preheader
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
br label %if.end
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%conv9 = sext i8 %1 to i32
%putchar = call i32 @putchar(i32 %conv9)
%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
%cmp7 = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp7, label %for.body, label %for.cond.cleanup, !llvm.loop !10
if.end: ; preds = %for.cond.cleanup, %if.then
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #6
attributes #0 = { 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 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
char t[99];
double s[99],v;
int p=0,f,c;
while(1){
c=scanf("%[^ \n]",t);
if(c==-1)
return 0;
if(c==0)
return 1;
f=0;
if(t[1]==0) {
if(t[0]=='+')
s[p-2]+=s[p-1],p--;
else if(t[0]=='-')
s[p-2]-=s[p-1],p--;
else if(t[0]=='*')
s[p-2]*=s[p-1],p--;
else if(t[0]=='/')
s[p-2]/=s[p-1],p--;
else
f=1;
} else
f=1;
if(f) {
if(sscanf(t,"%lf",&v)==-1)
return 1;
s[p++]=v;
}
c=getchar();
if(c=='\n')
printf("%f\n",s[--p]+0.);
else if(c==' ')
;
else
return 1;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217133/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217133/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%[^ \0A]\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
@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 [99 x i8], align 16
%s = alloca [99 x double], align 16
%v = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 99, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 792, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %v) #3
%arrayidx = getelementptr inbounds [99 x i8], ptr %t, i64 0, i64 1
br label %while.cond
while.cond: ; preds = %while.cond.backedge, %entry
%p.0 = phi i32 [ 0, %entry ], [ %p.0.be, %while.cond.backedge ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
switch i32 %call, label %if.end3 [
i32 -1, label %cleanup.loopexit
i32 0, label %cleanup
]
if.end3: ; preds = %while.cond
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp4 = icmp eq i8 %0, 0
br i1 %cmp4, label %if.then6, label %if.then62
if.then6: ; preds = %if.end3
%1 = load i8, ptr %t, align 16, !tbaa !5
switch i8 %1, label %if.then62 [
i8 43, label %if.then11
i8 45, label %if.then20
i8 42, label %if.then34
i8 47, label %if.then47
]
if.then11: ; preds = %if.then6
%sub = add nsw i32 %p.0, -1
%idxprom = sext i32 %sub to i64
%arrayidx12 = getelementptr inbounds [99 x double], ptr %s, i64 0, i64 %idxprom
%2 = load double, ptr %arrayidx12, align 8, !tbaa !8
%sub13 = add nsw i32 %p.0, -2
%idxprom14 = sext i32 %sub13 to i64
%arrayidx15 = getelementptr inbounds [99 x double], ptr %s, i64 0, i64 %idxprom14
%3 = load double, ptr %arrayidx15, align 8, !tbaa !8
%add = fadd double %2, %3
store double %add, ptr %arrayidx15, align 8, !tbaa !8
br label %if.end71
if.then20: ; preds = %if.then6
%sub21 = add nsw i32 %p.0, -1
%idxprom22 = sext i32 %sub21 to i64
%arrayidx23 = getelementptr inbounds [99 x double], ptr %s, i64 0, i64 %idxprom22
%4 = load double, ptr %arrayidx23, align 8, !tbaa !8
%sub24 = add nsw i32 %p.0, -2
%idxprom25 = sext i32 %sub24 to i64
%arrayidx26 = getelementptr inbounds [99 x double], ptr %s, i64 0, i64 %idxprom25
%5 = load double, ptr %arrayidx26, align 8, !tbaa !8
%sub27 = fsub double %5, %4
store double %sub27, ptr %arrayidx26, align 8, !tbaa !8
br label %if.end71
if.then34: ; preds = %if.then6
%sub35 = add nsw i32 %p.0, -1
%idxprom36 = sext i32 %sub35 to i64
%arrayidx37 = getelementptr inbounds [99 x double], ptr %s, i64 0, i64 %idxprom36
%6 = load double, ptr %arrayidx37, align 8, !tbaa !8
%sub38 = add nsw i32 %p.0, -2
%idxprom39 = sext i32 %sub38 to i64
%arrayidx40 = getelementptr inbounds [99 x double], ptr %s, i64 0, i64 %idxprom39
%7 = load double, ptr %arrayidx40, align 8, !tbaa !8
%mul = fmul double %6, %7
store double %mul, ptr %arrayidx40, align 8, !tbaa !8
br label %if.end71
if.then47: ; preds = %if.then6
%sub48 = add nsw i32 %p.0, -1
%idxprom49 = sext i32 %sub48 to i64
%arrayidx50 = getelementptr inbounds [99 x double], ptr %s, i64 0, i64 %idxprom49
%8 = load double, ptr %arrayidx50, align 8, !tbaa !8
%sub51 = add nsw i32 %p.0, -2
%idxprom52 = sext i32 %sub51 to i64
%arrayidx53 = getelementptr inbounds [99 x double], ptr %s, i64 0, i64 %idxprom52
%9 = load double, ptr %arrayidx53, align 8, !tbaa !8
%div = fdiv double %9, %8
store double %div, ptr %arrayidx53, align 8, !tbaa !8
br label %if.end71
if.then62: ; preds = %if.then6, %if.end3
%call64 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %t, ptr noundef nonnull @.str.1, ptr noundef nonnull %v) #3
%cmp65 = icmp eq i32 %call64, -1
br i1 %cmp65, label %cleanup.loopexit, label %if.end68
if.end68: ; preds = %if.then62
%10 = load double, ptr %v, align 8, !tbaa !8
%inc = add nsw i32 %p.0, 1
%idxprom69 = sext i32 %p.0 to i64
%arrayidx70 = getelementptr inbounds [99 x double], ptr %s, i64 0, i64 %idxprom69
store double %10, ptr %arrayidx70, align 8, !tbaa !8
br label %if.end71
if.end71: ; preds = %if.then47, %if.then34, %if.then20, %if.then11, %if.end68
%11 = phi double [ %10, %if.end68 ], [ %div, %if.then47 ], [ %mul, %if.then34 ], [ %sub27, %if.then20 ], [ %add, %if.then11 ]
%p.2 = phi i32 [ %inc, %if.end68 ], [ %sub48, %if.then47 ], [ %sub35, %if.then34 ], [ %sub21, %if.then20 ], [ %sub, %if.then11 ]
%12 = load ptr, ptr @stdin, align 8, !tbaa !10
%call.i = call i32 @getc(ptr noundef %12)
switch i32 %call.i, label %cleanup.loopexit [
i32 10, label %if.then75
i32 32, label %while.cond.backedge
]
while.cond.backedge: ; preds = %if.end71, %if.then75
%p.0.be = phi i32 [ %dec76, %if.then75 ], [ %p.2, %if.end71 ]
br label %while.cond
if.then75: ; preds = %if.end71
%dec76 = add nsw i32 %p.2, -1
%add79 = fadd double %11, 0.000000e+00
%call80 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %add79)
br label %while.cond.backedge
cleanup.loopexit: ; preds = %while.cond, %if.then62, %if.end71
%retval.0.ph = phi i32 [ 1, %if.end71 ], [ 1, %if.then62 ], [ 0, %while.cond ]
br label %cleanup
cleanup: ; preds = %while.cond, %cleanup.loopexit
%retval.0 = phi i32 [ %retval.0.ph, %cleanup.loopexit ], [ 1, %while.cond ]
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %v) #3
call void @llvm.lifetime.end.p0(i64 792, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 99, ptr nonnull %t) #3
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, 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 @getc(ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"double", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !6, i64 0}
|
#include<stdio.h>
#include<stdlib.h>
typedef struct range{
int l,r;
} range;
int cmp(const void *a,const void *b){
range *p=(range *)a;
range *q=(range *)b;
return (p->r-p->l)-(q->r-q->l);
}
void add(int *bit,int x,int v){
int n=bit[0];
for(int i=x;i<=n;i+=i&-i) bit[i]+=v;
}
int sum(int *bit,int x){
int res=0;
for(int i=x;i>0;i-=i&-i) res+=bit[i];
return res;
}
void run(void){
int n,m;
scanf("%d%d",&n,&m);
range *p=(range *)calloc(n,sizeof(range));
int i;
for(i=0;i<n;i++) scanf("%d%d",&p[i].l,&p[i].r);
qsort(p,n,sizeof(range),cmp);
int *bit=(int *)calloc(m+2,sizeof(int));
bit[0]=m+1;
int j=0;
for(i=1;i<=m;i++){
while(j<n && p[j].r-p[j].l+1<i){
add(bit,p[j].l,1);
add(bit,p[j].r+1,-1);
j++;
}
int cnt=n-j;
for(int k=i;k<=m;k+=i){
cnt+=sum(bit,k);
}
printf("%d\n",cnt);
}
}
int main(void){
run();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217212/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217212/source.c"
target datalayout = "e-m:e-p270: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.range = type { i32, i32 }
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%r = getelementptr inbounds %struct.range, ptr %a, i64 0, i32 1
%0 = load i32, ptr %r, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !10
%r1 = getelementptr inbounds %struct.range, ptr %b, i64 0, i32 1
%2 = load i32, ptr %r1, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !10
%4 = add i32 %1, %2
%sub = sub i32 %0, %4
%sub4 = add i32 %sub, %3
ret i32 %sub4
}
; 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 @add(ptr nocapture noundef %bit, i32 noundef %x, i32 noundef %v) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %bit, align 4, !tbaa !11
%cmp.not8 = icmp slt i32 %0, %x
br i1 %cmp.not8, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret void
for.body: ; preds = %entry, %for.body
%i.09 = phi i32 [ %add2, %for.body ], [ %x, %entry ]
%idxprom = sext i32 %i.09 to i64
%arrayidx1 = getelementptr inbounds i32, ptr %bit, i64 %idxprom
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !11
%add = add nsw i32 %1, %v
store i32 %add, ptr %arrayidx1, align 4, !tbaa !11
%sub = sub nsw i32 0, %i.09
%and = and i32 %i.09, %sub
%add2 = add nsw i32 %and, %i.09
%cmp.not = icmp sgt i32 %add2, %0
br i1 %cmp.not, label %for.cond.cleanup, label %for.body, !llvm.loop !12
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @sum(ptr nocapture noundef readonly %bit, i32 noundef %x) local_unnamed_addr #3 {
entry:
%cmp7 = icmp sgt i32 %x, 0
br i1 %cmp7, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%res.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
ret i32 %res.0.lcssa
for.body: ; preds = %entry, %for.body
%i.09 = phi i32 [ %sub1, %for.body ], [ %x, %entry ]
%res.08 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%idxprom = zext i32 %i.09 to i64
%arrayidx = getelementptr inbounds i32, ptr %bit, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !11
%add = add nsw i32 %0, %res.08
%sub.not = add nsw i32 %i.09, -1
%sub1 = and i32 %sub.not, %i.09
%cmp.not = icmp eq i32 %sub1, 0
br i1 %cmp.not, label %for.cond.cleanup, label %for.body, !llvm.loop !14
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !11
%conv = sext i32 %0 to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 8) #9
%cmp91 = icmp sgt i32 %0, 0
br i1 %cmp91, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.range, ptr %call1, i64 %indvars.iv
%r = getelementptr inbounds %struct.range, ptr %call1, i64 %indvars.iv, i32 1
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx, ptr noundef nonnull %r)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !11
%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 !15
for.end: ; preds = %for.body, %entry
%conv6.pre-phi = phi i64 [ %conv, %entry ], [ %2, %for.body ]
call void @qsort(ptr noundef %call1, i64 noundef %conv6.pre-phi, i64 noundef 8, ptr noundef nonnull @cmp) #8
%3 = load i32, ptr %m, align 4, !tbaa !11
%add = add nsw i32 %3, 2
%conv7 = sext i32 %add to i64
%call8 = call noalias ptr @calloc(i64 noundef %conv7, i64 noundef 4) #9
%add9 = add nsw i32 %3, 1
store i32 %add9, ptr %call8, align 4, !tbaa !11
%cmp12.not103 = icmp slt i32 %3, 1
br i1 %cmp12.not103, label %for.end47, label %while.cond.preheader
while.cond.preheader: ; preds = %for.end, %for.cond.cleanup
%4 = phi i32 [ %15, %for.cond.cleanup ], [ %3, %for.end ]
%j.0105 = phi i32 [ %j.1.lcssa, %for.cond.cleanup ], [ 0, %for.end ]
%i.1104 = phi i32 [ %inc46, %for.cond.cleanup ], [ 1, %for.end ]
%5 = load i32, ptr %n, align 4, !tbaa !11
%cmp1593 = icmp slt i32 %j.0105, %5
br i1 %cmp1593, label %land.rhs.preheader, label %while.end
land.rhs.preheader: ; preds = %while.cond.preheader
%6 = sext i32 %j.0105 to i64
%7 = sext i32 %5 to i64
br label %land.rhs
land.rhs: ; preds = %land.rhs.preheader, %add.exit84
%indvars.iv107 = phi i64 [ %6, %land.rhs.preheader ], [ %indvars.iv.next108, %add.exit84 ]
%arrayidx18 = getelementptr inbounds %struct.range, ptr %call1, i64 %indvars.iv107
%r19 = getelementptr inbounds %struct.range, ptr %call1, i64 %indvars.iv107, i32 1
%8 = load i32, ptr %r19, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx18, align 4, !tbaa !10
%sub = add i32 %8, 1
%add23 = sub i32 %sub, %9
%cmp24 = icmp slt i32 %add23, %i.1104
br i1 %cmp24, label %while.body, label %while.end.loopexit.split.loop.exit110
while.body: ; preds = %land.rhs
%10 = load i32, ptr %call8, align 4, !tbaa !11
%cmp.not8.i = icmp slt i32 %10, %9
br i1 %cmp.not8.i, label %add.exit, label %for.body.i
for.body.i: ; preds = %while.body, %for.body.i
%i.09.i = phi i32 [ %add2.i, %for.body.i ], [ %9, %while.body ]
%idxprom.i = sext i32 %i.09.i to i64
%arrayidx1.i = getelementptr inbounds i32, ptr %call8, i64 %idxprom.i
%11 = load i32, ptr %arrayidx1.i, align 4, !tbaa !11
%add.i = add nsw i32 %11, 1
store i32 %add.i, ptr %arrayidx1.i, align 4, !tbaa !11
%sub.i = sub nsw i32 0, %i.09.i
%and.i = and i32 %i.09.i, %sub.i
%add2.i = add nsw i32 %and.i, %i.09.i
%cmp.not.i = icmp sgt i32 %add2.i, %10
br i1 %cmp.not.i, label %add.exit.loopexit, label %for.body.i, !llvm.loop !12
add.exit.loopexit: ; preds = %for.body.i
%.pre = load i32, ptr %call8, align 4, !tbaa !11
br label %add.exit
add.exit: ; preds = %add.exit.loopexit, %while.body
%12 = phi i32 [ %.pre, %add.exit.loopexit ], [ %10, %while.body ]
%cmp.not8.i74.not = icmp sgt i32 %12, %8
br i1 %cmp.not8.i74.not, label %for.body.i75, label %add.exit84
for.body.i75: ; preds = %add.exit, %for.body.i75
%i.09.i76 = phi i32 [ %add2.i82, %for.body.i75 ], [ %sub, %add.exit ]
%idxprom.i77 = sext i32 %i.09.i76 to i64
%arrayidx1.i78 = getelementptr inbounds i32, ptr %call8, i64 %idxprom.i77
%13 = load i32, ptr %arrayidx1.i78, align 4, !tbaa !11
%add.i79 = add nsw i32 %13, -1
store i32 %add.i79, ptr %arrayidx1.i78, align 4, !tbaa !11
%sub.i80 = sub nsw i32 0, %i.09.i76
%and.i81 = and i32 %i.09.i76, %sub.i80
%add2.i82 = add nsw i32 %and.i81, %i.09.i76
%cmp.not.i83 = icmp sgt i32 %add2.i82, %12
br i1 %cmp.not.i83, label %add.exit84, label %for.body.i75, !llvm.loop !12
add.exit84: ; preds = %for.body.i75, %add.exit
%indvars.iv.next108 = add nsw i64 %indvars.iv107, 1
%exitcond.not = icmp eq i64 %indvars.iv.next108, %7
br i1 %exitcond.not, label %while.end, label %land.rhs, !llvm.loop !16
while.end.loopexit.split.loop.exit110: ; preds = %land.rhs
%14 = trunc i64 %indvars.iv107 to i32
br label %while.end
while.end: ; preds = %add.exit84, %while.end.loopexit.split.loop.exit110, %while.cond.preheader
%j.1.lcssa = phi i32 [ %j.0105, %while.cond.preheader ], [ %14, %while.end.loopexit.split.loop.exit110 ], [ %5, %add.exit84 ]
%sub34 = sub nsw i32 %5, %j.1.lcssa
%cmp36.not99 = icmp sgt i32 %i.1104, %4
br i1 %cmp36.not99, label %for.cond.cleanup, label %for.body.i85.preheader
for.body.i85.preheader: ; preds = %while.end, %sum.exit
%k.0101 = phi i32 [ %add42, %sum.exit ], [ %i.1104, %while.end ]
%cnt.0100 = phi i32 [ %add40, %sum.exit ], [ %sub34, %while.end ]
br label %for.body.i85
for.cond.cleanup: ; preds = %sum.exit, %while.end
%cnt.0.lcssa = phi i32 [ %sub34, %while.end ], [ %add40, %sum.exit ]
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
%inc46 = add nuw nsw i32 %i.1104, 1
%15 = load i32, ptr %m, align 4, !tbaa !11
%cmp12.not.not = icmp slt i32 %i.1104, %15
br i1 %cmp12.not.not, label %while.cond.preheader, label %for.end47, !llvm.loop !17
for.body.i85: ; preds = %for.body.i85.preheader, %for.body.i85
%i.09.i86 = phi i32 [ %sub1.i, %for.body.i85 ], [ %k.0101, %for.body.i85.preheader ]
%res.08.i = phi i32 [ %add.i88, %for.body.i85 ], [ 0, %for.body.i85.preheader ]
%idxprom.i87 = zext i32 %i.09.i86 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %call8, i64 %idxprom.i87
%16 = load i32, ptr %arrayidx.i, align 4, !tbaa !11
%add.i88 = add nsw i32 %16, %res.08.i
%sub.not.i = add nsw i32 %i.09.i86, -1
%sub1.i = and i32 %sub.not.i, %i.09.i86
%cmp.not.i89 = icmp eq i32 %sub1.i, 0
br i1 %cmp.not.i89, label %sum.exit, label %for.body.i85, !llvm.loop !14
sum.exit: ; preds = %for.body.i85
%add40 = add nsw i32 %add.i88, %cnt.0100
%add42 = add nuw nsw i32 %k.0101, %i.1104
%cmp36.not = icmp sgt i32 %add42, %4
br i1 %cmp36.not, label %for.cond.cleanup, label %for.body.i85.preheader, !llvm.loop !18
for.end47: ; preds = %for.cond.cleanup, %for.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret void
}
; 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,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #6
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
tail call void @run()
ret i32 0
}
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 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 norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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,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 #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0,1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 4}
!6 = !{!"range", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
|
#include <stdio.h>
int main(){
int H, W, i, j;
for(;;){
scanf("%d %d",&H ,&W);
if(H == 0 && W == 0)break ;
for ( i = 0; i < H; i++ ){
for ( j = 0; j < W; j++ ){
if( ( i + j ) %2 == 0){
printf("#");
} else {
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217320/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217320/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call29 = 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
%cmp30 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp131 = icmp eq i32 %1, 0
%or.cond32 = select i1 %cmp30, i1 %cmp131, i1 false
br i1 %or.cond32, label %for.end17, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %for.end15
%2 = phi i32 [ %6, %for.end15 ], [ %0, %entry ]
%cmp327 = icmp sgt i32 %2, 0
br i1 %cmp327, label %for.cond4.preheader, label %for.end15
for.cond4.preheader: ; preds = %for.cond2.preheader, %for.end
%i.028 = phi i32 [ %inc14, %for.end ], [ 0, %for.cond2.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp525 = icmp sgt i32 %3, 0
br i1 %cmp525, label %for.body6, label %for.end
for.body6: ; preds = %for.cond4.preheader, %for.body6
%j.026 = phi i32 [ %inc, %for.body6 ], [ 0, %for.cond4.preheader ]
%add = add nuw nsw i32 %j.026, %i.028
%rem = and i32 %add, 1
%cmp7 = icmp eq i32 %rem, 0
%. = select i1 %cmp7, i32 35, i32 46
%putchar24 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.026, 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
%putchar22 = call i32 @putchar(i32 10)
%inc14 = add nuw nsw i32 %i.028, 1
%5 = load i32, ptr %H, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc14, %5
br i1 %cmp3, label %for.cond4.preheader, label %for.end15, !llvm.loop !11
for.end15: ; 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.end17, label %for.cond2.preheader
for.end17: ; preds = %for.end15, %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){
//数値を2つ入力
scanf("%d %d", &H, &W);
//2つの数値が0なら終了
if(H == 0 && W == 0){
break;
}
//チェック柄の四角形を出力
for(i = 0; i < H; i++){
for(j = 0; j < W; j++){
if((i % 2) == 0){
if((j % 2) == 0 && j == (W - 1)){
printf("#\n");
}else if((j % 2) == 1 && j == (W - 1)){
printf(".\n");
}else if((j % 2) == 1){
printf(".");
}else{
printf("#");
}
}else{
if((j % 2) == 0 && j == (W - 1)){
printf(".\n");
}else if((j % 2) == 1 && j == (W - 1)){
printf("#\n");
}else if((j % 2) == 1){
printf("#");
}else{
printf(".");
}
}
}
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217364/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217364/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.7 = private unnamed_addr constant [2 x i8] c".\00", align 1
@str.8 = private unnamed_addr constant [2 x i8] c"#\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call88 = 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
%cmp89 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp190 = icmp eq i32 %1, 0
%or.cond91 = select i1 %cmp89, i1 %cmp190, i1 false
br i1 %or.cond91, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end60
%2 = phi i32 [ %13, %for.end60 ], [ %1, %entry ]
%3 = phi i32 [ %12, %for.end60 ], [ %0, %entry ]
%cmp286 = icmp sgt i32 %3, 0
%4 = icmp sgt i32 %2, 0
%or.cond96 = select i1 %cmp286, i1 %4, i1 false
br i1 %or.cond96, label %for.cond3.preheader, label %for.end60
for.cond3.preheader: ; preds = %for.cond.preheader, %for.inc58
%5 = phi i32 [ %10, %for.inc58 ], [ %2, %for.cond.preheader ]
%i.087 = phi i32 [ %inc59, %for.inc58 ], [ 0, %for.cond.preheader ]
%cmp484 = icmp sgt i32 %5, 0
br i1 %cmp484, label %for.body5.lr.ph, label %for.inc58
for.body5.lr.ph: ; preds = %for.cond3.preheader
%rem = and i32 %i.087, 1
%cmp6 = icmp eq i32 %rem, 0
br i1 %cmp6, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.inc.us
%6 = phi i32 [ %7, %for.inc.us ], [ %5, %for.body5.lr.ph ]
%j.085.us = phi i32 [ %inc.us, %for.inc.us ], [ 0, %for.body5.lr.ph ]
%rem8.us = and i32 %j.085.us, 1
%cmp9.us = icmp eq i32 %rem8.us, 0
%sub.us = add nsw i32 %6, -1
%cmp11.us = icmp eq i32 %j.085.us, %sub.us
%or.cond82.us = select i1 %cmp9.us, i1 %cmp11.us, i1 false
br i1 %or.cond82.us, label %if.then12.us, label %if.else.us
if.else.us: ; preds = %for.body5.us
br i1 %cmp9.us, label %if.else26.us, label %land.lhs.true16.us
land.lhs.true16.us: ; preds = %if.else.us
br i1 %cmp11.us, label %if.then19.us, label %if.then24.us
if.then24.us: ; preds = %land.lhs.true16.us
%putchar79.us = call i32 @putchar(i32 46)
br label %for.inc.us
if.then19.us: ; preds = %land.lhs.true16.us
%puts80.us = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
br label %for.inc.us
if.else26.us: ; preds = %if.else.us
%putchar78.us = call i32 @putchar(i32 35)
br label %for.inc.us
if.then12.us: ; preds = %for.body5.us
%puts81.us = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
br label %for.inc.us
for.inc.us: ; preds = %if.then12.us, %if.else26.us, %if.then19.us, %if.then24.us
%inc.us = add nuw nsw i32 %j.085.us, 1
%7 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %7
br i1 %cmp4.us, label %for.body5.us, label %for.inc58, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.inc
%8 = phi i32 [ %9, %for.inc ], [ %5, %for.body5.lr.ph ]
%j.085 = phi i32 [ %inc, %for.inc ], [ 0, %for.body5.lr.ph ]
%rem32 = and i32 %j.085, 1
%cmp33 = icmp eq i32 %rem32, 0
%sub35 = add nsw i32 %8, -1
%cmp36 = icmp eq i32 %j.085, %sub35
%or.cond83 = select i1 %cmp33, i1 %cmp36, i1 false
br i1 %or.cond83, label %if.then37, label %if.else39
if.then37: ; preds = %for.body5
%puts77 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
br label %for.inc
if.else39: ; preds = %for.body5
br i1 %cmp33, label %if.else52, label %land.lhs.true42
land.lhs.true42: ; preds = %if.else39
br i1 %cmp36, label %if.then45, label %if.then50
if.then45: ; preds = %land.lhs.true42
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
br label %for.inc
if.then50: ; preds = %land.lhs.true42
%putchar76 = call i32 @putchar(i32 35)
br label %for.inc
if.else52: ; preds = %if.else39
%putchar75 = call i32 @putchar(i32 46)
br label %for.inc
for.inc: ; preds = %if.then45, %if.else52, %if.then50, %if.then37
%inc = add nuw nsw i32 %j.085, 1
%9 = load i32, ptr %W, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %9
br i1 %cmp4, label %for.body5, label %for.inc58, !llvm.loop !9
for.inc58: ; preds = %for.inc, %for.inc.us, %for.cond3.preheader
%10 = phi i32 [ %5, %for.cond3.preheader ], [ %7, %for.inc.us ], [ %9, %for.inc ]
%inc59 = add nuw nsw i32 %i.087, 1
%11 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc59, %11
br i1 %cmp2, label %for.cond3.preheader, label %for.end60, !llvm.loop !11
for.end60: ; preds = %for.inc58, %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)
%12 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %12, 0
%13 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %13, 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.end60, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
|
#include<stdio.h>
int main()
{
int H, W, i, j;
while(1){
scanf("%d %d", &H, &W);
if(H == 0 && W == 0){
break;
}
for(i=1 ; i <= H ; i++){
for(j=1 ; j <= W ; j++){
if(i % 2 == 0){
if(j % 2 == 0){
printf("#");
}
else{
printf(".");
}
}
else{
if(j % 2 == 0){
printf(".");
}
else{
printf("#");
}
}
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217407/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217407/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call42 = 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
%cmp43 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp144 = icmp eq i32 %1, 0
%or.cond45 = select i1 %cmp43, i1 %cmp144, i1 false
br i1 %or.cond45, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end26
%2 = phi i32 [ %7, %for.end26 ], [ %0, %entry ]
%cmp2.not40 = icmp slt i32 %2, 1
br i1 %cmp2.not40, label %for.end26, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.041 = phi i32 [ %inc25, %for.end ], [ 1, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not38 = icmp slt i32 %3, 1
br i1 %cmp4.not38, label %for.end, label %for.body5.lr.ph
for.body5.lr.ph: ; preds = %for.cond3.preheader
%rem = and i32 %i.041, 1
%cmp6 = icmp eq i32 %rem, 0
br i1 %cmp6, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.039.us = phi i32 [ %inc.us, %for.body5.us ], [ 1, %for.body5.lr.ph ]
%rem8.us = and i32 %j.039.us, 1
%cmp9.us = icmp eq i32 %rem8.us, 0
%. = select i1 %cmp9.us, i32 35, i32 46
%putchar37.us = call i32 @putchar(i32 %.)
%inc.us = add nuw nsw i32 %j.039.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not.us.not = icmp slt i32 %j.039.us, %4
br i1 %cmp4.not.us.not, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%j.039 = phi i32 [ %inc, %for.body5 ], [ 1, %for.body5.lr.ph ]
%rem15 = and i32 %j.039, 1
%cmp16 = icmp eq i32 %rem15, 0
%.49 = select i1 %cmp16, i32 46, i32 35
%putchar34 = call i32 @putchar(i32 %.49)
%inc = add nuw nsw i32 %j.039, 1
%5 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not.not = icmp slt i32 %j.039, %5
br i1 %cmp4.not.not, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar33 = call i32 @putchar(i32 10)
%inc25 = add nuw nsw i32 %i.041, 1
%6 = load i32, ptr %H, align 4, !tbaa !5
%cmp2.not.not = icmp slt i32 %i.041, %6
br i1 %cmp2.not.not, label %for.cond3.preheader, label %for.end26, !llvm.loop !11
for.end26: ; 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 eq i32 %7, 0
%8 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %8, 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.end26, %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 W,H;
int i,j;
while(1){
scanf("%d %d", &H, &W);
if(H == 0 && W == 0){
break;
}
for(i =0;i<H;i++){
for(j=0;j<W;j++){
if((i + j) % 2 == 0){
printf("#");
}
else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217450/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217450/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%W = alloca i32, align 4
%H = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
%call27 = 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
%cmp28 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp129 = icmp eq i32 %1, 0
%or.cond30 = select i1 %cmp28, i1 %cmp129, i1 false
br i1 %or.cond30, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end14
%2 = phi i32 [ %6, %for.end14 ], [ %0, %entry ]
%cmp225 = icmp sgt i32 %2, 0
br i1 %cmp225, label %for.cond3.preheader, label %for.end14
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.026 = phi i32 [ %inc13, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp423 = icmp sgt i32 %3, 0
br i1 %cmp423, label %for.body5, label %for.end
for.body5: ; preds = %for.cond3.preheader, %for.body5
%j.024 = phi i32 [ %inc, %for.body5 ], [ 0, %for.cond3.preheader ]
%add = add nuw nsw i32 %j.024, %i.026
%rem = and i32 %add, 1
%cmp6 = icmp eq i32 %rem, 0
%. = select i1 %cmp6, i32 35, i32 46
%putchar22 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.024, 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
%putchar20 = call i32 @putchar(i32 10)
%inc13 = add nuw nsw i32 %i.026, 1
%5 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc13, %5
br i1 %cmp2, label %for.cond3.preheader, label %for.end14, !llvm.loop !11
for.end14: ; 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.end14, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void)
{
int H, W, i, j;
while (1) {
scanf("%d %d", &H, &W);
if (H == 0 && W == 0) {
break;
}
for (i = 0; i < H; i++) {
for (j = 0; j < W; j++) {
if ((i + j) % 2 == 0) {
printf("#");
} else {
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217500/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217500/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call27 = 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
%cmp28 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp129 = icmp eq i32 %1, 0
%or.cond30 = select i1 %cmp28, i1 %cmp129, i1 false
br i1 %or.cond30, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end14
%2 = phi i32 [ %6, %for.end14 ], [ %0, %entry ]
%cmp225 = icmp sgt i32 %2, 0
br i1 %cmp225, label %for.cond3.preheader, label %for.end14
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.026 = phi i32 [ %inc13, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp423 = icmp sgt i32 %3, 0
br i1 %cmp423, label %for.body5, label %for.end
for.body5: ; preds = %for.cond3.preheader, %for.body5
%j.024 = phi i32 [ %inc, %for.body5 ], [ 0, %for.cond3.preheader ]
%add = add nuw nsw i32 %j.024, %i.026
%rem = and i32 %add, 1
%cmp6 = icmp eq i32 %rem, 0
%. = select i1 %cmp6, i32 35, i32 46
%putchar22 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.024, 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
%putchar20 = call i32 @putchar(i32 10)
%inc13 = add nuw nsw i32 %i.026, 1
%5 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc13, %5
br i1 %cmp2, label %for.cond3.preheader, label %for.end14, !llvm.loop !11
for.end14: ; 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.end14, %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,a,b;
while(1){
scanf("%d %d",&H,&W);
if(H==0&&W==0){
break;
}
for(a=1;a<=H/2;a++){
for(b=1;b<=W/2;b++){
printf("#.");
}
if(W%2==0){
printf("\n");
}
else{
printf("#\n");
}
for(b=1;b<=W/2;b++){
printf(".#");
}
if(W%2==0){
printf("\n");
}
else{
printf(".\n");
}
}
if(H%2==0){
printf("\n");
}
else{
for(b=1;b<=W/2;b++){
printf("#.");
}
if(W%2==0){
printf("\n\n");
}
else{
printf("#\n\n");
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217544/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217544/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"#.\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c".#\00", align 1
@str = private unnamed_addr constant [3 x i8] c"#\0A\00", align 1
@str.8 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@str.9 = private unnamed_addr constant [2 x i8] c"#\00", align 1
@str.10 = private unnamed_addr constant [2 x i8] c".\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call81 = 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
%cmp82 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp183 = icmp eq i32 %1, 0
%or.cond84 = select i1 %cmp82, i1 %cmp183, i1 false
br i1 %or.cond84, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %if.end51
%2 = phi i32 [ %14, %if.end51 ], [ %0, %entry ]
%cmp2.not74 = icmp slt i32 %2, 2
br i1 %cmp2.not74, label %for.end30, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.cond.preheader, %for.inc28
%a.075 = phi i32 [ %inc29, %for.inc28 ], [ 1, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp5.not67 = icmp slt i32 %3, 2
br i1 %cmp5.not67, label %for.end, label %for.body6
for.body6: ; preds = %for.cond3.preheader, %for.body6
%b.068 = phi i32 [ %inc, %for.body6 ], [ 1, %for.cond3.preheader ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
%inc = add nuw nsw i32 %b.068, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%div4 = sdiv i32 %4, 2
%cmp5.not.not = icmp slt i32 %b.068, %div4
br i1 %cmp5.not.not, label %for.body6, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body6, %for.cond3.preheader
%.lcssa = phi i32 [ %3, %for.cond3.preheader ], [ %4, %for.body6 ]
%5 = and i32 %.lcssa, 1
%cmp8 = icmp eq i32 %5, 0
br i1 %cmp8, label %if.then9, label %if.else
if.then9: ; preds = %for.end
%putchar60 = call i32 @putchar(i32 10)
br label %if.end12
if.else: ; preds = %for.end
%puts59 = call i32 @puts(ptr nonnull dereferenceable(1) @str.9)
br label %if.end12
if.end12: ; preds = %if.else, %if.then9
%6 = load i32, ptr %W, align 4, !tbaa !5
%cmp15.not70 = icmp slt i32 %6, 2
br i1 %cmp15.not70, label %for.end20, label %for.body16
for.body16: ; preds = %if.end12, %for.body16
%b.171 = phi i32 [ %inc19, %for.body16 ], [ 1, %if.end12 ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
%inc19 = add nuw nsw i32 %b.171, 1
%7 = load i32, ptr %W, align 4, !tbaa !5
%div14 = sdiv i32 %7, 2
%cmp15.not.not = icmp slt i32 %b.171, %div14
br i1 %cmp15.not.not, label %for.body16, label %for.end20, !llvm.loop !11
for.end20: ; preds = %for.body16, %if.end12
%.lcssa63 = phi i32 [ %6, %if.end12 ], [ %7, %for.body16 ]
%8 = and i32 %.lcssa63, 1
%cmp22 = icmp eq i32 %8, 0
br i1 %cmp22, label %if.then23, label %if.else25
if.then23: ; preds = %for.end20
%putchar62 = call i32 @putchar(i32 10)
br label %for.inc28
if.else25: ; preds = %for.end20
%puts61 = call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
br label %for.inc28
for.inc28: ; preds = %if.then23, %if.else25
%inc29 = add nuw nsw i32 %a.075, 1
%9 = load i32, ptr %H, align 4, !tbaa !5
%div = sdiv i32 %9, 2
%cmp2.not.not = icmp slt i32 %a.075, %div
br i1 %cmp2.not.not, label %for.cond3.preheader, label %for.end30, !llvm.loop !12
for.end30: ; preds = %for.inc28, %for.cond.preheader
%.lcssa64 = phi i32 [ %2, %for.cond.preheader ], [ %9, %for.inc28 ]
%10 = and i32 %.lcssa64, 1
%cmp32 = icmp eq i32 %10, 0
br i1 %cmp32, label %if.then33, label %for.cond36.preheader
for.cond36.preheader: ; preds = %for.end30
%11 = load i32, ptr %W, align 4, !tbaa !5
%cmp38.not78 = icmp slt i32 %11, 2
br i1 %cmp38.not78, label %for.end43, label %for.body39
if.then33: ; preds = %for.end30
%putchar = call i32 @putchar(i32 10)
br label %if.end51
for.body39: ; preds = %for.cond36.preheader, %for.body39
%b.279 = phi i32 [ %inc42, %for.body39 ], [ 1, %for.cond36.preheader ]
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
%inc42 = add nuw nsw i32 %b.279, 1
%12 = load i32, ptr %W, align 4, !tbaa !5
%div37 = sdiv i32 %12, 2
%cmp38.not.not = icmp slt i32 %b.279, %div37
br i1 %cmp38.not.not, label %for.body39, label %for.end43, !llvm.loop !13
for.end43: ; preds = %for.body39, %for.cond36.preheader
%.lcssa65 = phi i32 [ %11, %for.cond36.preheader ], [ %12, %for.body39 ]
%13 = and i32 %.lcssa65, 1
%cmp45 = icmp eq i32 %13, 0
br i1 %cmp45, label %if.then46, label %if.else48
if.then46: ; preds = %for.end43
%puts58 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
br label %if.end51
if.else48: ; preds = %for.end43
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end51
if.end51: ; preds = %if.then46, %if.else48, %if.then33
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%14 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %14, 0
%15 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %15, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %if.end51, %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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main( void )
{
int H, W, H_Cou, W_Cou;
while(1)
{
scanf( "%d %d", &H, &W );
if( H == 0 && W == 0 )
{
break;
}
else
{
for( H_Cou = 0; H_Cou < H; H_Cou++ )
{
if( H_Cou % 2 == 0 )
{
for( W_Cou = 0; W_Cou < W; W_Cou++ )
{
if( W_Cou % 2 == 0 )
{
printf( "#" );
}
else
{
printf( "." );
}
}
}
else
{
for( W_Cou = 0; W_Cou < W; W_Cou++ )
{
if( W_Cou % 2 == 0 )
{
printf( "." );
}
else
{
printf( "#" );
}
}
}
printf( "\n" );
}
printf( "\n" );
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217588/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217588/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call54 = 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
%cmp55 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp156 = icmp eq i32 %1, 0
%or.cond57 = select i1 %cmp55, i1 %cmp156, i1 false
br i1 %or.cond57, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end32
%2 = phi i32 [ %7, %for.end32 ], [ %0, %entry ]
%cmp252 = icmp sgt i32 %2, 0
br i1 %cmp252, label %for.body, label %for.end32
for.body: ; preds = %for.cond.preheader, %if.end28
%H_Cou.053 = phi i32 [ %inc31, %if.end28 ], [ 0, %for.cond.preheader ]
%rem = and i32 %H_Cou.053, 1
%cmp3 = icmp eq i32 %rem, 0
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp650 = icmp sgt i32 %3, 0
br i1 %cmp3, label %for.cond5.preheader, label %for.cond15.preheader
for.cond15.preheader: ; preds = %for.body
br i1 %cmp650, label %for.body17, label %if.end28
for.cond5.preheader: ; preds = %for.body
br i1 %cmp650, label %for.body7, label %if.end28
for.body7: ; preds = %for.cond5.preheader, %for.body7
%W_Cou.051 = phi i32 [ %inc, %for.body7 ], [ 0, %for.cond5.preheader ]
%rem8 = and i32 %W_Cou.051, 1
%cmp9 = icmp eq i32 %rem8, 0
%. = select i1 %cmp9, i32 35, i32 46
%putchar46 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %W_Cou.051, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc, %4
br i1 %cmp6, label %for.body7, label %if.end28, !llvm.loop !9
for.body17: ; preds = %for.cond15.preheader, %for.body17
%W_Cou.149 = phi i32 [ %inc26, %for.body17 ], [ 0, %for.cond15.preheader ]
%rem18 = and i32 %W_Cou.149, 1
%cmp19 = icmp eq i32 %rem18, 0
%.61 = select i1 %cmp19, i32 46, i32 35
%putchar43 = call i32 @putchar(i32 %.61)
%inc26 = add nuw nsw i32 %W_Cou.149, 1
%5 = load i32, ptr %W, align 4, !tbaa !5
%cmp16 = icmp slt i32 %inc26, %5
br i1 %cmp16, label %for.body17, label %if.end28, !llvm.loop !11
if.end28: ; preds = %for.body17, %for.body7, %for.cond15.preheader, %for.cond5.preheader
%putchar44 = call i32 @putchar(i32 10)
%inc31 = add nuw nsw i32 %H_Cou.053, 1
%6 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc31, %6
br i1 %cmp2, label %for.body, label %for.end32, !llvm.loop !12
for.end32: ; preds = %if.end28, %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 eq i32 %7, 0
%8 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %8, 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.end32, %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>
#include <math.h>
int main(void){
int h,w,i,j;
while(scanf("%d %d",&h,&w)!=EOF){;
if(h==0 && w==0) break;
for(i=0;i<h;i++){
for(j=0;j<w;j++) printf("%c",(i+j)%2==0 ? '#' : '.');
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217638/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217638/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%cmp.not25 = icmp eq i32 %call24, -1
br i1 %cmp.not25, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end12
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp2 = icmp eq i32 %1, 0
%or.cond = select i1 %cmp1, i1 %cmp2, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %while.body
%cmp322 = icmp sgt i32 %0, 0
br i1 %cmp322, label %for.cond4.preheader, label %for.end12
for.cond4.preheader: ; preds = %for.cond.preheader, %for.end
%i.023 = phi i32 [ %inc11, %for.end ], [ 0, %for.cond.preheader ]
%2 = load i32, ptr %w, align 4, !tbaa !5
%cmp520 = icmp sgt i32 %2, 0
br i1 %cmp520, label %for.body6, label %for.end
for.body6: ; preds = %for.cond4.preheader, %for.body6
%j.021 = phi i32 [ %inc, %for.body6 ], [ 0, %for.cond4.preheader ]
%add = add nuw nsw i32 %j.021, %i.023
%rem = and i32 %add, 1
%cmp7 = icmp eq i32 %rem, 0
%cond = select i1 %cmp7, i32 35, i32 46
%putchar19 = call i32 @putchar(i32 %cond)
%inc = add nuw nsw i32 %j.021, 1
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp5 = icmp slt i32 %inc, %3
br i1 %cmp5, label %for.body6, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body6, %for.cond4.preheader
%putchar18 = call i32 @putchar(i32 10)
%inc11 = add nuw nsw i32 %i.023, 1
%4 = load i32, ptr %h, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc11, %4
br i1 %cmp3, label %for.cond4.preheader, label %for.end12, !llvm.loop !11
for.end12: ; 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)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %for.end12, %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void){
int H,W,i,j;
while(1){
scanf("%d %d",&H,&W);
if(H==0 && W==0) break;
for(i=0;i<H;i++){
if(i%2==0){
for(j=0;j<W;j++){
if(j%2==0){
printf("#");
}else{
printf(".");
}
}
printf("\n");
}else{
for(j=0;j<W;j++){
if(j%2==0){
printf(".");
}else{
printf("#");
}
}
printf("\n");
}
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217825/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217825/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call54 = 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
%cmp55 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp156 = icmp eq i32 %1, 0
%or.cond57 = select i1 %cmp55, i1 %cmp156, i1 false
br i1 %or.cond57, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end33
%2 = phi i32 [ %7, %for.end33 ], [ %0, %entry ]
%cmp252 = icmp sgt i32 %2, 0
br i1 %cmp252, label %for.body, label %for.end33
for.body: ; preds = %for.cond.preheader, %for.inc31
%i.053 = phi i32 [ %inc32, %for.inc31 ], [ 0, %for.cond.preheader ]
%rem = and i32 %i.053, 1
%cmp3 = icmp eq i32 %rem, 0
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp650 = icmp sgt i32 %3, 0
br i1 %cmp3, label %for.cond5.preheader, label %for.cond16.preheader
for.cond16.preheader: ; preds = %for.body
br i1 %cmp650, label %for.body18, label %for.inc31
for.cond5.preheader: ; preds = %for.body
br i1 %cmp650, label %for.body7, label %for.inc31
for.body7: ; preds = %for.cond5.preheader, %for.body7
%j.051 = phi i32 [ %inc, %for.body7 ], [ 0, %for.cond5.preheader ]
%rem8 = and i32 %j.051, 1
%cmp9 = icmp eq i32 %rem8, 0
%. = select i1 %cmp9, i32 35, i32 46
%putchar47 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.051, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc, %4
br i1 %cmp6, label %for.body7, label %for.inc31, !llvm.loop !9
for.body18: ; preds = %for.cond16.preheader, %for.body18
%j.149 = phi i32 [ %inc27, %for.body18 ], [ 0, %for.cond16.preheader ]
%rem19 = and i32 %j.149, 1
%cmp20 = icmp eq i32 %rem19, 0
%.59 = select i1 %cmp20, i32 46, i32 35
%putchar44 = call i32 @putchar(i32 %.59)
%inc27 = add nuw nsw i32 %j.149, 1
%5 = load i32, ptr %W, align 4, !tbaa !5
%cmp17 = icmp slt i32 %inc27, %5
br i1 %cmp17, label %for.body18, label %for.inc31, !llvm.loop !11
for.inc31: ; preds = %for.body18, %for.body7, %for.cond16.preheader, %for.cond5.preheader
%putchar45 = call i32 @putchar(i32 10)
%inc32 = add nuw nsw i32 %i.053, 1
%6 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc32, %6
br i1 %cmp2, label %for.body, label %for.end33, !llvm.loop !12
for.end33: ; preds = %for.inc31, %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 eq i32 %7, 0
%8 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %8, 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.end33, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void)
{
int H,W,i,j;
while(1){
scanf("%d %d",&H,&W);
if(H==0 && W==0)return 0;
for(i=1 ; i<=H ; i++){
for(j=1 ; j<=W ; j++){
if((i+j)%2==0)printf("#");
else printf(".");
}
printf("\n");
}
printf("\n");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217883/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217883/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call27 = 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
%cmp28 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp129 = icmp eq i32 %1, 0
%or.cond30 = select i1 %cmp28, i1 %cmp129, i1 false
br i1 %or.cond30, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end14
%2 = phi i32 [ %6, %for.end14 ], [ %0, %entry ]
%cmp2.not25 = icmp slt i32 %2, 1
br i1 %cmp2.not25, label %for.end14, label %for.cond3.preheader
if.then: ; preds = %for.end14, %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
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.026 = phi i32 [ %inc13, %for.end ], [ 1, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not23 = icmp slt i32 %3, 1
br i1 %cmp4.not23, label %for.end, label %for.body5
for.body5: ; preds = %for.cond3.preheader, %for.body5
%j.024 = phi i32 [ %inc, %for.body5 ], [ 1, %for.cond3.preheader ]
%add = add nuw nsw i32 %j.024, %i.026
%rem = and i32 %add, 1
%cmp6 = icmp eq i32 %rem, 0
%. = select i1 %cmp6, i32 35, i32 46
%putchar22 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.024, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not.not = icmp slt i32 %j.024, %4
br i1 %cmp4.not.not, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.cond3.preheader
%putchar20 = call i32 @putchar(i32 10)
%inc13 = add nuw nsw i32 %i.026, 1
%5 = load i32, ptr %H, align 4, !tbaa !5
%cmp2.not.not = icmp slt i32 %i.026, %5
br i1 %cmp2.not.not, label %for.cond3.preheader, label %for.end14, !llvm.loop !11
for.end14: ; 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 %if.then, label %for.cond.preheader
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(int argc, const char * argv[]) {
int a, b, H, W;
while(1){
scanf("%d %d",&H, &W);
if( H==0 && W==0)
break;
for(a=1; a<=H; a++){
for(b=1; b<=W; b++){
if((a+b)%2 == 0)
printf("#");
else
printf(".");
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217933/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217933/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%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
%call27 = 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
%cmp28 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp129 = icmp eq i32 %1, 0
%or.cond30 = select i1 %cmp28, i1 %cmp129, i1 false
br i1 %or.cond30, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end14
%2 = phi i32 [ %6, %for.end14 ], [ %0, %entry ]
%cmp2.not25 = icmp slt i32 %2, 1
br i1 %cmp2.not25, label %for.end14, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%a.026 = phi i32 [ %inc13, %for.end ], [ 1, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not23 = icmp slt i32 %3, 1
br i1 %cmp4.not23, label %for.end, label %for.body5
for.body5: ; preds = %for.cond3.preheader, %for.body5
%b.024 = phi i32 [ %inc, %for.body5 ], [ 1, %for.cond3.preheader ]
%add = add nuw nsw i32 %b.024, %a.026
%rem = and i32 %add, 1
%cmp6 = icmp eq i32 %rem, 0
%. = select i1 %cmp6, i32 35, i32 46
%putchar22 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %b.024, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not.not = icmp slt i32 %b.024, %4
br i1 %cmp4.not.not, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.cond3.preheader
%putchar20 = call i32 @putchar(i32 10)
%inc13 = add nuw nsw i32 %a.026, 1
%5 = load i32, ptr %H, align 4, !tbaa !5
%cmp2.not.not = icmp slt i32 %a.026, %5
br i1 %cmp2.not.not, label %for.cond3.preheader, label %for.end14, !llvm.loop !11
for.end14: ; 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.end14, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(int argc, const char * argv[]) {
// insert code here...
int w,h;
while(1){
scanf("%d %d",&w,&h);
if(w==0&&h==0){
break;
}
for(int y=1;y<=w;y++){
for(int x=1;x<=h;x++){
// if(x==1 && y==1){
// printf("#");
// }
if((x%2==0 && y%2==0) ||(x%2==1 && y%2==1) ){
printf("#");
}else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_217977/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_217977/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%w = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
%call41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h)
%0 = load i32, ptr %w, align 4, !tbaa !5
%cmp42 = icmp eq i32 %0, 0
%1 = load i32, ptr %h, align 4
%cmp143 = icmp eq i32 %1, 0
%or.cond44 = select i1 %cmp42, i1 %cmp143, i1 false
br i1 %or.cond44, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.cond.cleanup
%2 = phi i32 [ %5, %for.cond.cleanup ], [ %0, %entry ]
%cmp2.not39 = icmp slt i32 %2, 1
br i1 %cmp2.not39, label %for.cond.cleanup, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.cond.preheader, %for.cond.cleanup5
%y.040 = phi i32 [ %inc22, %for.cond.cleanup5 ], [ 1, %for.cond.preheader ]
%3 = load i32, ptr %h, align 4, !tbaa !5
%cmp4.not37 = icmp slt i32 %3, 1
br i1 %cmp4.not37, label %for.cond.cleanup5, label %for.body6.lr.ph
for.body6.lr.ph: ; preds = %for.cond3.preheader
%4 = and i32 %y.040, 1
br label %for.body6
for.cond.cleanup: ; preds = %for.cond.cleanup5, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h)
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp = icmp eq i32 %5, 0
%6 = load i32, ptr %h, align 4
%cmp1 = icmp eq i32 %6, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
for.cond.cleanup5: ; preds = %for.body6, %for.cond3.preheader
%putchar31 = call i32 @putchar(i32 10)
%inc22 = add nuw nsw i32 %y.040, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp2.not.not = icmp slt i32 %y.040, %7
br i1 %cmp2.not.not, label %for.cond3.preheader, label %for.cond.cleanup, !llvm.loop !9
for.body6: ; preds = %for.body6.lr.ph, %for.body6
%x.038 = phi i32 [ 1, %for.body6.lr.ph ], [ %inc, %for.body6 ]
%8 = or i32 %x.038, %y.040
%9 = and i32 %8, 1
%or.cond34 = icmp ne i32 %9, 0
%10 = and i32 %4, %x.038
%or.cond35 = icmp eq i32 %10, 0
%or.cond36 = and i1 %or.cond35, %or.cond34
%. = select i1 %or.cond36, i32 46, i32 35
%putchar33 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %x.038, 1
%11 = load i32, ptr %h, align 4, !tbaa !5
%cmp4.not.not = icmp slt i32 %x.038, %11
br i1 %cmp4.not.not, label %for.body6, label %for.cond.cleanup5, !llvm.loop !11
while.end: ; preds = %for.cond.cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(){
int h, w, i, j;
while(scanf("%d%d", &h, &w) && h && w){
for(i = 0;i < h;i++){
for(j = 0;j < w;j++) putchar((i + j) % 2 == 0 ? '#' : '.');
puts("");
}
puts("");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218019/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218019/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%tobool26 = icmp ne i32 %call25, 0
%0 = load i32, ptr %h, align 4
%tobool127 = icmp ne i32 %0, 0
%or.cond28 = select i1 %tobool26, i1 %tobool127, i1 false
%1 = load i32, ptr %w, align 4
%tobool229 = icmp ne i32 %1, 0
%or.cond1330 = select i1 %or.cond28, i1 %tobool229, i1 false
br i1 %or.cond1330, label %for.cond.preheader, label %while.end
for.cond.preheader: ; preds = %entry, %for.end11
%2 = phi i32 [ %9, %for.end11 ], [ %0, %entry ]
%cmp23 = icmp sgt i32 %2, 0
br i1 %cmp23, label %for.cond3.preheader, label %for.end11
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.024 = phi i32 [ %inc10, %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 ]
%add = add nuw nsw i32 %j.022, %i.024
%rem = and i32 %add, 1
%cmp6 = icmp eq i32 %rem, 0
%cond = select i1 %cmp6, i32 35, i32 46
%4 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i = call noundef i32 @putc(i32 noundef %cond, ptr noundef %4)
%inc = add nuw nsw i32 %j.022, 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 !11
for.end: ; preds = %for.body5, %for.cond3.preheader
%6 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i19 = call noundef i32 @putc(i32 noundef 10, ptr noundef %6)
%inc10 = add nuw nsw i32 %i.024, 1
%7 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp slt i32 %inc10, %7
br i1 %cmp, label %for.cond3.preheader, label %for.end11, !llvm.loop !13
for.end11: ; preds = %for.end, %for.cond.preheader
%8 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i20 = call noundef i32 @putc(i32 noundef 10, ptr noundef %8)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%tobool = icmp ne i32 %call, 0
%9 = load i32, ptr %h, align 4
%tobool1 = icmp ne i32 %9, 0
%or.cond = select i1 %tobool, i1 %tobool1, i1 false
%10 = load i32, ptr %w, align 4
%tobool2 = icmp ne i32 %10, 0
%or.cond13 = select i1 %or.cond, i1 %tobool2, i1 false
br i1 %or.cond13, label %for.cond.preheader, label %while.end, !llvm.loop !14
while.end: ; preds = %for.end11, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
|
#include <stdio.h>
int main(){
int h, w;
int i, j;
while(1){
scanf("%d %d ", &h, &w);
if(h==0&&w==0)break;
for(i=0;i<h;i++){
for(j=0;j<w;j++){
if((i%2==0&&j%2==0)||(i%2==1&&j%2==1)){
printf("#");
}else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218062/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218062/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d %d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp41 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp142 = icmp eq i32 %1, 0
%or.cond43 = select i1 %cmp41, i1 %cmp142, i1 false
br i1 %or.cond43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end22
%2 = phi i32 [ %10, %for.end22 ], [ %0, %entry ]
%cmp238 = icmp sgt i32 %2, 0
br i1 %cmp238, label %for.cond3.preheader, label %for.end22
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.039 = phi i32 [ %inc21, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp436 = icmp sgt i32 %3, 0
br i1 %cmp436, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%4 = and i32 %i.039, 1
br label %for.body5
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%j.037 = phi i32 [ 0, %for.body5.lr.ph ], [ %inc, %for.body5 ]
%5 = or i32 %j.037, %i.039
%6 = and i32 %5, 1
%or.cond33 = icmp ne i32 %6, 0
%7 = and i32 %4, %j.037
%or.cond34 = icmp eq i32 %7, 0
%or.cond35 = and i1 %or.cond34, %or.cond33
%. = select i1 %or.cond35, i32 46, i32 35
%putchar32 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.037, 1
%8 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %8
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.cond3.preheader
%putchar30 = call i32 @putchar(i32 10)
%inc21 = add nuw nsw i32 %i.039, 1
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc21, %9
br i1 %cmp2, label %for.cond3.preheader, label %for.end22, !llvm.loop !11
for.end22: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%10 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %10, 0
%11 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %11, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end22, %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,sq;
while(1){
scanf("%d %d",&h,&w);
if(h == 0 && w == 0) break;
for(i=0;i < h;i++){
for(j=0;j < w;j++){
if(i % 2 == 0 && j % 2 == 0 || i % 2 == 1 && j % 2 == 1){
printf("#");
}else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218112/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218112/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp41 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp142 = icmp eq i32 %1, 0
%or.cond43 = select i1 %cmp41, i1 %cmp142, i1 false
br i1 %or.cond43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end22
%2 = phi i32 [ %10, %for.end22 ], [ %0, %entry ]
%cmp238 = icmp sgt i32 %2, 0
br i1 %cmp238, label %for.cond3.preheader, label %for.end22
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.039 = phi i32 [ %inc21, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp436 = icmp sgt i32 %3, 0
br i1 %cmp436, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%4 = and i32 %i.039, 1
br label %for.body5
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%j.037 = phi i32 [ 0, %for.body5.lr.ph ], [ %inc, %for.body5 ]
%5 = or i32 %j.037, %i.039
%6 = and i32 %5, 1
%or.cond33 = icmp ne i32 %6, 0
%7 = and i32 %4, %j.037
%or.cond34 = icmp eq i32 %7, 0
%or.cond35 = and i1 %or.cond34, %or.cond33
%. = select i1 %or.cond35, i32 46, i32 35
%putchar32 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.037, 1
%8 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %8
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.cond3.preheader
%putchar30 = call i32 @putchar(i32 10)
%inc21 = add nuw nsw i32 %i.039, 1
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc21, %9
br i1 %cmp2, label %for.cond3.preheader, label %for.end22, !llvm.loop !11
for.end22: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%10 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %10, 0
%11 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %11, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end22, %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>
#include <string.h>
// #include <math.h>
int main() {
int h,w,i,j;
while(1){
scanf("%d %d",&h,&w);
if(h==0&&w==0){
break;
}
for(i=0;i<h;i++){
for(j=0;j<w;j++){
if((j+i)%2==0){
printf("#");
}else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218156/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218156/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call27 = 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
%cmp28 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp129 = icmp eq i32 %1, 0
%or.cond30 = select i1 %cmp28, i1 %cmp129, i1 false
br i1 %or.cond30, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end14
%2 = phi i32 [ %6, %for.end14 ], [ %0, %entry ]
%cmp225 = icmp sgt i32 %2, 0
br i1 %cmp225, label %for.cond3.preheader, label %for.end14
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.026 = phi i32 [ %inc13, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp423 = icmp sgt i32 %3, 0
br i1 %cmp423, label %for.body5, label %for.end
for.body5: ; preds = %for.cond3.preheader, %for.body5
%j.024 = phi i32 [ %inc, %for.body5 ], [ 0, %for.cond3.preheader ]
%add = add nuw nsw i32 %j.024, %i.026
%rem = and i32 %add, 1
%cmp6 = icmp eq i32 %rem, 0
%. = select i1 %cmp6, i32 35, i32 46
%putchar22 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.024, 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
%putchar20 = call i32 @putchar(i32 10)
%inc13 = add nuw nsw i32 %i.026, 1
%5 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc13, %5
br i1 %cmp2, label %for.cond3.preheader, label %for.end14, !llvm.loop !11
for.end14: ; 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.end14, %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 i,j,a,b,c;
for(c=1;;)
{
scanf("%d %d",&a,&b);
if(a==0 && b==0)break;
for(j=1;j<=a;j++)
if(j%2==0)
{
for(i=1;i<=b;i++)
{
if(i%2==0)
printf("#");
else
printf(".");
}
printf("\n");
}
else
{
for(i=1;i<=b;i++)
{
if(i%2==0)
printf(".");
else
printf("#");
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218213/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218213/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%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
%call56 = 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
%cmp57 = icmp eq i32 %0, 0
%1 = load i32, ptr %b, align 4
%cmp158 = icmp eq i32 %1, 0
%or.cond59 = select i1 %cmp57, i1 %cmp158, i1 false
br i1 %or.cond59, label %for.end36, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %for.end34
%2 = phi i32 [ %7, %for.end34 ], [ %0, %entry ]
%cmp3.not54 = icmp slt i32 %2, 1
br i1 %cmp3.not54, label %for.end34, label %for.body
for.body: ; preds = %for.cond2.preheader, %for.inc32
%j.055 = phi i32 [ %inc33, %for.inc32 ], [ 1, %for.cond2.preheader ]
%rem = and i32 %j.055, 1
%cmp4 = icmp eq i32 %rem, 0
%3 = load i32, ptr %b, align 4, !tbaa !5
%cmp7.not52 = icmp slt i32 %3, 1
br i1 %cmp4, label %for.cond6.preheader, label %for.cond17.preheader
for.cond17.preheader: ; preds = %for.body
br i1 %cmp7.not52, label %for.inc32, label %for.body19
for.cond6.preheader: ; preds = %for.body
br i1 %cmp7.not52, label %for.inc32, label %for.body8
for.body8: ; preds = %for.cond6.preheader, %for.body8
%i.053 = phi i32 [ %inc, %for.body8 ], [ 1, %for.cond6.preheader ]
%rem9 = and i32 %i.053, 1
%cmp10 = icmp eq i32 %rem9, 0
%. = select i1 %cmp10, i32 35, i32 46
%putchar49 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %i.053, 1
%4 = load i32, ptr %b, align 4, !tbaa !5
%cmp7.not.not = icmp slt i32 %i.053, %4
br i1 %cmp7.not.not, label %for.body8, label %for.inc32, !llvm.loop !9
for.body19: ; preds = %for.cond17.preheader, %for.body19
%i.151 = phi i32 [ %inc28, %for.body19 ], [ 1, %for.cond17.preheader ]
%rem20 = and i32 %i.151, 1
%cmp21 = icmp eq i32 %rem20, 0
%.61 = select i1 %cmp21, i32 46, i32 35
%putchar46 = call i32 @putchar(i32 %.61)
%inc28 = add nuw nsw i32 %i.151, 1
%5 = load i32, ptr %b, align 4, !tbaa !5
%cmp18.not.not = icmp slt i32 %i.151, %5
br i1 %cmp18.not.not, label %for.body19, label %for.inc32, !llvm.loop !11
for.inc32: ; preds = %for.body19, %for.body8, %for.cond17.preheader, %for.cond6.preheader
%putchar47 = call i32 @putchar(i32 10)
%inc33 = add nuw nsw i32 %j.055, 1
%6 = load i32, ptr %a, align 4, !tbaa !5
%cmp3.not.not = icmp slt i32 %j.055, %6
br i1 %cmp3.not.not, label %for.body, label %for.end34, !llvm.loop !12
for.end34: ; preds = %for.inc32, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%7 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp eq i32 %7, 0
%8 = load i32, ptr %b, align 4
%cmp1 = icmp eq i32 %8, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %for.end36, label %for.cond2.preheader
for.end36: ; preds = %for.end34, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
void write(int, int);
int main() {
int H, W;
while(1) {
scanf("%d%d", &H, &W);
if (H == 0 && W == 0) break;
write(H, W);
}
return 0;
}
void write(int H, int W) {
int i, j;
for (i = 0; i < H; i++) {
for (j = 0; j < W; j++) {
if (i % 2 == 1 && j % 2 == 1) printf("#");
else if (i % 2 == 1 && j % 2 == 0) printf(".");
else if (i % 2 == 0 && j % 2 == 1) printf(".");
else if (i % 2 == 0 && j % 2 == 0) printf("#");
}
printf("\n");
}
printf("\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218394/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218394/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call2 = 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
%cmp3 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp14 = icmp eq i32 %1, 0
%or.cond5 = select i1 %cmp3, i1 %cmp14, i1 false
br i1 %or.cond5, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end
%2 = phi i32 [ %5, %if.end ], [ %1, %entry ]
%3 = phi i32 [ %4, %if.end ], [ %0, %entry ]
call void @write(i32 noundef %3, i32 noundef %2)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%4 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %4, 0
%5 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %5, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %if.end
while.end: ; preds = %if.end, %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: nofree nounwind uwtable
define dso_local void @write(i32 noundef %H, i32 noundef %W) local_unnamed_addr #0 {
entry:
%cmp58 = icmp sgt i32 %H, 0
br i1 %cmp58, label %for.cond1.preheader.lr.ph, label %for.end36
for.cond1.preheader.lr.ph: ; preds = %entry
%cmp256 = icmp sgt i32 %W, 0
br i1 %cmp256, label %for.cond1.preheader.us, label %for.cond1.preheader
for.cond1.preheader.us: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.for.end_crit_edge.us
%i.059.us = phi i32 [ %inc35.us, %for.cond1.for.end_crit_edge.us ], [ 0, %for.cond1.preheader.lr.ph ]
%0 = and i32 %i.059.us, 1
%cmp4.not.us.not = icmp eq i32 %0, 0
br i1 %cmp4.not.us.not, label %if.else.us.us, label %for.body3.us61
for.body3.us61: ; preds = %for.cond1.preheader.us, %for.inc.us72
%j.057.us62 = phi i32 [ %inc.us73, %for.inc.us72 ], [ 0, %for.cond1.preheader.us ]
%1 = and i32 %0, %j.057.us62
%or.cond.not.not.us65 = icmp eq i32 %1, 0
br i1 %or.cond.not.not.us65, label %if.else.us68, label %for.inc.us72.sink.split
if.else.us68: ; preds = %for.body3.us61
%rem5.us63 = and i32 %j.057.us62, 1
%cmp6.not.us64 = icmp eq i32 %rem5.us63, 0
br i1 %cmp6.not.us64, label %for.inc.us72.sink.split, label %if.else14.us
if.else14.us: ; preds = %if.else.us68
%2 = or i32 %j.057.us62, %i.059.us
%3 = and i32 %2, 1
%or.cond55.us69 = icmp eq i32 %3, 0
br i1 %or.cond55.us69, label %for.inc.us72.sink.split, label %for.inc.us72
for.inc.us72.sink.split: ; preds = %if.else.us68, %if.else14.us, %for.body3.us61
%.sink = phi i32 [ 35, %for.body3.us61 ], [ 35, %if.else14.us ], [ 46, %if.else.us68 ]
%putchar51.us = tail call i32 @putchar(i32 %.sink)
br label %for.inc.us72
for.inc.us72: ; preds = %for.inc.us72.sink.split, %if.else14.us
%inc.us73 = add nuw nsw i32 %j.057.us62, 1
%exitcond79.not = icmp eq i32 %inc.us73, %W
br i1 %exitcond79.not, label %for.cond1.for.end_crit_edge.us, label %for.body3.us61, !llvm.loop !9
for.cond1.for.end_crit_edge.us: ; preds = %for.inc.us72, %for.inc.us.us
%putchar48.us = tail call i32 @putchar(i32 10)
%inc35.us = add nuw nsw i32 %i.059.us, 1
%exitcond81.not = icmp eq i32 %inc35.us, %H
br i1 %exitcond81.not, label %for.end36, label %for.cond1.preheader.us, !llvm.loop !11
if.else.us.us: ; preds = %for.cond1.preheader.us, %for.inc.us.us
%j.057.us.us = phi i32 [ %inc.us.us, %for.inc.us.us ], [ 0, %for.cond1.preheader.us ]
%rem5.us.us = and i32 %j.057.us.us, 1
%cmp6.not.us.us = icmp eq i32 %rem5.us.us, 0
br i1 %cmp6.not.us.us, label %if.else22.us.us, label %for.inc.us.us.sink.split
if.else22.us.us: ; preds = %if.else.us.us
%4 = or i32 %j.057.us.us, %i.059.us
%5 = and i32 %4, 1
%or.cond55.us.us = icmp eq i32 %5, 0
br i1 %or.cond55.us.us, label %for.inc.us.us.sink.split, label %for.inc.us.us
for.inc.us.us.sink.split: ; preds = %if.else22.us.us, %if.else.us.us
%.sink84 = phi i32 [ 46, %if.else.us.us ], [ 35, %if.else22.us.us ]
%putchar49.us.us = tail call i32 @putchar(i32 %.sink84)
br label %for.inc.us.us
for.inc.us.us: ; preds = %for.inc.us.us.sink.split, %if.else22.us.us
%inc.us.us = add nuw nsw i32 %j.057.us.us, 1
%exitcond80.not = icmp eq i32 %inc.us.us, %W
br i1 %exitcond80.not, label %for.cond1.for.end_crit_edge.us, label %if.else.us.us, !llvm.loop !9
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.preheader
%i.059 = phi i32 [ %inc35, %for.cond1.preheader ], [ 0, %for.cond1.preheader.lr.ph ]
%putchar48 = tail call i32 @putchar(i32 10)
%inc35 = add nuw nsw i32 %i.059, 1
%exitcond.not = icmp eq i32 %inc35, %H
br i1 %exitcond.not, label %for.end36, label %for.cond1.preheader, !llvm.loop !11
for.end36: ; preds = %for.cond1.preheader, %for.cond1.for.end_crit_edge.us, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 a[1000], b[1000],x,c,d,e,f;
int i = 0;
int r = 1;
while (r) {
scanf("%d %d",&a[i],&b[i]);
if(a[i] == 0 && b[i] == 0) {
r = 0;
}
i++;
}
for (x = 0; x < i; x++) {
c = a[x];
d = b[x];
for (e = 0; e < a[x]; e++) {
for (f = 0; f < b[x]; f++) {
if (e%2==0 && f%2==0) {
printf("#");
}
else if(e%2==1 && f%2==1){
printf("#");
}else {
printf(".");
}
}
printf("\n");
}
if (x != i - 1) {
printf("\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218437/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218437/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca [1000 x i32], align 16
%b = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %b) #4
br label %while.body
for.cond.preheader: ; preds = %if.end
%0 = and i64 %indvars.iv, 4294967295
%wide.trip.count = zext i32 %indvars.iv85 to i64
br label %for.body
while.body: ; preds = %entry, %if.end
%indvars.iv85 = phi i32 [ 1, %entry ], [ %indvars.iv.next86, %if.end ]
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %if.end ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [1000 x i32], ptr %b, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp = icmp eq i32 %1, 0
br i1 %cmp, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %while.body
%2 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp7 = icmp ne i32 %2, 0
%spec.select = zext i1 %cmp7 to i32
br label %if.end
if.end: ; preds = %land.lhs.true, %while.body
%r.1 = phi i32 [ 1, %while.body ], [ %spec.select, %land.lhs.true ]
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%tobool.not = icmp eq i32 %r.1, 0
%indvars.iv.next86 = add nuw i32 %indvars.iv85, 1
br i1 %tobool.not, label %for.cond.preheader, label %while.body, !llvm.loop !9
for.body: ; preds = %for.cond.preheader, %for.inc49
%indvars.iv82 = phi i64 [ 0, %for.cond.preheader ], [ %indvars.iv.next83, %for.inc49 ]
%arrayidx10 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv82
%arrayidx12 = getelementptr inbounds [1000 x i32], ptr %b, i64 0, i64 %indvars.iv82
%3 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp1678 = icmp sgt i32 %3, 0
br i1 %cmp1678, label %for.cond18.preheader, label %for.end44
for.cond18.preheader: ; preds = %for.body, %for.end
%e.079 = phi i32 [ %inc43, %for.end ], [ 0, %for.body ]
%4 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp2176 = icmp sgt i32 %4, 0
br i1 %cmp2176, label %for.body22.lr.ph, label %for.end
for.body22.lr.ph: ; preds = %for.cond18.preheader
%5 = and i32 %e.079, 1
br label %for.body22
for.body22: ; preds = %for.body22.lr.ph, %for.body22
%f.077 = phi i32 [ 0, %for.body22.lr.ph ], [ %inc40, %for.body22 ]
%6 = or i32 %f.077, %e.079
%7 = and i32 %6, 1
%or.cond = icmp eq i32 %7, 0
%8 = and i32 %5, %f.077
%or.cond74.not.not = icmp eq i32 %8, 0
%. = select i1 %or.cond74.not.not, i32 46, i32 35
%.sink = select i1 %or.cond, i32 35, i32 %.
%putchar73 = call i32 @putchar(i32 %.sink)
%inc40 = add nuw nsw i32 %f.077, 1
%9 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp21 = icmp slt i32 %inc40, %9
br i1 %cmp21, label %for.body22, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body22, %for.cond18.preheader
%putchar70 = call i32 @putchar(i32 10)
%inc43 = add nuw nsw i32 %e.079, 1
%10 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp16 = icmp slt i32 %inc43, %10
br i1 %cmp16, label %for.cond18.preheader, label %for.end44, !llvm.loop !12
for.end44: ; preds = %for.end, %for.body
%cmp45.not = icmp eq i64 %indvars.iv82, %0
br i1 %cmp45.not, label %for.inc49, label %if.then46
if.then46: ; preds = %for.end44
%putchar = call i32 @putchar(i32 10)
br label %for.inc49
for.inc49: ; preds = %for.end44, %if.then46
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%exitcond.not = icmp eq i64 %indvars.iv.next83, %wide.trip.count
br i1 %exitcond.not, label %for.end51, label %for.body, !llvm.loop !13
for.end51: ; preds = %for.inc49
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#define SHARP 0
#define DOT 1
int main(void)
{
int h,w;
int i,j;
char flag;
while(1)
{
scanf("%d %d",&h,&w);
if(h==0&&w==0) break;
for(i=1;i<=h;i++)
{
if(i%2==1)
{
flag = SHARP;
}
else
{
flag = DOT;
}
for(j=1;j<=w;j++)
{
if(flag == SHARP)
{
printf("#");
flag = DOT;
}
else
{
printf(".");
flag = SHARP;
}
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218523/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218523/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp33 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp134 = icmp eq i32 %1, 0
%or.cond35 = select i1 %cmp33, i1 %cmp134, i1 false
br i1 %or.cond35, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end19
%2 = phi i32 [ %6, %for.end19 ], [ %0, %entry ]
%cmp2.not30 = icmp slt i32 %2, 1
br i1 %cmp2.not30, label %for.end19, label %for.body
for.body: ; preds = %for.cond.preheader, %for.end
%i.031 = phi i32 [ %inc18, %for.end ], [ 1, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp7.not27 = icmp slt i32 %3, 1
br i1 %cmp7.not27, label %for.end, label %for.body8.preheader
for.body8.preheader: ; preds = %for.body
%rem = and i32 %i.031, 1
%. = xor i32 %rem, 1
br label %for.body8
for.body8: ; preds = %for.body8.preheader, %for.body8
%flag.129 = phi i32 [ %.37, %for.body8 ], [ %., %for.body8.preheader ]
%j.028 = phi i32 [ %inc, %for.body8 ], [ 1, %for.body8.preheader ]
%cmp9 = icmp eq i32 %flag.129, 0
%.36 = select i1 %cmp9, i32 35, i32 46
%.37 = zext i1 %cmp9 to i32
%putchar26 = call i32 @putchar(i32 %.36)
%inc = add nuw nsw i32 %j.028, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp7.not.not = icmp slt i32 %j.028, %4
br i1 %cmp7.not.not, label %for.body8, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body8, %for.body
%putchar24 = call i32 @putchar(i32 10)
%inc18 = add nuw nsw i32 %i.031, 1
%5 = load i32, ptr %h, align 4, !tbaa !5
%cmp2.not.not = icmp slt i32 %i.031, %5
br i1 %cmp2.not.not, label %for.body, label %for.end19, !llvm.loop !11
for.end19: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%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.end19, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(){
long long int A, B, K;
scanf("%lld %lld %lld", &A, &B, &K);
A-=K;
K=(A>=0LL)?0LL:-A;
if(K>0LL) A=0LL;
B-=K;
K=(B>=0LL)?0LL:-B;
if(K>0LL) B=0LL;
printf("%lld %lld\n", A, B);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218574/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218574/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%lld %lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%lld %lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i64, align 8
%B = alloca i64, align 8
%K = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %K) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %K)
%0 = load i64, ptr %K, align 8, !tbaa !5
%1 = load i64, ptr %A, align 8, !tbaa !5
%sub = sub nsw i64 %1, %0
%sub1 = sub nsw i64 0, %sub
%cmp.inv = icmp slt i64 %sub, 0
%cond = select i1 %cmp.inv, i64 %sub1, i64 0
%cmp2 = icmp sgt i64 %cond, 0
%spec.store.select = select i1 %cmp2, i64 0, i64 %sub
store i64 %spec.store.select, ptr %A, align 8
%2 = load i64, ptr %B, align 8, !tbaa !5
%sub3 = sub nsw i64 %2, %cond
store i64 %sub3, ptr %B, align 8, !tbaa !5
%sub7 = sub nsw i64 0, %sub3
%cmp4.inv = icmp slt i64 %sub3, 0
%cond9 = select i1 %cmp4.inv, i64 %sub7, i64 0
store i64 %cond9, ptr %K, align 8, !tbaa !5
%cmp10 = icmp sgt i64 %cond9, 0
br i1 %cmp10, label %if.then11, label %if.end12
if.then11: ; preds = %entry
store i64 0, ptr %B, align 8, !tbaa !5
br label %if.end12
if.end12: ; preds = %if.then11, %entry
%3 = phi i64 [ 0, %if.then11 ], [ %sub3, %entry ]
%spec.select = select i1 %cmp2, i64 0, i64 %sub
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %spec.select, i64 noundef %3)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
int main()
{
long long int a,b,k,i;
scanf("%lld %lld %lld",&a,&b,&k);
if(k<=a)
{
printf("%lld %lld\n",a-k,b);
}
else if(k>a && k<a+b )
{
printf("0 %lld\n",a+b-k);
}
else if(k>=a+b)
{
printf("0 0\n");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218624/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218624/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%lld %lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%lld %lld\0A\00", align 1
@.str.2 = private unnamed_addr constant [8 x i8] c"0 %lld\0A\00", align 1
@str = private unnamed_addr constant [4 x i8] c"0 0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %k)
%0 = load i64, ptr %k, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
%cmp.not = icmp sgt i64 %0, %1
br i1 %cmp.not, label %land.lhs.true, label %if.then
if.then: ; preds = %entry
%sub = sub nsw i64 %1, %0
%2 = load i64, ptr %b, align 8, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub, i64 noundef %2)
br label %if.end14
land.lhs.true: ; preds = %entry
%3 = load i64, ptr %b, align 8, !tbaa !5
%add = add nsw i64 %3, %1
%cmp3 = icmp slt i64 %0, %add
br i1 %cmp3, label %if.then4, label %if.then11
if.then4: ; preds = %land.lhs.true
%sub6 = sub nsw i64 %add, %0
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sub6)
br label %if.end14
if.then11: ; preds = %land.lhs.true
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end14
if.end14: ; preds = %if.then4, %if.then11, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#define BUF_SIZE 50
int get_int3(uint64_t *a1, uint64_t *a2, uint64_t *a3) {
#ifdef BUF_SIZE
char line[BUF_SIZE];
if(!fgets(line, BUF_SIZE, stdin)) return -1;
sscanf(line, "%llu %llu %llu", a1, a2, a3);
#else
#error
#endif
return 0;
}
int main(void) {
uint64_t a, b, k;
get_int3(&a, &b, &k);
if(k <= a) {
a -= k;
} else if (k > a && k <= a+b) {
k -= a;
a = 0;
b -= k;
} else {
a = 0; b = 0;
}
printf("%llu %llu\n", a, b);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218668/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218668/source.c"
target datalayout = "e-m:e-p270: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 [15 x i8] c"%llu %llu %llu\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%llu %llu\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int3(ptr noundef %a1, ptr noundef %a2, ptr noundef %a3) local_unnamed_addr #0 {
entry:
%line = alloca [50 x i8], align 16
call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %line) #3
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %line, i32 noundef 50, ptr noundef %0)
%tobool.not = icmp eq ptr %call, null
br i1 %tobool.not, label %cleanup, label %if.end
if.end: ; preds = %entry
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line, ptr noundef nonnull @.str, ptr noundef %a1, ptr noundef %a2, ptr noundef %a3) #3
br label %cleanup
cleanup: ; preds = %entry, %if.end
%retval.0 = phi i32 [ 0, %if.end ], [ -1, %entry ]
call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %line) #3
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree 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:
%line.i = alloca [50 x i8], align 16
%a = alloca i64, align 8
%b = alloca i64, align 8
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #3
call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %line.i) #3
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = call ptr @fgets(ptr noundef nonnull %line.i, i32 noundef 50, ptr noundef %0)
%tobool.not.i = icmp eq ptr %call.i, null
br i1 %tobool.not.i, label %get_int3.exit, label %if.end.i
if.end.i: ; preds = %entry
%call2.i = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line.i, ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %k) #3
br label %get_int3.exit
get_int3.exit: ; preds = %entry, %if.end.i
call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %line.i) #3
%1 = load i64, ptr %k, align 8, !tbaa !9
%2 = load i64, ptr %a, align 8, !tbaa !9
%cmp.not = icmp ugt i64 %1, %2
br i1 %cmp.not, label %land.lhs.true, label %if.then
if.then: ; preds = %get_int3.exit
%sub = sub i64 %2, %1
store i64 %sub, ptr %a, align 8, !tbaa !9
%.pre = load i64, ptr %b, align 8, !tbaa !9
br label %if.end7
land.lhs.true: ; preds = %get_int3.exit
%3 = load i64, ptr %b, align 8, !tbaa !9
%add = add i64 %3, %2
%cmp2.not = icmp ugt i64 %1, %add
br i1 %cmp2.not, label %if.else6, label %if.then3
if.then3: ; preds = %land.lhs.true
%sub4 = sub i64 %1, %2
store i64 %sub4, ptr %k, align 8, !tbaa !9
store i64 0, ptr %a, align 8, !tbaa !9
%sub5 = sub i64 %3, %sub4
store i64 %sub5, ptr %b, align 8, !tbaa !9
br label %if.end7
if.else6: ; preds = %land.lhs.true
store i64 0, ptr %a, align 8, !tbaa !9
store i64 0, ptr %b, align 8, !tbaa !9
br label %if.end7
if.end7: ; preds = %if.then3, %if.else6, %if.then
%4 = phi i64 [ %sub5, %if.then3 ], [ 0, %if.else6 ], [ %.pre, %if.then ]
%5 = phi i64 [ 0, %if.then3 ], [ 0, %if.else6 ], [ %sub, %if.then ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %5, i64 noundef %4)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
|
#include<stdio.h>
int main()
{
long long A;
long long B;
long long K;
long long J;
scanf("%lld%lld%lld",&A,&B,&K);
if(A==K){
printf("%lld %lld",A=0,B);
}
else if(A+B==K){
printf("%lld %lld",A=0,B=0);
}
else if(A+B<K){
printf("%lld %lld",A=0,B=0);
}
else if(A>K){
printf("%lld %lld",A-K,B);
}
else if(A<K){
J=K-A;
B=B-J;
printf("%lld %lld",A=0,B);
}
else if(A+B<K){
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218718/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218718/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%lld%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i64, align 8
%B = alloca i64, align 8
%K = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %K) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %K)
%0 = load i64, ptr %A, align 8, !tbaa !5
%1 = load i64, ptr %K, align 8, !tbaa !5
%cmp = icmp eq i64 %0, %1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
store i64 0, ptr %A, align 8, !tbaa !5
%2 = load i64, ptr %B, align 8, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 0, i64 noundef %2)
br label %if.end28
if.else: ; preds = %entry
%3 = load i64, ptr %B, align 8, !tbaa !5
%add = add nsw i64 %3, %0
%cmp2 = icmp eq i64 %add, %1
br i1 %cmp2, label %if.then3, label %if.else5
if.then3: ; preds = %if.else
store i64 0, ptr %A, align 8, !tbaa !5
store i64 0, ptr %B, align 8, !tbaa !5
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 0, i64 noundef 0)
br label %if.end28
if.else5: ; preds = %if.else
%cmp7 = icmp slt i64 %add, %1
br i1 %cmp7, label %if.then8, label %if.else10
if.then8: ; preds = %if.else5
store i64 0, ptr %A, align 8, !tbaa !5
store i64 0, ptr %B, align 8, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 0, i64 noundef 0)
br label %if.end28
if.else10: ; preds = %if.else5
%cmp11 = icmp sgt i64 %0, %1
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else10
%sub = sub nsw i64 %0, %1
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub, i64 noundef %3)
br label %if.end28
if.else14: ; preds = %if.else10
%cmp15 = icmp slt i64 %0, %1
br i1 %cmp15, label %if.then16, label %if.end28
if.then16: ; preds = %if.else14
%sub17.neg = sub i64 %0, %1
%sub18 = add i64 %3, %sub17.neg
store i64 %sub18, ptr %B, align 8, !tbaa !5
store i64 0, ptr %A, align 8, !tbaa !5
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 0, i64 noundef %sub18)
br label %if.end28
if.end28: ; preds = %if.else14, %if.then3, %if.then12, %if.then16, %if.then8, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main() {
long long a, b, k;
scanf("%lld%lld%lld", &a, &b, &k);
if (a >= k)
printf("%lld %lld\n", a - k, b);
else if (b >= k - a)
printf("0 %lld\n", b - (k - a));
else
printf("0 0\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218761/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218761/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%lld%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%lld %lld\0A\00", align 1
@.str.2 = private unnamed_addr constant [8 x i8] c"0 %lld\0A\00", align 1
@str = private unnamed_addr constant [4 x i8] c"0 0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %k)
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %k, align 8, !tbaa !5
%cmp.not = icmp slt i64 %0, %1
br i1 %cmp.not, label %if.else, label %if.then
if.then: ; preds = %entry
%sub = sub nsw i64 %0, %1
%2 = load i64, ptr %b, align 8, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub, i64 noundef %2)
br label %if.end10
if.else: ; preds = %entry
%3 = load i64, ptr %b, align 8, !tbaa !5
%sub2 = sub nsw i64 %1, %0
%cmp3.not = icmp slt i64 %3, %sub2
br i1 %cmp3.not, label %if.else8, label %if.then4
if.then4: ; preds = %if.else
%sub6 = sub nsw i64 %3, %sub2
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sub6)
br label %if.end10
if.else8: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end10
if.end10: ; preds = %if.then4, %if.else8, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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(void)
{
long a, b, sum;
long k;
scanf("%lu %lu %lu", &a, &b, &k);
if(a < k) {
sum = a + b - k;
if(sum < 0) {
a = 0;
b = 0;
} else if(sum > b) {
a = sum - b;
} else {
a = 0;
b = sum;
}
} else {
a -= k;
}
printf("%lu %lu\n", a, b);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218804/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218804/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%lu %lu %lu\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%lu %lu\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %k)
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %k, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
br i1 %cmp, label %if.then, label %if.else8
if.then: ; preds = %entry
%2 = load i64, ptr %b, align 8, !tbaa !5
%add = sub i64 %0, %1
%sub = add i64 %add, %2
%cmp1 = icmp slt i64 %sub, 0
br i1 %cmp1, label %if.then2, label %if.else
if.then2: ; preds = %if.then
store i64 0, ptr %a, align 8, !tbaa !5
store i64 0, ptr %b, align 8, !tbaa !5
br label %if.end10
if.else: ; preds = %if.then
%cmp3 = icmp sgt i64 %sub, %2
br i1 %cmp3, label %if.then4, label %if.else6
if.then4: ; preds = %if.else
store i64 %add, ptr %a, align 8, !tbaa !5
br label %if.end10
if.else6: ; preds = %if.else
store i64 0, ptr %a, align 8, !tbaa !5
store i64 %sub, ptr %b, align 8, !tbaa !5
br label %if.end10
if.else8: ; preds = %entry
%sub9 = sub nsw i64 %0, %1
store i64 %sub9, ptr %a, align 8, !tbaa !5
%.pre = load i64, ptr %b, align 8, !tbaa !5
br label %if.end10
if.end10: ; preds = %if.then2, %if.else6, %if.then4, %if.else8
%3 = phi i64 [ 0, %if.then2 ], [ %sub, %if.else6 ], [ %2, %if.then4 ], [ %.pre, %if.else8 ]
%4 = phi i64 [ 0, %if.then2 ], [ 0, %if.else6 ], [ %add, %if.then4 ], [ %sub9, %if.else8 ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %4, i64 noundef %3)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
#include<assert.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
#define charsize 100005 //10^5+5
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod_MOD1(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}
ll mod_p(ll n ,ll p){n+= n<0?((-n)/p+1)*p:0; return n%=p;}
ll change_into_num(char s[] , ll len, ll p){ return !p ? 0 : POW(10,p-1)*(s[len-p]-'0') + change_into_num(s,len,p-1); }
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}
int main(void){
// char ;
ll n;
// ll ans=0;
scanf("%lld",&n);
if(n==1){
printf("1\n");
return 0;
}
ll out=0,mark=1;
rep(i,1,n+1){
if( i*(i+1)/2>n ){
out = i*(i+1)/2 - n;
mark=i;
break;
}
}
rep(i,1,mark+1){
if(i!=out){
printf("%lld\n",i);
}
}
// printf("%lld\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218848/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218848/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
store i64 %1, ptr %b, align 8, !tbaa !5
store i64 %0, ptr %a, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #2 {
entry:
%cmp.not = icmp sgt i64 %a, %b
%cmp1.not = icmp sgt i64 %a, %c
%or.cond = or i1 %cmp.not, %cmp1.not
%cond = tail call i64 @llvm.smin.i64(i64 %b, i64 %c)
%cond6 = select i1 %or.cond, i64 %cond, i64 %a
ret i64 %cond6
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #2 {
entry:
%cmp.not = icmp slt i64 %a, %b
%cmp1.not = icmp slt i64 %a, %c
%or.cond = or i1 %cmp.not, %cmp1.not
%cond = tail call i64 @llvm.smax.i64(i64 %b, i64 %c)
%cond6 = select i1 %or.cond, i64 %cond, i64 %a
ret i64 %cond6
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @minn(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #3 {
entry:
%cmp5 = icmp sgt i64 %n, 0
br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader10, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 1152921504606846976, i64 1152921504606846976>, %vector.ph ], [ %2, %vector.body ]
%vec.phi8 = phi <2 x i64> [ <i64 1152921504606846976, i64 1152921504606846976>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %a, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load9 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%3 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi8, <2 x i64> %wide.load9)
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %2, <2 x i64> %3)
%5 = tail call i64 @llvm.vector.reduce.smin.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader10
for.body.preheader10: ; preds = %for.body.preheader, %middle.block
%i.07.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.06.ph = phi i64 [ 1152921504606846976, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.0.lcssa = phi i64 [ 1152921504606846976, %entry ], [ %5, %middle.block ], [ %cond.i, %for.body ]
ret i64 %b.0.lcssa
for.body: ; preds = %for.body.preheader10, %for.body
%i.07 = phi i64 [ %inc, %for.body ], [ %i.07.ph, %for.body.preheader10 ]
%b.06 = phi i64 [ %cond.i, %for.body ], [ %b.06.ph, %for.body.preheader10 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.07
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smin.i64(i64 %b.06, i64 %6)
%inc = add nuw nsw i64 %i.07, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !13
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @maxn(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #3 {
entry:
%cmp5 = icmp sgt i64 %n, 0
br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader10, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 -1152921504606846976, i64 -1152921504606846976>, %vector.ph ], [ %2, %vector.body ]
%vec.phi8 = phi <2 x i64> [ <i64 -1152921504606846976, i64 -1152921504606846976>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %a, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load9 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%3 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi8, <2 x i64> %wide.load9)
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %2, <2 x i64> %3)
%5 = tail call i64 @llvm.vector.reduce.smax.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader10
for.body.preheader10: ; preds = %for.body.preheader, %middle.block
%i.07.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.06.ph = phi i64 [ -1152921504606846976, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.0.lcssa = phi i64 [ -1152921504606846976, %entry ], [ %5, %middle.block ], [ %cond.i, %for.body ]
ret i64 %b.0.lcssa
for.body: ; preds = %for.body.preheader10, %for.body
%i.07 = phi i64 [ %inc, %for.body ], [ %i.07.ph, %for.body.preheader10 ]
%b.06 = phi i64 [ %cond.i, %for.body ], [ %b.06.ph, %for.body.preheader10 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.07
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smax.i64(i64 %b.06, i64 %6)
%inc = add nuw nsw i64 %i.07, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !15
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @ABS(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cond = tail call i64 @llvm.abs.i64(i64 %a, i1 true)
ret i64 %cond
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @POW(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%cmp3 = icmp sgt i64 %b, 0
br i1 %cmp3, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%c.04.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%c.04.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %c.04.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %c.04.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !16
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%c.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %c.0.lcssa
for.body: ; preds = %for.body, %for.body.preheader.new
%c.04 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %c.04, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !18
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %cond.end, label %cond.true
cond.true: ; preds = %entry, %cond.true
%b.tr6 = phi i64 [ %rem, %cond.true ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %cond.true ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %cond.end, label %cond.true
cond.end: ; preds = %cond.true, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %cond.true ]
ret i64 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%tobool.not4.i = icmp eq i64 %b, 0
br i1 %tobool.not4.i, label %gcd.exit, label %cond.true.i
cond.true.i: ; preds = %entry, %cond.true.i
%b.tr6.i = phi i64 [ %rem.i, %cond.true.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %cond.true.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %cond.true.i
gcd.exit: ; preds = %cond.true.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %cond.true.i ]
%div = sdiv i64 %a, %a.tr.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @mod_MOD1(i64 noundef %n) local_unnamed_addr #5 {
entry:
%cmp = icmp slt i64 %n, 0
br i1 %cmp, label %cond.true, label %cond.end
cond.true: ; preds = %entry
%n.nonneg = sub i64 0, %n
%0 = urem i64 %n.nonneg, 1000000007
%1 = add nsw i64 %0, %n
%mul = sub i64 1000000007, %1
br label %cond.end
cond.end: ; preds = %entry, %cond.true
%cond = phi i64 [ %mul, %cond.true ], [ 0, %entry ]
%add1 = add nsw i64 %cond, %n
%rem = srem i64 %add1, 1000000007
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @mod_p(i64 noundef %n, i64 noundef %p) local_unnamed_addr #5 {
entry:
%cmp = icmp slt i64 %n, 0
br i1 %cmp, label %cond.true, label %cond.end
cond.true: ; preds = %entry
%div7 = sdiv i64 %n, %p
%add = sub i64 1, %div7
%mul = mul nsw i64 %add, %p
br label %cond.end
cond.end: ; preds = %entry, %cond.true
%cond = phi i64 [ %mul, %cond.true ], [ 0, %entry ]
%add1 = add nsw i64 %cond, %n
%rem = srem i64 %add1, %p
ret i64 %rem
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @change_into_num(ptr nocapture noundef readonly %s, i64 noundef %len, i64 noundef %p) local_unnamed_addr #6 {
entry:
%tobool.not11 = icmp eq i64 %p, 0
br i1 %tobool.not11, label %cond.end, label %cond.false.preheader
cond.false.preheader: ; preds = %entry
%0 = add i64 %p, -2
br label %cond.false
cond.false: ; preds = %cond.false.preheader, %POW.exit
%indvar = phi i64 [ 0, %cond.false.preheader ], [ %indvar.next, %POW.exit ]
%p.tr13 = phi i64 [ %p, %cond.false.preheader ], [ %sub, %POW.exit ]
%accumulator.tr12 = phi i64 [ 0, %cond.false.preheader ], [ %add, %POW.exit ]
%1 = xor i64 %indvar, -1
%2 = add i64 %1, %p
%sub = add nsw i64 %p.tr13, -1
%cmp3.i = icmp sgt i64 %p.tr13, 1
br i1 %cmp3.i, label %for.body.i.preheader, label %POW.exit
for.body.i.preheader: ; preds = %cond.false
%3 = sub i64 %0, %indvar
%xtraiter = and i64 %2, 7
%4 = icmp ult i64 %3, 7
br i1 %4, label %POW.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %2, -8
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%c.04.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %mul.i.7, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.7, %for.body.i ]
%mul.i.7 = mul i64 %c.04.i, 100000000
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %POW.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !18
POW.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%mul.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %mul.i.7, %for.body.i ]
%c.04.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %mul.i.7, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %POW.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %POW.exit.loopexit.unr-lcssa, %for.body.i.epil
%c.04.i.epil = phi i64 [ %mul.i.epil, %for.body.i.epil ], [ %c.04.i.unr, %POW.exit.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %POW.exit.loopexit.unr-lcssa ]
%mul.i.epil = mul nsw i64 %c.04.i.epil, 10
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %POW.exit, label %for.body.i.epil, !llvm.loop !19
POW.exit: ; preds = %POW.exit.loopexit.unr-lcssa, %for.body.i.epil, %cond.false
%c.0.lcssa.i = phi i64 [ 1, %cond.false ], [ %mul.i.lcssa.ph, %POW.exit.loopexit.unr-lcssa ], [ %mul.i.epil, %for.body.i.epil ]
%sub1 = sub nsw i64 %len, %p.tr13
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %sub1
%5 = load i8, ptr %arrayidx, align 1, !tbaa !20
%conv = sext i8 %5 to i64
%sub2 = add nsw i64 %conv, -48
%mul = mul nsw i64 %sub2, %c.0.lcssa.i
%add = add nsw i64 %mul, %accumulator.tr12
%tobool.not = icmp eq i64 %sub, 0
%indvar.next = add i64 %indvar, 1
br i1 %tobool.not, label %cond.end, label %cond.false
cond.end: ; preds = %POW.exit, %entry
%accumulator.tr.lcssa = phi i64 [ 0, %entry ], [ %add, %POW.exit ]
ret i64 %accumulator.tr.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #7 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = zext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 -1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #7 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = sext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 1, i32 %cond
ret i32 %cond2
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #8 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #13
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #9
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #8 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @downll) #13
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp1(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #7 {
entry:
%0 = load i64, ptr %p, align 8, !tbaa !21
%1 = load i64, ptr %q, align 8, !tbaa !21
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp2(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #7 {
entry:
%0 = load i64, ptr %q, align 8, !tbaa !21
%1 = load i64, ptr %p, align 8, !tbaa !21
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @strsortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #8 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 16, ptr noundef nonnull @cmp1) #13
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @strsortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #8 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 16, ptr noundef nonnull @cmp2) #13
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #8 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #13
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp eq i64 %0, 1
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%smax = call i64 @llvm.smax.i64(i64 %0, i64 0)
%1 = add nuw i64 %smax, 1
br label %for.cond
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup26
for.cond: ; preds = %for.cond.preheader, %for.body
%i.0 = phi i64 [ %add3, %for.body ], [ 1, %for.cond.preheader ]
%exitcond = icmp eq i64 %i.0, %1
br i1 %exitcond, label %cleanup, label %for.body
for.body: ; preds = %for.cond
%add3 = add nuw i64 %i.0, 1
%mul = mul nsw i64 %add3, %i.0
%div36 = lshr i64 %mul, 1
%cmp4 = icmp sgt i64 %div36, %0
br i1 %cmp4, label %if.then5, label %for.cond, !llvm.loop !23
if.then5: ; preds = %for.body
%sub = sub nsw i64 %div36, %0
br label %cleanup
cleanup: ; preds = %for.cond, %if.then5
%out.0 = phi i64 [ %sub, %if.then5 ], [ 0, %for.cond ]
%mark.0 = phi i64 [ %add3, %if.then5 ], [ 2, %for.cond ]
%smax38 = call i64 @llvm.smax.i64(i64 %mark.0, i64 2)
br label %for.body15
for.body15: ; preds = %cleanup, %for.inc20
%i10.037 = phi i64 [ 1, %cleanup ], [ %inc21, %for.inc20 ]
%cmp16.not = icmp eq i64 %i10.037, %out.0
br i1 %cmp16.not, label %for.inc20, label %if.then17
if.then17: ; preds = %for.body15
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %i10.037)
br label %for.inc20
for.inc20: ; preds = %for.body15, %if.then17
%inc21 = add nuw nsw i64 %i10.037, 1
%exitcond39.not = icmp eq i64 %inc21, %smax38
br i1 %exitcond39.not, label %cleanup26, label %for.body15, !llvm.loop !24
cleanup26: ; preds = %for.inc20, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #13
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #11
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smin.v2i64(<2 x i64>, <2 x i64>) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smin.v2i64(<2 x i64>) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x i64>) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smax.v2i64(<2 x i64>) #11
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree 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 #8 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { 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 #10 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #12 = { nofree nounwind }
attributes #13 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !17}
!20 = !{!7, !7, i64 0}
!21 = !{!22, !6, i64 0}
!22 = !{!"", !6, i64 0, !6, i64 8}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
|
/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
#include <math.h>
int main()
{
signed long n,mid_term,first_digit,i,k,j,count,final_Result,curr_num,temp,d=0;
signed char max[6]={0};
signed long result_forward[10][10]={0};
final_Result = 0;
scanf("%ld",&n);
temp = n;
while(temp != 0)
{
max[d] = temp%10;
temp = temp/10;
d++;
}
if(d>=3)
{
mid_term = (n/10)%(signed long)(pow(10,(d-2)));
}
first_digit = n%10;
for(i=0;i<10;i++)
{
for(j=1;j<10;j++)
{
k = 1;
count = 0;
while(k<d )
{
if(k<d-1)
{
count = count + pow(10,k-1);
}
else if(k==d-1)
{
curr_num = i+j*(signed long)(pow(10,k));
if(j<max[k] && curr_num<=n)
{
count = count + pow(10,k-1);
}
else if(j==max[k] && d>2 && curr_num<=n)
{
if(i<=first_digit)
{
count = count + mid_term + 1;
}else
{
count = count + mid_term;
}
}
else if(j==max[k] && d==2 && curr_num<=n)
{
count++;
}
}
k++;
}
result_forward[i][j] = count;
}
}
for(i=1;i<10;i++)
{
result_forward[i][i]++;
}
for(i=1;i<10;i++)
{
for(j=1;j<10;j++)
{
{
final_Result = final_Result + result_forward[i][j]*result_forward[j][i];
}
}
}
if(n<10)
{
printf("%ld",n);
}
else
printf("%ld",final_Result);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218899/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218899/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%max = alloca [6 x i8], align 1
%result_forward = alloca [10 x [10 x i64]], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %max) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(6) %max, i8 0, i64 6, i1 false)
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %result_forward) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800) %result_forward, i8 0, i64 800, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not186 = icmp eq i64 %0, 0
br i1 %cmp.not186, label %for.cond11.preheader.preheader, label %while.body
while.body: ; preds = %entry, %while.body
%d.0188 = phi i64 [ %inc, %while.body ], [ 0, %entry ]
%temp.0187 = phi i64 [ %div, %while.body ], [ %0, %entry ]
%rem = srem i64 %temp.0187, 10
%conv = trunc i64 %rem to i8
%arrayidx = getelementptr inbounds [6 x i8], ptr %max, i64 0, i64 %d.0188
store i8 %conv, ptr %arrayidx, align 1, !tbaa !9
%div = sdiv i64 %temp.0187, 10
%inc = add nuw nsw i64 %d.0188, 1
%temp.0187.off = add i64 %temp.0187, 9
%cmp.not = icmp ult i64 %temp.0187.off, 19
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %while.body
%cmp1 = icmp ugt i64 %d.0188, 1
br i1 %cmp1, label %if.end.thread, label %if.end
if.end.thread: ; preds = %while.end
%div3 = sdiv i64 %0, 10
%sub = add nsw i64 %d.0188, -1
%conv4 = sitofp i64 %sub to double
%call5 = call double @pow(double noundef 1.000000e+01, double noundef %conv4) #5
%conv6 = fptosi double %call5 to i64
%rem7 = srem i64 %div3, %conv6
%.pre = load i64, ptr %n, align 8, !tbaa !5
%add64288 = add nsw i64 %rem7, 1
br label %for.cond11.preheader.us.preheader
if.end: ; preds = %while.end
%cmp16189 = icmp eq i64 %d.0188, 1
%cmp75 = icmp ne i64 %inc, 2
br i1 %cmp16189, label %for.cond11.preheader.us.preheader, label %for.cond11.preheader.preheader
for.cond11.preheader.preheader: ; preds = %entry, %if.end
%1 = getelementptr inbounds i8, ptr %result_forward, i64 96
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(72) %1, i8 0, i64 64, i1 false), !tbaa !5
%scevgep.2 = getelementptr inbounds i8, ptr %result_forward, i64 168
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %scevgep.2, i8 0, i64 72, i1 false), !tbaa !5
%scevgep.3 = getelementptr inbounds i8, ptr %result_forward, i64 248
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %scevgep.3, i8 0, i64 72, i1 false), !tbaa !5
%scevgep.4 = getelementptr inbounds i8, ptr %result_forward, i64 328
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %scevgep.4, i8 0, i64 72, i1 false), !tbaa !5
%scevgep.5 = getelementptr inbounds i8, ptr %result_forward, i64 408
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %scevgep.5, i8 0, i64 72, i1 false), !tbaa !5
%scevgep.6 = getelementptr inbounds i8, ptr %result_forward, i64 488
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %scevgep.6, i8 0, i64 72, i1 false), !tbaa !5
%scevgep.7 = getelementptr inbounds i8, ptr %result_forward, i64 568
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %scevgep.7, i8 0, i64 72, i1 false), !tbaa !5
%scevgep.8 = getelementptr inbounds i8, ptr %result_forward, i64 648
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %scevgep.8, i8 0, i64 72, i1 false), !tbaa !5
%scevgep.9 = getelementptr inbounds i8, ptr %result_forward, i64 728
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %scevgep.9, i8 0, i64 64, i1 false), !tbaa !5
br label %for.cond95.preheader
for.cond11.preheader.us.preheader: ; preds = %if.end.thread, %if.end
%cmp75296 = phi i1 [ true, %if.end.thread ], [ %cmp75, %if.end ]
%add64295 = phi i64 [ %add64288, %if.end.thread ], [ undef, %if.end ]
%sub19294 = phi i64 [ %d.0188, %if.end.thread ], [ 1, %if.end ]
%rem8293.in = phi i64 [ %.pre, %if.end.thread ], [ %0, %if.end ]
%mid_term.0292 = phi i64 [ %rem7, %if.end.thread ], [ undef, %if.end ]
%d.0.lcssa280291 = phi i64 [ %inc, %if.end.thread ], [ 2, %if.end ]
%rem8293 = srem i64 %rem8293.in, 10
%conv32.us202.us = sitofp i64 %sub19294 to double
%arrayidx36.us207.us = getelementptr inbounds [6 x i8], ptr %max, i64 0, i64 %sub19294
%sub44.us214.us = add nsw i64 %d.0.lcssa280291, -2
%conv45.us215.us = sitofp i64 %sub44.us214.us to double
%conv32.us.us.us.us = sitofp i64 %sub19294 to double
%arrayidx36.us.us.us.us = getelementptr inbounds [6 x i8], ptr %max, i64 0, i64 %sub19294
%sub44.us.us.us.us = add nsw i64 %d.0.lcssa280291, -2
%conv45.us.us.us.us = sitofp i64 %sub44.us.us.us.us to double
br label %for.cond11.preheader.us
for.cond11.preheader.us: ; preds = %for.cond11.preheader.us.preheader, %for.inc92.split.us.us
%i.0246.us = phi i64 [ %inc93.us, %for.inc92.split.us.us ], [ 0, %for.cond11.preheader.us.preheader ]
%cmp61.not.us = icmp sgt i64 %i.0246.us, %rem8293
%cmp61.not.fr.us = freeze i1 %cmp61.not.us
br i1 %cmp61.not.fr.us, label %while.cond15.preheader.us.us.us, label %while.cond15.preheader.us.us248
while.cond15.preheader.us.us248: ; preds = %for.cond11.preheader.us, %while.cond15.while.end88_crit_edge.split.us243.us
%j.0193.us.us249 = phi i64 [ %inc91.us.us251, %while.cond15.while.end88_crit_edge.split.us243.us ], [ 1, %for.cond11.preheader.us ]
br label %while.body18.us195.us
while.body18.us195.us: ; preds = %if.end86.us239.us, %while.cond15.preheader.us.us248
%count.0191.us196.us = phi i64 [ 0, %while.cond15.preheader.us.us248 ], [ %count.1.us240.us, %if.end86.us239.us ]
%k.0190.us197.us = phi i64 [ 1, %while.cond15.preheader.us.us248 ], [ %inc87.us241.us, %if.end86.us239.us ]
%cmp20.us198.us = icmp ult i64 %k.0190.us197.us, %sub19294
br i1 %cmp20.us198.us, label %if.then22.us232.us, label %if.else.us199.us
if.else.us199.us: ; preds = %while.body18.us195.us
%cmp29.us200.us = icmp eq i64 %k.0190.us197.us, %sub19294
br i1 %cmp29.us200.us, label %if.then31.us201.us, label %if.end86.us239.us
if.then31.us201.us: ; preds = %if.else.us199.us
%call33.us203.us = call double @pow(double noundef 1.000000e+01, double noundef %conv32.us202.us) #5
%conv34.us204.us = fptosi double %call33.us203.us to i64
%mul.us205.us = mul nsw i64 %j.0193.us.us249, %conv34.us204.us
%add35.us206.us = add nsw i64 %mul.us205.us, %i.0246.us
%2 = load i8, ptr %arrayidx36.us207.us, align 1, !tbaa !9
%conv37.us208.us = sext i8 %2 to i64
%cmp38.us209.us = icmp sge i64 %j.0193.us.us249, %conv37.us208.us
%3 = load i64, ptr %n, align 8
%cmp40.not.us210.us = icmp sgt i64 %add35.us206.us, %3
%or.cond183.us211.us = select i1 %cmp38.us209.us, i1 true, i1 %cmp40.not.us210.us
br i1 %or.cond183.us211.us, label %if.else49.us219.us, label %if.then42.us212.us
if.then42.us212.us: ; preds = %if.then31.us201.us
%conv43.us213.us = sitofp i64 %count.0191.us196.us to double
%call46.us216.us = call double @pow(double noundef 1.000000e+01, double noundef %conv45.us215.us) #5
%add47.us217.us = fadd double %call46.us216.us, %conv43.us213.us
%conv48.us218.us = fptosi double %add47.us217.us to i64
br label %if.end86.us239.us
if.else49.us219.us: ; preds = %if.then31.us201.us
%cmp52.us220.us = icmp eq i64 %j.0193.us.us249, %conv37.us208.us
%or.cond.us221.us = and i1 %cmp1, %cmp52.us220.us
%or.cond.not.us222.us = xor i1 %or.cond.us221.us, true
%or.cond184.us223.us = select i1 %or.cond.not.us222.us, i1 true, i1 %cmp40.not.us210.us
br i1 %or.cond184.us223.us, label %if.else69.us225.us, label %if.then60.us224.us
if.then60.us224.us: ; preds = %if.else49.us219.us
%add65.us.us = add i64 %add64295, %count.0191.us196.us
br label %if.end86.us239.us
if.else69.us225.us: ; preds = %if.else49.us219.us
%not.cmp52.us226.us = xor i1 %cmp52.us220.us, true
%or.cond132.us227.us = or i1 %cmp75296, %not.cmp52.us226.us
%or.cond185.us228.us = select i1 %or.cond132.us227.us, i1 true, i1 %cmp40.not.us210.us
%not.or.cond185.us229.us = xor i1 %or.cond185.us228.us, true
%inc81.us230.us = zext i1 %not.or.cond185.us229.us to i64
%spec.select.us231.us = add nsw i64 %count.0191.us196.us, %inc81.us230.us
br label %if.end86.us239.us
if.then22.us232.us: ; preds = %while.body18.us195.us
%conv23.us233.us = sitofp i64 %count.0191.us196.us to double
%sub24.us234.us = add nsw i64 %k.0190.us197.us, -1
%conv25.us235.us = sitofp i64 %sub24.us234.us to double
%call26.us236.us = call double @pow(double noundef 1.000000e+01, double noundef %conv25.us235.us) #5
%add.us237.us = fadd double %call26.us236.us, %conv23.us233.us
%conv27.us238.us = fptosi double %add.us237.us to i64
br label %if.end86.us239.us
if.end86.us239.us: ; preds = %if.then22.us232.us, %if.else69.us225.us, %if.then60.us224.us, %if.then42.us212.us, %if.else.us199.us
%count.1.us240.us = phi i64 [ %conv27.us238.us, %if.then22.us232.us ], [ %conv48.us218.us, %if.then42.us212.us ], [ %add65.us.us, %if.then60.us224.us ], [ %count.0191.us196.us, %if.else.us199.us ], [ %spec.select.us231.us, %if.else69.us225.us ]
%inc87.us241.us = add nuw nsw i64 %k.0190.us197.us, 1
%exitcond.not = icmp eq i64 %inc87.us241.us, %d.0.lcssa280291
br i1 %exitcond.not, label %while.cond15.while.end88_crit_edge.split.us243.us, label %while.body18.us195.us, !llvm.loop !12
while.cond15.while.end88_crit_edge.split.us243.us: ; preds = %if.end86.us239.us
%arrayidx90.us.us250 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 %i.0246.us, i64 %j.0193.us.us249
store i64 %count.1.us240.us, ptr %arrayidx90.us.us250, align 8, !tbaa !5
%inc91.us.us251 = add nuw nsw i64 %j.0193.us.us249, 1
%exitcond262.not = icmp eq i64 %inc91.us.us251, 10
br i1 %exitcond262.not, label %for.inc92.split.us.us, label %while.cond15.preheader.us.us248, !llvm.loop !13
for.inc92.split.us.us: ; preds = %while.cond15.while.end88_crit_edge.split.us243.us, %while.cond15.while.end88_crit_edge.split.us.us.us.us
%inc93.us = add nuw nsw i64 %i.0246.us, 1
%exitcond265.not = icmp eq i64 %inc93.us, 10
br i1 %exitcond265.not, label %for.cond95.preheader.loopexit, label %for.cond11.preheader.us, !llvm.loop !14
while.cond15.preheader.us.us.us: ; preds = %for.cond11.preheader.us, %while.cond15.while.end88_crit_edge.split.us.us.us.us
%j.0193.us.us.us = phi i64 [ %inc91.us.us.us, %while.cond15.while.end88_crit_edge.split.us.us.us.us ], [ 1, %for.cond11.preheader.us ]
br label %while.body18.us.us.us.us
while.body18.us.us.us.us: ; preds = %if.end86.us.us.us.us, %while.cond15.preheader.us.us.us
%count.0191.us.us.us.us = phi i64 [ 0, %while.cond15.preheader.us.us.us ], [ %count.1.us.us.us.us, %if.end86.us.us.us.us ]
%k.0190.us.us.us.us = phi i64 [ 1, %while.cond15.preheader.us.us.us ], [ %inc87.us.us.us.us, %if.end86.us.us.us.us ]
%cmp20.us.us.us.us = icmp ult i64 %k.0190.us.us.us.us, %sub19294
br i1 %cmp20.us.us.us.us, label %if.then22.us.us.us.us, label %if.else.us.us.us.us
if.else.us.us.us.us: ; preds = %while.body18.us.us.us.us
%cmp29.us.us.us.us = icmp eq i64 %k.0190.us.us.us.us, %sub19294
br i1 %cmp29.us.us.us.us, label %if.then31.us.us.us.us, label %if.end86.us.us.us.us
if.then31.us.us.us.us: ; preds = %if.else.us.us.us.us
%call33.us.us.us.us = call double @pow(double noundef 1.000000e+01, double noundef %conv32.us.us.us.us) #5
%conv34.us.us.us.us = fptosi double %call33.us.us.us.us to i64
%mul.us.us.us.us = mul nsw i64 %j.0193.us.us.us, %conv34.us.us.us.us
%add35.us.us.us.us = add nsw i64 %mul.us.us.us.us, %i.0246.us
%4 = load i8, ptr %arrayidx36.us.us.us.us, align 1, !tbaa !9
%conv37.us.us.us.us = sext i8 %4 to i64
%cmp38.us.us.us.us = icmp sge i64 %j.0193.us.us.us, %conv37.us.us.us.us
%5 = load i64, ptr %n, align 8
%cmp40.not.us.us.us.us = icmp sgt i64 %add35.us.us.us.us, %5
%or.cond183.us.us.us.us = select i1 %cmp38.us.us.us.us, i1 true, i1 %cmp40.not.us.us.us.us
br i1 %or.cond183.us.us.us.us, label %if.else49.us.us.us.us, label %if.then42.us.us.us.us
if.then42.us.us.us.us: ; preds = %if.then31.us.us.us.us
%conv43.us.us.us.us = sitofp i64 %count.0191.us.us.us.us to double
%call46.us.us.us.us = call double @pow(double noundef 1.000000e+01, double noundef %conv45.us.us.us.us) #5
%add47.us.us.us.us = fadd double %call46.us.us.us.us, %conv43.us.us.us.us
%conv48.us.us.us.us = fptosi double %add47.us.us.us.us to i64
br label %if.end86.us.us.us.us
if.else49.us.us.us.us: ; preds = %if.then31.us.us.us.us
%cmp52.us.us.us.us = icmp eq i64 %j.0193.us.us.us, %conv37.us.us.us.us
%or.cond.us.us.us.us = and i1 %cmp1, %cmp52.us.us.us.us
%or.cond.not.us.us.us.us = xor i1 %or.cond.us.us.us.us, true
%or.cond184.us.us.us.us = select i1 %or.cond.not.us.us.us.us, i1 true, i1 %cmp40.not.us.us.us.us
br i1 %or.cond184.us.us.us.us, label %if.else69.us.us.us.us, label %if.then60.us.us.us.us
if.then60.us.us.us.us: ; preds = %if.else49.us.us.us.us
%add67.us.us.us.us = add nsw i64 %count.0191.us.us.us.us, %mid_term.0292
br label %if.end86.us.us.us.us
if.else69.us.us.us.us: ; preds = %if.else49.us.us.us.us
%not.cmp52.us.us.us.us = xor i1 %cmp52.us.us.us.us, true
%or.cond132.us.us.us.us = or i1 %cmp75296, %not.cmp52.us.us.us.us
%or.cond185.us.us.us.us = select i1 %or.cond132.us.us.us.us, i1 true, i1 %cmp40.not.us.us.us.us
%not.or.cond185.us.us.us.us = xor i1 %or.cond185.us.us.us.us, true
%inc81.us.us.us.us = zext i1 %not.or.cond185.us.us.us.us to i64
%spec.select.us.us.us.us = add nsw i64 %count.0191.us.us.us.us, %inc81.us.us.us.us
br label %if.end86.us.us.us.us
if.then22.us.us.us.us: ; preds = %while.body18.us.us.us.us
%conv23.us.us.us.us = sitofp i64 %count.0191.us.us.us.us to double
%sub24.us.us.us.us = add nsw i64 %k.0190.us.us.us.us, -1
%conv25.us.us.us.us = sitofp i64 %sub24.us.us.us.us to double
%call26.us.us.us.us = call double @pow(double noundef 1.000000e+01, double noundef %conv25.us.us.us.us) #5
%add.us.us.us.us = fadd double %call26.us.us.us.us, %conv23.us.us.us.us
%conv27.us.us.us.us = fptosi double %add.us.us.us.us to i64
br label %if.end86.us.us.us.us
if.end86.us.us.us.us: ; preds = %if.then22.us.us.us.us, %if.else69.us.us.us.us, %if.then60.us.us.us.us, %if.then42.us.us.us.us, %if.else.us.us.us.us
%count.1.us.us.us.us = phi i64 [ %conv27.us.us.us.us, %if.then22.us.us.us.us ], [ %conv48.us.us.us.us, %if.then42.us.us.us.us ], [ %add67.us.us.us.us, %if.then60.us.us.us.us ], [ %count.0191.us.us.us.us, %if.else.us.us.us.us ], [ %spec.select.us.us.us.us, %if.else69.us.us.us.us ]
%inc87.us.us.us.us = add nuw nsw i64 %k.0190.us.us.us.us, 1
%exitcond263.not = icmp eq i64 %inc87.us.us.us.us, %d.0.lcssa280291
br i1 %exitcond263.not, label %while.cond15.while.end88_crit_edge.split.us.us.us.us, label %while.body18.us.us.us.us, !llvm.loop !12
while.cond15.while.end88_crit_edge.split.us.us.us.us: ; preds = %if.end86.us.us.us.us
%arrayidx90.us.us.us = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 %i.0246.us, i64 %j.0193.us.us.us
store i64 %count.1.us.us.us.us, ptr %arrayidx90.us.us.us, align 8, !tbaa !5
%inc91.us.us.us = add nuw nsw i64 %j.0193.us.us.us, 1
%exitcond264.not = icmp eq i64 %inc91.us.us.us, 10
br i1 %exitcond264.not, label %for.inc92.split.us.us, label %while.cond15.preheader.us.us.us, !llvm.loop !13
for.cond95.preheader.loopexit: ; preds = %for.inc92.split.us.us
%arrayidx100.phi.trans.insert = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 1, i64 1
%.pre269 = load i64, ptr %arrayidx100.phi.trans.insert, align 8, !tbaa !5
%arrayidx100.1.phi.trans.insert = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 2, i64 2
%.pre270 = load i64, ptr %arrayidx100.1.phi.trans.insert, align 16, !tbaa !5
%arrayidx100.2.phi.trans.insert = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 3, i64 3
%.pre271 = load i64, ptr %arrayidx100.2.phi.trans.insert, align 8, !tbaa !5
%arrayidx100.3.phi.trans.insert = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 4, i64 4
%.pre272 = load i64, ptr %arrayidx100.3.phi.trans.insert, align 16, !tbaa !5
%arrayidx100.4.phi.trans.insert = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 5, i64 5
%.pre273 = load i64, ptr %arrayidx100.4.phi.trans.insert, align 8, !tbaa !5
%arrayidx100.5.phi.trans.insert = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 6, i64 6
%.pre274 = load i64, ptr %arrayidx100.5.phi.trans.insert, align 16, !tbaa !5
%arrayidx100.6.phi.trans.insert = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 7, i64 7
%.pre275 = load i64, ptr %arrayidx100.6.phi.trans.insert, align 8, !tbaa !5
%arrayidx100.7.phi.trans.insert = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 8, i64 8
%.pre276 = load i64, ptr %arrayidx100.7.phi.trans.insert, align 16, !tbaa !5
%arrayidx100.8.phi.trans.insert = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 9, i64 9
%.pre277 = load i64, ptr %arrayidx100.8.phi.trans.insert, align 8, !tbaa !5
%6 = add nsw i64 %.pre269, 1
%7 = add nsw i64 %.pre270, 1
%8 = add nsw i64 %.pre271, 1
%9 = add nsw i64 %.pre272, 1
%10 = add nsw i64 %.pre273, 1
%11 = add nsw i64 %.pre274, 1
%12 = add nsw i64 %.pre275, 1
%13 = add nsw i64 %.pre276, 1
%14 = add nsw i64 %.pre277, 1
br label %for.cond95.preheader
for.cond95.preheader: ; preds = %for.cond11.preheader.preheader, %for.cond95.preheader.loopexit
%inc101.8 = phi i64 [ 1, %for.cond11.preheader.preheader ], [ %14, %for.cond95.preheader.loopexit ]
%inc101.7 = phi i64 [ 1, %for.cond11.preheader.preheader ], [ %13, %for.cond95.preheader.loopexit ]
%inc101.6 = phi i64 [ 1, %for.cond11.preheader.preheader ], [ %12, %for.cond95.preheader.loopexit ]
%inc101.5 = phi i64 [ 1, %for.cond11.preheader.preheader ], [ %11, %for.cond95.preheader.loopexit ]
%inc101.4 = phi i64 [ 1, %for.cond11.preheader.preheader ], [ %10, %for.cond95.preheader.loopexit ]
%inc101.3 = phi i64 [ 1, %for.cond11.preheader.preheader ], [ %9, %for.cond95.preheader.loopexit ]
%inc101.2 = phi i64 [ 1, %for.cond11.preheader.preheader ], [ %8, %for.cond95.preheader.loopexit ]
%inc101.1 = phi i64 [ 1, %for.cond11.preheader.preheader ], [ %7, %for.cond95.preheader.loopexit ]
%inc101 = phi i64 [ 1, %for.cond11.preheader.preheader ], [ %6, %for.cond95.preheader.loopexit ]
%arrayidx100 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 1, i64 1
store i64 %inc101, ptr %arrayidx100, align 8, !tbaa !5
%arrayidx100.1 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 2, i64 2
store i64 %inc101.1, ptr %arrayidx100.1, align 16, !tbaa !5
%arrayidx100.2 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 3, i64 3
store i64 %inc101.2, ptr %arrayidx100.2, align 8, !tbaa !5
%arrayidx100.3 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 4, i64 4
store i64 %inc101.3, ptr %arrayidx100.3, align 16, !tbaa !5
%arrayidx100.4 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 5, i64 5
store i64 %inc101.4, ptr %arrayidx100.4, align 8, !tbaa !5
%arrayidx100.5 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 6, i64 6
store i64 %inc101.5, ptr %arrayidx100.5, align 16, !tbaa !5
%arrayidx100.6 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 7, i64 7
store i64 %inc101.6, ptr %arrayidx100.6, align 8, !tbaa !5
%arrayidx100.7 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 8, i64 8
store i64 %inc101.7, ptr %arrayidx100.7, align 16, !tbaa !5
%arrayidx100.8 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 9, i64 9
store i64 %inc101.8, ptr %arrayidx100.8, align 8, !tbaa !5
br label %for.cond109.preheader
for.cond109.preheader: ; preds = %for.cond95.preheader, %for.cond109.preheader
%final_Result.0259 = phi i64 [ %add118.8, %for.cond109.preheader ], [ 0, %for.cond95.preheader ]
%i.2258 = phi i64 [ %inc123, %for.cond109.preheader ], [ 1, %for.cond95.preheader ]
%arrayidx114 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 %i.2258, i64 1
%15 = load i64, ptr %arrayidx114, align 8, !tbaa !5
%arrayidx116 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 1, i64 %i.2258
%16 = load i64, ptr %arrayidx116, align 8, !tbaa !5
%mul117 = mul nsw i64 %16, %15
%add118 = add nsw i64 %mul117, %final_Result.0259
%arrayidx114.1 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 %i.2258, i64 2
%17 = load i64, ptr %arrayidx114.1, align 16, !tbaa !5
%arrayidx116.1 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 2, i64 %i.2258
%18 = load i64, ptr %arrayidx116.1, align 8, !tbaa !5
%mul117.1 = mul nsw i64 %18, %17
%add118.1 = add nsw i64 %mul117.1, %add118
%arrayidx114.2 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 %i.2258, i64 3
%19 = load i64, ptr %arrayidx114.2, align 8, !tbaa !5
%arrayidx116.2 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 3, i64 %i.2258
%20 = load i64, ptr %arrayidx116.2, align 8, !tbaa !5
%mul117.2 = mul nsw i64 %20, %19
%add118.2 = add nsw i64 %mul117.2, %add118.1
%arrayidx114.3 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 %i.2258, i64 4
%21 = load i64, ptr %arrayidx114.3, align 16, !tbaa !5
%arrayidx116.3 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 4, i64 %i.2258
%22 = load i64, ptr %arrayidx116.3, align 8, !tbaa !5
%mul117.3 = mul nsw i64 %22, %21
%add118.3 = add nsw i64 %mul117.3, %add118.2
%arrayidx114.4 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 %i.2258, i64 5
%23 = load i64, ptr %arrayidx114.4, align 8, !tbaa !5
%arrayidx116.4 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 5, i64 %i.2258
%24 = load i64, ptr %arrayidx116.4, align 8, !tbaa !5
%mul117.4 = mul nsw i64 %24, %23
%add118.4 = add nsw i64 %mul117.4, %add118.3
%arrayidx114.5 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 %i.2258, i64 6
%25 = load i64, ptr %arrayidx114.5, align 16, !tbaa !5
%arrayidx116.5 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 6, i64 %i.2258
%26 = load i64, ptr %arrayidx116.5, align 8, !tbaa !5
%mul117.5 = mul nsw i64 %26, %25
%add118.5 = add nsw i64 %mul117.5, %add118.4
%arrayidx114.6 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 %i.2258, i64 7
%27 = load i64, ptr %arrayidx114.6, align 8, !tbaa !5
%arrayidx116.6 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 7, i64 %i.2258
%28 = load i64, ptr %arrayidx116.6, align 8, !tbaa !5
%mul117.6 = mul nsw i64 %28, %27
%add118.6 = add nsw i64 %mul117.6, %add118.5
%arrayidx114.7 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 %i.2258, i64 8
%29 = load i64, ptr %arrayidx114.7, align 16, !tbaa !5
%arrayidx116.7 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 8, i64 %i.2258
%30 = load i64, ptr %arrayidx116.7, align 8, !tbaa !5
%mul117.7 = mul nsw i64 %30, %29
%add118.7 = add nsw i64 %mul117.7, %add118.6
%arrayidx114.8 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 %i.2258, i64 9
%31 = load i64, ptr %arrayidx114.8, align 8, !tbaa !5
%arrayidx116.8 = getelementptr inbounds [10 x [10 x i64]], ptr %result_forward, i64 0, i64 9, i64 %i.2258
%32 = load i64, ptr %arrayidx116.8, align 8, !tbaa !5
%mul117.8 = mul nsw i64 %32, %31
%add118.8 = add nsw i64 %mul117.8, %add118.7
%inc123 = add nuw nsw i64 %i.2258, 1
%exitcond268.not = icmp eq i64 %inc123, 10
br i1 %exitcond268.not, label %for.end124, label %for.cond109.preheader, !llvm.loop !15
for.end124: ; preds = %for.cond109.preheader
%33 = load i64, ptr %n, align 8, !tbaa !5
%cmp125 = icmp slt i64 %33, 10
%.add118.8.lcssa = select i1 %cmp125, i64 %33, i64 %add118.8
%call130 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %.add118.8.lcssa)
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %result_forward) #5
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %max) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double 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) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
|
#include<stdio.h>
long long int count(long long int a, long long int b, long long int n)
{
long long int res = 0;
if (a == b && a <= n)res++;
long long int max, min;
max = min = 10 * a + b;
while (max <= n)
{
res += (max - min + 10) / 10;
max = (max - b + 9) * 10 + b;
min = (min - b) * 10 + b;
}
while (n % 10 != b && n >= 0)n--;
if (n >= min)
res += (n - min + 10) / 10;
return res;
}
int main()
{
long long int n;
scanf("%lld", &n);
long long int i, j, k;
long long int ans = 0;
for (i = 1; i < 10; i++)
for (j = 1; j < 10; j++)
ans += count(i, j, n) * count(j, i, n);
printf("%lld\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218941/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218941/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @count(i64 noundef %a, i64 noundef %b, i64 noundef %n) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i64 %a, %b
%cmp1.not = icmp sle i64 %a, %n
%or.cond.not = and i1 %cmp, %cmp1.not
%res.0 = zext i1 %or.cond.not to i64
%mul = mul nsw i64 %a, 10
%add = add nsw i64 %mul, %b
%min.0.neg46 = sub i64 0, %add
%cmp2.not47 = icmp sgt i64 %add, %n
br i1 %cmp2.not47, label %while.cond12.preheader, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%mul7 = add i64 %b, 90
br label %while.body
while.cond12.preheader: ; preds = %while.body, %entry
%res.1.lcssa = phi i64 [ %res.0, %entry ], [ %add4, %while.body ]
%min.0.lcssa = phi i64 [ %add, %entry ], [ %add11, %while.body ]
%min.0.neg.lcssa = phi i64 [ %min.0.neg46, %entry ], [ %min.0.neg, %while.body ]
br label %while.cond12
while.body: ; preds = %while.body.lr.ph, %while.body
%min.0.neg51 = phi i64 [ %min.0.neg46, %while.body.lr.ph ], [ %min.0.neg, %while.body ]
%min.050 = phi i64 [ %add, %while.body.lr.ph ], [ %add11, %while.body ]
%max.049 = phi i64 [ %add, %while.body.lr.ph ], [ %add8, %while.body ]
%res.148 = phi i64 [ %res.0, %while.body.lr.ph ], [ %add4, %while.body ]
%sub = add i64 %max.049, 10
%add3 = add i64 %sub, %min.0.neg51
%div = sdiv i64 %add3, 10
%add4 = add nsw i64 %div, %res.148
%sub5 = sub nsw i64 %max.049, %b
%0 = mul i64 %sub5, 10
%add8 = add i64 %mul7, %0
%sub9 = sub nsw i64 %min.050, %b
%mul10 = mul nsw i64 %sub9, 10
%add11 = add nsw i64 %mul10, %b
%min.0.neg = sub i64 0, %add11
%cmp2.not = icmp sgt i64 %add8, %n
br i1 %cmp2.not, label %while.cond12.preheader, label %while.body, !llvm.loop !5
while.cond12: ; preds = %while.cond12, %while.cond12.preheader
%n.addr.0 = phi i64 [ %dec, %while.cond12 ], [ %n, %while.cond12.preheader ]
%rem = srem i64 %n.addr.0, 10
%cmp13 = icmp ne i64 %rem, %b
%cmp14 = icmp sgt i64 %n.addr.0, -1
%1 = and i1 %cmp14, %cmp13
%dec = add nsw i64 %n.addr.0, -1
br i1 %1, label %while.cond12, label %while.end16, !llvm.loop !7
while.end16: ; preds = %while.cond12
%cmp17.not = icmp slt i64 %n.addr.0, %min.0.lcssa
br i1 %cmp17.not, label %if.end23, label %if.then18
if.then18: ; preds = %while.end16
%sub19 = add i64 %min.0.neg.lcssa, 10
%add20 = add i64 %sub19, %n.addr.0
%div21 = sdiv i64 %add20, 10
%add22 = add nsw i64 %div21, %res.1.lcssa
br label %if.end23
if.end23: ; preds = %if.then18, %while.end16
%res.2 = phi i64 [ %add22, %if.then18 ], [ %res.1.lcssa, %while.end16 ]
ret i64 %res.2
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !8
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc6
%ans.065 = phi i64 [ 0, %entry ], [ %add, %for.inc6 ]
%i.064 = phi i64 [ 1, %entry ], [ %inc7, %for.inc6 ]
%cmp1.not.i = icmp sle i64 %i.064, %0
%mul.i = mul nuw nsw i64 %i.064, 10
%mul7.i26 = add nuw nsw i64 %i.064, 90
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %count.exit61
%ans.163 = phi i64 [ %ans.065, %for.cond1.preheader ], [ %add, %count.exit61 ]
%j.062 = phi i64 [ 1, %for.cond1.preheader ], [ %inc, %count.exit61 ]
%cmp.i = icmp eq i64 %i.064, %j.062
%or.cond.not.i = and i1 %cmp.i, %cmp1.not.i
%res.0.i = zext i1 %or.cond.not.i to i64
%add.i = add nuw nsw i64 %j.062, %mul.i
%min.0.neg46.i = sub nsw i64 0, %add.i
%cmp2.not47.i = icmp sgt i64 %add.i, %0
br i1 %cmp2.not47.i, label %while.cond12.preheader.i, label %while.body.lr.ph.i
while.body.lr.ph.i: ; preds = %for.body3
%mul7.i = add nuw nsw i64 %j.062, 90
br label %while.body.i
while.cond12.preheader.i: ; preds = %while.body.i, %for.body3
%res.1.lcssa.i = phi i64 [ %res.0.i, %for.body3 ], [ %add4.i, %while.body.i ]
%min.0.lcssa.i = phi i64 [ %add.i, %for.body3 ], [ %add11.i, %while.body.i ]
%min.0.neg.lcssa.i = phi i64 [ %min.0.neg46.i, %for.body3 ], [ %min.0.neg.i, %while.body.i ]
br label %while.cond12.i
while.body.i: ; preds = %while.body.i, %while.body.lr.ph.i
%min.0.neg51.i = phi i64 [ %min.0.neg46.i, %while.body.lr.ph.i ], [ %min.0.neg.i, %while.body.i ]
%min.050.i = phi i64 [ %add.i, %while.body.lr.ph.i ], [ %add11.i, %while.body.i ]
%max.049.i = phi i64 [ %add.i, %while.body.lr.ph.i ], [ %add8.i, %while.body.i ]
%res.148.i = phi i64 [ %res.0.i, %while.body.lr.ph.i ], [ %add4.i, %while.body.i ]
%sub.i = add i64 %min.0.neg51.i, 10
%add3.i = add i64 %sub.i, %max.049.i
%div.i = sdiv i64 %add3.i, 10
%add4.i = add nsw i64 %div.i, %res.148.i
%sub5.i = sub nsw i64 %max.049.i, %j.062
%1 = mul i64 %sub5.i, 10
%add8.i = add i64 %mul7.i, %1
%sub9.i = sub nsw i64 %min.050.i, %j.062
%mul10.i = mul nsw i64 %sub9.i, 10
%add11.i = add nsw i64 %mul10.i, %j.062
%min.0.neg.i = sub i64 0, %add11.i
%cmp2.not.i = icmp sgt i64 %add8.i, %0
br i1 %cmp2.not.i, label %while.cond12.preheader.i, label %while.body.i, !llvm.loop !5
while.cond12.i: ; preds = %while.cond12.i, %while.cond12.preheader.i
%n.addr.0.i = phi i64 [ %dec.i, %while.cond12.i ], [ %0, %while.cond12.preheader.i ]
%rem.i = srem i64 %n.addr.0.i, 10
%cmp13.i = icmp ne i64 %rem.i, %j.062
%cmp14.i = icmp sgt i64 %n.addr.0.i, -1
%2 = and i1 %cmp14.i, %cmp13.i
%dec.i = add nsw i64 %n.addr.0.i, -1
br i1 %2, label %while.cond12.i, label %while.end16.i, !llvm.loop !7
while.end16.i: ; preds = %while.cond12.i
%cmp17.not.i = icmp slt i64 %n.addr.0.i, %min.0.lcssa.i
br i1 %cmp17.not.i, label %count.exit, label %if.then18.i
if.then18.i: ; preds = %while.end16.i
%sub19.i = add i64 %min.0.neg.lcssa.i, 10
%add20.i = add i64 %sub19.i, %n.addr.0.i
%div21.i = sdiv i64 %add20.i, 10
%add22.i = add nsw i64 %div21.i, %res.1.lcssa.i
br label %count.exit
count.exit: ; preds = %while.end16.i, %if.then18.i
%res.2.i = phi i64 [ %add22.i, %if.then18.i ], [ %res.1.lcssa.i, %while.end16.i ]
%cmp1.not.i18 = icmp sle i64 %j.062, %0
%or.cond.not.i19 = and i1 %cmp.i, %cmp1.not.i18
%res.0.i20 = zext i1 %or.cond.not.i19 to i64
%mul.i21 = mul nuw nsw i64 %j.062, 10
%add.i22 = add nuw nsw i64 %mul.i21, %i.064
%min.0.neg46.i23 = sub nsw i64 0, %add.i22
%cmp2.not47.i24 = icmp sgt i64 %add.i22, %0
br i1 %cmp2.not47.i24, label %while.cond12.preheader.i43, label %while.body.i27
while.cond12.preheader.i43: ; preds = %while.body.i27, %count.exit
%res.1.lcssa.i44 = phi i64 [ %res.0.i20, %count.exit ], [ %add4.i35, %while.body.i27 ]
%min.0.lcssa.i45 = phi i64 [ %add.i22, %count.exit ], [ %add11.i40, %while.body.i27 ]
%min.0.neg.lcssa.i46 = phi i64 [ %min.0.neg46.i23, %count.exit ], [ %min.0.neg.i41, %while.body.i27 ]
br label %while.cond12.i47
while.body.i27: ; preds = %count.exit, %while.body.i27
%min.0.neg51.i28 = phi i64 [ %min.0.neg.i41, %while.body.i27 ], [ %min.0.neg46.i23, %count.exit ]
%min.050.i29 = phi i64 [ %add11.i40, %while.body.i27 ], [ %add.i22, %count.exit ]
%max.049.i30 = phi i64 [ %add8.i37, %while.body.i27 ], [ %add.i22, %count.exit ]
%res.148.i31 = phi i64 [ %add4.i35, %while.body.i27 ], [ %res.0.i20, %count.exit ]
%sub.i32 = add i64 %min.0.neg51.i28, 10
%add3.i33 = add i64 %sub.i32, %max.049.i30
%div.i34 = sdiv i64 %add3.i33, 10
%add4.i35 = add nsw i64 %div.i34, %res.148.i31
%sub5.i36 = sub nsw i64 %max.049.i30, %i.064
%3 = mul i64 %sub5.i36, 10
%add8.i37 = add i64 %mul7.i26, %3
%sub9.i38 = sub nsw i64 %min.050.i29, %i.064
%mul10.i39 = mul nsw i64 %sub9.i38, 10
%add11.i40 = add nsw i64 %mul10.i39, %i.064
%min.0.neg.i41 = sub i64 0, %add11.i40
%cmp2.not.i42 = icmp sgt i64 %add8.i37, %0
br i1 %cmp2.not.i42, label %while.cond12.preheader.i43, label %while.body.i27, !llvm.loop !5
while.cond12.i47: ; preds = %while.cond12.i47, %while.cond12.preheader.i43
%n.addr.0.i48 = phi i64 [ %dec.i52, %while.cond12.i47 ], [ %0, %while.cond12.preheader.i43 ]
%rem.i49 = srem i64 %n.addr.0.i48, 10
%cmp13.i50 = icmp ne i64 %rem.i49, %i.064
%cmp14.i51 = icmp sgt i64 %n.addr.0.i48, -1
%4 = and i1 %cmp14.i51, %cmp13.i50
%dec.i52 = add nsw i64 %n.addr.0.i48, -1
br i1 %4, label %while.cond12.i47, label %while.end16.i53, !llvm.loop !7
while.end16.i53: ; preds = %while.cond12.i47
%cmp17.not.i54 = icmp slt i64 %n.addr.0.i48, %min.0.lcssa.i45
br i1 %cmp17.not.i54, label %count.exit61, label %if.then18.i55
if.then18.i55: ; preds = %while.end16.i53
%sub19.i56 = add i64 %min.0.neg.lcssa.i46, 10
%add20.i57 = add i64 %sub19.i56, %n.addr.0.i48
%div21.i58 = sdiv i64 %add20.i57, 10
%add22.i59 = add nsw i64 %div21.i58, %res.1.lcssa.i44
br label %count.exit61
count.exit61: ; preds = %while.end16.i53, %if.then18.i55
%res.2.i60 = phi i64 [ %add22.i59, %if.then18.i55 ], [ %res.1.lcssa.i44, %while.end16.i53 ]
%mul = mul nsw i64 %res.2.i60, %res.2.i
%add = add nsw i64 %mul, %ans.163
%inc = add nuw nsw i64 %j.062, 1
%exitcond.not = icmp eq i64 %inc, 10
br i1 %exitcond.not, label %for.inc6, label %for.body3, !llvm.loop !12
for.inc6: ; preds = %count.exit61
%inc7 = add nuw nsw i64 %i.064, 1
%exitcond66.not = icmp eq i64 %inc7, 10
br i1 %exitcond66.not, label %for.end8, label %for.cond1.preheader, !llvm.loop !13
for.end8: ; preds = %for.inc6
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
|
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#define RAND(min,max) (rand()%(max-min+1)+min)
#define LOG(log) {printf("%d\n",log);}
#define DEBUG(void) {printf("\nDEBUG %d\n",num_debug);num_debug++;}
char num_debug = 0;
int main(void) {
srand((unsigned)time(NULL));
int x;
int n;
int angle=-1;
scanf("%d", &x);
for (n = 1; angle != 0; n++) {
angle = (x * n)%360;
//LOG((x * n))
}
printf("%d", n-1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_218985/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_218985/source.c"
target datalayout = "e-m:e-p270: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_debug = dso_local local_unnamed_addr global i8 0, align 1
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%call = tail call i64 @time(ptr noundef null) #4
%conv = trunc i64 %call to i32
tail call void @srand(i32 noundef %conv) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
br label %for.body
for.body: ; preds = %entry, %for.body
%n.06 = phi i32 [ 1, %entry ], [ %inc, %for.body ]
%mul = mul nsw i32 %0, %n.06
%rem = srem i32 %mul, 360
%inc = add nuw nsw i32 %n.06, 1
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %n.06)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #1
; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
#define STD 200
#define STATE_MAX 3000 /* max state = 6*0 + 6*1 + 6*2 + .... 6*30 < 3000*/
#define DIR 6
int objects[STD][STD], queue[STATE_MAX], visited[STD][STD], dir_x[DIR] = {1, 0, -1, -1, 0, 1}, dir_y[DIR] = {0, -1, -1, 0, 1, 1};
int top, bottom;
void put(int val)
{
queue[bottom++] = val;
}
int get(void)
{
return queue[top++];
}
int empty(void)
{
return top == bottom;
}
int main(void)
{
int turn, obj_n, x, y, nx, ny, getted_val, used_turn, i;
while(1)
{
scanf("%d %d", &turn, &obj_n);
if(turn == 0 && obj_n == 0)
{
break;
}
top = bottom = used_turn = 0;
memset(objects, 0, sizeof(objects));
memset(visited, 0, sizeof(visited));
while(obj_n--)
{
scanf("%d %d", &x, &y);
objects[100 + x][100 + y] = 1;
}
scanf("%d %d", &x, &y);
x += 100;
y += 100;
visited[x][y] = 1;
put(x * 1000 + y);
while(!empty())
{
getted_val = get();
x = getted_val / 1000;
y = getted_val % 1000;
used_turn = visited[x][y];
for(i = 0; i < DIR; i++)
{
nx = x + dir_x[i];
ny = y + dir_y[i];
if(!objects[nx][ny] && !visited[nx][ny] && used_turn <= turn)
{
visited[nx][ny] = used_turn + 1;
put(nx * 1000 + ny);
}
}
}
printf("%d\n", top);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219027/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219027/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@dir_x = dso_local local_unnamed_addr global [6 x i32] [i32 1, i32 0, i32 -1, i32 -1, i32 0, i32 1], align 16
@dir_y = dso_local local_unnamed_addr global [6 x i32] [i32 0, i32 -1, i32 -1, i32 0, i32 1, i32 1], align 16
@queue = dso_local local_unnamed_addr global [3000 x i32] zeroinitializer, align 16
@bottom = dso_local local_unnamed_addr global i32 0, align 4
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@objects = dso_local local_unnamed_addr global [200 x [200 x i32]] zeroinitializer, align 16
@visited = dso_local local_unnamed_addr global [200 x [200 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @put(i32 noundef %val) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @bottom, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @bottom, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [3000 x i32], ptr @queue, i64 0, i64 %idxprom
store i32 %val, 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 @get() 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 [3000 x i32], ptr @queue, 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(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @empty() local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%1 = load i32, ptr @bottom, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%turn = alloca i32, align 4
%obj_n = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %turn) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %obj_n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #6
%call90 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %turn, ptr noundef nonnull %obj_n)
%0 = load i32, ptr %turn, align 4, !tbaa !5
%cmp91 = icmp eq i32 %0, 0
%1 = load i32, ptr %obj_n, align 4
%cmp192 = icmp eq i32 %1, 0
%or.cond93 = select i1 %cmp91, i1 %cmp192, i1 false
br i1 %or.cond93, label %while.end56, label %if.end
if.end: ; preds = %entry, %while.end54
%2 = phi i32 [ %39, %while.end54 ], [ %1, %entry ]
store i32 0, ptr @bottom, align 4, !tbaa !5
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(160000) @objects, i8 0, i64 160000, i1 false)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(160000) @visited, i8 0, i64 160000, i1 false)
%dec75 = add nsw i32 %2, -1
store i32 %dec75, ptr %obj_n, align 4, !tbaa !5
%tobool.not76 = icmp eq i32 %2, 0
br i1 %tobool.not76, label %while.end, label %while.body3
while.body3: ; preds = %if.end, %while.body3
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%3 = load i32, ptr %x, align 4, !tbaa !5
%add = add nsw i32 %3, 100
%idxprom = sext i32 %add to i64
%4 = load i32, ptr %y, align 4, !tbaa !5
%add5 = add nsw i32 %4, 100
%idxprom6 = sext i32 %add5 to i64
%arrayidx7 = getelementptr inbounds [200 x [200 x i32]], ptr @objects, i64 0, i64 %idxprom, i64 %idxprom6
store i32 1, ptr %arrayidx7, align 4, !tbaa !5
%5 = load i32, ptr %obj_n, align 4, !tbaa !5
%dec = add nsw i32 %5, -1
store i32 %dec, ptr %obj_n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %5, 0
br i1 %tobool.not, label %while.end, label %while.body3, !llvm.loop !9
while.end: ; preds = %while.body3, %if.end
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%6 = load i32, ptr %x, align 4, !tbaa !5
%add9 = add nsw i32 %6, 100
store i32 %add9, ptr %x, align 4, !tbaa !5
%7 = load i32, ptr %y, align 4, !tbaa !5
%add10 = add nsw i32 %7, 100
store i32 %add10, ptr %y, align 4, !tbaa !5
%idxprom11 = sext i32 %add9 to i64
%idxprom13 = sext i32 %add10 to i64
%arrayidx14 = getelementptr inbounds [200 x [200 x i32]], ptr @visited, i64 0, i64 %idxprom11, i64 %idxprom13
store i32 1, ptr %arrayidx14, align 4, !tbaa !5
%mul = mul nsw i32 %add9, 1000
%add15 = add nsw i32 %add10, %mul
%8 = load i32, ptr @bottom, align 4, !tbaa !5
%inc.i = add nsw i32 %8, 1
store i32 %inc.i, ptr @bottom, align 4, !tbaa !5
%idxprom.i = sext i32 %8 to i64
%arrayidx.i = getelementptr inbounds [3000 x i32], ptr @queue, i64 0, i64 %idxprom.i
store i32 %add15, ptr %arrayidx.i, align 4, !tbaa !5
%top.promoted = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.not87 = icmp eq i32 %top.promoted, %inc.i
br i1 %cmp.i.not87, label %while.end54, label %while.body19.lr.ph
while.body19.lr.ph: ; preds = %while.end
%9 = load i32, ptr %turn, align 4
%10 = sext i32 %top.promoted to i64
%11 = load i32, ptr @dir_x, align 16
%12 = load i32, ptr @dir_y, align 16
%13 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @dir_x, i64 0, i64 1), align 4
%14 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @dir_y, i64 0, i64 1), align 4
%15 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @dir_x, i64 0, i64 2), align 8
%16 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @dir_y, i64 0, i64 2), align 8
%17 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @dir_x, i64 0, i64 3), align 4
%18 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @dir_y, i64 0, i64 3), align 4
%19 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @dir_x, i64 0, i64 4), align 16
%20 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @dir_y, i64 0, i64 4), align 16
%21 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @dir_x, i64 0, i64 5), align 4
%22 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @dir_y, i64 0, i64 5), align 4
br label %while.body19
while.cond16.loopexit: ; preds = %for.inc.4, %land.lhs.true37.5, %if.then45.5, %while.body19
%bottom.promoted83 = phi i32 [ %bottom.promoted8688, %while.body19 ], [ %bottom.promoted84.4, %for.inc.4 ], [ %bottom.promoted84.4, %land.lhs.true37.5 ], [ %inc.i72.5, %if.then45.5 ]
%23 = trunc i64 %indvars.iv.next to i32
%cmp.i.not = icmp eq i32 %bottom.promoted83, %23
br i1 %cmp.i.not, label %while.cond16.while.end54_crit_edge, label %while.body19, !llvm.loop !11
while.body19: ; preds = %while.body19.lr.ph, %while.cond16.loopexit
%indvars.iv = phi i64 [ %10, %while.body19.lr.ph ], [ %indvars.iv.next, %while.cond16.loopexit ]
%bottom.promoted8688 = phi i32 [ %inc.i, %while.body19.lr.ph ], [ %bottom.promoted83, %while.cond16.loopexit ]
%indvars.iv.next = add i64 %indvars.iv, 1
%arrayidx.i71 = getelementptr inbounds [3000 x i32], ptr @queue, i64 0, i64 %indvars.iv
%24 = load i32, ptr %arrayidx.i71, align 4, !tbaa !5
%div = sdiv i32 %24, 1000
%rem = srem i32 %24, 1000
%idxprom21 = sext i32 %div to i64
%idxprom23 = sext i32 %rem to i64
%arrayidx24 = getelementptr inbounds [200 x [200 x i32]], ptr @visited, i64 0, i64 %idxprom21, i64 %idxprom23
%25 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%cmp44.not = icmp sgt i32 %25, %9
%add46 = add nsw i32 %25, 1
%cmp44.not.fr = freeze i1 %cmp44.not
br i1 %cmp44.not.fr, label %while.cond16.loopexit, label %for.body.preheader
for.body.preheader: ; preds = %while.body19
%add28 = add nsw i32 %11, %div
%add31 = add nsw i32 %12, %rem
%idxprom32 = sext i32 %add28 to i64
%idxprom34 = sext i32 %add31 to i64
%arrayidx35 = getelementptr inbounds [200 x [200 x i32]], ptr @objects, i64 0, i64 %idxprom32, i64 %idxprom34
%26 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%tobool36.not = icmp eq i32 %26, 0
br i1 %tobool36.not, label %land.lhs.true37, label %for.inc
land.lhs.true37: ; preds = %for.body.preheader
%arrayidx41 = getelementptr inbounds [200 x [200 x i32]], ptr @visited, i64 0, i64 %idxprom32, i64 %idxprom34
%27 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%tobool42.not.not = icmp eq i32 %27, 0
br i1 %tobool42.not.not, label %if.then45, label %for.inc
if.then45: ; preds = %land.lhs.true37
store i32 %add46, ptr %arrayidx41, align 4, !tbaa !5
%mul51 = mul nsw i32 %add28, 1000
%add52 = add nsw i32 %mul51, %add31
%inc.i72 = add nsw i32 %bottom.promoted8688, 1
store i32 %inc.i72, ptr @bottom, align 4, !tbaa !5
%idxprom.i73 = sext i32 %bottom.promoted8688 to i64
%arrayidx.i74 = getelementptr inbounds [3000 x i32], ptr @queue, i64 0, i64 %idxprom.i73
store i32 %add52, ptr %arrayidx.i74, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body.preheader, %land.lhs.true37, %if.then45
%bottom.promoted84 = phi i32 [ %bottom.promoted8688, %for.body.preheader ], [ %bottom.promoted8688, %land.lhs.true37 ], [ %inc.i72, %if.then45 ]
%add28.1 = add nsw i32 %13, %div
%add31.1 = add nsw i32 %14, %rem
%idxprom32.1 = sext i32 %add28.1 to i64
%idxprom34.1 = sext i32 %add31.1 to i64
%arrayidx35.1 = getelementptr inbounds [200 x [200 x i32]], ptr @objects, i64 0, i64 %idxprom32.1, i64 %idxprom34.1
%28 = load i32, ptr %arrayidx35.1, align 4, !tbaa !5
%tobool36.not.1 = icmp eq i32 %28, 0
br i1 %tobool36.not.1, label %land.lhs.true37.1, label %for.inc.1
land.lhs.true37.1: ; preds = %for.inc
%arrayidx41.1 = getelementptr inbounds [200 x [200 x i32]], ptr @visited, i64 0, i64 %idxprom32.1, i64 %idxprom34.1
%29 = load i32, ptr %arrayidx41.1, align 4, !tbaa !5
%tobool42.not.not.1 = icmp eq i32 %29, 0
br i1 %tobool42.not.not.1, label %if.then45.1, label %for.inc.1
if.then45.1: ; preds = %land.lhs.true37.1
store i32 %add46, ptr %arrayidx41.1, align 4, !tbaa !5
%mul51.1 = mul nsw i32 %add28.1, 1000
%add52.1 = add nsw i32 %mul51.1, %add31.1
%inc.i72.1 = add nsw i32 %bottom.promoted84, 1
store i32 %inc.i72.1, ptr @bottom, align 4, !tbaa !5
%idxprom.i73.1 = sext i32 %bottom.promoted84 to i64
%arrayidx.i74.1 = getelementptr inbounds [3000 x i32], ptr @queue, i64 0, i64 %idxprom.i73.1
store i32 %add52.1, ptr %arrayidx.i74.1, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.then45.1, %land.lhs.true37.1, %for.inc
%bottom.promoted84.1 = phi i32 [ %bottom.promoted84, %for.inc ], [ %bottom.promoted84, %land.lhs.true37.1 ], [ %inc.i72.1, %if.then45.1 ]
%add28.2 = add nsw i32 %15, %div
%add31.2 = add nsw i32 %16, %rem
%idxprom32.2 = sext i32 %add28.2 to i64
%idxprom34.2 = sext i32 %add31.2 to i64
%arrayidx35.2 = getelementptr inbounds [200 x [200 x i32]], ptr @objects, i64 0, i64 %idxprom32.2, i64 %idxprom34.2
%30 = load i32, ptr %arrayidx35.2, align 4, !tbaa !5
%tobool36.not.2 = icmp eq i32 %30, 0
br i1 %tobool36.not.2, label %land.lhs.true37.2, label %for.inc.2
land.lhs.true37.2: ; preds = %for.inc.1
%arrayidx41.2 = getelementptr inbounds [200 x [200 x i32]], ptr @visited, i64 0, i64 %idxprom32.2, i64 %idxprom34.2
%31 = load i32, ptr %arrayidx41.2, align 4, !tbaa !5
%tobool42.not.not.2 = icmp eq i32 %31, 0
br i1 %tobool42.not.not.2, label %if.then45.2, label %for.inc.2
if.then45.2: ; preds = %land.lhs.true37.2
store i32 %add46, ptr %arrayidx41.2, align 4, !tbaa !5
%mul51.2 = mul nsw i32 %add28.2, 1000
%add52.2 = add nsw i32 %mul51.2, %add31.2
%inc.i72.2 = add nsw i32 %bottom.promoted84.1, 1
store i32 %inc.i72.2, ptr @bottom, align 4, !tbaa !5
%idxprom.i73.2 = sext i32 %bottom.promoted84.1 to i64
%arrayidx.i74.2 = getelementptr inbounds [3000 x i32], ptr @queue, i64 0, i64 %idxprom.i73.2
store i32 %add52.2, ptr %arrayidx.i74.2, align 4, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.then45.2, %land.lhs.true37.2, %for.inc.1
%bottom.promoted84.2 = phi i32 [ %bottom.promoted84.1, %for.inc.1 ], [ %bottom.promoted84.1, %land.lhs.true37.2 ], [ %inc.i72.2, %if.then45.2 ]
%add28.3 = add nsw i32 %17, %div
%add31.3 = add nsw i32 %18, %rem
%idxprom32.3 = sext i32 %add28.3 to i64
%idxprom34.3 = sext i32 %add31.3 to i64
%arrayidx35.3 = getelementptr inbounds [200 x [200 x i32]], ptr @objects, i64 0, i64 %idxprom32.3, i64 %idxprom34.3
%32 = load i32, ptr %arrayidx35.3, align 4, !tbaa !5
%tobool36.not.3 = icmp eq i32 %32, 0
br i1 %tobool36.not.3, label %land.lhs.true37.3, label %for.inc.3
land.lhs.true37.3: ; preds = %for.inc.2
%arrayidx41.3 = getelementptr inbounds [200 x [200 x i32]], ptr @visited, i64 0, i64 %idxprom32.3, i64 %idxprom34.3
%33 = load i32, ptr %arrayidx41.3, align 4, !tbaa !5
%tobool42.not.not.3 = icmp eq i32 %33, 0
br i1 %tobool42.not.not.3, label %if.then45.3, label %for.inc.3
if.then45.3: ; preds = %land.lhs.true37.3
store i32 %add46, ptr %arrayidx41.3, align 4, !tbaa !5
%mul51.3 = mul nsw i32 %add28.3, 1000
%add52.3 = add nsw i32 %mul51.3, %add31.3
%inc.i72.3 = add nsw i32 %bottom.promoted84.2, 1
store i32 %inc.i72.3, ptr @bottom, align 4, !tbaa !5
%idxprom.i73.3 = sext i32 %bottom.promoted84.2 to i64
%arrayidx.i74.3 = getelementptr inbounds [3000 x i32], ptr @queue, i64 0, i64 %idxprom.i73.3
store i32 %add52.3, ptr %arrayidx.i74.3, align 4, !tbaa !5
br label %for.inc.3
for.inc.3: ; preds = %if.then45.3, %land.lhs.true37.3, %for.inc.2
%bottom.promoted84.3 = phi i32 [ %bottom.promoted84.2, %for.inc.2 ], [ %bottom.promoted84.2, %land.lhs.true37.3 ], [ %inc.i72.3, %if.then45.3 ]
%add28.4 = add nsw i32 %19, %div
%add31.4 = add nsw i32 %20, %rem
%idxprom32.4 = sext i32 %add28.4 to i64
%idxprom34.4 = sext i32 %add31.4 to i64
%arrayidx35.4 = getelementptr inbounds [200 x [200 x i32]], ptr @objects, i64 0, i64 %idxprom32.4, i64 %idxprom34.4
%34 = load i32, ptr %arrayidx35.4, align 4, !tbaa !5
%tobool36.not.4 = icmp eq i32 %34, 0
br i1 %tobool36.not.4, label %land.lhs.true37.4, label %for.inc.4
land.lhs.true37.4: ; preds = %for.inc.3
%arrayidx41.4 = getelementptr inbounds [200 x [200 x i32]], ptr @visited, i64 0, i64 %idxprom32.4, i64 %idxprom34.4
%35 = load i32, ptr %arrayidx41.4, align 4, !tbaa !5
%tobool42.not.not.4 = icmp eq i32 %35, 0
br i1 %tobool42.not.not.4, label %if.then45.4, label %for.inc.4
if.then45.4: ; preds = %land.lhs.true37.4
store i32 %add46, ptr %arrayidx41.4, align 4, !tbaa !5
%mul51.4 = mul nsw i32 %add28.4, 1000
%add52.4 = add nsw i32 %mul51.4, %add31.4
%inc.i72.4 = add nsw i32 %bottom.promoted84.3, 1
store i32 %inc.i72.4, ptr @bottom, align 4, !tbaa !5
%idxprom.i73.4 = sext i32 %bottom.promoted84.3 to i64
%arrayidx.i74.4 = getelementptr inbounds [3000 x i32], ptr @queue, i64 0, i64 %idxprom.i73.4
store i32 %add52.4, ptr %arrayidx.i74.4, align 4, !tbaa !5
br label %for.inc.4
for.inc.4: ; preds = %if.then45.4, %land.lhs.true37.4, %for.inc.3
%bottom.promoted84.4 = phi i32 [ %bottom.promoted84.3, %for.inc.3 ], [ %bottom.promoted84.3, %land.lhs.true37.4 ], [ %inc.i72.4, %if.then45.4 ]
%add28.5 = add nsw i32 %21, %div
%add31.5 = add nsw i32 %22, %rem
%idxprom32.5 = sext i32 %add28.5 to i64
%idxprom34.5 = sext i32 %add31.5 to i64
%arrayidx35.5 = getelementptr inbounds [200 x [200 x i32]], ptr @objects, i64 0, i64 %idxprom32.5, i64 %idxprom34.5
%36 = load i32, ptr %arrayidx35.5, align 4, !tbaa !5
%tobool36.not.5 = icmp eq i32 %36, 0
br i1 %tobool36.not.5, label %land.lhs.true37.5, label %while.cond16.loopexit
land.lhs.true37.5: ; preds = %for.inc.4
%arrayidx41.5 = getelementptr inbounds [200 x [200 x i32]], ptr @visited, i64 0, i64 %idxprom32.5, i64 %idxprom34.5
%37 = load i32, ptr %arrayidx41.5, align 4, !tbaa !5
%tobool42.not.not.5 = icmp eq i32 %37, 0
br i1 %tobool42.not.not.5, label %if.then45.5, label %while.cond16.loopexit
if.then45.5: ; preds = %land.lhs.true37.5
store i32 %add46, ptr %arrayidx41.5, align 4, !tbaa !5
%mul51.5 = mul nsw i32 %add28.5, 1000
%add52.5 = add nsw i32 %mul51.5, %add31.5
%inc.i72.5 = add nsw i32 %bottom.promoted84.4, 1
store i32 %inc.i72.5, ptr @bottom, align 4, !tbaa !5
%idxprom.i73.5 = sext i32 %bottom.promoted84.4 to i64
%arrayidx.i74.5 = getelementptr inbounds [3000 x i32], ptr @queue, i64 0, i64 %idxprom.i73.5
store i32 %add52.5, ptr %arrayidx.i74.5, align 4, !tbaa !5
br label %while.cond16.loopexit
while.cond16.while.end54_crit_edge: ; preds = %while.cond16.loopexit
store i32 %bottom.promoted83, ptr @top, align 4, !tbaa !5
store i32 %div, ptr %x, align 4, !tbaa !5
store i32 %rem, ptr %y, align 4, !tbaa !5
br label %while.end54
while.end54: ; preds = %while.cond16.while.end54_crit_edge, %while.end
%.lcssa = phi i32 [ %bottom.promoted83, %while.cond16.while.end54_crit_edge ], [ %inc.i, %while.end ]
%call55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %turn, ptr noundef nonnull %obj_n)
%38 = load i32, ptr %turn, align 4, !tbaa !5
%cmp = icmp eq i32 %38, 0
%39 = load i32, ptr %obj_n, align 4
%cmp1 = icmp eq i32 %39, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end56, label %if.end
while.end56: ; preds = %while.end54, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %obj_n) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %turn) #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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
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(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 #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <string.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
int main(){
int n; scanf("%d",&n);
char s[105],t[105]; scanf("%s%s",s,t);
int ans=2*n;
rep(i,n+1){
if(i==0)continue;
char st[105]={0},tt[105]={0};
strncpy(st,s+n-i,i);
strncpy(tt,t,i);
if(strcmp(st,tt)==0) ans=2*n-i;
}
printf("%d\n",ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219070/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219070/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca [105 x i8], align 16
%t = alloca [105 x i8], align 16
%st = alloca [105 x i8], align 16
%tt = alloca [105 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 105, ptr nonnull %s) #6
call void @llvm.lifetime.start.p0(i64 105, ptr nonnull %t) #6
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s, ptr noundef nonnull %t)
%0 = load i32, ptr %n, align 4
%mul = shl nsw i32 %0, 1
%cmp.not28 = icmp slt i32 %0, 0
br i1 %cmp.not28, label %for.cond.cleanup, label %for.inc.peel
for.inc.peel: ; preds = %entry
%idx.ext = zext i32 %0 to i64
%add.ptr = getelementptr inbounds i8, ptr %s, i64 %idx.ext
%1 = add nuw i32 %0, 1
%wide.trip.count = zext i32 %1 to i64
%exitcond.peel.not = icmp eq i32 %0, 0
br i1 %exitcond.peel.not, label %for.cond.cleanup, label %for.inc
for.cond.cleanup: ; preds = %for.inc, %for.inc.peel, %entry
%ans.0.lcssa = phi i32 [ %mul, %entry ], [ 0, %for.inc.peel ], [ %ans.1, %for.inc ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 105, ptr nonnull %t) #6
call void @llvm.lifetime.end.p0(i64 105, ptr nonnull %s) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
for.inc: ; preds = %for.inc.peel, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %for.inc.peel ]
%ans.029 = phi i32 [ %ans.1, %for.inc ], [ %mul, %for.inc.peel ]
call void @llvm.lifetime.start.p0(i64 105, ptr nonnull %st) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(105) %st, i8 0, i64 105, i1 false)
call void @llvm.lifetime.start.p0(i64 105, ptr nonnull %tt) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(105) %tt, i8 0, i64 105, i1 false)
%idx.neg = sub nsw i64 0, %indvars.iv
%add.ptr7 = getelementptr inbounds i8, ptr %add.ptr, i64 %idx.neg
%call8 = call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %st, ptr noundef nonnull dereferenceable(1) %add.ptr7, i64 noundef %indvars.iv) #6
%call12 = call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %tt, ptr noundef nonnull dereferenceable(1) %t, i64 noundef %indvars.iv) #6
%call15 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %st, ptr noundef nonnull dereferenceable(1) %tt) #7
%cmp16 = icmp eq i32 %call15, 0
%2 = trunc i64 %indvars.iv to i32
%sub = sub nsw i32 %mul, %2
%ans.1 = select i1 %cmp16, i32 %sub, i32 %ans.029
call void @llvm.lifetime.end.p0(i64 105, ptr nonnull %tt) #6
call void @llvm.lifetime.end.p0(i64 105, ptr nonnull %st) #6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.inc, !llvm.loop !5
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = distinct !{!5, !6, !7}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!"llvm.loop.peeled.count", i32 1}
|
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int N;
char s[101], t[101];
int is_same_(int d){
for (int i = 0; i < N - d; i++){
if(s[i+d]!=t[i]){
return 0;
}
}
return 1;
}
void core(){
scanf("%d", &N);
scanf("%s", &s);
scanf("%s", &t);
int d = 0;
for (d = 0; d < N; d++){
if (is_same_(d)){
break;
}
}
printf("%d\n", N + d);
}
int main(){
core();
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219120/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219120/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@N = dso_local global i32 0, align 4
@s = dso_local global [101 x i8] zeroinitializer, align 16
@t = dso_local global [101 x i8] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @is_same_(i32 noundef %d) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @N, align 4, !tbaa !5
%sub = sub nsw i32 %0, %d
%cmp.not10 = icmp slt i32 %sub, 1
br i1 %cmp.not10, label %cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = sext i32 %d to i64
%2 = zext i32 %sub to i64
%wide.trip.count = zext i32 %sub to i64
%arrayidx15 = getelementptr inbounds [101 x i8], ptr @s, i64 0, i64 %1
%3 = load i8, ptr %arrayidx15, align 1, !tbaa !9
%4 = load i8, ptr @t, align 16, !tbaa !9
%cmp4.not16 = icmp eq i8 %3, %4
br i1 %cmp4.not16, label %for.cond, label %cleanup
for.cond: ; preds = %for.body.preheader, %for.body
%indvars.iv17 = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv17, 1
%exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond, label %cleanup.loopexit.loopexit, label %for.body, !llvm.loop !10
for.body: ; preds = %for.cond
%5 = add nsw i64 %indvars.iv.next, %1
%arrayidx = getelementptr inbounds [101 x i8], ptr @s, i64 0, i64 %5
%6 = load i8, ptr %arrayidx, align 1, !tbaa !9
%arrayidx2 = getelementptr inbounds [101 x i8], ptr @t, i64 0, i64 %indvars.iv.next
%7 = load i8, ptr %arrayidx2, align 1, !tbaa !9
%cmp4.not = icmp eq i8 %6, %7
br i1 %cmp4.not, label %for.cond, label %cleanup.loopexit.loopexit, !llvm.loop !10
cleanup.loopexit.loopexit: ; preds = %for.body, %for.cond
%cmp.not.le = icmp uge i64 %indvars.iv.next, %2
%8 = zext i1 %cmp.not.le to i32
br label %cleanup
cleanup: ; preds = %for.body.preheader, %cleanup.loopexit.loopexit, %entry
%cmp.not.lcssa = phi i32 [ 1, %entry ], [ 0, %for.body.preheader ], [ %8, %cleanup.loopexit.loopexit ]
ret i32 %cmp.not.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @core() local_unnamed_addr #1 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @s)
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @t)
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp14 = icmp sgt i32 %0, 0
br i1 %cmp14, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%1 = load i8, ptr @t, align 16
%2 = zext i32 %0 to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%3 = sub nuw nsw i64 %2, %indvars.iv
%exitcond = icmp eq i64 %indvars.iv, %2
br i1 %exitcond, label %for.end, label %for.body.preheader.i
for.body.preheader.i: ; preds = %for.body
%arrayidx.i10 = getelementptr inbounds [101 x i8], ptr @s, i64 0, i64 %indvars.iv
%4 = load i8, ptr %arrayidx.i10, align 1, !tbaa !9
%cmp4.not.i11 = icmp eq i8 %4, %1
br i1 %cmp4.not.i11, label %for.cond.i, label %for.inc
for.cond.i: ; preds = %for.body.preheader.i, %for.body.i
%indvars.iv.i12 = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ 0, %for.body.preheader.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i12, 1
%exitcond.i = icmp eq i64 %indvars.iv.next.i, %3
br i1 %exitcond.i, label %is_same_.exit, label %for.body.i, !llvm.loop !10
for.body.i: ; preds = %for.cond.i
%5 = add nuw nsw i64 %indvars.iv.next.i, %indvars.iv
%arrayidx.i = getelementptr inbounds [101 x i8], ptr @s, i64 0, i64 %5
%6 = load i8, ptr %arrayidx.i, align 1, !tbaa !9
%arrayidx2.i = getelementptr inbounds [101 x i8], ptr @t, i64 0, i64 %indvars.iv.next.i
%7 = load i8, ptr %arrayidx2.i, align 1, !tbaa !9
%cmp4.not.i = icmp eq i8 %6, %7
br i1 %cmp4.not.i, label %for.cond.i, label %is_same_.exit, !llvm.loop !10
is_same_.exit: ; preds = %for.body.i, %for.cond.i
%cmp.not.i.not.le = icmp ult i64 %indvars.iv.next.i, %3
br i1 %cmp.not.i.not.le, label %for.inc, label %for.end.loopexit.split.loop.exit26
for.inc: ; preds = %for.body.preheader.i, %is_same_.exit
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond25.not = icmp eq i64 %indvars.iv.next, %2
br i1 %exitcond25.not, label %for.end, label %for.body, !llvm.loop !12
for.end.loopexit.split.loop.exit26: ; preds = %is_same_.exit
%8 = trunc i64 %indvars.iv to i32
br label %for.end
for.end: ; preds = %for.body, %for.inc, %for.end.loopexit.split.loop.exit26, %entry
%d.0.lcssa = phi i32 [ 0, %entry ], [ %8, %for.end.loopexit.split.loop.exit26 ], [ %0, %for.inc ], [ %0, %for.body ]
%add = add nsw i32 %0, %d.0.lcssa
%call4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
tail call void @core()
ret i32 0
}
attributes #0 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
#include <string.h>
int main()
{ char s[500001];
scanf("%s",s);
long long l=strlen(s);
long long left=0,right=0;
long long a[l+2];
for(int i=0;i<l+2;i++){a[i]=0;}
for(int i=0;i<l;i++){
if(s[i]=='<'){
a[i]=left;
left++;
}else{
a[i]=left;
a[i+1]=0;
left=0;
}
if(i==l-1&&s[i]=='<'){
a[i+1]=left;
}
}
for(int i=l-1;i>=0;i--){
if(s[i]=='>'){
a[i+1]=right;
right++;
}else{
a[i+1]=right>a[i+1]?right:a[i+1];
right=0;
}
if(i==0&&s[i]=='>'){
a[i]=right;
}
}
long long ans=0;
for(int i=0;i<=l;i++){
ans+=a[i];
}
printf("%lld",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219171/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219171/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [500001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 500001, ptr nonnull %s) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #8
%add = add i64 %call2, 2
%0 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %add, align 16
%cmp145 = icmp sgt i64 %call2, -2
br i1 %cmp145, label %for.cond6.preheader, label %for.cond.cleanup10
for.cond6.preheader: ; preds = %entry
%smax = call i64 @llvm.smax.i64(i64 %add, i64 1)
%1 = shl nuw i64 %smax, 3
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, i8 0, i64 %1, i1 false), !tbaa !5
%cmp8148 = icmp sgt i64 %call2, 0
br i1 %cmp8148, label %for.body11.lr.ph, label %for.cond.cleanup10
for.body11.lr.ph: ; preds = %for.cond6.preheader
%sub = add nsw i64 %call2, -1
%invariant.gep = getelementptr i64, ptr %vla, i64 1
%arrayidx36 = getelementptr inbounds i64, ptr %vla, i64 %call2
br label %for.body11
for.cond.cleanup10: ; preds = %for.inc38, %entry, %for.cond6.preheader
%2 = trunc i64 %call2 to i32
%i41.0152 = add i32 %2, -1
%cmp45153 = icmp sgt i32 %i41.0152, -1
br i1 %cmp45153, label %for.body48.preheader, label %for.cond87.preheader
for.body48.preheader: ; preds = %for.cond.cleanup10
%3 = zext i32 %i41.0152 to i64
br label %for.body48
for.body11: ; preds = %for.body11.lr.ph, %for.inc38
%indvars.iv = phi i64 [ 0, %for.body11.lr.ph ], [ %indvars.iv.next, %for.inc38 ]
%left.0149 = phi i64 [ 0, %for.body11.lr.ph ], [ %left.1138, %for.inc38 ]
%arrayidx13 = getelementptr inbounds [500001 x i8], ptr %s, i64 0, i64 %indvars.iv
%4 = load i8, ptr %arrayidx13, align 1, !tbaa !9
%cmp15 = icmp eq i8 %4, 60
%arrayidx18 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
store i64 %left.0149, ptr %arrayidx18, align 8, !tbaa !5
br i1 %cmp15, label %if.end, label %if.end.thread
if.end: ; preds = %for.body11
%inc19 = add nsw i64 %left.0149, 1
%cmp26 = icmp eq i64 %sub, %indvars.iv
br i1 %cmp26, label %if.then33, label %for.inc38
if.end.thread: ; preds = %for.body11
%gep = getelementptr i64, ptr %invariant.gep, i64 %indvars.iv
store i64 0, ptr %gep, align 8, !tbaa !5
br label %for.inc38
if.then33: ; preds = %if.end
store i64 %inc19, ptr %arrayidx36, align 8, !tbaa !5
br label %for.inc38
for.inc38: ; preds = %if.end.thread, %if.end, %if.then33
%left.1138 = phi i64 [ %inc19, %if.end ], [ %inc19, %if.then33 ], [ 0, %if.end.thread ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %call2
br i1 %exitcond.not, label %for.cond.cleanup10, label %for.body11, !llvm.loop !10
for.cond87.preheader: ; preds = %for.inc84, %for.inc84.thread, %for.cond.cleanup10
%cmp89.not157 = icmp slt i64 %call2, 0
br i1 %cmp89.not157, label %for.cond.cleanup91, label %for.body92.preheader
for.body92.preheader: ; preds = %for.cond87.preheader
%5 = add i64 %call2, 1
%min.iters.check = icmp ult i64 %5, 4
br i1 %min.iters.check, label %for.body92.preheader178, label %vector.ph
vector.ph: ; preds = %for.body92.preheader
%n.vec = and i64 %5, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%vec.phi176 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%6 = getelementptr inbounds i64, ptr %vla, i64 %index
%wide.load = load <2 x i64>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i64, ptr %6, i64 2
%wide.load177 = load <2 x i64>, ptr %7, align 16, !tbaa !5
%8 = add <2 x i64> %wide.load, %vec.phi
%9 = add <2 x i64> %wide.load177, %vec.phi176
%index.next = add nuw i64 %index, 4
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %9, %8
%11 = 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.cond.cleanup91, label %for.body92.preheader178
for.body92.preheader178: ; preds = %for.body92.preheader, %middle.block
%indvars.iv168.ph = phi i64 [ 0, %for.body92.preheader ], [ %n.vec, %middle.block ]
%ans.0158.ph = phi i64 [ 0, %for.body92.preheader ], [ %11, %middle.block ]
br label %for.body92
for.body48: ; preds = %for.body48.preheader, %for.inc84
%indvars.iv165 = phi i64 [ %3, %for.body48.preheader ], [ %indvars.iv.next166, %for.inc84 ]
%i41.0.in155 = phi i64 [ %call2, %for.body48.preheader ], [ %indvars.iv165, %for.inc84 ]
%right.0154 = phi i64 [ 0, %for.body48.preheader ], [ %right.1143, %for.inc84 ]
%arrayidx50 = getelementptr inbounds [500001 x i8], ptr %s, i64 0, i64 %indvars.iv165
%12 = load i8, ptr %arrayidx50, align 1, !tbaa !9
%cmp52 = icmp eq i8 %12, 62
%sext = shl i64 %i41.0.in155, 32
%idxprom56 = ashr exact i64 %sext, 32
%arrayidx57 = getelementptr inbounds i64, ptr %vla, i64 %idxprom56
br i1 %cmp52, label %if.end71, label %if.end71.thread
if.end71: ; preds = %for.body48
store i64 %right.0154, ptr %arrayidx57, align 8, !tbaa !5
%inc58 = add nsw i64 %right.0154, 1
%cmp72 = icmp eq i64 %indvars.iv165, 0
br i1 %cmp72, label %for.inc84.thread, label %for.inc84
if.end71.thread: ; preds = %for.body48
%13 = load i64, ptr %arrayidx57, align 8, !tbaa !5
%right.0. = call i64 @llvm.smax.i64(i64 %right.0154, i64 %13)
store i64 %right.0., ptr %arrayidx57, align 8, !tbaa !5
br label %for.inc84
for.inc84.thread: ; preds = %if.end71
store i64 %inc58, ptr %vla, align 16, !tbaa !5
br label %for.cond87.preheader
for.inc84: ; preds = %if.end71.thread, %if.end71
%right.1143 = phi i64 [ %inc58, %if.end71 ], [ 0, %if.end71.thread ]
%indvars.iv.next166 = add nsw i64 %indvars.iv165, -1
%cmp45.not = icmp eq i64 %indvars.iv165, 0
br i1 %cmp45.not, label %for.cond87.preheader, label %for.body48, !llvm.loop !15
for.cond.cleanup91: ; preds = %for.body92, %middle.block, %for.cond87.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond87.preheader ], [ %11, %middle.block ], [ %add95, %for.body92 ]
%call99 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 500001, ptr nonnull %s) #7
ret i32 0
for.body92: ; preds = %for.body92.preheader178, %for.body92
%indvars.iv168 = phi i64 [ %indvars.iv.next169, %for.body92 ], [ %indvars.iv168.ph, %for.body92.preheader178 ]
%ans.0158 = phi i64 [ %add95, %for.body92 ], [ %ans.0158.ph, %for.body92.preheader178 ]
%arrayidx94 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv168
%14 = load i64, ptr %arrayidx94, align 8, !tbaa !5
%add95 = add nsw i64 %14, %ans.0158
%indvars.iv.next169 = add nuw nsw i64 %indvars.iv168, 1
%exitcond171 = icmp eq i64 %indvars.iv168, %call2
br i1 %exitcond171, label %for.cond.cleanup91, label %for.body92, !llvm.loop !16
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) 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) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 nocallback nofree nosync nounwind willreturn }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11, !14, !13}
|
#include<stdio.h>
#include<stdlib.h>
long long MIN(long long a,long long b){return a<b?a:b;}
long long R=1,C=1,H[2000010],N[2000010];
//評価関数(いまはMIN)
int hyouka(int a,int b){
if(C<b)return 1;
if(C<a||b==0)return 0;
return N[H[a]]<N[H[b]]?1:0;
}
//挿入関数
void hin(long long a){
int i=C++;
for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
H[i]=R++;
}
//取り出す関数
int hout(){
int rt=H[1],i,j=2,k=H[--C];
for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
H[j/2]=k;
return rt;
}
int main(){
long long n,i,j,m=1e14,d[100010],s=0;
scanf("%lld",&n);
for(i=0;i<n;i++){
scanf("%lld",&j);
hin(j);
}
for(i=0;i<n;i++)d[i]=N[hout()];
for(i=0;i<n;i++){
j=labs(d[i]-d[n/2]);
s+=j*2;
if(m>j&&i-n/2)m=j;
}
//if(n-1)s-=m;
if(n%2==0)s-=labs(d[n/2]-d[n/2-1]);
else s-=MIN(labs(d[n/2]-d[n/2-1]),labs(d[n/2]-d[n/2+1]));
printf("%lld\n",s);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219214/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219214/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@R = dso_local local_unnamed_addr global i64 1, align 8
@C = dso_local local_unnamed_addr global i64 1, align 8
@N = dso_local local_unnamed_addr global [2000010 x i64] zeroinitializer, align 16
@H = dso_local local_unnamed_addr global [2000010 x i64] zeroinitializer, align 16
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @MIN(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @hyouka(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%0 = load i64, ptr @C, align 8, !tbaa !5
%conv = sext i32 %b to i64
%cmp = icmp slt i64 %0, %conv
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%conv2 = sext i32 %a to i64
%cmp3 = icmp slt i64 %0, %conv2
%cmp5 = icmp eq i32 %b, 0
%or.cond = or i1 %cmp5, %cmp3
br i1 %or.cond, label %return, label %if.end8
if.end8: ; preds = %if.end
%arrayidx = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %conv2
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
%arrayidx9 = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %1
%2 = load i64, ptr %arrayidx9, align 8, !tbaa !5
%arrayidx11 = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %conv
%3 = load i64, ptr %arrayidx11, align 8, !tbaa !5
%arrayidx12 = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %3
%4 = load i64, ptr %arrayidx12, align 8, !tbaa !5
%cmp13 = icmp slt i64 %2, %4
%cond = zext i1 %cmp13 to i32
br label %return
return: ; preds = %if.end, %entry, %if.end8
%retval.0 = phi i32 [ %cond, %if.end8 ], [ 1, %entry ], [ 0, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @hin(i64 noundef %a) local_unnamed_addr #2 {
entry:
%0 = load i64, ptr @C, align 8, !tbaa !5
%.fr = freeze i64 %0
%inc = add nsw i64 %.fr, 1
store i64 %inc, ptr @C, align 8, !tbaa !5
%conv = trunc i64 %.fr to i32
%1 = load i64, ptr @R, align 8, !tbaa !5
store i64 %1, ptr @H, align 16, !tbaa !5
%arrayidx = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %1
store i64 %a, ptr %arrayidx, align 8, !tbaa !5
%cmp3.i = icmp slt i64 %.fr, -1
br i1 %cmp3.i, label %entry.split.us, label %for.cond
entry.split.us: ; preds = %entry
%div.us18 = sdiv i32 %conv, 2
%conv.i.us19 = sext i32 %div.us18 to i64
%cmp.i.us20 = icmp slt i64 %inc, %conv.i.us19
br i1 %cmp.i.us20, label %for.body.us, label %for.end
for.body.us: ; preds = %entry.split.us, %for.body.us
%conv.i.us23 = phi i64 [ %conv.i.us, %for.body.us ], [ %conv.i.us19, %entry.split.us ]
%div.us22 = phi i32 [ %div.us, %for.body.us ], [ %div.us18, %entry.split.us ]
%i.0.us21 = phi i32 [ %div.us22, %for.body.us ], [ %conv, %entry.split.us ]
%arrayidx2.us = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %conv.i.us23
%2 = load i64, ptr %arrayidx2.us, align 8, !tbaa !5
%idxprom3.us = sext i32 %i.0.us21 to i64
%arrayidx4.us = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %idxprom3.us
store i64 %2, ptr %arrayidx4.us, align 8, !tbaa !5
%div.us = sdiv i32 %div.us22, 2
%conv.i.us = sext i32 %div.us to i64
%cmp.i.us = icmp slt i64 %inc, %conv.i.us
br i1 %cmp.i.us, label %for.body.us, label %for.end, !llvm.loop !9
for.cond: ; preds = %entry, %for.body
%i.0 = phi i32 [ %div, %for.body ], [ %conv, %entry ]
%div = sdiv i32 %i.0, 2
%conv.i = sext i32 %div to i64
%cmp.i = icmp slt i64 %inc, %conv.i
br i1 %cmp.i, label %for.cond.for.body_crit_edge, label %if.end.i
for.cond.for.body_crit_edge: ; preds = %for.cond
%arrayidx2.phi.trans.insert = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %conv.i
%.pre = load i64, ptr %arrayidx2.phi.trans.insert, align 8, !tbaa !5
br label %for.body
if.end.i: ; preds = %for.cond
%i.0.off = add i32 %i.0, 1
%cmp5.i = icmp ult i32 %i.0.off, 3
br i1 %cmp5.i, label %for.end, label %hyouka.exit
hyouka.exit: ; preds = %if.end.i
%3 = load i64, ptr @H, align 16, !tbaa !5
%arrayidx9.i = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %3
%4 = load i64, ptr %arrayidx9.i, align 8, !tbaa !5
%arrayidx11.i = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %conv.i
%5 = load i64, ptr %arrayidx11.i, align 8, !tbaa !5
%arrayidx12.i = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %5
%6 = load i64, ptr %arrayidx12.i, align 8, !tbaa !5
%cmp13.i.not = icmp slt i64 %4, %6
br i1 %cmp13.i.not, label %for.body, label %for.end
for.body: ; preds = %for.cond.for.body_crit_edge, %hyouka.exit
%7 = phi i64 [ %.pre, %for.cond.for.body_crit_edge ], [ %5, %hyouka.exit ]
%idxprom3 = sext i32 %i.0 to i64
%arrayidx4 = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %idxprom3
store i64 %7, ptr %arrayidx4, align 8, !tbaa !5
br label %for.cond, !llvm.loop !9
for.end: ; preds = %hyouka.exit, %if.end.i, %for.body.us, %entry.split.us
%.us-phi = phi i32 [ %conv, %entry.split.us ], [ %div.us22, %for.body.us ], [ %i.0, %if.end.i ], [ %i.0, %hyouka.exit ]
%inc6 = add nsw i64 %1, 1
store i64 %inc6, ptr @R, align 8, !tbaa !5
%idxprom7 = sext i32 %.us-phi to i64
%arrayidx8 = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %idxprom7
store i64 %1, ptr %arrayidx8, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @hout() local_unnamed_addr #2 {
entry:
%0 = load i64, ptr getelementptr inbounds ([2000010 x i64], ptr @H, i64 0, i64 1), align 8, !tbaa !5
%1 = load i64, ptr @C, align 8, !tbaa !5
%.fr = freeze i64 %1
%dec = add i64 %.fr, -1
store i64 %dec, ptr @C, align 8, !tbaa !5
%arrayidx = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %dec
%2 = load i64, ptr %arrayidx, align 8, !tbaa !5
%sext37 = shl i64 %dec, 32
%conv.i = ashr exact i64 %sext37, 32
%cmp.i.not = icmp sgt i64 %.fr, %conv.i
%arrayidx11.i = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %conv.i
br i1 %cmp.i.not, label %entry.split.us, label %for.cond
entry.split.us: ; preds = %entry
%3 = and i64 %dec, 4294967295
%cmp5.i = icmp eq i64 %3, 0
%cmp3.i.us38 = icmp slt i64 %.fr, 2
%or.cond.i.us39 = or i1 %cmp5.i, %cmp3.i.us38
br i1 %or.cond.i.us39, label %for.end, label %hyouka.exit.us.lr.ph.split
hyouka.exit.us.lr.ph.split: ; preds = %entry.split.us
%arrayidx9.i.us45 = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %0
%4 = load i64, ptr %arrayidx9.i.us45, align 8, !tbaa !5
%5 = load i64, ptr %arrayidx11.i, align 8, !tbaa !5
%arrayidx12.i.us46 = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %5
%6 = load i64, ptr %arrayidx12.i.us46, align 8, !tbaa !5
%cmp13.i.not.us47 = icmp slt i64 %4, %6
br i1 %cmp13.i.not.us47, label %for.body.us, label %for.end
hyouka.exit.us: ; preds = %hyouka.exit31.us
%7 = load i64, ptr %arrayidx7.us, align 8, !tbaa !5
%arrayidx9.i.us = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %7
%8 = load i64, ptr %arrayidx9.i.us, align 8, !tbaa !5
%9 = load i64, ptr %arrayidx11.i, align 8, !tbaa !5
%arrayidx12.i.us = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %9
%10 = load i64, ptr %arrayidx12.i.us, align 8, !tbaa !5
%cmp13.i.not.us = icmp slt i64 %8, %10
br i1 %cmp13.i.not.us, label %for.body.us, label %for.end.loopexit, !llvm.loop !11
for.body.us: ; preds = %hyouka.exit.us.lr.ph.split, %hyouka.exit.us
%i.0.us4148 = phi i32 [ %sub.us, %hyouka.exit.us ], [ 1, %hyouka.exit.us.lr.ph.split ]
%mul.us = shl nsw i32 %i.0.us4148, 1
%add.us = or i32 %mul.us, 1
%conv.i18.us = sext i32 %add.us to i64
%cmp.i19.not.us = icmp sgt i64 %.fr, %conv.i18.us
br i1 %cmp.i19.not.us, label %if.end.i20.us, label %hyouka.exit31.us
if.end.i20.us: ; preds = %for.body.us
%conv2.i21.us = sext i32 %mul.us to i64
%cmp3.i22.not.us = icmp sgt i64 %.fr, %conv2.i21.us
br i1 %cmp3.i22.not.us, label %if.end8.i23.us, label %hyouka.exit31.us
if.end8.i23.us: ; preds = %if.end.i20.us
%arrayidx.i24.us = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %conv2.i21.us
%11 = load i64, ptr %arrayidx.i24.us, align 16, !tbaa !5
%arrayidx9.i25.us = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %11
%12 = load i64, ptr %arrayidx9.i25.us, align 8, !tbaa !5
%arrayidx11.i26.us = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %conv.i18.us
%13 = load i64, ptr %arrayidx11.i26.us, align 8, !tbaa !5
%arrayidx12.i27.us = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %13
%14 = load i64, ptr %arrayidx12.i27.us, align 8, !tbaa !5
%cmp13.i28.us = icmp slt i64 %12, %14
%cond.i29.neg.us = sext i1 %cmp13.i28.us to i32
br label %hyouka.exit31.us
hyouka.exit31.us: ; preds = %if.end8.i23.us, %if.end.i20.us, %for.body.us
%retval.0.i30.neg.us = phi i32 [ %cond.i29.neg.us, %if.end8.i23.us ], [ -1, %for.body.us ], [ 0, %if.end.i20.us ]
%sub.us = add i32 %retval.0.i30.neg.us, %add.us
%idxprom.us = sext i32 %sub.us to i64
%arrayidx7.us = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %idxprom.us
%15 = load i64, ptr %arrayidx7.us, align 8, !tbaa !5
%idxprom8.us = sext i32 %i.0.us4148 to i64
%arrayidx9.us = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %idxprom8.us
store i64 %15, ptr %arrayidx9.us, align 8, !tbaa !5
%cmp3.i.us.not = icmp sgt i64 %.fr, %idxprom.us
br i1 %cmp3.i.us.not, label %hyouka.exit.us, label %for.end.loopexit, !llvm.loop !11
for.cond: ; preds = %entry, %hyouka.exit31
%i.0 = phi i32 [ %sub, %hyouka.exit31 ], [ 1, %entry ]
%mul = shl nsw i32 %i.0, 1
%add = or i32 %mul, 1
%conv.i18 = sext i32 %add to i64
%cmp.i19.not = icmp sgt i64 %.fr, %conv.i18
br i1 %cmp.i19.not, label %if.end.i20, label %hyouka.exit31
if.end.i20: ; preds = %for.cond
%conv2.i21 = sext i32 %mul to i64
%cmp3.i22.not = icmp sgt i64 %.fr, %conv2.i21
br i1 %cmp3.i22.not, label %if.end8.i23, label %hyouka.exit31
if.end8.i23: ; preds = %if.end.i20
%arrayidx.i24 = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %conv2.i21
%16 = load i64, ptr %arrayidx.i24, align 16, !tbaa !5
%arrayidx9.i25 = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %16
%17 = load i64, ptr %arrayidx9.i25, align 8, !tbaa !5
%arrayidx11.i26 = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %conv.i18
%18 = load i64, ptr %arrayidx11.i26, align 8, !tbaa !5
%arrayidx12.i27 = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %18
%19 = load i64, ptr %arrayidx12.i27, align 8, !tbaa !5
%cmp13.i28 = icmp slt i64 %17, %19
%cond.i29.neg = sext i1 %cmp13.i28 to i32
br label %hyouka.exit31
hyouka.exit31: ; preds = %for.cond, %if.end.i20, %if.end8.i23
%retval.0.i30.neg = phi i32 [ %cond.i29.neg, %if.end8.i23 ], [ -1, %for.cond ], [ 0, %if.end.i20 ]
%sub = add i32 %retval.0.i30.neg, %add
%idxprom = sext i32 %sub to i64
%arrayidx7 = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %idxprom
%20 = load i64, ptr %arrayidx7, align 8, !tbaa !5
%idxprom8 = sext i32 %i.0 to i64
%arrayidx9 = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %idxprom8
store i64 %20, ptr %arrayidx9, align 8, !tbaa !5
br label %for.cond, !llvm.loop !11
for.end.loopexit: ; preds = %hyouka.exit31.us, %hyouka.exit.us
%21 = sdiv i32 %sub.us, 2
%22 = sext i32 %21 to i64
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry.split.us, %hyouka.exit.us.lr.ph.split
%j.0.lcssa.us = phi i64 [ 1, %entry.split.us ], [ 1, %hyouka.exit.us.lr.ph.split ], [ %22, %for.end.loopexit ]
%conv = trunc i64 %0 to i32
%sext = shl i64 %2, 32
%conv10 = ashr exact i64 %sext, 32
%arrayidx12 = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %j.0.lcssa.us
store i64 %conv10, ptr %arrayidx12, align 8, !tbaa !5
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i64, align 8
%j = alloca i64, align 8
%d = alloca [100010 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %j) #8
call void @llvm.lifetime.start.p0(i64 800080, ptr nonnull %d) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp59 = icmp sgt i64 %0, 0
br i1 %cmp59, label %for.body, label %for.end20
for.cond2.preheader: ; preds = %hin.exit
%cmp361 = icmp sgt i64 %10, 0
br i1 %cmp361, label %for.body4, label %for.end20
for.body: ; preds = %entry, %hin.exit
%i.060 = phi i64 [ %inc, %hin.exit ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %j)
%1 = load i64, ptr %j, align 8, !tbaa !5
%2 = load i64, ptr @C, align 8, !tbaa !5
%.fr.i = freeze i64 %2
%inc.i = add nsw i64 %.fr.i, 1
store i64 %inc.i, ptr @C, align 8, !tbaa !5
%conv.i = trunc i64 %.fr.i to i32
%3 = load i64, ptr @R, align 8, !tbaa !5
store i64 %3, ptr @H, align 16, !tbaa !5
%arrayidx.i = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %3
store i64 %1, ptr %arrayidx.i, align 8, !tbaa !5
%cmp3.i.i = icmp slt i64 %.fr.i, -1
br i1 %cmp3.i.i, label %entry.split.us.i, label %for.cond.i
entry.split.us.i: ; preds = %for.body
%div.us18.i = sdiv i32 %conv.i, 2
%conv.i.us19.i = sext i32 %div.us18.i to i64
%cmp.i.us20.i = icmp slt i64 %inc.i, %conv.i.us19.i
br i1 %cmp.i.us20.i, label %for.body.us.i, label %hin.exit
for.body.us.i: ; preds = %entry.split.us.i, %for.body.us.i
%conv.i.us23.i = phi i64 [ %conv.i.us.i, %for.body.us.i ], [ %conv.i.us19.i, %entry.split.us.i ]
%div.us22.i = phi i32 [ %div.us.i, %for.body.us.i ], [ %div.us18.i, %entry.split.us.i ]
%i.0.us21.i = phi i32 [ %div.us22.i, %for.body.us.i ], [ %conv.i, %entry.split.us.i ]
%arrayidx2.us.i = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %conv.i.us23.i
%4 = load i64, ptr %arrayidx2.us.i, align 8, !tbaa !5
%idxprom3.us.i = sext i32 %i.0.us21.i to i64
%arrayidx4.us.i = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %idxprom3.us.i
store i64 %4, ptr %arrayidx4.us.i, align 8, !tbaa !5
%div.us.i = sdiv i32 %div.us22.i, 2
%conv.i.us.i = sext i32 %div.us.i to i64
%cmp.i.us.i = icmp slt i64 %inc.i, %conv.i.us.i
br i1 %cmp.i.us.i, label %for.body.us.i, label %hin.exit, !llvm.loop !9
for.cond.i: ; preds = %for.body, %for.body.i
%i.0.i = phi i32 [ %div.i, %for.body.i ], [ %conv.i, %for.body ]
%div.i = sdiv i32 %i.0.i, 2
%conv.i.i = sext i32 %div.i to i64
%cmp.i.i = icmp slt i64 %inc.i, %conv.i.i
br i1 %cmp.i.i, label %for.cond.for.body_crit_edge.i, label %if.end.i.i
for.cond.for.body_crit_edge.i: ; preds = %for.cond.i
%arrayidx2.phi.trans.insert.i = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %conv.i.i
%.pre.i = load i64, ptr %arrayidx2.phi.trans.insert.i, align 8, !tbaa !5
br label %for.body.i
if.end.i.i: ; preds = %for.cond.i
%i.0.off.i = add i32 %i.0.i, 1
%cmp5.i.i = icmp ult i32 %i.0.off.i, 3
br i1 %cmp5.i.i, label %hin.exit, label %hyouka.exit.i
hyouka.exit.i: ; preds = %if.end.i.i
%5 = load i64, ptr @H, align 16, !tbaa !5
%arrayidx9.i.i = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %5
%6 = load i64, ptr %arrayidx9.i.i, align 8, !tbaa !5
%arrayidx11.i.i = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %conv.i.i
%7 = load i64, ptr %arrayidx11.i.i, align 8, !tbaa !5
%arrayidx12.i.i = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %7
%8 = load i64, ptr %arrayidx12.i.i, align 8, !tbaa !5
%cmp13.i.not.i = icmp slt i64 %6, %8
br i1 %cmp13.i.not.i, label %for.body.i, label %hin.exit
for.body.i: ; preds = %hyouka.exit.i, %for.cond.for.body_crit_edge.i
%9 = phi i64 [ %.pre.i, %for.cond.for.body_crit_edge.i ], [ %7, %hyouka.exit.i ]
%idxprom3.i = sext i32 %i.0.i to i64
%arrayidx4.i = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %idxprom3.i
store i64 %9, ptr %arrayidx4.i, align 8, !tbaa !5
br label %for.cond.i, !llvm.loop !9
hin.exit: ; preds = %if.end.i.i, %hyouka.exit.i, %for.body.us.i, %entry.split.us.i
%.us-phi.i = phi i32 [ %conv.i, %entry.split.us.i ], [ %div.us22.i, %for.body.us.i ], [ %i.0.i, %hyouka.exit.i ], [ %i.0.i, %if.end.i.i ]
%inc6.i = add nsw i64 %3, 1
store i64 %inc6.i, ptr @R, align 8, !tbaa !5
%idxprom7.i = sext i32 %.us-phi.i to i64
%arrayidx8.i = getelementptr inbounds [2000010 x i64], ptr @H, i64 0, i64 %idxprom7.i
store i64 %3, ptr %arrayidx8.i, align 8, !tbaa !5
%inc = add nuw nsw i64 %i.060, 1
%10 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %10
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !12
for.cond10.preheader: ; preds = %for.body4
%cmp1163 = icmp sgt i64 %26, 0
br i1 %cmp1163, label %for.body12.lr.ph, label %for.end20
for.body12.lr.ph: ; preds = %for.cond10.preheader
%div7680 = lshr i64 %26, 1
%arrayidx14 = getelementptr inbounds [100010 x i64], ptr %d, i64 0, i64 %div7680
%11 = load i64, ptr %arrayidx14, align 8, !tbaa !5
%min.iters.check = icmp ult i64 %26, 4
br i1 %min.iters.check, label %for.body12.preheader, label %vector.ph
vector.ph: ; preds = %for.body12.lr.ph
%n.vec = and i64 %26, -4
%broadcast.splatinsert = insertelement <2 x i64> poison, i64 %11, i64 0
%broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %20, %vector.body ]
%vec.phi84 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %21, %vector.body ]
%12 = getelementptr inbounds [100010 x i64], ptr %d, i64 0, i64 %index
%wide.load = load <2 x i64>, ptr %12, align 16, !tbaa !5
%13 = getelementptr inbounds i64, ptr %12, i64 2
%wide.load85 = load <2 x i64>, ptr %13, align 16, !tbaa !5
%14 = sub nsw <2 x i64> %wide.load, %broadcast.splat
%15 = sub nsw <2 x i64> %wide.load85, %broadcast.splat
%16 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %14, i1 true)
%17 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %15, i1 true)
%18 = shl nuw nsw <2 x i64> %16, <i64 1, i64 1>
%19 = shl nuw nsw <2 x i64> %17, <i64 1, i64 1>
%20 = add <2 x i64> %18, %vec.phi
%21 = add <2 x i64> %19, %vec.phi84
%index.next = add nuw i64 %index, 4
%22 = icmp eq i64 %index.next, %n.vec
br i1 %22, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%23 = extractelement <2 x i64> %17, i64 1
%bin.rdx = add <2 x i64> %21, %20
%24 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %26, %n.vec
br i1 %cmp.n, label %for.cond10.for.end20_crit_edge, label %for.body12.preheader
for.body12.preheader: ; preds = %for.body12.lr.ph, %middle.block
%s.066.ph = phi i64 [ 0, %for.body12.lr.ph ], [ %24, %middle.block ]
%i.264.ph = phi i64 [ 0, %for.body12.lr.ph ], [ %n.vec, %middle.block ]
br label %for.body12
for.body4: ; preds = %for.cond2.preheader, %for.body4
%i.162 = phi i64 [ %inc8, %for.body4 ], [ 0, %for.cond2.preheader ]
%call5 = call i32 @hout()
%idxprom = sext i32 %call5 to i64
%arrayidx = getelementptr inbounds [2000010 x i64], ptr @N, i64 0, i64 %idxprom
%25 = load i64, ptr %arrayidx, align 8, !tbaa !5
%arrayidx6 = getelementptr inbounds [100010 x i64], ptr %d, i64 0, i64 %i.162
store i64 %25, ptr %arrayidx6, align 8, !tbaa !5
%inc8 = add nuw nsw i64 %i.162, 1
%26 = load i64, ptr %n, align 8, !tbaa !5
%cmp3 = icmp slt i64 %inc8, %26
br i1 %cmp3, label %for.body4, label %for.cond10.preheader, !llvm.loop !16
for.body12: ; preds = %for.body12.preheader, %for.body12
%s.066 = phi i64 [ %add, %for.body12 ], [ %s.066.ph, %for.body12.preheader ]
%i.264 = phi i64 [ %inc19, %for.body12 ], [ %i.264.ph, %for.body12.preheader ]
%arrayidx13 = getelementptr inbounds [100010 x i64], ptr %d, i64 0, i64 %i.264
%27 = load i64, ptr %arrayidx13, align 8, !tbaa !5
%sub = sub nsw i64 %27, %11
%28 = call i64 @llvm.abs.i64(i64 %sub, i1 true)
%mul = shl nuw nsw i64 %28, 1
%add = add nuw nsw i64 %mul, %s.066
%inc19 = add nuw nsw i64 %i.264, 1
%exitcond.not = icmp eq i64 %inc19, %26
br i1 %exitcond.not, label %for.cond10.for.end20_crit_edge, label %for.body12, !llvm.loop !17
for.cond10.for.end20_crit_edge: ; preds = %for.body12, %middle.block
%.lcssa = phi i64 [ %23, %middle.block ], [ %28, %for.body12 ]
%add.lcssa = phi i64 [ %24, %middle.block ], [ %add, %for.body12 ]
store i64 %.lcssa, ptr %j, align 8, !tbaa !5
br label %for.end20
for.end20: ; preds = %entry, %for.cond2.preheader, %for.cond10.for.end20_crit_edge, %for.cond10.preheader
%.lcssa75 = phi i64 [ %26, %for.cond10.for.end20_crit_edge ], [ %26, %for.cond10.preheader ], [ %10, %for.cond2.preheader ], [ %0, %entry ]
%s.0.lcssa = phi i64 [ %add.lcssa, %for.cond10.for.end20_crit_edge ], [ 0, %for.cond10.preheader ], [ 0, %for.cond2.preheader ], [ 0, %entry ]
%29 = and i64 %.lcssa75, 1
%cmp21 = icmp eq i64 %29, 0
%div23 = sdiv i64 %.lcssa75, 2
%arrayidx24 = getelementptr inbounds [100010 x i64], ptr %d, i64 0, i64 %div23
%30 = load i64, ptr %arrayidx24, align 8, !tbaa !5
%sub26 = add nsw i64 %div23, -1
%arrayidx27 = getelementptr inbounds [100010 x i64], ptr %d, i64 0, i64 %sub26
%31 = load i64, ptr %arrayidx27, align 8, !tbaa !5
%sub28 = sub nsw i64 %30, %31
%32 = call i64 @llvm.abs.i64(i64 %sub28, i1 true)
br i1 %cmp21, label %if.end44, label %if.else
if.else: ; preds = %for.end20
%add39 = add nsw i64 %div23, 1
%arrayidx40 = getelementptr inbounds [100010 x i64], ptr %d, i64 0, i64 %add39
%33 = load i64, ptr %arrayidx40, align 8, !tbaa !5
%sub41 = sub nsw i64 %30, %33
%34 = call i64 @llvm.abs.i64(i64 %sub41, i1 true)
%cond.i = call i64 @llvm.smin.i64(i64 %32, i64 %34)
br label %if.end44
if.end44: ; preds = %for.end20, %if.else
%.pn = phi i64 [ %cond.i, %if.else ], [ %32, %for.end20 ]
%s.1 = sub nsw i64 %s.0.lcssa, %.pn
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %s.1)
call void @llvm.lifetime.end.p0(i64 800080, ptr nonnull %d) #8
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %j) #8
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.abs.v2i64(<2 x i64>, i1 immarg) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #7
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(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 #2 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !15, !14}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <limits.h>
#include <assert.h>
#define FOR(i,a,n) for(i=(a);i<(n);i++)
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define MOD 1000000007
#define SIZE 100005
#define LOCAL
#ifdef LOCAL
#define DEBUG(...) printf(" "__VA_ARGS__)
#else
#define DEBUG(...)
#endif /* LOCAL */
int comp(const void* a,const void* b){
return *(int*)a-*(int*)b;
}
int main(void)
{
int n,a,b;
scanf("%d%d%d",&n,&a,&b);
printf("%s\n",(b-a)%2?"Borys":"Alice");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219272/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219272/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"Borys\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"Alice\00", align 1
; 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
%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
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = and i32 %sub, 1
%tobool.not = icmp eq i32 %2, 0
%cond = select i1 %tobool.not, ptr @.str.3, ptr @.str.2
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree 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"}
|
#include <stdio.h>
#include <stdlib.h>
int main(void){
int i, N, M, P;
while(1){
scanf("%d %d %d", &N, &M, &P);
if(N == 0){
break;
}
int *X = (int *)malloc(N * sizeof(int));
double sum = 0;
for(i = 0; i < N; i++){
scanf("%d", &X[i]);
sum += X[i] * 100;
}
if(X[M - 1] == 0){
printf("0\n");
continue;
}
else{
sum -= sum * P / 100;
printf("%d\n", (int)(sum / X[M - 1]));
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219322/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219322/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%M = alloca i32, align 4
%P = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %P) #5
%call44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M, ptr noundef nonnull %P)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp45 = icmp eq i32 %0, 0
br i1 %cmp45, label %while.end, label %if.end
if.end: ; preds = %entry, %cleanup
%1 = phi i32 [ %8, %cleanup ], [ %0, %entry ]
%conv = sext i32 %1 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #6
%cmp241 = icmp sgt i32 %1, 0
br i1 %cmp241, label %for.body, label %for.end
for.body: ; preds = %if.end, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %if.end ]
%sum.043 = phi double [ %add, %for.body ], [ 0.000000e+00, %if.end ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%mul7 = mul nsw i32 %2, 100
%conv8 = sitofp i32 %mul7 to double
%add = fadd double %sum.043, %conv8
%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
%cmp2 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %if.end
%sum.0.lcssa = phi double [ 0.000000e+00, %if.end ], [ %add, %for.body ]
%5 = load i32, ptr %M, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%idxprom9 = sext i32 %sub to i64
%arrayidx10 = getelementptr inbounds i32, ptr %call1, i64 %idxprom9
%6 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %6, 0
br i1 %cmp11, label %if.then13, label %if.else
if.then13: ; preds = %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
if.else: ; preds = %for.end
%7 = load i32, ptr %P, align 4, !tbaa !5
%conv15 = sitofp i32 %7 to double
%mul16 = fmul double %sum.0.lcssa, %conv15
%div = fdiv double %mul16, 1.000000e+02
%sub17 = fsub double %sum.0.lcssa, %div
%conv21 = sitofp i32 %6 to double
%div22 = fdiv double %sub17, %conv21
%conv23 = fptosi double %div22 to i32
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv23)
br label %cleanup
cleanup: ; preds = %if.else, %if.then13
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M, ptr noundef nonnull %P)
%8 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp eq i32 %8, 0
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %cleanup, %entry
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
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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"}
|
#include <stdio.h>
int main(void){
int i,m,n,p,r,ans,sum=0;
int x[1001];
for(;;){
scanf("%d %d %d", &n, &m, &p);
if(n==0&&m==0&&p==0) break;
for(i=0;i<n;i++){
scanf("%d", &x[i]);
sum=sum+x[i];
}
r=sum*(100-p);
if(x[m-1]!=0){
ans=r/x[m-1];
} else if(x[m-1]==0){
ans=0;
}
printf("%d\n", ans);
sum=0;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219373/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219373/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%n = alloca i32, align 4
%p = alloca i32, align 4
%x = alloca [1001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #3
call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %x) #3
%call34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %p)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp35 = icmp eq i32 %0, 0
%1 = load i32, ptr %m, align 4
%cmp136 = icmp eq i32 %1, 0
%or.cond37 = select i1 %cmp35, i1 %cmp136, i1 false
%2 = load i32, ptr %p, align 4
%cmp338 = icmp eq i32 %2, 0
%or.cond2639 = select i1 %or.cond37, i1 %cmp338, i1 false
br i1 %or.cond2639, label %for.end25, label %for.cond4.preheader
for.cond4.preheader: ; preds = %entry, %if.end23
%3 = phi i32 [ %12, %if.end23 ], [ %1, %entry ]
%4 = phi i32 [ %11, %if.end23 ], [ %0, %entry ]
%cmp531 = icmp sgt i32 %4, 0
br i1 %cmp531, label %for.body, label %for.end
for.body: ; preds = %for.cond4.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond4.preheader ]
%sum.133 = phi i32 [ %add, %for.body ], [ 0, %for.cond4.preheader ]
%arrayidx = getelementptr inbounds [1001 x i32], ptr %x, i64 0, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %5, %sum.133
%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
%cmp5 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp5, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%.pre = load i32, ptr %m, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %for.cond4.preheader
%8 = phi i32 [ %3, %for.cond4.preheader ], [ %.pre, %for.end.loopexit ]
%sum.1.lcssa = phi i32 [ 0, %for.cond4.preheader ], [ %add, %for.end.loopexit ]
%sub9 = add nsw i32 %8, -1
%idxprom10 = sext i32 %sub9 to i64
%arrayidx11 = getelementptr inbounds [1001 x i32], ptr %x, i64 0, i64 %idxprom10
%9 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12.not = icmp eq i32 %9, 0
br i1 %cmp12.not, label %if.end23, label %if.then13
if.then13: ; preds = %for.end
%10 = load i32, ptr %p, align 4, !tbaa !5
%sub = sub nsw i32 100, %10
%mul = mul nsw i32 %sub, %sum.1.lcssa
%div = sdiv i32 %mul, %9
br label %if.end23
if.end23: ; preds = %for.end, %if.then13
%ans.1 = phi i32 [ %div, %if.then13 ], [ 0, %for.end ]
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.1)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %p)
%11 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %11, 0
%12 = load i32, ptr %m, align 4
%cmp1 = icmp eq i32 %12, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%13 = load i32, ptr %p, align 4
%cmp3 = icmp eq i32 %13, 0
%or.cond26 = select i1 %or.cond, i1 %cmp3, i1 false
br i1 %or.cond26, label %for.end25, label %for.cond4.preheader
for.end25: ; preds = %if.end23, %entry
call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int N;
int a;
int b;
scanf("%d",&N);
a=N%10;
b=N/100;
if(a==b){
printf("Yes\n");
}
else{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219416/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219416/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%rem = srem i32 %0, 10
%div = sdiv i32 %0, 100
%cmp = icmp eq i32 %rem, %div
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#define PI 3.14159265;
double alan(double d1){
double alan;
alan=(d1/2)*(d1/2)*PI;
return alan;
}
int main(){
double alan1,dusurme,d,h,v,e;
scanf("%lf%lf%lf%lf",&d,&h,&v,&e);
alan1=alan(d);
dusurme=v/alan1;
dusurme-=e;
if(dusurme<=0)
printf("NO");
else{
printf("YES\n");
printf("%lf",h/dusurme);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21946/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21946/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf%lf%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @alan(double noundef %d1) local_unnamed_addr #0 {
entry:
%div = fmul double %d1, 5.000000e-01
%mul = fmul double %div, %div
%mul2 = fmul double %mul, 0x400921FB53C8D4F1
ret double %mul2
}
; 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:
%d = alloca double, align 8
%h = alloca double, align 8
%v = alloca double, align 8
%e = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d, ptr noundef nonnull %h, ptr noundef nonnull %v, ptr noundef nonnull %e)
%0 = load double, ptr %d, align 8, !tbaa !5
%div.i = fmul double %0, 5.000000e-01
%mul.i = fmul double %div.i, %div.i
%mul2.i = fmul double %mul.i, 0x400921FB53C8D4F1
%1 = load double, ptr %v, align 8, !tbaa !5
%div = fdiv double %1, %mul2.i
%2 = load double, ptr %e, align 8, !tbaa !5
%sub = fsub double %div, %2
%cmp = fcmp ugt double %sub, 0.000000e+00
br i1 %cmp, label %if.else, label %if.then
if.then: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end
if.else: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%3 = load double, ptr %h, align 8, !tbaa !5
%div4 = fdiv double %3, %sub
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %div4)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
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 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main() {
char N[1500] = {};
scanf("%s", N);
// scanf("%d %d",&n,&m);
if(N[0]==N[2])printf("Yes\n");
else printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219502/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219502/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca [1500 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1500, ptr nonnull %N) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1500) %N, i8 0, i64 1500, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i8, ptr %N, align 16, !tbaa !5
%arrayidx1 = getelementptr inbounds [1500 x i8], ptr %N, i64 0, i64 2
%1 = load i8, ptr %arrayidx1, align 2, !tbaa !5
%cmp = icmp eq i8 %0, %1
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 1500, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: 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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
char s[4];
scanf("%s",s);
printf("%s\n",(s[0]==s[2])?"Yes":"No");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219546/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219546/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%arrayidx1 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 2
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
%cond = select i1 %cmp, ptr @.str.2, ptr @.str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int a,b,N;
scanf("%d",&N);
100<=N<=999;
a=N/100;
b=N%10;
if(a==b)
printf("Yes\n");
else
printf("No\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219597/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219597/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%div = sdiv i32 %0, 100
%rem = srem i32 %0, 10
%cmp3 = icmp eq i32 %div, %rem
%str.3.str = select i1 %cmp3, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int a=0;
int b,c;
scanf("%d",&a);
b=a/100;
c=a/10;
a=a-c*10;
if(a==b){
printf("Yes");
}else{
printf("No");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219661/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219661/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
store i32 0, ptr %a, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%.fr = freeze i32 %0
%div = sdiv i32 %.fr, 100
%1 = srem i32 %.fr, 10
store i32 %1, ptr %a, align 4, !tbaa !5
%cmp = icmp eq i32 %1, %div
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int n,m,a;
double s,p,sp,max=0,e=0.0000001;
scanf("%d",&n);
while(n--){
scanf("%*d %d",&m);
for(s=sp=0;m--;s+=a*p){
scanf("%d %lf",&a,&p);
sp+=p;
}
if(max+e<s/sp)max=s/sp;
}
scanf("%*d %d",&m);
for(s=sp=0;m--;s+=a*p){
scanf("%d %lf",&a,&p);
sp+=p;
}//printf("%f %f\n",s/sp,max);
printf("%s\n",s/sp+e<max?"YES":"NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219704/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219704/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%*d %d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %lf\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.5 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca i32, align 4
%p = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %p) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%dec38 = add nsw i32 %0, -1
store i32 %dec38, ptr %n, align 4, !tbaa !5
%tobool.not39 = icmp eq i32 %0, 0
br i1 %tobool.not39, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%max.040 = phi double [ %max.1, %for.end ], [ 0.000000e+00, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%1 = load i32, ptr %m, align 4, !tbaa !5
%dec233 = add nsw i32 %1, -1
store i32 %dec233, ptr %m, align 4, !tbaa !5
%tobool3.not34 = icmp eq i32 %1, 0
br i1 %tobool3.not34, label %for.end, label %for.body
for.body: ; preds = %while.body, %for.body
%s.036 = phi double [ %4, %for.body ], [ 0.000000e+00, %while.body ]
%sp.035 = phi double [ %add, %for.body ], [ 0.000000e+00, %while.body ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a, ptr noundef nonnull %p)
%2 = load double, ptr %p, align 8, !tbaa !9
%add = fadd double %sp.035, %2
%3 = load i32, ptr %a, align 4, !tbaa !5
%conv = sitofp i32 %3 to double
%4 = call double @llvm.fmuladd.f64(double %conv, double %2, double %s.036)
%5 = load i32, ptr %m, align 4, !tbaa !5
%dec2 = add nsw i32 %5, -1
store i32 %dec2, ptr %m, align 4, !tbaa !5
%tobool3.not = icmp eq i32 %5, 0
br i1 %tobool3.not, label %for.end.loopexit, label %for.body, !llvm.loop !11
for.end.loopexit: ; preds = %for.body
%6 = fdiv double %4, %add
br label %for.end
for.end: ; preds = %for.end.loopexit, %while.body
%div = phi double [ 0x7FF8000000000000, %while.body ], [ %6, %for.end.loopexit ]
%add5 = fadd double %max.040, 0x3E7AD7F29ABCAF48
%cmp = fcmp olt double %add5, %div
%max.1 = select i1 %cmp, double %div, double %max.040
%7 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %7, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %7, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %for.end, %entry
%max.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %max.1, %for.end ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%8 = load i32, ptr %m, align 4, !tbaa !5
%dec1042 = add nsw i32 %8, -1
store i32 %dec1042, ptr %m, align 4, !tbaa !5
%tobool11.not43 = icmp eq i32 %8, 0
br i1 %tobool11.not43, label %for.end17, label %for.body12
for.body12: ; preds = %while.end, %for.body12
%s.145 = phi double [ %11, %for.body12 ], [ 0.000000e+00, %while.end ]
%sp.144 = phi double [ %add14, %for.body12 ], [ 0.000000e+00, %while.end ]
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a, ptr noundef nonnull %p)
%9 = load double, ptr %p, align 8, !tbaa !9
%add14 = fadd double %sp.144, %9
%10 = load i32, ptr %a, align 4, !tbaa !5
%conv16 = sitofp i32 %10 to double
%11 = call double @llvm.fmuladd.f64(double %conv16, double %9, double %s.145)
%12 = load i32, ptr %m, align 4, !tbaa !5
%dec10 = add nsw i32 %12, -1
store i32 %dec10, ptr %m, align 4, !tbaa !5
%tobool11.not = icmp eq i32 %12, 0
br i1 %tobool11.not, label %for.end17.loopexit, label %for.body12, !llvm.loop !14
for.end17.loopexit: ; preds = %for.body12
%13 = fdiv double %11, %add14
%14 = fadd double %13, 0x3E7AD7F29ABCAF48
br label %for.end17
for.end17: ; preds = %for.end17.loopexit, %while.end
%div18 = phi double [ 0x7FF8000000000000, %while.end ], [ %14, %for.end17.loopexit ]
%cmp20 = fcmp olt double %div18, %max.0.lcssa
%cond = select i1 %cmp20, ptr @.str.4, ptr @.str.5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %p) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
|
#include <stdio.h>
#include <math.h>
int main(void){
int a;
int b;
int m;
int xm[100000];
int ym[100000];
int cm[100000];
int ai[100000];
int bi[100000];
int x=100000;
int y=100000;
scanf("%d %d %d",&a,&b,&m);
for(int i=0; i<a; i++){
scanf("%d",&ai[i]);
x=fmin(x,ai[i]);
}
for(int i=0; i<b; i++){
scanf("%d",&bi[i]);
y=fmin(y,bi[i]);
}
int s=x+y;
for(int i=0; i<m; i++){
scanf("%d %d %d",&xm[i],&ym[i],&cm[i]);
s=fmin(s,(ai[xm[i]-1]+bi[ym[i]-1]-cm[i]));
}
printf("%d",s);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219755/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219755/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%m = alloca i32, align 4
%xm = alloca [100000 x i32], align 16
%ym = alloca [100000 x i32], align 16
%cm = alloca [100000 x i32], align 16
%ai = alloca [100000 x i32], align 16
%bi = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %xm) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %ym) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %cm) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %ai) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %bi) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %m)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp72 = icmp sgt i32 %0, 0
br i1 %cmp72, label %for.body, label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body, %entry
%x.0.lcssa = phi i32 [ 100000, %entry ], [ %conv5, %for.body ]
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp875 = icmp sgt i32 %1, 0
br i1 %cmp875, label %for.body11, label %for.cond.cleanup10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%x.073 = phi i32 [ %conv5, %for.body ], [ 100000, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %ai, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%conv = sitofp i32 %x.073 to double
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%conv4 = sitofp i32 %2 to double
%3 = call double @llvm.minnum.f64(double %conv, double %conv4)
%conv5 = fptosi double %3 to i32
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %a, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond7.preheader, !llvm.loop !9
for.cond.cleanup10: ; preds = %for.body11, %for.cond7.preheader
%y.0.lcssa = phi i32 [ 100000, %for.cond7.preheader ], [ %conv19, %for.body11 ]
%add = add nsw i32 %y.0.lcssa, %x.0.lcssa
%6 = load i32, ptr %m, align 4, !tbaa !5
%cmp2579 = icmp sgt i32 %6, 0
br i1 %cmp2579, label %for.body28, label %for.cond.cleanup27
for.body11: ; preds = %for.cond7.preheader, %for.body11
%indvars.iv84 = phi i64 [ %indvars.iv.next85, %for.body11 ], [ 0, %for.cond7.preheader ]
%y.076 = phi i32 [ %conv19, %for.body11 ], [ 100000, %for.cond7.preheader ]
%arrayidx13 = getelementptr inbounds [100000 x i32], ptr %bi, i64 0, i64 %indvars.iv84
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx13)
%conv15 = sitofp i32 %y.076 to double
%7 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%conv18 = sitofp i32 %7 to double
%8 = call double @llvm.minnum.f64(double %conv15, double %conv18)
%conv19 = fptosi double %8 to i32
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%9 = load i32, ptr %b, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp8 = icmp slt i64 %indvars.iv.next85, %10
br i1 %cmp8, label %for.body11, label %for.cond.cleanup10, !llvm.loop !11
for.cond.cleanup27: ; preds = %for.body28, %for.cond.cleanup10
%s.0.lcssa = phi i32 [ %add, %for.cond.cleanup10 ], [ %conv51, %for.body28 ]
%call55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %s.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %bi) #4
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %ai) #4
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %cm) #4
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %ym) #4
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %xm) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
for.body28: ; preds = %for.cond.cleanup10, %for.body28
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.body28 ], [ 0, %for.cond.cleanup10 ]
%s.080 = phi i32 [ %conv51, %for.body28 ], [ %add, %for.cond.cleanup10 ]
%arrayidx30 = getelementptr inbounds [100000 x i32], ptr %xm, i64 0, i64 %indvars.iv87
%arrayidx32 = getelementptr inbounds [100000 x i32], ptr %ym, i64 0, i64 %indvars.iv87
%arrayidx34 = getelementptr inbounds [100000 x i32], ptr %cm, i64 0, i64 %indvars.iv87
%call35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx30, ptr noundef nonnull %arrayidx32, ptr noundef nonnull %arrayidx34)
%conv36 = sitofp i32 %s.080 to double
%11 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%sub = add nsw i32 %11, -1
%idxprom39 = sext i32 %sub to i64
%arrayidx40 = getelementptr inbounds [100000 x i32], ptr %ai, i64 0, i64 %idxprom39
%12 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%13 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%sub43 = add nsw i32 %13, -1
%idxprom44 = sext i32 %sub43 to i64
%arrayidx45 = getelementptr inbounds [100000 x i32], ptr %bi, i64 0, i64 %idxprom44
%14 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%add46 = add nsw i32 %14, %12
%15 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%sub49 = sub i32 %add46, %15
%conv50 = sitofp i32 %sub49 to double
%16 = call double @llvm.minnum.f64(double %conv36, double %conv50)
%conv51 = fptosi double %16 to i32
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%17 = load i32, ptr %m, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp25 = icmp slt i64 %indvars.iv.next88, %18
br i1 %cmp25, label %for.body28, label %for.cond.cleanup27, !llvm.loop !12
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.minnum.f64(double, double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int min(int a, int b)
{
if(a>b) return b;
else return a;
}
int main()
{
int A, B, M;
scanf("%d %d %d", &A, &B, &M);
int a[A], b[B];
for(int i=0;i<A;i++) scanf("%d", &a[i]);
for(int i=0;i<B;i++) scanf("%d", &b[i]);
int x[M], y[M], c[M];
for(int i=0;i<M;i++) scanf("%d %d %d", &x[i], &y[i], &c[i]);
int amin=a[0], bmin=b[0];
for(int i=0;i<A;i++) amin=min(amin,a[i]);
for(int i=0;i<B;i++) bmin=min(bmin,b[i]);
int nocou=amin+bmin;
int cou[M];
for(int i=0;i<M;i++) cou[i]=a[x[i]-1]+b[y[i]-1]-c[i];
int ans = nocou;
for(int i=0;i<M;i++) ans=min(ans, cou[i]);
printf("%d", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219799/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219799/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%b.a = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %b.a
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%M = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #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 %A, ptr noundef nonnull %B, ptr noundef nonnull %M)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %B, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%5 = load i32, ptr %A, align 4, !tbaa !5
%cmp116 = icmp sgt i32 %5, 0
br i1 %cmp116, label %for.body, label %for.cond4.preheader
for.cond4.preheader.loopexit: ; preds = %for.body
%.pre = load i32, ptr %B, align 4, !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond4.preheader.loopexit, %entry
%6 = phi i32 [ %.pre, %for.cond4.preheader.loopexit ], [ %3, %entry ]
%cmp5118 = icmp sgt i32 %6, 0
br i1 %cmp5118, label %for.body7, label %for.cond.cleanup6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %A, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %for.cond4.preheader.loopexit, !llvm.loop !9
for.cond.cleanup6: ; preds = %for.body7, %for.cond4.preheader
%9 = load i32, ptr %M, align 4, !tbaa !5
%10 = zext i32 %9 to i64
%vla14 = alloca i32, i64 %10, align 16
%vla15 = alloca i32, i64 %10, align 16
%vla16 = alloca i32, i64 %10, align 16
%cmp19120 = icmp sgt i32 %9, 0
br i1 %cmp19120, label %for.body21, label %for.cond.cleanup20
for.body7: ; preds = %for.cond4.preheader, %for.body7
%indvars.iv138 = phi i64 [ %indvars.iv.next139, %for.body7 ], [ 0, %for.cond4.preheader ]
%arrayidx9 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv138
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx9)
%indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
%11 = load i32, ptr %B, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp5 = icmp slt i64 %indvars.iv.next139, %12
br i1 %cmp5, label %for.body7, label %for.cond.cleanup6, !llvm.loop !11
for.cond.cleanup20: ; preds = %for.body21, %for.cond.cleanup6
%.lcssa = phi i32 [ %9, %for.cond.cleanup6 ], [ %22, %for.body21 ]
%13 = load i32, ptr %vla, align 16, !tbaa !5
%14 = load i32, ptr %vla1, align 16, !tbaa !5
%15 = load i32, ptr %A, align 4, !tbaa !5
%cmp36122 = icmp sgt i32 %15, 0
br i1 %cmp36122, label %for.body38.preheader, label %for.cond46.preheader
for.body38.preheader: ; preds = %for.cond.cleanup20
%wide.trip.count = zext i32 %15 to i64
%min.iters.check = icmp ult i32 %15, 8
br i1 %min.iters.check, label %for.body38.preheader210, label %vector.ph
vector.ph: ; preds = %for.body38.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
%minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %13, i64 0
%minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %18, %vector.body ]
%vec.phi164 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %19, %vector.body ]
%16 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %16, align 16, !tbaa !5
%17 = getelementptr inbounds i32, ptr %16, i64 4
%wide.load165 = load <4 x i32>, ptr %17, align 16, !tbaa !5
%18 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
%19 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi164, <4 x i32> %wide.load165)
%index.next = add nuw i64 %index, 8
%20 = icmp eq i64 %index.next, %n.vec
br i1 %20, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %18, <4 x i32> %19)
%21 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond46.preheader, label %for.body38.preheader210
for.body38.preheader210: ; preds = %for.body38.preheader, %middle.block
%indvars.iv144.ph = phi i64 [ 0, %for.body38.preheader ], [ %n.vec, %middle.block ]
%amin.0123.ph = phi i32 [ %13, %for.body38.preheader ], [ %21, %middle.block ]
br label %for.body38
for.body21: ; preds = %for.cond.cleanup6, %for.body21
%indvars.iv141 = phi i64 [ %indvars.iv.next142, %for.body21 ], [ 0, %for.cond.cleanup6 ]
%arrayidx23 = getelementptr inbounds i32, ptr %vla14, i64 %indvars.iv141
%arrayidx25 = getelementptr inbounds i32, ptr %vla15, i64 %indvars.iv141
%arrayidx27 = getelementptr inbounds i32, ptr %vla16, i64 %indvars.iv141
%call28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx23, ptr noundef nonnull %arrayidx25, ptr noundef nonnull %arrayidx27)
%indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1
%22 = load i32, ptr %M, align 4, !tbaa !5
%23 = sext i32 %22 to i64
%cmp19 = icmp slt i64 %indvars.iv.next142, %23
br i1 %cmp19, label %for.body21, label %for.cond.cleanup20, !llvm.loop !15
for.cond46.preheader: ; preds = %for.body38, %middle.block, %for.cond.cleanup20
%amin.0.lcssa = phi i32 [ %13, %for.cond.cleanup20 ], [ %21, %middle.block ], [ %b.a.i, %for.body38 ]
%24 = load i32, ptr %B, align 4, !tbaa !5
%cmp47126 = icmp sgt i32 %24, 0
br i1 %cmp47126, label %for.body49.preheader, label %for.cond.cleanup48
for.body49.preheader: ; preds = %for.cond46.preheader
%wide.trip.count150 = zext i32 %24 to i64
%min.iters.check168 = icmp ult i32 %24, 8
br i1 %min.iters.check168, label %for.body49.preheader207, label %vector.ph169
vector.ph169: ; preds = %for.body49.preheader
%n.vec171 = and i64 %wide.trip.count150, 4294967288
%minmax.ident.splatinsert178 = insertelement <4 x i32> poison, i32 %14, i64 0
%minmax.ident.splat179 = shufflevector <4 x i32> %minmax.ident.splatinsert178, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body174
vector.body174: ; preds = %vector.body174, %vector.ph169
%index175 = phi i64 [ 0, %vector.ph169 ], [ %index.next182, %vector.body174 ]
%vec.phi176 = phi <4 x i32> [ %minmax.ident.splat179, %vector.ph169 ], [ %27, %vector.body174 ]
%vec.phi177 = phi <4 x i32> [ %minmax.ident.splat179, %vector.ph169 ], [ %28, %vector.body174 ]
%25 = getelementptr inbounds i32, ptr %vla1, i64 %index175
%wide.load180 = load <4 x i32>, ptr %25, align 16, !tbaa !5
%26 = getelementptr inbounds i32, ptr %25, i64 4
%wide.load181 = load <4 x i32>, ptr %26, align 16, !tbaa !5
%27 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi176, <4 x i32> %wide.load180)
%28 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi177, <4 x i32> %wide.load181)
%index.next182 = add nuw i64 %index175, 8
%29 = icmp eq i64 %index.next182, %n.vec171
br i1 %29, label %middle.block166, label %vector.body174, !llvm.loop !16
middle.block166: ; preds = %vector.body174
%rdx.minmax183 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %27, <4 x i32> %28)
%30 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax183)
%cmp.n173 = icmp eq i64 %n.vec171, %wide.trip.count150
br i1 %cmp.n173, label %for.cond.cleanup48, label %for.body49.preheader207
for.body49.preheader207: ; preds = %for.body49.preheader, %middle.block166
%indvars.iv147.ph = phi i64 [ 0, %for.body49.preheader ], [ %n.vec171, %middle.block166 ]
%bmin.0127.ph = phi i32 [ %14, %for.body49.preheader ], [ %30, %middle.block166 ]
br label %for.body49
for.body38: ; preds = %for.body38.preheader210, %for.body38
%indvars.iv144 = phi i64 [ %indvars.iv.next145, %for.body38 ], [ %indvars.iv144.ph, %for.body38.preheader210 ]
%amin.0123 = phi i32 [ %b.a.i, %for.body38 ], [ %amin.0123.ph, %for.body38.preheader210 ]
%arrayidx40 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv144
%31 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%b.a.i = call i32 @llvm.smin.i32(i32 %amin.0123, i32 %31)
%indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
%exitcond.not = icmp eq i64 %indvars.iv.next145, %wide.trip.count
br i1 %exitcond.not, label %for.cond46.preheader, label %for.body38, !llvm.loop !17
for.cond.cleanup48: ; preds = %for.body49, %middle.block166, %for.cond46.preheader
%bmin.0.lcssa = phi i32 [ %14, %for.cond46.preheader ], [ %30, %middle.block166 ], [ %b.a.i114, %for.body49 ]
%add = add nsw i32 %bmin.0.lcssa, %amin.0.lcssa
%32 = zext i32 %.lcssa to i64
%vla56 = alloca i32, i64 %32, align 16
%cmp59130 = icmp sgt i32 %.lcssa, 0
br i1 %cmp59130, label %for.body61, label %for.cond.cleanup83
for.body49: ; preds = %for.body49.preheader207, %for.body49
%indvars.iv147 = phi i64 [ %indvars.iv.next148, %for.body49 ], [ %indvars.iv147.ph, %for.body49.preheader207 ]
%bmin.0127 = phi i32 [ %b.a.i114, %for.body49 ], [ %bmin.0127.ph, %for.body49.preheader207 ]
%arrayidx51 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv147
%33 = load i32, ptr %arrayidx51, align 4, !tbaa !5
%b.a.i114 = call i32 @llvm.smin.i32(i32 %bmin.0127, i32 %33)
%indvars.iv.next148 = add nuw nsw i64 %indvars.iv147, 1
%exitcond151.not = icmp eq i64 %indvars.iv.next148, %wide.trip.count150
br i1 %exitcond151.not, label %for.cond.cleanup48, label %for.body49, !llvm.loop !18
for.cond81.preheader: ; preds = %for.body61
br i1 %cmp59130, label %for.body84.preheader, label %for.cond.cleanup83
for.body84.preheader: ; preds = %for.cond81.preheader
%min.iters.check187 = icmp ult i32 %.lcssa, 8
br i1 %min.iters.check187, label %for.body84.preheader204, label %vector.ph188
vector.ph188: ; preds = %for.body84.preheader
%n.vec190 = and i64 %32, 4294967288
%minmax.ident.splatinsert197 = insertelement <4 x i32> poison, i32 %add, i64 0
%minmax.ident.splat198 = shufflevector <4 x i32> %minmax.ident.splatinsert197, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body193
vector.body193: ; preds = %vector.body193, %vector.ph188
%index194 = phi i64 [ 0, %vector.ph188 ], [ %index.next201, %vector.body193 ]
%vec.phi195 = phi <4 x i32> [ %minmax.ident.splat198, %vector.ph188 ], [ %36, %vector.body193 ]
%vec.phi196 = phi <4 x i32> [ %minmax.ident.splat198, %vector.ph188 ], [ %37, %vector.body193 ]
%34 = getelementptr inbounds i32, ptr %vla56, i64 %index194
%wide.load199 = load <4 x i32>, ptr %34, align 16, !tbaa !5
%35 = getelementptr inbounds i32, ptr %34, i64 4
%wide.load200 = load <4 x i32>, ptr %35, align 16, !tbaa !5
%36 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi195, <4 x i32> %wide.load199)
%37 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi196, <4 x i32> %wide.load200)
%index.next201 = add nuw i64 %index194, 8
%38 = icmp eq i64 %index.next201, %n.vec190
br i1 %38, label %middle.block185, label %vector.body193, !llvm.loop !19
middle.block185: ; preds = %vector.body193
%rdx.minmax202 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %36, <4 x i32> %37)
%39 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax202)
%cmp.n192 = icmp eq i64 %n.vec190, %32
br i1 %cmp.n192, label %for.cond.cleanup83, label %for.body84.preheader204
for.body84.preheader204: ; preds = %for.body84.preheader, %middle.block185
%indvars.iv157.ph = phi i64 [ 0, %for.body84.preheader ], [ %n.vec190, %middle.block185 ]
%ans.0133.ph = phi i32 [ %add, %for.body84.preheader ], [ %39, %middle.block185 ]
br label %for.body84
for.body61: ; preds = %for.cond.cleanup48, %for.body61
%indvars.iv152 = phi i64 [ %indvars.iv.next153, %for.body61 ], [ 0, %for.cond.cleanup48 ]
%arrayidx63 = getelementptr inbounds i32, ptr %vla14, i64 %indvars.iv152
%40 = load i32, ptr %arrayidx63, align 4, !tbaa !5
%sub = add nsw i32 %40, -1
%idxprom64 = sext i32 %sub to i64
%arrayidx65 = getelementptr inbounds i32, ptr %vla, i64 %idxprom64
%41 = load i32, ptr %arrayidx65, align 4, !tbaa !5
%arrayidx67 = getelementptr inbounds i32, ptr %vla15, i64 %indvars.iv152
%42 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%sub68 = add nsw i32 %42, -1
%idxprom69 = sext i32 %sub68 to i64
%arrayidx70 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom69
%43 = load i32, ptr %arrayidx70, align 4, !tbaa !5
%add71 = add nsw i32 %43, %41
%arrayidx73 = getelementptr inbounds i32, ptr %vla16, i64 %indvars.iv152
%44 = load i32, ptr %arrayidx73, align 4, !tbaa !5
%sub74 = sub i32 %add71, %44
%arrayidx76 = getelementptr inbounds i32, ptr %vla56, i64 %indvars.iv152
store i32 %sub74, ptr %arrayidx76, align 4, !tbaa !5
%indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 1
%exitcond156.not = icmp eq i64 %indvars.iv.next153, %32
br i1 %exitcond156.not, label %for.cond81.preheader, label %for.body61, !llvm.loop !20
for.cond.cleanup83: ; preds = %for.body84, %middle.block185, %for.cond.cleanup48, %for.cond81.preheader
%ans.0.lcssa = phi i32 [ %add, %for.cond81.preheader ], [ %add, %for.cond.cleanup48 ], [ %39, %middle.block185 ], [ %b.a.i115, %for.body84 ]
%call91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #6
ret i32 0
for.body84: ; preds = %for.body84.preheader204, %for.body84
%indvars.iv157 = phi i64 [ %indvars.iv.next158, %for.body84 ], [ %indvars.iv157.ph, %for.body84.preheader204 ]
%ans.0133 = phi i32 [ %b.a.i115, %for.body84 ], [ %ans.0133.ph, %for.body84.preheader204 ]
%arrayidx86 = getelementptr inbounds i32, ptr %vla56, i64 %indvars.iv157
%45 = load i32, ptr %arrayidx86, align 4, !tbaa !5
%b.a.i115 = call i32 @llvm.smin.i32(i32 %ans.0133, i32 %45)
%indvars.iv.next158 = add nuw nsw i64 %indvars.iv157, 1
%exitcond161.not = icmp eq i64 %indvars.iv.next158, %32
br i1 %exitcond161.not, label %for.cond.cleanup83, label %for.body84, !llvm.loop !21
}
; 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 nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smin.v4i32(<4 x i32>) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !13, !14}
!17 = distinct !{!17, !10, !14, !13}
!18 = distinct !{!18, !10, !14, !13}
!19 = distinct !{!19, !10, !13, !14}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10, !14, !13}
|
#include <stdio.h>
#include <stdbool.h>
int main(void)
{
int k, x;
scanf("%d %d",&k,&x);
int i = -1000000;
int c = 1;
while (i <= 1000000)
{
if(i>= x - k + 1 && i <= x + k -1)
{
if (k*2 - 1 == c)
printf("%d\n",i);
else
printf("%d ",i);
c++;
}
i++;
}
return(0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219841/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219841/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %x)
br label %while.body
while.body: ; preds = %entry, %if.end10
%c.020 = phi i32 [ 1, %entry ], [ %c.1, %if.end10 ]
%i.018 = phi i32 [ -1000000, %entry ], [ %inc11, %if.end10 ]
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %k, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%cmp1.not.not = icmp sgt i32 %i.018, %sub
%add2 = add nsw i32 %1, %0
%cmp4.not.not = icmp slt i32 %i.018, %add2
%or.cond = select i1 %cmp1.not.not, i1 %cmp4.not.not, i1 false
br i1 %or.cond, label %if.then, label %if.end10
if.then: ; preds = %while.body
%mul = shl nsw i32 %1, 1
%sub5 = add nsw i32 %mul, -1
%cmp6 = icmp eq i32 %sub5, %c.020
%.str.1..str.2 = select i1 %cmp6, ptr @.str.1, ptr @.str.2
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2, i32 noundef %i.018)
%inc = add nsw i32 %c.020, 1
br label %if.end10
if.end10: ; preds = %if.then, %while.body
%c.1 = phi i32 [ %inc, %if.then ], [ %c.020, %while.body ]
%inc11 = add nsw i32 %i.018, 1
%exitcond.not = icmp eq i32 %inc11, 1000001
br i1 %exitcond.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int k,x,i;
scanf("%d%d",&k,&x);
printf("%d",x-k+1);
for(i=2-k;i<k;i++) printf(" %d",x+i);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219885/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219885/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %k, align 4, !tbaa !5
%sub = add i32 %0, 1
%add = sub i32 %sub, %1
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%2 = load i32, ptr %k, align 4, !tbaa !5
%sub2 = sub nsw i32 2, %2
%cmp7 = icmp slt i32 %sub2, %2
br i1 %cmp7, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.08 = phi i32 [ %inc, %for.body ], [ %sub2, %entry ]
%3 = load i32, ptr %x, align 4, !tbaa !5
%add3 = add nsw i32 %3, %i.08
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add3)
%inc = add nsw i32 %i.08, 1
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int K;
int X;
scanf("%d", &K);
scanf("%d", &X);
for(int i = X - (K - 1); i <= X + (K - 1); i++)printf("%d ", i);
putchar('\n');
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219928/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219928/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%K = alloca i32, align 4
%X = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %K)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X)
%0 = load i32, ptr %X, align 4, !tbaa !5
%1 = load i32, ptr %K, align 4, !tbaa !5
%sub.neg = add i32 %0, 1
%sub2 = sub i32 %sub.neg, %1
%sub38 = add i32 %0, -1
%add9 = add i32 %sub38, %1
%cmp.not10 = icmp sgt i32 %sub2, %add9
br i1 %cmp.not10, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
%2 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i = call i32 @putc(i32 noundef 10, ptr noundef %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3
ret i32 0
for.body: ; preds = %entry, %for.body
%i.011 = phi i32 [ %inc, %for.body ], [ %sub2, %entry ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.011)
%inc = add nsw i32 %i.011, 1
%3 = load i32, ptr %X, align 4, !tbaa !5
%4 = load i32, ptr %K, align 4, !tbaa !5
%sub3 = add i32 %3, -1
%add = add i32 %sub3, %4
%cmp.not.not = icmp slt i32 %i.011, %add
br i1 %cmp.not.not, 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: 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~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"}
|
#include<stdio.h>
int main(){
int k,x,i;
scanf("%d%d",&k,&x);
for(i=k-1;i>=0;i--)printf("%d ",x-i);
for(i=1;i<k;i++)printf("%d ",x+i);
puts("");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_219971/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_219971/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %x)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end8
for.cond3.preheader: ; preds = %for.body
%.pre = load i32, ptr %k, align 4, !tbaa !5
%1 = icmp sgt i32 %.pre, 1
br i1 %1, label %for.body5, label %for.end8
for.body: ; preds = %entry, %for.body
%i.0.in16 = phi i32 [ %i.0, %for.body ], [ %0, %entry ]
%i.0 = add nsw i32 %i.0.in16, -1
%2 = load i32, ptr %x, align 4, !tbaa !5
%sub1 = sub nsw i32 %2, %i.0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub1)
%cmp = icmp ugt i32 %i.0.in16, 1
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.body5: ; preds = %for.cond3.preheader, %for.body5
%i.118 = phi i32 [ %inc, %for.body5 ], [ 1, %for.cond3.preheader ]
%3 = load i32, ptr %x, align 4, !tbaa !5
%add = add nsw i32 %3, %i.118
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%inc = add nuw nsw i32 %i.118, 1
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %4
br i1 %cmp4, label %for.body5, label %for.end8, !llvm.loop !11
for.end8: ; preds = %for.body5, %entry, %for.cond3.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, 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 @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 k,x,i,j;
scanf("%d %d",&k,&x);
for(i=0;i<2*k-1;i++){
printf("%d ",x-k+1+i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220012/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220012/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %x)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %0, 0
br i1 %cmp8, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%1 = phi i32 [ %3, %for.body ], [ %0, %entry ]
%i.09 = phi i32 [ %sub1, %for.body ], [ 0, %entry ]
%2 = load i32, ptr %x, align 4, !tbaa !5
%sub1 = add nuw nsw i32 %i.09, 1
%add = sub i32 %sub1, %1
%add2 = add i32 %add, %2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add2)
%3 = load i32, ptr %k, align 4, !tbaa !5
%mul = shl nsw i32 %3, 1
%sub = add nsw i32 %mul, -1
%cmp = icmp slt i32 %sub1, %sub
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int i,K,X;
scanf("%d", &K);
scanf("%d", &X);
if(K==1){
printf("%d ",X);
}
else{
for(i=K-1;i>=1;i--){
printf("%d ",X-i);
}
printf("%d ",X);
for(i=1;i<K;i++){
printf("%d ",X+i);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220056/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220056/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%K = alloca i32, align 4
%X = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %K)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X)
%0 = load i32, ptr %K, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp318 = icmp sgt i32 %0, 1
br i1 %cmp318, label %for.body, label %for.end
if.then: ; preds = %entry
%1 = load i32, ptr %X, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
br label %if.end
for.body: ; preds = %for.cond.preheader, %for.body
%i.0.in19 = phi i32 [ %i.0, %for.body ], [ %0, %for.cond.preheader ]
%i.0 = add nsw i32 %i.0.in19, -1
%2 = load i32, ptr %X, align 4, !tbaa !5
%sub4 = sub nsw i32 %2, %i.0
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub4)
%cmp3 = icmp ugt i32 %i.0.in19, 2
br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
%3 = load i32, ptr %X, align 4, !tbaa !5
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%4 = load i32, ptr %K, align 4, !tbaa !5
%cmp820 = icmp sgt i32 %4, 1
br i1 %cmp820, label %for.body9, label %if.end
for.body9: ; preds = %for.end, %for.body9
%i.121 = phi i32 [ %inc, %for.body9 ], [ 1, %for.end ]
%5 = load i32, ptr %X, align 4, !tbaa !5
%add = add nsw i32 %5, %i.121
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%inc = add nuw nsw i32 %i.121, 1
%6 = load i32, ptr %K, align 4, !tbaa !5
%cmp8 = icmp slt i32 %inc, %6
br i1 %cmp8, label %for.body9, label %if.end, !llvm.loop !11
if.end: ; preds = %for.body9, %for.end, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
long int pow2(int pow){
long int base = 1;
for(int i = 0; i < pow; i++)
base = base*2;
return base;
}
int main()
{
int t;
int n;
long int diff;
scanf("%d",&t);
for(int i = 0; i < t; i++){
scanf("%d",&n);
diff = 2*pow2(n/2) -2;
printf("%ld\n", diff);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2201/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2201/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @pow2(i32 noundef %pow) local_unnamed_addr #0 {
entry:
%cmp3 = icmp sgt i32 %pow, 0
br i1 %cmp3, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%xtraiter = and i32 %pow, 7
%0 = icmp ult i32 %pow, 8
br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i32 %pow, -8
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul, %for.body ]
%base.04.unr = phi i64 [ 1, %for.body.preheader ], [ %mul, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%base.04.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %base.04.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%mul.epil = shl nsw i64 %base.04.epil, 1
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !5
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%base.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %base.0.lcssa
for.body: ; preds = %for.body, %for.body.preheader.new
%base.04 = phi i64 [ 1, %for.body.preheader.new ], [ %mul, %for.body ]
%niter = phi i32 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = shl i64 %base.04, 8
%niter.next.7 = add i32 %niter, 8
%niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !9
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %pow2.exit, %entry
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
for.body: ; preds = %entry, %pow2.exit
%i.06 = phi i32 [ %inc, %pow2.exit ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !9
%div = sdiv i32 %1, 2
%cmp3.i = icmp sgt i32 %1, 1
br i1 %cmp3.i, label %for.body.i.preheader, label %pow2.exit
for.body.i.preheader: ; preds = %for.body
%2 = add nsw i32 %div, -1
%xtraiter = and i32 %div, 7
%3 = icmp ult i32 %2, 7
br i1 %3, label %pow2.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i32 %div, -8
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%base.04.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %mul.i, %for.body.i ]
%niter = phi i32 [ 0, %for.body.i.preheader.new ], [ %niter.next.7, %for.body.i ]
%mul.i = shl i64 %base.04.i, 8
%niter.next.7 = add i32 %niter, 8
%niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %pow2.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !7
pow2.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%mul.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %mul.i, %for.body.i ]
%base.04.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %mul.i, %for.body.i ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %pow2.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %pow2.exit.loopexit.unr-lcssa, %for.body.i.epil
%base.04.i.epil = phi i64 [ %mul.i.epil, %for.body.i.epil ], [ %base.04.i.unr, %pow2.exit.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.i.epil ], [ 0, %pow2.exit.loopexit.unr-lcssa ]
%mul.i.epil = shl nsw i64 %base.04.i.epil, 1
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %pow2.exit, label %for.body.i.epil, !llvm.loop !13
pow2.exit: ; preds = %pow2.exit.loopexit.unr-lcssa, %for.body.i.epil, %for.body
%base.0.lcssa.i = phi i64 [ 1, %for.body ], [ %mul.i.lcssa.ph, %pow2.exit.loopexit.unr-lcssa ], [ %mul.i.epil, %for.body.i.epil ]
%mul = shl nsw i64 %base.0.lcssa.i, 1
%sub = add nsw i64 %mul, -2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub)
%inc = add nuw nsw i32 %i.06, 1
%4 = load i32, ptr %t, align 4, !tbaa !9
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !14
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.unroll.disable"}
!7 = distinct !{!7, !8}
!8 = !{!"llvm.loop.mustprogress"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C/C++ TBAA"}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !8}
|
#include <stdio.h>
int main(void) {
int k,x;
scanf("%d %d",&k,&x);
int isi = x-(k-1);
int i = 0;
while(i < k*2-1) {
printf("%d ",isi);
isi++;i++;
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220142/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220142/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %x)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %entry
%1 = load i32, ptr %x, align 4, !tbaa !5
%sub.neg = add i32 %1, 1
%sub1 = sub i32 %sub.neg, %0
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%i.012 = phi i32 [ %inc4, %while.body ], [ 0, %while.body.preheader ]
%isi.011 = phi i32 [ %inc, %while.body ], [ %sub1, %while.body.preheader ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %isi.011)
%inc = add nsw i32 %isi.011, 1
%inc4 = add nuw nsw i32 %i.012, 1
%2 = load i32, ptr %k, align 4, !tbaa !5
%mul = shl nsw i32 %2, 1
%sub2 = add nsw i32 %mul, -1
%cmp = icmp slt i32 %inc4, %sub2
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, 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 @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"}
|
#include <stdio.h>
int main(void){
int K, X;
scanf("%d%d", &K, &X);
for (int i = -K+1; i < K; i++) {
printf("%d%c", X+i, i == K-1?'\n':' ');
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220186/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220186/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"%d%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%K = alloca i32, align 4
%X = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %K, ptr noundef nonnull %X)
%0 = load i32, ptr %K, align 4, !tbaa !5
%add = sub i32 1, %0
%cmp8 = icmp slt i32 %add, %0
br i1 %cmp8, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3
ret i32 0
for.body: ; preds = %entry, %for.body
%1 = phi i32 [ %3, %for.body ], [ %0, %entry ]
%i.09 = phi i32 [ %inc, %for.body ], [ %add, %entry ]
%2 = load i32, ptr %X, align 4, !tbaa !5
%add1 = add nsw i32 %2, %i.09
%sub2 = add nsw i32 %1, -1
%cmp3 = icmp eq i32 %i.09, %sub2
%cond = select i1 %cmp3, i32 10, i32 32
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add1, i32 noundef %cond)
%inc = add nsw i32 %i.09, 1
%3 = load i32, ptr %K, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %3
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: 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 L, N;
int x, w;
int i;
int AsumiKana = 0;
if (scanf("%d", &L) != 1) return 1;
if (scanf("%d", &N) != 1) return 1;
for (i = 0; i < N; i++) {
if (scanf("%d%d", &x, &w) != 2) return 1;
AsumiKana += x * w;
}
if (AsumiKana > 0) {
printf("1\n-1 %d\n", AsumiKana);
} else if (AsumiKana < 0) {
printf("1\n1 %d\n", -AsumiKana);
} else {
puts("0");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220236/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220236/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"1\0A-1 %d\0A\00", align 1
@.str.3 = private unnamed_addr constant [8 x i8] c"1\0A1 %d\0A\00", align 1
@.str.4 = 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:
%L = alloca i32, align 4
%N = alloca i32, align 4
%x = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %L) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %L)
%cmp.not = icmp eq i32 %call, 1
br i1 %cmp.not, label %if.end, label %cleanup
if.end: ; preds = %entry
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%cmp2.not = icmp eq i32 %call1, 1
br i1 %cmp2.not, label %for.cond.preheader, label %cleanup
for.cond.preheader: ; preds = %if.end
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp531 = icmp sgt i32 %0, 0
br i1 %cmp531, label %for.body, label %if.else16
for.body: ; preds = %for.cond.preheader, %if.end9
%AsumiKana.033 = phi i32 [ %add, %if.end9 ], [ 0, %for.cond.preheader ]
%i.032 = phi i32 [ %inc, %if.end9 ], [ 0, %for.cond.preheader ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %w)
%cmp7.not = icmp eq i32 %call6, 2
br i1 %cmp7.not, label %if.end9, label %cleanup
if.end9: ; preds = %for.body
%1 = load i32, ptr %x, align 4, !tbaa !5
%2 = load i32, ptr %w, align 4, !tbaa !5
%mul = mul nsw i32 %2, %1
%add = add nsw i32 %mul, %AsumiKana.033
%inc = add nuw nsw i32 %i.032, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp5 = icmp slt i32 %inc, %3
br i1 %cmp5, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %if.end9
%cmp10 = icmp sgt i32 %add, 0
br i1 %cmp10, label %if.then11, label %if.else
if.then11: ; preds = %for.end
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add)
br label %cleanup
if.else: ; preds = %for.end
%cmp13 = icmp slt i32 %add, 0
br i1 %cmp13, label %if.then14, label %if.else16
if.then14: ; preds = %if.else
%sub = sub nsw i32 0, %add
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %sub)
br label %cleanup
if.else16: ; preds = %for.cond.preheader, %if.else
%call17 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.4)
br label %cleanup
cleanup: ; preds = %for.body, %if.then11, %if.else16, %if.then14, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %if.end ], [ 0, %if.then14 ], [ 0, %if.else16 ], [ 0, %if.then11 ], [ 1, %for.body ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %L) #3
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
long long int n;
scanf("%lld",&n);
long long int count = 1;
while( n > count)
{
n = n - count;
count++;
}
if(n> 0)
{
printf("%lld",n);
}
else
printf("%lld",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22028/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22028/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%.pr = load i64, ptr %n, align 8, !tbaa !5
%cmp7 = icmp sgt i64 %.pr, 1
br i1 %cmp7, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%count.08 = phi i64 [ %inc, %while.body ], [ 1, %entry ]
%0 = phi i64 [ %sub, %while.body ], [ %.pr, %entry ]
%sub = sub nsw i64 %0, %count.08
%inc = add nuw nsw i64 %count.08, 1
%cmp = icmp sgt i64 %sub, %inc
br i1 %cmp, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i64 %sub, ptr %n, align 8, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%.lcssa = phi i64 [ %sub, %while.cond.while.end_crit_edge ], [ %.pr, %entry ]
%count.0.lcssa = phi i64 [ %inc, %while.cond.while.end_crit_edge ], [ 1, %entry ]
%cmp1 = icmp sgt i64 %.lcssa, 0
%.lcssa.count.0.lcssa = select i1 %cmp1, i64 %.lcssa, i64 %count.0.lcssa
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %.lcssa.count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
long long int x,i,n,s;
x=1;
scanf("%lld",&n);
for(i=1;((i*(i+1))/2)<=n;i++)
{
x=i;
}
s=(x*(x+1))/2;
// printf("x=%lld ",x);
if((x*(x+1)/2)==n)
printf("%lld\n",x);
else
printf("%lld\n",(n-s));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22033/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22033/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%i.0 = phi i64 [ 1, %entry ], [ %add, %for.cond ]
%x.0 = phi i64 [ 1, %entry ], [ %i.0, %for.cond ]
%add = add nuw nsw i64 %i.0, 1
%mul = mul nsw i64 %add, %i.0
%div17 = lshr i64 %mul, 1
%cmp.not = icmp sgt i64 %div17, %0
br i1 %cmp.not, label %for.end, label %for.cond, !llvm.loop !9
for.end: ; preds = %for.cond
%add1 = add nuw nsw i64 %x.0, 1
%mul2 = mul nsw i64 %add1, %x.0
%div318 = lshr i64 %mul2, 1
%cmp7 = icmp eq i64 %div318, %0
%sub = sub nsw i64 %0, %div318
%sub.sink = select i1 %cmp7, i64 %x.0, i64 %sub
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub.sink)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Node{
int key;
struct Node *right;
struct Node *left;
struct Node *parent;
};
struct Node *root;
struct Node *NIL;
struct Node *find(struct Node *u, int k){
while (u != NIL && k != u->key){
if(k < u->key) u = u->left;
else u = u->right;
}
return u;
}
void insert(int k){
struct Node *y = NIL;
struct Node *x = root;
struct Node *z;
z = (struct Node *)malloc(sizeof(struct Node));
z->key = k;
z->left = NIL;
z->right = NIL;
while(x != NIL){
y = x;
if(z->key < x-> key) x = x->left;
else x = x->right;
}
z->parent = y;
if(y == NIL) root = z;
else{
if(z->key < y->key) y->left = z;
else y -> right = z;
}
}
void inorder(struct Node *u){
if(u == NIL) return;
inorder(u->left);
printf(" %d", u->key);
inorder(u->right);
}
void preorder(struct Node *u){
if(u == NIL) return;
printf(" %d", u->key);
preorder(u->left);
preorder(u->right);
}
int main(){
int n;
int i,j;
int x;
int count=0;
int cnt[10];
int tmp=0;
struct Node *t;
char *com;
char *comin = "insert";
char *compr = "print";
com = (char*)malloc(7*sizeof(char));
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%s", com);
if(com[0] == 'f'){
scanf("%d", &x);
t = find(root, x);
if(t != NIL){
printf("yes\n");
}
else{
printf("no\n");
}
}
else if(strncmp(com,comin,6)==0){
scanf("%d",&x);
insert(x);
}
else if(strncmp(com,compr,5)==0){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220380/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220380/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, ptr, ptr, ptr }
@NIL = dso_local local_unnamed_addr global ptr null, align 8
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"insert\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"print\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.8 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @find(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp.not10 = icmp eq ptr %0, %u
br i1 %cmp.not10, label %while.end, label %land.rhs
land.rhs: ; preds = %entry, %while.body
%u.addr.011 = phi ptr [ %u.addr.1, %while.body ], [ %u, %entry ]
%1 = load i32, ptr %u.addr.011, align 8, !tbaa !9
%cmp1.not = icmp eq i32 %1, %k
br i1 %cmp1.not, label %while.end, label %while.body
while.body: ; preds = %land.rhs
%cmp3 = icmp sgt i32 %1, %k
%left = getelementptr inbounds %struct.Node, ptr %u.addr.011, i64 0, i32 2
%right = getelementptr inbounds %struct.Node, ptr %u.addr.011, i64 0, i32 1
%u.addr.1.in = select i1 %cmp3, ptr %left, ptr %right
%u.addr.1 = load ptr, ptr %u.addr.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %u.addr.1, %0
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !12
while.end: ; preds = %land.rhs, %while.body, %entry
%u.addr.0.lcssa = phi ptr [ %u, %entry ], [ %0, %while.body ], [ %u.addr.011, %land.rhs ]
ret ptr %u.addr.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%1 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
store i32 %k, ptr %call, align 8, !tbaa !9
%left = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 2
store ptr %0, ptr %left, align 8, !tbaa !14
%right = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1
store ptr %0, ptr %right, align 8, !tbaa !15
%cmp.not34 = icmp eq ptr %1, %0
br i1 %cmp.not34, label %while.end.thread, label %while.body
while.end.thread: ; preds = %entry
%parent37 = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %0, ptr %parent37, align 8, !tbaa !16
br label %if.end17
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %1, %entry ]
%2 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %2, %k
%left4 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
%right5 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %right5
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, %0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !17
while.end: ; preds = %while.body
%parent = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %x.035, ptr %parent, align 8, !tbaa !16
%cmp6 = icmp eq ptr %x.035, %0
br i1 %cmp6, label %if.end17, label %if.else8
if.else8: ; preds = %while.end
%3 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %3, %k
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else8
%left13 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
br label %if.end17
if.else14: ; preds = %if.else8
%right15 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1
br label %if.end17
if.end17: ; preds = %while.end, %while.end.thread, %if.then12, %if.else14
%left13.sink = phi ptr [ %left13, %if.then12 ], [ %right15, %if.else14 ], [ @root, %while.end.thread ], [ @root, %while.end ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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) #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp4 = icmp eq ptr %0, %u
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ]
%left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%1 = load ptr, ptr %left, align 8, !tbaa !14
tail call void @inorder(ptr noundef %1)
%2 = load i32, ptr %u.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2)
%right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%3 = load ptr, ptr %right, align 8, !tbaa !15
%4 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp4 = icmp eq ptr %0, %u
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ]
%1 = load i32, ptr %u.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%2 = load ptr, ptr %left, align 8, !tbaa !14
tail call void @preorder(ptr noundef %2)
%right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%3 = load ptr, ptr %right, align 8, !tbaa !15
%4 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8
%call = tail call noalias dereferenceable_or_null(7) ptr @malloc(i64 noundef 7) #7
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !18
%cmp43 = icmp sgt i32 %0, 0
br i1 %cmp43, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.044 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef %call)
%1 = load i8, ptr %call, align 1, !tbaa !19
%cmp3 = icmp eq i8 %1, 102
br i1 %cmp3, label %if.then, label %if.else12
if.then: ; preds = %for.body
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %x)
%2 = load ptr, ptr @root, align 8, !tbaa !5
%3 = load i32, ptr %x, align 4, !tbaa !18
%4 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp.not10.i = icmp eq ptr %4, %2
br i1 %cmp.not10.i, label %find.exit, label %land.rhs.i
land.rhs.i: ; preds = %if.then, %while.body.i
%u.addr.011.i = phi ptr [ %u.addr.1.i, %while.body.i ], [ %2, %if.then ]
%5 = load i32, ptr %u.addr.011.i, align 8, !tbaa !9
%cmp1.not.i = icmp eq i32 %5, %3
br i1 %cmp1.not.i, label %find.exit, label %while.body.i
while.body.i: ; preds = %land.rhs.i
%cmp3.i = icmp sgt i32 %5, %3
%left.i = getelementptr inbounds %struct.Node, ptr %u.addr.011.i, i64 0, i32 2
%right.i = getelementptr inbounds %struct.Node, ptr %u.addr.011.i, i64 0, i32 1
%u.addr.1.in.i = select i1 %cmp3.i, ptr %left.i, ptr %right.i
%u.addr.1.i = load ptr, ptr %u.addr.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %u.addr.1.i, %4
br i1 %cmp.not.i, label %if.else, label %land.rhs.i, !llvm.loop !12
find.exit: ; preds = %land.rhs.i, %if.then
%u.addr.0.lcssa.i = phi ptr [ %2, %if.then ], [ %u.addr.011.i, %land.rhs.i ]
%cmp7.not = icmp eq ptr %u.addr.0.lcssa.i, %4
br i1 %cmp7.not, label %if.else, label %if.then9
if.then9: ; preds = %find.exit
%puts33 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
br label %for.inc
if.else: ; preds = %while.body.i, %find.exit
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.else12: ; preds = %for.body
%call13 = call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %call, ptr noundef nonnull dereferenceable(7) @.str.1, i64 noundef 6) #9
%cmp14 = icmp eq i32 %call13, 0
br i1 %cmp14, label %if.then16, label %if.else18
if.then16: ; preds = %if.else12
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %x)
%6 = load i32, ptr %x, align 4, !tbaa !18
%7 = load ptr, ptr @NIL, align 8, !tbaa !5
%8 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
store i32 %6, ptr %call.i, align 8, !tbaa !9
%left.i34 = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 2
store ptr %7, ptr %left.i34, align 8, !tbaa !14
%right.i35 = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1
store ptr %7, ptr %right.i35, align 8, !tbaa !15
%cmp.not34.i = icmp eq ptr %8, %7
br i1 %cmp.not34.i, label %while.end.thread.i, label %while.body.i36
while.end.thread.i: ; preds = %if.then16
%parent37.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %7, ptr %parent37.i, align 8, !tbaa !16
br label %insert.exit
while.body.i36: ; preds = %if.then16, %while.body.i36
%x.035.i = phi ptr [ %x.1.i, %while.body.i36 ], [ %8, %if.then16 ]
%9 = load i32, ptr %x.035.i, align 8, !tbaa !9
%cmp3.i37 = icmp sgt i32 %9, %6
%left4.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 2
%right5.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i37, ptr %left4.i, ptr %right5.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i38 = icmp eq ptr %x.1.i, %7
br i1 %cmp.not.i38, label %while.end.i, label %while.body.i36, !llvm.loop !17
while.end.i: ; preds = %while.body.i36
%parent.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %x.035.i, ptr %parent.i, align 8, !tbaa !16
%cmp6.i = icmp eq ptr %x.035.i, %7
%spec.select41 = select i1 %cmp6.i, ptr @root, ptr %x.1.in.i
br label %insert.exit
insert.exit: ; preds = %while.end.i, %while.end.thread.i
%left13.sink.i = phi ptr [ @root, %while.end.thread.i ], [ %spec.select41, %while.end.i ]
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.else18: ; preds = %if.else12
%call19 = call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %call, ptr noundef nonnull dereferenceable(6) @.str.2, i64 noundef 5) #9
%cmp20 = icmp eq i32 %call19, 0
br i1 %cmp20, label %if.then22, label %for.inc
if.then22: ; preds = %if.else18
%10 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %10)
%putchar = call i32 @putchar(i32 10)
%11 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %11)
%putchar32 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %if.else, %if.then9, %if.else18, %if.then22, %insert.exit
%inc = add nuw nsw i32 %i.044, 1
%12 = load i32, ptr %n, align 4, !tbaa !18
%cmp = icmp slt i32 %inc, %12
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !20
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { 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 #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress 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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"Node", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !6, i64 24}
!17 = distinct !{!17, !13}
!18 = !{!11, !11, i64 0}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !13}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node {
int key;
struct node *parent, *left, *right;
};
struct node *tree, *z;
void insert(struct node *T, struct node *z);
void find(int key);
void inorder(struct node *p);
void preorder(struct node *p);
int main(int argc, char*argv[])
{
int m, i, key;
char cmd[6 + 1];
tree = NULL;
scanf("%d", &m);
for (i = 0; i < m; i++) {
scanf("%s", cmd);
if (!strcmp(cmd, "insert")) {
z = (struct node *)malloc(sizeof(struct node));
scanf("%d", &(z->key));
z->parent = NULL;
z->left = NULL;
z->right = NULL;
insert(tree, z);
} else if (!strcmp(cmd, "print")) {
inorder(tree);
printf("\n");
preorder(tree);
printf("\n");
} else if (!strcmp(cmd, "find")) {
scanf("%d", &key);
find(key);
}
}
return 0;
}
void insert(struct node *T, struct node *z)
{
struct node *x, *y;
y = NULL;
x = tree;
while (x != NULL) {
y = x;
if (z->key < x->key) x = x->left;
else x = x->right;
}
z->parent = y;
if (y == NULL) tree = z;
else if (z->key < y->key) y->left = z;
else y->right = z;
}
void find(int key)
{
struct node *x = tree;
if (x == NULL) {
printf("no\n");
return;
}
while (x != NULL) {
if (x->key == key) {
printf("yes\n");
return;
} else if (x->key < key) x = x->right;
else x = x->left;
}
printf("no\n");
}
void inorder(struct node *p)
{
if (p->left != NULL) inorder(p->left);
printf(" %d", p->key);
if (p->right != NULL) inorder(p->right);
}
void preorder(struct node *p)
{
printf(" %d", p->key);
if (p->left != NULL) preorder(p->left);
if (p->right != NULL) preorder(p->right);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220430/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220430/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.node = type { i32, ptr, ptr, ptr }
@tree = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"insert\00", align 1
@z = dso_local local_unnamed_addr global ptr null, align 8
@.str.3 = private unnamed_addr constant [6 x i8] c"print\00", align 1
@.str.5 = private unnamed_addr constant [5 x i8] c"find\00", align 1
@.str.8 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str.9 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
@str.10 = private unnamed_addr constant [3 x i8] c"no\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:
%m = alloca i32, align 4
%key = alloca i32, align 4
%cmd = alloca [7 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #8
call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %cmd) #8
store ptr null, ptr @tree, align 8, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !9
%cmp29 = icmp sgt i32 %0, 0
br i1 %cmp29, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.030 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %cmd)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %cmd, ptr noundef nonnull dereferenceable(7) @.str.2, i64 7)
%tobool.not = icmp eq i32 %bcmp, 0
br i1 %tobool.not, label %if.then, label %if.else
if.then: ; preds = %for.body
%call4 = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #9
store ptr %call4, ptr @z, align 8, !tbaa !5
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %call4)
%1 = load ptr, ptr @z, align 8, !tbaa !5
%parent = getelementptr inbounds %struct.node, ptr %1, i64 0, i32 1
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %parent, i8 0, i64 24, i1 false)
%x.028.i = load ptr, ptr @tree, align 8, !tbaa !5
%cmp.not29.i = icmp eq ptr %x.028.i, null
br i1 %cmp.not29.i, label %insert.exit, label %while.body.lr.ph.i
while.body.lr.ph.i: ; preds = %if.then
%2 = load i32, ptr %1, align 8, !tbaa !11
br label %while.body.i
while.body.i: ; preds = %while.body.i, %while.body.lr.ph.i
%x.030.i = phi ptr [ %x.028.i, %while.body.lr.ph.i ], [ %x.0.i, %while.body.i ]
%3 = load i32, ptr %x.030.i, align 8, !tbaa !11
%cmp2.i = icmp slt i32 %2, %3
%left.i = getelementptr inbounds %struct.node, ptr %x.030.i, i64 0, i32 2
%right.i = getelementptr inbounds %struct.node, ptr %x.030.i, i64 0, i32 3
%x.1.in.i = select i1 %cmp2.i, ptr %left.i, ptr %right.i
%x.0.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.0.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !13
insert.exit: ; preds = %while.body.i, %if.then
%storemerge = phi ptr [ null, %if.then ], [ %x.030.i, %while.body.i ]
%left10.sink.i = phi ptr [ @tree, %if.then ], [ %x.1.in.i, %while.body.i ]
store ptr %storemerge, ptr %parent, align 8, !tbaa !15
store ptr %1, ptr %left10.sink.i, align 8, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%bcmp22 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %cmd, ptr noundef nonnull dereferenceable(6) @.str.3, i64 6)
%tobool9.not = icmp eq i32 %bcmp22, 0
br i1 %tobool9.not, label %if.then10, label %if.else13
if.then10: ; preds = %if.else
%4 = load ptr, ptr @tree, align 8, !tbaa !5
call void @inorder(ptr noundef %4)
%putchar = call i32 @putchar(i32 10)
%5 = load ptr, ptr @tree, align 8, !tbaa !5
call void @preorder(ptr noundef %5)
%putchar23 = call i32 @putchar(i32 10)
br label %for.inc
if.else13: ; preds = %if.else
%bcmp24 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %cmd, ptr noundef nonnull dereferenceable(5) @.str.5, i64 5)
%tobool16.not = icmp eq i32 %bcmp24, 0
br i1 %tobool16.not, label %if.then17, label %for.inc
if.then17: ; preds = %if.else13
%call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%6 = load i32, ptr %key, align 4, !tbaa !9
%7 = load ptr, ptr @tree, align 8, !tbaa !5
%cmp.i = icmp eq ptr %7, null
br i1 %cmp.i, label %find.exit, label %while.body.i25
while.body.i25: ; preds = %if.then17, %if.else.i
%x.022.i = phi ptr [ %x.1.i, %if.else.i ], [ %7, %if.then17 ]
%8 = load i32, ptr %x.022.i, align 8, !tbaa !11
%cmp3.i = icmp eq i32 %8, %6
br i1 %cmp3.i, label %find.exit, label %if.else.i
if.else.i: ; preds = %while.body.i25
%cmp7.i = icmp slt i32 %8, %6
%right.i26 = getelementptr inbounds %struct.node, ptr %x.022.i, i64 0, i32 3
%left.i27 = getelementptr inbounds %struct.node, ptr %x.022.i, i64 0, i32 2
%x.1.in.i28 = select i1 %cmp7.i, ptr %right.i26, ptr %left.i27
%x.1.i = load ptr, ptr %x.1.in.i28, align 8, !tbaa !5
%cmp1.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp1.not.i, label %find.exit, label %while.body.i25, !llvm.loop !16
find.exit: ; preds = %while.body.i25, %if.else.i, %if.then17
%str.sink.i = phi ptr [ @str.10, %if.then17 ], [ @str.10, %if.else.i ], [ @str.9, %while.body.i25 ]
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink.i)
br label %for.inc
for.inc: ; preds = %insert.exit, %if.else13, %find.exit, %if.then10
%inc = add nuw nsw i32 %i.030, 1
%9 = load i32, ptr %m, align 4, !tbaa !9
%cmp = icmp slt i32 %inc, %9
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !17
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %cmd) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #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,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insert(ptr nocapture noundef readnone %T, ptr noundef %z) local_unnamed_addr #4 {
entry:
%x.028 = load ptr, ptr @tree, align 8, !tbaa !5
%cmp.not29 = icmp eq ptr %x.028, null
br i1 %cmp.not29, label %if.then4, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %z, align 8, !tbaa !11
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%x.030 = phi ptr [ %x.028, %while.body.lr.ph ], [ %x.0, %while.body ]
%1 = load i32, ptr %x.030, align 8, !tbaa !11
%cmp2 = icmp slt i32 %0, %1
%left = getelementptr inbounds %struct.node, ptr %x.030, i64 0, i32 2
%right = getelementptr inbounds %struct.node, ptr %x.030, i64 0, i32 3
%x.1.in = select i1 %cmp2, ptr %left, ptr %right
%x.0 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.0, null
br i1 %cmp.not, label %if.else5, label %while.body, !llvm.loop !13
if.then4: ; preds = %entry
%parent32 = getelementptr inbounds %struct.node, ptr %z, i64 0, i32 1
store ptr null, ptr %parent32, align 8, !tbaa !15
br label %if.end14
if.else5: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %z, i64 0, i32 1
store ptr %x.030, ptr %parent, align 8, !tbaa !15
%2 = load i32, ptr %z, align 8, !tbaa !11
%3 = load i32, ptr %x.030, align 8, !tbaa !11
%cmp8 = icmp slt i32 %2, %3
br i1 %cmp8, label %if.then9, label %if.else11
if.then9: ; preds = %if.else5
%left10 = getelementptr inbounds %struct.node, ptr %x.030, i64 0, i32 2
br label %if.end14
if.else11: ; preds = %if.else5
%right12 = getelementptr inbounds %struct.node, ptr %x.030, i64 0, i32 3
br label %if.end14
if.end14: ; preds = %if.then9, %if.else11, %if.then4
%left10.sink = phi ptr [ %left10, %if.then9 ], [ %right12, %if.else11 ], [ @tree, %if.then4 ]
store ptr %z, ptr %left10.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr nocapture noundef readonly %p) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%p.tr = phi ptr [ %p, %entry ], [ %2, %if.end ]
%left = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 2
%0 = load ptr, ptr %left, align 8, !tbaa !18
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @inorder(ptr noundef nonnull %0)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%1 = load i32, ptr %p.tr, align 8, !tbaa !11
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %1)
%right = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 3
%2 = load ptr, ptr %right, align 8, !tbaa !19
%cmp2.not = icmp eq ptr %2, null
br i1 %cmp2.not, label %if.end5, label %tailrecurse
if.end5: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr nocapture noundef readonly %p) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%p.tr = phi ptr [ %p, %entry ], [ %2, %if.end ]
%0 = load i32, ptr %p.tr, align 8, !tbaa !11
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 2
%1 = load ptr, ptr %left, align 8, !tbaa !18
%cmp.not = icmp eq ptr %1, null
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @preorder(ptr noundef nonnull %1)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%right = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 3
%2 = load ptr, ptr %right, align 8, !tbaa !19
%cmp2.not = icmp eq ptr %2, null
br i1 %cmp2.not, label %if.end5, label %tailrecurse
if.end5: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @find(i32 noundef %key) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @tree, align 8, !tbaa !5
%cmp = icmp eq ptr %0, null
br i1 %cmp, label %cleanup, label %while.body
while.body: ; preds = %entry, %if.else
%x.022 = phi ptr [ %x.1, %if.else ], [ %0, %entry ]
%1 = load i32, ptr %x.022, align 8, !tbaa !11
%cmp3 = icmp eq i32 %1, %key
br i1 %cmp3, label %cleanup, label %if.else
if.else: ; preds = %while.body
%cmp7 = icmp slt i32 %1, %key
%right = getelementptr inbounds %struct.node, ptr %x.022, i64 0, i32 3
%left = getelementptr inbounds %struct.node, ptr %x.022, i64 0, i32 2
%x.1.in = select i1 %cmp7, ptr %right, ptr %left
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp1.not = icmp eq ptr %x.1, null
br i1 %cmp1.not, label %cleanup, label %while.body, !llvm.loop !16
cleanup: ; preds = %if.else, %while.body, %entry
%str.sink = phi ptr [ @str.10, %entry ], [ @str.9, %while.body ], [ @str.10, %if.else ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree norecurse nosync nounwind memory(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 willreturn memory(argmem: read) }
attributes #6 = { nofree nounwind }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }
attributes #9 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"node", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!12, !6, i64 8}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = !{!12, !6, i64 16}
!19 = !{!12, !6, i64 24}
|
#include<stdio.h>
#include<stdlib.h>
struct node{
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node * Node;
#define NIL NULL
Node root;
Node treeMinimum(Node x){
}
Node treeSearch(Node u, int k){
while(u !=NIL){
if(u->key == k)break;
else if(u->key < k)u = u->right;
else u = u->left;
}
return u;
}
Node treeSuccessor(Node x){
}
void treeDelete(Node z){
Node y; // node to be deleted
Node x; // child of y
}
void insert(int k){
Node y = NIL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->left = NIL;
z->right = NIL;
while(x != NIL){
y=x;
if(z->key < x->key)x = x->left;
else x = x->right;
}
z->parent = y;
if(y == NIL)
root = z;
else if(z->key < y->key)
y->left = z;
else
y->right = z;
}
void inorder(Node u){
if(u != NIL){
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
}
void preorder(Node u){
if(u != NIL){
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
}
int main(){
int n, i, x;
char com[20];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s", com);
if ( com[0] == 'f' ){
scanf("%d", &x);
Node t = treeSearch(root, x);
if ( t != NIL ) printf("yes\n");
else printf("no\n");
} else if ( com[0] == 'i' ){
scanf("%d", &x);
insert(x);
} else if ( com[0] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
} else if ( com[0] == 'd' ){
scanf("%d", &x);
treeDelete(treeSearch(root, x));
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220474/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220474/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.6 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeMinimum(ptr nocapture noundef readnone %x) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeSearch(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #1 {
entry:
%cmp.not13 = icmp eq ptr %u, null
br i1 %cmp.not13, label %while.end, label %while.body
while.body: ; preds = %entry, %if.else
%u.addr.014 = phi ptr [ %u.addr.1, %if.else ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.addr.014, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !5
%cmp1 = icmp eq i32 %0, %k
br i1 %cmp1, label %while.end, label %if.else
if.else: ; preds = %while.body
%cmp3 = icmp slt i32 %0, %k
%left = getelementptr inbounds %struct.node, ptr %u.addr.014, i64 0, i32 1
%u.addr.1.in = select i1 %cmp3, ptr %u.addr.014, ptr %left
%u.addr.1 = load ptr, ptr %u.addr.1.in, align 8, !tbaa !11
%cmp.not = icmp eq ptr %u.addr.1, null
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.else, %while.body, %entry
%u.addr.0.lcssa = phi ptr [ null, %entry ], [ %u.addr.014, %while.body ], [ null, %if.else ]
ret ptr %u.addr.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeSuccessor(ptr nocapture noundef readnone %x) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local void @treeDelete(ptr nocapture noundef readnone %z) local_unnamed_addr #0 {
entry:
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 nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #3 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !11
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !5
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%1 = load i32, ptr %key2, align 8, !tbaa !5
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !11
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !14
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %parent37, align 8, !tbaa !15
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.035, ptr %parent, align 8, !tbaa !15
%key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%2 = load i32, ptr %key10, align 8, !tbaa !5
%cmp11 = icmp sgt i32 %2, %k
%left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %left13, ptr %x.035
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !11
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #3 {
entry:
%cmp.not4 = icmp eq ptr %u, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr5 = phi ptr [ %2, %if.then ], [ %u, %entry ]
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !16
tail call void @inorder(ptr noundef %0)
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !17
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #3 {
entry:
%cmp.not4 = icmp eq ptr %u, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr5 = phi ptr [ %2, %if.then ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !16
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !17
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #9
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !18
%cmp60 = icmp sgt i32 %0, 0
br i1 %cmp60, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.061 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !19
switch i8 %1, label %for.inc [
i8 102, label %if.then
i8 105, label %if.then16
i8 112, label %if.then23
i8 100, label %if.then31
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load ptr, ptr @root, align 8, !tbaa !11
%3 = load i32, ptr %x, align 4, !tbaa !18
%cmp.not13.i = icmp eq ptr %2, null
br i1 %cmp.not13.i, label %if.else, label %while.body.i
while.body.i: ; preds = %if.then, %if.else.i
%u.addr.014.i = phi ptr [ %u.addr.1.i, %if.else.i ], [ %2, %if.then ]
%key.i = getelementptr inbounds %struct.node, ptr %u.addr.014.i, i64 0, i32 3
%4 = load i32, ptr %key.i, align 8, !tbaa !5
%cmp1.i = icmp eq i32 %4, %3
br i1 %cmp1.i, label %if.then8, label %if.else.i
if.else.i: ; preds = %while.body.i
%cmp3.i = icmp slt i32 %4, %3
%left.i = getelementptr inbounds %struct.node, ptr %u.addr.014.i, i64 0, i32 1
%u.addr.1.in.i = select i1 %cmp3.i, ptr %u.addr.014.i, ptr %left.i
%u.addr.1.i = load ptr, ptr %u.addr.1.in.i, align 8, !tbaa !11
%cmp.not.i = icmp eq ptr %u.addr.1.i, null
br i1 %cmp.not.i, label %if.else, label %while.body.i, !llvm.loop !12
if.then8: ; preds = %while.body.i
%puts40 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
if.else: ; preds = %if.else.i, %if.then
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.then16: ; preds = %for.body
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%5 = load i32, ptr %x, align 4, !tbaa !18
%6 = load ptr, ptr @root, align 8, !tbaa !11
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8
%key.i41 = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %5, ptr %key.i41, align 8, !tbaa !5
%cmp.not34.i = icmp eq ptr %6, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i42
while.body.i42: ; preds = %if.then16, %while.body.i42
%x.035.i = phi ptr [ %x.1.i, %while.body.i42 ], [ %6, %if.then16 ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%7 = load i32, ptr %key2.i, align 8, !tbaa !5
%cmp3.i43 = icmp sgt i32 %7, %5
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i43, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !11
%cmp.not.i44 = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i44, label %insert.exit, label %while.body.i42, !llvm.loop !14
insert.exit: ; preds = %while.body.i42, %if.then16
%.sink = phi ptr [ null, %if.then16 ], [ %x.035.i, %while.body.i42 ]
%left13.sink.i = phi ptr [ @root, %if.then16 ], [ %x.1.in.i, %while.body.i42 ]
%parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %parent37.i, align 8, !tbaa !15
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !11
br label %for.inc
if.then23: ; preds = %for.body
%8 = load ptr, ptr @root, align 8, !tbaa !11
call void @inorder(ptr noundef %8)
%putchar = call i32 @putchar(i32 10)
%9 = load ptr, ptr @root, align 8, !tbaa !11
call void @preorder(ptr noundef %9)
%putchar39 = call i32 @putchar(i32 10)
br label %for.inc
if.then31: ; preds = %for.body
%call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
br label %for.inc
for.inc: ; preds = %if.then31, %for.body, %if.then8, %if.else, %if.then23, %insert.exit
%inc = add nuw nsw i32 %i.061, 1
%10 = load i32, ptr %n, align 4, !tbaa !18
%cmp = icmp slt i32 %inc, %10
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !20
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
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 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 24}
!6 = !{!"node", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!6, !7, i64 16}
!16 = !{!6, !7, i64 8}
!17 = !{!6, !7, i64 0}
!18 = !{!10, !10, i64 0}
!19 = !{!8, !8, i64 0}
!20 = distinct !{!20, !13}
|
#include<stdio.h>
#include<stdlib.h>
struct node{
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node * Node;
#define NIL NULL
Node root;
Node treeMinimum(Node x){
while(x->left!=NIL){
x=x->left;
}
return x;
}
Node treeSearch(Node u, int k){
if(u==NIL || k==u->key) return u;
if(k < u->key){
return treeSearch(u->left,k);
}
else {
return treeSearch(u->right,k);
}
}
Node treeSuccessor(Node x){
Node y;
if(x->right!=NIL) return treeMinimum(x->right);
y=x->parent;
while(y!=NIL && x==y->right){
x=y;
y=y->parent;
}
return y;
}
Node treeDelete(Node z){
Node y; // node to be deleted
Node x; // child of y
if(z->left==NIL || z->right==NIL){ y=z;}//zが子を持たないか、子を1つ持つ場合は入力節点のz
else {y= treeSuccessor(z);}//zが子を2つ持つ場合はzの次節点
if(y->left!=NIL){//yの子xを決める
x=y->left;//yに左の子があれば、xはyの左の子
}
else {
x=y->right;//yに左の子がなければ、xはyの右の子
}
if(x!=NIL){ x->parent=y->parent;}//xの親を設定する
if(y->parent==NIL){ root=x;}
else if(y==y->parent->left){
y->parent->left=x;
}//yがその親の左の子ならば、pの左の子をxとする
else{
y->parent->right=x;
}//yがその親の右の子ならば、pの右の子をxとする
if(y!=z){//zの次節点が削除された場合
z->key=y->key;//yのデータをzにコピーする
}
return y;
}
void insert(int k){
Node y = NIL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->left = NIL;
z->right = NIL;
//printf("%d\n",x->key);
while(x!=NIL){//親を設定
y=x;
if(z->key < x->key){
x=x->left;
}//左の子へ移動
else x=x->right;//右の子へ移動
}
z->parent=y;
if(y==NIL){
root = z;
}
else if(z->key < y->key){
y->left=z;
}//zをyの左の子にする
else y->right=z;//zをyの右の子にする
}
void inorder(Node u){
if(u!=NIL){
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
}
void preorder(Node u){
if(u!=NIL){
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
}
int main(){
int n, i, x;
char com[20];
scanf("%d", &n);
root=NIL;
for ( i = 0; i < n; i++ ){
scanf("%s", com);
if ( com[0] == 'f' ){
scanf("%d", &x);
Node t = treeSearch(root, x);
if ( t != NIL ) printf("yes\n");
else printf("no\n");
} else if ( com[0] == 'i' ){
scanf("%d", &x);
insert(x);
} else if ( com[0] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
} else if ( com[0] == 'd' ){
scanf("%d", &x);
treeDelete(treeSearch(root, x));
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220517/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220517/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.6 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeMinimum(ptr noundef readonly %x) local_unnamed_addr #0 {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%x.addr.0 = phi ptr [ %x, %entry ], [ %0, %while.cond ]
%left = getelementptr inbounds %struct.node, ptr %x.addr.0, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !5
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !11
while.end: ; preds = %while.cond
ret ptr %x.addr.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeSearch(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #0 {
entry:
%cmp14 = icmp eq ptr %u, null
br i1 %cmp14, label %return, label %lor.lhs.false
lor.lhs.false: ; preds = %entry, %if.end
%u.tr15 = phi ptr [ %u.tr.be, %if.end ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.tr15, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !13
%cmp1 = icmp eq i32 %0, %k
br i1 %cmp1, label %return, label %if.end
if.end: ; preds = %lor.lhs.false
%cmp3 = icmp sgt i32 %0, %k
%left = getelementptr inbounds %struct.node, ptr %u.tr15, i64 0, i32 1
%spec.select = select i1 %cmp3, ptr %left, ptr %u.tr15
%u.tr.be = load ptr, ptr %spec.select, align 8, !tbaa !14
%cmp = icmp eq ptr %u.tr.be, null
br i1 %cmp, label %return, label %lor.lhs.false
return: ; preds = %lor.lhs.false, %if.end, %entry
%retval.0 = phi ptr [ null, %entry ], [ null, %if.end ], [ %u.tr15, %lor.lhs.false ]
ret ptr %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeSuccessor(ptr noundef readonly %x) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr %x, align 8, !tbaa !15
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %while.cond, label %while.cond.i
while.cond.i: ; preds = %entry, %while.cond.i
%x.addr.0.i = phi ptr [ %1, %while.cond.i ], [ %0, %entry ]
%left.i = getelementptr inbounds %struct.node, ptr %x.addr.0.i, i64 0, i32 1
%1 = load ptr, ptr %left.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %1, null
br i1 %cmp.not.i, label %cleanup, label %while.cond.i, !llvm.loop !11
while.cond: ; preds = %entry, %land.rhs
%x.addr.0 = phi ptr [ %y.0, %land.rhs ], [ %x, %entry ]
%y.0.in = getelementptr inbounds %struct.node, ptr %x.addr.0, i64 0, i32 2
%y.0 = load ptr, ptr %y.0.in, align 8, !tbaa !16
%cmp2.not = icmp eq ptr %y.0, null
br i1 %cmp2.not, label %cleanup, label %land.rhs
land.rhs: ; preds = %while.cond
%2 = load ptr, ptr %y.0, align 8, !tbaa !15
%cmp4 = icmp eq ptr %x.addr.0, %2
br i1 %cmp4, label %while.cond, label %cleanup, !llvm.loop !17
cleanup: ; preds = %while.cond.i, %land.rhs, %while.cond
%retval.0 = phi ptr [ %y.0, %land.rhs ], [ null, %while.cond ], [ %x.addr.0.i, %while.cond.i ]
ret ptr %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local ptr @treeDelete(ptr noundef %z) local_unnamed_addr #2 {
entry:
%left = getelementptr inbounds %struct.node, ptr %z, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !5
%cmp = icmp eq ptr %0, null
br i1 %cmp, label %if.end8, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%1 = load ptr, ptr %z, align 8, !tbaa !15
%cmp1 = icmp eq ptr %1, null
br i1 %cmp1, label %if.then10, label %while.cond.i.i
while.cond.i.i: ; preds = %lor.lhs.false, %while.cond.i.i
%x.addr.0.i.i = phi ptr [ %2, %while.cond.i.i ], [ %1, %lor.lhs.false ]
%left.i.i = getelementptr inbounds %struct.node, ptr %x.addr.0.i.i, i64 0, i32 1
%2 = load ptr, ptr %left.i.i, align 8, !tbaa !5
%cmp.not.i.i = icmp eq ptr %2, null
br i1 %cmp.not.i.i, label %if.end8, label %while.cond.i.i, !llvm.loop !11
if.end8: ; preds = %while.cond.i.i, %entry
%y.0.ph = phi ptr [ %z, %entry ], [ %x.addr.0.i.i, %while.cond.i.i ]
%3 = load ptr, ptr %y.0.ph, align 8, !tbaa !15
%cmp9.not = icmp eq ptr %3, null
br i1 %cmp9.not, label %if.end12, label %if.then10
if.then10: ; preds = %lor.lhs.false, %if.end8
%y.059 = phi ptr [ %y.0.ph, %if.end8 ], [ %z, %lor.lhs.false ]
%x.055 = phi ptr [ %3, %if.end8 ], [ %0, %lor.lhs.false ]
%parent = getelementptr inbounds %struct.node, ptr %y.059, i64 0, i32 2
%4 = load ptr, ptr %parent, align 8, !tbaa !16
%parent11 = getelementptr inbounds %struct.node, ptr %x.055, i64 0, i32 2
store ptr %4, ptr %parent11, align 8, !tbaa !16
br label %if.end12
if.end12: ; preds = %if.then10, %if.end8
%y.061 = phi ptr [ %y.059, %if.then10 ], [ %y.0.ph, %if.end8 ]
%x.056 = phi ptr [ %x.055, %if.then10 ], [ null, %if.end8 ]
%parent13 = getelementptr inbounds %struct.node, ptr %y.061, i64 0, i32 2
%5 = load ptr, ptr %parent13, align 8, !tbaa !16
%cmp14 = icmp eq ptr %5, null
br i1 %cmp14, label %if.end27, label %if.else16
if.else16: ; preds = %if.end12
%left18 = getelementptr inbounds %struct.node, ptr %5, i64 0, i32 1
%6 = load ptr, ptr %left18, align 8, !tbaa !5
%cmp19 = icmp eq ptr %y.061, %6
%left18. = select i1 %cmp19, ptr %left18, ptr %5
br label %if.end27
if.end27: ; preds = %if.else16, %if.end12
%left18.sink = phi ptr [ @root, %if.end12 ], [ %left18., %if.else16 ]
store ptr %x.056, ptr %left18.sink, align 8, !tbaa !14
%cmp28.not = icmp eq ptr %y.061, %z
br i1 %cmp28.not, label %if.end31, label %if.then29
if.then29: ; preds = %if.end27
%key = getelementptr inbounds %struct.node, ptr %y.061, i64 0, i32 3
%7 = load i32, ptr %key, align 8, !tbaa !13
%key30 = getelementptr inbounds %struct.node, ptr %z, i64 0, i32 3
store i32 %7, ptr %key30, align 8, !tbaa !13
br label %if.end31
if.end31: ; preds = %if.then29, %if.end27
ret ptr %y.061
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #3 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !14
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !13
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%1 = load i32, ptr %key2, align 8, !tbaa !13
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !14
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !18
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %parent37, align 8, !tbaa !16
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.035, ptr %parent, align 8, !tbaa !16
%key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%2 = load i32, ptr %key10, align 8, !tbaa !13
%cmp11 = icmp sgt i32 %2, %k
%left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %left13, ptr %x.035
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !14
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #3 {
entry:
%cmp.not4 = icmp eq ptr %u, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr5 = phi ptr [ %2, %if.then ], [ %u, %entry ]
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !5
tail call void @inorder(ptr noundef %0)
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !13
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !15
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #3 {
entry:
%cmp.not4 = icmp eq ptr %u, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr5 = phi ptr [ %2, %if.then ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !13
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !5
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !15
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #9
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
store ptr null, ptr @root, align 8, !tbaa !14
%0 = load i32, ptr %n, align 4, !tbaa !19
%cmp67 = icmp sgt i32 %0, 0
br i1 %cmp67, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.068 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !20
switch i8 %1, label %for.inc [
i8 102, label %if.then
i8 105, label %if.then16
i8 112, label %if.then23
i8 100, label %if.then31
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load ptr, ptr @root, align 8, !tbaa !14
%3 = load i32, ptr %x, align 4, !tbaa !19
%cmp14.i = icmp eq ptr %2, null
br i1 %cmp14.i, label %if.else, label %lor.lhs.false.i
lor.lhs.false.i: ; preds = %if.then, %if.end.i
%u.tr15.i = phi ptr [ %u.tr.be.i, %if.end.i ], [ %2, %if.then ]
%key.i = getelementptr inbounds %struct.node, ptr %u.tr15.i, i64 0, i32 3
%4 = load i32, ptr %key.i, align 8, !tbaa !13
%cmp1.i = icmp eq i32 %4, %3
br i1 %cmp1.i, label %if.then8, label %if.end.i
if.end.i: ; preds = %lor.lhs.false.i
%cmp3.i = icmp sgt i32 %4, %3
%left.i = getelementptr inbounds %struct.node, ptr %u.tr15.i, i64 0, i32 1
%spec.select.i = select i1 %cmp3.i, ptr %left.i, ptr %u.tr15.i
%u.tr.be.i = load ptr, ptr %spec.select.i, align 8, !tbaa !14
%cmp.i = icmp eq ptr %u.tr.be.i, null
br i1 %cmp.i, label %if.else, label %lor.lhs.false.i
if.then8: ; preds = %lor.lhs.false.i
%puts41 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
if.else: ; preds = %if.end.i, %if.then
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.then16: ; preds = %for.body
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%5 = load i32, ptr %x, align 4, !tbaa !19
%6 = load ptr, ptr @root, align 8, !tbaa !14
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8
%key.i42 = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %5, ptr %key.i42, align 8, !tbaa !13
%cmp.not34.i = icmp eq ptr %6, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then16, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %6, %if.then16 ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%7 = load i32, ptr %key2.i, align 8, !tbaa !13
%cmp3.i43 = icmp sgt i32 %7, %5
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i43, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !14
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !18
insert.exit: ; preds = %while.body.i, %if.then16
%.sink = phi ptr [ null, %if.then16 ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then16 ], [ %x.1.in.i, %while.body.i ]
%parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %parent37.i, align 8, !tbaa !16
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !14
br label %for.inc
if.then23: ; preds = %for.body
%8 = load ptr, ptr @root, align 8, !tbaa !14
call void @inorder(ptr noundef %8)
%putchar = call i32 @putchar(i32 10)
%9 = load ptr, ptr @root, align 8, !tbaa !14
call void @preorder(ptr noundef %9)
%putchar40 = call i32 @putchar(i32 10)
br label %for.inc
if.then31: ; preds = %for.body
%call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%10 = load ptr, ptr @root, align 8, !tbaa !14
%11 = load i32, ptr %x, align 4, !tbaa !19
%cmp14.i45 = icmp eq ptr %10, null
br i1 %cmp14.i45, label %treeSearch.exit57, label %lor.lhs.false.i46
lor.lhs.false.i46: ; preds = %if.then31, %if.end.i50
%u.tr15.i47 = phi ptr [ %u.tr.be.i54, %if.end.i50 ], [ %10, %if.then31 ]
%key.i48 = getelementptr inbounds %struct.node, ptr %u.tr15.i47, i64 0, i32 3
%12 = load i32, ptr %key.i48, align 8, !tbaa !13
%cmp1.i49 = icmp eq i32 %12, %11
br i1 %cmp1.i49, label %treeSearch.exit57, label %if.end.i50
if.end.i50: ; preds = %lor.lhs.false.i46
%cmp3.i51 = icmp sgt i32 %12, %11
%left.i52 = getelementptr inbounds %struct.node, ptr %u.tr15.i47, i64 0, i32 1
%spec.select.i53 = select i1 %cmp3.i51, ptr %left.i52, ptr %u.tr15.i47
%u.tr.be.i54 = load ptr, ptr %spec.select.i53, align 8, !tbaa !14
%cmp.i55 = icmp eq ptr %u.tr.be.i54, null
br i1 %cmp.i55, label %treeSearch.exit57, label %lor.lhs.false.i46
treeSearch.exit57: ; preds = %lor.lhs.false.i46, %if.end.i50, %if.then31
%retval.0.i56 = phi ptr [ null, %if.then31 ], [ %u.tr15.i47, %lor.lhs.false.i46 ], [ null, %if.end.i50 ]
%left.i58 = getelementptr inbounds %struct.node, ptr %retval.0.i56, i64 0, i32 1
%13 = load ptr, ptr %left.i58, align 8, !tbaa !5
%cmp.i59 = icmp eq ptr %13, null
br i1 %cmp.i59, label %if.end8.i, label %lor.lhs.false.i60
lor.lhs.false.i60: ; preds = %treeSearch.exit57
%14 = load ptr, ptr %retval.0.i56, align 8, !tbaa !15
%cmp1.i61 = icmp eq ptr %14, null
br i1 %cmp1.i61, label %if.then10.i, label %while.cond.i.i.i
while.cond.i.i.i: ; preds = %lor.lhs.false.i60, %while.cond.i.i.i
%x.addr.0.i.i.i = phi ptr [ %15, %while.cond.i.i.i ], [ %14, %lor.lhs.false.i60 ]
%left.i.i.i = getelementptr inbounds %struct.node, ptr %x.addr.0.i.i.i, i64 0, i32 1
%15 = load ptr, ptr %left.i.i.i, align 8, !tbaa !5
%cmp.not.i.i.i = icmp eq ptr %15, null
br i1 %cmp.not.i.i.i, label %if.end8.i, label %while.cond.i.i.i, !llvm.loop !11
if.end8.i: ; preds = %while.cond.i.i.i, %treeSearch.exit57
%y.0.ph.i = phi ptr [ %retval.0.i56, %treeSearch.exit57 ], [ %x.addr.0.i.i.i, %while.cond.i.i.i ]
%16 = load ptr, ptr %y.0.ph.i, align 8, !tbaa !15
%cmp9.not.i = icmp eq ptr %16, null
br i1 %cmp9.not.i, label %if.end12.i, label %if.then10.i
if.then10.i: ; preds = %if.end8.i, %lor.lhs.false.i60
%y.059.i = phi ptr [ %y.0.ph.i, %if.end8.i ], [ %retval.0.i56, %lor.lhs.false.i60 ]
%x.055.i = phi ptr [ %16, %if.end8.i ], [ %13, %lor.lhs.false.i60 ]
%parent.i62 = getelementptr inbounds %struct.node, ptr %y.059.i, i64 0, i32 2
%17 = load ptr, ptr %parent.i62, align 8, !tbaa !16
%parent11.i = getelementptr inbounds %struct.node, ptr %x.055.i, i64 0, i32 2
store ptr %17, ptr %parent11.i, align 8, !tbaa !16
br label %if.end12.i
if.end12.i: ; preds = %if.then10.i, %if.end8.i
%y.061.i = phi ptr [ %y.059.i, %if.then10.i ], [ %y.0.ph.i, %if.end8.i ]
%x.056.i = phi ptr [ %x.055.i, %if.then10.i ], [ null, %if.end8.i ]
%parent13.i = getelementptr inbounds %struct.node, ptr %y.061.i, i64 0, i32 2
%18 = load ptr, ptr %parent13.i, align 8, !tbaa !16
%cmp14.i63 = icmp eq ptr %18, null
br i1 %cmp14.i63, label %if.end27.i, label %if.else16.i
if.else16.i: ; preds = %if.end12.i
%left18.i = getelementptr inbounds %struct.node, ptr %18, i64 0, i32 1
%19 = load ptr, ptr %left18.i, align 8, !tbaa !5
%cmp19.i = icmp eq ptr %y.061.i, %19
%left18..i = select i1 %cmp19.i, ptr %left18.i, ptr %18
br label %if.end27.i
if.end27.i: ; preds = %if.else16.i, %if.end12.i
%left18.sink.i = phi ptr [ @root, %if.end12.i ], [ %left18..i, %if.else16.i ]
store ptr %x.056.i, ptr %left18.sink.i, align 8, !tbaa !14
%cmp28.not.i = icmp eq ptr %y.061.i, %retval.0.i56
br i1 %cmp28.not.i, label %for.inc, label %if.then29.i
if.then29.i: ; preds = %if.end27.i
%key.i64 = getelementptr inbounds %struct.node, ptr %y.061.i, i64 0, i32 3
%20 = load i32, ptr %key.i64, align 8, !tbaa !13
%key30.i = getelementptr inbounds %struct.node, ptr %retval.0.i56, i64 0, i32 3
store i32 %20, ptr %key30.i, align 8, !tbaa !13
br label %for.inc
for.inc: ; preds = %if.then29.i, %if.end27.i, %for.body, %if.then8, %if.else, %if.then23, %insert.exit
%inc = add nuw nsw i32 %i.068, 1
%21 = load i32, ptr %n, align 4, !tbaa !19
%cmp = icmp slt i32 %inc, %21
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !21
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
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 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree norecurse 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !7, i64 8}
!6 = !{!"node", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!6, !10, i64 24}
!14 = !{!7, !7, i64 0}
!15 = !{!6, !7, i64 0}
!16 = !{!6, !7, i64 16}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = !{!10, !10, i64 0}
!20 = !{!8, !8, i64 0}
!21 = distinct !{!21, !12}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 100000
#define NIL -1
typedef struct search{
struct search *right;
struct search *left;
struct search *p;
int key;
}search;
void insert(int);
void inorderTreeWalk(search *x);
void Puriorder(search *x);
search *find(search *x, int k);
search *T,*B;
int main(){
int i,v,k;
char a[32];
T = NULL;
scanf("%d",&v);
for ( i = 0;i < v;i++){
scanf("%s",a);
if(strcmp(a,"find")==0){
scanf("%d",&k);
B = find (T,k);
if(B != NULL){
printf("yes\n");
}else{
printf("no\n");
}
}else if(strcmp(a,"insert")==0){
scanf("%d",&k);
insert(k);
}
else if(strcmp(a,"print")==0){
inorderTreeWalk(T);
printf("\n");
Puriorder(T);
printf("\n");
}
}
return 0;
}
//??????
void inorderTreeWalk(search *x){
if(x !=NULL){
inorderTreeWalk(x->left);
printf(" %d",x->key);
inorderTreeWalk(x->right);
}
}
void Puriorder(search *x){
if(x !=NULL){
printf(" %d",x->key);
Puriorder(x->left);
Puriorder(x->right);
}
}
void insert(int key){
search *x,*y,*z;
y = NULL; // x ??????
x = T;
z = (search *)malloc(sizeof(search));
z->key = key;
z->right = NULL;
z->left = NULL;
z->p = NULL;
while (x != NULL){
y = x; // ???????¨????
if (z->key < x->key)
x = x->left; // ?????????????§????
else
x = x->right; // ?????????????§????
}
z->p = y;
if( y == NULL){ // T ???????????´???
T = z;
}
else if (z->key < y->key)
y->left = z; // z ??? y ?????????????????????
else
y->right = z; // z ??? y ?????????????????????
}
search *find(search *x , int k){
while (x != NULL && k != x -> key){
if(k < x -> key){
x = x->left;
}else{
x = x->right;
}
}
return x;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220575/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220575/source.c"
target datalayout = "e-m:e-p270: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.search = type { ptr, ptr, ptr, i32 }
@T = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"find\00", align 1
@B = dso_local local_unnamed_addr global ptr null, align 8
@.str.5 = private unnamed_addr constant [7 x i8] c"insert\00", align 1
@.str.6 = private unnamed_addr constant [6 x i8] c"print\00", align 1
@.str.8 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.9 = 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:
%v = alloca i32, align 4
%k = alloca i32, align 4
%a = alloca [32 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #8
call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %a) #8
store ptr null, ptr @T, align 8, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%0 = load i32, ptr %v, align 4, !tbaa !9
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.038 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %a, ptr noundef nonnull dereferenceable(5) @.str.2, i64 5)
%cmp4 = icmp eq i32 %bcmp, 0
br i1 %cmp4, label %if.then, label %if.else11
if.then: ; preds = %for.body
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%1 = load ptr, ptr @T, align 8, !tbaa !5
%2 = load i32, ptr %k, align 4, !tbaa !9
%cmp.not10.i = icmp eq ptr %1, null
br i1 %cmp.not10.i, label %if.else, label %land.rhs.i
land.rhs.i: ; preds = %if.then, %while.body.i
%x.addr.011.i = phi ptr [ %x.addr.1.i, %while.body.i ], [ %1, %if.then ]
%key.i = getelementptr inbounds %struct.search, ptr %x.addr.011.i, i64 0, i32 3
%3 = load i32, ptr %key.i, align 8, !tbaa !11
%cmp1.not.i = icmp eq i32 %3, %2
br i1 %cmp1.not.i, label %if.then8, label %while.body.i
while.body.i: ; preds = %land.rhs.i
%cmp3.i = icmp sgt i32 %3, %2
%left.i = getelementptr inbounds %struct.search, ptr %x.addr.011.i, i64 0, i32 1
%x.addr.1.in.i = select i1 %cmp3.i, ptr %left.i, ptr %x.addr.011.i
%x.addr.1.i = load ptr, ptr %x.addr.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.addr.1.i, null
br i1 %cmp.not.i, label %if.else, label %land.rhs.i, !llvm.loop !13
if.then8: ; preds = %land.rhs.i
store ptr %x.addr.011.i, ptr @B, align 8, !tbaa !5
%puts31 = call i32 @puts(ptr nonnull dereferenceable(1) @str.9)
br label %for.inc
if.else: ; preds = %while.body.i, %if.then
store ptr null, ptr @B, align 8, !tbaa !5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.else11: ; preds = %for.body
%bcmp28 = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %a, ptr noundef nonnull dereferenceable(7) @.str.5, i64 7)
%cmp14 = icmp eq i32 %bcmp28, 0
br i1 %cmp14, label %if.then15, label %if.else17
if.then15: ; preds = %if.else11
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%4 = load i32, ptr %k, align 4, !tbaa !9
%5 = load ptr, ptr @T, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #9
%key1.i = getelementptr inbounds %struct.search, ptr %call.i, i64 0, i32 3
store i32 %4, ptr %key1.i, align 8, !tbaa !11
%p.i = getelementptr inbounds %struct.search, ptr %call.i, i64 0, i32 2
%cmp.not37.i = icmp eq ptr %5, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %call.i, i8 0, i64 24, i1 false)
br i1 %cmp.not37.i, label %insert.exit, label %while.body.i32
while.body.i32: ; preds = %if.then15, %while.body.i32
%x.038.i = phi ptr [ %x.1.i, %while.body.i32 ], [ %5, %if.then15 ]
%key3.i = getelementptr inbounds %struct.search, ptr %x.038.i, i64 0, i32 3
%6 = load i32, ptr %key3.i, align 8, !tbaa !11
%cmp4.i = icmp sgt i32 %6, %4
%left5.i = getelementptr inbounds %struct.search, ptr %x.038.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp4.i, ptr %left5.i, ptr %x.038.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i33 = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i33, label %if.else10.i, label %while.body.i32, !llvm.loop !15
if.else10.i: ; preds = %while.body.i32
store ptr %x.038.i, ptr %p.i, align 8, !tbaa !16
br label %insert.exit
insert.exit: ; preds = %if.then15, %if.else10.i
%left15.sink.i = phi ptr [ @T, %if.then15 ], [ %x.1.in.i, %if.else10.i ]
store ptr %call.i, ptr %left15.sink.i, align 8, !tbaa !5
br label %for.inc
if.else17: ; preds = %if.else11
%bcmp29 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %a, ptr noundef nonnull dereferenceable(6) @.str.6, i64 6)
%cmp20 = icmp eq i32 %bcmp29, 0
br i1 %cmp20, label %if.then21, label %for.inc
if.then21: ; preds = %if.else17
%7 = load ptr, ptr @T, align 8, !tbaa !5
call void @inorderTreeWalk(ptr noundef %7)
%putchar = call i32 @putchar(i32 10)
%8 = load ptr, ptr @T, align 8, !tbaa !5
call void @Puriorder(ptr noundef %8)
%putchar30 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %if.else, %if.then8, %if.else17, %if.then21, %insert.exit
%inc = add nuw nsw i32 %i.038, 1
%9 = load i32, ptr %v, align 4, !tbaa !9
%cmp = icmp slt i32 %inc, %9
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !17
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %a) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @find(ptr noundef readonly %x, i32 noundef %k) local_unnamed_addr #3 {
entry:
%cmp.not10 = icmp eq ptr %x, null
br i1 %cmp.not10, label %while.end, label %land.rhs
land.rhs: ; preds = %entry, %while.body
%x.addr.011 = phi ptr [ %x.addr.1, %while.body ], [ %x, %entry ]
%key = getelementptr inbounds %struct.search, ptr %x.addr.011, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !11
%cmp1.not = icmp eq i32 %0, %k
br i1 %cmp1.not, label %while.end, label %while.body
while.body: ; preds = %land.rhs
%cmp3 = icmp sgt i32 %0, %k
%left = getelementptr inbounds %struct.search, ptr %x.addr.011, i64 0, i32 1
%x.addr.1.in = select i1 %cmp3, ptr %left, ptr %x.addr.011
%x.addr.1 = load ptr, ptr %x.addr.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.addr.1, null
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !13
while.end: ; preds = %land.rhs, %while.body, %entry
%x.addr.0.lcssa = phi ptr [ null, %entry ], [ null, %while.body ], [ %x.addr.011, %land.rhs ]
ret ptr %x.addr.0.lcssa
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %key) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @T, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #9
%key1 = getelementptr inbounds %struct.search, ptr %call, i64 0, i32 3
store i32 %key, ptr %key1, align 8, !tbaa !11
%p = getelementptr inbounds %struct.search, ptr %call, i64 0, i32 2
%cmp.not37 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %call, i8 0, i64 24, i1 false)
br i1 %cmp.not37, label %if.end19, label %while.body
while.body: ; preds = %entry, %while.body
%x.038 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key3 = getelementptr inbounds %struct.search, ptr %x.038, i64 0, i32 3
%1 = load i32, ptr %key3, align 8, !tbaa !11
%cmp4 = icmp sgt i32 %1, %key
%left5 = getelementptr inbounds %struct.search, ptr %x.038, i64 0, i32 1
%x.1.in = select i1 %cmp4, ptr %left5, ptr %x.038
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else10, label %while.body, !llvm.loop !15
if.else10: ; preds = %while.body
store ptr %x.038, ptr %p, align 8, !tbaa !16
%key12 = getelementptr inbounds %struct.search, ptr %x.038, i64 0, i32 3
%2 = load i32, ptr %key12, align 8, !tbaa !11
%cmp13 = icmp sgt i32 %2, %key
%left15 = getelementptr inbounds %struct.search, ptr %x.038, i64 0, i32 1
%spec.select = select i1 %cmp13, ptr %left15, ptr %x.038
br label %if.end19
if.end19: ; preds = %if.else10, %entry
%left15.sink = phi ptr [ @T, %entry ], [ %spec.select, %if.else10 ]
store ptr %call, ptr %left15.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorderTreeWalk(ptr noundef readonly %x) local_unnamed_addr #0 {
entry:
%cmp.not4 = icmp eq ptr %x, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%x.tr5 = phi ptr [ %2, %if.then ], [ %x, %entry ]
%left = getelementptr inbounds %struct.search, ptr %x.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !18
tail call void @inorderTreeWalk(ptr noundef %0)
%key = getelementptr inbounds %struct.search, ptr %x.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !11
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %1)
%2 = load ptr, ptr %x.tr5, align 8, !tbaa !19
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Puriorder(ptr noundef readonly %x) local_unnamed_addr #0 {
entry:
%cmp.not4 = icmp eq ptr %x, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%x.tr5 = phi ptr [ %2, %if.then ], [ %x, %entry ]
%key = getelementptr inbounds %struct.search, ptr %x.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !11
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %0)
%left = getelementptr inbounds %struct.search, ptr %x.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !18
tail call void @Puriorder(ptr noundef %1)
%2 = load ptr, ptr %x.tr5, align 8, !tbaa !19
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind willreturn memory(argmem: read) }
attributes #6 = { nofree nounwind }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }
attributes #9 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"search", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!12, !6, i64 16}
!17 = distinct !{!17, !14}
!18 = !{!12, !6, i64 8}
!19 = !{!12, !6, i64 0}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Node{
int key;
struct Node *right,*left,*parent;
};
struct Node *root,*NIL;
struct Node * find(struct Node *u,int k){
while(u!=NIL && k!=u->key){
if(k < u->key) u=u->left;
else u=u->right;
}
return u;
}
void insert(int k){
struct Node *y=NIL;
struct Node *x=root;
struct Node *z;
z=(struct Node *)malloc(sizeof(struct Node));
z->key=k;
z->left=NIL;
z->right=NIL;
while(x!=NIL){
y=x;
if(z->key < x->key) x=x->left;
else x=x->right;
}
z->parent=y;
if(y==NIL) root=z;
else {
if(z->key < y->key) y->left=z;
else y->right=z;
}
}
void inorder(struct Node *u){
if(u==NIL) return;
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
void preorder(struct Node *u){
if(u==NIL) return;
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
int main()
{
struct Node *t;
char str1[]="insert";
char str2[]="print";
int n,i,x;
char com[1000];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",com);
if(com[0]=='f'){
scanf("%d",&x);
t=find(root,x);
if(t!=NIL) printf("yes\n");
else printf("no\n");
}
else if(strcmp(com,str1)==0){
scanf("%d",&x);
insert(x);
}
else if(strcmp(com,str2)==0){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220625/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220625/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, ptr, ptr, ptr }
@NIL = dso_local local_unnamed_addr global ptr null, align 8
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@__const.main.str1 = private unnamed_addr constant [7 x i8] c"insert\00", align 1
@__const.main.str2 = private unnamed_addr constant [6 x i8] c"print\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.6 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @find(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp.not10 = icmp eq ptr %0, %u
br i1 %cmp.not10, label %while.end, label %land.rhs
land.rhs: ; preds = %entry, %while.body
%u.addr.011 = phi ptr [ %u.addr.1, %while.body ], [ %u, %entry ]
%1 = load i32, ptr %u.addr.011, align 8, !tbaa !9
%cmp1.not = icmp eq i32 %1, %k
br i1 %cmp1.not, label %while.end, label %while.body
while.body: ; preds = %land.rhs
%cmp3 = icmp sgt i32 %1, %k
%left = getelementptr inbounds %struct.Node, ptr %u.addr.011, i64 0, i32 2
%right = getelementptr inbounds %struct.Node, ptr %u.addr.011, i64 0, i32 1
%u.addr.1.in = select i1 %cmp3, ptr %left, ptr %right
%u.addr.1 = load ptr, ptr %u.addr.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %u.addr.1, %0
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !12
while.end: ; preds = %land.rhs, %while.body, %entry
%u.addr.0.lcssa = phi ptr [ %u, %entry ], [ %0, %while.body ], [ %u.addr.011, %land.rhs ]
ret ptr %u.addr.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%1 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
store i32 %k, ptr %call, align 8, !tbaa !9
%left = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 2
store ptr %0, ptr %left, align 8, !tbaa !14
%right = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1
store ptr %0, ptr %right, align 8, !tbaa !15
%cmp.not34 = icmp eq ptr %1, %0
br i1 %cmp.not34, label %while.end.thread, label %while.body
while.end.thread: ; preds = %entry
%parent37 = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %0, ptr %parent37, align 8, !tbaa !16
br label %if.end17
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %1, %entry ]
%2 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %2, %k
%left4 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
%right5 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %right5
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, %0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !17
while.end: ; preds = %while.body
%parent = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %x.035, ptr %parent, align 8, !tbaa !16
%cmp6 = icmp eq ptr %x.035, %0
br i1 %cmp6, label %if.end17, label %if.else8
if.else8: ; preds = %while.end
%3 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %3, %k
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else8
%left13 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
br label %if.end17
if.else14: ; preds = %if.else8
%right15 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1
br label %if.end17
if.end17: ; preds = %while.end, %while.end.thread, %if.then12, %if.else14
%left13.sink = phi ptr [ %left13, %if.then12 ], [ %right15, %if.else14 ], [ @root, %while.end.thread ], [ @root, %while.end ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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) #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp4 = icmp eq ptr %0, %u
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ]
%left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%1 = load ptr, ptr %left, align 8, !tbaa !14
tail call void @inorder(ptr noundef %1)
%2 = load i32, ptr %u.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2)
%right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%3 = load ptr, ptr %right, align 8, !tbaa !15
%4 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp4 = icmp eq ptr %0, %u
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ]
%1 = load i32, ptr %u.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%2 = load ptr, ptr %left, align 8, !tbaa !14
tail call void @preorder(ptr noundef %2)
%right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%3 = load ptr, ptr %right, align 8, !tbaa !15
%4 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [1000 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 %x) #8
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %com) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !18
%cmp44 = icmp sgt i32 %0, 0
br i1 %cmp44, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.045 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !19
%cmp2 = icmp eq i8 %1, 102
br i1 %cmp2, label %if.then, label %if.else11
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load ptr, ptr @root, align 8, !tbaa !5
%3 = load i32, ptr %x, align 4, !tbaa !18
%4 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp.not10.i = icmp eq ptr %4, %2
br i1 %cmp.not10.i, label %find.exit, label %land.rhs.i
land.rhs.i: ; preds = %if.then, %while.body.i
%u.addr.011.i = phi ptr [ %u.addr.1.i, %while.body.i ], [ %2, %if.then ]
%5 = load i32, ptr %u.addr.011.i, align 8, !tbaa !9
%cmp1.not.i = icmp eq i32 %5, %3
br i1 %cmp1.not.i, label %find.exit, label %while.body.i
while.body.i: ; preds = %land.rhs.i
%cmp3.i = icmp sgt i32 %5, %3
%left.i = getelementptr inbounds %struct.Node, ptr %u.addr.011.i, i64 0, i32 2
%right.i = getelementptr inbounds %struct.Node, ptr %u.addr.011.i, i64 0, i32 1
%u.addr.1.in.i = select i1 %cmp3.i, ptr %left.i, ptr %right.i
%u.addr.1.i = load ptr, ptr %u.addr.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %u.addr.1.i, %4
br i1 %cmp.not.i, label %if.else, label %land.rhs.i, !llvm.loop !12
find.exit: ; preds = %land.rhs.i, %if.then
%u.addr.0.lcssa.i = phi ptr [ %2, %if.then ], [ %u.addr.011.i, %land.rhs.i ]
%cmp6.not = icmp eq ptr %u.addr.0.lcssa.i, %4
br i1 %cmp6.not, label %if.else, label %if.then8
if.then8: ; preds = %find.exit
%puts34 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
if.else: ; preds = %while.body.i, %find.exit
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.else11: ; preds = %for.body
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %com, ptr noundef nonnull dereferenceable(7) @__const.main.str1, i64 7)
%cmp15 = icmp eq i32 %bcmp, 0
br i1 %cmp15, label %if.then17, label %if.else19
if.then17: ; preds = %if.else11
%call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%6 = load i32, ptr %x, align 4, !tbaa !18
%7 = load ptr, ptr @NIL, align 8, !tbaa !5
%8 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
store i32 %6, ptr %call.i, align 8, !tbaa !9
%left.i35 = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 2
store ptr %7, ptr %left.i35, align 8, !tbaa !14
%right.i36 = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1
store ptr %7, ptr %right.i36, align 8, !tbaa !15
%cmp.not34.i = icmp eq ptr %8, %7
br i1 %cmp.not34.i, label %while.end.thread.i, label %while.body.i37
while.end.thread.i: ; preds = %if.then17
%parent37.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %7, ptr %parent37.i, align 8, !tbaa !16
br label %insert.exit
while.body.i37: ; preds = %if.then17, %while.body.i37
%x.035.i = phi ptr [ %x.1.i, %while.body.i37 ], [ %8, %if.then17 ]
%9 = load i32, ptr %x.035.i, align 8, !tbaa !9
%cmp3.i38 = icmp sgt i32 %9, %6
%left4.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 2
%right5.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i38, ptr %left4.i, ptr %right5.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i39 = icmp eq ptr %x.1.i, %7
br i1 %cmp.not.i39, label %while.end.i, label %while.body.i37, !llvm.loop !17
while.end.i: ; preds = %while.body.i37
%parent.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %x.035.i, ptr %parent.i, align 8, !tbaa !16
%cmp6.i = icmp eq ptr %x.035.i, %7
%spec.select42 = select i1 %cmp6.i, ptr @root, ptr %x.1.in.i
br label %insert.exit
insert.exit: ; preds = %while.end.i, %while.end.thread.i
%left13.sink.i = phi ptr [ @root, %while.end.thread.i ], [ %spec.select42, %while.end.i ]
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.else19: ; preds = %if.else11
%bcmp32 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %com, ptr noundef nonnull dereferenceable(6) @__const.main.str2, i64 6)
%cmp23 = icmp eq i32 %bcmp32, 0
br i1 %cmp23, label %if.then25, label %for.inc
if.then25: ; preds = %if.else19
%10 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %10)
%putchar = call i32 @putchar(i32 10)
%11 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %11)
%putchar33 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %if.else, %if.then8, %if.else19, %if.then25, %insert.exit
%inc = add nuw nsw i32 %i.045, 1
%12 = load i32, ptr %n, align 4, !tbaa !18
%cmp = icmp slt i32 %inc, %12
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !20
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %com) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { 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 #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress 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 "no-trapping-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 willreturn memory(argmem: read) }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"Node", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !6, i64 24}
!17 = distinct !{!17, !13}
!18 = !{!11, !11, i64 0}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !13}
|
#include<stdio.h>
#include<stdlib.h>
struct Node{
int key;
struct Node *r,*l,*p;
};
struct Node *B,*NIL;
void insert(int k){
struct Node *y = NIL;
struct Node *x = B;
struct Node *z;
z = (struct Node *)malloc(sizeof(struct Node));
z->key = k;
z->l = NIL;
z->r = NIL;
while(x!=NIL){
y = x;
if(z->key < x->key){
x = x->l;
}
else x = x->r;
}
z->p = y;
if(y == NIL ){
B=z;
}
else if(z->key < y->key){
y->l = z;
}
else y->r = z;
}
struct Node* find(int k,struct Node *u){
while( u != NIL && k != u->key ){
if(k < u->key) u = u->l;
else u = u->r;
}
return u;
}
void inorder(struct Node *u){
if(u==NIL) return;
inorder(u->l);
printf(" %d",u->key);
inorder(u->r);
}
void preorder(struct Node *u){
if(u == NIL )return;
printf(" %d",u->key);
preorder(u->l);
preorder(u->r);
}
int main(){
int i,j,x,y;
char G[8];
struct Node *s;
scanf("%d",&x);
for(i=0;i<x;i++){
scanf("%s",&G);
if(G[0] == 'i'){
scanf("%d",&y);
insert(y);
}
else if(G[0] == 'p'){
inorder(B);
printf("\n");
preorder(B);
printf("\n");
}
else if(G[0]=='f'){
scanf("%d",&y);
s = find(y,B);
if(s != NIL) printf("yes\n");
else if(s == NIL)printf("no\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220676/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220676/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, ptr, ptr, ptr }
@NIL = dso_local local_unnamed_addr global ptr null, align 8
@B = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.6 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%1 = load ptr, ptr @B, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %k, ptr %call, align 8, !tbaa !9
%l = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 2
store ptr %0, ptr %l, align 8, !tbaa !12
%r = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1
store ptr %0, ptr %r, align 8, !tbaa !13
%cmp.not34 = icmp eq ptr %1, %0
br i1 %cmp.not34, label %while.end.thread, label %while.body
while.end.thread: ; preds = %entry
%p37 = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %0, ptr %p37, align 8, !tbaa !14
br label %if.end17
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %1, %entry ]
%2 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %2, %k
%l4 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
%r5 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %l4, ptr %r5
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, %0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %while.body
%p = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %x.035, ptr %p, align 8, !tbaa !14
%cmp6 = icmp eq ptr %x.035, %0
br i1 %cmp6, label %if.end17, label %if.else8
if.else8: ; preds = %while.end
%3 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %3, %k
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else8
%l13 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
br label %if.end17
if.else14: ; preds = %if.else8
%r15 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1
br label %if.end17
if.end17: ; preds = %while.end, %while.end.thread, %if.then12, %if.else14
%l13.sink = phi ptr [ %l13, %if.then12 ], [ %r15, %if.else14 ], [ @B, %while.end.thread ], [ @B, %while.end ]
store ptr %call, ptr %l13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @find(i32 noundef %k, ptr noundef readonly %u) local_unnamed_addr #3 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp.not10 = icmp eq ptr %0, %u
br i1 %cmp.not10, label %while.end, label %land.rhs
land.rhs: ; preds = %entry, %while.body
%u.addr.011 = phi ptr [ %u.addr.1, %while.body ], [ %u, %entry ]
%1 = load i32, ptr %u.addr.011, align 8, !tbaa !9
%cmp1.not = icmp eq i32 %1, %k
br i1 %cmp1.not, label %while.end, label %while.body
while.body: ; preds = %land.rhs
%cmp3 = icmp sgt i32 %1, %k
%l = getelementptr inbounds %struct.Node, ptr %u.addr.011, i64 0, i32 2
%r = getelementptr inbounds %struct.Node, ptr %u.addr.011, i64 0, i32 1
%u.addr.1.in = select i1 %cmp3, ptr %l, ptr %r
%u.addr.1 = load ptr, ptr %u.addr.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %u.addr.1, %0
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !17
while.end: ; preds = %land.rhs, %while.body, %entry
%u.addr.0.lcssa = phi ptr [ %u, %entry ], [ %0, %while.body ], [ %u.addr.011, %land.rhs ]
ret ptr %u.addr.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp4 = icmp eq ptr %0, %u
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ]
%l = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%1 = load ptr, ptr %l, align 8, !tbaa !12
tail call void @inorder(ptr noundef %1)
%2 = load i32, ptr %u.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2)
%r = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%3 = load ptr, ptr %r, align 8, !tbaa !13
%4 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp4 = icmp eq ptr %0, %u
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ]
%1 = load i32, ptr %u.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%l = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%2 = load ptr, ptr %l, align 8, !tbaa !12
tail call void @preorder(ptr noundef %2)
%r = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%3 = load ptr, ptr %r, align 8, !tbaa !13
%4 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%G = alloca [8 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %G) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !18
%cmp47 = icmp sgt i32 %0, 0
br i1 %cmp47, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.048 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %G)
%1 = load i8, ptr %G, align 1, !tbaa !19
switch i8 %1, label %for.inc [
i8 105, label %if.then
i8 112, label %if.then9
i8 102, label %if.then17
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %y)
%2 = load i32, ptr %y, align 4, !tbaa !18
%3 = load ptr, ptr @NIL, align 8, !tbaa !5
%4 = load ptr, ptr @B, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %2, ptr %call.i, align 8, !tbaa !9
%l.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 2
store ptr %3, ptr %l.i, align 8, !tbaa !12
%r.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1
store ptr %3, ptr %r.i, align 8, !tbaa !13
%cmp.not34.i = icmp eq ptr %4, %3
br i1 %cmp.not34.i, label %while.end.thread.i, label %while.body.i
while.end.thread.i: ; preds = %if.then
%p37.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %3, ptr %p37.i, align 8, !tbaa !14
br label %insert.exit
while.body.i: ; preds = %if.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %4, %if.then ]
%5 = load i32, ptr %x.035.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %5, %2
%l4.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 2
%r5.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %l4.i, ptr %r5.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.1.i, %3
br i1 %cmp.not.i, label %while.end.i, label %while.body.i, !llvm.loop !15
while.end.i: ; preds = %while.body.i
%p.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %x.035.i, ptr %p.i, align 8, !tbaa !14
%cmp6.i = icmp eq ptr %x.035.i, %3
%spec.select45 = select i1 %cmp6.i, ptr @B, ptr %x.1.in.i
br label %insert.exit
insert.exit: ; preds = %while.end.i, %while.end.thread.i
%l13.sink.i = phi ptr [ @B, %while.end.thread.i ], [ %spec.select45, %while.end.i ]
store ptr %call.i, ptr %l13.sink.i, align 8, !tbaa !5
br label %for.inc
if.then9: ; preds = %for.body
%6 = load ptr, ptr @B, align 8, !tbaa !5
call void @inorder(ptr noundef %6)
%putchar = call i32 @putchar(i32 10)
%7 = load ptr, ptr @B, align 8, !tbaa !5
call void @preorder(ptr noundef %7)
%putchar36 = call i32 @putchar(i32 10)
br label %for.inc
if.then17: ; preds = %for.body
%call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %y)
%8 = load i32, ptr %y, align 4, !tbaa !18
%9 = load ptr, ptr @B, align 8, !tbaa !5
%10 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp.not10.i = icmp eq ptr %10, %9
br i1 %cmp.not10.i, label %find.exit, label %land.rhs.i
land.rhs.i: ; preds = %if.then17, %while.body.i37
%u.addr.011.i = phi ptr [ %u.addr.1.i, %while.body.i37 ], [ %9, %if.then17 ]
%11 = load i32, ptr %u.addr.011.i, align 8, !tbaa !9
%cmp1.not.i = icmp eq i32 %11, %8
br i1 %cmp1.not.i, label %find.exit, label %while.body.i37
while.body.i37: ; preds = %land.rhs.i
%cmp3.i38 = icmp sgt i32 %11, %8
%l.i39 = getelementptr inbounds %struct.Node, ptr %u.addr.011.i, i64 0, i32 2
%r.i40 = getelementptr inbounds %struct.Node, ptr %u.addr.011.i, i64 0, i32 1
%u.addr.1.in.i = select i1 %cmp3.i38, ptr %l.i39, ptr %r.i40
%u.addr.1.i = load ptr, ptr %u.addr.1.in.i, align 8, !tbaa !5
%cmp.not.i41 = icmp eq ptr %u.addr.1.i, %10
br i1 %cmp.not.i41, label %if.then27, label %land.rhs.i, !llvm.loop !17
find.exit: ; preds = %land.rhs.i, %if.then17
%u.addr.0.lcssa.i = phi ptr [ %9, %if.then17 ], [ %u.addr.011.i, %land.rhs.i ]
%cmp20.not = icmp eq ptr %u.addr.0.lcssa.i, %10
br i1 %cmp20.not, label %if.then27, label %if.then22
if.then22: ; preds = %find.exit
%puts35 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
if.then27: ; preds = %while.body.i37, %find.exit
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
for.inc: ; preds = %for.body, %insert.exit, %if.then27, %if.then22, %if.then9
%inc = add nuw nsw i32 %i.048, 1
%12 = load i32, ptr %x, align 4, !tbaa !18
%cmp = icmp slt i32 %inc, %12
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !20
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %G) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; 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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(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 "no-trapping-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 allocsize(0) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"Node", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 16}
!13 = !{!10, !6, i64 8}
!14 = !{!10, !6, i64 24}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = !{!11, !11, i64 0}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !16}
|
#include<stdio.h>
#include<stdlib.h>
struct node{
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node * Node;
#define NIL NULL
Node root;
//Node T_root;
void insert(int k){
Node y = NIL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->left = NIL;
z->right = NIL;
y=NIL;
x=root;
while(x!=NIL){
y=x;
if(z->key<x->key){
x=x->left;
}
else{
x=x->right;
}
}
z->parent=y;
if(y==NIL){
root=z;
}
else if(z->key<y->key){
y->left=z;
}
else{
y->right=z;
}
}
Node find(Node u,int k){
while(u!=NIL && k!=u->key){
if(k<u->key) u=u->left;
else u=u->right;
}
return u;
}
void inorder(Node u){
if(u==NIL) return;
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
void preorder(Node u){
if(u==NIL) return;
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
int main(){
int n, i, x;
char com[20];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s", com);
if ( com[0] == 'i' ){
scanf("%d", &x);
insert(x);
}
else if(com[0]=='f'){
scanf("%d", &x);
Node t = find(root, x);
if ( t != NIL ) printf("yes\n");
else printf("no\n");
}
else if ( com[0] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220719/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220719/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.6 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
%x.034 = load ptr, ptr @root, align 8, !tbaa !11
%cmp.not35 = icmp eq ptr %x.034, null
br i1 %cmp.not35, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.036 = phi ptr [ %x.0, %while.body ], [ %x.034, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.036, i64 0, i32 3
%0 = load i32, ptr %key2, align 8, !tbaa !5
%cmp3 = icmp sgt i32 %0, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.036, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %x.036
%x.0 = load ptr, ptr %x.1.in, align 8, !tbaa !11
%cmp.not = icmp eq ptr %x.0, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12
if.then7: ; preds = %entry
%parent38 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %parent38, align 8, !tbaa !14
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.036, ptr %parent, align 8, !tbaa !14
%key10 = getelementptr inbounds %struct.node, ptr %x.036, i64 0, i32 3
%1 = load i32, ptr %key10, align 8, !tbaa !5
%cmp11 = icmp sgt i32 %1, %k
%left13 = getelementptr inbounds %struct.node, ptr %x.036, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %left13, ptr %x.036
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !11
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @find(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #3 {
entry:
%cmp.not10 = icmp eq ptr %u, null
br i1 %cmp.not10, label %while.end, label %land.rhs
land.rhs: ; preds = %entry, %while.body
%u.addr.011 = phi ptr [ %u.addr.1, %while.body ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.addr.011, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !5
%cmp1.not = icmp eq i32 %0, %k
br i1 %cmp1.not, label %while.end, label %while.body
while.body: ; preds = %land.rhs
%cmp3 = icmp sgt i32 %0, %k
%left = getelementptr inbounds %struct.node, ptr %u.addr.011, i64 0, i32 1
%u.addr.1.in = select i1 %cmp3, ptr %left, ptr %u.addr.011
%u.addr.1 = load ptr, ptr %u.addr.1.in, align 8, !tbaa !11
%cmp.not = icmp eq ptr %u.addr.1, null
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !15
while.end: ; preds = %land.rhs, %while.body, %entry
%u.addr.0.lcssa = phi ptr [ null, %entry ], [ null, %while.body ], [ %u.addr.011, %land.rhs ]
ret ptr %u.addr.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !16
tail call void @inorder(ptr noundef %0)
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !17
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !16
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !17
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 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 %x) #8
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !18
%cmp38 = icmp sgt i32 %0, 0
br i1 %cmp38, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.039 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !19
switch i8 %1, label %for.inc [
i8 105, label %if.then
i8 102, label %if.then9
i8 112, label %if.then23
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !18
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %2, ptr %key.i, align 8, !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
%x.034.i = load ptr, ptr @root, align 8, !tbaa !11
%cmp.not35.i = icmp eq ptr %x.034.i, null
br i1 %cmp.not35.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.036.i = phi ptr [ %x.0.i, %while.body.i ], [ %x.034.i, %if.then ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.036.i, i64 0, i32 3
%3 = load i32, ptr %key2.i, align 8, !tbaa !5
%cmp3.i = icmp sgt i32 %3, %2
%left4.i = getelementptr inbounds %struct.node, ptr %x.036.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %x.036.i
%x.0.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !11
%cmp.not.i = icmp eq ptr %x.0.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12
insert.exit: ; preds = %while.body.i, %if.then
%.sink = phi ptr [ null, %if.then ], [ %x.036.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ]
%parent38.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %parent38.i, align 8, !tbaa !14
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !11
br label %for.inc
if.then9: ; preds = %for.body
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%4 = load ptr, ptr @root, align 8, !tbaa !11
%5 = load i32, ptr %x, align 4, !tbaa !18
%cmp.not10.i = icmp eq ptr %4, null
br i1 %cmp.not10.i, label %if.else16, label %land.rhs.i
land.rhs.i: ; preds = %if.then9, %while.body.i33
%u.addr.011.i = phi ptr [ %u.addr.1.i, %while.body.i33 ], [ %4, %if.then9 ]
%key.i32 = getelementptr inbounds %struct.node, ptr %u.addr.011.i, i64 0, i32 3
%6 = load i32, ptr %key.i32, align 8, !tbaa !5
%cmp1.not.i = icmp eq i32 %6, %5
br i1 %cmp1.not.i, label %if.then14, label %while.body.i33
while.body.i33: ; preds = %land.rhs.i
%cmp3.i34 = icmp sgt i32 %6, %5
%left.i = getelementptr inbounds %struct.node, ptr %u.addr.011.i, i64 0, i32 1
%u.addr.1.in.i = select i1 %cmp3.i34, ptr %left.i, ptr %u.addr.011.i
%u.addr.1.i = load ptr, ptr %u.addr.1.in.i, align 8, !tbaa !11
%cmp.not.i35 = icmp eq ptr %u.addr.1.i, null
br i1 %cmp.not.i35, label %if.else16, label %land.rhs.i, !llvm.loop !15
if.then14: ; preds = %land.rhs.i
%puts31 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
if.else16: ; preds = %while.body.i33, %if.then9
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.then23: ; preds = %for.body
%7 = load ptr, ptr @root, align 8, !tbaa !11
call void @inorder(ptr noundef %7)
%putchar = call i32 @putchar(i32 10)
%8 = load ptr, ptr @root, align 8, !tbaa !11
call void @preorder(ptr noundef %8)
%putchar30 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %if.then14, %if.else16, %insert.exit, %if.then23
%inc = add nuw nsw i32 %i.039, 1
%9 = load i32, ptr %n, align 4, !tbaa !18
%cmp = icmp slt i32 %inc, %9
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !20
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind allocsize(0) }
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, !10, i64 24}
!6 = !{!"node", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!6, !7, i64 16}
!15 = distinct !{!15, !13}
!16 = !{!6, !7, i64 8}
!17 = !{!6, !7, i64 0}
!18 = !{!10, !10, i64 0}
!19 = !{!8, !8, i64 0}
!20 = distinct !{!20, !13}
|
#include<stdio.h>
int main()
{
int h,m,n;
scanf("%d:%d",&h,&m);
scanf("%d",&n);
m=m+n;
if(m<60)
{
if(h<10)
printf("0%d",h);
else
printf("%d",h);
printf(":");
if(m<10)
printf("0%d",m);
else
printf("%d",m);
return 0;
}
if(m>=60)
{
h=h+(m/60);
m=m%60;
if(h<24)
{
if(h<10)
printf("0%d",h);
else
printf("%d",h);
printf(":");
if(m<10)
printf("0%d",m);
else
printf("%d",m);
return 0;
}
else if(h>=24)
{
h=h%24;
if(h<10)
printf("0%d",h);
else
printf("%d",h);
printf(":");
if(m<10)
printf("0%d",m);
else
printf("%d",m);
return 0;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22077/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22077/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d:%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"0%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%m = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %m)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %m, align 4, !tbaa !5
%1 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %1, %0
store i32 %add, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %add, 60
%2 = load i32, ptr %h, align 4, !tbaa !5
br i1 %cmp, label %if.then, label %if.then15
if.then: ; preds = %entry
%cmp2 = icmp slt i32 %2, 10
%.str.2..str.1 = select i1 %cmp2, ptr @.str.2, ptr @.str.1
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1, i32 noundef %2)
%putchar62 = call i32 @putchar(i32 58)
%3 = load i32, ptr %m, align 4, !tbaa !5
%cmp7 = icmp slt i32 %3, 10
br i1 %cmp7, label %if.then8, label %if.else10
if.then8: ; preds = %if.then
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %3)
br label %cleanup
if.else10: ; preds = %if.then
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
br label %cleanup
if.then15: ; preds = %entry
%div = udiv i32 %add, 60
%add16 = add nsw i32 %2, %div
store i32 %add16, ptr %h, align 4, !tbaa !5
%rem63 = urem i32 %add, 60
store i32 %rem63, ptr %m, align 4, !tbaa !5
%cmp17 = icmp slt i32 %add16, 24
br i1 %cmp17, label %if.then18, label %if.then34
if.then18: ; preds = %if.then15
%cmp19 = icmp slt i32 %add16, 10
%.str.2..str.166 = select i1 %cmp19, ptr @.str.2, ptr @.str.1
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.166, i32 noundef %add16)
%putchar61 = call i32 @putchar(i32 58)
%4 = load i32, ptr %m, align 4, !tbaa !5
%cmp26 = icmp slt i32 %4, 10
br i1 %cmp26, label %if.then27, label %if.else29
if.then27: ; preds = %if.then18
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %4)
br label %cleanup
if.else29: ; preds = %if.then18
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
br label %cleanup
if.then34: ; preds = %if.then15
%rem35 = urem i32 %add16, 24
store i32 %rem35, ptr %h, align 4, !tbaa !5
%cmp36 = icmp ult i32 %rem35, 10
%.str.2..str.167 = select i1 %cmp36, ptr @.str.2, ptr @.str.1
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.167, i32 noundef %rem35)
%putchar = call i32 @putchar(i32 58)
%5 = load i32, ptr %m, align 4, !tbaa !5
%cmp43 = icmp slt i32 %5, 10
br i1 %cmp43, label %if.then44, label %if.else46
if.then44: ; preds = %if.then34
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %5)
br label %cleanup
if.else46: ; preds = %if.then34
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
br label %cleanup
cleanup: ; preds = %if.then44, %if.else46, %if.then27, %if.else29, %if.then8, %if.else10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
struct node{
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node * Node;
#define NIL NULL
Node root =NIL;
Node treeMinimum(Node x){
while(x->right!=NIL)x=x->left;
return x;
}
Node treeSearch(Node x, int k){
while (x!=NIL && k!=x->key){
if(k<x->key)x=x->left;
else x=x->right;
}
return x;
}
Node treeSuccessor(Node x){
Node y;
if(x->right!=NIL){
return treeMinimum(x->right);
y=x->parent;
while (y !=NIL && x==y->right){
x=y;
y=y->parent;
}
return y;
}
}
void treeDelete(Node z){
Node y; // node to be deleted
Node x; // child of y
if(z->left==NIL||z->right==NIL){
y = z;
}
else y=treeSuccessor(z);
if(y->left !=NIL)x=y->left;
else x=y->right;
if(x != NIL)x->parent=y->parent;
if(y->parent==NIL)root=x;
else if(y==y->parent->left)y->parent=x;
else y->parent->right;
if(y!=z){
z->key=y->key;
}
}
void insert(int k){
Node y = NIL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->left = NIL;
z->right = NIL;
while(x!=NIL){
y=x;
if(z->key<x->key)x=x->left;
else x=x->right;
}
z->parent=y;
if(y==NIL)root=z;
else if (z->key<y->key)y->left=z;
else y->right=z;
}
void inorder(Node u){
if(u!=NIL){
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
}
void preorder(Node u){
if(u!=NIL){
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
}
int main(){
int n, i, x;
char com[20];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s", com);
if ( com[0] == 'f' ){
scanf("%d", &x);
Node t = treeSearch(root, x);
if ( t != NIL ) printf("yes\n");
else printf("no\n");
} else if ( com[0] == 'i' ){
scanf("%d", &x);
insert(x);
} else if ( com[0] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
} else if ( com[0] == 'd' ){
scanf("%d", &x);
treeDelete(treeSearch(root, x));
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220812/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220812/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.6 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeMinimum(ptr noundef readonly %x) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr %x, align 8, !tbaa !5
%cmp.not3 = icmp eq ptr %0, null
br i1 %cmp.not3, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%x.addr.04 = phi ptr [ %1, %while.body ], [ %x, %entry ]
%left = getelementptr inbounds %struct.node, ptr %x.addr.04, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !11
%2 = load ptr, ptr %1, align 8, !tbaa !5
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %while.body, %entry
%x.addr.0.lcssa = phi ptr [ %x, %entry ], [ %1, %while.body ]
ret ptr %x.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeSearch(ptr noundef readonly %x, i32 noundef %k) local_unnamed_addr #0 {
entry:
%cmp.not10 = icmp eq ptr %x, null
br i1 %cmp.not10, label %while.end, label %land.rhs
land.rhs: ; preds = %entry, %while.body
%x.addr.011 = phi ptr [ %x.addr.1, %while.body ], [ %x, %entry ]
%key = getelementptr inbounds %struct.node, ptr %x.addr.011, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !14
%cmp1.not = icmp eq i32 %0, %k
br i1 %cmp1.not, label %while.end, label %while.body
while.body: ; preds = %land.rhs
%cmp3 = icmp sgt i32 %0, %k
%left = getelementptr inbounds %struct.node, ptr %x.addr.011, i64 0, i32 1
%x.addr.1.in = select i1 %cmp3, ptr %left, ptr %x.addr.011
%x.addr.1 = load ptr, ptr %x.addr.1.in, align 8, !tbaa !15
%cmp.not = icmp eq ptr %x.addr.1, null
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !16
while.end: ; preds = %land.rhs, %while.body, %entry
%x.addr.0.lcssa = phi ptr [ null, %entry ], [ null, %while.body ], [ %x.addr.011, %land.rhs ]
ret ptr %x.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeSuccessor(ptr nocapture noundef readonly %x) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr %x, align 8, !tbaa !5
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %cleanup, label %if.then
if.then: ; preds = %entry
%1 = load ptr, ptr %0, align 8, !tbaa !5
%cmp.not3.i = icmp eq ptr %1, null
br i1 %cmp.not3.i, label %cleanup, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.addr.04.i = phi ptr [ %2, %while.body.i ], [ %0, %if.then ]
%left.i = getelementptr inbounds %struct.node, ptr %x.addr.04.i, i64 0, i32 1
%2 = load ptr, ptr %left.i, align 8, !tbaa !11
%3 = load ptr, ptr %2, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %3, null
br i1 %cmp.not.i, label %cleanup, label %while.body.i, !llvm.loop !12
cleanup: ; preds = %while.body.i, %if.then, %entry
%retval.0 = phi ptr [ undef, %entry ], [ %0, %if.then ], [ %2, %while.body.i ]
ret ptr %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @treeDelete(ptr noundef %z) local_unnamed_addr #2 {
entry:
%left = getelementptr inbounds %struct.node, ptr %z, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !11
%cmp = icmp eq ptr %0, null
br i1 %cmp, label %if.end, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%1 = load ptr, ptr %z, align 8, !tbaa !5
%cmp1 = icmp eq ptr %1, null
br i1 %cmp1, label %if.end, label %if.then.i
if.then.i: ; preds = %lor.lhs.false
%2 = load ptr, ptr %1, align 8, !tbaa !5
%cmp.not3.i.i = icmp eq ptr %2, null
br i1 %cmp.not3.i.i, label %if.end, label %while.body.i.i
while.body.i.i: ; preds = %if.then.i, %while.body.i.i
%x.addr.04.i.i = phi ptr [ %3, %while.body.i.i ], [ %1, %if.then.i ]
%left.i.i = getelementptr inbounds %struct.node, ptr %x.addr.04.i.i, i64 0, i32 1
%3 = load ptr, ptr %left.i.i, align 8, !tbaa !11
%4 = load ptr, ptr %3, align 8, !tbaa !5
%cmp.not.i.i = icmp eq ptr %4, null
br i1 %cmp.not.i.i, label %if.end, label %while.body.i.i, !llvm.loop !12
if.end: ; preds = %while.body.i.i, %if.then.i, %entry, %lor.lhs.false
%y.0 = phi ptr [ %z, %lor.lhs.false ], [ %z, %entry ], [ %1, %if.then.i ], [ %3, %while.body.i.i ]
%left2 = getelementptr inbounds %struct.node, ptr %y.0, i64 0, i32 1
%5 = load ptr, ptr %left2, align 8, !tbaa !11
%cmp3.not = icmp eq ptr %5, null
br i1 %cmp3.not, label %if.end8, label %if.then10
if.end8: ; preds = %if.end
%6 = load ptr, ptr %y.0, align 8, !tbaa !5
%cmp9.not = icmp eq ptr %6, null
br i1 %cmp9.not, label %if.end12, label %if.then10
if.then10: ; preds = %if.end, %if.end8
%x.052 = phi ptr [ %6, %if.end8 ], [ %5, %if.end ]
%parent = getelementptr inbounds %struct.node, ptr %y.0, i64 0, i32 2
%7 = load ptr, ptr %parent, align 8, !tbaa !17
%parent11 = getelementptr inbounds %struct.node, ptr %x.052, i64 0, i32 2
store ptr %7, ptr %parent11, align 8, !tbaa !17
br label %if.end12
if.end12: ; preds = %if.then10, %if.end8
%x.053 = phi ptr [ %x.052, %if.then10 ], [ null, %if.end8 ]
%parent13 = getelementptr inbounds %struct.node, ptr %y.0, i64 0, i32 2
%8 = load ptr, ptr %parent13, align 8, !tbaa !17
%cmp14 = icmp eq ptr %8, null
br i1 %cmp14, label %if.end26.sink.split, label %if.else16
if.else16: ; preds = %if.end12
%left18 = getelementptr inbounds %struct.node, ptr %8, i64 0, i32 1
%9 = load ptr, ptr %left18, align 8, !tbaa !11
%cmp19 = icmp eq ptr %y.0, %9
br i1 %cmp19, label %if.end26.sink.split, label %if.end26
if.end26.sink.split: ; preds = %if.else16, %if.end12
%parent13.sink = phi ptr [ @root, %if.end12 ], [ %parent13, %if.else16 ]
store ptr %x.053, ptr %parent13.sink, align 8, !tbaa !15
br label %if.end26
if.end26: ; preds = %if.end26.sink.split, %if.else16
%cmp27.not = icmp eq ptr %y.0, %z
br i1 %cmp27.not, label %if.end30, label %if.then28
if.then28: ; preds = %if.end26
%key = getelementptr inbounds %struct.node, ptr %y.0, i64 0, i32 3
%10 = load i32, ptr %key, align 8, !tbaa !14
%key29 = getelementptr inbounds %struct.node, ptr %z, i64 0, i32 3
store i32 %10, ptr %key29, align 8, !tbaa !14
br label %if.end30
if.end30: ; preds = %if.then28, %if.end26
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #3 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !15
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !14
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%1 = load i32, ptr %key2, align 8, !tbaa !14
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !15
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !18
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %parent37, align 8, !tbaa !17
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.035, ptr %parent, align 8, !tbaa !17
%key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%2 = load i32, ptr %key10, align 8, !tbaa !14
%cmp11 = icmp sgt i32 %2, %k
%left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %left13, ptr %x.035
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !15
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #3 {
entry:
%cmp.not4 = icmp eq ptr %u, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr5 = phi ptr [ %2, %if.then ], [ %u, %entry ]
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !11
tail call void @inorder(ptr noundef %0)
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !14
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !5
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #3 {
entry:
%cmp.not4 = icmp eq ptr %u, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr5 = phi ptr [ %2, %if.then ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !14
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !11
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !5
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #9
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !19
%cmp63 = icmp sgt i32 %0, 0
br i1 %cmp63, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.064 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !20
switch i8 %1, label %for.inc [
i8 102, label %if.then
i8 105, label %if.then16
i8 112, label %if.then23
i8 100, label %if.then31
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load ptr, ptr @root, align 8, !tbaa !15
%3 = load i32, ptr %x, align 4, !tbaa !19
%cmp.not10.i = icmp eq ptr %2, null
br i1 %cmp.not10.i, label %if.else, label %land.rhs.i
land.rhs.i: ; preds = %if.then, %while.body.i
%x.addr.011.i = phi ptr [ %x.addr.1.i, %while.body.i ], [ %2, %if.then ]
%key.i = getelementptr inbounds %struct.node, ptr %x.addr.011.i, i64 0, i32 3
%4 = load i32, ptr %key.i, align 8, !tbaa !14
%cmp1.not.i = icmp eq i32 %4, %3
br i1 %cmp1.not.i, label %if.then8, label %while.body.i
while.body.i: ; preds = %land.rhs.i
%cmp3.i = icmp sgt i32 %4, %3
%left.i = getelementptr inbounds %struct.node, ptr %x.addr.011.i, i64 0, i32 1
%x.addr.1.in.i = select i1 %cmp3.i, ptr %left.i, ptr %x.addr.011.i
%x.addr.1.i = load ptr, ptr %x.addr.1.in.i, align 8, !tbaa !15
%cmp.not.i = icmp eq ptr %x.addr.1.i, null
br i1 %cmp.not.i, label %if.else, label %land.rhs.i, !llvm.loop !16
if.then8: ; preds = %land.rhs.i
%puts40 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
if.else: ; preds = %while.body.i, %if.then
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.then16: ; preds = %for.body
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%5 = load i32, ptr %x, align 4, !tbaa !19
%6 = load ptr, ptr @root, align 8, !tbaa !15
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8
%key.i41 = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %5, ptr %key.i41, align 8, !tbaa !14
%cmp.not34.i = icmp eq ptr %6, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i42
while.body.i42: ; preds = %if.then16, %while.body.i42
%x.035.i = phi ptr [ %x.1.i, %while.body.i42 ], [ %6, %if.then16 ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%7 = load i32, ptr %key2.i, align 8, !tbaa !14
%cmp3.i43 = icmp sgt i32 %7, %5
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i43, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !15
%cmp.not.i44 = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i44, label %insert.exit, label %while.body.i42, !llvm.loop !18
insert.exit: ; preds = %while.body.i42, %if.then16
%.sink = phi ptr [ null, %if.then16 ], [ %x.035.i, %while.body.i42 ]
%left13.sink.i = phi ptr [ @root, %if.then16 ], [ %x.1.in.i, %while.body.i42 ]
%parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %parent37.i, align 8, !tbaa !17
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !15
br label %for.inc
if.then23: ; preds = %for.body
%8 = load ptr, ptr @root, align 8, !tbaa !15
call void @inorder(ptr noundef %8)
%putchar = call i32 @putchar(i32 10)
%9 = load ptr, ptr @root, align 8, !tbaa !15
call void @preorder(ptr noundef %9)
%putchar39 = call i32 @putchar(i32 10)
br label %for.inc
if.then31: ; preds = %for.body
%call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%10 = load ptr, ptr @root, align 8, !tbaa !15
%11 = load i32, ptr %x, align 4, !tbaa !19
%cmp.not10.i45 = icmp eq ptr %10, null
br i1 %cmp.not10.i45, label %treeSearch.exit57, label %land.rhs.i46
land.rhs.i46: ; preds = %if.then31, %while.body.i50
%x.addr.011.i47 = phi ptr [ %x.addr.1.i54, %while.body.i50 ], [ %10, %if.then31 ]
%key.i48 = getelementptr inbounds %struct.node, ptr %x.addr.011.i47, i64 0, i32 3
%12 = load i32, ptr %key.i48, align 8, !tbaa !14
%cmp1.not.i49 = icmp eq i32 %12, %11
br i1 %cmp1.not.i49, label %treeSearch.exit57, label %while.body.i50
while.body.i50: ; preds = %land.rhs.i46
%cmp3.i51 = icmp sgt i32 %12, %11
%left.i52 = getelementptr inbounds %struct.node, ptr %x.addr.011.i47, i64 0, i32 1
%x.addr.1.in.i53 = select i1 %cmp3.i51, ptr %left.i52, ptr %x.addr.011.i47
%x.addr.1.i54 = load ptr, ptr %x.addr.1.in.i53, align 8, !tbaa !15
%cmp.not.i55 = icmp eq ptr %x.addr.1.i54, null
br i1 %cmp.not.i55, label %treeSearch.exit57, label %land.rhs.i46, !llvm.loop !16
treeSearch.exit57: ; preds = %land.rhs.i46, %while.body.i50, %if.then31
%x.addr.0.lcssa.i56 = phi ptr [ null, %if.then31 ], [ %x.addr.011.i47, %land.rhs.i46 ], [ null, %while.body.i50 ]
%left.i58 = getelementptr inbounds %struct.node, ptr %x.addr.0.lcssa.i56, i64 0, i32 1
%13 = load ptr, ptr %left.i58, align 8, !tbaa !11
%cmp.i = icmp eq ptr %13, null
br i1 %cmp.i, label %if.end.i, label %lor.lhs.false.i
lor.lhs.false.i: ; preds = %treeSearch.exit57
%14 = load ptr, ptr %x.addr.0.lcssa.i56, align 8, !tbaa !5
%cmp1.i = icmp eq ptr %14, null
br i1 %cmp1.i, label %if.end.i, label %if.then.i.i
if.then.i.i: ; preds = %lor.lhs.false.i
%15 = load ptr, ptr %14, align 8, !tbaa !5
%cmp.not3.i.i.i = icmp eq ptr %15, null
br i1 %cmp.not3.i.i.i, label %if.end.i, label %while.body.i.i.i
while.body.i.i.i: ; preds = %if.then.i.i, %while.body.i.i.i
%x.addr.04.i.i.i = phi ptr [ %16, %while.body.i.i.i ], [ %14, %if.then.i.i ]
%left.i.i.i = getelementptr inbounds %struct.node, ptr %x.addr.04.i.i.i, i64 0, i32 1
%16 = load ptr, ptr %left.i.i.i, align 8, !tbaa !11
%17 = load ptr, ptr %16, align 8, !tbaa !5
%cmp.not.i.i.i = icmp eq ptr %17, null
br i1 %cmp.not.i.i.i, label %if.end.i, label %while.body.i.i.i, !llvm.loop !12
if.end.i: ; preds = %while.body.i.i.i, %if.then.i.i, %lor.lhs.false.i, %treeSearch.exit57
%y.0.i = phi ptr [ %x.addr.0.lcssa.i56, %lor.lhs.false.i ], [ %x.addr.0.lcssa.i56, %treeSearch.exit57 ], [ %14, %if.then.i.i ], [ %16, %while.body.i.i.i ]
%left2.i = getelementptr inbounds %struct.node, ptr %y.0.i, i64 0, i32 1
%18 = load ptr, ptr %left2.i, align 8, !tbaa !11
%cmp3.not.i = icmp eq ptr %18, null
br i1 %cmp3.not.i, label %if.end8.i, label %if.then10.i
if.end8.i: ; preds = %if.end.i
%19 = load ptr, ptr %y.0.i, align 8, !tbaa !5
%cmp9.not.i = icmp eq ptr %19, null
br i1 %cmp9.not.i, label %if.end12.i, label %if.then10.i
if.then10.i: ; preds = %if.end8.i, %if.end.i
%x.052.i = phi ptr [ %19, %if.end8.i ], [ %18, %if.end.i ]
%parent.i59 = getelementptr inbounds %struct.node, ptr %y.0.i, i64 0, i32 2
%20 = load ptr, ptr %parent.i59, align 8, !tbaa !17
%parent11.i = getelementptr inbounds %struct.node, ptr %x.052.i, i64 0, i32 2
store ptr %20, ptr %parent11.i, align 8, !tbaa !17
br label %if.end12.i
if.end12.i: ; preds = %if.then10.i, %if.end8.i
%x.053.i = phi ptr [ %x.052.i, %if.then10.i ], [ null, %if.end8.i ]
%parent13.i = getelementptr inbounds %struct.node, ptr %y.0.i, i64 0, i32 2
%21 = load ptr, ptr %parent13.i, align 8, !tbaa !17
%cmp14.i = icmp eq ptr %21, null
br i1 %cmp14.i, label %if.end26.sink.split.i, label %if.else16.i
if.else16.i: ; preds = %if.end12.i
%left18.i = getelementptr inbounds %struct.node, ptr %21, i64 0, i32 1
%22 = load ptr, ptr %left18.i, align 8, !tbaa !11
%cmp19.i = icmp eq ptr %y.0.i, %22
br i1 %cmp19.i, label %if.end26.sink.split.i, label %if.end26.i
if.end26.sink.split.i: ; preds = %if.else16.i, %if.end12.i
%parent13.sink.i = phi ptr [ @root, %if.end12.i ], [ %parent13.i, %if.else16.i ]
store ptr %x.053.i, ptr %parent13.sink.i, align 8, !tbaa !15
br label %if.end26.i
if.end26.i: ; preds = %if.end26.sink.split.i, %if.else16.i
%cmp27.not.i = icmp eq ptr %y.0.i, %x.addr.0.lcssa.i56
br i1 %cmp27.not.i, label %for.inc, label %if.then28.i
if.then28.i: ; preds = %if.end26.i
%key.i60 = getelementptr inbounds %struct.node, ptr %y.0.i, i64 0, i32 3
%23 = load i32, ptr %key.i60, align 8, !tbaa !14
%key29.i = getelementptr inbounds %struct.node, ptr %x.addr.0.lcssa.i56, i64 0, i32 3
store i32 %23, ptr %key29.i, align 8, !tbaa !14
br label %for.inc
for.inc: ; preds = %if.then28.i, %if.end26.i, %for.body, %if.then8, %if.else, %if.then23, %insert.exit
%inc = add nuw nsw i32 %i.064, 1
%24 = load i32, ptr %n, align 4, !tbaa !19
%cmp = icmp slt i32 %inc, %24
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !21
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
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 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree norecurse 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !7, i64 0}
!6 = !{!"node", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 8}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!6, !10, i64 24}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !13}
!17 = !{!6, !7, i64 16}
!18 = distinct !{!18, !13}
!19 = !{!10, !10, i64 0}
!20 = !{!8, !8, i64 0}
!21 = distinct !{!21, !13}
|
/*
* FileName: binary_tree_2
* CreatedDate: 2020-04-22 21:32:11 +0900
* LastModified: 2020-04-23 01:02:05 +0900
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define node_max 500000
typedef struct _node{
long int number;
struct _node *pare;
struct _node *left;
struct _node *right;
}_node;
void insert_node(_node *pare, _node *new){
if(pare==NULL){
return;
}
if(pare->left==NULL&&pare->number>new->number){
pare->left=new;
new->pare=pare;
}
else if(pare->left!=NULL&&pare->number>new->number){
insert_node(pare->left,new);
}
else if(pare->right==NULL&&pare->number<new->number){
pare->right=new;
new->pare=pare;
}
else{
insert_node(pare->right,new);
}
}
void print_node(_node *pare,int order){
if(pare==NULL){
return ;
}
if(order==0){
printf(" %ld",pare->number);
print_node(pare->left,order);
print_node(pare->right,order);
}
else{
print_node(pare->left,order);
printf(" %ld",pare->number);
print_node(pare->right,order);
}
}
int find_node(_node *pare,int key){
if(pare==NULL){
return 0;
}
if(pare->number==key){
return 1;
}
else{
if(pare->number>key){
return find_node(pare->left,key);
}
else{
return find_node(pare->right,key);
}
}
}
int main(void){
int n,count=0;
scanf("%d",&n);
_node *nn = (_node*)malloc(sizeof(_node));
nn->left=NULL;
nn->right=NULL;
nn->pare=NULL;
char tmp[7];
scanf("%s %ld",tmp,&nn->number);
_node *pare = nn;
_node *node = (_node*)malloc(n*sizeof(_node));
for(int i=1;i<n;i++){
char *command = (char*)malloc(7*sizeof(char));
scanf("%s",command);
if(strcmp(command,"insert")==0){
scanf("%ld",&(node+count)->number);
insert_node(pare,node+count);
count++;
pare=nn;
}
else if(strcmp(command,"print")==0){
print_node(pare,1);
printf("\n");
print_node(pare,0);
printf("\n");
}
else{
int key;
scanf("%d",&key);
if(find_node(pare,key)==0){
printf("no\n");
}
else{
printf("yes\n");
}
pare=nn;
}
free(command);
}
free(nn);
free(node);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220863/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220863/source.c"
target datalayout = "e-m:e-p270: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 { i64, ptr, ptr, ptr }
@.str = private unnamed_addr constant [5 x i8] c" %ld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%s %ld\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.4 = private unnamed_addr constant [7 x i8] c"insert\00", align 1
@.str.5 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.6 = private unnamed_addr constant [6 x i8] c"print\00", align 1
@str = private unnamed_addr constant [4 x i8] c"yes\00", align 1
@str.10 = private unnamed_addr constant [3 x i8] c"no\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insert_node(ptr noundef %pare, ptr noundef %new) local_unnamed_addr #0 {
entry:
%cmp53 = icmp eq ptr %pare, null
br i1 %cmp53, label %if.end28, label %if.end.preheader
if.end.preheader: ; preds = %entry
%0 = load i64, ptr %new, align 8, !tbaa !5
br label %if.end
if.end: ; preds = %if.end.backedge, %if.end.preheader
%pare.tr54 = phi ptr [ %pare, %if.end.preheader ], [ %pare.tr54.be, %if.end.backedge ]
%left = getelementptr inbounds %struct._node, ptr %pare.tr54, i64 0, i32 2
%1 = load ptr, ptr %left, align 8, !tbaa !11
%cmp1 = icmp eq ptr %1, null
%2 = load i64, ptr %pare.tr54, align 8, !tbaa !5
%cmp3 = icmp sgt i64 %2, %0
br i1 %cmp1, label %land.lhs.true, label %land.lhs.true9
land.lhs.true: ; preds = %if.end
br i1 %cmp3, label %if.then4, label %if.else15
if.then4: ; preds = %land.lhs.true
%left.le = getelementptr inbounds %struct._node, ptr %pare.tr54, i64 0, i32 2
br label %if.end28.sink.split
land.lhs.true9: ; preds = %if.end
br i1 %cmp3, label %if.end.backedge, label %if.else15
if.else15: ; preds = %land.lhs.true, %land.lhs.true9
%right = getelementptr inbounds %struct._node, ptr %pare.tr54, i64 0, i32 3
%3 = load ptr, ptr %right, align 8, !tbaa !12
%cmp16 = icmp eq ptr %3, null
br i1 %cmp16, label %land.lhs.true17, label %if.end.backedge
if.end.backedge: ; preds = %if.else15, %land.lhs.true9
%pare.tr54.be = phi ptr [ %1, %land.lhs.true9 ], [ %3, %if.else15 ]
br label %if.end
land.lhs.true17: ; preds = %if.else15
%right.le = getelementptr inbounds %struct._node, ptr %pare.tr54, i64 0, i32 3
%cmp20 = icmp slt i64 %2, %0
br i1 %cmp20, label %if.end28.sink.split, label %if.end28
if.end28.sink.split: ; preds = %land.lhs.true17, %if.then4
%right.le.sink = phi ptr [ %left.le, %if.then4 ], [ %right.le, %land.lhs.true17 ]
store ptr %new, ptr %right.le.sink, align 8, !tbaa !13
%pare23 = getelementptr inbounds %struct._node, ptr %new, i64 0, i32 1
store ptr %pare.tr54, ptr %pare23, align 8, !tbaa !14
br label %if.end28
if.end28: ; preds = %if.end28.sink.split, %land.lhs.true17, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print_node(ptr noundef readonly %pare, i32 noundef %order) local_unnamed_addr #1 {
entry:
%cmp1923 = icmp eq ptr %pare, null
br i1 %cmp1923, label %if.end7, label %if.end.lr.ph.preheader
if.end.lr.ph.preheader: ; preds = %entry
%cmp1.peel = icmp eq i32 %order, 0
br i1 %cmp1.peel, label %if.end.lr.ph.split.us.peel, label %if.end
if.end.lr.ph.split.us.peel: ; preds = %if.end.lr.ph.preheader
%0 = load i64, ptr %pare, align 8, !tbaa !5
%call.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %0)
%left.peel = getelementptr inbounds %struct._node, ptr %pare, i64 0, i32 2
%1 = load ptr, ptr %left.peel, align 8, !tbaa !11
tail call void @print_node(ptr noundef %1, i32 noundef 0)
%right.peel = getelementptr inbounds %struct._node, ptr %pare, i64 0, i32 3
%2 = load ptr, ptr %right.peel, align 8, !tbaa !12
%cmp19.peel = icmp eq ptr %2, null
br i1 %cmp19.peel, label %if.end7, label %if.end.lr.ph.split.us
if.end.lr.ph.split.us: ; preds = %if.end.lr.ph.split.us.peel, %if.end.lr.ph.split.us
%pare.tr.ph24 = phi ptr [ %5, %if.end.lr.ph.split.us ], [ %2, %if.end.lr.ph.split.us.peel ]
%3 = load i64, ptr %pare.tr.ph24, align 8, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %3)
%left = getelementptr inbounds %struct._node, ptr %pare.tr.ph24, i64 0, i32 2
%4 = load ptr, ptr %left, align 8, !tbaa !11
tail call void @print_node(ptr noundef %4, i32 noundef 0)
%right = getelementptr inbounds %struct._node, ptr %pare.tr.ph24, i64 0, i32 3
%5 = load ptr, ptr %right, align 8, !tbaa !12
%cmp19 = icmp eq ptr %5, null
br i1 %cmp19, label %if.end7, label %if.end.lr.ph.split.us, !llvm.loop !15
if.end: ; preds = %if.end.lr.ph.preheader, %if.end
%pare.tr20 = phi ptr [ %8, %if.end ], [ %pare, %if.end.lr.ph.preheader ]
%left3 = getelementptr inbounds %struct._node, ptr %pare.tr20, i64 0, i32 2
%6 = load ptr, ptr %left3, align 8, !tbaa !11
tail call void @print_node(ptr noundef %6, i32 noundef %order)
%7 = load i64, ptr %pare.tr20, align 8, !tbaa !5
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %7)
%right6 = getelementptr inbounds %struct._node, ptr %pare.tr20, i64 0, i32 3
%8 = load ptr, ptr %right6, align 8, !tbaa !12
%cmp = icmp eq ptr %8, null
br i1 %cmp, label %if.end7, label %if.end
if.end7: ; preds = %if.end, %if.end.lr.ph.split.us, %if.end.lr.ph.split.us.peel, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find_node(ptr noundef readonly %pare, i32 noundef %key) local_unnamed_addr #3 {
entry:
%cmp18 = icmp eq ptr %pare, null
br i1 %cmp18, label %return, label %if.end.lr.ph
if.end.lr.ph: ; preds = %entry
%conv = sext i32 %key to i64
br label %if.end
if.end: ; preds = %if.end.lr.ph, %if.else
%pare.tr19 = phi ptr [ %pare, %if.end.lr.ph ], [ %pare.tr.be, %if.else ]
%0 = load i64, ptr %pare.tr19, align 8, !tbaa !5
%cmp1 = icmp eq i64 %0, %conv
br i1 %cmp1, label %return, label %if.else
if.else: ; preds = %if.end
%cmp6 = icmp sgt i64 %0, %conv
%left = getelementptr inbounds %struct._node, ptr %pare.tr19, i64 0, i32 2
%right = getelementptr inbounds %struct._node, ptr %pare.tr19, i64 0, i32 3
%pare.tr.be.in = select i1 %cmp6, ptr %left, ptr %right
%pare.tr.be = load ptr, ptr %pare.tr.be.in, align 8, !tbaa !13
%cmp = icmp eq ptr %pare.tr.be, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.else, %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %if.end ], [ 0, %if.else ]
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
%tmp = alloca [7 x i8], align 1
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%call1 = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #12
%pare = getelementptr inbounds %struct._node, ptr %call1, i64 0, i32 1
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %pare, i8 0, i64 24, i1 false)
call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %tmp) #11
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %tmp, ptr noundef %call1)
%0 = load i32, ptr %n, align 4, !tbaa !17
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 5
%call4 = call noalias ptr @malloc(i64 noundef %mul) #12
%cmp68 = icmp sgt i32 %0, 1
br i1 %cmp68, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %if.end31, %entry
call void @free(ptr noundef %call1) #11
call void @free(ptr noundef %call4) #11
call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %tmp) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
for.body: ; preds = %entry, %if.end31
%count.070 = phi i32 [ %count.1, %if.end31 ], [ 0, %entry ]
%i.069 = phi i32 [ %inc32, %if.end31 ], [ 1, %entry ]
%call6 = call noalias dereferenceable_or_null(7) ptr @malloc(i64 noundef 7) #12
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef %call6)
%call8 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %call6, ptr noundef nonnull dereferenceable(7) @.str.4) #13
%cmp9 = icmp eq i32 %call8, 0
br i1 %cmp9, label %if.then, label %if.else
if.then: ; preds = %for.body
%idx.ext = sext i32 %count.070 to i64
%add.ptr = getelementptr inbounds %struct._node, ptr %call4, i64 %idx.ext
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef %add.ptr)
%1 = load i64, ptr %add.ptr, align 8, !tbaa !5
br label %if.end.i
if.end.i: ; preds = %if.end.i.backedge, %if.then
%pare.tr54.i = phi ptr [ %call1, %if.then ], [ %pare.tr54.i.be, %if.end.i.backedge ]
%left.i = getelementptr inbounds %struct._node, ptr %pare.tr54.i, i64 0, i32 2
%2 = load ptr, ptr %left.i, align 8, !tbaa !11
%cmp1.i = icmp eq ptr %2, null
%3 = load i64, ptr %pare.tr54.i, align 8, !tbaa !5
%cmp3.i = icmp sgt i64 %3, %1
br i1 %cmp1.i, label %land.lhs.true.i, label %land.lhs.true9.i
land.lhs.true.i: ; preds = %if.end.i
br i1 %cmp3.i, label %if.end28.sink.split.i.loopexit, label %if.else15.i
land.lhs.true9.i: ; preds = %if.end.i
br i1 %cmp3.i, label %if.end.i.backedge, label %if.else15.i
if.else15.i: ; preds = %land.lhs.true9.i, %land.lhs.true.i
%right.i = getelementptr inbounds %struct._node, ptr %pare.tr54.i, i64 0, i32 3
%4 = load ptr, ptr %right.i, align 8, !tbaa !12
%cmp16.i = icmp eq ptr %4, null
br i1 %cmp16.i, label %land.lhs.true17.i, label %if.end.i.backedge
if.end.i.backedge: ; preds = %if.else15.i, %land.lhs.true9.i
%pare.tr54.i.be = phi ptr [ %2, %land.lhs.true9.i ], [ %4, %if.else15.i ]
br label %if.end.i
land.lhs.true17.i: ; preds = %if.else15.i
%right.i.le = getelementptr inbounds %struct._node, ptr %pare.tr54.i, i64 0, i32 3
%cmp20.i = icmp slt i64 %3, %1
br i1 %cmp20.i, label %if.end28.sink.split.i, label %insert_node.exit
if.end28.sink.split.i.loopexit: ; preds = %land.lhs.true.i
%left.i.le = getelementptr inbounds %struct._node, ptr %pare.tr54.i, i64 0, i32 2
br label %if.end28.sink.split.i
if.end28.sink.split.i: ; preds = %if.end28.sink.split.i.loopexit, %land.lhs.true17.i
%right.le.sink.i = phi ptr [ %right.i.le, %land.lhs.true17.i ], [ %left.i.le, %if.end28.sink.split.i.loopexit ]
store ptr %add.ptr, ptr %right.le.sink.i, align 8, !tbaa !13
%pare23.i = getelementptr inbounds %struct._node, ptr %call4, i64 %idx.ext, i32 1
store ptr %pare.tr54.i, ptr %pare23.i, align 8, !tbaa !14
br label %insert_node.exit
insert_node.exit: ; preds = %land.lhs.true17.i, %if.end28.sink.split.i
%inc = add nsw i32 %count.070, 1
br label %if.end31
if.else: ; preds = %for.body
%call15 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %call6, ptr noundef nonnull dereferenceable(6) @.str.6) #13
%cmp16 = icmp eq i32 %call15, 0
br i1 %cmp16, label %if.then18, label %if.else21
if.then18: ; preds = %if.else
call void @print_node(ptr noundef %call1, i32 noundef 1)
%putchar = call i32 @putchar(i32 10)
call void @print_node(ptr noundef %call1, i32 noundef 0)
%putchar52 = call i32 @putchar(i32 10)
br label %if.end31
if.else21: ; preds = %if.else
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #11
%call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %key)
%5 = load i32, ptr %key, align 4, !tbaa !17
%conv.i = sext i32 %5 to i64
br label %if.end.i53
if.end.i53: ; preds = %if.else.i, %if.else21
%pare.tr19.i = phi ptr [ %call1, %if.else21 ], [ %pare.tr.be.i57, %if.else.i ]
%6 = load i64, ptr %pare.tr19.i, align 8, !tbaa !5
%cmp1.i54 = icmp eq i64 %6, %conv.i
br i1 %cmp1.i54, label %if.end, label %if.else.i
if.else.i: ; preds = %if.end.i53
%cmp6.i = icmp sgt i64 %6, %conv.i
%left.i55 = getelementptr inbounds %struct._node, ptr %pare.tr19.i, i64 0, i32 2
%right.i56 = getelementptr inbounds %struct._node, ptr %pare.tr19.i, i64 0, i32 3
%pare.tr.be.in.i = select i1 %cmp6.i, ptr %left.i55, ptr %right.i56
%pare.tr.be.i57 = load ptr, ptr %pare.tr.be.in.i, align 8, !tbaa !13
%cmp.i = icmp eq ptr %pare.tr.be.i57, null
br i1 %cmp.i, label %if.end, label %if.end.i53
if.end: ; preds = %if.end.i53, %if.else.i
%str.sink = phi ptr [ @str.10, %if.else.i ], [ @str, %if.end.i53 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #11
br label %if.end31
if.end31: ; preds = %if.then18, %if.end, %insert_node.exit
%count.1 = phi i32 [ %inc, %insert_node.exit ], [ %count.070, %if.then18 ], [ %count.070, %if.end ]
call void @free(ptr noundef %call6) #11
%inc32 = add nuw nsw i32 %i.069, 1
%7 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc32, %7
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !19
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #5
; 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 #6
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #5
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #9
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #10
attributes #0 = { nofree norecurse 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { 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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { 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 #9 = { nofree nounwind }
attributes #10 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #11 = { nounwind }
attributes #12 = { nounwind allocsize(0) }
attributes #13 = { 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, !7, i64 0}
!6 = !{!"_node", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!6, !10, i64 24}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !10, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = !{!18, !18, i64 0}
!18 = !{!"int", !8, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
|
//Binary tree search 2
#include<stdio.h>
#include<stdlib.h>
#define N NULL
typedef struct node
{
struct node *p, *l, *r;
int w;
}*tree;
void prepare(tree *root, int w)
{
(*root) = (tree)malloc(sizeof(struct node));
(*root)->p = N;
(*root)->l = N;
(*root)->r = N;
(*root)->w = w;
}
void ins(tree *root, tree imp)
{
tree y = N;
tree x = *root;
while(x != N)
{
y = x;
if(imp->w < x->w)
{
x = x->l;
} else {
x = x->r;
}
}
imp->p = y;
if(y == N)
{
*root = imp;
}
else if(imp->w > y->w)
{
y->r = imp;
}
else y->l = imp;
}
tree find(tree root,int w)
{
while(root != N && w != root->w)
{
if(w < root->w)
{
root = root->l;
}
else root = root->r;
}
return root;
}
void inorder(tree imp)
{
if(imp != N)
{
inorder(imp->l);
printf(" %d",imp->w);
inorder(imp->r);
}
}
void preorder(tree imp)
{
if(imp != N)
{
printf(" %d",imp->w);
preorder(imp->l);
preorder(imp->r);
}
}
void print(tree root)
{
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
int main()
{
tree root, imp, f;
root = N;
int n,w,i;
char arr[10];
//input data
scanf("%d",&n);
for(i = 0; i < n; i++)
{
scanf("%s",arr);
if(arr[0] == 'i')
{
scanf("%d",&w);
prepare(&imp,w);
ins(&root,imp);
}
if(arr[0] == 'p')
{
print(root);
}
if(arr[0] == 'f')
{
scanf("%d",&w);
f = find(root,w);
if(f != N)
{
printf("yes\n");
}
else printf("no\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_220906/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_220906/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.6 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write, inaccessiblemem: readwrite) uwtable
define dso_local void @prepare(ptr nocapture noundef writeonly %root, i32 noundef %w) local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #9
store ptr %call, ptr %root, align 8, !tbaa !5
%w1 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %call, i8 0, i64 24, i1 false)
store i32 %w, ptr %w1, align 8, !tbaa !9
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @ins(ptr nocapture noundef %root, ptr noundef %imp) local_unnamed_addr #2 {
entry:
%x.029 = load ptr, ptr %root, align 8, !tbaa !5
%cmp.not30 = icmp eq ptr %x.029, null
br i1 %cmp.not30, label %if.then4, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%w = getelementptr inbounds %struct.node, ptr %imp, i64 0, i32 3
%0 = load i32, ptr %w, align 8, !tbaa !9
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%x.031 = phi ptr [ %x.029, %while.body.lr.ph ], [ %x.0, %while.body ]
%w1 = getelementptr inbounds %struct.node, ptr %x.031, i64 0, i32 3
%1 = load i32, ptr %w1, align 8, !tbaa !9
%cmp2 = icmp slt i32 %0, %1
%l = getelementptr inbounds %struct.node, ptr %x.031, i64 0, i32 1
%r = getelementptr inbounds %struct.node, ptr %x.031, i64 0, i32 2
%x.1.in = select i1 %cmp2, ptr %l, ptr %r
%x.0 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.0, null
br i1 %cmp.not, label %if.else5, label %while.body, !llvm.loop !12
if.then4: ; preds = %entry
store ptr null, ptr %imp, align 8, !tbaa !14
br label %if.end14
if.else5: ; preds = %while.body
store ptr %x.031, ptr %imp, align 8, !tbaa !14
%w6 = getelementptr inbounds %struct.node, ptr %imp, i64 0, i32 3
%2 = load i32, ptr %w6, align 8, !tbaa !9
%w7 = getelementptr inbounds %struct.node, ptr %x.031, i64 0, i32 3
%3 = load i32, ptr %w7, align 8, !tbaa !9
%cmp8 = icmp sgt i32 %2, %3
br i1 %cmp8, label %if.then9, label %if.else11
if.then9: ; preds = %if.else5
%r10 = getelementptr inbounds %struct.node, ptr %x.031, i64 0, i32 2
br label %if.end14
if.else11: ; preds = %if.else5
%l12 = getelementptr inbounds %struct.node, ptr %x.031, i64 0, i32 1
br label %if.end14
if.end14: ; preds = %if.then9, %if.else11, %if.then4
%r10.sink = phi ptr [ %r10, %if.then9 ], [ %l12, %if.else11 ], [ %root, %if.then4 ]
store ptr %imp, ptr %r10.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @find(ptr noundef readonly %root, i32 noundef %w) local_unnamed_addr #4 {
entry:
%cmp.not11 = icmp eq ptr %root, null
br i1 %cmp.not11, label %while.end, label %land.rhs
land.rhs: ; preds = %entry, %while.body
%root.addr.012 = phi ptr [ %root.addr.1, %while.body ], [ %root, %entry ]
%w1 = getelementptr inbounds %struct.node, ptr %root.addr.012, i64 0, i32 3
%0 = load i32, ptr %w1, align 8, !tbaa !9
%cmp2.not = icmp eq i32 %0, %w
br i1 %cmp2.not, label %while.end, label %while.body
while.body: ; preds = %land.rhs
%cmp4 = icmp sgt i32 %0, %w
%l = getelementptr inbounds %struct.node, ptr %root.addr.012, i64 0, i32 1
%r = getelementptr inbounds %struct.node, ptr %root.addr.012, i64 0, i32 2
%root.addr.1.in = select i1 %cmp4, ptr %l, ptr %r
%root.addr.1 = load ptr, ptr %root.addr.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %root.addr.1, null
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !15
while.end: ; preds = %land.rhs, %while.body, %entry
%root.addr.0.lcssa = phi ptr [ null, %entry ], [ null, %while.body ], [ %root.addr.012, %land.rhs ]
ret ptr %root.addr.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %imp) local_unnamed_addr #5 {
entry:
%cmp.not4 = icmp eq ptr %imp, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%imp.tr5 = phi ptr [ %2, %if.then ], [ %imp, %entry ]
%l = getelementptr inbounds %struct.node, ptr %imp.tr5, i64 0, i32 1
%0 = load ptr, ptr %l, align 8, !tbaa !16
tail call void @inorder(ptr noundef %0)
%w = getelementptr inbounds %struct.node, ptr %imp.tr5, i64 0, i32 3
%1 = load i32, ptr %w, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%r = getelementptr inbounds %struct.node, ptr %imp.tr5, i64 0, i32 2
%2 = load ptr, ptr %r, align 8, !tbaa !17
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %imp) local_unnamed_addr #5 {
entry:
%cmp.not4 = icmp eq ptr %imp, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%imp.tr5 = phi ptr [ %2, %if.then ], [ %imp, %entry ]
%w = getelementptr inbounds %struct.node, ptr %imp.tr5, i64 0, i32 3
%0 = load i32, ptr %w, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%l = getelementptr inbounds %struct.node, ptr %imp.tr5, i64 0, i32 1
%1 = load ptr, ptr %l, align 8, !tbaa !16
tail call void @preorder(ptr noundef %1)
%r = getelementptr inbounds %struct.node, ptr %imp.tr5, i64 0, i32 2
%2 = load ptr, ptr %r, align 8, !tbaa !17
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(ptr noundef %root) local_unnamed_addr #5 {
entry:
tail call void @inorder(ptr noundef %root)
%putchar = tail call i32 @putchar(i32 10)
tail call void @preorder(ptr noundef %root)
%putchar3 = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%root = alloca ptr, align 8
%n = alloca i32, align 4
%w = alloca i32, align 4
%arr = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %root)
store ptr null, ptr %root, align 8, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #10
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #10
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %arr) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !18
%cmp36 = icmp sgt i32 %0, 0
br i1 %cmp36, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.037 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %arr)
%1 = load i8, ptr %arr, align 1, !tbaa !19
%cmp2 = icmp eq i8 %1, 105
br i1 %cmp2, label %if.then, label %if.end
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %w)
%2 = load i32, ptr %w, align 4, !tbaa !18
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #9
%w1.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %call.i, i8 0, i64 24, i1 false)
store i32 %2, ptr %w1.i, align 8, !tbaa !9
%root.0.root.0.root.0.x.029.i = load ptr, ptr %root, align 8, !tbaa !5
%cmp.not30.i = icmp eq ptr %root.0.root.0.root.0.x.029.i, null
br i1 %cmp.not30.i, label %ins.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.031.i = phi ptr [ %x.0.i, %while.body.i ], [ %root.0.root.0.root.0.x.029.i, %if.then ]
%w1.i27 = getelementptr inbounds %struct.node, ptr %x.031.i, i64 0, i32 3
%3 = load i32, ptr %w1.i27, align 8, !tbaa !9
%cmp2.i = icmp slt i32 %2, %3
%l.i = getelementptr inbounds %struct.node, ptr %x.031.i, i64 0, i32 1
%r.i = getelementptr inbounds %struct.node, ptr %x.031.i, i64 0, i32 2
%x.1.in.i = select i1 %cmp2.i, ptr %l.i, ptr %r.i
%x.0.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.0.i, null
br i1 %cmp.not.i, label %if.else5.i, label %while.body.i, !llvm.loop !12
if.else5.i: ; preds = %while.body.i
store ptr %x.031.i, ptr %call.i, align 8, !tbaa !14
%cmp8.i = icmp sgt i32 %2, %3
%spec.select = select i1 %cmp8.i, ptr %r.i, ptr %l.i
br label %ins.exit
ins.exit: ; preds = %if.then, %if.else5.i
%r10.sink.i = phi ptr [ %spec.select, %if.else5.i ], [ %root, %if.then ]
store ptr %call.i, ptr %r10.sink.i, align 8, !tbaa !5
%.pr = load i8, ptr %arr, align 1, !tbaa !19
br label %if.end
if.end: ; preds = %ins.exit, %for.body
%4 = phi i8 [ %.pr, %ins.exit ], [ %1, %for.body ]
%cmp7 = icmp eq i8 %4, 112
br i1 %cmp7, label %if.then9, label %if.end10
if.then9: ; preds = %if.end
%root.0.root.0.root.0. = load ptr, ptr %root, align 8, !tbaa !5
call void @inorder(ptr noundef %root.0.root.0.root.0.)
%putchar.i = call i32 @putchar(i32 10)
call void @preorder(ptr noundef %root.0.root.0.root.0.)
%putchar3.i = call i32 @putchar(i32 10)
%.pre = load i8, ptr %arr, align 1, !tbaa !19
br label %if.end10
if.end10: ; preds = %if.then9, %if.end
%5 = phi i8 [ %.pre, %if.then9 ], [ %4, %if.end ]
%cmp13 = icmp eq i8 %5, 102
br i1 %cmp13, label %if.then15, label %for.inc
if.then15: ; preds = %if.end10
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %w)
%root.0.root.0.root.0.33 = load ptr, ptr %root, align 8, !tbaa !5
%6 = load i32, ptr %w, align 4, !tbaa !18
%cmp.not11.i = icmp eq ptr %root.0.root.0.root.0.33, null
br i1 %cmp.not11.i, label %for.inc.sink.split, label %land.rhs.i
land.rhs.i: ; preds = %if.then15, %while.body.i29
%root.addr.012.i = phi ptr [ %root.addr.1.i, %while.body.i29 ], [ %root.0.root.0.root.0.33, %if.then15 ]
%w1.i28 = getelementptr inbounds %struct.node, ptr %root.addr.012.i, i64 0, i32 3
%7 = load i32, ptr %w1.i28, align 8, !tbaa !9
%cmp2.not.i = icmp eq i32 %7, %6
br i1 %cmp2.not.i, label %for.inc.sink.split, label %while.body.i29
while.body.i29: ; preds = %land.rhs.i
%cmp4.i = icmp sgt i32 %7, %6
%l.i30 = getelementptr inbounds %struct.node, ptr %root.addr.012.i, i64 0, i32 1
%r.i31 = getelementptr inbounds %struct.node, ptr %root.addr.012.i, i64 0, i32 2
%root.addr.1.in.i = select i1 %cmp4.i, ptr %l.i30, ptr %r.i31
%root.addr.1.i = load ptr, ptr %root.addr.1.in.i, align 8, !tbaa !5
%cmp.not.i32 = icmp eq ptr %root.addr.1.i, null
br i1 %cmp.not.i32, label %for.inc.sink.split, label %land.rhs.i, !llvm.loop !15
for.inc.sink.split: ; preds = %while.body.i29, %land.rhs.i, %if.then15
%str.sink = phi ptr [ @str, %if.then15 ], [ @str.6, %land.rhs.i ], [ @str, %while.body.i29 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %if.end10
%inc = add nuw nsw i32 %i.037, 1
%8 = load i32, ptr %n, align 4, !tbaa !18
%cmp = icmp slt i32 %inc, %8
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !20
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %arr) #10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #10
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %root)
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 @putchar(i32 noundef) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8
attributes #0 = { mustprogress nofree nounwind willreturn memory(write, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = { nofree nounwind }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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, !11, i64 24}
!10 = !{!"node", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 0}
!15 = distinct !{!15, !13}
!16 = !{!10, !6, i64 8}
!17 = !{!10, !6, i64 16}
!18 = !{!11, !11, i64 0}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !13}
|
#include <stdio.h>
#include <math.h>
int main()
{
long long int n,i;
scanf("%I64d",&n);
double num=-0.5+sqrt(2*n+0.25);
long long int temp=(int)num;
long long int rem=n-(temp*(temp+1)/2);
if(rem==0)
{
printf("%I64d",temp);
}
else
{
/*int sum=0;
for(i=1;i<=temp+1;i++)
{
sum=sum+i;
if(sum>=rem)
{
printf("%I64d",i);
break;
}
}
*/
printf("%d",rem);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22095/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22095/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%mul = shl nsw i64 %0, 1
%conv = sitofp i64 %mul to double
%add = fadd double %conv, 2.500000e-01
%call1 = call double @sqrt(double noundef %add) #4
%add2 = fadd double %call1, -5.000000e-01
%conv3 = fptosi double %add2 to i32
%conv4 = sext i32 %conv3 to i64
%1 = load i64, ptr %n, align 8, !tbaa !5
%add5 = add nsw i64 %conv4, 1
%mul6 = mul nsw i64 %add5, %conv4
%div.neg = sdiv i64 %mul6, -2
%sub = add i64 %div.neg, %1
%cmp = icmp eq i64 %sub, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %conv4)
br label %if.end
if.else: ; preds = %entry
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
long long int ab(long long int a, long long int b)
{
if(a>b) return a-b;
return b-a;
}
int main()
{
int t;
scanf("%d", &t);
while(t--)
{
int n;
scanf("%d", &n);
long long int a=0,b=0;
for(int i=1;i<=n;i++)
{
if(i >= n/2 && i <n) a += 1<<i;
else b += 1<<i;
}
printf("%lld\n",ab(a,b));
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2210/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2210/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @ab(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub = sub nsw i64 %a, %b
%retval.0 = tail call i64 @llvm.abs.i64(i64 %sub, i1 true)
ret i64 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec21 = add nsw i32 %0, -1
store i32 %dec21, ptr %t, align 4, !tbaa !5
%tobool.not22 = icmp eq i32 %0, 0
br i1 %tobool.not22, label %while.end, label %while.body
while.body: ; preds = %entry, %for.cond.cleanup
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not16 = icmp slt i32 %1, 1
br i1 %cmp.not16, label %for.cond.cleanup, label %for.body.lr.ph
for.body.lr.ph: ; preds = %while.body
%div2324 = lshr i32 %1, 1
%xtraiter = and i32 %1, 1
%2 = icmp eq i32 %1, 1
br i1 %2, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %1, -2
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%a.1.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %a.1.1, %for.body ]
%b.1.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %b.1.1, %for.body ]
%i.019.unr = phi i32 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%b.018.unr = phi i64 [ 0, %for.body.lr.ph ], [ %b.1.1, %for.body ]
%a.017.unr = phi i64 [ 0, %for.body.lr.ph ], [ %a.1.1, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup.loopexit, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa
%cmp2.not.epil = icmp sge i32 %i.019.unr, %div2324
%cmp3.epil = icmp slt i32 %i.019.unr, %1
%or.cond.epil = and i1 %cmp3.epil, %cmp2.not.epil
%shl.epil = shl nuw i32 1, %i.019.unr
%conv.epil = sext i32 %shl.epil to i64
%add.epil = select i1 %or.cond.epil, i64 %conv.epil, i64 0
%a.1.epil = add nsw i64 %a.017.unr, %add.epil
%add6.epil = select i1 %or.cond.epil, i64 0, i64 %conv.epil
%b.1.epil = add nsw i64 %b.018.unr, %add6.epil
br label %for.cond.cleanup.loopexit
for.cond.cleanup.loopexit: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%a.1.lcssa = phi i64 [ %a.1.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %a.1.epil, %for.body.epil ]
%b.1.lcssa = phi i64 [ %b.1.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %b.1.epil, %for.body.epil ]
%3 = sub nsw i64 %a.1.lcssa, %b.1.lcssa
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %while.body
%sub.i = phi i64 [ 0, %while.body ], [ %3, %for.cond.cleanup.loopexit ]
%retval.0.i = call i64 @llvm.abs.i64(i64 %sub.i, i1 true)
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %retval.0.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
%4 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
for.body: ; preds = %for.body, %for.body.lr.ph.new
%i.019 = phi i32 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%b.018 = phi i64 [ 0, %for.body.lr.ph.new ], [ %b.1.1, %for.body ]
%a.017 = phi i64 [ 0, %for.body.lr.ph.new ], [ %a.1.1, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%cmp2.not = icmp sge i32 %i.019, %div2324
%cmp3 = icmp slt i32 %i.019, %1
%or.cond = and i1 %cmp3, %cmp2.not
%shl = shl nuw i32 1, %i.019
%conv = sext i32 %shl to i64
%add = select i1 %or.cond, i64 %conv, i64 0
%a.1 = add nsw i64 %a.017, %add
%add6 = select i1 %or.cond, i64 0, i64 %conv
%b.1 = add nsw i64 %b.018, %add6
%inc = add nuw i32 %i.019, 1
%cmp2.not.1 = icmp sge i32 %inc, %div2324
%cmp3.1 = icmp slt i32 %inc, %1
%or.cond.1 = and i1 %cmp3.1, %cmp2.not.1
%shl.1 = shl i32 2, %i.019
%conv.1 = sext i32 %shl.1 to i64
%add.1 = select i1 %or.cond.1, i64 %conv.1, i64 0
%a.1.1 = add nsw i64 %a.1, %add.1
%add6.1 = select i1 %or.cond.1, i64 0, i64 %conv.1
%b.1.1 = add nsw i64 %b.1, %add6.1
%inc.1 = add nuw i32 %i.019, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !11
while.end: ; preds = %for.cond.cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
struct node{
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node * Node;
#define NIL NULL
Node root;
void insert(int k){
Node y = NIL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->left = NIL;
z->right = NIL;
while (x != NIL){
y = x;
if (z->key < x->key)
x = x->left;
else
x = x->right;
}
z->parent = y;
if (y == NIL)
root = z;
else if (z->key < y->key)
y->left = z;
else
y->right = z;
}
void inorder(Node u){
if (u == NIL)
return;
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
void preorder(Node u){
if (u == NIL)
return;
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
Node treeSearch(Node u, int k){
if (u == NIL || k == u->key)
return u;
if (k < u->key)
return treeSearch(u->left,k);
else
return treeSearch(u->right,k);
}
int main(){
int n, i, x;
char com[20];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s", com);
if ( com[0] == 'f' ){
scanf("%d", &x);
Node t = treeSearch(root, x);
if ( t != NIL ) printf("yes\n");
else printf("no\n");
} else if ( com[0] == 'i' ){
scanf("%d", &x);
insert(x);
} else if ( com[0] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221042/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221042/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.6 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !9
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%1 = load i32, ptr %key2, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %parent37, align 8, !tbaa !14
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.035, ptr %parent, align 8, !tbaa !14
%key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%2 = load i32, ptr %key10, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %2, %k
%left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %left13, ptr %x.035
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @inorder(ptr noundef %0)
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeSearch(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #4 {
entry:
%cmp14 = icmp eq ptr %u, null
br i1 %cmp14, label %return, label %lor.lhs.false
lor.lhs.false: ; preds = %entry, %if.end
%u.tr15 = phi ptr [ %u.tr.be, %if.end ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.tr15, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !9
%cmp1 = icmp eq i32 %0, %k
br i1 %cmp1, label %return, label %if.end
if.end: ; preds = %lor.lhs.false
%cmp3 = icmp sgt i32 %0, %k
%left = getelementptr inbounds %struct.node, ptr %u.tr15, i64 0, i32 1
%spec.select = select i1 %cmp3, ptr %left, ptr %u.tr15
%u.tr.be = load ptr, ptr %spec.select, align 8, !tbaa !5
%cmp = icmp eq ptr %u.tr.be, null
br i1 %cmp, label %return, label %lor.lhs.false
return: ; preds = %lor.lhs.false, %if.end, %entry
%retval.0 = phi ptr [ null, %entry ], [ null, %if.end ], [ %u.tr15, %lor.lhs.false ]
ret ptr %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 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 %x) #8
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.038 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !18
switch i8 %1, label %for.inc [
i8 102, label %if.then
i8 105, label %if.then16
i8 112, label %if.then23
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load ptr, ptr @root, align 8, !tbaa !5
%3 = load i32, ptr %x, align 4, !tbaa !17
%cmp14.i = icmp eq ptr %2, null
br i1 %cmp14.i, label %if.else, label %lor.lhs.false.i
lor.lhs.false.i: ; preds = %if.then, %if.end.i
%u.tr15.i = phi ptr [ %u.tr.be.i, %if.end.i ], [ %2, %if.then ]
%key.i = getelementptr inbounds %struct.node, ptr %u.tr15.i, i64 0, i32 3
%4 = load i32, ptr %key.i, align 8, !tbaa !9
%cmp1.i = icmp eq i32 %4, %3
br i1 %cmp1.i, label %if.then8, label %if.end.i
if.end.i: ; preds = %lor.lhs.false.i
%cmp3.i = icmp sgt i32 %4, %3
%left.i = getelementptr inbounds %struct.node, ptr %u.tr15.i, i64 0, i32 1
%spec.select.i = select i1 %cmp3.i, ptr %left.i, ptr %u.tr15.i
%u.tr.be.i = load ptr, ptr %spec.select.i, align 8, !tbaa !5
%cmp.i = icmp eq ptr %u.tr.be.i, null
br i1 %cmp.i, label %if.else, label %lor.lhs.false.i
if.then8: ; preds = %lor.lhs.false.i
%puts31 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
if.else: ; preds = %if.end.i, %if.then
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.then16: ; preds = %for.body
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%5 = load i32, ptr %x, align 4, !tbaa !17
%6 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key.i32 = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %5, ptr %key.i32, align 8, !tbaa !9
%cmp.not34.i = icmp eq ptr %6, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then16, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %6, %if.then16 ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%7 = load i32, ptr %key2.i, align 8, !tbaa !9
%cmp3.i33 = icmp sgt i32 %7, %5
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i33, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12
insert.exit: ; preds = %while.body.i, %if.then16
%.sink = phi ptr [ null, %if.then16 ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then16 ], [ %x.1.in.i, %while.body.i ]
%parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %parent37.i, align 8, !tbaa !14
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.then23: ; preds = %for.body
%8 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %8)
%putchar = call i32 @putchar(i32 10)
%9 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %9)
%putchar30 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %if.then8, %if.else, %if.then23, %insert.exit
%inc = add nuw nsw i32 %i.038, 1
%10 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %10
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 24}
!10 = !{!"node", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !6, i64 0}
!17 = !{!11, !11, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !13}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct tree_t{
int key;
struct tree_t *left;
struct tree_t *right;
}TREE_T;
TREE_T *TREE;
TREE_T *Find(int key)
{
TREE_T *y = NULL;
TREE_T *x = TREE;
while(x != NULL){
if(key == x->key)
return x;
y = x;
if(key < x->key)
x = x->left;
else
x = x->right;
}
return NULL;
}
int Insert(int key)
{
TREE_T *p;
TREE_T *y = NULL;
TREE_T *x = TREE;
if( (p = (TREE_T *)malloc(sizeof(TREE_T))) == NULL){
printf("malloc error\n");
return 0;
}
p->key = key;
p->left = NULL;
p->right = NULL;
while(x != NULL){
y = x;
if(p->key < x->key)
x = x->left;
else
x = x->right;
}
if(y == NULL)
TREE = p;
else if(p->key < y->key)
y->left = p;
else
y->right = p;
return 1;
}
// kind = 0:通りがけ 1:行きがけ
void Walk_tree(TREE_T *p, int kind)
{
if(kind == 1)
printf(" %d", p->key);
if(p->left != NULL)
Walk_tree(p->left, kind);
if(kind == 0)
printf(" %d", p->key);
if(p->right !=NULL)
Walk_tree(p->right, kind);
}
int main()
{
TREE_T *p;
int n;
char command[10];
int key;
int i;
TREE = NULL;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%s", command);
if(!strcmp(command, "insert")){
scanf("%d", &key);
Insert(key);
}else if(!strcmp(command, "print")){
Walk_tree(TREE, 0);
printf("\n");
Walk_tree(TREE, 1);
printf("\n");
}else if(!strcmp(command, "find")){
scanf("%d", &key);
if(Find(key))
printf("yes\n");
else
printf("no\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221086/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221086/source.c"
target datalayout = "e-m:e-p270: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.tree_t = type { i32, ptr, ptr }
@TREE = dso_local local_unnamed_addr global ptr null, align 8
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.4 = private unnamed_addr constant [7 x i8] c"insert\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c"print\00", align 1
@.str.7 = private unnamed_addr constant [5 x i8] c"find\00", align 1
@str = private unnamed_addr constant [13 x i8] c"malloc error\00", align 1
@str.10 = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.11 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @Find(i32 noundef %key) local_unnamed_addr #0 {
entry:
%x.015 = load ptr, ptr @TREE, align 8, !tbaa !5
%cmp.not16 = icmp eq ptr %x.015, null
br i1 %cmp.not16, label %cleanup, label %while.body
while.body: ; preds = %entry, %if.end
%x.017 = phi ptr [ %x.0, %if.end ], [ %x.015, %entry ]
%0 = load i32, ptr %x.017, align 8, !tbaa !9
%cmp2 = icmp eq i32 %0, %key
br i1 %cmp2, label %cleanup, label %if.end
if.end: ; preds = %while.body
%cmp4 = icmp sgt i32 %0, %key
%left = getelementptr inbounds %struct.tree_t, ptr %x.017, i64 0, i32 1
%right = getelementptr inbounds %struct.tree_t, ptr %x.017, i64 0, i32 2
%x.1.in = select i1 %cmp4, ptr %left, ptr %right
%x.0 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.0, null
br i1 %cmp.not, label %cleanup, label %while.body, !llvm.loop !12
cleanup: ; preds = %while.body, %if.end, %entry
%x.0.lcssa = phi ptr [ null, %entry ], [ null, %if.end ], [ %x.017, %while.body ]
ret ptr %x.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @Insert(i32 noundef %key) local_unnamed_addr #2 {
entry:
%0 = load ptr, ptr @TREE, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #8
%cmp = icmp eq ptr %call, null
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
if.end: ; preds = %entry
store i32 %key, ptr %call, align 8, !tbaa !9
%left = getelementptr inbounds %struct.tree_t, ptr %call, i64 0, i32 1
%cmp3.not39 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left, i8 0, i64 16, i1 false)
br i1 %cmp3.not39, label %if.then12, label %while.body
while.body: ; preds = %if.end, %while.body
%x.040 = phi ptr [ %x.1, %while.body ], [ %0, %if.end ]
%1 = load i32, ptr %x.040, align 8, !tbaa !9
%cmp6 = icmp sgt i32 %1, %key
%left8 = getelementptr inbounds %struct.tree_t, ptr %x.040, i64 0, i32 1
%right9 = getelementptr inbounds %struct.tree_t, ptr %x.040, i64 0, i32 2
%x.1.in = select i1 %cmp6, ptr %left8, ptr %right9
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp3.not = icmp eq ptr %x.1, null
br i1 %cmp3.not, label %if.else13, label %while.body, !llvm.loop !14
if.then12: ; preds = %if.end
store ptr %call, ptr @TREE, align 8, !tbaa !5
br label %cleanup
if.else13: ; preds = %while.body
%2 = load i32, ptr %x.040, align 8, !tbaa !9
%cmp16 = icmp sgt i32 %2, %key
br i1 %cmp16, label %if.then17, label %if.else19
if.then17: ; preds = %if.else13
%left18 = getelementptr inbounds %struct.tree_t, ptr %x.040, i64 0, i32 1
store ptr %call, ptr %left18, align 8, !tbaa !15
br label %cleanup
if.else19: ; preds = %if.else13
%right20 = getelementptr inbounds %struct.tree_t, ptr %x.040, i64 0, i32 2
store ptr %call, ptr %right20, align 8, !tbaa !16
br label %cleanup
cleanup: ; preds = %if.then12, %if.else19, %if.then17, %if.then
%retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.then17 ], [ 1, %if.else19 ], [ 1, %if.then12 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local void @Walk_tree(ptr nocapture noundef readonly %p, i32 noundef %kind) local_unnamed_addr #2 {
entry:
switch i32 %kind, label %tailrecurse [
i32 1, label %tailrecurse.us
i32 0, label %tailrecurse.us23
]
tailrecurse.us: ; preds = %entry, %if.end4.us
%p.tr.us = phi ptr [ %2, %if.end4.us ], [ %p, %entry ]
%0 = load i32, ptr %p.tr.us, align 8, !tbaa !9
%call.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%left.us = getelementptr inbounds %struct.tree_t, ptr %p.tr.us, i64 0, i32 1
%1 = load ptr, ptr %left.us, align 8, !tbaa !15
%cmp1.not.us = icmp eq ptr %1, null
br i1 %cmp1.not.us, label %if.end4.us, label %if.then2.us
if.then2.us: ; preds = %tailrecurse.us
tail call void @Walk_tree(ptr noundef nonnull %1, i32 noundef 1)
br label %if.end4.us
if.end4.us: ; preds = %if.then2.us, %tailrecurse.us
%right.us = getelementptr inbounds %struct.tree_t, ptr %p.tr.us, i64 0, i32 2
%2 = load ptr, ptr %right.us, align 8, !tbaa !16
%cmp10.not.us = icmp eq ptr %2, null
br i1 %cmp10.not.us, label %if.end13, label %tailrecurse.us
tailrecurse.us23: ; preds = %entry, %if.end4.us28
%p.tr.us24 = phi ptr [ %5, %if.end4.us28 ], [ %p, %entry ]
%left.us25 = getelementptr inbounds %struct.tree_t, ptr %p.tr.us24, i64 0, i32 1
%3 = load ptr, ptr %left.us25, align 8, !tbaa !15
%cmp1.not.us26 = icmp eq ptr %3, null
br i1 %cmp1.not.us26, label %if.end4.us28, label %if.then2.us27
if.then2.us27: ; preds = %tailrecurse.us23
tail call void @Walk_tree(ptr noundef nonnull %3, i32 noundef 0)
br label %if.end4.us28
if.end4.us28: ; preds = %if.then2.us27, %tailrecurse.us23
%4 = load i32, ptr %p.tr.us24, align 8, !tbaa !9
%call8.us30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%right.us32 = getelementptr inbounds %struct.tree_t, ptr %p.tr.us24, i64 0, i32 2
%5 = load ptr, ptr %right.us32, align 8, !tbaa !16
%cmp10.not.us33 = icmp eq ptr %5, null
br i1 %cmp10.not.us33, label %if.end13, label %tailrecurse.us23
tailrecurse: ; preds = %entry, %if.end4
%p.tr = phi ptr [ %7, %if.end4 ], [ %p, %entry ]
%left = getelementptr inbounds %struct.tree_t, ptr %p.tr, i64 0, i32 1
%6 = load ptr, ptr %left, align 8, !tbaa !15
%cmp1.not = icmp eq ptr %6, null
br i1 %cmp1.not, label %if.end4, label %if.then2
if.then2: ; preds = %tailrecurse
tail call void @Walk_tree(ptr noundef nonnull %6, i32 noundef %kind)
br label %if.end4
if.end4: ; preds = %if.then2, %tailrecurse
%right = getelementptr inbounds %struct.tree_t, ptr %p.tr, i64 0, i32 2
%7 = load ptr, ptr %right, align 8, !tbaa !16
%cmp10.not = icmp eq ptr %7, null
br i1 %cmp10.not, label %if.end13, label %tailrecurse
if.end13: ; preds = %if.end4.us28, %if.end4.us, %if.end4
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%command = alloca [10 x i8], align 1
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %command) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #9
store ptr null, ptr @TREE, align 8, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp38 = icmp sgt i32 %0, 0
br i1 %cmp38, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.039 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %command)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %command, ptr noundef nonnull dereferenceable(7) @.str.4, i64 7)
%tobool.not = icmp eq i32 %bcmp, 0
br i1 %tobool.not, label %if.then, label %if.else
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %key)
%1 = load i32, ptr %key, align 4, !tbaa !17
%2 = load ptr, ptr @TREE, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #8
%cmp.i = icmp eq ptr %call.i, null
br i1 %cmp.i, label %if.then.i, label %if.end.i
if.then.i: ; preds = %if.then
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.end.i: ; preds = %if.then
store i32 %1, ptr %call.i, align 8, !tbaa !9
%left.i = getelementptr inbounds %struct.tree_t, ptr %call.i, i64 0, i32 1
%cmp3.not39.i = icmp eq ptr %2, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left.i, i8 0, i64 16, i1 false)
br i1 %cmp3.not39.i, label %if.then12.i, label %while.body.i
while.body.i: ; preds = %if.end.i, %while.body.i
%x.040.i = phi ptr [ %x.1.i, %while.body.i ], [ %2, %if.end.i ]
%3 = load i32, ptr %x.040.i, align 8, !tbaa !9
%cmp6.i = icmp sgt i32 %3, %1
%left8.i = getelementptr inbounds %struct.tree_t, ptr %x.040.i, i64 0, i32 1
%right9.i = getelementptr inbounds %struct.tree_t, ptr %x.040.i, i64 0, i32 2
%x.1.in.i = select i1 %cmp6.i, ptr %left8.i, ptr %right9.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp3.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp3.not.i, label %if.else13.i, label %while.body.i, !llvm.loop !14
if.then12.i: ; preds = %if.end.i
store ptr %call.i, ptr @TREE, align 8, !tbaa !5
br label %for.inc
if.else13.i: ; preds = %while.body.i
br i1 %cmp6.i, label %if.then17.i, label %if.else19.i
if.then17.i: ; preds = %if.else13.i
store ptr %call.i, ptr %left8.i, align 8, !tbaa !15
br label %for.inc
if.else19.i: ; preds = %if.else13.i
store ptr %call.i, ptr %right9.i, align 8, !tbaa !16
br label %for.inc
if.else: ; preds = %for.body
%bcmp28 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %command, ptr noundef nonnull dereferenceable(6) @.str.5, i64 6)
%tobool8.not = icmp eq i32 %bcmp28, 0
br i1 %tobool8.not, label %if.then9, label %if.else12
if.then9: ; preds = %if.else
%4 = load ptr, ptr @TREE, align 8, !tbaa !5
call void @Walk_tree(ptr noundef %4, i32 noundef 0)
%putchar = call i32 @putchar(i32 10)
%5 = load ptr, ptr @TREE, align 8, !tbaa !5
call void @Walk_tree(ptr noundef %5, i32 noundef 1)
%putchar29 = call i32 @putchar(i32 10)
br label %for.inc
if.else12: ; preds = %if.else
%bcmp30 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %command, ptr noundef nonnull dereferenceable(5) @.str.7, i64 5)
%tobool15.not = icmp eq i32 %bcmp30, 0
br i1 %tobool15.not, label %if.then16, label %for.inc
if.then16: ; preds = %if.else12
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %key)
%6 = load i32, ptr %key, align 4, !tbaa !17
%x.015.i = load ptr, ptr @TREE, align 8, !tbaa !5
%cmp.not16.i = icmp eq ptr %x.015.i, null
br i1 %cmp.not16.i, label %if.else22, label %while.body.i32
while.body.i32: ; preds = %if.then16, %if.end.i33
%x.017.i = phi ptr [ %x.0.i, %if.end.i33 ], [ %x.015.i, %if.then16 ]
%7 = load i32, ptr %x.017.i, align 8, !tbaa !9
%cmp2.i = icmp eq i32 %7, %6
br i1 %cmp2.i, label %if.then20, label %if.end.i33
if.end.i33: ; preds = %while.body.i32
%cmp4.i = icmp sgt i32 %7, %6
%left.i34 = getelementptr inbounds %struct.tree_t, ptr %x.017.i, i64 0, i32 1
%right.i = getelementptr inbounds %struct.tree_t, ptr %x.017.i, i64 0, i32 2
%x.1.in.i35 = select i1 %cmp4.i, ptr %left.i34, ptr %right.i
%x.0.i = load ptr, ptr %x.1.in.i35, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.0.i, null
br i1 %cmp.not.i, label %if.else22, label %while.body.i32, !llvm.loop !12
if.then20: ; preds = %while.body.i32
%puts31 = call i32 @puts(ptr nonnull dereferenceable(1) @str.11)
br label %for.inc
if.else22: ; preds = %if.end.i33, %if.then16
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
br label %for.inc
for.inc: ; preds = %if.else19.i, %if.then17.i, %if.then12.i, %if.then.i, %if.else12, %if.else22, %if.then20, %if.then9
%inc = add nuw nsw i32 %i.039, 1
%8 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %8
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !18
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #9
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %command) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
attributes #0 = { 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 #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 = { 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 "no-trapping-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 = { nofree nounwind willreturn memory(argmem: read) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"tree_t", !11, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !6, i64 16}
!17 = !{!11, !11, i64 0}
!18 = distinct !{!18, !13}
|
#include<stdio.h>
#include<stdlib.h>
struct node{
struct node *r;
struct node *l;
struct node *p;
int key;
};
typedef struct node * Node;
#define NIL NULL
Node root;
Node treeSearch(Node u,int k){
if(u == NIL || k == u->key) return u;
if(k < u->key) return treeSearch(u->l,k);
else return treeSearch(u->r,k);
}
void insert(int k){
Node y = NIL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->l = NIL;
z->r = NIL;
while(x != NIL){
y=x;
if(z->key < x->key){
x=x->l;
}
else {
x=x->r;
}
}
z->p = y;
if(y == NIL){
root = z;
}
else {
if(z->key < y->key){
y->l = z;
}
else {
y->r = z;
}
}
}
void inorder(Node u){
if(u != NIL){
inorder(u->l);
printf(" %d",u->key);
inorder(u->r);
}
}
void preorder(Node u){
if(u != NIL){
printf(" %d",u->key);
preorder(u->l);
preorder(u->r);
}
}
int main(){
int n,i,x;
char com[20];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",com);
if(com[0] == 'f'){
scanf("%d",&x);
Node t = treeSearch(root, x);
if(t != NIL) printf("yes\n");
else printf("no\n");
}
else if(com[0] == 'i'){
scanf("%d",&x);
insert(x);
}
else if(com[0] == 'p'){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221143/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221143/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.6 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeSearch(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #0 {
entry:
%cmp14 = icmp eq ptr %u, null
br i1 %cmp14, label %return, label %lor.lhs.false
lor.lhs.false: ; preds = %entry, %if.end
%u.tr15 = phi ptr [ %u.tr.be, %if.end ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.tr15, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !5
%cmp1 = icmp eq i32 %0, %k
br i1 %cmp1, label %return, label %if.end
if.end: ; preds = %lor.lhs.false
%cmp3 = icmp sgt i32 %0, %k
%l = getelementptr inbounds %struct.node, ptr %u.tr15, i64 0, i32 1
%spec.select = select i1 %cmp3, ptr %l, ptr %u.tr15
%u.tr.be = load ptr, ptr %spec.select, align 8, !tbaa !11
%cmp = icmp eq ptr %u.tr.be, null
br i1 %cmp, label %return, label %lor.lhs.false
return: ; preds = %lor.lhs.false, %if.end, %entry
%retval.0 = phi ptr [ null, %entry ], [ null, %if.end ], [ %u.tr15, %lor.lhs.false ]
ret ptr %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !11
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !5
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%1 = load i32, ptr %key2, align 8, !tbaa !5
%cmp3 = icmp sgt i32 %1, %k
%l4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %l4, ptr %x.035
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !11
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12
if.then7: ; preds = %entry
%p37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %p37, align 8, !tbaa !14
br label %if.end17
if.else8: ; preds = %while.body
%p = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.035, ptr %p, align 8, !tbaa !14
%key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%2 = load i32, ptr %key10, align 8, !tbaa !5
%cmp11 = icmp sgt i32 %2, %k
%l13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %l13, ptr %x.035
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%l13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %l13.sink, align 8, !tbaa !11
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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) #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #1 {
entry:
%cmp.not4 = icmp eq ptr %u, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr5 = phi ptr [ %2, %if.then ], [ %u, %entry ]
%l = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%0 = load ptr, ptr %l, align 8, !tbaa !15
tail call void @inorder(ptr noundef %0)
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !16
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #1 {
entry:
%cmp.not4 = icmp eq ptr %u, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr5 = phi ptr [ %2, %if.then ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%l = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%1 = load ptr, ptr %l, align 8, !tbaa !15
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !16
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 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 %x) #8
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.038 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !18
switch i8 %1, label %for.inc [
i8 102, label %if.then
i8 105, label %if.then16
i8 112, label %if.then23
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load ptr, ptr @root, align 8, !tbaa !11
%3 = load i32, ptr %x, align 4, !tbaa !17
%cmp14.i = icmp eq ptr %2, null
br i1 %cmp14.i, label %if.else, label %lor.lhs.false.i
lor.lhs.false.i: ; preds = %if.then, %if.end.i
%u.tr15.i = phi ptr [ %u.tr.be.i, %if.end.i ], [ %2, %if.then ]
%key.i = getelementptr inbounds %struct.node, ptr %u.tr15.i, i64 0, i32 3
%4 = load i32, ptr %key.i, align 8, !tbaa !5
%cmp1.i = icmp eq i32 %4, %3
br i1 %cmp1.i, label %if.then8, label %if.end.i
if.end.i: ; preds = %lor.lhs.false.i
%cmp3.i = icmp sgt i32 %4, %3
%l.i = getelementptr inbounds %struct.node, ptr %u.tr15.i, i64 0, i32 1
%spec.select.i = select i1 %cmp3.i, ptr %l.i, ptr %u.tr15.i
%u.tr.be.i = load ptr, ptr %spec.select.i, align 8, !tbaa !11
%cmp.i = icmp eq ptr %u.tr.be.i, null
br i1 %cmp.i, label %if.else, label %lor.lhs.false.i
if.then8: ; preds = %lor.lhs.false.i
%puts31 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
if.else: ; preds = %if.end.i, %if.then
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.then16: ; preds = %for.body
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%5 = load i32, ptr %x, align 4, !tbaa !17
%6 = load ptr, ptr @root, align 8, !tbaa !11
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key.i32 = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %5, ptr %key.i32, align 8, !tbaa !5
%cmp.not34.i = icmp eq ptr %6, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then16, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %6, %if.then16 ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%7 = load i32, ptr %key2.i, align 8, !tbaa !5
%cmp3.i33 = icmp sgt i32 %7, %5
%l4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i33, ptr %l4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !11
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12
insert.exit: ; preds = %while.body.i, %if.then16
%.sink = phi ptr [ null, %if.then16 ], [ %x.035.i, %while.body.i ]
%l13.sink.i = phi ptr [ @root, %if.then16 ], [ %x.1.in.i, %while.body.i ]
%p37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %p37.i, align 8, !tbaa !14
store ptr %call.i, ptr %l13.sink.i, align 8, !tbaa !11
br label %for.inc
if.then23: ; preds = %for.body
%8 = load ptr, ptr @root, align 8, !tbaa !11
call void @inorder(ptr noundef %8)
%putchar = call i32 @putchar(i32 10)
%9 = load ptr, ptr @root, align 8, !tbaa !11
call void @preorder(ptr noundef %9)
%putchar30 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %if.then8, %if.else, %if.then23, %insert.exit
%inc = add nuw nsw i32 %i.038, 1
%10 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %10
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
attributes #0 = { 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 #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress 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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind allocsize(0) }
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, !10, i64 24}
!6 = !{!"node", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!6, !7, i64 16}
!15 = !{!6, !7, i64 8}
!16 = !{!6, !7, i64 0}
!17 = !{!10, !10, i64 0}
!18 = !{!8, !8, i64 0}
!19 = distinct !{!19, !13}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct Node{
int k;
struct Node *right;
struct Node *left;
struct Node *parent;
};
struct Node *root, *NIL;
void Insert(int);
void Inorder(struct Node *);
void Preorder(struct Node *);
struct Node * Find(struct Node *, int);
int main(){
int str1 = 0, str2 = 0, str3 = 0;
int i,n,value,findnum;
char C1[10], C2[10]="insert", C3[10]="print",C4[10]="find";
scanf("%d",&n);
for(i = 0 ; i < n ; i++){
scanf("%s",C1);
if(strcmp(C1,C2) == 0) str1 = 1;
if(strcmp(C1,C3) == 0) str2 = 1;
if(strcmp(C1,C4) == 0) str3 = 1;
if(str1 == 1){
scanf("%d",&value);
Insert(value);
str1 = 0;
}
else if(str2 == 1){
str2 = 0;
Inorder(root);
printf("\n");
Preorder(root);
printf("\n");
}
else if(str3 == 1){
str3 = 0;
scanf("%d",&findnum);
struct Node *F = Find(root,findnum);
if(F != NIL) printf("yes\n");
else printf("no\n");
}
}
return 0;
}
void Insert(int n){
struct Node *p = root;
struct Node *q = NIL;
struct Node *r;
r = (struct Node *)malloc(sizeof(struct Node));
r -> k = n;
r -> left = NIL;
r -> right = NIL;
while(p != NIL){
q = p;
if(r->k < p->k){
p = p -> left;
}
else{
p = p -> right;
}
}
r -> parent = q;
if(q == NIL){
root = r;
}
else{
if(r->k < q->k){
q -> left = r;
}
else{
q -> right = r;
}
}
}
void Inorder(struct Node *x){
if(x == NIL) return;
Inorder(x -> left);
printf(" %d",x -> k);
Inorder(x -> right);
}
void Preorder(struct Node *x){
if(x == NIL) return;
printf(" %d",x -> k);
Preorder(x -> left);
Preorder(x -> right);
}
struct Node * Find(struct Node *x, int n){
while(x != NIL && n != x -> k){
if(n < x -> k ) x = x -> left;
else x = x -> right;
}
return x;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221187/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221187/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, ptr, ptr, ptr }
@__const.main.C2 = private unnamed_addr constant [10 x i8] c"insert\00\00\00\00", align 1
@__const.main.C3 = private unnamed_addr constant [10 x i8] c"print\00\00\00\00\00", align 1
@__const.main.C4 = private unnamed_addr constant [10 x i8] c"find\00\00\00\00\00\00", align 1
@.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
@root = dso_local local_unnamed_addr global ptr null, align 8
@NIL = dso_local local_unnamed_addr global ptr null, align 8
@.str.5 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.6 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%value = alloca i32, align 4
%findnum = alloca i32, align 4
%C1 = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %value) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %findnum) #7
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %C1) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp53 = icmp sgt i32 %0, 0
br i1 %cmp53, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.056 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%str3.055 = phi i32 [ %str3.2, %for.inc ], [ 0, %entry ]
%str2.054 = phi i32 [ %str2.2, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %C1)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %C1, ptr noundef nonnull dereferenceable(7) @__const.main.C2, i64 7)
%cmp5 = icmp eq i32 %bcmp, 0
%bcmp40 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %C1, ptr noundef nonnull dereferenceable(6) @__const.main.C3, i64 6)
%cmp9 = icmp eq i32 %bcmp40, 0
%str2.1 = select i1 %cmp9, i32 1, i32 %str2.054
%bcmp41 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %C1, ptr noundef nonnull dereferenceable(5) @__const.main.C4, i64 5)
%cmp15 = icmp eq i32 %bcmp41, 0
%str3.1 = select i1 %cmp15, i32 1, i32 %str3.055
br i1 %cmp5, label %if.then19, label %if.else
if.then19: ; preds = %for.body
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %value)
%1 = load i32, ptr %value, align 4, !tbaa !5
%2 = load ptr, ptr @root, align 8, !tbaa !9
%3 = load ptr, ptr @NIL, align 8, !tbaa !9
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8
store i32 %1, ptr %call.i, align 8, !tbaa !11
%left.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 2
store ptr %3, ptr %left.i, align 8, !tbaa !13
%right.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1
store ptr %3, ptr %right.i, align 8, !tbaa !14
%cmp.not34.i = icmp eq ptr %2, %3
br i1 %cmp.not34.i, label %while.end.i, label %while.body.i
while.body.i: ; preds = %if.then19, %while.body.i
%p.035.i = phi ptr [ %p.1.i, %while.body.i ], [ %2, %if.then19 ]
%4 = load i32, ptr %p.035.i, align 8, !tbaa !11
%cmp3.i = icmp sgt i32 %4, %1
%left4.i = getelementptr inbounds %struct.Node, ptr %p.035.i, i64 0, i32 2
%right5.i = getelementptr inbounds %struct.Node, ptr %p.035.i, i64 0, i32 1
%p.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %right5.i
%p.1.i = load ptr, ptr %p.1.in.i, align 8, !tbaa !9
%cmp.not.i = icmp eq ptr %p.1.i, %3
br i1 %cmp.not.i, label %while.end.i, label %while.body.i, !llvm.loop !15
while.end.i: ; preds = %while.body.i, %if.then19
%q.0.lcssa.i = phi ptr [ %2, %if.then19 ], [ %p.035.i, %while.body.i ]
%parent.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %q.0.lcssa.i, ptr %parent.i, align 8, !tbaa !17
%cmp6.i = icmp eq ptr %q.0.lcssa.i, %3
br i1 %cmp6.i, label %Insert.exit, label %if.else8.i
if.else8.i: ; preds = %while.end.i
%5 = load i32, ptr %q.0.lcssa.i, align 8, !tbaa !11
%cmp11.i = icmp sgt i32 %5, %1
br i1 %cmp11.i, label %if.then12.i, label %if.else14.i
if.then12.i: ; preds = %if.else8.i
%left13.i = getelementptr inbounds %struct.Node, ptr %q.0.lcssa.i, i64 0, i32 2
br label %Insert.exit
if.else14.i: ; preds = %if.else8.i
%right15.i = getelementptr inbounds %struct.Node, ptr %q.0.lcssa.i, i64 0, i32 1
br label %Insert.exit
Insert.exit: ; preds = %while.end.i, %if.then12.i, %if.else14.i
%left13.sink.i = phi ptr [ %left13.i, %if.then12.i ], [ %right15.i, %if.else14.i ], [ @root, %while.end.i ]
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !9
br label %for.inc
if.else: ; preds = %for.body
%cmp21 = icmp eq i32 %str2.1, 1
br i1 %cmp21, label %if.then22, label %if.else25
if.then22: ; preds = %if.else
%6 = load ptr, ptr @root, align 8, !tbaa !9
call void @Inorder(ptr noundef %6)
%putchar = call i32 @putchar(i32 10)
%7 = load ptr, ptr @root, align 8, !tbaa !9
call void @Preorder(ptr noundef %7)
%putchar43 = call i32 @putchar(i32 10)
br label %for.inc
if.else25: ; preds = %if.else
%cmp26 = icmp eq i32 %str3.1, 1
br i1 %cmp26, label %if.then27, label %for.inc
if.then27: ; preds = %if.else25
%call28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %findnum)
%8 = load ptr, ptr @root, align 8, !tbaa !9
%9 = load i32, ptr %findnum, align 4, !tbaa !5
%10 = load ptr, ptr @NIL, align 8, !tbaa !9
%cmp.not10.i = icmp eq ptr %10, %8
br i1 %cmp.not10.i, label %Find.exit, label %land.rhs.i
land.rhs.i: ; preds = %if.then27, %while.body.i44
%x.addr.011.i = phi ptr [ %x.addr.1.i, %while.body.i44 ], [ %8, %if.then27 ]
%11 = load i32, ptr %x.addr.011.i, align 8, !tbaa !11
%cmp1.not.i = icmp eq i32 %11, %9
br i1 %cmp1.not.i, label %Find.exit, label %while.body.i44
while.body.i44: ; preds = %land.rhs.i
%cmp3.i45 = icmp sgt i32 %11, %9
%left.i46 = getelementptr inbounds %struct.Node, ptr %x.addr.011.i, i64 0, i32 2
%right.i47 = getelementptr inbounds %struct.Node, ptr %x.addr.011.i, i64 0, i32 1
%x.addr.1.in.i = select i1 %cmp3.i45, ptr %left.i46, ptr %right.i47
%x.addr.1.i = load ptr, ptr %x.addr.1.in.i, align 8, !tbaa !9
%cmp.not.i48 = icmp eq ptr %x.addr.1.i, %10
br i1 %cmp.not.i48, label %if.else33, label %land.rhs.i, !llvm.loop !18
Find.exit: ; preds = %land.rhs.i, %if.then27
%x.addr.0.lcssa.i = phi ptr [ %8, %if.then27 ], [ %x.addr.011.i, %land.rhs.i ]
%cmp30.not = icmp eq ptr %x.addr.0.lcssa.i, %10
br i1 %cmp30.not, label %if.else33, label %if.then31
if.then31: ; preds = %Find.exit
%puts42 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
if.else33: ; preds = %while.body.i44, %Find.exit
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
for.inc: ; preds = %if.then31, %if.else33, %Insert.exit, %if.else25, %if.then22
%str2.2 = phi i32 [ %str2.1, %Insert.exit ], [ 0, %if.then22 ], [ 0, %if.else25 ], [ 0, %if.else33 ], [ 0, %if.then31 ]
%str3.2 = phi i32 [ %str3.1, %Insert.exit ], [ %str3.1, %if.then22 ], [ 0, %if.else25 ], [ 0, %if.else33 ], [ 0, %if.then31 ]
%inc = add nuw nsw i32 %i.056, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %12
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %C1) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %findnum) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %value) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @Insert(i32 noundef %n) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !9
%1 = load ptr, ptr @NIL, align 8, !tbaa !9
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #8
store i32 %n, ptr %call, align 8, !tbaa !11
%left = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 2
store ptr %1, ptr %left, align 8, !tbaa !13
%right = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1
store ptr %1, ptr %right, align 8, !tbaa !14
%cmp.not34 = icmp eq ptr %0, %1
br i1 %cmp.not34, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%p.035 = phi ptr [ %p.1, %while.body ], [ %0, %entry ]
%2 = load i32, ptr %p.035, align 8, !tbaa !11
%cmp3 = icmp sgt i32 %2, %n
%left4 = getelementptr inbounds %struct.Node, ptr %p.035, i64 0, i32 2
%right5 = getelementptr inbounds %struct.Node, ptr %p.035, i64 0, i32 1
%p.1.in = select i1 %cmp3, ptr %left4, ptr %right5
%p.1 = load ptr, ptr %p.1.in, align 8, !tbaa !9
%cmp.not = icmp eq ptr %p.1, %1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %while.body, %entry
%q.0.lcssa = phi ptr [ %0, %entry ], [ %p.035, %while.body ]
%parent = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %q.0.lcssa, ptr %parent, align 8, !tbaa !17
%cmp6 = icmp eq ptr %q.0.lcssa, %1
br i1 %cmp6, label %if.end17, label %if.else8
if.else8: ; preds = %while.end
%3 = load i32, ptr %q.0.lcssa, align 8, !tbaa !11
%cmp11 = icmp sgt i32 %3, %n
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else8
%left13 = getelementptr inbounds %struct.Node, ptr %q.0.lcssa, i64 0, i32 2
br label %if.end17
if.else14: ; preds = %if.else8
%right15 = getelementptr inbounds %struct.Node, ptr %q.0.lcssa, i64 0, i32 1
br label %if.end17
if.end17: ; preds = %while.end, %if.then12, %if.else14
%left13.sink = phi ptr [ %left13, %if.then12 ], [ %right15, %if.else14 ], [ @root, %while.end ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !9
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Inorder(ptr noundef readonly %x) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !9
%cmp4 = icmp eq ptr %0, %x
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%x.tr5 = phi ptr [ %3, %if.end ], [ %x, %entry ]
%left = getelementptr inbounds %struct.Node, ptr %x.tr5, i64 0, i32 2
%1 = load ptr, ptr %left, align 8, !tbaa !13
tail call void @Inorder(ptr noundef %1)
%2 = load i32, ptr %x.tr5, align 8, !tbaa !11
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %2)
%right = getelementptr inbounds %struct.Node, ptr %x.tr5, i64 0, i32 1
%3 = load ptr, ptr %right, align 8, !tbaa !14
%4 = load ptr, ptr @NIL, align 8, !tbaa !9
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @Preorder(ptr noundef readonly %x) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !9
%cmp4 = icmp eq ptr %0, %x
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%x.tr5 = phi ptr [ %3, %if.end ], [ %x, %entry ]
%1 = load i32, ptr %x.tr5, align 8, !tbaa !11
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %1)
%left = getelementptr inbounds %struct.Node, ptr %x.tr5, i64 0, i32 2
%2 = load ptr, ptr %left, align 8, !tbaa !13
tail call void @Preorder(ptr noundef %2)
%right = getelementptr inbounds %struct.Node, ptr %x.tr5, i64 0, i32 1
%3 = load ptr, ptr %right, align 8, !tbaa !14
%4 = load ptr, ptr @NIL, align 8, !tbaa !9
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @Find(ptr noundef readonly %x, i32 noundef %n) local_unnamed_addr #3 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !9
%cmp.not10 = icmp eq ptr %0, %x
br i1 %cmp.not10, label %while.end, label %land.rhs
land.rhs: ; preds = %entry, %while.body
%x.addr.011 = phi ptr [ %x.addr.1, %while.body ], [ %x, %entry ]
%1 = load i32, ptr %x.addr.011, align 8, !tbaa !11
%cmp1.not = icmp eq i32 %1, %n
br i1 %cmp1.not, label %while.end, label %while.body
while.body: ; preds = %land.rhs
%cmp3 = icmp sgt i32 %1, %n
%left = getelementptr inbounds %struct.Node, ptr %x.addr.011, i64 0, i32 2
%right = getelementptr inbounds %struct.Node, ptr %x.addr.011, i64 0, i32 1
%x.addr.1.in = select i1 %cmp3, ptr %left, ptr %right
%x.addr.1 = load ptr, ptr %x.addr.1.in, align 8, !tbaa !9
%cmp.not = icmp eq ptr %x.addr.1, %0
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !18
while.end: ; preds = %land.rhs, %while.body, %entry
%x.addr.0.lcssa = phi ptr [ %x, %entry ], [ %0, %while.body ], [ %x.addr.011, %land.rhs ]
ret ptr %x.addr.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind willreturn memory(argmem: read) }
attributes #6 = { nofree nounwind }
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, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"Node", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!13 = !{!12, !10, i64 16}
!14 = !{!12, !10, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!12, !10, i64 24}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}
|
#include<stdio.h>
int main(){
int t;
scanf("%d",&t);
while(t--){
long long n,r=1,m=1e9+7;
scanf("%lld",&n);
for(int i=2*n;i>=3;i--){
r=(r*i)%m;;
}
r=r%m;
printf("%lld\n",r);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22123/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22123/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec16 = add nsw i32 %0, -1
store i32 %dec16, ptr %t, align 4, !tbaa !5
%tobool.not17 = icmp eq i32 %0, 0
br i1 %tobool.not17, label %while.end, label %while.body
while.body: ; preds = %entry, %for.cond.cleanup
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%1 = load i64, ptr %n, align 8, !tbaa !9
%.tr = trunc i64 %1 to i32
%conv = shl i32 %.tr, 1
%cmp13 = icmp sgt i32 %conv, 2
br i1 %cmp13, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %while.body
%2 = shl i64 %1, 1
%3 = and i64 %2, 4294967294
br label %for.body
for.cond.cleanup: ; preds = %for.body, %while.body
%r.0.lcssa = phi i64 [ 1, %while.body ], [ %rem, %for.body ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %r.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
%4 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ %3, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%r.014 = phi i64 [ 1, %for.body.preheader ], [ %rem, %for.body ]
%mul4 = mul nuw nsw i64 %r.014, %indvars.iv
%rem = urem i64 %mul4, 1000000007
%cmp = icmp ugt i64 %indvars.iv, 3
%indvars.iv.next = add nsw i64 %indvars.iv, -1
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
while.end: ; preds = %for.cond.cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include <stdio.h> // printf(), scanf()
#define MAX_N 500000
typedef struct node_tbl
{
int key;
int parent;
int left;
int right;
} node;
const int nil = -1;
node t[MAX_N + 1];
int root;
int ix;
int
find(int u, int k)
{
while (u != nil && k != t[u].key)
{
if (k < t[u].key)
u = t[u].left;
else
u = t[u].right;
}
return u;
}
void
insert(int k)
{
int y = nil;
int x = root;
int z = ix++;
t[z].key = k;
t[z].left = nil;
t[z].right = nil;
while (x != nil)
{
y = x;
if (t[z].key < t[x].key)
x = t[x].left;
else
x = t[x].right;
}
t[z].parent = y;
if (y == nil)
root = z;
else
{
if (t[z].key < t[y].key)
t[y].left = z;
else
t[y].right = z;
}
}
void
inorder(int u)
{
if (u == nil)
return;
inorder(t[u].left);
printf(" %d", t[u].key);
inorder(t[u].right);
}
void
preorder(int u)
{
if (u == nil)
return;
printf(" %d", t[u].key);
preorder(t[u].left);
preorder(t[u].right);
}
int
main(int argc, char** argv)
{
char command[8];
int n;
int x;
int i;
root = nil;
ix = 0;
scanf("%d", &n);
for (i = 0; i < n; ++i)
{
scanf("%s", command);
switch (command[0])
{
case 'f':
scanf("%d", &x);
printf("%s\n", find(root, x) != nil ? "yes" : "no");
break;
case 'i':
scanf("%d", &x);
insert(x);
break;
case 'p':
default:
inorder(root);
printf("\n");
preorder(root);
printf("\n");
break;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221273/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221273/source.c"
target datalayout = "e-m:e-p270: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_tbl = type { i32, i32, i32, i32 }
@nil = dso_local local_unnamed_addr constant i32 -1, align 4
@t = dso_local local_unnamed_addr global [500001 x %struct.node_tbl] zeroinitializer, align 16
@root = dso_local local_unnamed_addr global i32 0, align 4
@ix = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
@.str.5 = private unnamed_addr constant [3 x i8] c"no\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(i32 noundef %u, i32 noundef %k) local_unnamed_addr #0 {
entry:
%cmp.not16 = icmp eq i32 %u, -1
br i1 %cmp.not16, label %while.end, label %land.rhs
land.rhs: ; preds = %entry, %while.body
%u.addr.017 = phi i32 [ %u.addr.1, %while.body ], [ %u, %entry ]
%idxprom = sext i32 %u.addr.017 to i64
%arrayidx = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 16, !tbaa !5
%cmp1.not = icmp eq i32 %0, %k
br i1 %cmp1.not, label %while.end, label %while.body
while.body: ; preds = %land.rhs
%cmp5 = icmp sgt i32 %0, %k
%left = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 2
%right = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 3
%u.addr.1.in = select i1 %cmp5, ptr %left, ptr %right
%u.addr.1 = load i32, ptr %u.addr.1.in, align 4, !tbaa !10
%cmp.not = icmp eq i32 %u.addr.1, -1
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !11
while.end: ; preds = %land.rhs, %while.body, %entry
%u.addr.0.lcssa = phi i32 [ -1, %entry ], [ -1, %while.body ], [ %u.addr.017, %land.rhs ]
ret i32 %u.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @root, align 4, !tbaa !10
%1 = load i32, ptr @ix, align 4, !tbaa !10
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @ix, align 4, !tbaa !10
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom
store i32 %k, ptr %arrayidx, align 16, !tbaa !5
%left = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 2
store i32 -1, ptr %left, align 8, !tbaa !13
%right = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 3
store i32 -1, ptr %right, align 4, !tbaa !14
%cmp.not56 = icmp eq i32 %0, -1
br i1 %cmp.not56, label %if.then21, label %while.body
while.body: ; preds = %entry, %while.body
%x.057 = phi i32 [ %x.1, %while.body ], [ %0, %entry ]
%idxprom8 = sext i32 %x.057 to i64
%arrayidx9 = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom8
%2 = load i32, ptr %arrayidx9, align 16, !tbaa !5
%cmp11 = icmp sgt i32 %2, %k
%left14 = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom8, i32 2
%right17 = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom8, i32 3
%x.1.in = select i1 %cmp11, ptr %left14, ptr %right17
%x.1 = load i32, ptr %x.1.in, align 4, !tbaa !10
%cmp.not = icmp eq i32 %x.1, -1
br i1 %cmp.not, label %if.else22, label %while.body, !llvm.loop !15
if.then21: ; preds = %entry
%parent59 = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 1
store i32 -1, ptr %parent59, align 4, !tbaa !16
store i32 %1, ptr @root, align 4, !tbaa !10
br label %if.end39
if.else22: ; preds = %while.body
%parent = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 1
store i32 %x.057, ptr %parent, align 4, !tbaa !16
%idxprom26 = sext i32 %x.057 to i64
%arrayidx27 = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom26
%3 = load i32, ptr %arrayidx27, align 16, !tbaa !5
%cmp29 = icmp sgt i32 %3, %k
br i1 %cmp29, label %if.then30, label %if.else34
if.then30: ; preds = %if.else22
%left33 = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom26, i32 2
store i32 %1, ptr %left33, align 8, !tbaa !13
br label %if.end39
if.else34: ; preds = %if.else22
%right37 = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom26, i32 3
store i32 %1, ptr %right37, align 4, !tbaa !14
br label %if.end39
if.end39: ; preds = %if.then30, %if.else34, %if.then21
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 nounwind uwtable
define dso_local void @inorder(i32 noundef %u) local_unnamed_addr #3 {
entry:
%cmp8 = icmp eq i32 %u, -1
br i1 %cmp8, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr9 = phi i32 [ %2, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr9 to i64
%arrayidx = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom
%left = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 2
%0 = load i32, ptr %left, align 8, !tbaa !13
tail call void @inorder(i32 noundef %0)
%1 = load i32, ptr %arrayidx, align 16, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%right = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 3
%2 = load i32, ptr %right, align 4, !tbaa !14
%cmp = icmp eq i32 %2, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(i32 noundef %u) local_unnamed_addr #3 {
entry:
%cmp8 = icmp eq i32 %u, -1
br i1 %cmp8, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr9 = phi i32 [ %2, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr9 to i64
%arrayidx = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 16, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %left, align 8, !tbaa !13
tail call void @preorder(i32 noundef %1)
%right = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 3
%2 = load i32, ptr %right, align 4, !tbaa !14
%cmp = icmp eq i32 %2, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #3 {
entry:
%command = alloca [8 x i8], align 1
%n = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %command) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6
store i32 -1, ptr @root, align 4, !tbaa !10
store i32 0, ptr @ix, align 4, !tbaa !10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !10
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.024 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %command)
%1 = load i8, ptr %command, align 1, !tbaa !17
%conv = sext i8 %1 to i32
switch i32 %conv, label %sw.default [
i32 102, label %sw.bb
i32 105, label %sw.bb7
]
sw.bb: ; preds = %for.body
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load i32, ptr @root, align 4, !tbaa !10
%3 = load i32, ptr %x, align 4, !tbaa !10
%cmp.not16.i = icmp eq i32 %2, -1
br i1 %cmp.not16.i, label %find.exit, label %land.rhs.i
land.rhs.i: ; preds = %sw.bb, %while.body.i
%u.addr.017.i = phi i32 [ %u.addr.1.i, %while.body.i ], [ %2, %sw.bb ]
%idxprom.i = sext i32 %u.addr.017.i to i64
%arrayidx.i = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom.i
%4 = load i32, ptr %arrayidx.i, align 16, !tbaa !5
%cmp1.not.i = icmp eq i32 %4, %3
br i1 %cmp1.not.i, label %find.exit, label %while.body.i
while.body.i: ; preds = %land.rhs.i
%cmp5.i = icmp sgt i32 %4, %3
%left.i = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom.i, i32 2
%right.i = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom.i, i32 3
%u.addr.1.in.i = select i1 %cmp5.i, ptr %left.i, ptr %right.i
%u.addr.1.i = load i32, ptr %u.addr.1.in.i, align 4, !tbaa !10
%cmp.not.i = icmp eq i32 %u.addr.1.i, -1
br i1 %cmp.not.i, label %find.exit, label %land.rhs.i, !llvm.loop !11
find.exit: ; preds = %while.body.i, %land.rhs.i, %sw.bb
%5 = phi ptr [ @.str.5, %sw.bb ], [ @.str.5, %while.body.i ], [ @.str.4, %land.rhs.i ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %5)
br label %for.inc
sw.bb7: ; preds = %for.body
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%6 = load i32, ptr %x, align 4, !tbaa !10
%7 = load i32, ptr @root, align 4, !tbaa !10
%8 = load i32, ptr @ix, align 4, !tbaa !10
%inc.i = add nsw i32 %8, 1
store i32 %inc.i, ptr @ix, align 4, !tbaa !10
%idxprom.i14 = sext i32 %8 to i64
%arrayidx.i15 = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom.i14
store i32 %6, ptr %arrayidx.i15, align 16, !tbaa !5
%left.i16 = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom.i14, i32 2
store i32 -1, ptr %left.i16, align 8, !tbaa !13
%right.i17 = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom.i14, i32 3
store i32 -1, ptr %right.i17, align 4, !tbaa !14
%cmp.not56.i = icmp eq i32 %7, -1
br i1 %cmp.not56.i, label %if.then21.i, label %while.body.i18
while.body.i18: ; preds = %sw.bb7, %while.body.i18
%x.057.i = phi i32 [ %x.1.i, %while.body.i18 ], [ %7, %sw.bb7 ]
%idxprom8.i = sext i32 %x.057.i to i64
%arrayidx9.i = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom8.i
%9 = load i32, ptr %arrayidx9.i, align 16, !tbaa !5
%cmp11.i = icmp sgt i32 %9, %6
%left14.i = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom8.i, i32 2
%right17.i = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom8.i, i32 3
%x.1.in.i = select i1 %cmp11.i, ptr %left14.i, ptr %right17.i
%x.1.i = load i32, ptr %x.1.in.i, align 4, !tbaa !10
%cmp.not.i19 = icmp eq i32 %x.1.i, -1
br i1 %cmp.not.i19, label %if.else22.i, label %while.body.i18, !llvm.loop !15
if.then21.i: ; preds = %sw.bb7
%parent59.i = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom.i14, i32 1
store i32 -1, ptr %parent59.i, align 4, !tbaa !16
store i32 %8, ptr @root, align 4, !tbaa !10
br label %for.inc
if.else22.i: ; preds = %while.body.i18
%parent.i = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom.i14, i32 1
store i32 %x.057.i, ptr %parent.i, align 4, !tbaa !16
br i1 %cmp11.i, label %if.then30.i, label %if.else34.i
if.then30.i: ; preds = %if.else22.i
store i32 %8, ptr %left14.i, align 8, !tbaa !13
br label %for.inc
if.else34.i: ; preds = %if.else22.i
store i32 %8, ptr %right17.i, align 4, !tbaa !14
br label %for.inc
sw.default: ; preds = %for.body
%10 = load i32, ptr @root, align 4, !tbaa !10
call void @inorder(i32 noundef %10)
%putchar = call i32 @putchar(i32 10)
%11 = load i32, ptr @root, align 4, !tbaa !10
call void @preorder(i32 noundef %11)
%putchar13 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %if.else34.i, %if.then30.i, %if.then21.i, %find.exit, %sw.default
%inc = add nuw nsw i32 %i.024, 1
%12 = load i32, ptr %n, align 4, !tbaa !10
%cmp = icmp slt i32 %inc, %12
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !18
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %command) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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, !7, i64 0}
!6 = !{!"node_tbl", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!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"}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !7, i64 12}
!15 = distinct !{!15, !12}
!16 = !{!6, !7, i64 4}
!17 = !{!8, !8, i64 0}
!18 = distinct !{!18, !12}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int X[100], Y[100];
int main() {
int N, K;
scanf ("%d %d", &N, &K);
printf("%d", K==1?0:N-K);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221323/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221323/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@X = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@Y = 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:
%N = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i32, ptr %K, align 4
%cmp = icmp eq i32 %0, 1
%1 = load i32, ptr %N, align 4
%sub = sub nsw i32 %1, %0
%cond = select i1 %cmp, i32 0, i32 %sub
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(void)
{
int n, k;
scanf("%d%d", &n, &k);
if(k == 1 || n == k){
printf("%d\n", 0);
return 0;
}
printf("%d\n", n - k);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221367/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221367/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
%1 = load i32, ptr %n, align 4
%sub = sub nsw i32 %1, %0
%sub.sink = select i1 %cmp, i32 0, i32 %sub
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
long long int further_solve(long long int n,long long int ans){
if (n==2)
return 1;
if (n==3)
return 3;
ans = (n*((further_solve(n-1,ans))%(1000000007)))%1000000007;
return ans;
}
void solve(){
long long int n;
scanf("%lld",&n);
long long int ans = 3;
printf("%lld",further_solve(2*n,ans));
return;
}
int main(){
int TC = 1,t = 0;
scanf("%d",&TC);
while(t++ < TC){
solve();
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22141/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22141/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @further_solve(i64 noundef %n, i64 noundef %ans) local_unnamed_addr #0 {
entry:
switch i64 %n, label %if.end3 [
i64 2, label %common.ret9
i64 3, label %if.then2
]
if.then2: ; preds = %entry
br label %common.ret9
common.ret9: ; preds = %entry, %if.then2, %if.end3
%common.ret9.op = phi i64 [ %rem4, %if.end3 ], [ 3, %if.then2 ], [ 1, %entry ]
ret i64 %common.ret9.op
if.end3: ; preds = %entry
%sub = add nsw i64 %n, -1
%call = tail call i64 @further_solve(i64 noundef %sub, i64 noundef %ans), !range !5
%mul = mul nsw i64 %call, %n
%rem4 = srem i64 %mul, 1000000007
br label %common.ret9
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @solve() local_unnamed_addr #1 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !6
%mul = shl nsw i64 %0, 1
%call1 = call i64 @further_solve(i64 noundef %mul, i64 noundef 3), !range !5
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %call1)
call void @llvm.lifetime.end.p0(i64 8, 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) #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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n.i = alloca i64, align 8
%TC = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %TC) #5
store i32 1, ptr %TC, align 4, !tbaa !10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %TC)
%0 = load i32, ptr %TC, align 4, !tbaa !10
%cmp2 = icmp sgt i32 %0, 0
br i1 %cmp2, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%t.03 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
%inc = add nuw nsw i32 %t.03, 1
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n.i) #5
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n.i)
%1 = load i64, ptr %n.i, align 8, !tbaa !6
%mul.i = shl nsw i64 %1, 1
%call1.i = call i64 @further_solve(i64 noundef %mul.i, i64 noundef 3), !range !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %call1.i)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n.i) #5
%putchar = call i32 @putchar(i32 10)
%2 = load i32, ptr %TC, align 4, !tbaa !10
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %TC) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree 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 = !{i64 -1000000006, i64 1000000007}
!6 = !{!7, !7, i64 0}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#define YYES #Yay!
#define NNO #:(
int main()
{
int n;
int k;
scanf("%d %d", &n, &k);
printf("%d\n", n % k);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221453/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221453/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = load i32, ptr %k, align 4, !tbaa !5
%rem = srem i32 %0, %1
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %rem)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define WHITE 0
#define BLACK 1
int **matrix;
int *d;
int *parent;
int *color;
void dijkstra(int);
int main()
{
int n,i,j,k,u,v;
scanf("%d",&n);
color = malloc(n * sizeof(int ));
d = malloc(n * sizeof(int ));
parent = malloc(n * sizeof(int));
matrix = malloc(n * sizeof(int *));
for(i=0;i<n;i++)
matrix[i] = malloc(n * sizeof(int));
for(i=0;i<n;i++)
for(j=0;j<n;j++)
matrix[i][j] = -1;
for(i=0;i<n;i++)
{
scanf("%d%d",&u,&k);
for(j=0;j<k;j++)
{
scanf("%d",&v);
scanf("%d",&matrix[u][v]);
}
}
dijkstra(n);
for(i=0;i<n;i++) printf("%d %d\n",i,d[i]);
free(d);
free(color);
free(parent);
for(i=0;i<n;i++) free(matrix[i]);
free(matrix);
return 0;
}
void dijkstra(int n)
{
int mincost;
int i,j,u;
for(i=0;i<n;i++)
{
d[i] = INT_MAX;
parent[i] = -1;
color[i] = WHITE;
}
d[0] = 0;
while(1)
{
mincost = INT_MAX;
for(i=0;i<n;i++)
{
if(color[i] != BLACK && d[i] < mincost)
{
mincost = d[i];
u = i;
}
}
if(mincost == INT_MAX) break;
color[u] = BLACK;
for(i=0;i<n;i++)
{
if(color[i] != BLACK && matrix[u][i] != -1 && matrix[u][i] + d[u] < d[i])
{
d[i] = matrix[u][i] + d[u];
parent[i] = u;
}
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221510/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221510/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@color = dso_local local_unnamed_addr global ptr null, align 8
@d = dso_local local_unnamed_addr global ptr null, align 8
@parent = dso_local local_unnamed_addr global ptr null, align 8
@matrix = dso_local local_unnamed_addr global ptr null, align 8
@.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: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%u = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #8
store ptr %call1, ptr @color, align 8, !tbaa !9
%call4 = call noalias ptr @malloc(i64 noundef %mul) #8
store ptr %call4, ptr @d, align 8, !tbaa !9
%call7 = call noalias ptr @malloc(i64 noundef %mul) #8
store ptr %call7, ptr @parent, align 8, !tbaa !9
%mul9 = shl nsw i64 %conv, 3
%call10 = call noalias ptr @malloc(i64 noundef %mul9) #8
store ptr %call10, ptr @matrix, align 8, !tbaa !9
%cmp93 = icmp sgt i32 %0, 0
br i1 %cmp93, label %for.body.preheader, label %for.end53.thread
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.cond15.preheader: ; preds = %for.body
br i1 %cmp93, label %for.cond19.preheader.preheader, label %for.end53.thread
for.cond19.preheader.preheader: ; preds = %for.cond15.preheader
%1 = load ptr, ptr @matrix, align 8
br label %for.cond19.preheader
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%call14 = call noalias ptr @malloc(i64 noundef %mul) #8
%2 = load ptr, ptr @matrix, align 8, !tbaa !9
%arrayidx = getelementptr inbounds ptr, ptr %2, i64 %indvars.iv
store ptr %call14, 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.cond15.preheader, label %for.body, !llvm.loop !11
for.cond19.preheader: ; preds = %for.cond19.preheader.preheader, %for.inc30
%3 = phi i32 [ %0, %for.cond19.preheader.preheader ], [ %7, %for.inc30 ]
%indvars.iv114 = phi i64 [ 0, %for.cond19.preheader.preheader ], [ %indvars.iv.next115, %for.inc30 ]
%cmp2095 = icmp sgt i32 %3, 0
br i1 %cmp2095, label %for.body22.lr.ph, label %for.cond19.preheader.for.inc30_crit_edge
for.cond19.preheader.for.inc30_crit_edge: ; preds = %for.cond19.preheader
%.pre123 = sext i32 %3 to i64
br label %for.inc30
for.body22.lr.ph: ; preds = %for.cond19.preheader
%arrayidx24 = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv114
%4 = load ptr, ptr %arrayidx24, align 8, !tbaa !9
br label %for.body22
for.cond33.preheader: ; preds = %for.inc30
%cmp34101 = icmp sgt i32 %7, 0
br i1 %cmp34101, label %for.body36, label %for.end53.thread
for.body22: ; preds = %for.body22.lr.ph, %for.body22
%indvars.iv111 = phi i64 [ 0, %for.body22.lr.ph ], [ %indvars.iv.next112, %for.body22 ]
%arrayidx26 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv111
store i32 -1, ptr %arrayidx26, align 4, !tbaa !5
%indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp20 = icmp slt i64 %indvars.iv.next112, %6
br i1 %cmp20, label %for.body22, label %for.inc30, !llvm.loop !13
for.inc30: ; preds = %for.body22, %for.cond19.preheader.for.inc30_crit_edge
%.pre-phi = phi i64 [ %.pre123, %for.cond19.preheader.for.inc30_crit_edge ], [ %6, %for.body22 ]
%7 = phi i32 [ %3, %for.cond19.preheader.for.inc30_crit_edge ], [ %5, %for.body22 ]
%indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
%cmp16 = icmp slt i64 %indvars.iv.next115, %.pre-phi
br i1 %cmp16, label %for.cond19.preheader, label %for.cond33.preheader, !llvm.loop !14
for.body36: ; preds = %for.cond33.preheader, %for.inc51
%i.2102 = phi i32 [ %inc52, %for.inc51 ], [ 0, %for.cond33.preheader ]
%call37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%8 = load i32, ptr %k, align 4, !tbaa !5
%cmp3999 = icmp sgt i32 %8, 0
br i1 %cmp3999, label %for.body41, label %for.inc51
for.body41: ; preds = %for.body36, %for.body41
%j.1100 = phi i32 [ %inc49, %for.body41 ], [ 0, %for.body36 ]
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%9 = load ptr, ptr @matrix, align 8, !tbaa !9
%10 = load i32, ptr %u, align 4, !tbaa !5
%idxprom43 = sext i32 %10 to i64
%arrayidx44 = getelementptr inbounds ptr, ptr %9, i64 %idxprom43
%11 = load ptr, ptr %arrayidx44, align 8, !tbaa !9
%12 = load i32, ptr %v, align 4, !tbaa !5
%idxprom45 = sext i32 %12 to i64
%arrayidx46 = getelementptr inbounds i32, ptr %11, i64 %idxprom45
%call47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx46)
%inc49 = add nuw nsw i32 %j.1100, 1
%13 = load i32, ptr %k, align 4, !tbaa !5
%cmp39 = icmp slt i32 %inc49, %13
br i1 %cmp39, label %for.body41, label %for.inc51, !llvm.loop !16
for.inc51: ; preds = %for.body41, %for.body36
%inc52 = add nuw nsw i32 %i.2102, 1
%.pr = load i32, ptr %n, align 4, !tbaa !5
%cmp34 = icmp slt i32 %inc52, %.pr
br i1 %cmp34, label %for.body36, label %for.end53, !llvm.loop !17
for.end53.thread: ; preds = %for.cond33.preheader, %for.cond15.preheader, %entry
%.pre.i128 = load ptr, ptr @d, align 8, !tbaa !9
br label %for.end.thread.i
for.end53: ; preds = %for.inc51
%cmp93.i = icmp sgt i32 %.pr, 0
%.pre.i = load ptr, ptr @d, align 8, !tbaa !9
%.pre.i135 = ptrtoint ptr %.pre.i to i64
br i1 %cmp93.i, label %for.body.lr.ph.i, label %for.end.thread.i
for.end.thread.i: ; preds = %for.end53.thread, %for.end53
%.pre.i129 = phi ptr [ %.pre.i128, %for.end53.thread ], [ %.pre.i, %for.end53 ]
store i32 0, ptr %.pre.i129, align 4, !tbaa !5
br label %dijkstra.exit
for.body.lr.ph.i: ; preds = %for.end53
%14 = load ptr, ptr @parent, align 8, !tbaa !9
%15 = load ptr, ptr @color, align 8, !tbaa !9
%wide.trip.count.i = zext i32 %.pr to i64
%min.iters.check = icmp ult i32 %.pr, 16
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.lr.ph.i
%16 = ptrtoint ptr %15 to i64
%17 = ptrtoint ptr %14 to i64
%18 = sub i64 %17, %.pre.i135
%diff.check = icmp ult i64 %18, 32
%19 = sub i64 %16, %.pre.i135
%diff.check136 = icmp ult i64 %19, 32
%conflict.rdx = or i1 %diff.check, %diff.check136
%20 = sub i64 %16, %17
%diff.check137 = icmp ult i64 %20, 32
%conflict.rdx138 = or i1 %conflict.rdx, %diff.check137
br i1 %conflict.rdx138, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%21 = getelementptr inbounds i32, ptr %.pre.i, i64 %index
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %21, align 4, !tbaa !5
%22 = getelementptr inbounds i32, ptr %21, i64 4
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %22, align 4, !tbaa !5
%23 = getelementptr inbounds i32, ptr %14, i64 %index
store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %23, align 4, !tbaa !5
%24 = getelementptr inbounds i32, ptr %23, i64 4
store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %24, align 4, !tbaa !5
%25 = getelementptr inbounds i32, ptr %15, i64 %index
store <4 x i32> zeroinitializer, ptr %25, align 4, !tbaa !5
%26 = getelementptr inbounds i32, ptr %25, i64 4
store <4 x i32> zeroinitializer, ptr %26, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%27 = icmp eq i64 %index.next, %n.vec
br i1 %27, label %middle.block, label %vector.body, !llvm.loop !18
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %while.cond.us.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.lr.ph.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.lr.ph.i ], [ %n.vec, %middle.block ]
%xtraiter = and i64 %wide.trip.count.i, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader
%arrayidx.i.prol = getelementptr inbounds i32, ptr %.pre.i, i64 %indvars.iv.i.ph
store i32 2147483647, ptr %arrayidx.i.prol, align 4, !tbaa !5
%arrayidx2.i.prol = getelementptr inbounds i32, ptr %14, i64 %indvars.iv.i.ph
store i32 -1, ptr %arrayidx2.i.prol, align 4, !tbaa !5
%arrayidx4.i.prol = getelementptr inbounds i32, ptr %15, i64 %indvars.iv.i.ph
store i32 0, ptr %arrayidx4.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = or i64 %indvars.iv.i.ph, 1
br label %for.body.i.prol.loopexit
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%28 = sub nsw i64 0, %wide.trip.count.i
%29 = xor i64 %indvars.iv.i.ph, %28
%30 = icmp eq i64 %29, -1
br i1 %30, label %while.cond.us.preheader.i, label %for.body.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.1, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%arrayidx.i = getelementptr inbounds i32, ptr %.pre.i, i64 %indvars.iv.i
store i32 2147483647, ptr %arrayidx.i, align 4, !tbaa !5
%arrayidx2.i = getelementptr inbounds i32, ptr %14, i64 %indvars.iv.i
store i32 -1, ptr %arrayidx2.i, align 4, !tbaa !5
%arrayidx4.i = getelementptr inbounds i32, ptr %15, i64 %indvars.iv.i
store i32 0, ptr %arrayidx4.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds i32, ptr %.pre.i, i64 %indvars.iv.next.i
store i32 2147483647, ptr %arrayidx.i.1, align 4, !tbaa !5
%arrayidx2.i.1 = getelementptr inbounds i32, ptr %14, i64 %indvars.iv.next.i
store i32 -1, ptr %arrayidx2.i.1, align 4, !tbaa !5
%arrayidx4.i.1 = getelementptr inbounds i32, ptr %15, i64 %indvars.iv.next.i
store i32 0, ptr %arrayidx4.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%exitcond.not.i.1 = icmp eq i64 %indvars.iv.next.i.1, %wide.trip.count.i
br i1 %exitcond.not.i.1, label %while.cond.us.preheader.i, label %for.body.i, !llvm.loop !21
while.cond.us.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block
store i32 0, ptr %.pre.i, align 4, !tbaa !5
%31 = load ptr, ptr @color, align 8
br label %for.body8.us.i
for.end19.us.i: ; preds = %for.inc17.us.i
%cmp20.us.i = icmp eq i32 %mincost.1.us.i, 2147483647
br i1 %cmp20.us.i, label %dijkstra.exit, label %if.end22.us.i
if.end22.us.i: ; preds = %for.end19.us.i
%idxprom23.us.i = sext i32 %u.2.us.i to i64
%arrayidx24.us.i = getelementptr inbounds i32, ptr %31, i64 %idxprom23.us.i
store i32 1, ptr %arrayidx24.us.i, align 4, !tbaa !5
%32 = load ptr, ptr @matrix, align 8
%arrayidx33.us.i = getelementptr inbounds ptr, ptr %32, i64 %idxprom23.us.i
%arrayidx43.us.i = getelementptr inbounds i32, ptr %.pre.i, i64 %idxprom23.us.i
%33 = load ptr, ptr @parent, align 8
br label %for.body27.us.i
for.body27.us.i: ; preds = %for.inc60.us.i, %if.end22.us.i
%indvars.iv138.i = phi i64 [ 0, %if.end22.us.i ], [ %indvars.iv.next139.i, %for.inc60.us.i ]
%arrayidx29.us.i = getelementptr inbounds i32, ptr %31, i64 %indvars.iv138.i
%34 = load i32, ptr %arrayidx29.us.i, align 4, !tbaa !5
%cmp30.not.us.i = icmp eq i32 %34, 1
br i1 %cmp30.not.us.i, label %for.inc60.us.i, label %land.lhs.true31.us.i
land.lhs.true31.us.i: ; preds = %for.body27.us.i
%35 = load ptr, ptr %arrayidx33.us.i, align 8, !tbaa !9
%arrayidx35.us.i = getelementptr inbounds i32, ptr %35, i64 %indvars.iv138.i
%36 = load i32, ptr %arrayidx35.us.i, align 4, !tbaa !5
%cmp36.not.us.i = icmp eq i32 %36, -1
br i1 %cmp36.not.us.i, label %for.inc60.us.i, label %land.lhs.true37.us.i
land.lhs.true37.us.i: ; preds = %land.lhs.true31.us.i
%37 = load i32, ptr %arrayidx43.us.i, align 4, !tbaa !5
%add.us.i = add nsw i32 %37, %36
%arrayidx45.us.i = getelementptr inbounds i32, ptr %.pre.i, i64 %indvars.iv138.i
%38 = load i32, ptr %arrayidx45.us.i, align 4, !tbaa !5
%cmp46.us.i = icmp slt i32 %add.us.i, %38
br i1 %cmp46.us.i, label %if.then47.us.i, label %for.inc60.us.i
if.then47.us.i: ; preds = %land.lhs.true37.us.i
store i32 %add.us.i, ptr %arrayidx45.us.i, align 4, !tbaa !5
%arrayidx58.us.i = getelementptr inbounds i32, ptr %33, i64 %indvars.iv138.i
store i32 %u.2.us.i, ptr %arrayidx58.us.i, align 4, !tbaa !5
br label %for.inc60.us.i
for.inc60.us.i: ; preds = %if.then47.us.i, %land.lhs.true37.us.i, %land.lhs.true31.us.i, %for.body27.us.i
%indvars.iv.next139.i = add nuw nsw i64 %indvars.iv138.i, 1
%exitcond142.not.i = icmp eq i64 %indvars.iv.next139.i, %wide.trip.count.i
br i1 %exitcond142.not.i, label %for.body8.us.i.backedge, label %for.body27.us.i, !llvm.loop !22
for.body8.us.i: ; preds = %for.body8.us.i.backedge, %while.cond.us.preheader.i
%indvars.iv133.i = phi i64 [ 0, %while.cond.us.preheader.i ], [ %indvars.iv133.i.be, %for.body8.us.i.backedge ]
%u.198.us.i = phi i32 [ undef, %while.cond.us.preheader.i ], [ %u.2.us.i, %for.body8.us.i.backedge ]
%mincost.097.us.i = phi i32 [ 2147483647, %while.cond.us.preheader.i ], [ %mincost.097.us.i.be, %for.body8.us.i.backedge ]
%arrayidx10.us.i = getelementptr inbounds i32, ptr %31, i64 %indvars.iv133.i
%39 = load i32, ptr %arrayidx10.us.i, align 4, !tbaa !5
%cmp11.not.us.i = icmp eq i32 %39, 1
br i1 %cmp11.not.us.i, label %for.inc17.us.i, label %land.lhs.true.us.i
land.lhs.true.us.i: ; preds = %for.body8.us.i
%arrayidx13.us.i = getelementptr inbounds i32, ptr %.pre.i, i64 %indvars.iv133.i
%40 = load i32, ptr %arrayidx13.us.i, align 4, !tbaa !5
%cmp14.us.i = icmp slt i32 %40, %mincost.097.us.i
%spec.select.us.i = call i32 @llvm.smin.i32(i32 %40, i32 %mincost.097.us.i)
%41 = trunc i64 %indvars.iv133.i to i32
%spec.select92.us.i = select i1 %cmp14.us.i, i32 %41, i32 %u.198.us.i
br label %for.inc17.us.i
for.inc17.us.i: ; preds = %land.lhs.true.us.i, %for.body8.us.i
%mincost.1.us.i = phi i32 [ %mincost.097.us.i, %for.body8.us.i ], [ %spec.select.us.i, %land.lhs.true.us.i ]
%u.2.us.i = phi i32 [ %u.198.us.i, %for.body8.us.i ], [ %spec.select92.us.i, %land.lhs.true.us.i ]
%indvars.iv.next134.i = add nuw nsw i64 %indvars.iv133.i, 1
%exitcond137.not.i = icmp eq i64 %indvars.iv.next134.i, %wide.trip.count.i
br i1 %exitcond137.not.i, label %for.end19.us.i, label %for.body8.us.i.backedge
for.body8.us.i.backedge: ; preds = %for.inc60.us.i, %for.inc17.us.i
%indvars.iv133.i.be = phi i64 [ %indvars.iv.next134.i, %for.inc17.us.i ], [ 0, %for.inc60.us.i ]
%mincost.097.us.i.be = phi i32 [ %mincost.1.us.i, %for.inc17.us.i ], [ 2147483647, %for.inc60.us.i ]
br label %for.body8.us.i, !llvm.loop !22
dijkstra.exit: ; preds = %for.end19.us.i, %for.end.thread.i
%.pre.i130 = phi ptr [ %.pre.i129, %for.end.thread.i ], [ %.pre.i, %for.end19.us.i ]
%42 = load i32, ptr %n, align 4, !tbaa !5
%cmp55104 = icmp sgt i32 %42, 0
br i1 %cmp55104, label %for.body57, label %for.end63
for.body57: ; preds = %dijkstra.exit, %for.body57
%indvars.iv117 = phi i64 [ %indvars.iv.next118, %for.body57 ], [ 0, %dijkstra.exit ]
%43 = load ptr, ptr @d, align 8, !tbaa !9
%arrayidx59 = getelementptr inbounds i32, ptr %43, i64 %indvars.iv117
%44 = load i32, ptr %arrayidx59, align 4, !tbaa !5
%45 = trunc i64 %indvars.iv117 to i32
%call60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %45, i32 noundef %44)
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%46 = load i32, ptr %n, align 4, !tbaa !5
%47 = sext i32 %46 to i64
%cmp55 = icmp slt i64 %indvars.iv.next118, %47
br i1 %cmp55, label %for.body57, label %for.end63.loopexit, !llvm.loop !23
for.end63.loopexit: ; preds = %for.body57
%.pre = load ptr, ptr @d, align 8, !tbaa !9
br label %for.end63
for.end63: ; preds = %for.end63.loopexit, %dijkstra.exit
%48 = phi ptr [ %.pre, %for.end63.loopexit ], [ %.pre.i130, %dijkstra.exit ]
call void @free(ptr noundef %48) #7
%49 = load ptr, ptr @color, align 8, !tbaa !9
call void @free(ptr noundef %49) #7
%50 = load ptr, ptr @parent, align 8, !tbaa !9
call void @free(ptr noundef %50) #7
%51 = load i32, ptr %n, align 4, !tbaa !5
%cmp65106 = icmp sgt i32 %51, 0
br i1 %cmp65106, label %for.body67, label %for.end72
for.body67: ; preds = %for.end63, %for.body67
%indvars.iv120 = phi i64 [ %indvars.iv.next121, %for.body67 ], [ 0, %for.end63 ]
%52 = load ptr, ptr @matrix, align 8, !tbaa !9
%arrayidx69 = getelementptr inbounds ptr, ptr %52, i64 %indvars.iv120
%53 = load ptr, ptr %arrayidx69, align 8, !tbaa !9
call void @free(ptr noundef %53) #7
%indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
%54 = load i32, ptr %n, align 4, !tbaa !5
%55 = sext i32 %54 to i64
%cmp65 = icmp slt i64 %indvars.iv.next121, %55
br i1 %cmp65, label %for.body67, label %for.end72, !llvm.loop !24
for.end72: ; preds = %for.body67, %for.end63
%56 = load ptr, ptr @matrix, align 8, !tbaa !9
call void @free(ptr noundef %56) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dijkstra(i32 noundef %n) local_unnamed_addr #4 {
entry:
%cmp93 = icmp sgt i32 %n, 0
%.pre = load ptr, ptr @d, align 8, !tbaa !9
%.pre143 = ptrtoint ptr %.pre to i64
br i1 %cmp93, label %for.body.lr.ph, label %for.end.thread
for.end.thread: ; preds = %entry
store i32 0, ptr %.pre, align 4, !tbaa !5
br label %while.end
for.body.lr.ph: ; preds = %entry
%0 = load ptr, ptr @parent, align 8, !tbaa !9
%1 = load ptr, ptr @color, align 8, !tbaa !9
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 16
br i1 %min.iters.check, label %for.body.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.lr.ph
%2 = ptrtoint ptr %1 to i64
%3 = ptrtoint ptr %0 to i64
%4 = sub i64 %3, %.pre143
%diff.check = icmp ult i64 %4, 32
%5 = sub i64 %2, %.pre143
%diff.check144 = icmp ult i64 %5, 32
%conflict.rdx = or i1 %diff.check, %diff.check144
%6 = sub i64 %2, %3
%diff.check145 = icmp ult i64 %6, 32
%conflict.rdx146 = or i1 %conflict.rdx, %diff.check145
br i1 %conflict.rdx146, label %for.body.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%7 = getelementptr inbounds i32, ptr %.pre, i64 %index
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %7, align 4, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %0, i64 %index
store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %9, align 4, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %10, align 4, !tbaa !5
%11 = getelementptr inbounds i32, ptr %1, i64 %index
store <4 x i32> zeroinitializer, ptr %11, align 4, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 4
store <4 x i32> zeroinitializer, ptr %12, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !25
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %vector.memcheck, %for.body.lr.ph, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.lr.ph ], [ %n.vec, %middle.block ]
%xtraiter = and i64 %wide.trip.count, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader
%arrayidx.prol = getelementptr inbounds i32, ptr %.pre, i64 %indvars.iv.ph
store i32 2147483647, ptr %arrayidx.prol, align 4, !tbaa !5
%arrayidx2.prol = getelementptr inbounds i32, ptr %0, i64 %indvars.iv.ph
store i32 -1, ptr %arrayidx2.prol, align 4, !tbaa !5
%arrayidx4.prol = getelementptr inbounds i32, ptr %1, i64 %indvars.iv.ph
store i32 0, ptr %arrayidx4.prol, align 4, !tbaa !5
%indvars.iv.next.prol = or i64 %indvars.iv.ph, 1
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader ], [ %indvars.iv.next.prol, %for.body.prol ]
%14 = sub nsw i64 0, %wide.trip.count
%15 = xor i64 %indvars.iv.ph, %14
%16 = icmp eq i64 %15, -1
br i1 %16, label %for.end, label %for.body
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%arrayidx = getelementptr inbounds i32, ptr %.pre, i64 %indvars.iv
store i32 2147483647, ptr %arrayidx, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv
store i32 -1, ptr %arrayidx2, align 4, !tbaa !5
%arrayidx4 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv
store i32 0, ptr %arrayidx4, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %.pre, i64 %indvars.iv.next
store i32 2147483647, ptr %arrayidx.1, align 4, !tbaa !5
%arrayidx2.1 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx2.1, align 4, !tbaa !5
%arrayidx4.1 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv.next
store i32 0, ptr %arrayidx4.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !26
for.end: ; preds = %for.body.prol.loopexit, %for.body, %middle.block
store i32 0, ptr %.pre, align 4, !tbaa !5
%17 = load ptr, ptr @color, align 8
br i1 %cmp93, label %while.cond.us.preheader, label %while.end
while.cond.us.preheader: ; preds = %for.end
%wide.trip.count136 = zext i32 %n to i64
%wide.trip.count141 = zext i32 %n to i64
br label %for.body8.us
for.end19.us: ; preds = %for.inc17.us
%cmp20.us = icmp eq i32 %mincost.1.us, 2147483647
br i1 %cmp20.us, label %while.end, label %if.end22.us
if.end22.us: ; preds = %for.end19.us
%idxprom23.us = sext i32 %u.2.us to i64
%arrayidx24.us = getelementptr inbounds i32, ptr %17, i64 %idxprom23.us
store i32 1, ptr %arrayidx24.us, align 4, !tbaa !5
%18 = load ptr, ptr @matrix, align 8
%arrayidx33.us = getelementptr inbounds ptr, ptr %18, i64 %idxprom23.us
%arrayidx43.us = getelementptr inbounds i32, ptr %.pre, i64 %idxprom23.us
%19 = load ptr, ptr @parent, align 8
br label %for.body27.us
for.body27.us: ; preds = %if.end22.us, %for.inc60.us
%indvars.iv138 = phi i64 [ 0, %if.end22.us ], [ %indvars.iv.next139, %for.inc60.us ]
%arrayidx29.us = getelementptr inbounds i32, ptr %17, i64 %indvars.iv138
%20 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
%cmp30.not.us = icmp eq i32 %20, 1
br i1 %cmp30.not.us, label %for.inc60.us, label %land.lhs.true31.us
land.lhs.true31.us: ; preds = %for.body27.us
%21 = load ptr, ptr %arrayidx33.us, align 8, !tbaa !9
%arrayidx35.us = getelementptr inbounds i32, ptr %21, i64 %indvars.iv138
%22 = load i32, ptr %arrayidx35.us, align 4, !tbaa !5
%cmp36.not.us = icmp eq i32 %22, -1
br i1 %cmp36.not.us, label %for.inc60.us, label %land.lhs.true37.us
land.lhs.true37.us: ; preds = %land.lhs.true31.us
%23 = load i32, ptr %arrayidx43.us, align 4, !tbaa !5
%add.us = add nsw i32 %23, %22
%arrayidx45.us = getelementptr inbounds i32, ptr %.pre, i64 %indvars.iv138
%24 = load i32, ptr %arrayidx45.us, align 4, !tbaa !5
%cmp46.us = icmp slt i32 %add.us, %24
br i1 %cmp46.us, label %if.then47.us, label %for.inc60.us
if.then47.us: ; preds = %land.lhs.true37.us
store i32 %add.us, ptr %arrayidx45.us, align 4, !tbaa !5
%arrayidx58.us = getelementptr inbounds i32, ptr %19, i64 %indvars.iv138
store i32 %u.2.us, ptr %arrayidx58.us, align 4, !tbaa !5
br label %for.inc60.us
for.inc60.us: ; preds = %if.then47.us, %land.lhs.true37.us, %land.lhs.true31.us, %for.body27.us
%indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
%exitcond142.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count141
br i1 %exitcond142.not, label %for.body8.us.backedge, label %for.body27.us, !llvm.loop !22
for.body8.us: ; preds = %for.body8.us.backedge, %while.cond.us.preheader
%indvars.iv133 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv133.be, %for.body8.us.backedge ]
%u.198.us = phi i32 [ undef, %while.cond.us.preheader ], [ %u.2.us, %for.body8.us.backedge ]
%mincost.097.us = phi i32 [ 2147483647, %while.cond.us.preheader ], [ %mincost.097.us.be, %for.body8.us.backedge ]
%arrayidx10.us = getelementptr inbounds i32, ptr %17, i64 %indvars.iv133
%25 = load i32, ptr %arrayidx10.us, align 4, !tbaa !5
%cmp11.not.us = icmp eq i32 %25, 1
br i1 %cmp11.not.us, label %for.inc17.us, label %land.lhs.true.us
land.lhs.true.us: ; preds = %for.body8.us
%arrayidx13.us = getelementptr inbounds i32, ptr %.pre, i64 %indvars.iv133
%26 = load i32, ptr %arrayidx13.us, align 4, !tbaa !5
%cmp14.us = icmp slt i32 %26, %mincost.097.us
%spec.select.us = tail call i32 @llvm.smin.i32(i32 %26, i32 %mincost.097.us)
%27 = trunc i64 %indvars.iv133 to i32
%spec.select92.us = select i1 %cmp14.us, i32 %27, i32 %u.198.us
br label %for.inc17.us
for.inc17.us: ; preds = %land.lhs.true.us, %for.body8.us
%mincost.1.us = phi i32 [ %mincost.097.us, %for.body8.us ], [ %spec.select.us, %land.lhs.true.us ]
%u.2.us = phi i32 [ %u.198.us, %for.body8.us ], [ %spec.select92.us, %land.lhs.true.us ]
%indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
%exitcond137.not = icmp eq i64 %indvars.iv.next134, %wide.trip.count136
br i1 %exitcond137.not, label %for.end19.us, label %for.body8.us.backedge
for.body8.us.backedge: ; preds = %for.inc60.us, %for.inc17.us
%indvars.iv133.be = phi i64 [ %indvars.iv.next134, %for.inc17.us ], [ 0, %for.inc60.us ]
%mincost.097.us.be = phi i32 [ %mincost.1.us, %for.inc17.us ], [ 2147483647, %for.inc60.us ]
br label %for.body8.us, !llvm.loop !22
while.end: ; preds = %for.end19.us, %for.end.thread, %for.end
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12, !19, !20}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !12, !19}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12, !19, !20}
!26 = distinct !{!26, !12, !19}
|
#include <stdio.h>
#define MAX 100
#define INFTY 200000
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n, m[MAX][MAX];
void dijkstra(void);
int main()
{
int i, j, k, c, u, v;
scanf("%d", &n);
for(i=0; i<n; i++) {
for(j=0; j<n; j++) {
m[i][j] = INFTY;
}
}
for(i=0; i<n;i++) {
scanf("%d %d", &u, &k);
for(j=0; j<k; j++) {
scanf("%d %d", &v, &c);
m[u][v] = c;
}
}
dijkstra();
return 0;
}
void dijkstra()
{
int i, minv, u, v;
int d[MAX], color[MAX];
for(i=0; i<n; i++) {
d[i] = INFTY;
color[i] = WHITE;
}
d[0] = 0;
color[0] = GRAY;
while(1) {
minv = INFTY;
u = -1;
for(i=0; i<n; i++) {
if(minv > d[i] && color[i] != BLACK) {
u = i;
minv = d[i];
}
}
if(u == -1)
break;
color[u] = BLACK;
for(v=0; v<n; v++) {
if(color[v] != BLACK && m[u][v] != INFTY) {
if(d[v] > d[u]+m[u][v]) {
d[v] = d[u] + m[u][v];
color[v] = GRAY;
}
}
}
}
for(i=0; i<n; i++) {
printf("%d ", i);
if(d[i] == INFTY)
printf("-1\n");
else
printf("%d\n", d[i]);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221561/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221561/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@m = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%c = alloca i32, align 4
%u = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.cond1.preheader.us.preheader, label %for.end26
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count47 = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
%n.vec = and i64 %wide.trip.count47, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count47
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us
%indvars.iv44 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next45, %for.cond1.for.inc6_crit_edge.us ]
br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body
vector.body: ; preds = %for.cond1.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ]
%1 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv44, i64 %index
store <4 x i32> <i32 200000, i32 200000, i32 200000, i32 200000>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 200000, i32 200000, i32 200000, i32 200000>, ptr %2, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader
for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body3.us
for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ]
%arrayidx5.us = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv44, i64 %indvars.iv
store i32 200000, ptr %arrayidx5.us, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count47
br i1 %exitcond.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !13
for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%exitcond48.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count47
br i1 %exitcond48.not, label %for.cond9.preheader, label %for.cond1.preheader.us, !llvm.loop !14
for.cond9.preheader: ; preds = %for.cond1.for.inc6_crit_edge.us
br i1 %cmp37, label %for.body11, label %for.end26
for.body11: ; preds = %for.cond9.preheader, %for.inc24
%i.142 = phi i32 [ %inc25, %for.inc24 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp1439 = icmp sgt i32 %4, 0
br i1 %cmp1439, label %for.body15, label %for.inc24
for.body15: ; preds = %for.body11, %for.body15
%j.140 = phi i32 [ %inc22, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %c)
%5 = load i32, ptr %c, align 4, !tbaa !5
%6 = load i32, ptr %u, align 4, !tbaa !5
%idxprom17 = sext i32 %6 to i64
%7 = load i32, ptr %v, align 4, !tbaa !5
%idxprom19 = sext i32 %7 to i64
%arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %idxprom17, i64 %idxprom19
store i32 %5, ptr %arrayidx20, align 4, !tbaa !5
%inc22 = add nuw nsw i32 %j.140, 1
%8 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc22, %8
br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !15
for.inc24: ; preds = %for.body15, %for.body11
%inc25 = add nuw nsw i32 %i.142, 1
%9 = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc25, %9
br i1 %cmp10, label %for.body11, label %for.end26, !llvm.loop !16
for.end26: ; preds = %for.inc24, %entry, %for.cond9.preheader
call void @dijkstra()
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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 uwtable
define dso_local void @dijkstra() local_unnamed_addr #0 {
entry:
%d = alloca [100 x i32], align 16
%color = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #5
%0 = load i32, ptr @n, align 4, !tbaa !5
%.fr = freeze i32 %0
%cmp109 = icmp sgt i32 %.fr, 0
br i1 %cmp109, label %for.body.preheader, label %for.end77
for.body.preheader: ; preds = %entry
%1 = zext i32 %.fr 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 %.fr, 8
br i1 %min.iters.check, label %for.body.preheader168, label %vector.ph
vector.ph: ; preds = %for.body.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 [100 x i32], ptr %d, i64 0, i64 %index
store <4 x i32> <i32 200000, i32 200000, i32 200000, i32 200000>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> <i32 200000, i32 200000, i32 200000, i32 200000>, 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 !17
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %for.end, label %for.body.preheader168
for.body.preheader168: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader168, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader168 ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv
store i32 200000, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %1
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !18
for.end: ; preds = %for.body, %middle.block
store i32 0, ptr %d, align 16, !tbaa !5
store i32 1, ptr %color, align 16, !tbaa !5
br i1 %cmp109, label %while.cond.us.preheader, label %for.end77
while.cond.us.preheader: ; preds = %for.end
%wide.trip.count157 = zext i32 %.fr to i64
%wide.trip.count162 = zext i32 %.fr to i64
br label %for.body7.us
for.end18.us: ; preds = %for.inc16.us
%cmp19.us = icmp eq i32 %u.1.us, -1
br i1 %cmp19.us, label %for.cond63.preheader, label %if.end21.us
if.end21.us: ; preds = %for.end18.us
%idxprom22.us = sext i32 %u.1.us to i64
%arrayidx23.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom22.us
store i32 2, ptr %arrayidx23.us, align 4, !tbaa !5
%arrayidx40.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom22.us
br label %for.body26.us
for.body26.us: ; preds = %if.end21.us, %for.inc60.us
%indvars.iv159 = phi i64 [ 0, %if.end21.us ], [ %indvars.iv.next160, %for.inc60.us ]
%arrayidx28.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv159
%6 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%cmp29.not.us = icmp eq i32 %6, 2
br i1 %cmp29.not.us, label %for.inc60.us, label %land.lhs.true30.us
land.lhs.true30.us: ; preds = %for.body26.us
%arrayidx34.us = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %idxprom22.us, i64 %indvars.iv159
%7 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5
%cmp35.not.us = icmp eq i32 %7, 200000
br i1 %cmp35.not.us, label %for.inc60.us, label %if.then36.us
if.then36.us: ; preds = %land.lhs.true30.us
%arrayidx38.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv159
%8 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5
%add.us = add nsw i32 %9, %7
%cmp45.us = icmp sgt i32 %8, %add.us
br i1 %cmp45.us, label %if.then46.us, label %for.inc60.us
if.then46.us: ; preds = %if.then36.us
store i32 %add.us, ptr %arrayidx38.us, align 4, !tbaa !5
store i32 1, ptr %arrayidx28.us, align 4, !tbaa !5
br label %for.inc60.us
for.inc60.us: ; preds = %if.then46.us, %if.then36.us, %land.lhs.true30.us, %for.body26.us
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162
br i1 %exitcond163.not, label %for.body7.us.backedge, label %for.body26.us, !llvm.loop !19
for.body7.us: ; preds = %for.body7.us.backedge, %while.cond.us.preheader
%indvars.iv154 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv154.be, %for.body7.us.backedge ]
%u.0114.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0114.us.be, %for.body7.us.backedge ]
%minv.0113.us = phi i32 [ 200000, %while.cond.us.preheader ], [ %minv.0113.us.be, %for.body7.us.backedge ]
%arrayidx9.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv154
%10 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%cmp10.us = icmp sgt i32 %minv.0113.us, %10
br i1 %cmp10.us, label %land.lhs.true.us, label %for.inc16.us
land.lhs.true.us: ; preds = %for.body7.us
%arrayidx12.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv154
%11 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5
%cmp13.not.us = icmp eq i32 %11, 2
%spec.select.us = select i1 %cmp13.not.us, i32 %minv.0113.us, i32 %10
%12 = trunc i64 %indvars.iv154 to i32
%spec.select108.us = select i1 %cmp13.not.us, i32 %u.0114.us, i32 %12
br label %for.inc16.us
for.inc16.us: ; preds = %land.lhs.true.us, %for.body7.us
%minv.1.us = phi i32 [ %minv.0113.us, %for.body7.us ], [ %spec.select.us, %land.lhs.true.us ]
%u.1.us = phi i32 [ %u.0114.us, %for.body7.us ], [ %spec.select108.us, %land.lhs.true.us ]
%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.end18.us, label %for.body7.us.backedge
for.body7.us.backedge: ; preds = %for.inc60.us, %for.inc16.us
%indvars.iv154.be = phi i64 [ %indvars.iv.next155, %for.inc16.us ], [ 0, %for.inc60.us ]
%u.0114.us.be = phi i32 [ %u.1.us, %for.inc16.us ], [ -1, %for.inc60.us ]
%minv.0113.us.be = phi i32 [ %minv.1.us, %for.inc16.us ], [ 200000, %for.inc60.us ]
br label %for.body7.us, !llvm.loop !19
for.cond63.preheader: ; preds = %for.end18.us
%cmp64145 = icmp sgt i32 %.fr, 0
br i1 %cmp64145, label %for.body65, label %for.end77
for.body65: ; preds = %for.cond63.preheader, %for.inc75
%indvars.iv164 = phi i64 [ %indvars.iv.next165, %for.inc75 ], [ 0, %for.cond63.preheader ]
%13 = trunc i64 %indvars.iv164 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%arrayidx67 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv164
%14 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%cmp68 = icmp eq i32 %14, 200000
br i1 %cmp68, label %if.then69, label %if.else
if.then69: ; preds = %for.body65
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc75
if.else: ; preds = %for.body65
%call73 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %14)
br label %for.inc75
for.inc75: ; preds = %if.then69, %if.else
%indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1
%15 = load i32, ptr @n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp64 = icmp slt i64 %indvars.iv.next165, %16
br i1 %cmp64, label %for.body65, label %for.end77, !llvm.loop !20
for.end77: ; preds = %for.inc75, %entry, %for.end, %for.cond63.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !11, !12}
!18 = distinct !{!18, !10, !12, !11}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include<stdio.h>
#define MAX 100
#define INFTY 200000
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n,T[MAX][MAX];
void dijkstra(){
int minv,i,v,u;
int d[MAX],color[MAX];
for(i=0;i<n;i++){
d[i] = INFTY;
color[i] = WHITE;
}
d[0] = 0;
color[0] = GRAY;
while(1){
minv = INFTY;
u = -1;
for(i = 0;i<n;i++){
if(minv>d[i] && color[i] != BLACK){
u = i;
minv = d[i];
}
}
if(u == -1)break;
color[u] = BLACK;
for(v = 0;v<n;v++){
if(color[v] != BLACK && T[u][v] != INFTY){
if(d[v]>d[u]+T[u][v]){
d[v] = d[u] + T[u][v];
color[v] = GRAY;
}
}
}
}
for(i = 0;i<n;i++){
printf("%d",i);
printf(" ");
d[i]= (d[i] == INFTY) ? -1 : d[i];
printf("%d\n",d[i]);
}
}
int main(){
int i,k,c,u,v,j;
scanf("%d",&n);
for(i = 0;i<n;i++){
for(j = 0;j<n;j++){
T[i][j] = INFTY;
}
}
for(i=0;i<n;i++){
scanf("%d %d",&u,&k);
for(j = 0;j<k;j++){
scanf("%d %d",&v,&c);
T[u][v] = c;
}
}
dijkstra();
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221611/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221611/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@T = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @dijkstra() local_unnamed_addr #0 {
entry:
%d = alloca [100 x i32], align 16
%color = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #5
%0 = load i32, ptr @n, align 4, !tbaa !5
%.fr = freeze i32 %0
%cmp114 = icmp sgt i32 %.fr, 0
br i1 %cmp114, label %for.body.preheader, label %for.end79
for.body.preheader: ; preds = %entry
%1 = zext i32 %.fr 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 %.fr, 8
br i1 %min.iters.check, label %for.body.preheader173, label %vector.ph
vector.ph: ; preds = %for.body.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 [100 x i32], ptr %d, i64 0, i64 %index
store <4 x i32> <i32 200000, i32 200000, i32 200000, i32 200000>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> <i32 200000, i32 200000, i32 200000, i32 200000>, 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 !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %for.end, label %for.body.preheader173
for.body.preheader173: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader173, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader173 ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv
store i32 200000, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %1
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block
store i32 0, ptr %d, align 16, !tbaa !5
store i32 1, ptr %color, align 16, !tbaa !5
br i1 %cmp114, label %while.cond.us.preheader, label %for.end79
while.cond.us.preheader: ; preds = %for.end
%wide.trip.count162 = zext i32 %.fr to i64
%wide.trip.count167 = zext i32 %.fr to i64
br label %for.body7.us
for.end18.us: ; preds = %for.inc16.us
%cmp19.us = icmp eq i32 %u.1.us, -1
br i1 %cmp19.us, label %for.cond63.preheader, label %if.end21.us
if.end21.us: ; preds = %for.end18.us
%idxprom22.us = sext i32 %u.1.us to i64
%arrayidx23.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom22.us
store i32 2, ptr %arrayidx23.us, align 4, !tbaa !5
%arrayidx40.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom22.us
br label %for.body26.us
for.body26.us: ; preds = %if.end21.us, %for.inc60.us
%indvars.iv164 = phi i64 [ 0, %if.end21.us ], [ %indvars.iv.next165, %for.inc60.us ]
%arrayidx28.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv164
%6 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%cmp29.not.us = icmp eq i32 %6, 2
br i1 %cmp29.not.us, label %for.inc60.us, label %land.lhs.true30.us
land.lhs.true30.us: ; preds = %for.body26.us
%arrayidx34.us = getelementptr inbounds [100 x [100 x i32]], ptr @T, i64 0, i64 %idxprom22.us, i64 %indvars.iv164
%7 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5
%cmp35.not.us = icmp eq i32 %7, 200000
br i1 %cmp35.not.us, label %for.inc60.us, label %if.then36.us
if.then36.us: ; preds = %land.lhs.true30.us
%arrayidx38.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv164
%8 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5
%add.us = add nsw i32 %9, %7
%cmp45.us = icmp sgt i32 %8, %add.us
br i1 %cmp45.us, label %if.then46.us, label %for.inc60.us
if.then46.us: ; preds = %if.then36.us
store i32 %add.us, ptr %arrayidx38.us, align 4, !tbaa !5
store i32 1, ptr %arrayidx28.us, align 4, !tbaa !5
br label %for.inc60.us
for.inc60.us: ; preds = %if.then46.us, %if.then36.us, %land.lhs.true30.us, %for.body26.us
%indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1
%exitcond168.not = icmp eq i64 %indvars.iv.next165, %wide.trip.count167
br i1 %exitcond168.not, label %for.body7.us.backedge, label %for.body26.us, !llvm.loop !14
for.body7.us: ; preds = %for.body7.us.backedge, %while.cond.us.preheader
%indvars.iv159 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv159.be, %for.body7.us.backedge ]
%u.0119.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0119.us.be, %for.body7.us.backedge ]
%minv.0117.us = phi i32 [ 200000, %while.cond.us.preheader ], [ %minv.0117.us.be, %for.body7.us.backedge ]
%arrayidx9.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv159
%10 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%cmp10.us = icmp sgt i32 %minv.0117.us, %10
br i1 %cmp10.us, label %land.lhs.true.us, label %for.inc16.us
land.lhs.true.us: ; preds = %for.body7.us
%arrayidx12.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv159
%11 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5
%cmp13.not.us = icmp eq i32 %11, 2
%spec.select.us = select i1 %cmp13.not.us, i32 %minv.0117.us, i32 %10
%12 = trunc i64 %indvars.iv159 to i32
%spec.select112.us = select i1 %cmp13.not.us, i32 %u.0119.us, i32 %12
br label %for.inc16.us
for.inc16.us: ; preds = %land.lhs.true.us, %for.body7.us
%minv.1.us = phi i32 [ %minv.0117.us, %for.body7.us ], [ %spec.select.us, %land.lhs.true.us ]
%u.1.us = phi i32 [ %u.0119.us, %for.body7.us ], [ %spec.select112.us, %land.lhs.true.us ]
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162
br i1 %exitcond163.not, label %for.end18.us, label %for.body7.us.backedge
for.body7.us.backedge: ; preds = %for.inc60.us, %for.inc16.us
%indvars.iv159.be = phi i64 [ %indvars.iv.next160, %for.inc16.us ], [ 0, %for.inc60.us ]
%u.0119.us.be = phi i32 [ %u.1.us, %for.inc16.us ], [ -1, %for.inc60.us ]
%minv.0117.us.be = phi i32 [ %minv.1.us, %for.inc16.us ], [ 200000, %for.inc60.us ]
br label %for.body7.us, !llvm.loop !14
for.cond63.preheader: ; preds = %for.end18.us
%cmp64150 = icmp sgt i32 %.fr, 0
br i1 %cmp64150, label %for.body65, label %for.end79
for.body65: ; preds = %for.cond63.preheader, %for.body65
%indvars.iv169 = phi i64 [ %indvars.iv.next170, %for.body65 ], [ 0, %for.cond63.preheader ]
%13 = trunc i64 %indvars.iv169 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13)
%putchar = tail call i32 @putchar(i32 32)
%arrayidx68 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv169
%14 = load i32, ptr %arrayidx68, align 4, !tbaa !5
%cmp69 = icmp eq i32 %14, 200000
%spec.select113 = select i1 %cmp69, i32 -1, i32 %14
store i32 %spec.select113, ptr %arrayidx68, align 4, !tbaa !5
%call76 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.select113)
%indvars.iv.next170 = add nuw nsw i64 %indvars.iv169, 1
%15 = load i32, ptr @n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp64 = icmp slt i64 %indvars.iv.next170, %16
br i1 %cmp64, label %for.body65, label %for.end79, !llvm.loop !15
for.end79: ; preds = %for.body65, %entry, %for.end, %for.cond63.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #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 @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:
%k = alloca i32, align 4
%c = alloca i32, align 4
%u = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.cond1.preheader.us.preheader, label %for.end26
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count47 = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
%n.vec = and i64 %wide.trip.count47, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count47
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us
%indvars.iv44 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next45, %for.cond1.for.inc6_crit_edge.us ]
br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body
vector.body: ; preds = %for.cond1.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ]
%1 = getelementptr inbounds [100 x [100 x i32]], ptr @T, i64 0, i64 %indvars.iv44, i64 %index
store <4 x i32> <i32 200000, i32 200000, i32 200000, i32 200000>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 200000, i32 200000, i32 200000, i32 200000>, ptr %2, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader
for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body3.us
for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ]
%arrayidx5.us = getelementptr inbounds [100 x [100 x i32]], ptr @T, i64 0, i64 %indvars.iv44, i64 %indvars.iv
store i32 200000, ptr %arrayidx5.us, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count47
br i1 %exitcond.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !17
for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%exitcond48.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count47
br i1 %exitcond48.not, label %for.cond9.preheader, label %for.cond1.preheader.us, !llvm.loop !18
for.cond9.preheader: ; preds = %for.cond1.for.inc6_crit_edge.us
br i1 %cmp37, label %for.body11, label %for.end26
for.body11: ; preds = %for.cond9.preheader, %for.inc24
%i.142 = phi i32 [ %inc25, %for.inc24 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %u, ptr noundef nonnull %k)
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp1439 = icmp sgt i32 %4, 0
br i1 %cmp1439, label %for.body15, label %for.inc24
for.body15: ; preds = %for.body11, %for.body15
%j.140 = phi i32 [ %inc22, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %v, ptr noundef nonnull %c)
%5 = load i32, ptr %c, align 4, !tbaa !5
%6 = load i32, ptr %u, align 4, !tbaa !5
%idxprom17 = sext i32 %6 to i64
%7 = load i32, ptr %v, align 4, !tbaa !5
%idxprom19 = sext i32 %7 to i64
%arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr @T, i64 0, i64 %idxprom17, i64 %idxprom19
store i32 %5, ptr %arrayidx20, align 4, !tbaa !5
%inc22 = add nuw nsw i32 %j.140, 1
%8 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc22, %8
br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !19
for.inc24: ; preds = %for.body15, %for.body11
%inc25 = add nuw nsw i32 %i.142, 1
%9 = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc25, %9
br i1 %cmp10, label %for.body11, label %for.end26, !llvm.loop !20
for.end26: ; preds = %for.inc24, %entry, %for.cond9.preheader
call void @dijkstra()
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10, !12, !11}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include <stdio.h>
#define N 101
#define INFTY 200000
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n,M[N][N];
void dijkstra();
int main(){
int i,j;
int k,c,u,v;
scanf("%d",&n);
for(i=0; i<n; i++){
for(j=0; j<n; j++){
M[i][j] = INFTY;
}
}
for(i=0; i<n; i++){
scanf("%d%d",&u,&k);
for(j=0; j<k; j++){
scanf("%d%d",&v,&c);
M[u][v] = c;
}
}
dijkstra();
return 0;
}
void dijkstra(){
int minv;
int d[N],color[N];
int i,u,v;
for(i=0; i<n; i++){
d[i] = INFTY;
color[i] = WHITE;
}
d[0] = 0;
color[0] = GRAY;
while(1){
minv = INFTY;
u=-1;
for(i=0; i<n; i++) {
if(minv > d[i] && color[i] != BLACK){
u = i;
minv = d[i];
}
}
if(u==-1) break;
color[u] = BLACK;
for(v=0; v<n; v++){
if(color[v] != BLACK && M[u][v] != INFTY){
if(d[v] > d[u] + M[u][v]) {
d[v] = d[u] + M[u][v];
color[v] = GRAY;
}
}
}
}
for(i=0; i<n; i++){
printf("%d %d\n",i,d[i]);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221655/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221655/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@M = dso_local local_unnamed_addr global [101 x [101 x i32]] 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:
%k = alloca i32, align 4
%c = alloca i32, align 4
%u = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.cond1.preheader.us.preheader, label %for.end26
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count47 = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
%n.vec = and i64 %wide.trip.count47, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count47
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us
%indvars.iv44 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next45, %for.cond1.for.inc6_crit_edge.us ]
br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body
vector.body: ; preds = %for.cond1.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ]
%1 = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv44, i64 %index
store <4 x i32> <i32 200000, i32 200000, i32 200000, i32 200000>, ptr %1, align 4, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 200000, i32 200000, i32 200000, i32 200000>, ptr %2, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader
for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body3.us
for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ]
%arrayidx5.us = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv44, i64 %indvars.iv
store i32 200000, ptr %arrayidx5.us, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count47
br i1 %exitcond.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !13
for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%exitcond48.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count47
br i1 %exitcond48.not, label %for.cond9.preheader, label %for.cond1.preheader.us, !llvm.loop !14
for.cond9.preheader: ; preds = %for.cond1.for.inc6_crit_edge.us
br i1 %cmp37, label %for.body11, label %for.end26
for.body11: ; preds = %for.cond9.preheader, %for.inc24
%i.142 = phi i32 [ %inc25, %for.inc24 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp1439 = icmp sgt i32 %4, 0
br i1 %cmp1439, label %for.body15, label %for.inc24
for.body15: ; preds = %for.body11, %for.body15
%j.140 = phi i32 [ %inc22, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %c)
%5 = load i32, ptr %c, align 4, !tbaa !5
%6 = load i32, ptr %u, align 4, !tbaa !5
%idxprom17 = sext i32 %6 to i64
%7 = load i32, ptr %v, align 4, !tbaa !5
%idxprom19 = sext i32 %7 to i64
%arrayidx20 = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %idxprom17, i64 %idxprom19
store i32 %5, ptr %arrayidx20, align 4, !tbaa !5
%inc22 = add nuw nsw i32 %j.140, 1
%8 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc22, %8
br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !15
for.inc24: ; preds = %for.body15, %for.body11
%inc25 = add nuw nsw i32 %i.142, 1
%9 = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc25, %9
br i1 %cmp10, label %for.body11, label %for.end26, !llvm.loop !16
for.end26: ; preds = %for.inc24, %entry, %for.cond9.preheader
call void @dijkstra()
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @dijkstra() local_unnamed_addr #0 {
entry:
%d = alloca [101 x i32], align 16
%color = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %color) #4
%0 = load i32, ptr @n, align 4, !tbaa !5
%.fr = freeze i32 %0
%cmp100 = icmp sgt i32 %.fr, 0
br i1 %cmp100, label %for.body.preheader, label %for.end70
for.body.preheader: ; preds = %entry
%1 = zext i32 %.fr 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 %.fr, 8
br i1 %min.iters.check, label %for.body.preheader159, label %vector.ph
vector.ph: ; preds = %for.body.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 [101 x i32], ptr %d, i64 0, i64 %index
store <4 x i32> <i32 200000, i32 200000, i32 200000, i32 200000>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> <i32 200000, i32 200000, i32 200000, i32 200000>, 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 !17
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %for.end, label %for.body.preheader159
for.body.preheader159: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader159, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader159 ]
%arrayidx = getelementptr inbounds [101 x i32], ptr %d, i64 0, i64 %indvars.iv
store i32 200000, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %1
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !18
for.end: ; preds = %for.body, %middle.block
store i32 0, ptr %d, align 16, !tbaa !5
store i32 1, ptr %color, align 16, !tbaa !5
br i1 %cmp100, label %while.cond.us.preheader, label %for.end70
while.cond.us.preheader: ; preds = %for.end
%wide.trip.count148 = zext i32 %.fr to i64
%wide.trip.count153 = zext i32 %.fr to i64
br label %for.body7.us
for.end18.us: ; preds = %for.inc16.us
%cmp19.us = icmp eq i32 %u.1.us, -1
br i1 %cmp19.us, label %for.cond63.preheader, label %if.end21.us
if.end21.us: ; preds = %for.end18.us
%idxprom22.us = sext i32 %u.1.us to i64
%arrayidx23.us = getelementptr inbounds [101 x i32], ptr %color, i64 0, i64 %idxprom22.us
store i32 2, ptr %arrayidx23.us, align 4, !tbaa !5
%arrayidx40.us = getelementptr inbounds [101 x i32], ptr %d, i64 0, i64 %idxprom22.us
br label %for.body26.us
for.body26.us: ; preds = %if.end21.us, %for.inc60.us
%indvars.iv150 = phi i64 [ 0, %if.end21.us ], [ %indvars.iv.next151, %for.inc60.us ]
%arrayidx28.us = getelementptr inbounds [101 x i32], ptr %color, i64 0, i64 %indvars.iv150
%6 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%cmp29.not.us = icmp eq i32 %6, 2
br i1 %cmp29.not.us, label %for.inc60.us, label %land.lhs.true30.us
land.lhs.true30.us: ; preds = %for.body26.us
%arrayidx34.us = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %idxprom22.us, i64 %indvars.iv150
%7 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5
%cmp35.not.us = icmp eq i32 %7, 200000
br i1 %cmp35.not.us, label %for.inc60.us, label %if.then36.us
if.then36.us: ; preds = %land.lhs.true30.us
%arrayidx38.us = getelementptr inbounds [101 x i32], ptr %d, i64 0, i64 %indvars.iv150
%8 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5
%add.us = add nsw i32 %9, %7
%cmp45.us = icmp sgt i32 %8, %add.us
br i1 %cmp45.us, label %if.then46.us, label %for.inc60.us
if.then46.us: ; preds = %if.then36.us
store i32 %add.us, ptr %arrayidx38.us, align 4, !tbaa !5
store i32 1, ptr %arrayidx28.us, align 4, !tbaa !5
br label %for.inc60.us
for.inc60.us: ; preds = %if.then46.us, %if.then36.us, %land.lhs.true30.us, %for.body26.us
%indvars.iv.next151 = add nuw nsw i64 %indvars.iv150, 1
%exitcond154.not = icmp eq i64 %indvars.iv.next151, %wide.trip.count153
br i1 %exitcond154.not, label %for.body7.us.backedge, label %for.body26.us, !llvm.loop !19
for.body7.us: ; preds = %for.body7.us.backedge, %while.cond.us.preheader
%indvars.iv145 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv145.be, %for.body7.us.backedge ]
%u.0105.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0105.us.be, %for.body7.us.backedge ]
%minv.0103.us = phi i32 [ 200000, %while.cond.us.preheader ], [ %minv.0103.us.be, %for.body7.us.backedge ]
%arrayidx9.us = getelementptr inbounds [101 x i32], ptr %d, i64 0, i64 %indvars.iv145
%10 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%cmp10.us = icmp sgt i32 %minv.0103.us, %10
br i1 %cmp10.us, label %land.lhs.true.us, label %for.inc16.us
land.lhs.true.us: ; preds = %for.body7.us
%arrayidx12.us = getelementptr inbounds [101 x i32], ptr %color, i64 0, i64 %indvars.iv145
%11 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5
%cmp13.not.us = icmp eq i32 %11, 2
%spec.select.us = select i1 %cmp13.not.us, i32 %minv.0103.us, i32 %10
%12 = trunc i64 %indvars.iv145 to i32
%spec.select99.us = select i1 %cmp13.not.us, i32 %u.0105.us, i32 %12
br label %for.inc16.us
for.inc16.us: ; preds = %land.lhs.true.us, %for.body7.us
%minv.1.us = phi i32 [ %minv.0103.us, %for.body7.us ], [ %spec.select.us, %land.lhs.true.us ]
%u.1.us = phi i32 [ %u.0105.us, %for.body7.us ], [ %spec.select99.us, %land.lhs.true.us ]
%indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
%exitcond149.not = icmp eq i64 %indvars.iv.next146, %wide.trip.count148
br i1 %exitcond149.not, label %for.end18.us, label %for.body7.us.backedge
for.body7.us.backedge: ; preds = %for.inc60.us, %for.inc16.us
%indvars.iv145.be = phi i64 [ %indvars.iv.next146, %for.inc16.us ], [ 0, %for.inc60.us ]
%u.0105.us.be = phi i32 [ %u.1.us, %for.inc16.us ], [ -1, %for.inc60.us ]
%minv.0103.us.be = phi i32 [ %minv.1.us, %for.inc16.us ], [ 200000, %for.inc60.us ]
br label %for.body7.us, !llvm.loop !19
for.cond63.preheader: ; preds = %for.end18.us
%cmp64136 = icmp sgt i32 %.fr, 0
br i1 %cmp64136, label %for.body65, label %for.end70
for.body65: ; preds = %for.cond63.preheader, %for.body65
%indvars.iv155 = phi i64 [ %indvars.iv.next156, %for.body65 ], [ 0, %for.cond63.preheader ]
%arrayidx67 = getelementptr inbounds [101 x i32], ptr %d, i64 0, i64 %indvars.iv155
%13 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%14 = trunc i64 %indvars.iv155 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14, i32 noundef %13)
%indvars.iv.next156 = add nuw nsw i64 %indvars.iv155, 1
%15 = load i32, ptr @n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp64 = icmp slt i64 %indvars.iv.next156, %16
br i1 %cmp64, label %for.body65, label %for.end70, !llvm.loop !20
for.end70: ; preds = %for.body65, %entry, %for.end, %for.cond63.preheader
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %color) #4
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %d) #4
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !11, !12}
!18 = distinct !{!18, !10, !12, !11}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include <stdio.h>
#include <string.h>
#define MAX_N 100
const int inf = 1<<25;
int n;
int A[MAX_N][MAX_N];
int used[MAX_N];
int mincost[MAX_N];
int main() {
int i, j;
scanf("%d", &n);
memset(A, -1, sizeof(A));
for(i = 0; i < n; i++) {
int u, k;
scanf("%d %d", &u, &k);
for(j = 0; j < k; j++) {
int v, c;
scanf("%d %d", &v, &c);
A[u][v] = c;
}
}
for(i = 0; i < n; i++) {
used[i] = 0;
mincost[i] = inf;
}
mincost[0] = 0;
while(1) {
int v, u = -1;
for(v = 0; v < n; v++) {
if(used[v]) continue;
if(u == -1 || mincost[v] < mincost[u]) u = v;
}
if(u == -1) break;
used[u] = 1;
for(v = 0; v < n; v++) {
if(used[v]) continue;
if(~A[u][v] && mincost[u]+A[u][v] < mincost[v]) {
mincost[v] = mincost[u]+A[u][v];
}
}
}
for(i = 0; i < n; i++) {
printf("%d %d\n", i, mincost[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221705/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221705/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@inf = dso_local local_unnamed_addr constant i32 33554432, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@A = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@used = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@mincost = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@.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:
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
%c = alloca i32, align 4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40000) @A, i8 -1, i64 40000, i1 false)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp124 = icmp sgt i32 %0, 0
br i1 %cmp124, label %for.body, label %for.end20
for.cond11.preheader: ; preds = %for.end
%cmp12126 = icmp sgt i32 %11, 0
br i1 %cmp12126, label %for.body13.preheader, label %for.end20
for.body13.preheader: ; preds = %for.cond11.preheader
%1 = zext i32 %11 to i64
%2 = shl nuw nsw i64 %1, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @used, i8 0, i64 %2, i1 false), !tbaa !5
%min.iters.check = icmp ult i32 %11, 8
br i1 %min.iters.check, label %for.body13.preheader158, label %vector.ph
vector.ph: ; preds = %for.body13.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 [100 x i32], ptr @mincost, i64 0, i64 %index
store <4 x i32> <i32 33554432, i32 33554432, i32 33554432, i32 33554432>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> <i32 33554432, i32 33554432, i32 33554432, i32 33554432>, 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 !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %for.end20, label %for.body13.preheader158
for.body13.preheader158: ; preds = %for.body13.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body13.preheader ], [ %n.vec, %middle.block ]
br label %for.body13
for.body: ; preds = %entry, %for.end
%i.0125 = phi i32 [ %inc9, %for.end ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%6 = load i32, ptr %k, align 4, !tbaa !5
%cmp3122 = icmp sgt i32 %6, 0
br i1 %cmp3122, label %for.body4, label %for.end
for.body4: ; preds = %for.body, %for.body4
%j.0123 = phi i32 [ %inc, %for.body4 ], [ 0, %for.body ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %c)
%7 = load i32, ptr %c, align 4, !tbaa !5
%8 = load i32, ptr %u, align 4, !tbaa !5
%idxprom = sext i32 %8 to i64
%9 = load i32, ptr %v, align 4, !tbaa !5
%idxprom6 = sext i32 %9 to i64
%arrayidx7 = getelementptr inbounds [100 x [100 x i32]], ptr @A, i64 0, i64 %idxprom, i64 %idxprom6
store i32 %7, ptr %arrayidx7, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
%inc = add nuw nsw i32 %j.0123, 1
%10 = load i32, ptr %k, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc, %10
br i1 %cmp3, label %for.body4, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body4, %for.body
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #4
%inc9 = add nuw nsw i32 %i.0125, 1
%11 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc9, %11
br i1 %cmp, label %for.body, label %for.cond11.preheader, !llvm.loop !14
for.body13: ; preds = %for.body13.preheader158, %for.body13
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body13 ], [ %indvars.iv.ph, %for.body13.preheader158 ]
%arrayidx17 = getelementptr inbounds [100 x i32], ptr @mincost, i64 0, i64 %indvars.iv
store i32 33554432, ptr %arrayidx17, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %1
br i1 %exitcond.not, label %for.end20, label %for.body13, !llvm.loop !15
for.end20: ; preds = %for.body13, %middle.block, %entry, %for.cond11.preheader
%cmp12126152 = phi i1 [ false, %for.cond11.preheader ], [ false, %entry ], [ %cmp12126, %middle.block ], [ %cmp12126, %for.body13 ]
%12 = phi i32 [ %11, %for.cond11.preheader ], [ %0, %entry ], [ %11, %middle.block ], [ %11, %for.body13 ]
store i32 0, ptr @mincost, align 16, !tbaa !5
%wide.trip.count141 = zext i32 %12 to i64
%wide.trip.count146 = zext i32 %12 to i64
br i1 %cmp12126152, label %for.body25, label %for.end89
for.body25: ; preds = %for.end20, %for.body25.backedge
%indvars.iv138 = phi i64 [ %indvars.iv138.be, %for.body25.backedge ], [ 0, %for.end20 ]
%u22.0130 = phi i32 [ %u22.0130.be, %for.body25.backedge ], [ -1, %for.end20 ]
%arrayidx27 = getelementptr inbounds [100 x i32], ptr @used, i64 0, i64 %indvars.iv138
%13 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%tobool.not = icmp eq i32 %13, 0
br i1 %tobool.not, label %if.end, label %for.inc36
if.end: ; preds = %for.body25
%cmp28 = icmp eq i32 %u22.0130, -1
br i1 %cmp28, label %if.then34, label %lor.lhs.false
lor.lhs.false: ; preds = %if.end
%arrayidx30 = getelementptr inbounds [100 x i32], ptr @mincost, i64 0, i64 %indvars.iv138
%14 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%idxprom31 = sext i32 %u22.0130 to i64
%arrayidx32 = getelementptr inbounds [100 x i32], ptr @mincost, i64 0, i64 %idxprom31
%15 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%cmp33 = icmp slt i32 %14, %15
br i1 %cmp33, label %if.then34, label %for.inc36
if.then34: ; preds = %lor.lhs.false, %if.end
%16 = trunc i64 %indvars.iv138 to i32
br label %for.inc36
for.inc36: ; preds = %lor.lhs.false, %if.then34, %for.body25
%u22.1 = phi i32 [ %u22.0130, %for.body25 ], [ %16, %if.then34 ], [ %u22.0130, %lor.lhs.false ]
%indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
%exitcond142.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count141
br i1 %exitcond142.not, label %for.end38, label %for.body25.backedge
for.body25.backedge: ; preds = %for.inc36, %cleanup
%indvars.iv138.be = phi i64 [ %indvars.iv.next139, %for.inc36 ], [ 0, %cleanup ]
%u22.0130.be = phi i32 [ %u22.1, %for.inc36 ], [ -1, %cleanup ]
br label %for.body25, !llvm.loop !16
for.end38: ; preds = %for.inc36
%cmp39.not = icmp eq i32 %u22.1, -1
br i1 %cmp39.not, label %for.cond81.preheader, label %if.end41
if.end41: ; preds = %for.end38
%idxprom42 = sext i32 %u22.1 to i64
%arrayidx43 = getelementptr inbounds [100 x i32], ptr @used, i64 0, i64 %idxprom42
store i32 1, ptr %arrayidx43, align 4, !tbaa !5
br i1 %cmp12126152, label %for.body46.lr.ph, label %for.end89
for.body46.lr.ph: ; preds = %if.end41
%arrayidx58 = getelementptr inbounds [100 x i32], ptr @mincost, i64 0, i64 %idxprom42
br label %for.body46
for.body46: ; preds = %for.body46.lr.ph, %for.inc77
%indvars.iv143 = phi i64 [ 0, %for.body46.lr.ph ], [ %indvars.iv.next144, %for.inc77 ]
%arrayidx48 = getelementptr inbounds [100 x i32], ptr @used, i64 0, i64 %indvars.iv143
%17 = load i32, ptr %arrayidx48, align 4, !tbaa !5
%tobool49.not = icmp eq i32 %17, 0
br i1 %tobool49.not, label %if.end51, label %for.inc77
if.end51: ; preds = %for.body46
%arrayidx55 = getelementptr inbounds [100 x [100 x i32]], ptr @A, i64 0, i64 %idxprom42, i64 %indvars.iv143
%18 = load i32, ptr %arrayidx55, align 4, !tbaa !5
%tobool56.not = icmp eq i32 %18, -1
br i1 %tobool56.not, label %for.inc77, label %land.lhs.true
land.lhs.true: ; preds = %if.end51
%19 = load i32, ptr %arrayidx58, align 4, !tbaa !5
%add = add nsw i32 %19, %18
%arrayidx64 = getelementptr inbounds [100 x i32], ptr @mincost, i64 0, i64 %indvars.iv143
%20 = load i32, ptr %arrayidx64, align 4, !tbaa !5
%cmp65 = icmp slt i32 %add, %20
br i1 %cmp65, label %if.then66, label %for.inc77
if.then66: ; preds = %land.lhs.true
store i32 %add, ptr %arrayidx64, align 4, !tbaa !5
br label %for.inc77
for.inc77: ; preds = %if.end51, %land.lhs.true, %if.then66, %for.body46
%indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
%exitcond147.not = icmp eq i64 %indvars.iv.next144, %wide.trip.count146
br i1 %exitcond147.not, label %cleanup, label %for.body46, !llvm.loop !17
cleanup: ; preds = %for.inc77
br i1 %cmp12126152, label %for.body25.backedge, label %for.end89
for.cond81.preheader: ; preds = %for.end38
br i1 %cmp12126152, label %for.body83, label %for.end89
for.body83: ; preds = %for.cond81.preheader, %for.body83
%indvars.iv148 = phi i64 [ %indvars.iv.next149, %for.body83 ], [ 0, %for.cond81.preheader ]
%arrayidx85 = getelementptr inbounds [100 x i32], ptr @mincost, i64 0, i64 %indvars.iv148
%21 = load i32, ptr %arrayidx85, align 4, !tbaa !5
%22 = trunc i64 %indvars.iv148 to i32
%call86 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22, i32 noundef %21)
%indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
%23 = load i32, ptr @n, align 4, !tbaa !5
%24 = sext i32 %23 to i64
%cmp82 = icmp slt i64 %indvars.iv.next149, %24
br i1 %cmp82, label %for.body83, label %for.end89, !llvm.loop !18
for.end89: ; preds = %if.end41, %cleanup, %for.body83, %for.end20, %for.cond81.preheader
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
|
#include <stdio.h>
#define MAX 100
#define INF 1000000
#define W 0
#define B 1
#define NIL -2
int d[MAX],col[MAX],w[MAX][MAX];
void prim(int,int);
void prim(int G,int r){
int u,min,i,pi[100],v;
int count=0;
for(u=0; u < G; u++){
d[u] = INF;
col[u] = W;
pi[u] = NIL;
}
d[r] = 0;
while(1){
min = INF;
for(i=0;i<G;i++){
if(col[i] != B && d[i] < min){
min = d[i];
u = i;
}
}
if(min == INF){
break;
}
col[u] = B;
count++;
for(v=0;v<G;v++){
if(col[v] != B && d[u] + w[u][v] < d[v]){
pi[v] = u;
d[v] =d[u] + w[u][v];
}
}
if(count == G){
break;
}
}
}
int main(){
int g,r,c,v,k,u,i,j;
scanf("%d",&g);
for(i=0;i<g;i++){
for(j=0;j<g;j++){
w[i][j]=INF;
}
}
for(i=0;i<g;i++){
scanf("%d%d",&u,&k);
for(j=0;j<k;j++){
scanf("%d%d",&v,&c);
w[u][v]=c;
// printf("u=%d,k=%d v,c : %d,%d\n",u,k,v,c);
}
}
r=0;
prim(g,r);
for(v=0;v<g;v++){
printf("%d %d\n",v,d[v]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221770/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221770/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@col = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@w = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @prim(i32 noundef %G, i32 noundef %r) local_unnamed_addr #0 {
entry:
%cmp90 = icmp sgt i32 %G, 0
br i1 %cmp90, label %for.body.preheader, label %for.end.thread
for.end.thread: ; preds = %entry
%idxprom5145 = sext i32 %r to i64
%arrayidx6146 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom5145
store i32 0, ptr %arrayidx6146, align 4, !tbaa !5
br label %while.end
for.body.preheader: ; preds = %entry
%0 = zext i32 %G to i64
%1 = shl nuw nsw i64 %0, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @col, i8 0, i64 %1, i1 false), !tbaa !5
%min.iters.check = icmp ult i32 %G, 8
br i1 %min.iters.check, label %for.body.preheader147, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %0, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %index
store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %3, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %0
br i1 %cmp.n, label %for.end, label %for.body.preheader147
for.body.preheader147: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader147, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader147 ]
%arrayidx = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv
store i32 1000000, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block
%idxprom5 = sext i32 %r to i64
%arrayidx6 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom5
store i32 0, ptr %arrayidx6, align 4, !tbaa !5
br i1 %cmp90, label %while.cond.us.preheader, label %while.end
while.cond.us.preheader: ; preds = %for.end
%wide.trip.count142 = zext i32 %G to i64
%xtraiter = and i64 %wide.trip.count142, 1
%5 = icmp eq i32 %G, 1
%unroll_iter = and i64 %wide.trip.count142, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.body9.us.preheader
for.body9.us.preheader: ; preds = %for.cond27.for.end58_crit_edge.us, %while.cond.us.preheader
%u.1.us = phi i32 [ %u.3.us.lcssa, %for.cond27.for.end58_crit_edge.us ], [ %G, %while.cond.us.preheader ]
%count.0.us = phi i32 [ %inc26.us, %for.cond27.for.end58_crit_edge.us ], [ 0, %while.cond.us.preheader ]
br i1 %5, label %for.end20.us.unr-lcssa, label %for.body9.us
for.end20.us.unr-lcssa: ; preds = %for.inc18.us.1, %for.body9.us.preheader
%u.3.us.lcssa.ph = phi i32 [ undef, %for.body9.us.preheader ], [ %u.3.us.1, %for.inc18.us.1 ]
%min.1.us.lcssa.ph = phi i32 [ undef, %for.body9.us.preheader ], [ %min.1.us.1, %for.inc18.us.1 ]
%indvars.iv134.unr = phi i64 [ 0, %for.body9.us.preheader ], [ %indvars.iv.next135.1, %for.inc18.us.1 ]
%min.094.us.unr = phi i32 [ 1000000, %for.body9.us.preheader ], [ %min.1.us.1, %for.inc18.us.1 ]
%u.293.us.unr = phi i32 [ %u.1.us, %for.body9.us.preheader ], [ %u.3.us.1, %for.inc18.us.1 ]
br i1 %lcmp.mod.not, label %for.end20.us, label %for.body9.us.epil
for.body9.us.epil: ; preds = %for.end20.us.unr-lcssa
%arrayidx11.us.epil = getelementptr inbounds [100 x i32], ptr @col, i64 0, i64 %indvars.iv134.unr
%6 = load i32, ptr %arrayidx11.us.epil, align 4, !tbaa !5
%cmp12.not.us.epil = icmp eq i32 %6, 1
br i1 %cmp12.not.us.epil, label %for.end20.us, label %land.lhs.true.us.epil
land.lhs.true.us.epil: ; preds = %for.body9.us.epil
%arrayidx14.us.epil = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv134.unr
%7 = load i32, ptr %arrayidx14.us.epil, align 4, !tbaa !5
%cmp15.us.epil = icmp slt i32 %7, %min.094.us.unr
%8 = trunc i64 %indvars.iv134.unr to i32
%spec.select.us.epil = select i1 %cmp15.us.epil, i32 %8, i32 %u.293.us.unr
%spec.select89.us.epil = tail call i32 @llvm.smin.i32(i32 %7, i32 %min.094.us.unr)
br label %for.end20.us
for.end20.us: ; preds = %for.body9.us.epil, %land.lhs.true.us.epil, %for.end20.us.unr-lcssa
%u.3.us.lcssa = phi i32 [ %u.3.us.lcssa.ph, %for.end20.us.unr-lcssa ], [ %u.293.us.unr, %for.body9.us.epil ], [ %spec.select.us.epil, %land.lhs.true.us.epil ]
%min.1.us.lcssa = phi i32 [ %min.1.us.lcssa.ph, %for.end20.us.unr-lcssa ], [ %min.094.us.unr, %for.body9.us.epil ], [ %spec.select89.us.epil, %land.lhs.true.us.epil ]
%cmp21.us = icmp eq i32 %min.1.us.lcssa, 1000000
br i1 %cmp21.us, label %while.end, label %if.end23.us
if.end23.us: ; preds = %for.end20.us
%idxprom24.us = sext i32 %u.3.us.lcssa to i64
%arrayidx25.us = getelementptr inbounds [100 x i32], ptr @col, i64 0, i64 %idxprom24.us
store i32 1, ptr %arrayidx25.us, align 4, !tbaa !5
%arrayidx35.us = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom24.us
br label %for.body29.us
for.body29.us: ; preds = %if.end23.us, %for.inc56.us
%indvars.iv139 = phi i64 [ 0, %if.end23.us ], [ %indvars.iv.next140, %for.inc56.us ]
%arrayidx31.us = getelementptr inbounds [100 x i32], ptr @col, i64 0, i64 %indvars.iv139
%9 = load i32, ptr %arrayidx31.us, align 4, !tbaa !5
%cmp32.not.us = icmp eq i32 %9, 1
br i1 %cmp32.not.us, label %for.inc56.us, label %land.lhs.true33.us
land.lhs.true33.us: ; preds = %for.body29.us
%10 = load i32, ptr %arrayidx35.us, align 4, !tbaa !5
%arrayidx39.us = getelementptr inbounds [100 x [100 x i32]], ptr @w, i64 0, i64 %idxprom24.us, i64 %indvars.iv139
%11 = load i32, ptr %arrayidx39.us, align 4, !tbaa !5
%add.us = add nsw i32 %11, %10
%arrayidx41.us = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv139
%12 = load i32, ptr %arrayidx41.us, align 4, !tbaa !5
%cmp42.us = icmp slt i32 %add.us, %12
br i1 %cmp42.us, label %if.then43.us, label %for.inc56.us
if.then43.us: ; preds = %land.lhs.true33.us
store i32 %add.us, ptr %arrayidx41.us, align 4, !tbaa !5
br label %for.inc56.us
for.inc56.us: ; preds = %if.then43.us, %land.lhs.true33.us, %for.body29.us
%indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
%exitcond143.not = icmp eq i64 %indvars.iv.next140, %wide.trip.count142
br i1 %exitcond143.not, label %for.cond27.for.end58_crit_edge.us, label %for.body29.us, !llvm.loop !14
for.body9.us: ; preds = %for.body9.us.preheader, %for.inc18.us.1
%indvars.iv134 = phi i64 [ %indvars.iv.next135.1, %for.inc18.us.1 ], [ 0, %for.body9.us.preheader ]
%min.094.us = phi i32 [ %min.1.us.1, %for.inc18.us.1 ], [ 1000000, %for.body9.us.preheader ]
%u.293.us = phi i32 [ %u.3.us.1, %for.inc18.us.1 ], [ %u.1.us, %for.body9.us.preheader ]
%niter = phi i64 [ %niter.next.1, %for.inc18.us.1 ], [ 0, %for.body9.us.preheader ]
%arrayidx11.us = getelementptr inbounds [100 x i32], ptr @col, i64 0, i64 %indvars.iv134
%13 = load i32, ptr %arrayidx11.us, align 8, !tbaa !5
%cmp12.not.us = icmp eq i32 %13, 1
br i1 %cmp12.not.us, label %for.inc18.us, label %land.lhs.true.us
land.lhs.true.us: ; preds = %for.body9.us
%arrayidx14.us = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv134
%14 = load i32, ptr %arrayidx14.us, align 8, !tbaa !5
%cmp15.us = icmp slt i32 %14, %min.094.us
%15 = trunc i64 %indvars.iv134 to i32
%spec.select.us = select i1 %cmp15.us, i32 %15, i32 %u.293.us
%spec.select89.us = tail call i32 @llvm.smin.i32(i32 %14, i32 %min.094.us)
br label %for.inc18.us
for.inc18.us: ; preds = %land.lhs.true.us, %for.body9.us
%u.3.us = phi i32 [ %u.293.us, %for.body9.us ], [ %spec.select.us, %land.lhs.true.us ]
%min.1.us = phi i32 [ %min.094.us, %for.body9.us ], [ %spec.select89.us, %land.lhs.true.us ]
%indvars.iv.next135 = or i64 %indvars.iv134, 1
%arrayidx11.us.1 = getelementptr inbounds [100 x i32], ptr @col, i64 0, i64 %indvars.iv.next135
%16 = load i32, ptr %arrayidx11.us.1, align 4, !tbaa !5
%cmp12.not.us.1 = icmp eq i32 %16, 1
br i1 %cmp12.not.us.1, label %for.inc18.us.1, label %land.lhs.true.us.1
land.lhs.true.us.1: ; preds = %for.inc18.us
%arrayidx14.us.1 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv.next135
%17 = load i32, ptr %arrayidx14.us.1, align 4, !tbaa !5
%cmp15.us.1 = icmp slt i32 %17, %min.1.us
%18 = trunc i64 %indvars.iv.next135 to i32
%spec.select.us.1 = select i1 %cmp15.us.1, i32 %18, i32 %u.3.us
%spec.select89.us.1 = tail call i32 @llvm.smin.i32(i32 %17, i32 %min.1.us)
br label %for.inc18.us.1
for.inc18.us.1: ; preds = %land.lhs.true.us.1, %for.inc18.us
%u.3.us.1 = phi i32 [ %u.3.us, %for.inc18.us ], [ %spec.select.us.1, %land.lhs.true.us.1 ]
%min.1.us.1 = phi i32 [ %min.1.us, %for.inc18.us ], [ %spec.select89.us.1, %land.lhs.true.us.1 ]
%indvars.iv.next135.1 = add nuw nsw i64 %indvars.iv134, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end20.us.unr-lcssa, label %for.body9.us, !llvm.loop !15
for.cond27.for.end58_crit_edge.us: ; preds = %for.inc56.us
%inc26.us = add nuw nsw i32 %count.0.us, 1
%cmp59.us = icmp eq i32 %inc26.us, %G
br i1 %cmp59.us, label %while.end, label %for.body9.us.preheader
while.end: ; preds = %for.end20.us, %for.cond27.for.end58_crit_edge.us, %for.end, %for.end.thread
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%g = alloca i32, align 4
%c = alloca i32, align 4
%v = alloca i32, align 4
%k = alloca i32, align 4
%u = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %g) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %g)
%0 = load i32, ptr %g, align 4, !tbaa !5
%cmp48 = icmp sgt i32 %0, 0
br i1 %cmp48, label %for.cond1.preheader.us.preheader, label %for.end35.sink.split
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count61 = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
%n.vec = and i64 %wide.trip.count61, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count61
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us
%indvars.iv58 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next59, %for.cond1.for.inc6_crit_edge.us ]
br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body
vector.body: ; preds = %for.cond1.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ]
%1 = getelementptr inbounds [100 x [100 x i32]], ptr @w, i64 0, i64 %indvars.iv58, i64 %index
store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %2, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader
for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body3.us
for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ]
%arrayidx5.us = getelementptr inbounds [100 x [100 x i32]], ptr @w, i64 0, i64 %indvars.iv58, i64 %indvars.iv
store i32 1000000, ptr %arrayidx5.us, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count61
br i1 %exitcond.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !17
for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%exitcond62.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count61
br i1 %exitcond62.not, label %for.cond9.preheader, label %for.cond1.preheader.us, !llvm.loop !18
for.cond9.preheader: ; preds = %for.cond1.for.inc6_crit_edge.us
br i1 %cmp48, label %for.body11, label %for.end35.sink.split
for.body11: ; preds = %for.cond9.preheader, %for.inc24
%i.153 = phi i32 [ %inc25, %for.inc24 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp1450 = icmp sgt i32 %4, 0
br i1 %cmp1450, label %for.body15, label %for.inc24
for.body15: ; preds = %for.body11, %for.body15
%j.151 = phi i32 [ %inc22, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %c)
%5 = load i32, ptr %c, align 4, !tbaa !5
%6 = load i32, ptr %u, align 4, !tbaa !5
%idxprom17 = sext i32 %6 to i64
%7 = load i32, ptr %v, align 4, !tbaa !5
%idxprom19 = sext i32 %7 to i64
%arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr @w, i64 0, i64 %idxprom17, i64 %idxprom19
store i32 %5, ptr %arrayidx20, align 4, !tbaa !5
%inc22 = add nuw nsw i32 %j.151, 1
%8 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc22, %8
br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !19
for.inc24: ; preds = %for.body15, %for.body11
%inc25 = add nuw nsw i32 %i.153, 1
%.pr = load i32, ptr %g, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc25, %.pr
br i1 %cmp10, label %for.body11, label %for.end26, !llvm.loop !20
for.end26: ; preds = %for.inc24
%cmp90.i = icmp sgt i32 %.pr, 0
br i1 %cmp90.i, label %for.body.preheader.i, label %for.end35.sink.split
for.body.preheader.i: ; preds = %for.end26
%9 = zext i32 %.pr to i64
%10 = shl nuw nsw i64 %9, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @col, i8 0, i64 %10, i1 false), !tbaa !5
%min.iters.check69 = icmp ult i32 %.pr, 8
br i1 %min.iters.check69, label %for.body.i.preheader, label %vector.ph70
vector.ph70: ; preds = %for.body.preheader.i
%n.vec72 = and i64 %9, 4294967288
br label %vector.body75
vector.body75: ; preds = %vector.body75, %vector.ph70
%index76 = phi i64 [ 0, %vector.ph70 ], [ %index.next77, %vector.body75 ]
%11 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %index76
store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %11, align 16, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 4
store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %12, align 16, !tbaa !5
%index.next77 = add nuw i64 %index76, 8
%13 = icmp eq i64 %index.next77, %n.vec72
br i1 %13, label %middle.block67, label %vector.body75, !llvm.loop !21
middle.block67: ; preds = %vector.body75
%cmp.n74 = icmp eq i64 %n.vec72, %9
br i1 %cmp.n74, label %while.cond.us.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body.preheader.i, %middle.block67
%indvars.iv.i.ph = phi i64 [ 0, %for.body.preheader.i ], [ %n.vec72, %middle.block67 ]
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%arrayidx.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv.i
store i32 1000000, ptr %arrayidx.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %9
br i1 %exitcond.not.i, label %while.cond.us.preheader.i, label %for.body.i, !llvm.loop !22
while.cond.us.preheader.i: ; preds = %for.body.i, %middle.block67
store i32 0, ptr @d, align 16, !tbaa !5
%xtraiter = and i64 %9, 1
%14 = icmp eq i32 %.pr, 1
%unroll_iter = and i64 %9, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.body9.us.preheader.i
for.body9.us.preheader.i: ; preds = %for.cond27.for.end58_crit_edge.us.i, %while.cond.us.preheader.i
%u.1.us.i = phi i32 [ %u.3.us.i.lcssa, %for.cond27.for.end58_crit_edge.us.i ], [ %.pr, %while.cond.us.preheader.i ]
%count.0.us.i = phi i32 [ %inc26.us.i, %for.cond27.for.end58_crit_edge.us.i ], [ 0, %while.cond.us.preheader.i ]
br i1 %14, label %for.end20.us.i.unr-lcssa, label %for.body9.us.i
for.end20.us.i.unr-lcssa: ; preds = %for.inc18.us.i.1, %for.body9.us.preheader.i
%u.3.us.i.lcssa.ph = phi i32 [ undef, %for.body9.us.preheader.i ], [ %u.3.us.i.1, %for.inc18.us.i.1 ]
%min.1.us.i.lcssa.ph = phi i32 [ undef, %for.body9.us.preheader.i ], [ %min.1.us.i.1, %for.inc18.us.i.1 ]
%indvars.iv134.i.unr = phi i64 [ 0, %for.body9.us.preheader.i ], [ %indvars.iv.next135.i.1, %for.inc18.us.i.1 ]
%min.094.us.i.unr = phi i32 [ 1000000, %for.body9.us.preheader.i ], [ %min.1.us.i.1, %for.inc18.us.i.1 ]
%u.293.us.i.unr = phi i32 [ %u.1.us.i, %for.body9.us.preheader.i ], [ %u.3.us.i.1, %for.inc18.us.i.1 ]
br i1 %lcmp.mod.not, label %for.end20.us.i, label %for.body9.us.i.epil
for.body9.us.i.epil: ; preds = %for.end20.us.i.unr-lcssa
%arrayidx11.us.i.epil = getelementptr inbounds [100 x i32], ptr @col, i64 0, i64 %indvars.iv134.i.unr
%15 = load i32, ptr %arrayidx11.us.i.epil, align 4, !tbaa !5
%cmp12.not.us.i.epil = icmp eq i32 %15, 1
br i1 %cmp12.not.us.i.epil, label %for.end20.us.i, label %land.lhs.true.us.i.epil
land.lhs.true.us.i.epil: ; preds = %for.body9.us.i.epil
%arrayidx14.us.i.epil = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv134.i.unr
%16 = load i32, ptr %arrayidx14.us.i.epil, align 4, !tbaa !5
%cmp15.us.i.epil = icmp slt i32 %16, %min.094.us.i.unr
%17 = trunc i64 %indvars.iv134.i.unr to i32
%spec.select.us.i.epil = select i1 %cmp15.us.i.epil, i32 %17, i32 %u.293.us.i.unr
%spec.select89.us.i.epil = call i32 @llvm.smin.i32(i32 %16, i32 %min.094.us.i.unr)
br label %for.end20.us.i
for.end20.us.i: ; preds = %for.body9.us.i.epil, %land.lhs.true.us.i.epil, %for.end20.us.i.unr-lcssa
%u.3.us.i.lcssa = phi i32 [ %u.3.us.i.lcssa.ph, %for.end20.us.i.unr-lcssa ], [ %u.293.us.i.unr, %for.body9.us.i.epil ], [ %spec.select.us.i.epil, %land.lhs.true.us.i.epil ]
%min.1.us.i.lcssa = phi i32 [ %min.1.us.i.lcssa.ph, %for.end20.us.i.unr-lcssa ], [ %min.094.us.i.unr, %for.body9.us.i.epil ], [ %spec.select89.us.i.epil, %land.lhs.true.us.i.epil ]
%cmp21.us.i = icmp eq i32 %min.1.us.i.lcssa, 1000000
br i1 %cmp21.us.i, label %prim.exit, label %if.end23.us.i
if.end23.us.i: ; preds = %for.end20.us.i
%idxprom24.us.i = sext i32 %u.3.us.i.lcssa to i64
%arrayidx25.us.i = getelementptr inbounds [100 x i32], ptr @col, i64 0, i64 %idxprom24.us.i
store i32 1, ptr %arrayidx25.us.i, align 4, !tbaa !5
%arrayidx35.us.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom24.us.i
br label %for.body29.us.i
for.body29.us.i: ; preds = %for.inc56.us.i, %if.end23.us.i
%indvars.iv139.i = phi i64 [ 0, %if.end23.us.i ], [ %indvars.iv.next140.i, %for.inc56.us.i ]
%arrayidx31.us.i = getelementptr inbounds [100 x i32], ptr @col, i64 0, i64 %indvars.iv139.i
%18 = load i32, ptr %arrayidx31.us.i, align 4, !tbaa !5
%cmp32.not.us.i = icmp eq i32 %18, 1
br i1 %cmp32.not.us.i, label %for.inc56.us.i, label %land.lhs.true33.us.i
land.lhs.true33.us.i: ; preds = %for.body29.us.i
%19 = load i32, ptr %arrayidx35.us.i, align 4, !tbaa !5
%arrayidx39.us.i = getelementptr inbounds [100 x [100 x i32]], ptr @w, i64 0, i64 %idxprom24.us.i, i64 %indvars.iv139.i
%20 = load i32, ptr %arrayidx39.us.i, align 4, !tbaa !5
%add.us.i = add nsw i32 %20, %19
%arrayidx41.us.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv139.i
%21 = load i32, ptr %arrayidx41.us.i, align 4, !tbaa !5
%cmp42.us.i = icmp slt i32 %add.us.i, %21
br i1 %cmp42.us.i, label %if.then43.us.i, label %for.inc56.us.i
if.then43.us.i: ; preds = %land.lhs.true33.us.i
store i32 %add.us.i, ptr %arrayidx41.us.i, align 4, !tbaa !5
br label %for.inc56.us.i
for.inc56.us.i: ; preds = %if.then43.us.i, %land.lhs.true33.us.i, %for.body29.us.i
%indvars.iv.next140.i = add nuw nsw i64 %indvars.iv139.i, 1
%exitcond143.not.i = icmp eq i64 %indvars.iv.next140.i, %9
br i1 %exitcond143.not.i, label %for.cond27.for.end58_crit_edge.us.i, label %for.body29.us.i, !llvm.loop !14
for.body9.us.i: ; preds = %for.body9.us.preheader.i, %for.inc18.us.i.1
%indvars.iv134.i = phi i64 [ %indvars.iv.next135.i.1, %for.inc18.us.i.1 ], [ 0, %for.body9.us.preheader.i ]
%min.094.us.i = phi i32 [ %min.1.us.i.1, %for.inc18.us.i.1 ], [ 1000000, %for.body9.us.preheader.i ]
%u.293.us.i = phi i32 [ %u.3.us.i.1, %for.inc18.us.i.1 ], [ %u.1.us.i, %for.body9.us.preheader.i ]
%niter = phi i64 [ %niter.next.1, %for.inc18.us.i.1 ], [ 0, %for.body9.us.preheader.i ]
%arrayidx11.us.i = getelementptr inbounds [100 x i32], ptr @col, i64 0, i64 %indvars.iv134.i
%22 = load i32, ptr %arrayidx11.us.i, align 8, !tbaa !5
%cmp12.not.us.i = icmp eq i32 %22, 1
br i1 %cmp12.not.us.i, label %for.inc18.us.i, label %land.lhs.true.us.i
land.lhs.true.us.i: ; preds = %for.body9.us.i
%arrayidx14.us.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv134.i
%23 = load i32, ptr %arrayidx14.us.i, align 8, !tbaa !5
%cmp15.us.i = icmp slt i32 %23, %min.094.us.i
%24 = trunc i64 %indvars.iv134.i to i32
%spec.select.us.i = select i1 %cmp15.us.i, i32 %24, i32 %u.293.us.i
%spec.select89.us.i = call i32 @llvm.smin.i32(i32 %23, i32 %min.094.us.i)
br label %for.inc18.us.i
for.inc18.us.i: ; preds = %land.lhs.true.us.i, %for.body9.us.i
%u.3.us.i = phi i32 [ %u.293.us.i, %for.body9.us.i ], [ %spec.select.us.i, %land.lhs.true.us.i ]
%min.1.us.i = phi i32 [ %min.094.us.i, %for.body9.us.i ], [ %spec.select89.us.i, %land.lhs.true.us.i ]
%indvars.iv.next135.i = or i64 %indvars.iv134.i, 1
%arrayidx11.us.i.1 = getelementptr inbounds [100 x i32], ptr @col, i64 0, i64 %indvars.iv.next135.i
%25 = load i32, ptr %arrayidx11.us.i.1, align 4, !tbaa !5
%cmp12.not.us.i.1 = icmp eq i32 %25, 1
br i1 %cmp12.not.us.i.1, label %for.inc18.us.i.1, label %land.lhs.true.us.i.1
land.lhs.true.us.i.1: ; preds = %for.inc18.us.i
%arrayidx14.us.i.1 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv.next135.i
%26 = load i32, ptr %arrayidx14.us.i.1, align 4, !tbaa !5
%cmp15.us.i.1 = icmp slt i32 %26, %min.1.us.i
%27 = trunc i64 %indvars.iv.next135.i to i32
%spec.select.us.i.1 = select i1 %cmp15.us.i.1, i32 %27, i32 %u.3.us.i
%spec.select89.us.i.1 = call i32 @llvm.smin.i32(i32 %26, i32 %min.1.us.i)
br label %for.inc18.us.i.1
for.inc18.us.i.1: ; preds = %land.lhs.true.us.i.1, %for.inc18.us.i
%u.3.us.i.1 = phi i32 [ %u.3.us.i, %for.inc18.us.i ], [ %spec.select.us.i.1, %land.lhs.true.us.i.1 ]
%min.1.us.i.1 = phi i32 [ %min.1.us.i, %for.inc18.us.i ], [ %spec.select89.us.i.1, %land.lhs.true.us.i.1 ]
%indvars.iv.next135.i.1 = add nuw nsw i64 %indvars.iv134.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end20.us.i.unr-lcssa, label %for.body9.us.i, !llvm.loop !15
for.cond27.for.end58_crit_edge.us.i: ; preds = %for.inc56.us.i
%inc26.us.i = add nuw nsw i32 %count.0.us.i, 1
%cmp59.us.i = icmp eq i32 %inc26.us.i, %.pr
br i1 %cmp59.us.i, label %prim.exit, label %for.body9.us.preheader.i
prim.exit: ; preds = %for.end20.us.i, %for.cond27.for.end58_crit_edge.us.i
store i32 0, ptr %v, align 4, !tbaa !5
br i1 %cmp90.i, label %for.body29, label %for.end35
for.body29: ; preds = %prim.exit, %for.body29
%storemerge56 = phi i32 [ %inc34, %for.body29 ], [ 0, %prim.exit ]
%idxprom30 = sext i32 %storemerge56 to i64
%arrayidx31 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom30
%28 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %storemerge56, i32 noundef %28)
%29 = load i32, ptr %v, align 4, !tbaa !5
%inc34 = add nsw i32 %29, 1
store i32 %inc34, ptr %v, align 4, !tbaa !5
%30 = load i32, ptr %g, align 4, !tbaa !5
%cmp28 = icmp slt i32 %inc34, %30
br i1 %cmp28, label %for.body29, label %for.end35, !llvm.loop !23
for.end35.sink.split: ; preds = %for.cond9.preheader, %entry, %for.end26
store i32 0, ptr @d, align 16, !tbaa !5
br label %for.end35
for.end35: ; preds = %for.body29, %for.end35.sink.split, %prim.exit
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %g) #6
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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { 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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10, !12, !11}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10, !11, !12}
!22 = distinct !{!22, !10, !12, !11}
!23 = distinct !{!23, !10}
|
#include <stdio.h>
#define INFTY 2000000000
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n,A[100][100];
void dijkstra(){
int i,j,k,u,min,d[100],color[100];
for(i=0;i<n;i++){
d[i]=INFTY;
color[i]=WHITE;
}
d[0]=0;
color[0]=GRAY;
while(1){
min=INFTY;
u=-1;
for(i=0;i<n;i++){
if(min>d[i] && color[i]!=BLACK){
u=i;
min=d[i];
}
}
if(u==-1)
break;
color[u]=BLACK;
for(k=0;k<n;k++){
if(color[k]!=BLACK && A[u][k]!=INFTY){
if(d[k]>d[u]+A[u][k]){
d[k]=d[u]+A[u][k];
color[k]=GRAY;
}
}
}
}
for(i=0;i<n;i++){
if(d[i]==INFTY)
d[i]=-1;
printf("%d %d\n",i,d[i]);
}
}
int main(){
int i,j,u,k,v,c;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
A[i][j]=INFTY;
}
}
for(i=0;i<n;i++){
scanf("%d%d",&u,&k);
for(j=0;j<k;j++){
scanf("%d%d",&v,&c);
A[u][v]=c;
}
}
dijkstra();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221828/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221828/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@A = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @dijkstra() local_unnamed_addr #0 {
entry:
%d = alloca [100 x i32], align 16
%color = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #4
%0 = load i32, ptr @n, align 4, !tbaa !5
%.fr = freeze i32 %0
%cmp109 = icmp sgt i32 %.fr, 0
br i1 %cmp109, label %for.body.preheader, label %for.end77
for.body.preheader: ; preds = %entry
%1 = zext i32 %.fr 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 %.fr, 8
br i1 %min.iters.check, label %for.body.preheader168, label %vector.ph
vector.ph: ; preds = %for.body.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 [100 x i32], ptr %d, i64 0, i64 %index
store <4 x i32> <i32 2000000000, i32 2000000000, i32 2000000000, i32 2000000000>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> <i32 2000000000, i32 2000000000, i32 2000000000, i32 2000000000>, 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 !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %for.end, label %for.body.preheader168
for.body.preheader168: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader168, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader168 ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv
store i32 2000000000, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %1
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block
store i32 0, ptr %d, align 16, !tbaa !5
store i32 1, ptr %color, align 16, !tbaa !5
br i1 %cmp109, label %while.cond.us.preheader, label %for.end77
while.cond.us.preheader: ; preds = %for.end
%wide.trip.count157 = zext i32 %.fr to i64
%wide.trip.count162 = zext i32 %.fr to i64
br label %for.body7.us
for.end18.us: ; preds = %for.inc16.us
%cmp19.us = icmp eq i32 %u.1.us, -1
br i1 %cmp19.us, label %for.cond63.preheader, label %if.end21.us
if.end21.us: ; preds = %for.end18.us
%idxprom22.us = sext i32 %u.1.us to i64
%arrayidx23.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom22.us
store i32 2, ptr %arrayidx23.us, align 4, !tbaa !5
%arrayidx40.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom22.us
br label %for.body26.us
for.body26.us: ; preds = %if.end21.us, %for.inc60.us
%indvars.iv159 = phi i64 [ 0, %if.end21.us ], [ %indvars.iv.next160, %for.inc60.us ]
%arrayidx28.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv159
%6 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%cmp29.not.us = icmp eq i32 %6, 2
br i1 %cmp29.not.us, label %for.inc60.us, label %land.lhs.true30.us
land.lhs.true30.us: ; preds = %for.body26.us
%arrayidx34.us = getelementptr inbounds [100 x [100 x i32]], ptr @A, i64 0, i64 %idxprom22.us, i64 %indvars.iv159
%7 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5
%cmp35.not.us = icmp eq i32 %7, 2000000000
br i1 %cmp35.not.us, label %for.inc60.us, label %if.then36.us
if.then36.us: ; preds = %land.lhs.true30.us
%arrayidx38.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv159
%8 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5
%add.us = add nsw i32 %9, %7
%cmp45.us = icmp sgt i32 %8, %add.us
br i1 %cmp45.us, label %if.then46.us, label %for.inc60.us
if.then46.us: ; preds = %if.then36.us
store i32 %add.us, ptr %arrayidx38.us, align 4, !tbaa !5
store i32 1, ptr %arrayidx28.us, align 4, !tbaa !5
br label %for.inc60.us
for.inc60.us: ; preds = %if.then46.us, %if.then36.us, %land.lhs.true30.us, %for.body26.us
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162
br i1 %exitcond163.not, label %for.body7.us.backedge, label %for.body26.us, !llvm.loop !14
for.body7.us: ; preds = %for.body7.us.backedge, %while.cond.us.preheader
%indvars.iv154 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv154.be, %for.body7.us.backedge ]
%min.0114.us = phi i32 [ 2000000000, %while.cond.us.preheader ], [ %min.0114.us.be, %for.body7.us.backedge ]
%u.0113.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0113.us.be, %for.body7.us.backedge ]
%arrayidx9.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv154
%10 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%cmp10.us = icmp sgt i32 %min.0114.us, %10
br i1 %cmp10.us, label %land.lhs.true.us, label %for.inc16.us
land.lhs.true.us: ; preds = %for.body7.us
%arrayidx12.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv154
%11 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5
%cmp13.not.us = icmp eq i32 %11, 2
%12 = trunc i64 %indvars.iv154 to i32
%spec.select.us = select i1 %cmp13.not.us, i32 %u.0113.us, i32 %12
%spec.select108.us = select i1 %cmp13.not.us, i32 %min.0114.us, i32 %10
br label %for.inc16.us
for.inc16.us: ; preds = %land.lhs.true.us, %for.body7.us
%u.1.us = phi i32 [ %u.0113.us, %for.body7.us ], [ %spec.select.us, %land.lhs.true.us ]
%min.1.us = phi i32 [ %min.0114.us, %for.body7.us ], [ %spec.select108.us, %land.lhs.true.us ]
%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.end18.us, label %for.body7.us.backedge
for.body7.us.backedge: ; preds = %for.inc60.us, %for.inc16.us
%indvars.iv154.be = phi i64 [ %indvars.iv.next155, %for.inc16.us ], [ 0, %for.inc60.us ]
%min.0114.us.be = phi i32 [ %min.1.us, %for.inc16.us ], [ 2000000000, %for.inc60.us ]
%u.0113.us.be = phi i32 [ %u.1.us, %for.inc16.us ], [ -1, %for.inc60.us ]
br label %for.body7.us, !llvm.loop !14
for.cond63.preheader: ; preds = %for.end18.us
%cmp64145 = icmp sgt i32 %.fr, 0
br i1 %cmp64145, label %for.body65, label %for.end77
for.body65: ; preds = %for.cond63.preheader, %for.body65
%indvars.iv164 = phi i64 [ %indvars.iv.next165, %for.body65 ], [ 0, %for.cond63.preheader ]
%arrayidx67 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv164
%13 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%cmp68 = icmp eq i32 %13, 2000000000
%spec.store.select = select i1 %cmp68, i32 -1, i32 %13
store i32 %spec.store.select, ptr %arrayidx67, align 4
%14 = trunc i64 %indvars.iv164 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %14, i32 noundef %spec.store.select)
%indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1
%15 = load i32, ptr @n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp64 = icmp slt i64 %indvars.iv.next165, %16
br i1 %cmp64, label %for.body65, label %for.end77, !llvm.loop !15
for.end77: ; preds = %for.body65, %entry, %for.end, %for.cond63.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #4
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.cond1.preheader.us.preheader, label %for.end26
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count47 = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
%n.vec = and i64 %wide.trip.count47, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count47
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us
%indvars.iv44 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next45, %for.cond1.for.inc6_crit_edge.us ]
br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body
vector.body: ; preds = %for.cond1.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ]
%1 = getelementptr inbounds [100 x [100 x i32]], ptr @A, i64 0, i64 %indvars.iv44, i64 %index
store <4 x i32> <i32 2000000000, i32 2000000000, i32 2000000000, i32 2000000000>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 2000000000, i32 2000000000, i32 2000000000, i32 2000000000>, ptr %2, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader
for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body3.us
for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ]
%arrayidx5.us = getelementptr inbounds [100 x [100 x i32]], ptr @A, i64 0, i64 %indvars.iv44, i64 %indvars.iv
store i32 2000000000, ptr %arrayidx5.us, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count47
br i1 %exitcond.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !17
for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%exitcond48.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count47
br i1 %exitcond48.not, label %for.cond9.preheader, label %for.cond1.preheader.us, !llvm.loop !18
for.cond9.preheader: ; preds = %for.cond1.for.inc6_crit_edge.us
br i1 %cmp37, label %for.body11, label %for.end26
for.body11: ; preds = %for.cond9.preheader, %for.inc24
%i.142 = phi i32 [ %inc25, %for.inc24 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %u, ptr noundef nonnull %k)
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp1439 = icmp sgt i32 %4, 0
br i1 %cmp1439, label %for.body15, label %for.inc24
for.body15: ; preds = %for.body11, %for.body15
%j.140 = phi i32 [ %inc22, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %v, ptr noundef nonnull %c)
%5 = load i32, ptr %c, align 4, !tbaa !5
%6 = load i32, ptr %u, align 4, !tbaa !5
%idxprom17 = sext i32 %6 to i64
%7 = load i32, ptr %v, align 4, !tbaa !5
%idxprom19 = sext i32 %7 to i64
%arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr @A, i64 0, i64 %idxprom17, i64 %idxprom19
store i32 %5, ptr %arrayidx20, align 4, !tbaa !5
%inc22 = add nuw nsw i32 %j.140, 1
%8 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc22, %8
br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !19
for.inc24: ; preds = %for.body15, %for.body11
%inc25 = add nuw nsw i32 %i.142, 1
%9 = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc25, %9
br i1 %cmp10, label %for.body11, label %for.end26, !llvm.loop !20
for.end26: ; preds = %for.inc24, %entry, %for.cond9.preheader
call void @dijkstra()
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10, !12, !11}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include<stdio.h>
#define MAX 100
#define INFTY 10000000
#define WHITE 0
#define GRAY 1
#define BLACK 2
void sssp(void );
int n, G[MAX][MAX];
void sssp(){
int minv,i,v,u;
int d[MAX],color[MAX];
for(i = 0; i < n; i++) {
d[i] = INFTY;
color[i] = WHITE;
}
d[0] = 0;
color[0] = GRAY;
while(1) {
minv = INFTY;
u = -1;
for(i = 0; i < n; i++) {
if(minv > d[i] && color[i] != BLACK) {
u = i;
minv = d[i];
}
}
if(u == -1) {
break;
}
color[u] = BLACK;
for(v = 0; v < n; v++) {
if(color[v] != BLACK && G[u][v] != INFTY) {
if(d[v] > d[u] + G[u][v]) {
d[v] = d[u] + G[u][v];
color[v] = GRAY;
}
}
}
}
for(i = 0; i< n; i++){
printf("%d ",i);
if(d[i] == INFTY) printf("-1\n");
else printf("%d\n", d[i]);
}
}
int main() {
int i,j,k,c,u,v;
scanf("%d", &n);
for(i = 0; i < n; i++)
for(j = 0; j < n; j++)
G[i][j] = INFTY;
for(i = 0; i < n; i++) {
scanf("%d %d", &u, &k);
for(j = 0; j < k; j++) {
scanf("%d %d", &v, &c);
G[u][v] = c;
}
}
sssp();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221871/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221871/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@G = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @sssp() local_unnamed_addr #0 {
entry:
%d = alloca [100 x i32], align 16
%color = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #5
%0 = load i32, ptr @n, align 4, !tbaa !5
%.fr = freeze i32 %0
%cmp109 = icmp sgt i32 %.fr, 0
br i1 %cmp109, label %for.body.preheader, label %for.end77
for.body.preheader: ; preds = %entry
%1 = zext i32 %.fr 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 %.fr, 8
br i1 %min.iters.check, label %for.body.preheader168, label %vector.ph
vector.ph: ; preds = %for.body.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 [100 x i32], ptr %d, i64 0, i64 %index
store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, 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 !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %for.end, label %for.body.preheader168
for.body.preheader168: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader168, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader168 ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv
store i32 10000000, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %1
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block
store i32 0, ptr %d, align 16, !tbaa !5
store i32 1, ptr %color, align 16, !tbaa !5
br i1 %cmp109, label %while.cond.us.preheader, label %for.end77
while.cond.us.preheader: ; preds = %for.end
%wide.trip.count157 = zext i32 %.fr to i64
%wide.trip.count162 = zext i32 %.fr to i64
br label %for.body7.us
for.end18.us: ; preds = %for.inc16.us
%cmp19.us = icmp eq i32 %u.1.us, -1
br i1 %cmp19.us, label %for.cond63.preheader, label %if.end21.us
if.end21.us: ; preds = %for.end18.us
%idxprom22.us = sext i32 %u.1.us to i64
%arrayidx23.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom22.us
store i32 2, ptr %arrayidx23.us, align 4, !tbaa !5
%arrayidx40.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom22.us
br label %for.body26.us
for.body26.us: ; preds = %if.end21.us, %for.inc60.us
%indvars.iv159 = phi i64 [ 0, %if.end21.us ], [ %indvars.iv.next160, %for.inc60.us ]
%arrayidx28.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv159
%6 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%cmp29.not.us = icmp eq i32 %6, 2
br i1 %cmp29.not.us, label %for.inc60.us, label %land.lhs.true30.us
land.lhs.true30.us: ; preds = %for.body26.us
%arrayidx34.us = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %idxprom22.us, i64 %indvars.iv159
%7 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5
%cmp35.not.us = icmp eq i32 %7, 10000000
br i1 %cmp35.not.us, label %for.inc60.us, label %if.then36.us
if.then36.us: ; preds = %land.lhs.true30.us
%arrayidx38.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv159
%8 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5
%add.us = add nsw i32 %9, %7
%cmp45.us = icmp sgt i32 %8, %add.us
br i1 %cmp45.us, label %if.then46.us, label %for.inc60.us
if.then46.us: ; preds = %if.then36.us
store i32 %add.us, ptr %arrayidx38.us, align 4, !tbaa !5
store i32 1, ptr %arrayidx28.us, align 4, !tbaa !5
br label %for.inc60.us
for.inc60.us: ; preds = %if.then46.us, %if.then36.us, %land.lhs.true30.us, %for.body26.us
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162
br i1 %exitcond163.not, label %for.body7.us.backedge, label %for.body26.us, !llvm.loop !14
for.body7.us: ; preds = %for.body7.us.backedge, %while.cond.us.preheader
%indvars.iv154 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv154.be, %for.body7.us.backedge ]
%u.0114.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0114.us.be, %for.body7.us.backedge ]
%minv.0112.us = phi i32 [ 10000000, %while.cond.us.preheader ], [ %minv.0112.us.be, %for.body7.us.backedge ]
%arrayidx9.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv154
%10 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%cmp10.us = icmp sgt i32 %minv.0112.us, %10
br i1 %cmp10.us, label %land.lhs.true.us, label %for.inc16.us
land.lhs.true.us: ; preds = %for.body7.us
%arrayidx12.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv154
%11 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5
%cmp13.not.us = icmp eq i32 %11, 2
%spec.select.us = select i1 %cmp13.not.us, i32 %minv.0112.us, i32 %10
%12 = trunc i64 %indvars.iv154 to i32
%spec.select108.us = select i1 %cmp13.not.us, i32 %u.0114.us, i32 %12
br label %for.inc16.us
for.inc16.us: ; preds = %land.lhs.true.us, %for.body7.us
%minv.1.us = phi i32 [ %minv.0112.us, %for.body7.us ], [ %spec.select.us, %land.lhs.true.us ]
%u.1.us = phi i32 [ %u.0114.us, %for.body7.us ], [ %spec.select108.us, %land.lhs.true.us ]
%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.end18.us, label %for.body7.us.backedge
for.body7.us.backedge: ; preds = %for.inc60.us, %for.inc16.us
%indvars.iv154.be = phi i64 [ %indvars.iv.next155, %for.inc16.us ], [ 0, %for.inc60.us ]
%u.0114.us.be = phi i32 [ %u.1.us, %for.inc16.us ], [ -1, %for.inc60.us ]
%minv.0112.us.be = phi i32 [ %minv.1.us, %for.inc16.us ], [ 10000000, %for.inc60.us ]
br label %for.body7.us, !llvm.loop !14
for.cond63.preheader: ; preds = %for.end18.us
%cmp64145 = icmp sgt i32 %.fr, 0
br i1 %cmp64145, label %for.body65, label %for.end77
for.body65: ; preds = %for.cond63.preheader, %for.inc75
%indvars.iv164 = phi i64 [ %indvars.iv.next165, %for.inc75 ], [ 0, %for.cond63.preheader ]
%13 = trunc i64 %indvars.iv164 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13)
%arrayidx67 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv164
%14 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%cmp68 = icmp eq i32 %14, 10000000
br i1 %cmp68, label %if.then69, label %if.else
if.then69: ; preds = %for.body65
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc75
if.else: ; preds = %for.body65
%call73 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
br label %for.inc75
for.inc75: ; preds = %if.then69, %if.else
%indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1
%15 = load i32, ptr @n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp64 = icmp slt i64 %indvars.iv.next165, %16
br i1 %cmp64, label %for.body65, label %for.end77, !llvm.loop !15
for.end77: ; preds = %for.inc75, %entry, %for.end, %for.cond63.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #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 @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:
%k = alloca i32, align 4
%c = alloca i32, align 4
%u = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.cond1.preheader.us.preheader, label %for.end26
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count47 = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
%n.vec = and i64 %wide.trip.count47, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count47
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us
%indvars.iv44 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next45, %for.cond1.for.inc6_crit_edge.us ]
br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body
vector.body: ; preds = %for.cond1.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ]
%1 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %indvars.iv44, i64 %index
store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, ptr %2, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader
for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body3.us
for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ]
%arrayidx5.us = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %indvars.iv44, i64 %indvars.iv
store i32 10000000, ptr %arrayidx5.us, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count47
br i1 %exitcond.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !17
for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%exitcond48.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count47
br i1 %exitcond48.not, label %for.cond9.preheader, label %for.cond1.preheader.us, !llvm.loop !18
for.cond9.preheader: ; preds = %for.cond1.for.inc6_crit_edge.us
br i1 %cmp37, label %for.body11, label %for.end26
for.body11: ; preds = %for.cond9.preheader, %for.inc24
%i.142 = phi i32 [ %inc25, %for.inc24 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %u, ptr noundef nonnull %k)
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp1439 = icmp sgt i32 %4, 0
br i1 %cmp1439, label %for.body15, label %for.inc24
for.body15: ; preds = %for.body11, %for.body15
%j.140 = phi i32 [ %inc22, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %v, ptr noundef nonnull %c)
%5 = load i32, ptr %c, align 4, !tbaa !5
%6 = load i32, ptr %u, align 4, !tbaa !5
%idxprom17 = sext i32 %6 to i64
%7 = load i32, ptr %v, align 4, !tbaa !5
%idxprom19 = sext i32 %7 to i64
%arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %idxprom17, i64 %idxprom19
store i32 %5, ptr %arrayidx20, align 4, !tbaa !5
%inc22 = add nuw nsw i32 %j.140, 1
%8 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc22, %8
br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !19
for.inc24: ; preds = %for.body15, %for.body11
%inc25 = add nuw nsw i32 %i.142, 1
%9 = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc25, %9
br i1 %cmp10, label %for.body11, label %for.end26, !llvm.loop !20
for.end26: ; preds = %for.inc24, %entry, %for.cond9.preheader
call void @sssp()
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10, !12, !11}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include <stdio.h>
#define MAX 100
#define INF 1000000
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n, G[MAX][MAX];
void dij() {
int i, u, v, min, d[MAX], color[MAX];
for (i = 0; i < n; i++) {
d[i] = INF;
color[i] = WHITE;
}
d[0] = 0;
color[0] = GRAY;
while (1) {
min = INF;
u = -1;
for (i = 0; i < n; i++) {
if (min > d[i] && color[i] != BLACK) {
u = i;
min = d[i];
}
}
if (u == -1) break;
color[u] = BLACK;
for (v = 0; v < n; v++) {
if (color[v] != BLACK && G[u][v] != INF) {
if (d[v] > d[u] + G[u][v]) {
d[v] = d[u] + G[u][v];
color[v] = GRAY;
}
}
}
}
for (i = 0; i < n; i++) {
printf("%d ",i);
if (d[i] == INF) printf("-1\n");
else printf("%d\n",d[i]);
}
}
int main() {
int i, j,u,k,v,c;
scanf("%d", &n);
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
G[i][j] = INF;
}
}
for (i = 0; i < n; i++) {
scanf("%d%d", &u, &k);
for (j = 0; j < k; j++) {
scanf("%d%d", &v, &c);
G[u][v] = c;
}
}
dij();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221914/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221914/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@G = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @dij() local_unnamed_addr #0 {
entry:
%d = alloca [100 x i32], align 16
%color = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #5
%0 = load i32, ptr @n, align 4, !tbaa !5
%.fr = freeze i32 %0
%cmp109 = icmp sgt i32 %.fr, 0
br i1 %cmp109, label %for.body.preheader, label %for.end77
for.body.preheader: ; preds = %entry
%1 = zext i32 %.fr 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 %.fr, 8
br i1 %min.iters.check, label %for.body.preheader168, label %vector.ph
vector.ph: ; preds = %for.body.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 [100 x i32], ptr %d, i64 0, i64 %index
store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, 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 !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %for.end, label %for.body.preheader168
for.body.preheader168: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader168, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader168 ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv
store i32 1000000, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %1
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block
store i32 0, ptr %d, align 16, !tbaa !5
store i32 1, ptr %color, align 16, !tbaa !5
br i1 %cmp109, label %while.cond.us.preheader, label %for.end77
while.cond.us.preheader: ; preds = %for.end
%wide.trip.count157 = zext i32 %.fr to i64
%wide.trip.count162 = zext i32 %.fr to i64
br label %for.body7.us
for.end18.us: ; preds = %for.inc16.us
%cmp19.us = icmp eq i32 %u.1.us, -1
br i1 %cmp19.us, label %for.cond63.preheader, label %if.end21.us
if.end21.us: ; preds = %for.end18.us
%idxprom22.us = sext i32 %u.1.us to i64
%arrayidx23.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom22.us
store i32 2, ptr %arrayidx23.us, align 4, !tbaa !5
%arrayidx40.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom22.us
br label %for.body26.us
for.body26.us: ; preds = %if.end21.us, %for.inc60.us
%indvars.iv159 = phi i64 [ 0, %if.end21.us ], [ %indvars.iv.next160, %for.inc60.us ]
%arrayidx28.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv159
%6 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%cmp29.not.us = icmp eq i32 %6, 2
br i1 %cmp29.not.us, label %for.inc60.us, label %land.lhs.true30.us
land.lhs.true30.us: ; preds = %for.body26.us
%arrayidx34.us = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %idxprom22.us, i64 %indvars.iv159
%7 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5
%cmp35.not.us = icmp eq i32 %7, 1000000
br i1 %cmp35.not.us, label %for.inc60.us, label %if.then36.us
if.then36.us: ; preds = %land.lhs.true30.us
%arrayidx38.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv159
%8 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5
%add.us = add nsw i32 %9, %7
%cmp45.us = icmp sgt i32 %8, %add.us
br i1 %cmp45.us, label %if.then46.us, label %for.inc60.us
if.then46.us: ; preds = %if.then36.us
store i32 %add.us, ptr %arrayidx38.us, align 4, !tbaa !5
store i32 1, ptr %arrayidx28.us, align 4, !tbaa !5
br label %for.inc60.us
for.inc60.us: ; preds = %if.then46.us, %if.then36.us, %land.lhs.true30.us, %for.body26.us
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162
br i1 %exitcond163.not, label %for.body7.us.backedge, label %for.body26.us, !llvm.loop !14
for.body7.us: ; preds = %for.body7.us.backedge, %while.cond.us.preheader
%indvars.iv154 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv154.be, %for.body7.us.backedge ]
%min.0114.us = phi i32 [ 1000000, %while.cond.us.preheader ], [ %min.0114.us.be, %for.body7.us.backedge ]
%u.0113.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0113.us.be, %for.body7.us.backedge ]
%arrayidx9.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv154
%10 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%cmp10.us = icmp sgt i32 %min.0114.us, %10
br i1 %cmp10.us, label %land.lhs.true.us, label %for.inc16.us
land.lhs.true.us: ; preds = %for.body7.us
%arrayidx12.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv154
%11 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5
%cmp13.not.us = icmp eq i32 %11, 2
%12 = trunc i64 %indvars.iv154 to i32
%spec.select.us = select i1 %cmp13.not.us, i32 %u.0113.us, i32 %12
%spec.select108.us = select i1 %cmp13.not.us, i32 %min.0114.us, i32 %10
br label %for.inc16.us
for.inc16.us: ; preds = %land.lhs.true.us, %for.body7.us
%u.1.us = phi i32 [ %u.0113.us, %for.body7.us ], [ %spec.select.us, %land.lhs.true.us ]
%min.1.us = phi i32 [ %min.0114.us, %for.body7.us ], [ %spec.select108.us, %land.lhs.true.us ]
%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.end18.us, label %for.body7.us.backedge
for.body7.us.backedge: ; preds = %for.inc60.us, %for.inc16.us
%indvars.iv154.be = phi i64 [ %indvars.iv.next155, %for.inc16.us ], [ 0, %for.inc60.us ]
%min.0114.us.be = phi i32 [ %min.1.us, %for.inc16.us ], [ 1000000, %for.inc60.us ]
%u.0113.us.be = phi i32 [ %u.1.us, %for.inc16.us ], [ -1, %for.inc60.us ]
br label %for.body7.us, !llvm.loop !14
for.cond63.preheader: ; preds = %for.end18.us
%cmp64145 = icmp sgt i32 %.fr, 0
br i1 %cmp64145, label %for.body65, label %for.end77
for.body65: ; preds = %for.cond63.preheader, %for.inc75
%indvars.iv164 = phi i64 [ %indvars.iv.next165, %for.inc75 ], [ 0, %for.cond63.preheader ]
%13 = trunc i64 %indvars.iv164 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13)
%arrayidx67 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv164
%14 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%cmp68 = icmp eq i32 %14, 1000000
br i1 %cmp68, label %if.then69, label %if.else
if.then69: ; preds = %for.body65
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc75
if.else: ; preds = %for.body65
%call73 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
br label %for.inc75
for.inc75: ; preds = %if.then69, %if.else
%indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1
%15 = load i32, ptr @n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp64 = icmp slt i64 %indvars.iv.next165, %16
br i1 %cmp64, label %for.body65, label %for.end77, !llvm.loop !15
for.end77: ; preds = %for.inc75, %entry, %for.end, %for.cond63.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #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 @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:
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.cond1.preheader.us.preheader, label %for.end26
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count47 = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
%n.vec = and i64 %wide.trip.count47, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count47
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us
%indvars.iv44 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next45, %for.cond1.for.inc6_crit_edge.us ]
br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body
vector.body: ; preds = %for.cond1.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ]
%1 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %indvars.iv44, i64 %index
store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %2, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader
for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body3.us
for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ]
%arrayidx5.us = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %indvars.iv44, i64 %indvars.iv
store i32 1000000, ptr %arrayidx5.us, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count47
br i1 %exitcond.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !17
for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%exitcond48.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count47
br i1 %exitcond48.not, label %for.cond9.preheader, label %for.cond1.preheader.us, !llvm.loop !18
for.cond9.preheader: ; preds = %for.cond1.for.inc6_crit_edge.us
br i1 %cmp37, label %for.body11, label %for.end26
for.body11: ; preds = %for.cond9.preheader, %for.inc24
%i.142 = phi i32 [ %inc25, %for.inc24 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %u, ptr noundef nonnull %k)
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp1439 = icmp sgt i32 %4, 0
br i1 %cmp1439, label %for.body15, label %for.inc24
for.body15: ; preds = %for.body11, %for.body15
%j.140 = phi i32 [ %inc22, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %v, ptr noundef nonnull %c)
%5 = load i32, ptr %c, align 4, !tbaa !5
%6 = load i32, ptr %u, align 4, !tbaa !5
%idxprom17 = sext i32 %6 to i64
%7 = load i32, ptr %v, align 4, !tbaa !5
%idxprom19 = sext i32 %7 to i64
%arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %idxprom17, i64 %idxprom19
store i32 %5, ptr %arrayidx20, align 4, !tbaa !5
%inc22 = add nuw nsw i32 %j.140, 1
%8 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc22, %8
br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !19
for.inc24: ; preds = %for.body15, %for.body11
%inc25 = add nuw nsw i32 %i.142, 1
%9 = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc25, %9
br i1 %cmp10, label %for.body11, label %for.end26, !llvm.loop !20
for.end26: ; preds = %for.inc24, %entry, %for.cond9.preheader
call void @dij()
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10, !12, !11}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include<stdio.h>
typedef struct{
int have;
int link[100];
int min;
int weight[100];
int flag;
}Tree;
Tree data[100];
void input(int);
void shokika(int);
void shori(int,int,int);
void listprint(int);
void debug_listprint1(int);
void debug_listprint2(int);
int main(){
int n, i;
scanf("%d",&n);
shokika(n);
input(n);
//debug_listprint1(n);
shori(0,0,-1);
listprint(n);
return 0;
}
void shori(int now, int weight, int back)
{
int i, x, a;
data[now].flag = 1;
for(i = 0; data[now].link[i] != -1; i++)
{
//debug_listprint2(5);
x = data[now].weight[i];
a = data[now].link[i];
if(data[a].min > weight + x && data[a].flag == 0 && a != back)
{
//printf("data[%d].link[%d] = %d|weight:%d|t_weight:%d\n",now,i,a,x,weight);
//printf("%d → %d\n",now,data[now].link[i]);
data[data[now].link[i]].min = weight + x;
shori(data[now].link[i], weight + data[now].weight[i], now);
//printf("%d ← %d\n",now,data[now].link[i]);
}
}
data[now].flag = 0;
}
void debug_listprint1(int n)
{
int i, j;
for(i = 0; i < n; i++)
{
printf("---------\n");
printf("%d:link-%d-\n",i,data[i].have);
for(j = 0; j < data[i].have; j++)
{
printf("%d:%d → %d : ",j,i,data[i].link[j]);
printf("weight -%d-\n",data[i].weight[j]);
}
}
}
void debug_listprint2(int n)
{
int i;
printf("------------------\n");
for(i = 0; i < n; i++)
{
printf("data[%d].flag = %d||data[%d].min = %d\n",i,data[i].flag,i,data[i].min);
}
printf("------------------\n");
}
void shokika(int n)
{
int i, j;
for(i = 0; i < n; i++)
{
for(j = 0; j < n; j++)
{
data[i].link[j] = -1;
data[i].weight[j] = -1;
}
data[i].min = 99999999;
data[i].flag = 0;
}
data[0].min = 0;
}
void input(int n)
{
int i, j, x;
for(i = 0; i < n; i++)
{
scanf("%d%d",&x,&data[i].have);
for(j = 0; j < data[i].have; j++)
{
scanf("%d",&data[i].link[j]);
scanf("%d",&data[i].weight[j]);
}
}
}
void listprint(int n)
{
int i;
for(i = 0; i < n; i++)printf("%d %d\n", i, data[i].min);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_221958/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_221958/source.c"
target datalayout = "e-m:e-p270: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.Tree = type { i32, [100 x i32], i32, [100 x i32], i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@data = dso_local global [100 x %struct.Tree] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [13 x i8] c"%d:link-%d-\0A\00", align 1
@.str.3 = private unnamed_addr constant [16 x i8] c"%d:%d \E2\86\92 %d : \00", align 1
@.str.4 = private unnamed_addr constant [13 x i8] c"weight -%d-\0A\00", align 1
@.str.6 = private unnamed_addr constant [39 x i8] c"data[%d].flag = %d||data[%d].min = %d\0A\00", align 1
@.str.7 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.8 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@str = private unnamed_addr constant [10 x i8] c"---------\00", align 1
@str.10 = private unnamed_addr constant [19 x i8] c"------------------\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x.i = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp28.i = icmp sgt i32 %0, 0
br i1 %cmp28.i, label %for.cond1.preheader.us.preheader.i, label %shokika.exit.thread
shokika.exit.thread: ; preds = %entry
store i32 0, ptr getelementptr inbounds ([100 x %struct.Tree], ptr @data, i64 0, i64 0, i32 2), align 4, !tbaa !9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x.i) #6
br label %input.exit
for.cond1.preheader.us.preheader.i: ; preds = %entry
%wide.trip.count34.i = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 4
%n.vec = and i64 %wide.trip.count34.i, 4294967292
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count34.i
br label %for.cond1.preheader.us.i
for.cond1.preheader.us.i: ; preds = %for.cond1.for.end_crit_edge.us.i, %for.cond1.preheader.us.preheader.i
%indvars.iv31.i = phi i64 [ 0, %for.cond1.preheader.us.preheader.i ], [ %indvars.iv.next32.i, %for.cond1.for.end_crit_edge.us.i ]
br i1 %min.iters.check, label %for.body3.us.i.preheader, label %vector.body
vector.body: ; preds = %for.cond1.preheader.us.i, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us.i ]
%1 = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv31.i, i32 1, i64 %index
store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %1, align 4, !tbaa !5
%2 = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv31.i, i32 3, i64 %index
store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %2, align 4, !tbaa !5
%index.next = add nuw i64 %index, 4
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond1.for.end_crit_edge.us.i, label %for.body3.us.i.preheader
for.body3.us.i.preheader: ; preds = %for.cond1.preheader.us.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %for.cond1.preheader.us.i ], [ %n.vec, %middle.block ]
br label %for.body3.us.i
for.body3.us.i: ; preds = %for.body3.us.i.preheader, %for.body3.us.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body3.us.i ], [ %indvars.iv.i.ph, %for.body3.us.i.preheader ]
%arrayidx5.us.i = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv31.i, i32 1, i64 %indvars.iv.i
store i32 -1, ptr %arrayidx5.us.i, align 4, !tbaa !5
%arrayidx9.us.i = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv31.i, i32 3, i64 %indvars.iv.i
store i32 -1, ptr %arrayidx9.us.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count34.i
br i1 %exitcond.not.i, label %for.cond1.for.end_crit_edge.us.i, label %for.body3.us.i, !llvm.loop !15
for.cond1.for.end_crit_edge.us.i: ; preds = %for.body3.us.i, %middle.block
%min.us.i = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv31.i, i32 2
store i32 99999999, ptr %min.us.i, align 4, !tbaa !9
%flag.us.i = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv31.i, i32 4
store i32 0, ptr %flag.us.i, align 4, !tbaa !16
%indvars.iv.next32.i = add nuw nsw i64 %indvars.iv31.i, 1
%exitcond35.not.i = icmp eq i64 %indvars.iv.next32.i, %wide.trip.count34.i
br i1 %exitcond35.not.i, label %shokika.exit, label %for.cond1.preheader.us.i, !llvm.loop !17
shokika.exit: ; preds = %for.cond1.for.end_crit_edge.us.i
store i32 0, ptr getelementptr inbounds ([100 x %struct.Tree], ptr @data, i64 0, i64 0, i32 2), align 4, !tbaa !9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x.i) #6
br label %for.body.i
for.body.i: ; preds = %for.inc17.i, %shokika.exit
%indvars.iv33.i = phi i64 [ 0, %shokika.exit ], [ %indvars.iv.next34.i, %for.inc17.i ]
%arrayidx.i = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv33.i
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull %x.i, ptr noundef nonnull %arrayidx.i)
%4 = load i32, ptr %arrayidx.i, align 4, !tbaa !18
%cmp528.i = icmp sgt i32 %4, 0
br i1 %cmp528.i, label %for.body6.i, label %for.inc17.i
for.body6.i: ; preds = %for.body.i, %for.body6.i
%indvars.iv.i2 = phi i64 [ %indvars.iv.next.i3, %for.body6.i ], [ 0, %for.body.i ]
%arrayidx10.i = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv33.i, i32 1, i64 %indvars.iv.i2
%call11.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx10.i)
%arrayidx15.i = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv33.i, i32 3, i64 %indvars.iv.i2
%call16.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx15.i)
%indvars.iv.next.i3 = add nuw nsw i64 %indvars.iv.i2, 1
%5 = load i32, ptr %arrayidx.i, align 4, !tbaa !18
%6 = sext i32 %5 to i64
%cmp5.i = icmp slt i64 %indvars.iv.next.i3, %6
br i1 %cmp5.i, label %for.body6.i, label %for.inc17.i, !llvm.loop !19
for.inc17.i: ; preds = %for.body6.i, %for.body.i
%indvars.iv.next34.i = add nuw nsw i64 %indvars.iv33.i, 1
%exitcond.not.i1 = icmp eq i64 %indvars.iv.next34.i, %wide.trip.count34.i
br i1 %exitcond.not.i1, label %input.exit, label %for.body.i, !llvm.loop !20
input.exit: ; preds = %for.inc17.i, %shokika.exit.thread
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x.i) #6
call void @shori(i32 noundef 0, i32 noundef 0, i32 noundef -1)
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp4.i = icmp sgt i32 %7, 0
br i1 %cmp4.i, label %for.body.preheader.i4, label %listprint.exit
for.body.preheader.i4: ; preds = %input.exit
%wide.trip.count.i5 = zext i32 %7 to i64
br label %for.body.i6
for.body.i6: ; preds = %for.body.i6, %for.body.preheader.i4
%indvars.iv.i7 = phi i64 [ 0, %for.body.preheader.i4 ], [ %indvars.iv.next.i9, %for.body.i6 ]
%min.i = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv.i7, i32 2
%8 = load i32, ptr %min.i, align 4, !tbaa !9
%9 = trunc i64 %indvars.iv.i7 to i32
%call.i8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %9, i32 noundef %8)
%indvars.iv.next.i9 = add nuw nsw i64 %indvars.iv.i7, 1
%exitcond.not.i10 = icmp eq i64 %indvars.iv.next.i9, %wide.trip.count.i5
br i1 %exitcond.not.i10, label %listprint.exit, label %for.body.i6, !llvm.loop !21
listprint.exit: ; preds = %for.body.i6, %input.exit
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: nofree norecurse nosync nounwind memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @shokika(i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp28 = icmp sgt i32 %n, 0
br i1 %cmp28, label %for.cond1.preheader.us.preheader, label %for.end16
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count34 = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 4
%n.vec = and i64 %wide.trip.count34, 4294967292
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count34
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.end_crit_edge.us
%indvars.iv31 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next32, %for.cond1.for.end_crit_edge.us ]
br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body
vector.body: ; preds = %for.cond1.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ]
%0 = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv31, i32 1, i64 %index
store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %0, align 4, !tbaa !5
%1 = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv31, i32 3, i64 %index
store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %1, align 4, !tbaa !5
%index.next = add nuw i64 %index, 4
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !22
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond1.for.end_crit_edge.us, label %for.body3.us.preheader
for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body3.us
for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ]
%arrayidx5.us = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv31, i32 1, i64 %indvars.iv
store i32 -1, ptr %arrayidx5.us, align 4, !tbaa !5
%arrayidx9.us = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv31, i32 3, i64 %indvars.iv
store i32 -1, ptr %arrayidx9.us, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count34
br i1 %exitcond.not, label %for.cond1.for.end_crit_edge.us, label %for.body3.us, !llvm.loop !23
for.cond1.for.end_crit_edge.us: ; preds = %for.body3.us, %middle.block
%min.us = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv31, i32 2
store i32 99999999, ptr %min.us, align 4, !tbaa !9
%flag.us = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv31, i32 4
store i32 0, ptr %flag.us, align 4, !tbaa !16
%indvars.iv.next32 = add nuw nsw i64 %indvars.iv31, 1
%exitcond35.not = icmp eq i64 %indvars.iv.next32, %wide.trip.count34
br i1 %exitcond35.not, label %for.end16, label %for.cond1.preheader.us, !llvm.loop !17
for.end16: ; preds = %for.cond1.for.end_crit_edge.us, %entry
store i32 0, ptr getelementptr inbounds ([100 x %struct.Tree], ptr @data, i64 0, i64 0, i32 2), align 4, !tbaa !9
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @input(i32 noundef %n) local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6
%cmp30 = icmp sgt i32 %n, 0
br i1 %cmp30, label %for.body.preheader, label %for.end19
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc17
%indvars.iv33 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next34, %for.inc17 ]
%arrayidx = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv33
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull %x, ptr noundef nonnull %arrayidx)
%0 = load i32, ptr %arrayidx, align 4, !tbaa !18
%cmp528 = icmp sgt i32 %0, 0
br i1 %cmp528, label %for.body6, label %for.inc17
for.body6: ; preds = %for.body, %for.body6
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body6 ], [ 0, %for.body ]
%arrayidx10 = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv33, i32 1, i64 %indvars.iv
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx10)
%arrayidx15 = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv33, i32 3, i64 %indvars.iv
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx15)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %arrayidx, align 4, !tbaa !18
%2 = sext i32 %1 to i64
%cmp5 = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp5, label %for.body6, label %for.inc17, !llvm.loop !19
for.inc17: ; preds = %for.body6, %for.body
%indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
%exitcond.not = icmp eq i64 %indvars.iv.next34, %wide.trip.count
br i1 %exitcond.not, label %for.end19, label %for.body, !llvm.loop !20
for.end19: ; preds = %for.inc17, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @shori(i32 noundef %now, i32 noundef %weight, i32 noundef %back) local_unnamed_addr #4 {
entry:
%idxprom = sext i32 %now to i64
%flag = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %idxprom, i32 4
store i32 1, ptr %flag, align 4, !tbaa !16
%arrayidx466 = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %idxprom, i32 1, i64 0
%0 = load i32, ptr %arrayidx466, align 4, !tbaa !5
%cmp.not67 = icmp eq i32 %0, -1
br i1 %cmp.not67, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%1 = phi i32 [ %7, %for.inc ], [ %0, %entry ]
%arrayidx470 = phi ptr [ %arrayidx4, %for.inc ], [ %arrayidx466, %entry ]
%arrayidx9 = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %idxprom, i32 3, i64 %indvars.iv
%2 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%idxprom15 = sext i32 %1 to i64
%min = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %idxprom15, i32 2
%3 = load i32, ptr %min, align 4, !tbaa !9
%add = add nsw i32 %2, %weight
%cmp17 = icmp sgt i32 %3, %add
br i1 %cmp17, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%flag20 = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %idxprom15, i32 4
%4 = load i32, ptr %flag20, align 4, !tbaa !16
%cmp21 = icmp ne i32 %4, 0
%cmp23.not = icmp eq i32 %1, %back
%or.cond = or i1 %cmp23.not, %cmp21
br i1 %or.cond, label %for.inc, label %if.then
if.then: ; preds = %land.lhs.true
store i32 %add, ptr %min, align 4, !tbaa !9
%5 = load i32, ptr %arrayidx470, align 4, !tbaa !5
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%add43 = add nsw i32 %6, %weight
tail call void @shori(i32 noundef %5, i32 noundef %add43, i32 noundef %now)
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %if.then
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx4 = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %idxprom, i32 1, i64 %indvars.iv.next
%7 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp.not = icmp eq i32 %7, -1
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !24
for.end: ; preds = %for.inc, %entry
store i32 0, ptr %flag, align 4, !tbaa !16
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @listprint(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp4 = icmp sgt i32 %n, 0
br i1 %cmp4, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%min = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv, i32 2
%0 = load i32, ptr %min, align 4, !tbaa !9
%1 = trunc i64 %indvars.iv to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %1, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !21
for.end: ; preds = %for.body, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @debug_listprint1(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp34 = icmp sgt i32 %n, 0
br i1 %cmp34, label %for.body.preheader, label %for.end20
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc18
%indvars.iv37 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next38, %for.inc18 ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
%arrayidx = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv37
%0 = load i32, ptr %arrayidx, align 4, !tbaa !18
%1 = trunc i64 %indvars.iv37 to i32
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %1, i32 noundef %0)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !18
%cmp632 = icmp sgt i32 %2, 0
br i1 %cmp632, label %for.body7, label %for.inc18
for.body7: ; preds = %for.body, %for.body7
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body7 ], [ 0, %for.body ]
%arrayidx11 = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv37, i32 1, i64 %indvars.iv
%3 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%4 = trunc i64 %indvars.iv to i32
%call12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %4, i32 noundef %1, i32 noundef %3)
%arrayidx16 = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv37, i32 3, i64 %indvars.iv
%5 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%call17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %5)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %arrayidx, align 4, !tbaa !18
%7 = sext i32 %6 to i64
%cmp6 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp6, label %for.body7, label %for.inc18, !llvm.loop !25
for.inc18: ; preds = %for.body7, %for.body
%indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
%exitcond.not = icmp eq i64 %indvars.iv.next38, %wide.trip.count
br i1 %exitcond.not, label %for.end20, label %for.body, !llvm.loop !26
for.end20: ; preds = %for.inc18, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @debug_listprint2(i32 noundef %n) local_unnamed_addr #0 {
entry:
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
%cmp11 = icmp sgt i32 %n, 0
br i1 %cmp11, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%flag = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv, i32 4
%0 = load i32, ptr %flag, align 4, !tbaa !16
%min = getelementptr inbounds [100 x %struct.Tree], ptr @data, i64 0, i64 %indvars.iv, i32 2
%1 = load i32, ptr %min, align 4, !tbaa !9
%2 = trunc i64 %indvars.iv to i32
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %2, i32 noundef %0, i32 noundef %2, i32 noundef %1)
%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 !27
for.end: ; preds = %for.body, %entry
%puts10 = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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(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 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!10, !6, i64 404}
!10 = !{!"", !6, i64 0, !7, i64 4, !6, i64 404, !7, i64 408, !6, i64 808}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !14, !13}
!16 = !{!10, !6, i64 808}
!17 = distinct !{!17, !12}
!18 = !{!10, !6, i64 0}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12, !13, !14}
!23 = distinct !{!23, !12, !14, !13}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12}
!26 = distinct !{!26, !12}
!27 = distinct !{!27, !12}
|
#include<stdio.h>
#include<math.h>
int duang(long long int a,int n)
{
long long int as;
as=pow(2,n-1);
if(a==as)return n;
if(a<as)return duang(a,n-1);
if(a>as)return duang(a-as,n-1);
}
int main()
{
int n,sum;
long long int k;
scanf("%d %lld",&n,&k);
sum=duang(k,n);
printf("%d",sum);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22200/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22200/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d %lld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @duang(i64 noundef %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
br label %tailrecurse.outer
tailrecurse.outer: ; preds = %if.end8, %entry
%a.tr.ph = phi i64 [ %sub12, %if.end8 ], [ %a, %entry ]
%n.tr.ph = phi i32 [ %sub, %if.end8 ], [ %n, %entry ]
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse.outer, %if.end
%n.tr = phi i32 [ %sub, %if.end ], [ %n.tr.ph, %tailrecurse.outer ]
%sub = add nsw i32 %n.tr, -1
%ldexp = tail call double @ldexp(double 1.000000e+00, i32 %sub) #4
%conv1 = fptosi double %ldexp to i64
%cmp = icmp eq i64 %a.tr.ph, %conv1
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %tailrecurse
%cmp3 = icmp slt i64 %a.tr.ph, %conv1
br i1 %cmp3, label %tailrecurse, label %if.end8
if.end8: ; preds = %if.end
%sub12 = sub nsw i64 %a.tr.ph, %conv1
br label %tailrecurse.outer
cleanup: ; preds = %tailrecurse
ret i32 %n.tr
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i64, ptr %k, align 8, !tbaa !5
%1 = load i32, ptr %n, align 4, !tbaa !9
br label %tailrecurse.outer.i
tailrecurse.outer.i: ; preds = %if.end8.i, %entry
%a.tr.ph.i = phi i64 [ %sub12.i, %if.end8.i ], [ %0, %entry ]
%n.tr.ph.i = phi i32 [ %sub.i, %if.end8.i ], [ %1, %entry ]
br label %tailrecurse.i
tailrecurse.i: ; preds = %if.end.i, %tailrecurse.outer.i
%n.tr.i = phi i32 [ %sub.i, %if.end.i ], [ %n.tr.ph.i, %tailrecurse.outer.i ]
%sub.i = add nsw i32 %n.tr.i, -1
%ldexp.i = call double @ldexp(double 1.000000e+00, i32 %sub.i) #4
%conv1.i = fptosi double %ldexp.i to i64
%cmp.i = icmp eq i64 %a.tr.ph.i, %conv1.i
br i1 %cmp.i, label %duang.exit, label %if.end.i
if.end.i: ; preds = %tailrecurse.i
%cmp3.i = icmp slt i64 %a.tr.ph.i, %conv1.i
br i1 %cmp3.i, label %tailrecurse.i, label %if.end8.i
if.end8.i: ; preds = %if.end.i
%sub12.i = sub nsw i64 %a.tr.ph.i, %conv1.i
br label %tailrecurse.outer.i
duang.exit: ; preds = %tailrecurse.i
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %n.tr.i)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree willreturn
declare double @ldexp(double, i32) 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 willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
|
#include<stdio.h>
#define MAX 100
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
int n, M[MAX][MAX];
void dijkstra(){
int minv;
int d[MAX], color[MAX];
for(int i=0; i<n; i++){
d[i] = INFTY;
color[i] = WHITE;
}
d[0] = 0;
color[0] = GRAY;
while(1){
minv = INFTY;
int u = -1;
for(int i=0; i<n;i++){
if( minv > d[i] && color[i] != BLACK){
u = i;
minv = d[i];
}
}
if( u == -1) break;
color[u] = BLACK;
for(int v = 0; v<n; v++){
if(color[v] != BLACK && M[u][v] != INFTY){
if(d[v] > d[u] + M[u][v]){
d[v] = d[u] + M[u][v];
color[v] = GRAY;
}
}
}
}
for(int i = 0; i<n; i++){
printf("%d ", i);
if(d[i] == INFTY) printf("-1");
else printf("%d", d[i]);
printf("\n");
}
}
int main(){
scanf("%d", &n);
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
M[i][j] = INFTY;
}
}
int k, c, u, v;
for(int i=0; i<n; i++){
scanf("%d %d", &u, &k);
for(int j=0; j<k;j++){
scanf("%d %d", &v, &c);
M[u][v] = c;
}
}
dijkstra();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222050/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222050/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@M = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\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 void @dijkstra() local_unnamed_addr #0 {
entry:
%d = alloca [100 x i32], align 16
%color = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #5
%0 = load i32, ptr @n, align 4, !tbaa !5
%.fr = freeze i32 %0
%cmp114 = icmp sgt i32 %.fr, 0
br i1 %cmp114, label %for.body.preheader, label %for.cond.cleanup69
for.body.preheader: ; preds = %entry
%1 = zext i32 %.fr 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 %.fr, 8
br i1 %min.iters.check, label %for.body.preheader173, label %vector.ph
vector.ph: ; preds = %for.body.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 [100 x i32], ptr %d, i64 0, i64 %index
store <4 x i32> <i32 2097152, i32 2097152, i32 2097152, i32 2097152>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> <i32 2097152, i32 2097152, i32 2097152, i32 2097152>, 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 !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader173
for.body.preheader173: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block
store i32 0, ptr %d, align 16, !tbaa !5
store i32 1, ptr %color, align 16, !tbaa !5
br i1 %cmp114, label %while.cond.us.preheader, label %for.cond.cleanup69
while.cond.us.preheader: ; preds = %for.cond.cleanup
%wide.trip.count162 = zext i32 %.fr to i64
%wide.trip.count167 = zext i32 %.fr to i64
br label %for.body9.us
for.cond.cleanup8.us: ; preds = %for.inc18.us
%cmp21.not.us = icmp eq i32 %u.1.us, -1
br i1 %cmp21.not.us, label %for.cond67.preheader, label %if.end23.us
if.end23.us: ; preds = %for.cond.cleanup8.us
%idxprom24.us = sext i32 %u.1.us to i64
%arrayidx25.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom24.us
store i32 2, ptr %arrayidx25.us, align 4, !tbaa !5
%arrayidx43.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom24.us
br label %for.body29.us
for.body29.us: ; preds = %if.end23.us, %for.inc63.us
%indvars.iv164 = phi i64 [ 0, %if.end23.us ], [ %indvars.iv.next165, %for.inc63.us ]
%arrayidx31.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv164
%6 = load i32, ptr %arrayidx31.us, align 4, !tbaa !5
%cmp32.not.us = icmp eq i32 %6, 2
br i1 %cmp32.not.us, label %for.inc63.us, label %land.lhs.true33.us
land.lhs.true33.us: ; preds = %for.body29.us
%arrayidx37.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom24.us, i64 %indvars.iv164
%7 = load i32, ptr %arrayidx37.us, align 4, !tbaa !5
%cmp38.not.us = icmp eq i32 %7, 2097152
br i1 %cmp38.not.us, label %for.inc63.us, label %if.then39.us
if.then39.us: ; preds = %land.lhs.true33.us
%arrayidx41.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv164
%8 = load i32, ptr %arrayidx41.us, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx43.us, align 4, !tbaa !5
%add.us = add nsw i32 %9, %7
%cmp48.us = icmp sgt i32 %8, %add.us
br i1 %cmp48.us, label %if.then49.us, label %for.inc63.us
if.then49.us: ; preds = %if.then39.us
store i32 %add.us, ptr %arrayidx41.us, align 4, !tbaa !5
store i32 1, ptr %arrayidx31.us, align 4, !tbaa !5
br label %for.inc63.us
for.inc63.us: ; preds = %if.then49.us, %if.then39.us, %land.lhs.true33.us, %for.body29.us
%indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1
%exitcond168.not = icmp eq i64 %indvars.iv.next165, %wide.trip.count167
br i1 %exitcond168.not, label %for.body9.us.backedge, label %for.body29.us, !llvm.loop !13
for.body9.us: ; preds = %for.body9.us.backedge, %while.cond.us.preheader
%indvars.iv159 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv159.be, %for.body9.us.backedge ]
%u.0118.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0118.us.be, %for.body9.us.backedge ]
%minv.0117.us = phi i32 [ 2097152, %while.cond.us.preheader ], [ %minv.0117.us.be, %for.body9.us.backedge ]
%arrayidx11.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv159
%10 = load i32, ptr %arrayidx11.us, align 4, !tbaa !5
%cmp12.us = icmp sgt i32 %minv.0117.us, %10
br i1 %cmp12.us, label %land.lhs.true.us, label %for.inc18.us
land.lhs.true.us: ; preds = %for.body9.us
%arrayidx14.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv159
%11 = load i32, ptr %arrayidx14.us, align 4, !tbaa !5
%cmp15.not.us = icmp eq i32 %11, 2
%spec.select.us = select i1 %cmp15.not.us, i32 %minv.0117.us, i32 %10
%12 = trunc i64 %indvars.iv159 to i32
%spec.select113.us = select i1 %cmp15.not.us, i32 %u.0118.us, i32 %12
br label %for.inc18.us
for.inc18.us: ; preds = %land.lhs.true.us, %for.body9.us
%minv.1.us = phi i32 [ %minv.0117.us, %for.body9.us ], [ %spec.select.us, %land.lhs.true.us ]
%u.1.us = phi i32 [ %u.0118.us, %for.body9.us ], [ %spec.select113.us, %land.lhs.true.us ]
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162
br i1 %exitcond163.not, label %for.cond.cleanup8.us, label %for.body9.us.backedge
for.body9.us.backedge: ; preds = %for.inc63.us, %for.inc18.us
%indvars.iv159.be = phi i64 [ %indvars.iv.next160, %for.inc18.us ], [ 0, %for.inc63.us ]
%u.0118.us.be = phi i32 [ %u.1.us, %for.inc18.us ], [ -1, %for.inc63.us ]
%minv.0117.us.be = phi i32 [ %minv.1.us, %for.inc18.us ], [ 2097152, %for.inc63.us ]
br label %for.body9.us, !llvm.loop !13
for.body: ; preds = %for.body.preheader173, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader173 ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv
store i32 2097152, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %1
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !14
for.cond67.preheader: ; preds = %for.cond.cleanup8.us
%cmp68150 = icmp sgt i32 %.fr, 0
br i1 %cmp68150, label %for.body70, label %for.cond.cleanup69
for.cond.cleanup69: ; preds = %if.end79, %entry, %for.cond.cleanup, %for.cond67.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #5
ret void
for.body70: ; preds = %for.cond67.preheader, %if.end79
%indvars.iv169 = phi i64 [ %indvars.iv.next170, %if.end79 ], [ 0, %for.cond67.preheader ]
%13 = trunc i64 %indvars.iv169 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13)
%arrayidx72 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv169
%14 = load i32, ptr %arrayidx72, align 4, !tbaa !5
%cmp73 = icmp eq i32 %14, 2097152
br i1 %cmp73, label %if.then74, label %if.else
if.then74: ; preds = %for.body70
%call75 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end79
if.else: ; preds = %for.body70
%call78 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
br label %if.end79
if.end79: ; preds = %if.else, %if.then74
%putchar = tail call i32 @putchar(i32 10)
%indvars.iv.next170 = add nuw nsw i64 %indvars.iv169, 1
%15 = load i32, ptr @n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp68 = icmp slt i64 %indvars.iv.next170, %16
br i1 %cmp68, label %for.body70, label %for.cond.cleanup69, !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: 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 uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%c = alloca i32, align 4
%u = alloca i32, align 4
%v = alloca i32, align 4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.cond1.preheader.us.preheader, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
br label %for.cond.cleanup13
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count50 = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
%n.vec = and i64 %wide.trip.count50, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count50
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.cond.cleanup3_crit_edge.us
%indvars.iv47 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next48, %for.cond1.for.cond.cleanup3_crit_edge.us ]
br i1 %min.iters.check, label %for.body4.us.preheader, label %vector.body
vector.body: ; preds = %for.cond1.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ]
%1 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv47, i64 %index
store <4 x i32> <i32 2097152, i32 2097152, i32 2097152, i32 2097152>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 2097152, i32 2097152, i32 2097152, i32 2097152>, ptr %2, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us.preheader
for.body4.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body4.us
for.body4.us: ; preds = %for.body4.us.preheader, %for.body4.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body4.us ], [ %indvars.iv.ph, %for.body4.us.preheader ]
%arrayidx6.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv47, i64 %indvars.iv
store i32 2097152, ptr %arrayidx6.us, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count50
br i1 %exitcond.not, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us, !llvm.loop !17
for.cond1.for.cond.cleanup3_crit_edge.us: ; preds = %for.body4.us, %middle.block
%indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
%exitcond51.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count50
br i1 %exitcond51.not, label %for.cond.cleanup, label %for.cond1.preheader.us, !llvm.loop !18
for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
br i1 %cmp40, label %for.body14, label %for.cond.cleanup13
for.cond.cleanup13: ; preds = %for.cond.cleanup19, %for.cond.cleanup.thread, %for.cond.cleanup
call void @dijkstra()
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
ret i32 0
for.body14: ; preds = %for.cond.cleanup, %for.cond.cleanup19
%i10.045 = phi i32 [ %inc30, %for.cond.cleanup19 ], [ 0, %for.cond.cleanup ]
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %u, ptr noundef nonnull %k)
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp1842 = icmp sgt i32 %4, 0
br i1 %cmp1842, label %for.body20, label %for.cond.cleanup19
for.cond.cleanup19: ; preds = %for.body20, %for.body14
%inc30 = add nuw nsw i32 %i10.045, 1
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp12 = icmp slt i32 %inc30, %5
br i1 %cmp12, label %for.body14, label %for.cond.cleanup13, !llvm.loop !19
for.body20: ; preds = %for.body14, %for.body20
%j16.043 = phi i32 [ %inc27, %for.body20 ], [ 0, %for.body14 ]
%call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %v, ptr noundef nonnull %c)
%6 = load i32, ptr %c, align 4, !tbaa !5
%7 = load i32, ptr %u, align 4, !tbaa !5
%idxprom22 = sext i32 %7 to i64
%8 = load i32, ptr %v, align 4, !tbaa !5
%idxprom24 = sext i32 %8 to i64
%arrayidx25 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom22, i64 %idxprom24
store i32 %6, ptr %arrayidx25, align 4, !tbaa !5
%inc27 = add nuw nsw i32 %j16.043, 1
%9 = load i32, ptr %k, align 4, !tbaa !5
%cmp18 = icmp slt i32 %inc27, %9
br i1 %cmp18, label %for.body20, label %for.cond.cleanup19, !llvm.loop !20
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10, !12, !11}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include<stdio.h>
#define MAX 100
#define INF 10000000
#define WHITE 0
#define GRAY 1
#define BLACK 2
void dijkstra();
int n,M[MAX][MAX];
int i,j;
int main()
{
int k,c,u,v;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
M[i][j] = INF;
}
}
for(i=0;i<n;i++){
scanf("%d%d",&u,&k);
for(j=0;j<k;j++){
scanf("%d%d",&v,&c);
M[u][v] = c;
}
}
dijkstra();
return 0;
}
void dijkstra()
{
int minv,u,v;
int d[MAX],color[MAX];
for(i=0;i<n;i++){
d[i] = INF;
color[i] = WHITE;
}
d[0]=0;
color[0]=GRAY;
while(1){
minv = INF;
u = -1;
for(i=0;i<n;i++){
if(minv > d[i] && color[i] != BLACK){
u = i;
minv = d[i];
}
}
if(u == -1) break;
color[u] = BLACK;
for(v=0;v<n;v++){
if(color[v]!=BLACK && M[u][v]!=INF){
if(d[v] > d[u]+M[u][v]){
d[v] = d[u]+M[u][v];
color[v] = GRAY;
}
}
}
}
for(i=0;i<n;i++){
if(d[i] == INF) printf("%d %d\n",i,-1);
else printf("%d %d\n",i,d[i]);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222094/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222094/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@j = dso_local local_unnamed_addr global i32 0, align 4
@M = dso_local local_unnamed_addr global [100 x [100 x i32]] 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:
%k = alloca i32, align 4
%c = alloca i32, align 4
%u = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp32 = icmp sgt i32 %0, 0
br i1 %cmp32, label %for.cond1.preheader.us.preheader, label %for.cond9.preheader.thread
for.cond9.preheader.thread: ; preds = %entry
store i32 0, ptr @i, align 4, !tbaa !5
br label %for.end26
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count42 = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
%n.vec = and i64 %wide.trip.count42, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count42
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us
%indvars.iv39 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next40, %for.cond1.for.inc6_crit_edge.us ]
br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body
vector.body: ; preds = %for.cond1.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ]
%1 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv39, i64 %index
store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, ptr %2, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader
for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body3.us
for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ]
%arrayidx5.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %indvars.iv39, i64 %indvars.iv
store i32 10000000, ptr %arrayidx5.us, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count42
br i1 %exitcond.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !13
for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%exitcond43.not = icmp eq i64 %indvars.iv.next40, %wide.trip.count42
br i1 %exitcond43.not, label %for.cond9.preheader, label %for.cond1.preheader.us, !llvm.loop !14
for.cond9.preheader: ; preds = %for.cond1.for.inc6_crit_edge.us
store i32 %0, ptr @j, align 4, !tbaa !5
store i32 0, ptr @i, align 4, !tbaa !5
br i1 %cmp32, label %for.body11, label %for.end26
for.body11: ; preds = %for.cond9.preheader, %for.inc24
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
store i32 0, ptr @j, align 4, !tbaa !5
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp1436 = icmp sgt i32 %4, 0
br i1 %cmp1436, label %for.body15, label %for.inc24
for.body15: ; preds = %for.body11, %for.body15
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %c)
%5 = load i32, ptr %c, align 4, !tbaa !5
%6 = load i32, ptr %u, align 4, !tbaa !5
%idxprom17 = sext i32 %6 to i64
%7 = load i32, ptr %v, align 4, !tbaa !5
%idxprom19 = sext i32 %7 to i64
%arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom17, i64 %idxprom19
store i32 %5, ptr %arrayidx20, align 4, !tbaa !5
%8 = load i32, ptr @j, align 4, !tbaa !5
%inc22 = add nsw i32 %8, 1
store i32 %inc22, ptr @j, align 4, !tbaa !5
%9 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc22, %9
br i1 %cmp14, label %for.body15, label %for.inc24, !llvm.loop !15
for.inc24: ; preds = %for.body15, %for.body11
%10 = load i32, ptr @i, align 4, !tbaa !5
%inc25 = add nsw i32 %10, 1
store i32 %inc25, ptr @i, align 4, !tbaa !5
%11 = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc25, %11
br i1 %cmp10, label %for.body11, label %for.end26, !llvm.loop !16
for.end26: ; preds = %for.inc24, %for.cond9.preheader.thread, %for.cond9.preheader
call void @dijkstra()
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @dijkstra() local_unnamed_addr #0 {
entry:
%d = alloca [100 x i32], align 16
%color = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #4
%0 = load i32, ptr @n, align 4, !tbaa !5
%.fr = freeze i32 %0
%cmp99 = icmp sgt i32 %.fr, 0
br i1 %cmp99, label %for.body.preheader, label %for.cond63.preheader.thread
for.body.preheader: ; preds = %entry
%1 = zext i32 %.fr 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 %.fr, 8
br i1 %min.iters.check, label %for.body.preheader163, label %vector.ph
vector.ph: ; preds = %for.body.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 [100 x i32], ptr %d, i64 0, i64 %index
store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> <i32 10000000, i32 10000000, i32 10000000, i32 10000000>, 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 !17
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %for.end, label %for.body.preheader163
for.body.preheader163: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader163, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader163 ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv
store i32 10000000, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %1
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !18
for.end: ; preds = %for.body, %middle.block
store i32 0, ptr %d, align 16, !tbaa !5
store i32 1, ptr %color, align 16, !tbaa !5
br i1 %cmp99, label %while.cond.us.preheader, label %for.cond63.preheader.thread
while.cond.us.preheader: ; preds = %for.end
%wide.trip.count154 = zext i32 %.fr to i64
%wide.trip.count159 = zext i32 %.fr to i64
br label %for.body7.us
for.end18.us: ; preds = %for.inc16.us
%cmp19.us = icmp eq i32 %u.1.us, -1
br i1 %cmp19.us, label %for.cond63.preheader, label %if.end21.us
if.end21.us: ; preds = %for.end18.us
%idxprom22.us = sext i32 %u.1.us to i64
%arrayidx23.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom22.us
store i32 2, ptr %arrayidx23.us, align 4, !tbaa !5
%arrayidx40.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom22.us
br label %for.body26.us
for.body26.us: ; preds = %if.end21.us, %for.inc60.us
%indvars.iv156 = phi i64 [ 0, %if.end21.us ], [ %indvars.iv.next157, %for.inc60.us ]
%arrayidx28.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv156
%6 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%cmp29.not.us = icmp eq i32 %6, 2
br i1 %cmp29.not.us, label %for.inc60.us, label %land.lhs.true30.us
land.lhs.true30.us: ; preds = %for.body26.us
%arrayidx34.us = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom22.us, i64 %indvars.iv156
%7 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5
%cmp35.not.us = icmp eq i32 %7, 10000000
br i1 %cmp35.not.us, label %for.inc60.us, label %if.then36.us
if.then36.us: ; preds = %land.lhs.true30.us
%arrayidx38.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv156
%8 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5
%add.us = add nsw i32 %9, %7
%cmp45.us = icmp sgt i32 %8, %add.us
br i1 %cmp45.us, label %if.then46.us, label %for.inc60.us
if.then46.us: ; preds = %if.then36.us
store i32 %add.us, ptr %arrayidx38.us, align 4, !tbaa !5
store i32 1, ptr %arrayidx28.us, align 4, !tbaa !5
br label %for.inc60.us
for.inc60.us: ; preds = %if.then46.us, %if.then36.us, %land.lhs.true30.us, %for.body26.us
%indvars.iv.next157 = add nuw nsw i64 %indvars.iv156, 1
%exitcond160.not = icmp eq i64 %indvars.iv.next157, %wide.trip.count159
br i1 %exitcond160.not, label %for.body7.us.backedge, label %for.body26.us, !llvm.loop !19
for.body7.us: ; preds = %for.body7.us.backedge, %while.cond.us.preheader
%indvars.iv151 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv151.be, %for.body7.us.backedge ]
%u.0105.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0105.us.be, %for.body7.us.backedge ]
%minv.0104.us = phi i32 [ 10000000, %while.cond.us.preheader ], [ %minv.0104.us.be, %for.body7.us.backedge ]
%arrayidx9.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv151
%10 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%cmp10.us = icmp sgt i32 %minv.0104.us, %10
br i1 %cmp10.us, label %land.lhs.true.us, label %for.inc16.us
land.lhs.true.us: ; preds = %for.body7.us
%arrayidx12.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv151
%11 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5
%cmp13.not.us = icmp eq i32 %11, 2
%spec.select.us = select i1 %cmp13.not.us, i32 %minv.0104.us, i32 %10
%12 = trunc i64 %indvars.iv151 to i32
%spec.select98.us = select i1 %cmp13.not.us, i32 %u.0105.us, i32 %12
br label %for.inc16.us
for.inc16.us: ; preds = %land.lhs.true.us, %for.body7.us
%minv.1.us = phi i32 [ %minv.0104.us, %for.body7.us ], [ %spec.select.us, %land.lhs.true.us ]
%u.1.us = phi i32 [ %u.0105.us, %for.body7.us ], [ %spec.select98.us, %land.lhs.true.us ]
%indvars.iv.next152 = add nuw nsw i64 %indvars.iv151, 1
%exitcond155.not = icmp eq i64 %indvars.iv.next152, %wide.trip.count154
br i1 %exitcond155.not, label %for.end18.us, label %for.body7.us.backedge
for.body7.us.backedge: ; preds = %for.inc60.us, %for.inc16.us
%indvars.iv151.be = phi i64 [ %indvars.iv.next152, %for.inc16.us ], [ 0, %for.inc60.us ]
%u.0105.us.be = phi i32 [ %u.1.us, %for.inc16.us ], [ -1, %for.inc60.us ]
%minv.0104.us.be = phi i32 [ %minv.1.us, %for.inc16.us ], [ 10000000, %for.inc60.us ]
br label %for.body7.us, !llvm.loop !19
for.cond63.preheader.thread: ; preds = %entry, %for.end
store i32 0, ptr @i, align 4, !tbaa !5
br label %for.end76
for.cond63.preheader: ; preds = %for.end18.us
store i32 0, ptr @i, align 4, !tbaa !5
%cmp64142 = icmp sgt i32 %.fr, 0
br i1 %cmp64142, label %for.body65, label %for.end76
for.body65: ; preds = %for.cond63.preheader, %for.body65
%storemerge97143 = phi i32 [ %inc75, %for.body65 ], [ 0, %for.cond63.preheader ]
%idxprom66 = sext i32 %storemerge97143 to i64
%arrayidx67 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom66
%13 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%cmp68 = icmp eq i32 %13, 10000000
%. = select i1 %cmp68, i32 -1, i32 %13
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %storemerge97143, i32 noundef %.)
%14 = load i32, ptr @i, align 4, !tbaa !5
%inc75 = add nsw i32 %14, 1
store i32 %inc75, ptr @i, align 4, !tbaa !5
%15 = load i32, ptr @n, align 4, !tbaa !5
%cmp64 = icmp slt i32 %inc75, %15
br i1 %cmp64, label %for.body65, label %for.end76, !llvm.loop !20
for.end76: ; preds = %for.body65, %for.cond63.preheader.thread, %for.cond63.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #4
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !11, !12}
!18 = distinct !{!18, !10, !12, !11}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include<stdio.h>
#include<limits.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n,m[100][100];
void dijkstra(){
int min,i,j,u;
int d[100],color[100];
for(i=0;i<n;i++){
d[i]=INT_MAX;
color[i]=WHITE;
}
d[0]=0;
color[0]=GRAY;
while(1){
min=INT_MAX;
u=-1;
for(i=0;i<n;i++){
if(min>d[i]&&color[i]!=BLACK){
u=i;
min=d[i];
}
}
if(u==-1)break;
color[u]=BLACK;
for(j=0;j<n;j++){
if(color[j]!=BLACK&&m[u][j]!=INT_MAX){
if(d[j]>d[u]+m[u][j]){
d[j]=d[u]+m[u][j];
color[j]=GRAY;
}
}
}
}
for(i=0;i<n;i++){
if(d[i]==INT_MAX)d[i]=-1;
printf("%d %d\n",i,d[i]);
}
}
int main(){
int i,j;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
m[i][j]=INT_MAX;
}
}
int k,c,u,v;
for(i=0;i<n;i++){
scanf("%d",&u);
scanf("%d",&k);
for(j=0;j<k;j++){
scanf("%d",&v);
scanf("%d",&c);
m[u][v]=c;
}
}
dijkstra();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_222137/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_222137/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@m = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @dijkstra() local_unnamed_addr #0 {
entry:
%d = alloca [100 x i32], align 16
%color = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %color) #4
%0 = load i32, ptr @n, align 4, !tbaa !5
%.fr = freeze i32 %0
%cmp109 = icmp sgt i32 %.fr, 0
br i1 %cmp109, label %for.body.preheader, label %for.end77
for.body.preheader: ; preds = %entry
%1 = zext i32 %.fr 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 %.fr, 8
br i1 %min.iters.check, label %for.body.preheader168, label %vector.ph
vector.ph: ; preds = %for.body.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 [100 x i32], ptr %d, i64 0, i64 %index
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, 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 !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %for.end, label %for.body.preheader168
for.body.preheader168: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader168, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader168 ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv
store i32 2147483647, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %1
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block
store i32 0, ptr %d, align 16, !tbaa !5
store i32 1, ptr %color, align 16, !tbaa !5
br i1 %cmp109, label %while.cond.us.preheader, label %for.end77
while.cond.us.preheader: ; preds = %for.end
%wide.trip.count157 = zext i32 %.fr to i64
%wide.trip.count162 = zext i32 %.fr to i64
br label %for.body7.us
for.end18.us: ; preds = %for.inc16.us
%cmp19.us = icmp eq i32 %u.1.us, -1
br i1 %cmp19.us, label %for.cond63.preheader, label %if.end21.us
if.end21.us: ; preds = %for.end18.us
%idxprom22.us = sext i32 %u.1.us to i64
%arrayidx23.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %idxprom22.us
store i32 2, ptr %arrayidx23.us, align 4, !tbaa !5
%arrayidx40.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom22.us
br label %for.body26.us
for.body26.us: ; preds = %if.end21.us, %for.inc60.us
%indvars.iv159 = phi i64 [ 0, %if.end21.us ], [ %indvars.iv.next160, %for.inc60.us ]
%arrayidx28.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv159
%6 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%cmp29.not.us = icmp eq i32 %6, 2
br i1 %cmp29.not.us, label %for.inc60.us, label %land.lhs.true30.us
land.lhs.true30.us: ; preds = %for.body26.us
%arrayidx34.us = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %idxprom22.us, i64 %indvars.iv159
%7 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5
%cmp35.not.us = icmp eq i32 %7, 2147483647
br i1 %cmp35.not.us, label %for.inc60.us, label %if.then36.us
if.then36.us: ; preds = %land.lhs.true30.us
%arrayidx38.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv159
%8 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5
%add.us = add nsw i32 %9, %7
%cmp45.us = icmp sgt i32 %8, %add.us
br i1 %cmp45.us, label %if.then46.us, label %for.inc60.us
if.then46.us: ; preds = %if.then36.us
store i32 %add.us, ptr %arrayidx38.us, align 4, !tbaa !5
store i32 1, ptr %arrayidx28.us, align 4, !tbaa !5
br label %for.inc60.us
for.inc60.us: ; preds = %if.then46.us, %if.then36.us, %land.lhs.true30.us, %for.body26.us
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162
br i1 %exitcond163.not, label %for.body7.us.backedge, label %for.body26.us, !llvm.loop !14
for.body7.us: ; preds = %for.body7.us.backedge, %while.cond.us.preheader
%indvars.iv154 = phi i64 [ 0, %while.cond.us.preheader ], [ %indvars.iv154.be, %for.body7.us.backedge ]
%u.0114.us = phi i32 [ -1, %while.cond.us.preheader ], [ %u.0114.us.be, %for.body7.us.backedge ]
%min.0112.us = phi i32 [ 2147483647, %while.cond.us.preheader ], [ %min.0112.us.be, %for.body7.us.backedge ]
%arrayidx9.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv154
%10 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%cmp10.us = icmp sgt i32 %min.0112.us, %10
br i1 %cmp10.us, label %land.lhs.true.us, label %for.inc16.us
land.lhs.true.us: ; preds = %for.body7.us
%arrayidx12.us = getelementptr inbounds [100 x i32], ptr %color, i64 0, i64 %indvars.iv154
%11 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5
%cmp13.not.us = icmp eq i32 %11, 2
%spec.select.us = select i1 %cmp13.not.us, i32 %min.0112.us, i32 %10
%12 = trunc i64 %indvars.iv154 to i32
%spec.select108.us = select i1 %cmp13.not.us, i32 %u.0114.us, i32 %12
br label %for.inc16.us
for.inc16.us: ; preds = %land.lhs.true.us, %for.body7.us
%min.1.us = phi i32 [ %min.0112.us, %for.body7.us ], [ %spec.select.us, %land.lhs.true.us ]
%u.1.us = phi i32 [ %u.0114.us, %for.body7.us ], [ %spec.select108.us, %land.lhs.true.us ]
%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.end18.us, label %for.body7.us.backedge
for.body7.us.backedge: ; preds = %for.inc60.us, %for.inc16.us
%indvars.iv154.be = phi i64 [ %indvars.iv.next155, %for.inc16.us ], [ 0, %for.inc60.us ]
%u.0114.us.be = phi i32 [ %u.1.us, %for.inc16.us ], [ -1, %for.inc60.us ]
%min.0112.us.be = phi i32 [ %min.1.us, %for.inc16.us ], [ 2147483647, %for.inc60.us ]
br label %for.body7.us, !llvm.loop !14
for.cond63.preheader: ; preds = %for.end18.us
%cmp64145 = icmp sgt i32 %.fr, 0
br i1 %cmp64145, label %for.body65, label %for.end77
for.body65: ; preds = %for.cond63.preheader, %for.body65
%indvars.iv164 = phi i64 [ %indvars.iv.next165, %for.body65 ], [ 0, %for.cond63.preheader ]
%arrayidx67 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv164
%13 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%cmp68 = icmp eq i32 %13, 2147483647
%spec.store.select = select i1 %cmp68, i32 -1, i32 %13
store i32 %spec.store.select, ptr %arrayidx67, align 4
%14 = trunc i64 %indvars.iv164 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %14, i32 noundef %spec.store.select)
%indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1
%15 = load i32, ptr @n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp64 = icmp slt i64 %indvars.iv.next165, %16
br i1 %cmp64, label %for.body65, label %for.end77, !llvm.loop !15
for.end77: ; preds = %for.body65, %entry, %for.end, %for.cond63.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %color) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #4
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%c = alloca i32, align 4
%u = alloca i32, align 4
%v = alloca i32, align 4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.cond1.preheader.us.preheader, label %for.end8.thread
for.end8.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
br label %for.end28
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count49 = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
%n.vec = and i64 %wide.trip.count49, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count49
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us
%indvars.iv46 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next47, %for.cond1.for.inc6_crit_edge.us ]
br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.body
vector.body: ; preds = %for.cond1.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond1.preheader.us ]
%1 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv46, i64 %index
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %2, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.preheader
for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body3.us
for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ]
%arrayidx5.us = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %indvars.iv46, i64 %indvars.iv
store i32 2147483647, ptr %arrayidx5.us, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count49
br i1 %exitcond.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us, !llvm.loop !17
for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us, %middle.block
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%exitcond50.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count49
br i1 %exitcond50.not, label %for.end8, label %for.cond1.preheader.us, !llvm.loop !18
for.end8: ; preds = %for.cond1.for.inc6_crit_edge.us
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
br i1 %cmp39, label %for.body11, label %for.end28
for.body11: ; preds = %for.end8, %for.inc26
%i.144 = phi i32 [ %inc27, %for.inc26 ], [ 0, %for.end8 ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u)
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %k)
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp1541 = icmp sgt i32 %4, 0
br i1 %cmp1541, label %for.body16, label %for.inc26
for.body16: ; preds = %for.body11, %for.body16
%j.142 = phi i32 [ %inc24, %for.body16 ], [ 0, %for.body11 ]
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v)
%call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c)
%5 = load i32, ptr %c, align 4, !tbaa !5
%6 = load i32, ptr %u, align 4, !tbaa !5
%idxprom19 = sext i32 %6 to i64
%7 = load i32, ptr %v, align 4, !tbaa !5
%idxprom21 = sext i32 %7 to i64
%arrayidx22 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %idxprom19, i64 %idxprom21
store i32 %5, ptr %arrayidx22, align 4, !tbaa !5
%inc24 = add nuw nsw i32 %j.142, 1
%8 = load i32, ptr %k, align 4, !tbaa !5
%cmp15 = icmp slt i32 %inc24, %8
br i1 %cmp15, label %for.body16, label %for.inc26, !llvm.loop !19
for.inc26: ; preds = %for.body16, %for.body11
%inc27 = add nuw nsw i32 %i.144, 1
%9 = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc27, %9
br i1 %cmp10, label %for.body11, label %for.end28, !llvm.loop !20
for.end28: ; preds = %for.inc26, %for.end8.thread, %for.end8
call void @dijkstra()
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10, !12, !11}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.