Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include<stdio.h>
#include<string.h>
int main(){
char s[13],t[14];
scanf("%s\n",s);
scanf("%s\n",t);
int k,l,m,count=0;
k=strlen(s);
l=strlen(t);
if(l-k==1){
for(int i=0;i<k;i++)
if(s[i]==t[i])
count++;
else break;
if(count==k)
printf("Yes");
else
printf("No");
}
else printf("No");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_207543/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_207543/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s\0A\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:
%s = alloca [13 x i8], align 1
%t = alloca [14 x i8], align 1
call void @llvm.lifetime.start.p0(i64 13, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #5
%conv = trunc i64 %call4 to i32
%call6 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %t) #5
%conv7 = trunc i64 %call6 to i32
%sub = sub nsw i32 %conv7, %conv
%cmp = icmp eq i32 %sub, 1
br i1 %cmp, label %for.cond.preheader, label %if.end28
for.cond.preheader: ; preds = %entry
%cmp935 = icmp sgt i32 %conv, 0
br i1 %cmp935, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = and i64 %call4, 4294967295
br label %for.body
for.body: ; preds = %for.body.preheader, %if.then17
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %if.then17 ]
%arrayidx = getelementptr inbounds [13 x i8], ptr %s, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%arrayidx13 = getelementptr inbounds [14 x i8], ptr %t, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx13, align 1, !tbaa !5
%cmp15 = icmp eq i8 %0, %1
br i1 %cmp15, label %if.then17, label %cleanup.loopexit
if.then17: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %if.end28, label %for.body, !llvm.loop !8
cleanup.loopexit: ; preds = %for.body
%indvars41.le = trunc i64 %indvars.iv to i32
br label %cleanup
cleanup: ; preds = %cleanup.loopexit, %for.cond.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %indvars41.le, %cleanup.loopexit ]
%cmp19 = icmp eq i32 %count.0.lcssa, %conv
%spec.select = select i1 %cmp19, ptr @.str.1, ptr @.str.2
br label %if.end28
if.end28: ; preds = %if.then17, %cleanup, %entry
%.str.1.sink = phi ptr [ @.str.2, %entry ], [ %spec.select, %cleanup ], [ @.str.1, %if.then17 ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 13, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<math.h>
#include<string.h>
int main( )
{
int i,p=1;
char a[20];
char b[20];
scanf("%s",a);
scanf("%s",b);
for(i=0;a[i];i++)
if(a[i]!=b[i])
p=0;
if((strlen(b)-strlen(a))!=1)
p=0;
if(p==0)
{printf("No");return 0;}
if(p==1)
{printf("Yes");return 0;}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_207594/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_207594/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [20 x i8], align 16
%b = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i8, ptr %a, align 16, !tbaa !5
%tobool.not36 = icmp eq i8 %0, 0
br i1 %tobool.not36, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%1 = phi i8 [ %3, %for.body ], [ %0, %entry ]
%p.038 = phi i32 [ %spec.select, %for.body ], [ 1, %entry ]
%arrayidx6 = getelementptr inbounds [20 x i8], ptr %b, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx6, align 1, !tbaa !5
%cmp.not = icmp eq i8 %1, %2
%spec.select = select i1 %cmp.not, i32 %p.038, i32 0
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [20 x i8], ptr %a, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx, align 1, !tbaa !5
%tobool.not = icmp eq i8 %3, 0
br i1 %tobool.not, label %for.end.loopexit, label %for.body, !llvm.loop !8
for.end.loopexit: ; preds = %for.body
%4 = icmp eq i32 %spec.select, 0
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%p.0.lcssa = phi i1 [ false, %entry ], [ %4, %for.end.loopexit ]
%call10 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %b) #5
%call12 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %a) #5
%sub = sub i64 %call10, %call12
%cmp13.not = icmp ne i64 %sub, 1
%cmp17 = select i1 %cmp13.not, i1 true, i1 %p.0.lcssa
%.str.1..str.2 = select i1 %cmp17, ptr @.str.1, ptr @.str.2
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 20, 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 nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main(void)
{
char s[11], t[11];
scanf("%s%s", s, t);
if (strncmp(s, t, strlen(s)) == 0 && strlen(t) == strlen(s) + 1)
printf("Yes\n");
else
printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_207659/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_207659/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s%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:
%s = alloca [11 x i8], align 1
%t = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t)
%call5 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%call6 = call i32 @strncmp(ptr noundef nonnull %s, ptr noundef nonnull %t, i64 noundef %call5) #6
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %entry
%call8 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %t) #6
%add = add i64 %call5, 1
%cmp11 = icmp eq i64 %call8, %add
br i1 %cmp11, label %if.end, label %if.else
if.else: ; preds = %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %land.lhs.true ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(){
int i;
char s[11],t[12];
scanf("%s",&s);
scanf("%s",&t);
for(i=0;s[i]!=0;i++){
if(s[i]!=t[i]) break;
}
if(s[i]==0){
printf("Yes");
}else{
printf("No");
}
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_207723/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_207723/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [11 x i8], align 1
%t = alloca [12 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp.not24 = icmp eq i8 %0, 0
br i1 %cmp.not24, label %if.end19, label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %1, 0
br i1 %cmp.not, label %if.end19, label %for.body, !llvm.loop !8
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%2 = phi i8 [ %1, %for.cond ], [ %0, %entry ]
%arrayidx7 = getelementptr inbounds [12 x i8], ptr %t, i64 0, i64 %indvars.iv
%3 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp9.not = icmp eq i8 %2, %3
br i1 %cmp9.not, label %for.cond, label %if.end19
if.end19: ; preds = %for.body, %for.cond, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.1, %for.cond ], [ @.str.2, %for.body ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void *a,const void *b){
return *(int*)a-*(int*)b;
}
int main(){
int a[5];
while( scanf("%d,%d,%d,%d,%d",&a[0],&a[1],&a[2],&a[3],&a[4])!=EOF){
qsort(a,5,sizeof(int),compare_int);
if((a[0]==a[1]&& a[1]==a[2] && a[2]==a[3]) || (a[1]==a[2] && a[2]==a[3] && a[3]==a[4]))printf("four card\n");
else if(a[0]==a[1] && a[1]==a[2]){
if(a[3]==a[4])printf("full house\n");
else printf("three card\n");
}
else if(a[1]==a[2] && a[2]==a[3])printf("three card\n");
else if(a[2]==a[3] && a[3]==a[4]){
if(a[0]==a[1])printf("full house\n");
else printf("three card\n");
}
else if(a[0]==a[1]){
if(a[2]==a[3] || a[3]==a[4])printf("two pair\n");
else printf("one pair\n");
}
else if(a[1]==a[2]){
if(a[3]==a[4])printf("two pair\n");
else printf("one pair\n");
}
else if(a[2]==a[3] ||a[3]==a[4])printf("one pair\n");
else {
if(a[0]==1 && a[1]==10 && a[2]==11 && a[3]==12 && a[4]==13)printf("straight\n");
else if(a[0]+1==a[1] && a[1]+1==a[2] && a[2]+1==a[3] && a[3]+1==a[4])printf("straight\n");
else printf("null\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_207774/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_207774/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d,%d,%d,%d,%d\00", align 1
@str = private unnamed_addr constant [5 x i8] c"null\00", align 1
@str.9 = private unnamed_addr constant [9 x i8] c"straight\00", align 1
@str.13 = private unnamed_addr constant [9 x i8] c"one pair\00", align 1
@str.14 = private unnamed_addr constant [9 x i8] c"two pair\00", align 1
@str.18 = private unnamed_addr constant [11 x i8] c"three card\00", align 1
@str.19 = private unnamed_addr constant [11 x i8] c"full house\00", align 1
@str.20 = private unnamed_addr constant [10 x i8] c"four card\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%a = alloca [5 x i32], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %a) #6
%arrayidx1 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 2
%arrayidx3 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 3
%arrayidx4 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 4
%call199 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4)
%cmp.not200 = icmp eq i32 %call199, -1
br i1 %cmp.not200, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end157
call void @qsort(ptr noundef nonnull %a, i64 noundef 5, i64 noundef 4, ptr noundef nonnull @compare_int) #6
%0 = load i32, ptr %a, align 16, !tbaa !5
%1 = load <2 x i32>, ptr %arrayidx1, align 4
%2 = extractelement <2 x i32> %1, i64 0
%cmp7 = icmp eq i32 %0, %2
br i1 %cmp7, label %land.lhs.true, label %lor.lhs.false
land.lhs.true: ; preds = %while.body
%3 = extractelement <2 x i32> %1, i64 1
%cmp10 = icmp eq i32 %0, %3
%4 = load i32, ptr %arrayidx3, align 4
%cmp14 = icmp eq i32 %3, %4
%or.cond186 = select i1 %cmp10, i1 %cmp14, i1 false
br i1 %or.cond186, label %if.end157, label %lor.lhs.false
lor.lhs.false: ; preds = %land.lhs.true, %while.body
%5 = extractelement <2 x i32> %1, i64 1
%cmp17 = icmp eq i32 %2, %5
%6 = load <2 x i32>, ptr %arrayidx3, align 4
%7 = extractelement <2 x i32> %6, i64 0
%8 = extractelement <2 x i32> %6, i64 1
%cmp25 = icmp eq i32 %7, %8
br i1 %cmp17, label %land.lhs.true18, label %if.else52
land.lhs.true18: ; preds = %lor.lhs.false
%cmp21 = icmp eq i32 %2, %7
%or.cond187 = select i1 %cmp21, i1 %cmp25, i1 false
br i1 %or.cond187, label %if.end157, label %if.else
if.else: ; preds = %land.lhs.true18
br i1 %cmp7, label %if.then34, label %if.else42
if.then34: ; preds = %if.else
%str.19.str.18 = select i1 %cmp25, ptr @str.19, ptr @str.18
br label %if.end157
if.else42: ; preds = %if.else
br i1 %cmp21, label %if.end157, label %if.then90
if.else52: ; preds = %lor.lhs.false
%cmp49196 = icmp eq i32 %5, %7
%or.cond190 = select i1 %cmp49196, i1 %cmp25, i1 false
br i1 %or.cond190, label %if.then60, label %if.else69
if.then60: ; preds = %if.else52
%str.16.str.15 = select i1 %cmp7, ptr @str.19, ptr @str.18
br label %if.end157
if.else69: ; preds = %if.else52
%or.cond191 = select i1 %cmp49196, i1 true, i1 %cmp25
br i1 %cmp7, label %if.then73, label %if.else99
if.then73: ; preds = %if.else69
%str.14.str.13 = select i1 %or.cond191, ptr @str.14, ptr @str.13
br label %if.end157
if.then90: ; preds = %if.else42
%cmp59203 = icmp eq i32 %7, %8
%str.12.str.11 = select i1 %cmp59203, ptr @str.14, ptr @str.13
br label %if.end157
if.else99: ; preds = %if.else69
br i1 %or.cond191, label %if.end157, label %if.else109
if.else109: ; preds = %if.else99
%9 = shufflevector <2 x i32> %1, <2 x i32> %6, <4 x i32> <i32 0, i32 poison, i32 1, i32 2>
%10 = insertelement <4 x i32> %9, i32 %0, i64 1
%11 = icmp ne <4 x i32> %10, <i32 10, i32 1, i32 11, i32 12>
%cmp123 = icmp eq i32 %8, 13
%12 = bitcast <4 x i1> %11 to i4
%13 = icmp eq i4 %12, 0
%op.rdx = and i1 %13, %cmp123
br i1 %op.rdx, label %if.end157, label %if.else126
if.else126: ; preds = %if.else109
%14 = insertelement <4 x i32> poison, i32 %0, i64 0
%15 = shufflevector <2 x i32> %1, <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
%16 = shufflevector <4 x i32> %14, <4 x i32> %15, <4 x i32> <i32 0, i32 4, i32 5, i32 poison>
%17 = shufflevector <2 x i32> %6, <2 x i32> poison, <4 x i32> <i32 0, i32 poison, i32 poison, i32 poison>
%18 = shufflevector <4 x i32> %16, <4 x i32> %17, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
%19 = add nsw <4 x i32> %18, <i32 1, i32 1, i32 1, i32 1>
%20 = shufflevector <2 x i32> %1, <2 x i32> %6, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%21 = icmp eq <4 x i32> %19, %20
%22 = freeze <4 x i1> %21
%23 = bitcast <4 x i1> %22 to i4
%24 = icmp eq i4 %23, -1
%str.8.str = select i1 %24, ptr @str.9, ptr @str
br label %if.end157
if.end157: ; preds = %if.else126, %if.else109, %if.else99, %if.then90, %if.then73, %if.then60, %if.else42, %if.then34, %land.lhs.true, %land.lhs.true18
%str.18.sink = phi ptr [ @str.20, %land.lhs.true18 ], [ @str.20, %land.lhs.true ], [ %str.19.str.18, %if.then34 ], [ @str.18, %if.else42 ], [ %str.16.str.15, %if.then60 ], [ %str.14.str.13, %if.then73 ], [ %str.12.str.11, %if.then90 ], [ @str.13, %if.else99 ], [ @str.9, %if.else109 ], [ %str.8.str, %if.else126 ]
%puts183 = call i32 @puts(ptr nonnull dereferenceable(1) %str.18.sink)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end157, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %a) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: 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 #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int pair(int a, int b, int c, int d, int e)
{
int card[14] = {0};
int i, t, u=0;
t = a;
card[t] = card[t] + 1;
t = b;
card[t] = card[t] + 1;
t = c;
card[t] = card[t] + 1;
t = d;
card[t] = card[t] + 1;
t = e;
card[t] = card[t] + 1;
t = 0;
for(i=0; i<14; i++){
if(card[i]==2) t = t + 1;
if(card[i]==3) u = 1;
if(card[i]==4) t = 6;
}
if(t==1 && u==1) return 5;
if(t!=0 && t<=6) return t;
if(u==1) return 3;
else return 0;
}
int compare_int(const void *a, const void *b)
{
return *(int*)a - *(int*)b;
}
int straight(int a, int b, int c, int d, int e)
{
int num[] = {a, b, c, d, e};
int v, w, x, y, z;
qsort(num, 5, sizeof(int), compare_int);
v = num[0];
w = num[1];
x = num[2];
y = num[3];
z = num[4];
if(w==v+1){
if(x==w+1){
if(y==x+1){
if(z==y+1) return 4;
}
}
}
if(v==1 && w==10 && x==11 && y==12 && z==13) return 4;
return 0;
}
int main(void)
{
int a, b, c, d, e, op;
while(0<1){
if(scanf("%d,%d,%d,%d,%d", &a, &b, &c, &d, &e)==-1) break;
op = pair(a, b, c, d, e);
if(op==0) op = straight(a, b, c, d, e);
switch(op){
case 1: printf("one pair\n"); break;
case 2: printf("two pair\n"); break;
case 3: printf("three card\n"); break;
case 4: printf("straight\n"); break;
case 5: printf("full house\n"); break;
case 6: printf("four card\n"); break;
default: printf("null\n"); break;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_207817/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_207817/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d,%d,%d,%d,%d\00", align 1
@str = private unnamed_addr constant [10 x i8] c"four card\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"full house\00", align 1
@str.9 = private unnamed_addr constant [9 x i8] c"straight\00", align 1
@str.10 = private unnamed_addr constant [11 x i8] c"three card\00", align 1
@str.11 = private unnamed_addr constant [9 x i8] c"two pair\00", align 1
@str.12 = private unnamed_addr constant [9 x i8] c"one pair\00", align 1
@str.13 = private unnamed_addr constant [5 x i8] c"null\00", align 1
@reltable.main = private unnamed_addr constant [6 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @str.12 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.11 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.10 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.9 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.8 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @pair(i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %d, i32 noundef %e) local_unnamed_addr #0 {
entry:
%card = alloca [14 x i32], align 16
call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %card) #9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(56) %card, i8 0, i64 56, i1 false)
%idxprom = sext i32 %a to i64
%arrayidx = getelementptr inbounds [14 x i32], ptr %card, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %0, 1
store i32 %add, ptr %arrayidx, align 4, !tbaa !5
%idxprom3 = sext i32 %b to i64
%arrayidx4 = getelementptr inbounds [14 x i32], ptr %card, i64 0, i64 %idxprom3
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%add5 = add nsw i32 %1, 1
store i32 %add5, ptr %arrayidx4, align 4, !tbaa !5
%idxprom8 = sext i32 %c to i64
%arrayidx9 = getelementptr inbounds [14 x i32], ptr %card, i64 0, i64 %idxprom8
%2 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%add10 = add nsw i32 %2, 1
store i32 %add10, ptr %arrayidx9, align 4, !tbaa !5
%idxprom13 = sext i32 %d to i64
%arrayidx14 = getelementptr inbounds [14 x i32], ptr %card, i64 0, i64 %idxprom13
%3 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%add15 = add nsw i32 %3, 1
store i32 %add15, ptr %arrayidx14, align 4, !tbaa !5
%idxprom18 = sext i32 %e to i64
%arrayidx19 = getelementptr inbounds [14 x i32], ptr %card, i64 0, i64 %idxprom18
%4 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%add20 = add nsw i32 %4, 1
store i32 %add20, ptr %arrayidx19, align 4, !tbaa !5
%5 = load i32, ptr %card, align 16, !tbaa !5
%cmp25 = icmp eq i32 %5, 2
%add26 = zext i1 %cmp25 to i32
%cmp29 = icmp eq i32 %5, 3
%cmp34 = icmp eq i32 %5, 4
%t.2 = select i1 %cmp34, i32 6, i32 %add26
%arrayidx24.1 = getelementptr inbounds [14 x i32], ptr %card, i64 0, i64 1
%6 = load i32, ptr %arrayidx24.1, align 4, !tbaa !5
%.fr90 = freeze i32 %6
%cmp25.1 = icmp eq i32 %.fr90, 2
%add26.1 = zext i1 %cmp25.1 to i32
%spec.select.1 = add nuw nsw i32 %t.2, %add26.1
%cmp29.1 = icmp eq i32 %.fr90, 3
%cmp34.1 = icmp eq i32 %.fr90, 4
%t.2.1 = select i1 %cmp34.1, i32 6, i32 %spec.select.1
%arrayidx24.2 = getelementptr inbounds [14 x i32], ptr %card, i64 0, i64 2
%7 = load i32, ptr %arrayidx24.2, align 8, !tbaa !5
%.fr88 = freeze i32 %7
%cmp25.2 = icmp eq i32 %.fr88, 2
%add26.2 = zext i1 %cmp25.2 to i32
%spec.select.2 = add nuw nsw i32 %t.2.1, %add26.2
%cmp29.2 = icmp eq i32 %.fr88, 3
%cmp34.2 = icmp eq i32 %.fr88, 4
%t.2.2 = select i1 %cmp34.2, i32 6, i32 %spec.select.2
%arrayidx24.3 = getelementptr inbounds [14 x i32], ptr %card, i64 0, i64 3
%8 = load i32, ptr %arrayidx24.3, align 4, !tbaa !5
%.fr91 = freeze i32 %8
%cmp25.3 = icmp eq i32 %.fr91, 2
%add26.3 = zext i1 %cmp25.3 to i32
%spec.select.3 = add nuw nsw i32 %t.2.2, %add26.3
%cmp29.3 = icmp eq i32 %.fr91, 3
%cmp34.3 = icmp eq i32 %.fr91, 4
%t.2.3 = select i1 %cmp34.3, i32 6, i32 %spec.select.3
%arrayidx24.4 = getelementptr inbounds [14 x i32], ptr %card, i64 0, i64 4
%9 = load i32, ptr %arrayidx24.4, align 16, !tbaa !5
%.fr87 = freeze i32 %9
%cmp25.4 = icmp eq i32 %.fr87, 2
%add26.4 = zext i1 %cmp25.4 to i32
%spec.select.4 = add nuw nsw i32 %t.2.3, %add26.4
%cmp29.4 = icmp eq i32 %.fr87, 3
%cmp34.4 = icmp eq i32 %.fr87, 4
%t.2.4 = select i1 %cmp34.4, i32 6, i32 %spec.select.4
%arrayidx24.5 = getelementptr inbounds [14 x i32], ptr %card, i64 0, i64 5
%10 = load i32, ptr %arrayidx24.5, align 4, !tbaa !5
%.fr89 = freeze i32 %10
%cmp25.5 = icmp eq i32 %.fr89, 2
%add26.5 = zext i1 %cmp25.5 to i32
%spec.select.5 = add nuw nsw i32 %t.2.4, %add26.5
%cmp29.5 = icmp eq i32 %.fr89, 3
%cmp34.5 = icmp eq i32 %.fr89, 4
%t.2.5 = select i1 %cmp34.5, i32 6, i32 %spec.select.5
%arrayidx24.6 = getelementptr inbounds [14 x i32], ptr %card, i64 0, i64 6
%11 = load <8 x i32>, ptr %arrayidx24.6, align 8, !tbaa !5
%.fr = freeze <8 x i32> %11
%12 = shufflevector <8 x i32> %.fr, <8 x i32> poison, <16 x i32> <i32 7, i32 7, i32 6, i32 6, i32 5, i32 5, i32 4, i32 4, i32 3, i32 3, i32 2, i32 2, i32 1, i32 1, i32 0, i32 0>
%13 = icmp eq <8 x i32> %.fr, <i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
%14 = bitcast <8 x i1> %13 to i8
%15 = icmp ne i8 %14, 0
%op.rdx = or i1 %15, %cmp29.5
%op.rdx83 = or i1 %cmp29.2, %cmp29.1
%16 = or i1 %op.rdx, %cmp29.4
%op.rdx84 = or i1 %16, %cmp29.3
%17 = or i1 %op.rdx84, %op.rdx83
%op.rdx86 = select i1 %17, i1 true, i1 %cmp29
%18 = icmp eq <16 x i32> %12, <i32 4, i32 2, i32 4, i32 2, i32 4, i32 2, i32 4, i32 2, i32 4, i32 2, i32 4, i32 2, i32 4, i32 2, i32 4, i32 2>
%19 = extractelement <16 x i1> %18, i64 15
%add26.6 = zext i1 %19 to i32
%spec.select.6 = add nuw nsw i32 %t.2.5, %add26.6
%20 = extractelement <16 x i1> %18, i64 14
%t.2.6 = select i1 %20, i32 6, i32 %spec.select.6
%21 = extractelement <16 x i1> %18, i64 13
%add26.7 = zext i1 %21 to i32
%spec.select.7 = add nuw nsw i32 %t.2.6, %add26.7
%22 = extractelement <16 x i1> %18, i64 12
%t.2.7 = select i1 %22, i32 6, i32 %spec.select.7
%23 = extractelement <16 x i1> %18, i64 11
%add26.8 = zext i1 %23 to i32
%spec.select.8 = add nuw nsw i32 %t.2.7, %add26.8
%24 = extractelement <16 x i1> %18, i64 10
%t.2.8 = select i1 %24, i32 6, i32 %spec.select.8
%25 = extractelement <16 x i1> %18, i64 9
%add26.9 = zext i1 %25 to i32
%spec.select.9 = add nuw nsw i32 %t.2.8, %add26.9
%26 = extractelement <16 x i1> %18, i64 8
%t.2.9 = select i1 %26, i32 6, i32 %spec.select.9
%27 = extractelement <16 x i1> %18, i64 7
%add26.10 = zext i1 %27 to i32
%spec.select.10 = add nuw nsw i32 %t.2.9, %add26.10
%28 = extractelement <16 x i1> %18, i64 6
%t.2.10 = select i1 %28, i32 6, i32 %spec.select.10
%29 = extractelement <16 x i1> %18, i64 5
%add26.11 = zext i1 %29 to i32
%spec.select.11 = add nuw nsw i32 %t.2.10, %add26.11
%30 = extractelement <16 x i1> %18, i64 4
%t.2.11 = select i1 %30, i32 6, i32 %spec.select.11
%31 = extractelement <16 x i1> %18, i64 3
%add26.12 = zext i1 %31 to i32
%spec.select.12 = add nuw nsw i32 %t.2.11, %add26.12
%32 = extractelement <16 x i1> %18, i64 2
%t.2.12 = select i1 %32, i32 6, i32 %spec.select.12
%33 = extractelement <16 x i1> %18, i64 1
%add26.13 = zext i1 %33 to i32
%spec.select.13 = add nuw nsw i32 %t.2.12, %add26.13
%34 = extractelement <16 x i1> %18, i64 0
%t.2.13 = select i1 %34, i32 6, i32 %spec.select.13
%cmp37 = icmp eq i32 %t.2.13, 1
%or.cond = select i1 %cmp37, i1 %op.rdx86, i1 false
%35 = add i32 %t.2.13, -1
%or.cond51 = icmp ult i32 %35, 6
%. = select i1 %op.rdx86, i32 3, i32 0
%spec.select71 = select i1 %or.cond51, i32 %t.2.13, i32 %.
%retval.0 = select i1 %or.cond, i32 5, i32 %spec.select71
call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %card) #9
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #3 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @straight(i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %d, i32 noundef %e) local_unnamed_addr #4 {
entry:
%num = alloca [5 x i32], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %num) #9
store i32 %a, ptr %num, align 16, !tbaa !5
%arrayinit.element = getelementptr inbounds i32, ptr %num, i64 1
store i32 %b, ptr %arrayinit.element, align 4, !tbaa !5
%arrayinit.element1 = getelementptr inbounds i32, ptr %num, i64 2
store i32 %c, ptr %arrayinit.element1, align 8, !tbaa !5
%arrayinit.element2 = getelementptr inbounds i32, ptr %num, i64 3
store i32 %d, ptr %arrayinit.element2, align 4, !tbaa !5
%arrayinit.element3 = getelementptr inbounds i32, ptr %num, i64 4
store i32 %e, ptr %arrayinit.element3, align 16, !tbaa !5
call void @qsort(ptr noundef nonnull %num, i64 noundef 5, i64 noundef 4, ptr noundef nonnull @compare_int) #9
%0 = load i32, ptr %num, align 16, !tbaa !5
%1 = load i32, ptr %arrayinit.element, align 4, !tbaa !5
%2 = load i32, ptr %arrayinit.element1, align 8, !tbaa !5
%3 = load i32, ptr %arrayinit.element2, align 4, !tbaa !5
%4 = load i32, ptr %arrayinit.element3, align 16, !tbaa !5
%add = add nsw i32 %0, 1
%cmp = icmp eq i32 %1, %add
%add8 = add nsw i32 %1, 1
%cmp9 = icmp eq i32 %2, %add8
%or.cond48 = select i1 %cmp, i1 %cmp9, i1 false
%add11 = add nsw i32 %2, 1
%cmp12 = icmp eq i32 %3, %add11
%or.cond49 = select i1 %or.cond48, i1 %cmp12, i1 false
%add14 = add nsw i32 %3, 1
%cmp15 = icmp eq i32 %4, %add14
%or.cond50 = select i1 %or.cond49, i1 %cmp15, i1 false
br i1 %or.cond50, label %cleanup, label %if.end19
if.end19: ; preds = %entry
%cmp20 = icmp eq i32 %0, 1
%cmp21 = icmp eq i32 %1, 10
%or.cond = and i1 %cmp20, %cmp21
%cmp23 = icmp eq i32 %2, 11
%or.cond35 = select i1 %or.cond, i1 %cmp23, i1 false
%cmp25 = icmp eq i32 %3, 12
%or.cond36 = select i1 %or.cond35, i1 %cmp25, i1 false
%cmp27 = icmp eq i32 %4, 13
%or.cond37 = select i1 %or.cond36, i1 %cmp27, i1 false
%. = select i1 %or.cond37, i32 4, i32 0
br label %cleanup
cleanup: ; preds = %if.end19, %entry
%retval.0 = phi i32 [ 4, %entry ], [ %., %if.end19 ]
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %num) #9
ret i32 %retval.0
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%num.i = alloca [5 x i32], align 16
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
%e = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %e) #9
%call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e)
%cmp26 = icmp eq i32 %call25, -1
br i1 %cmp26, label %while.end, label %if.end.lr.ph
if.end.lr.ph: ; preds = %entry
%arrayinit.element.i = getelementptr inbounds i32, ptr %num.i, i64 1
%arrayinit.element1.i = getelementptr inbounds i32, ptr %num.i, i64 2
%arrayinit.element2.i = getelementptr inbounds i32, ptr %num.i, i64 3
%arrayinit.element3.i = getelementptr inbounds i32, ptr %num.i, i64 4
br label %if.end
if.end: ; preds = %if.end.lr.ph, %sw.epilog
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%2 = load i32, ptr %c, align 4, !tbaa !5
%3 = load i32, ptr %d, align 4, !tbaa !5
%4 = load i32, ptr %e, align 4, !tbaa !5
%call1 = call i32 @pair(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4)
%cmp2 = icmp eq i32 %call1, 0
br i1 %cmp2, label %if.then3, label %if.end5
if.then3: ; preds = %if.end
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %num.i) #9
store i32 %0, ptr %num.i, align 16, !tbaa !5
store i32 %1, ptr %arrayinit.element.i, align 4, !tbaa !5
store i32 %2, ptr %arrayinit.element1.i, align 8, !tbaa !5
store i32 %3, ptr %arrayinit.element2.i, align 4, !tbaa !5
store i32 %4, ptr %arrayinit.element3.i, align 16, !tbaa !5
call void @qsort(ptr noundef nonnull %num.i, i64 noundef 5, i64 noundef 4, ptr noundef nonnull @compare_int) #9
%5 = load i32, ptr %num.i, align 16, !tbaa !5
%6 = load i32, ptr %arrayinit.element.i, align 4, !tbaa !5
%7 = load i32, ptr %arrayinit.element1.i, align 8, !tbaa !5
%8 = load i32, ptr %arrayinit.element2.i, align 4, !tbaa !5
%9 = load i32, ptr %arrayinit.element3.i, align 16, !tbaa !5
%add.i = add nsw i32 %5, 1
%cmp.i = icmp eq i32 %6, %add.i
%add8.i = add nsw i32 %6, 1
%cmp9.i = icmp eq i32 %7, %add8.i
%or.cond48.i = select i1 %cmp.i, i1 %cmp9.i, i1 false
%add11.i = add nsw i32 %7, 1
%cmp12.i = icmp eq i32 %8, %add11.i
%or.cond49.i = select i1 %or.cond48.i, i1 %cmp12.i, i1 false
%add14.i = add nsw i32 %8, 1
%cmp15.i = icmp eq i32 %9, %add14.i
%or.cond50.i = select i1 %or.cond49.i, i1 %cmp15.i, i1 false
br i1 %or.cond50.i, label %straight.exit, label %if.end19.i
if.end19.i: ; preds = %if.then3
%cmp20.i = icmp eq i32 %5, 1
%cmp21.i = icmp eq i32 %6, 10
%or.cond.i = and i1 %cmp20.i, %cmp21.i
%cmp23.i = icmp eq i32 %7, 11
%or.cond35.i = select i1 %or.cond.i, i1 %cmp23.i, i1 false
%cmp25.i = icmp eq i32 %8, 12
%or.cond36.i = select i1 %or.cond35.i, i1 %cmp25.i, i1 false
%cmp27.i = icmp eq i32 %9, 13
%or.cond37.i = select i1 %or.cond36.i, i1 %cmp27.i, i1 false
%..i = select i1 %or.cond37.i, i32 4, i32 0
br label %straight.exit
straight.exit: ; preds = %if.then3, %if.end19.i
%retval.0.i = phi i32 [ 4, %if.then3 ], [ %..i, %if.end19.i ]
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %num.i) #9
br label %if.end5
if.end5: ; preds = %straight.exit, %if.end
%op.0 = phi i32 [ %retval.0.i, %straight.exit ], [ %call1, %if.end ]
%switch.tableidx = add i32 %op.0, -1
%10 = icmp ult i32 %switch.tableidx, 6
br i1 %10, label %switch.lookup, label %sw.epilog
switch.lookup: ; preds = %if.end5
%11 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %11, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %sw.epilog
sw.epilog: ; preds = %if.end5, %switch.lookup
%str.13.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @str.13, %if.end5 ]
%puts24 = call i32 @puts(ptr nonnull dereferenceable(1) %str.13.sink)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e)
%cmp = icmp eq i32 %call, -1
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %sw.epilog, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %e) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #9
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #8
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind "no-trapping-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 nosync nounwind willreturn memory(argmem: read) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int k;
int a[1000001];
scanf("%d", &k);
a[1] = 7 % k;
for(int i = 2; i <= k; ++i){
a[i] = (10 * a[i-1] + 7) % k;
}
int flag = 0;
for(int i = 1; i <= k; ++i){
if(a[i] == 0){
printf("%d\n", i);
flag = 1;
break;
}
}
if(flag == 0) printf("-1\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_207875/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_207875/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [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
%a = alloca [1000001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4000004, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%rem = srem i32 7, %0
%arrayidx = getelementptr inbounds [1000001 x i32], ptr %a, i64 0, i64 1
store i32 %rem, ptr %arrayidx, align 4, !tbaa !5
%cmp.not31 = icmp slt i32 %0, 2
br i1 %cmp.not31, label %for.cond6.preheader, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = add nuw i32 %0, 1
%wide.trip.count = zext i32 %1 to i64
%xtraiter = and i64 %wide.trip.count, 1
%2 = icmp eq i32 %1, 3
br i1 %2, label %for.cond6.preheader.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%3 = and i64 %wide.trip.count, 4294967294
%4 = add nsw i64 %3, -4
br label %for.body
for.cond6.preheader.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%.unr = phi i32 [ %rem, %for.body.preheader ], [ %rem2.1, %for.body ]
%indvars.iv.unr = phi i64 [ 2, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond6.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond6.preheader.loopexit.unr-lcssa
%mul.epil = mul nsw i32 %.unr, 10
%add.epil = add nsw i32 %mul.epil, 7
%rem2.epil = srem i32 %add.epil, %0
%arrayidx4.epil = getelementptr inbounds [1000001 x i32], ptr %a, i64 0, i64 %indvars.iv.unr
store i32 %rem2.epil, ptr %arrayidx4.epil, align 4, !tbaa !5
br label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.body.epil, %for.cond6.preheader.loopexit.unr-lcssa, %entry
%cmp7.not33 = icmp slt i32 %0, 1
br i1 %cmp7.not33, label %if.then18, label %for.body9.preheader
for.body9.preheader: ; preds = %for.cond6.preheader
%5 = add nuw i32 %0, 1
%wide.trip.count41 = zext i32 %5 to i64
br label %for.body9
for.body: ; preds = %for.body, %for.body.preheader.new
%6 = phi i32 [ %rem, %for.body.preheader.new ], [ %rem2.1, %for.body ]
%indvars.iv = phi i64 [ 2, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%mul = mul nsw i32 %6, 10
%add = add nsw i32 %mul, 7
%rem2 = srem i32 %add, %0
%arrayidx4 = getelementptr inbounds [1000001 x i32], ptr %a, i64 0, i64 %indvars.iv
store i32 %rem2, ptr %arrayidx4, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%mul.1 = mul nsw i32 %rem2, 10
%add.1 = add nsw i32 %mul.1, 7
%rem2.1 = srem i32 %add.1, %0
%arrayidx4.1 = getelementptr inbounds [1000001 x i32], ptr %a, i64 0, i64 %indvars.iv.next
store i32 %rem2.1, ptr %arrayidx4.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter, %4
br i1 %niter.ncmp.1, label %for.cond6.preheader.loopexit.unr-lcssa, label %for.body, !llvm.loop !9
for.body9: ; preds = %for.body9.preheader, %for.inc14
%indvars.iv38 = phi i64 [ 1, %for.body9.preheader ], [ %indvars.iv.next39, %for.inc14 ]
%arrayidx11 = getelementptr inbounds [1000001 x i32], ptr %a, i64 0, i64 %indvars.iv38
%7 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp eq i32 %7, 0
br i1 %cmp12, label %if.then, label %for.inc14
if.then: ; preds = %for.body9
%8 = trunc i64 %indvars.iv38 to i32
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
br label %if.end20
for.inc14: ; preds = %for.body9
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%exitcond42.not = icmp eq i64 %indvars.iv.next39, %wide.trip.count41
br i1 %exitcond42.not, label %if.then18, label %for.body9, !llvm.loop !11
if.then18: ; preds = %for.inc14, %for.cond6.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end20
if.end20: ; preds = %if.then, %if.then18
call void @llvm.lifetime.end.p0(i64 4000004, ptr nonnull %a) #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
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main()
{
int k, l;
int ans = 1;
scanf("%d", &k);
if (k % 7 == 0)
l = 9 * k / 7;
else
l = 9 * k;
if (l % 2 == 0 || l % 5 == 0)
ans = -1;
else
{
int remain = 10 % l;
while (remain != 1) {
remain = remain * 10 % l;
ans++;
}
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_207918/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_207918/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
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 %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%rem = srem i32 %0, 7
%cmp = icmp eq i32 %rem, 0
%mul = mul nsw i32 %0, 9
%div = sdiv i32 %mul, 7
%l.0 = select i1 %cmp, i32 %div, i32 %mul
%1 = and i32 %l.0, 1
%cmp3 = icmp eq i32 %1, 0
%rem4 = srem i32 %l.0, 5
%cmp5 = icmp eq i32 %rem4, 0
%or.cond = or i1 %cmp3, %cmp5
br i1 %or.cond, label %if.end12, label %while.cond.preheader
while.cond.preheader: ; preds = %entry
%remain.019 = srem i32 10, %l.0
%cmp9.not20 = icmp eq i32 %remain.019, 1
br i1 %cmp9.not20, label %if.end12, label %while.body
while.body: ; preds = %while.cond.preheader, %while.body
%remain.022 = phi i32 [ %remain.0, %while.body ], [ %remain.019, %while.cond.preheader ]
%ans.021 = phi i32 [ %inc, %while.body ], [ 1, %while.cond.preheader ]
%mul10 = mul nsw i32 %remain.022, 10
%inc = add nuw nsw i32 %ans.021, 1
%remain.0 = srem i32 %mul10, %l.0
%cmp9.not = icmp eq i32 %remain.0, 1
br i1 %cmp9.not, label %if.end12, label %while.body, !llvm.loop !9
if.end12: ; preds = %while.body, %while.cond.preheader, %entry
%ans.1 = phi i32 [ -1, %entry ], [ 1, %while.cond.preheader ], [ %inc, %while.body ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.1)
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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
long long int K;
int N=1;
long long int S=7LL;
scanf("%lld",&K);
if(K%2LL==0 || K%5LL==0){
printf("-1\n");
}else{
while(S%K!=0){
S=(S*10LL+7LL)%K;
N++;
}
printf("%d\n",N);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_207961/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_207961/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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 i64, align 8
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 %K)
%0 = load i64, ptr %K, align 8, !tbaa !5
%1 = and i64 %0, 1
%cmp = icmp eq i64 %1, 0
%rem1 = srem i64 %0, 5
%cmp2 = icmp eq i64 %rem1, 0
%or.cond = or i1 %cmp, %cmp2
br i1 %or.cond, label %if.then, label %while.cond.preheader
while.cond.preheader: ; preds = %entry
%rem410 = srem i64 7, %0
%cmp5.not11 = icmp eq i64 %rem410, 0
br i1 %cmp5.not11, label %while.end, label %while.body
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
while.body: ; preds = %while.cond.preheader, %while.body
%S.013 = phi i64 [ %rem6, %while.body ], [ 7, %while.cond.preheader ]
%N.012 = phi i32 [ %inc, %while.body ], [ 1, %while.cond.preheader ]
%mul = mul nsw i64 %S.013, 10
%add = add nsw i64 %mul, 7
%rem6 = srem i64 %add, %0
%inc = add nuw nsw i32 %N.012, 1
%cmp5.not = icmp eq i64 %rem6, 0
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %while.cond.preheader
%N.0.lcssa = phi i32 [ 1, %while.cond.preheader ], [ %inc, %while.body ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %N.0.lcssa)
br label %if.end
if.end: ; preds = %while.end, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
typedef long long ll;
typedef const void cv;
int downint(cv *a, cv *b) {
return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0;
}
int main(void){
int n,k,i,h[200000];
ll result=0;
scanf("%d",&n);
scanf("%d",&k);
for(i=0;i<n;i++){
scanf("%d",&h[i]);
}
if(n<=k){
printf("0");
return 0;
}
qsort(h,n,sizeof(int),downint);
for(i=k;i<n;i++){
result+=(ll)h[i];
}
printf("%lld",result);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208003/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208003/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downint(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp sgt i32 %0, %1
%cond = sext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 1, i32 %cond
ret i32 %cond2
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%h = alloca [200000 x i32], align 16
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 800000, ptr nonnull %h) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %0, 0
br i1 %cmp26, 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 [200000 x i32], ptr %h, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%3 = load i32, ptr %k, align 4, !tbaa !5
%cmp3.not = icmp sgt i32 %.lcssa, %3
br i1 %cmp3.not, label %if.end, label %if.then
if.then: ; preds = %for.end
%putchar = call i32 @putchar(i32 48)
br label %cleanup
if.end: ; preds = %for.end
%conv = sext i32 %.lcssa to i64
call void @qsort(ptr noundef nonnull %h, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @downint) #7
%4 = load i32, ptr %k, align 4, !tbaa !5
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp628 = icmp slt i32 %4, %5
br i1 %cmp628, label %for.body8.preheader, label %for.end14
for.body8.preheader: ; preds = %if.end
%6 = sext i32 %4 to i64
%wide.trip.count = sext i32 %5 to i64
%7 = sub nsw i64 %wide.trip.count, %6
%min.iters.check = icmp ult i64 %7, 4
br i1 %min.iters.check, label %for.body8.preheader41, label %vector.ph
vector.ph: ; preds = %for.body8.preheader
%n.vec = and i64 %7, -4
%ind.end = add nsw i64 %n.vec, %6
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 ], [ %12, %vector.body ]
%vec.phi39 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%offset.idx = add i64 %index, %6
%8 = getelementptr inbounds [200000 x i32], ptr %h, i64 0, i64 %offset.idx
%wide.load = load <2 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 2
%wide.load40 = load <2 x i32>, ptr %9, align 4, !tbaa !5
%10 = sext <2 x i32> %wide.load to <2 x i64>
%11 = sext <2 x i32> %wide.load40 to <2 x i64>
%12 = add <2 x i64> %vec.phi, %10
%13 = add <2 x i64> %vec.phi39, %11
%index.next = add nuw i64 %index, 4
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %13, %12
%15 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %7, %n.vec
br i1 %cmp.n, label %for.end14, label %for.body8.preheader41
for.body8.preheader41: ; preds = %for.body8.preheader, %middle.block
%indvars.iv34.ph = phi i64 [ %6, %for.body8.preheader ], [ %ind.end, %middle.block ]
%result.030.ph = phi i64 [ 0, %for.body8.preheader ], [ %15, %middle.block ]
br label %for.body8
for.body8: ; preds = %for.body8.preheader41, %for.body8
%indvars.iv34 = phi i64 [ %indvars.iv.next35, %for.body8 ], [ %indvars.iv34.ph, %for.body8.preheader41 ]
%result.030 = phi i64 [ %add, %for.body8 ], [ %result.030.ph, %for.body8.preheader41 ]
%arrayidx10 = getelementptr inbounds [200000 x i32], ptr %h, i64 0, i64 %indvars.iv34
%16 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%conv11 = sext i32 %16 to i64
%add = add nsw i64 %result.030, %conv11
%indvars.iv.next35 = add nsw i64 %indvars.iv34, 1
%exitcond.not = icmp eq i64 %indvars.iv.next35, %wide.trip.count
br i1 %exitcond.not, label %for.end14, label %for.body8, !llvm.loop !14
for.end14: ; preds = %for.body8, %middle.block, %if.end
%result.0.lcssa = phi i64 [ 0, %if.end ], [ %15, %middle.block ], [ %add, %for.body8 ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %result.0.lcssa)
br label %cleanup
cleanup: ; preds = %for.end14, %if.then
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %h) #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) #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: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
|
#include <stdio.h>
#include <stdlib.h>
void merge(int arr[], int l, int m, int r)
{
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
/* create temp arrays */
int L[n1], R[n2];
/* Copy data to temp arrays L[] and R[] */
for (i = 0; i < n1; i++)
L[i] = arr[l + i];
for (j = 0; j < n2; j++)
R[j] = arr[m + 1+ j];
/* Merge the temp arrays back into arr[l..r]*/
i = 0; // Initial index of first subarray
j = 0; // Initial index of second subarray
k = l; // Initial index of merged subarray
while (i < n1 && j < n2)
{
if (L[i] <= R[j])
{
arr[k] = L[i];
i++;
}
else
{
arr[k] = R[j];
j++;
}
k++;
}
/* Copy the remaining elements of L[], if there
are any */
while (i < n1)
{
arr[k] = L[i];
i++;
k++;
}
/* Copy the remaining elements of R[], if there
are any */
while (j < n2)
{
arr[k] = R[j];
j++;
k++;
}
}
/* l is for left index and r is right index of the
sub-array of arr to be sorted */
void mergeSort(int arr[], int l, int r)
{
if (l < r)
{
// Same as (l+r)/2, but avoids overflow for
// large l and h
int m = l+(r-l)/2;
// Sort first and second halves
mergeSort(arr, l, m);
mergeSort(arr, m+1, r);
merge(arr, l, m, r);
}
}
int main()
{
int i , numOfMons, numOfSpecMoves;
unsigned int *monsHealth;
long long accHealth = 0;
scanf("%d %d", &numOfMons, &numOfSpecMoves);
monsHealth = (int*) calloc (numOfMons, sizeof(int));
for (i=0; i<numOfMons ; i++)
{
scanf("%u", &monsHealth[i]);
accHealth += monsHealth[i];
}
mergeSort(monsHealth, 0, numOfMons-1);
// quickSort(monsHealth, 0, numOfMons-1);
for (i=numOfMons-1; numOfSpecMoves>0 && i>=0; numOfSpecMoves--,i--)
{
accHealth -= monsHealth[i];
}
printf("%lli",accHealth);
free(monsHealth);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208054/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208054/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%u\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%lli\00", align 1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @merge(ptr nocapture noundef %arr, i32 noundef %l, i32 noundef %m, i32 noundef %r) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %m, %l
%add = add nsw i32 %sub, 1
%sub1 = sub i32 %r, %m
%0 = zext i32 %add to i64
%vla = alloca i32, i64 %0, align 16
%1 = zext i32 %sub1 to i64
%vla2 = alloca i32, i64 %1, align 16
%cmp.not98 = icmp slt i32 %sub, 0
br i1 %cmp.not98, label %for.cond6.preheader, label %for.body.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %l to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr %arr, i64 %3
%4 = add i32 %m, 1
%5 = sub i32 %4, %l
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %vla, ptr align 4 %scevgep, i64 %7, i1 false), !tbaa !5
br label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.body.preheader, %entry
%cmp7100 = icmp sgt i32 %sub1, 0
br i1 %cmp7100, label %for.body8.lr.ph, label %while.cond36.preheader
for.body8.lr.ph: ; preds = %for.cond6.preheader
%add9 = add nsw i32 %m, 1
%8 = sext i32 %add9 to i64
%invariant.gep = getelementptr i32, ptr %arr, i64 %8
%min.iters.check = icmp ult i32 %sub1, 8
br i1 %min.iters.check, label %for.body8.preheader, label %vector.ph
vector.ph: ; preds = %for.body8.lr.ph
%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 ]
%9 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = getelementptr i32, ptr %9, i64 4
%wide.load143 = load <4 x i32>, ptr %10, align 4, !tbaa !5
%11 = getelementptr inbounds i32, ptr %vla2, i64 %index
store <4 x i32> %wide.load, ptr %11, align 16, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 4
store <4 x i32> %wide.load143, ptr %12, align 16, !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 !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %while.cond.preheader, label %for.body8.preheader
for.body8.preheader: ; preds = %for.body8.lr.ph, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body8.lr.ph ], [ %n.vec, %middle.block ]
br label %for.body8
while.cond.preheader: ; preds = %for.body8, %middle.block
%cmp18102 = icmp sgt i32 %sub, -1
%14 = and i1 %cmp18102, %cmp7100
br i1 %14, label %while.body.preheader, label %while.cond36.preheader
while.body.preheader: ; preds = %while.cond.preheader
%15 = sext i32 %l to i64
br label %while.body
for.body8: ; preds = %for.body8.preheader, %for.body8
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body8 ], [ %indvars.iv.ph, %for.body8.preheader ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%16 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx14 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv
store i32 %16, ptr %arrayidx14, 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 %while.cond.preheader, label %for.body8, !llvm.loop !13
while.cond36.preheader.loopexit: ; preds = %while.body
%17 = trunc i64 %indvars.iv.next121 to i32
br label %while.cond36.preheader
while.cond36.preheader: ; preds = %for.cond6.preheader, %while.cond36.preheader.loopexit, %while.cond.preheader
%k.0.lcssa = phi i32 [ %l, %while.cond.preheader ], [ %17, %while.cond36.preheader.loopexit ], [ %l, %for.cond6.preheader ]
%j.1.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %j.2, %while.cond36.preheader.loopexit ], [ 0, %for.cond6.preheader ]
%i.1.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %i.2, %while.cond36.preheader.loopexit ], [ 0, %for.cond6.preheader ]
%cmp37.not109 = icmp sgt i32 %i.1.lcssa, %sub
br i1 %cmp37.not109, label %while.cond46.preheader, label %while.body38.preheader
while.body38.preheader: ; preds = %while.cond36.preheader
%18 = sext i32 %k.0.lcssa to i64
%19 = shl nsw i64 %18, 2
%scevgep123 = getelementptr i8, ptr %arr, i64 %19
%20 = sext i32 %i.1.lcssa to i64
%21 = shl nsw i64 %20, 2
%scevgep124 = getelementptr i8, ptr %vla, i64 %21
%22 = add i32 %i.1.lcssa, %l
%23 = sub i32 %m, %22
%24 = zext i32 %23 to i64
%25 = shl nuw nsw i64 %24, 2
%26 = add nuw nsw i64 %25, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep123, ptr noundef nonnull align 4 dereferenceable(1) %scevgep124, i64 %26, i1 false), !tbaa !5
%27 = add i32 %m, 1
%28 = sub i32 %27, %l
%29 = add i32 %i.1.lcssa, %l
%30 = sub i32 %m, %29
%31 = zext i32 %30 to i64
%32 = add nuw nsw i64 %31, 1
%min.iters.check146 = icmp ult i32 %30, 3
br i1 %min.iters.check146, label %while.body38.preheader156, label %vector.ph147
vector.ph147: ; preds = %while.body38.preheader
%n.vec149 = and i64 %32, 8589934588
%ind.end = add nsw i64 %n.vec149, %20
%33 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %18, i64 0
br label %vector.body152
vector.body152: ; preds = %vector.body152, %vector.ph147
%index153 = phi i64 [ 0, %vector.ph147 ], [ %index.next155, %vector.body152 ]
%vec.phi = phi <2 x i64> [ %33, %vector.ph147 ], [ %34, %vector.body152 ]
%vec.phi154 = phi <2 x i64> [ zeroinitializer, %vector.ph147 ], [ %35, %vector.body152 ]
%34 = add <2 x i64> %vec.phi, <i64 1, i64 1>
%35 = add <2 x i64> %vec.phi154, <i64 1, i64 1>
%index.next155 = add nuw i64 %index153, 4
%36 = icmp eq i64 %index.next155, %n.vec149
br i1 %36, label %middle.block144, label %vector.body152, !llvm.loop !14
middle.block144: ; preds = %vector.body152
%bin.rdx = add <2 x i64> %35, %34
%37 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n151 = icmp eq i64 %32, %n.vec149
br i1 %cmp.n151, label %while.cond46.preheader.loopexit, label %while.body38.preheader156
while.body38.preheader156: ; preds = %while.body38.preheader, %middle.block144
%indvars.iv127.ph = phi i64 [ %18, %while.body38.preheader ], [ %37, %middle.block144 ]
%indvars.iv125.ph = phi i64 [ %20, %while.body38.preheader ], [ %ind.end, %middle.block144 ]
br label %while.body38
while.body: ; preds = %while.body.preheader, %while.body
%indvars.iv120 = phi i64 [ %15, %while.body.preheader ], [ %indvars.iv.next121, %while.body ]
%i.1106 = phi i32 [ 0, %while.body.preheader ], [ %i.2, %while.body ]
%j.1105 = phi i32 [ 0, %while.body.preheader ], [ %j.2, %while.body ]
%idxprom20 = zext i32 %i.1106 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %vla, i64 %idxprom20
%38 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%idxprom22 = zext i32 %j.1105 to i64
%arrayidx23 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom22
%39 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24.not = icmp sgt i32 %38, %39
%.sink = tail call i32 @llvm.smin.i32(i32 %38, i32 %39)
%inc34 = zext i1 %cmp24.not to i32
%j.2 = add nuw nsw i32 %j.1105, %inc34
%not.cmp24.not = xor i1 %cmp24.not, true
%inc29 = zext i1 %not.cmp24.not to i32
%i.2 = add nuw nsw i32 %i.1106, %inc29
%40 = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv120
store i32 %.sink, ptr %40, align 4
%indvars.iv.next121 = add i64 %indvars.iv120, 1
%cmp18 = icmp sle i32 %i.2, %sub
%cmp19 = icmp slt i32 %j.2, %sub1
%41 = select i1 %cmp18, i1 %cmp19, i1 false
br i1 %41, label %while.body, label %while.cond36.preheader.loopexit, !llvm.loop !15
while.cond46.preheader.loopexit: ; preds = %while.body38, %middle.block144
%indvars.iv.next128.lcssa = phi i64 [ %37, %middle.block144 ], [ %indvars.iv.next128, %while.body38 ]
%42 = trunc i64 %indvars.iv.next128.lcssa to i32
br label %while.cond46.preheader
while.cond46.preheader: ; preds = %while.cond46.preheader.loopexit, %while.cond36.preheader
%k.1.lcssa = phi i32 [ %k.0.lcssa, %while.cond36.preheader ], [ %42, %while.cond46.preheader.loopexit ]
%cmp47113 = icmp slt i32 %j.1.lcssa, %sub1
br i1 %cmp47113, label %while.body48.preheader, label %while.end55
while.body48.preheader: ; preds = %while.cond46.preheader
%43 = sext i32 %k.1.lcssa to i64
%44 = shl nsw i64 %43, 2
%scevgep133 = getelementptr i8, ptr %arr, i64 %44
%45 = sext i32 %j.1.lcssa to i64
%46 = shl nsw i64 %45, 2
%scevgep134 = getelementptr i8, ptr %vla2, i64 %46
%47 = xor i32 %j.1.lcssa, -1
%48 = add i32 %47, %r
%49 = sub i32 %48, %m
%50 = zext i32 %49 to i64
%51 = shl nuw nsw i64 %50, 2
%52 = add nuw nsw i64 %51, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep133, ptr noundef nonnull align 4 dereferenceable(1) %scevgep134, i64 %52, i1 false), !tbaa !5
br label %while.end55
while.body38: ; preds = %while.body38.preheader156, %while.body38
%indvars.iv127 = phi i64 [ %indvars.iv.next128, %while.body38 ], [ %indvars.iv127.ph, %while.body38.preheader156 ]
%indvars.iv125 = phi i64 [ %indvars.iv.next126, %while.body38 ], [ %indvars.iv125.ph, %while.body38.preheader156 ]
%indvars.iv.next126 = add nsw i64 %indvars.iv125, 1
%indvars.iv.next128 = add nsw i64 %indvars.iv127, 1
%lftr.wideiv = trunc i64 %indvars.iv.next126 to i32
%exitcond132.not = icmp eq i32 %28, %lftr.wideiv
br i1 %exitcond132.not, label %while.cond46.preheader.loopexit, label %while.body38, !llvm.loop !16
while.end55: ; preds = %while.body48.preheader, %while.cond46.preheader
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @mergeSort(ptr noundef %arr, i32 noundef %l, i32 noundef %r) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %l, %r
br i1 %cmp, label %if.then, label %common.ret13
common.ret13: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%sub = sub nsw i32 %r, %l
%div = sdiv i32 %sub, 2
%add = add nsw i32 %div, %l
tail call void @mergeSort(ptr noundef %arr, i32 noundef %l, i32 noundef %add)
%add1 = add nsw i32 %add, 1
tail call void @mergeSort(ptr noundef %arr, i32 noundef %add1, i32 noundef %r)
tail call void @merge(ptr noundef %arr, i32 noundef %l, i32 noundef %add, i32 noundef %r)
br label %common.ret13
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%numOfMons = alloca i32, align 4
%numOfSpecMoves = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %numOfMons) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %numOfSpecMoves) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %numOfMons, ptr noundef nonnull %numOfSpecMoves)
%0 = load i32, ptr %numOfMons, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #9
%cmp35 = icmp sgt i32 %0, 0
br i1 %cmp35, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%accHealth.037 = phi i64 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%conv6 = zext i32 %1 to i64
%add = add nuw nsw i64 %accHealth.037, %conv6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %numOfMons, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !17
for.end: ; preds = %for.body, %entry
%accHealth.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ]
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
%sub = add nsw i32 %.lcssa, -1
call void @mergeSort(ptr noundef %call1, i32 noundef 0, i32 noundef %sub)
%numOfSpecMoves.promoted = load i32, ptr %numOfSpecMoves, align 4, !tbaa !5
%cmp940 = icmp sgt i32 %numOfSpecMoves.promoted, 0
%cmp1141 = icmp sgt i32 %.lcssa, 0
%4 = and i1 %cmp1141, %cmp940
br i1 %4, label %for.body13.preheader, label %for.end20
for.body13.preheader: ; preds = %for.end
%5 = zext i32 %.lcssa to i64
%6 = add nsw i64 %5, -1
%7 = add i32 %numOfSpecMoves.promoted, -1
%8 = zext i32 %7 to i64
%umin53 = call i64 @llvm.umin.i64(i64 %6, i64 %8)
%9 = add nuw nsw i64 %umin53, 1
%min.iters.check = icmp ult i64 %umin53, 13
br i1 %min.iters.check, label %for.body13.preheader61, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body13.preheader
%10 = add nsw i64 %5, -1
%11 = add i32 %numOfSpecMoves.promoted, -1
%12 = zext i32 %11 to i64
%umin = call i64 @llvm.umin.i64(i64 %10, i64 %12)
%13 = add i32 %.lcssa, -1
%14 = trunc i64 %umin to i32
%15 = icmp ult i32 %13, %14
br i1 %15, label %for.body13.preheader61, label %vector.ph
vector.ph: ; preds = %vector.scevcheck
%n.vec = and i64 %9, 8589934588
%ind.end = sub nsw i64 %5, %n.vec
%.cast = trunc i64 %n.vec to i32
%ind.end54 = sub i32 %numOfSpecMoves.promoted, %.cast
%16 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %accHealth.0.lcssa, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ %16, %vector.ph ], [ %25, %vector.body ]
%vec.phi56 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %26, %vector.body ]
%17 = xor i64 %index, -1
%18 = add i64 %17, %5
%19 = and i64 %18, 4294967295
%20 = getelementptr inbounds i32, ptr %call1, i64 %19
%21 = getelementptr inbounds i32, ptr %20, i64 -1
%wide.load = load <2 x i32>, ptr %21, align 4, !tbaa !5
%reverse = shufflevector <2 x i32> %wide.load, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
%22 = getelementptr inbounds i32, ptr %20, i64 -3
%wide.load59 = load <2 x i32>, ptr %22, align 4, !tbaa !5
%reverse60 = shufflevector <2 x i32> %wide.load59, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
%23 = zext <2 x i32> %reverse to <2 x i64>
%24 = zext <2 x i32> %reverse60 to <2 x i64>
%25 = sub <2 x i64> %vec.phi, %23
%26 = sub <2 x i64> %vec.phi56, %24
%index.next = add nuw i64 %index, 4
%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
%bin.rdx = add <2 x i64> %26, %25
%28 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %9, %n.vec
br i1 %cmp.n, label %for.cond8.for.end20_crit_edge, label %for.body13.preheader61
for.body13.preheader61: ; preds = %vector.scevcheck, %for.body13.preheader, %middle.block
%indvars.iv48.ph = phi i64 [ %5, %vector.scevcheck ], [ %5, %for.body13.preheader ], [ %ind.end, %middle.block ]
%accHealth.144.ph = phi i64 [ %accHealth.0.lcssa, %vector.scevcheck ], [ %accHealth.0.lcssa, %for.body13.preheader ], [ %28, %middle.block ]
%dec3942.ph = phi i32 [ %numOfSpecMoves.promoted, %vector.scevcheck ], [ %numOfSpecMoves.promoted, %for.body13.preheader ], [ %ind.end54, %middle.block ]
br label %for.body13
for.body13: ; preds = %for.body13.preheader61, %for.body13
%indvars.iv48 = phi i64 [ %indvars.iv.next49, %for.body13 ], [ %indvars.iv48.ph, %for.body13.preheader61 ]
%accHealth.144 = phi i64 [ %sub17, %for.body13 ], [ %accHealth.144.ph, %for.body13.preheader61 ]
%dec3942 = phi i32 [ %dec, %for.body13 ], [ %dec3942.ph, %for.body13.preheader61 ]
%indvars.iv.next49 = add nsw i64 %indvars.iv48, -1
%idxprom14 = and i64 %indvars.iv.next49, 4294967295
%arrayidx15 = getelementptr inbounds i32, ptr %call1, i64 %idxprom14
%29 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%conv16 = zext i32 %29 to i64
%sub17 = sub nsw i64 %accHealth.144, %conv16
%dec = add nsw i32 %dec3942, -1
%cmp9 = icmp ugt i32 %dec3942, 1
%cmp11 = icmp ugt i64 %indvars.iv48, 1
%30 = and i1 %cmp11, %cmp9
br i1 %30, label %for.body13, label %for.cond8.for.end20_crit_edge, !llvm.loop !19
for.cond8.for.end20_crit_edge: ; preds = %for.body13, %middle.block
%sub17.lcssa = phi i64 [ %28, %middle.block ], [ %sub17, %for.body13 ]
%dec.lcssa = phi i32 [ %ind.end54, %middle.block ], [ %dec, %for.body13 ]
store i32 %dec.lcssa, ptr %numOfSpecMoves, align 4, !tbaa !5
br label %for.end20
for.end20: ; preds = %for.cond8.for.end20_crit_edge, %for.end
%accHealth.1.lcssa = phi i64 [ %sub17.lcssa, %for.cond8.for.end20_crit_edge ], [ %accHealth.0.lcssa, %for.end ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %accHealth.1.lcssa)
call void @free(ptr noundef %call1) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %numOfSpecMoves) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %numOfMons) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #7
attributes #0 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !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, !11, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !12, !11}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !11, !12}
!19 = distinct !{!19, !10, !11}
|
#include <stdio.h>
/* 配列の要素を交換する */
void Swap(int x[ ], int i, int j)
{
int temp;
temp = x[i];
x[i] = x[j];
x[j] = temp;
}
/* クイックソートを行う */
void QSort(int x[ ], int left, int right)
{
int i, j;
int pivot;
i = left; /* ソートする配列の一番小さい要素の添字 */
j = right; /* ソートする配列の一番大きい要素の添字 */
pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */
while (1) { /* 無限ループ */
while (x[i] < pivot) /* pivot より大きい値が */
i++; /* 出るまで i を増加させる */
while (pivot < x[j]) /* pivot より小さい値が */
j--; /* 出るまで j を減少させる */
if (i >= j) /* i >= j なら */
break; /* 無限ループから抜ける */
Swap(x, i, j); /* x[i] と x[j]を交換 */
i++; /* 次のデータ */
j--;
}
//ShowData(x, 10); /* 途中経過を表示 */
if (left < i - 1) /* 基準値の左に 2 以上要素があれば */
QSort(x, left, i - 1); /* 左の配列を Q ソートする */
if (j + 1 < right) /* 基準値の右に 2 以上要素があれば */
QSort(x, j + 1, right); /* 右の配列を Q ソートする */
}
int main(){
int n, k,i,j,tmp;
long int result=0;
int h[200001];
scanf("%d %d", &n, &k);
for(i=0;i<n;i++) scanf("%d", &h[i]);
QSort(h, 0, n-1);
for(i=0;i<n-k;i++) result += h[i];
printf("%ld", result);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208104/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208104/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%ld\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @Swap(ptr nocapture noundef %x, i32 noundef %i, i32 noundef %j) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %i to i64
%arrayidx = getelementptr inbounds i32, ptr %x, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom1 = sext i32 %j to i64
%arrayidx2 = getelementptr inbounds i32, ptr %x, i64 %idxprom1
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
store i32 %1, ptr %arrayidx, align 4, !tbaa !5
store i32 %0, ptr %arrayidx2, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @QSort(ptr nocapture noundef %x, i32 noundef %left, i32 noundef %right) local_unnamed_addr #2 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end18, %entry
%left.tr = phi i32 [ %left, %entry ], [ %add19, %if.end18 ]
%add = add nsw i32 %left.tr, %right
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %x, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %if.end, %tailrecurse
%j.0 = phi i32 [ %right, %tailrecurse ], [ %dec13, %if.end ]
%i.0 = phi i32 [ %left.tr, %tailrecurse ], [ %inc12, %if.end ]
%1 = sext i32 %i.0 to i64
br label %while.cond1
while.cond1: ; preds = %while.cond1, %while.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond1 ], [ %1, %while.cond ]
%arrayidx3 = getelementptr inbounds i32, ptr %x, i64 %indvars.iv
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp = icmp slt i32 %2, %0
%indvars.iv.next = add i64 %indvars.iv, 1
br i1 %cmp, label %while.cond1, label %while.cond5.preheader, !llvm.loop !9
while.cond5.preheader: ; preds = %while.cond1
%arrayidx3.le = getelementptr inbounds i32, ptr %x, i64 %indvars.iv
%3 = trunc i64 %indvars.iv to i32
%4 = sext i32 %j.0 to i64
br label %while.cond5
while.cond5: ; preds = %while.cond5, %while.cond5.preheader
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %while.cond5 ], [ %4, %while.cond5.preheader ]
%arrayidx7 = getelementptr inbounds i32, ptr %x, i64 %indvars.iv51
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8 = icmp slt i32 %0, %5
%indvars.iv.next52 = add i64 %indvars.iv51, -1
br i1 %cmp8, label %while.cond5, label %while.end10, !llvm.loop !11
while.end10: ; preds = %while.cond5
%6 = trunc i64 %indvars.iv51 to i32
%cmp11.not = icmp slt i32 %3, %6
br i1 %cmp11.not, label %if.end, label %while.end14
if.end: ; preds = %while.end10
%arrayidx7.le = getelementptr inbounds i32, ptr %x, i64 %indvars.iv51
store i32 %5, ptr %arrayidx3.le, align 4, !tbaa !5
store i32 %2, ptr %arrayidx7.le, align 4, !tbaa !5
%inc12 = add nsw i32 %3, 1
%dec13 = add nsw i32 %6, -1
br label %while.cond
while.end14: ; preds = %while.end10
%sub = add nsw i32 %3, -1
%cmp15 = icmp sgt i32 %sub, %left.tr
br i1 %cmp15, label %if.then16, label %if.end18
if.then16: ; preds = %while.end14
tail call void @QSort(ptr noundef nonnull %x, i32 noundef %left.tr, i32 noundef %sub)
br label %if.end18
if.end18: ; preds = %if.then16, %while.end14
%add19 = add nsw i32 %6, 1
%cmp20 = icmp slt i32 %add19, %right
br i1 %cmp20, label %tailrecurse, label %if.end23
if.end23: ; preds = %if.end18
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%h = alloca [200001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.start.p0(i64 800004, ptr nonnull %h) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200001 x i32], ptr %h, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%sub = add nsw i32 %.lcssa, -1
call void @QSort(ptr noundef nonnull %h, i32 noundef 0, i32 noundef %sub)
%3 = load i32, ptr %k, align 4, !tbaa !5
%sub3 = sub nsw i32 %.lcssa, %3
%cmp420 = icmp sgt i32 %sub3, 0
br i1 %cmp420, label %for.body5.preheader, label %for.end10
for.body5.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %sub3 to i64
%min.iters.check = icmp ult i32 %sub3, 4
br i1 %min.iters.check, label %for.body5.preheader33, label %vector.ph
vector.ph: ; preds = %for.body5.preheader
%n.vec = and i64 %wide.trip.count, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%vec.phi31 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%4 = getelementptr inbounds [200001 x i32], ptr %h, i64 0, i64 %index
%wide.load = load <2 x i32>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 2
%wide.load32 = load <2 x i32>, ptr %5, align 8, !tbaa !5
%6 = sext <2 x i32> %wide.load to <2 x i64>
%7 = sext <2 x i32> %wide.load32 to <2 x i64>
%8 = add <2 x i64> %vec.phi, %6
%9 = add <2 x i64> %vec.phi31, %7
%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 !13
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 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end10, label %for.body5.preheader33
for.body5.preheader33: ; preds = %for.body5.preheader, %middle.block
%indvars.iv26.ph = phi i64 [ 0, %for.body5.preheader ], [ %n.vec, %middle.block ]
%result.022.ph = phi i64 [ 0, %for.body5.preheader ], [ %11, %middle.block ]
br label %for.body5
for.body5: ; preds = %for.body5.preheader33, %for.body5
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.body5 ], [ %indvars.iv26.ph, %for.body5.preheader33 ]
%result.022 = phi i64 [ %add, %for.body5 ], [ %result.022.ph, %for.body5.preheader33 ]
%arrayidx7 = getelementptr inbounds [200001 x i32], ptr %h, i64 0, i64 %indvars.iv26
%12 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%conv = sext i32 %12 to i64
%add = add nsw i64 %result.022, %conv
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%exitcond.not = icmp eq i64 %indvars.iv.next27, %wide.trip.count
br i1 %exitcond.not, label %for.end10, label %for.body5, !llvm.loop !16
for.end10: ; preds = %for.body5, %middle.block, %for.end
%result.0.lcssa = phi i64 [ 0, %for.end ], [ %11, %middle.block ], [ %add, %for.body5 ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %result.0.lcssa)
call void @llvm.lifetime.end.p0(i64 800004, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind 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 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10, !15, !14}
|
#include <stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int cmp(const int *a,const int *b){
return *a > *b ? -1 : *a < *b ? 1 : 0 ;
}
//qsort(pa,n,sizeof(int),(int(*)(const void* ,const void*))cmp);
//syoujiyunn
int main(void){
int n;
int k;
scanf("%d%d",&n,&k);
long long int h[n];
int i,j;
for(i=0;i<n;i++){
scanf("%lld",&h[i]);
}
long long int ans=0;
qsort(h,n,sizeof(long long int),(int(*)(const void* ,const void*))cmp);
for(i=k;i<n;i++){
ans+=h[i];
}
printf("%lld",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208162/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208162/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lld\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp slt i32 %0, %1
%cond = zext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 -1, i32 %cond
ret i32 %cond2
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %3, 0
br i1 %cmp18, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %3 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %5, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @cmp) #7
%6 = load i32, ptr %k, align 4, !tbaa !5
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp320 = icmp slt i32 %6, %7
br i1 %cmp320, label %for.body5.preheader, label %for.end10
for.body5.preheader: ; preds = %for.end
%8 = sext i32 %6 to i64
%wide.trip.count = sext i32 %7 to i64
%9 = sub nsw i64 %wide.trip.count, %8
%min.iters.check = icmp ult i64 %9, 4
br i1 %min.iters.check, label %for.body5.preheader31, label %vector.ph
vector.ph: ; preds = %for.body5.preheader
%n.vec = and i64 %9, -4
%ind.end = add nsw i64 %n.vec, %8
%invariant.gep = getelementptr i64, ptr %vla, i64 %8
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%vec.phi29 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%gep = getelementptr i64, ptr %invariant.gep, i64 %index
%wide.load = load <2 x i64>, ptr %gep, align 8, !tbaa !11
%10 = getelementptr inbounds i64, ptr %gep, i64 2
%wide.load30 = load <2 x i64>, ptr %10, align 8, !tbaa !11
%11 = add <2 x i64> %wide.load, %vec.phi
%12 = add <2 x i64> %wide.load30, %vec.phi29
%index.next = add nuw i64 %index, 4
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %12, %11
%14 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %9, %n.vec
br i1 %cmp.n, label %for.end10, label %for.body5.preheader31
for.body5.preheader31: ; preds = %for.body5.preheader, %middle.block
%indvars.iv26.ph = phi i64 [ %8, %for.body5.preheader ], [ %ind.end, %middle.block ]
%ans.022.ph = phi i64 [ 0, %for.body5.preheader ], [ %14, %middle.block ]
br label %for.body5
for.body5: ; preds = %for.body5.preheader31, %for.body5
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.body5 ], [ %indvars.iv26.ph, %for.body5.preheader31 ]
%ans.022 = phi i64 [ %add, %for.body5 ], [ %ans.022.ph, %for.body5.preheader31 ]
%arrayidx7 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv26
%15 = load i64, ptr %arrayidx7, align 8, !tbaa !11
%add = add nsw i64 %15, %ans.022
%indvars.iv.next27 = add nsw i64 %indvars.iv26, 1
%exitcond.not = icmp eq i64 %indvars.iv.next27, %wide.trip.count
br i1 %exitcond.not, label %for.end10, label %for.body5, !llvm.loop !16
for.end10: ; preds = %for.body5, %middle.block, %for.end
%ans.0.lcssa = phi i64 [ 0, %for.end ], [ %14, %middle.block ], [ %add, %for.body5 ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10, !15, !14}
|
#include <stdio.h>
int main() {
int A,B,C;
scanf("%d %d %d",&A,&B,&C);
if(A == B)
printf("%d\n",C);
if(B == C)
printf("%d\n",A);
if(A == C)
printf("%d\n",B);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208205/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208205/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%2 = load i32, ptr %C, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
%.pre = load i32, ptr %B, align 4, !tbaa !5
%.pre11.pre = load i32, ptr %A, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%.pre11 = phi i32 [ %.pre11.pre, %if.then ], [ %0, %entry ]
%3 = phi i32 [ %.pre, %if.then ], [ %1, %entry ]
%4 = load i32, ptr %C, align 4, !tbaa !5
%cmp2 = icmp eq i32 %3, %4
br i1 %cmp2, label %if.then3, label %if.end5
if.then3: ; preds = %if.end
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre11)
%.pre10 = load i32, ptr %A, align 4, !tbaa !5
%.pre12 = load i32, ptr %C, align 4, !tbaa !5
br label %if.end5
if.end5: ; preds = %if.then3, %if.end
%5 = phi i32 [ %.pre12, %if.then3 ], [ %4, %if.end ]
%6 = phi i32 [ %.pre10, %if.then3 ], [ %.pre11, %if.end ]
%cmp6 = icmp eq i32 %6, %5
br i1 %cmp6, label %if.then7, label %if.end9
if.then7: ; preds = %if.end5
%7 = load i32, ptr %B, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
br label %if.end9
if.end9: ; preds = %if.then7, %if.end5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int p,q,r;
scanf("%d%d%d",&p,&q,&r);
if(p==q){printf("%d",r);}
else if(q==r){printf("%d",p);}
else if(r==p){printf("%d",q);}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208256/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208256/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%p = alloca i32, align 4
%q = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p, ptr noundef nonnull %q, ptr noundef nonnull %r)
%0 = load i32, ptr %p, align 4, !tbaa !5
%1 = load i32, ptr %q, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
%2 = load i32, ptr %r, align 4, !tbaa !5
br i1 %cmp, label %if.end10.sink.split, label %if.else
if.else: ; preds = %entry
%cmp2 = icmp eq i32 %1, %2
br i1 %cmp2, label %if.end10.sink.split, label %if.else5
if.else5: ; preds = %if.else
%cmp6 = icmp eq i32 %2, %0
br i1 %cmp6, label %if.end10.sink.split, label %if.end10
if.end10.sink.split: ; preds = %if.else5, %if.else, %entry
%.sink = phi i32 [ %2, %entry ], [ %0, %if.else ], [ %1, %if.else5 ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink)
br label %if.end10
if.end10: ; preds = %if.end10.sink.split, %if.else5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main () {
int a, b, c;
while (scanf("%d %d %d", &a, &b, &c) == 3)
printf("%d\n", a*b+(c-1)*b+(c-1)*(a-1));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2083/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2083/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%cmp9 = icmp eq i32 %call8, 3
br i1 %cmp9, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%2 = load i32, ptr %c, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%mul7 = add i32 %sub, %0
%add = mul i32 %mul7, %1
%sub3 = add nsw i32 %0, -1
%mul4 = mul nsw i32 %sub, %sub3
%add5 = add nsw i32 %add, %mul4
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add5)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%cmp = icmp eq i32 %call, 3
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void)
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a==b){
printf("%d\n",c);
}
else if(a==c){
printf("%d\n",b);
}
else{
printf("%d\n",a);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208342/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208342/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
%2 = load i32, ptr %c, align 4, !tbaa !5
%cmp2 = icmp eq i32 %0, %2
%. = select i1 %cmp2, i32 %1, i32 %0
%.sink = select i1 %cmp, i32 %2, i32 %.
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main() {
int x;
int y;
int z;
scanf("%d%d%d", &x, &y, &z);
if (x == y)
printf("%d\n", z);
else if (y == z)
printf("%d\n", x);
else
printf("%d\n", y);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208393/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208393/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
%2 = load i32, ptr %z, align 4, !tbaa !5
%cmp2 = icmp eq i32 %1, %2
%. = select i1 %cmp2, i32 %0, i32 %1
%.sink = select i1 %cmp, i32 %2, i32 %.
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1072114514
#define llinf 1145141919810364364
#define mod 1000000007
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int main(void){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if(a==b){printf("%d\n",c);}
if(a==c){printf("%d\n",b);}
if(b==c){printf("%d\n",a);}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208436/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208436/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @zt(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i32 %a, %b
%sub = tail call i32 @llvm.abs.i32(i32 %sub5, i1 true)
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @round(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%mul = shl nsw i32 %rem, 1
%cmp.not = icmp sge i32 %mul, %b
%div1 = sdiv i32 %a, %b
%add = zext i1 %cmp.not to i32
%retval.0 = add nsw i32 %div1, %add
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ceil(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %a, %b
%add = zext i1 %cmp to i32
%retval.0 = add nsw i32 %div, %add
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i32 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i32 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i32 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i32 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i32 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i32 %a.addr.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i32 %b, 0
br i1 %cmp.not4.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i32 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5
gcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i32 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i32 %a, %a.addr.0.lcssa.i
%mul = mul nsw i32 %div, %b
ret i32 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nCr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i32 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i32 %a, 1
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i32 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i32 %add, %i.07
%mul = mul nsw i32 %r.08, %sub
%div = sdiv i32 %mul, %i.07
%inc = add nuw i32 %i.07, 1
%sub.1 = sub i32 %add, %inc
%mul.1 = mul nsw i32 %div, %sub.1
%div.1 = sdiv i32 %mul.1, %inc
%inc.1 = add nuw i32 %i.07, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i32 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i32 %add, %i.07.unr
%mul.epil = mul nsw i32 %r.08.unr, %sub.epil
%div.epil = sdiv i32 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @fact(i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i32 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %a, 8
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %a, -8
%ind.end = or i32 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = mul <4 x i32> %vec.phi, %vec.ind
%1 = mul <4 x i32> %vec.phi7, %step.add
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %a
br i1 %cmp.n, label %for.end, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%r.06.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader9, %for.body
%r.06 = phi i32 [ %mul, %for.body ], [ %r.06.ph, %for.body.preheader9 ]
%i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader9 ]
%mul = mul nsw i32 %r.06, %i.05
%inc = add nuw i32 %i.05, 1
%exitcond.not = icmp eq i32 %i.05, %a
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @pow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i32 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %b, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %b, -8
%ind.end = or i32 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%0 = mul <4 x i32> %vec.phi, %broadcast.splat
%1 = mul <4 x i32> %vec.phi6, %broadcast.splat
%index.next = add nuw i32 %index, 8
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %b
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%r.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.04.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%r.05 = phi i32 [ %mul, %for.body ], [ %r.05.ph, %for.body.preheader7 ]
%i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ]
%mul = mul nsw i32 %r.05, %a
%inc = add nuw i32 %i.04, 1
%exitcond.not = icmp eq i32 %i.04, %b
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llzt(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i64 %a, %b
%sub = tail call i64 @llvm.abs.i64(i64 %sub5, i1 true)
ret i64 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llround(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%mul = shl nsw i64 %rem, 1
%cmp.not = icmp sge i64 %mul, %b
%div1 = sdiv i64 %a, %b
%add = zext i1 %cmp.not to i64
%retval.0 = add nsw i64 %div1, %add
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llceil(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %a, %b
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i64 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i64 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i64 %a.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lllcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i64 %b, 0
br i1 %cmp.not4.i, label %llgcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i64 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i64 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not.i, label %llgcd.exit, label %while.body.i, !llvm.loop !14
llgcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i64 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i64 %a, %a.addr.0.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnCr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i64 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i64 %a, 1
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i64 %add, %i.07
%mul = mul nsw i64 %r.08, %sub
%div = sdiv i64 %mul, %i.07
%inc = add nuw i64 %i.07, 1
%sub.1 = sub i64 %add, %inc
%mul.1 = mul nsw i64 %div, %sub.1
%div.1 = sdiv i64 %mul.1, %inc
%inc.1 = add nuw i64 %i.07, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !15
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i64 %add, %i.07.unr
%mul.epil = mul nsw i64 %r.08.unr, %sub.epil
%div.epil = sdiv i64 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llfact(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i64 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %a, 7
%0 = icmp ult i64 %a, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %a, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.06 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%i.05 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.06, %i.05
%inc = add nuw nsw i64 %i.05, 1
%mul.1 = mul nsw i64 %mul, %inc
%inc.1 = add nuw nsw i64 %i.05, 2
%mul.2 = mul nsw i64 %mul.1, %inc.1
%inc.2 = add nuw nsw i64 %i.05, 3
%mul.3 = mul nsw i64 %mul.2, %inc.2
%inc.3 = add nuw nsw i64 %i.05, 4
%mul.4 = mul nsw i64 %mul.3, %inc.3
%inc.4 = add nuw nsw i64 %i.05, 5
%mul.5 = mul nsw i64 %mul.4, %inc.4
%inc.5 = add nuw nsw i64 %i.05, 6
%mul.6 = mul nsw i64 %mul.5, %inc.5
%inc.6 = add nuw i64 %i.05, 7
%mul.7 = mul nsw i64 %mul.6, %inc.6
%inc.7 = add nuw i64 %i.05, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !16
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%i.05.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.06.unr, %for.end.loopexit.unr-lcssa ]
%i.05.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.06.epil, %i.05.epil
%inc.epil = add nuw i64 %i.05.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !17
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i64 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.05 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.05, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !19
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.05.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.05.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.05.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !20
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp ogt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp olt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbzt(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp.i = fcmp ogt double %a, %b
%a.b.i = select i1 %cmp.i, double %a, double %b
%cmp.i4 = fcmp olt double %a, %b
%a.b.i5 = select i1 %cmp.i4, double %a, double %b
%sub = fsub double %a.b.i, %a.b.i5
ret double %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !21
%1 = load i32, ptr %b, align 4, !tbaa !21
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !21
%1 = load i32, ptr %b, align 4, !tbaa !21
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !25
%1 = load i64, ptr %b, align 8, !tbaa !25
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !25
%1 = load i64, ptr %b, align 8, !tbaa !25
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !27
%1 = load double, ptr %b, align 8, !tbaa !27
%cmp = fcmp ogt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !27
%1 = load double, ptr %b, align 8, !tbaa !27
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !21
%1 = load i32, ptr %b, align 4, !tbaa !21
%cmp = icmp eq i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%2 = load i32, ptr %c, align 4, !tbaa !21
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
%.pre = load i32, ptr %a, align 4, !tbaa !21
%.pre11.pre = load i32, ptr %b, align 4, !tbaa !21
br label %if.end
if.end: ; preds = %if.then, %entry
%.pre11 = phi i32 [ %.pre11.pre, %if.then ], [ %1, %entry ]
%3 = phi i32 [ %.pre, %if.then ], [ %0, %entry ]
%4 = load i32, ptr %c, align 4, !tbaa !21
%cmp2 = icmp eq i32 %3, %4
br i1 %cmp2, label %if.then3, label %if.end5
if.then3: ; preds = %if.end
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre11)
%.pre10 = load i32, ptr %b, align 4, !tbaa !21
%.pre12 = load i32, ptr %c, align 4, !tbaa !21
br label %if.end5
if.end5: ; preds = %if.then3, %if.end
%5 = phi i32 [ %.pre12, %if.then3 ], [ %4, %if.end ]
%6 = phi i32 [ %.pre10, %if.then3 ], [ %.pre11, %if.end ]
%cmp6 = icmp eq i32 %6, %5
br i1 %cmp6, label %if.then7, label %if.end9
if.then7: ; preds = %if.end5
%7 = load i32, ptr %a, align 4, !tbaa !21
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
br label %if.end9
if.end9: ; preds = %if.then7, %if.end5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #7
; 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 i64 @llvm.abs.i64(i64, i1 immarg) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #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(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6, !9, !10}
!9 = !{!"llvm.loop.isvectorized", i32 1}
!10 = !{!"llvm.loop.unroll.runtime.disable"}
!11 = distinct !{!11, !6, !10, !9}
!12 = distinct !{!12, !6, !9, !10}
!13 = distinct !{!13, !6, !10, !9}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !6}
!20 = distinct !{!20, !18}
!21 = !{!22, !22, i64 0}
!22 = !{!"int", !23, i64 0}
!23 = !{!"omnipotent char", !24, i64 0}
!24 = !{!"Simple C/C++ TBAA"}
!25 = !{!26, !26, i64 0}
!26 = !{!"long long", !23, i64 0}
!27 = !{!28, !28, i64 0}
!28 = !{!"double", !23, i64 0}
|
#include<stdio.h>
#include<stdlib.h>
int compare (const void *q,const void *w)
{
return *(int*)w-*(int*)q;
}
int main()
{
int n,k,i;
long long int result;
char c;
scanf("%d%d",&n,&k);
int a[26]={0};
getchar();
for(i=0;i<n;i++)
{
c=getchar();
a[c-'A']+=1;
}
qsort(a,26,sizeof(int),compare);
result=0;
i=0;
while(k>=a[i] && k!=0 && i<26 )
{
result+=(long long int)a[i]*(long long int)a[i];
k=(long long int)k-(long long int)a[i];
i++;
}
result=result+(long long int)k*(long long int)k;
printf("%lld\n",result);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_20848/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_20848/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8] c"%lld\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %q, ptr nocapture noundef readonly %w) #0 {
entry:
%0 = load i32, ptr %w, align 4, !tbaa !5
%1 = load i32, ptr %q, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%a = alloca [26 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %a) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(104) %a, i8 0, i64 104, i1 false)
%0 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i = call i32 @getc(ptr noundef %0)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp43 = icmp sgt i32 %1, 0
br i1 %cmp43, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.044 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%2 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i42 = call i32 @getc(ptr noundef %2)
%sext = shl i32 %call.i42, 24
%conv3 = ashr exact i32 %sext, 24
%sub = add nsw i32 %conv3, -65
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [26 x i32], ptr %a, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %3, 1
store i32 %add, ptr %arrayidx, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.044, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
call void @qsort(ptr noundef nonnull %a, i64 noundef 26, i64 noundef 4, ptr noundef nonnull @compare) #6
%k.promoted = load i32, ptr %k, align 4
%5 = load i32, ptr %a, align 16, !tbaa !5
%cmp646 = icmp sge i32 %k.promoted, %5
%cmp847 = icmp ne i32 %k.promoted, 0
%or.cond48 = and i1 %cmp847, %cmp646
br i1 %or.cond48, label %while.body, label %while.end
while.body: ; preds = %for.end, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %for.end ]
%6 = phi i32 [ %7, %while.body ], [ %5, %for.end ]
%result.050 = phi i64 [ %add18, %while.body ], [ 0, %for.end ]
%sub234549 = phi i32 [ %sub23, %while.body ], [ %k.promoted, %for.end ]
%conv14 = sext i32 %6 to i64
%mul = mul nsw i64 %conv14, %conv14
%add18 = add nuw nsw i64 %mul, %result.050
%sub23 = sub i32 %sub234549, %6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx5 = getelementptr inbounds [26 x i32], ptr %a, i64 0, i64 %indvars.iv.next
%7 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp sge i32 %sub23, %7
%cmp8 = icmp ne i32 %sub23, 0
%or.cond = and i1 %cmp8, %cmp6
%cmp10 = icmp ult i64 %indvars.iv, 25
%or.cond31 = and i1 %cmp10, %or.cond
br i1 %or.cond31, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !13
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 %sub23, ptr %k, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %for.end
%result.0.lcssa = phi i64 [ %add18, %while.cond.while.end_crit_edge ], [ 0, %for.end ]
%.lcssa = phi i32 [ %sub23, %while.cond.while.end_crit_edge ], [ %k.promoted, %for.end ]
%conv26 = sext i32 %.lcssa to i64
%mul28 = mul nsw i64 %conv26, %conv26
%add29 = add nuw nsw i64 %mul28, %result.0.lcssa
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add29)
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 nounwind willreturn memory(argmem: write) }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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}
|
#include<stdio.h>
#include<string.h>
#define MYSTRINGMAX 200000 // 配列20万分取る
#define SIZE MYSTRINGMAX + 2 // MYSTRINGMAX+2した値をSIZEに入れたものを定義する SIZE = 200002
int main(void) {
char s[SIZE], t[SIZE];
char c1[SIZE] = {0};
char c2[SIZE] = {0};
fgets(s, SIZE, stdin);
fgets(t, SIZE, stdin);
int length = strlen(s) - 1; // lengthに文字列の長さを返すstrlen関数を配列sにて判定する
for (int i = 0; i < length; i++) {
int in1 = s[i] - 'a';
if (c1[in1] == 0) {
c1[in1] = t[i];
} else {
if (c1[in1] != t[i]) {
printf("No\n");
return 0;
}
}
int in2 = t[i] - 'a';
if (c2[in2] == 0) {
c2[in2] = s[i];
} else {
if (c2[in2] != s[i]) {
printf("No\n");
return 0;
}
}
}
printf("Yes\n"); // それ以外ならYesを実行
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208522/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208522/source.c"
target datalayout = "e-m:e-p270: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.2 = 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:
%s = alloca [200002 x i8], align 16
%t = alloca [200002 x i8], align 16
%c1 = alloca [200002 x i8], align 16
%c2 = alloca [200002 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200002, ptr nonnull %s) #6
call void @llvm.lifetime.start.p0(i64 200002, ptr nonnull %t) #6
call void @llvm.lifetime.start.p0(i64 200002, ptr nonnull %c1) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200002) %c1, i8 0, i64 200002, i1 false)
call void @llvm.lifetime.start.p0(i64 200002, ptr nonnull %c2) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200002) %c2, i8 0, i64 200002, i1 false)
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %s, i32 noundef 200002, ptr noundef %0)
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call2 = call ptr @fgets(ptr noundef nonnull %t, i32 noundef 200002, ptr noundef %1)
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #7
%2 = trunc i64 %call4 to i32
%conv = add i32 %2, -1
%cmp.not81 = icmp sgt i32 %conv, 0
br i1 %cmp.not81, label %for.body.preheader, label %cleanup59
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %conv to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds [200002 x i8], ptr %s, i64 0, i64 %indvars.iv
%3 = load i8, ptr %arrayidx, align 1, !tbaa !9
%conv6 = sext i8 %3 to i64
%sub7 = add nsw i64 %conv6, -97
%arrayidx9 = getelementptr inbounds [200002 x i8], ptr %c1, i64 0, i64 %sub7
%4 = load i8, ptr %arrayidx9, align 1, !tbaa !9
%cmp11 = icmp eq i8 %4, 0
%arrayidx14 = getelementptr inbounds [200002 x i8], ptr %t, i64 0, i64 %indvars.iv
%5 = load i8, ptr %arrayidx14, align 1, !tbaa !9
br i1 %cmp11, label %if.then, label %if.else
if.then: ; preds = %for.body
store i8 %5, ptr %arrayidx9, align 1, !tbaa !9
br label %if.end27
if.else: ; preds = %for.body
%cmp23.not = icmp eq i8 %4, %5
br i1 %cmp23.not, label %if.end27, label %cleanup59
if.end27: ; preds = %if.else, %if.then
%6 = phi i8 [ %4, %if.else ], [ %5, %if.then ]
%conv30 = sext i8 %6 to i64
%sub31 = add nsw i64 %conv30, -97
%arrayidx33 = getelementptr inbounds [200002 x i8], ptr %c2, i64 0, i64 %sub31
%7 = load i8, ptr %arrayidx33, align 1, !tbaa !9
%cmp35 = icmp eq i8 %7, 0
br i1 %cmp35, label %if.then37, label %if.else42
if.then37: ; preds = %if.end27
store i8 %3, ptr %arrayidx33, align 1, !tbaa !9
br label %for.inc
if.else42: ; preds = %if.end27
%cmp49.not = icmp eq i8 %7, %3
br i1 %cmp49.not, label %for.inc, label %cleanup59
for.inc: ; preds = %if.else42, %if.then37
%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 %cleanup59, label %for.body, !llvm.loop !10
cleanup59: ; preds = %for.inc, %if.else42, %if.else, %entry
%str.2.sink = phi ptr [ @str.3, %entry ], [ @str.2, %if.else ], [ @str.2, %if.else42 ], [ @str.3, %for.inc ]
%puts77 = call i32 @puts(ptr nonnull dereferenceable(1) %str.2.sink)
call void @llvm.lifetime.end.p0(i64 200002, ptr nonnull %c2) #6
call void @llvm.lifetime.end.p0(i64 200002, ptr nonnull %c1) #6
call void @llvm.lifetime.end.p0(i64 200002, ptr nonnull %t) #6
call void @llvm.lifetime.end.p0(i64 200002, ptr nonnull %s) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; 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 = { 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(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 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int A;
int B,C,D;
int P;
int costa,costb;
scanf("%d",&A);
scanf("%d",&B);
scanf("%d",&C);
scanf("%d",&D);
scanf("%d",&P);
costa=A*P;
if(P>=C)costb=B+(P-C)*D;
else costb=B;
if(costa>costb)printf("%d\n",costb);
else printf("%d\n",costa);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208595/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208595/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
%D = alloca i32, align 4
%P = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %P) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %B)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %C)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %D)
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %P)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %P, align 4, !tbaa !5
%mul = mul nsw i32 %1, %0
%2 = load i32, ptr %C, align 4, !tbaa !5
%cmp.not = icmp slt i32 %1, %2
%3 = load i32, ptr %B, align 4, !tbaa !5
%sub = sub nsw i32 %1, %2
%4 = load i32, ptr %D, align 4
%mul5 = mul nsw i32 %4, %sub
%add = select i1 %cmp.not, i32 0, i32 %mul5
%costb.0 = add nsw i32 %3, %add
%mul.sink = call i32 @llvm.smin.i32(i32 %mul, i32 %costb.0)
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %P) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int a,b,c,d,p,x,y;
scanf("%d %d %d %d %d",&a,&b,&c,&d,&p);
x = a * p;
if(c <= p){
y = b + (d * (p - c));
}else{
y = b;
}
if(x < y){
printf("%d\n",x);
}else{
printf("%d\n",y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208645/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208645/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d %d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
%p = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %p)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %p, align 4, !tbaa !5
%mul = mul nsw i32 %1, %0
%2 = load i32, ptr %c, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %2, %1
%3 = load i32, ptr %b, align 4, !tbaa !5
%4 = load i32, ptr %d, align 4
%sub = sub nsw i32 %1, %2
%mul1 = mul nsw i32 %4, %sub
%add = select i1 %cmp.not, i32 0, i32 %mul1
%y.0 = add nsw i32 %3, %add
%y.0.sink = call i32 @llvm.smin.i32(i32 %mul, i32 %y.0)
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %y.0.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main(){
int a,b,c,d,p,ans;
scanf("%d %d %d %d %d",&a,&b,&c,&d,&p);
a=a*p;
if(p-c>0){
b=b+(p-c)*d;
}
ans=fmin(a,b);
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208696/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208696/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d %d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
%p = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %p)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %p, align 4, !tbaa !5
%mul = mul nsw i32 %1, %0
store i32 %mul, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %c, align 4, !tbaa !5
%sub = sub nsw i32 %1, %2
%cmp = icmp sgt i32 %sub, 0
%.pre = load i32, ptr %b, align 4, !tbaa !5
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%3 = load i32, ptr %d, align 4, !tbaa !5
%mul2 = mul nsw i32 %3, %sub
%add = add nsw i32 %mul2, %.pre
store i32 %add, ptr %b, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%4 = phi i32 [ %add, %if.then ], [ %.pre, %entry ]
%conv = sitofp i32 %mul to double
%conv3 = sitofp i32 %4 to double
%5 = call double @llvm.minnum.f64(double %conv, double %conv3)
%conv4 = fptosi double %5 to i32
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.minnum.f64(double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int a,b,c,d,p,x,y;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
scanf("%d",&p);
x=a*p;
if(p<=c) y=b;
else y=(p-c)*d+b;
if(x<y) printf("%d\n",x);
else printf("%d\n",y);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208739/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208739/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
%p = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %p, align 4, !tbaa !5
%2 = load i32, ptr %c, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %1, %2
br i1 %cmp.not, label %if.else, label %if.then
if.then: ; preds = %entry
%3 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %entry
%sub = sub nsw i32 %1, %2
%4 = load i32, ptr %d, align 4, !tbaa !5
%mul5 = mul nsw i32 %4, %sub
%5 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %mul5, %5
br label %if.end
if.end: ; preds = %if.else, %if.then
%y.0 = phi i32 [ %3, %if.then ], [ %add, %if.else ]
%mul = mul nsw i32 %1, %0
%mul.y.0 = call i32 @llvm.smin.i32(i32 %mul, i32 %y.0)
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul.y.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
typedef struct _set{
int *element;
int eCnt;
struct _set *next;
}SET;
SET* initSet(int n){
int i;
SET *p,*head;
for(i=0;i<n;i++){
if(i==0){
head=(SET*)malloc(sizeof(SET));
p=head;
}else{
p->next=(SET*)malloc(sizeof(SET));
p=p->next;
}
p->element=(int*)malloc(sizeof(int));
p->element[0]=i;
p->eCnt=1;
}
p->next=NULL;
return head;
}
void printSet(SET *head){
int i;
SET *p=head;
printf("-----printSet-----\n");
while(p!=NULL){
for(i=0;i<p->eCnt;i++)printf("%d ",p->element[i]);
printf("\n");
p=p->next;
}
printf("------end------\n");
}
SET* getTarget(SET *head,int target){
int i;
SET *p=head;
while(p!=NULL){
for(i=0;i<p->eCnt;i++){
if(p->element[i]==target)return p;
}
p=p->next;
}
return NULL;
}
SET* del(SET *head,SET *target){
SET *p=head;
if(head==target){
head=head->next;
free(p->element);
free(p);
return head;
}
while(p!=NULL&&p->next!=target)p=p->next;
if(p==NULL)return head;
p->next=target->next;
free(target->element);
free(target);
return head;
}
SET* unite(SET *head,int x,int y){
SET *xp,*yp;
xp=getTarget(head,x);
yp=getTarget(head,y);
if(xp==NULL||yp==NULL||xp==yp)return head;
xp->element=(int*)realloc(xp->element,sizeof(int)*(xp->eCnt+yp->eCnt));
int i,j;
for(i=xp->eCnt,j=0;j<yp->eCnt;i++,j++)xp->element[i]=yp->element[j];
xp->eCnt+=yp->eCnt;
return head=del(head,yp);
}
void same(SET *head,int x,int y){
SET *xp,*yp;
xp=getTarget(head,x);
yp=getTarget(head,y);
if(xp==yp)printf("1\n");
else printf("0\n");
}
void delAll(SET *head){
SET *p=head;
while(p!=NULL){
head=head->next;
free(p->element);
free(p);
p=head;
}
}
int main(void){
int i;
int n;
scanf("%d ",&n);
SET *head;
head=initSet(n);
int q;
scanf("%d\n",&q);
int com,x,y;
for(i=0;i<q;i++){
scanf("%d %d %d\n",&com,&x,&y);
switch(com){
case 0:
head=unite(head,x,y);
break;
case 1:
same(head,x,y);
break;
}
}
delAll(head);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208782/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208782/source.c"
target datalayout = "e-m:e-p270: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._set = type { ptr, i32, ptr }
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.7 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@str = private unnamed_addr constant [19 x i8] c"-----printSet-----\00", align 1
@str.8 = private unnamed_addr constant [16 x i8] c"------end------\00", align 1
@str.9 = private unnamed_addr constant [2 x i8] c"0\00", align 1
@str.10 = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind memory(write, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @initSet(i32 noundef %n) local_unnamed_addr #0 {
if.end.peel:
%cmp16 = icmp sgt i32 %n, 0
tail call void @llvm.assume(i1 %cmp16)
%call.peel = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #11
%call4.peel = tail call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #11
store ptr %call4.peel, ptr %call.peel, align 8, !tbaa !5
store i32 0, ptr %call4.peel, align 4, !tbaa !11
%eCnt.peel = getelementptr inbounds %struct._set, ptr %call.peel, i64 0, i32 1
store i32 1, ptr %eCnt.peel, align 8, !tbaa !12
%exitcond.peel.not = icmp eq i32 %n, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%p.018 = phi ptr [ %call2, %if.end ], [ %call.peel, %if.end.peel ]
%i.017 = phi i32 [ %inc, %if.end ], [ 1, %if.end.peel ]
%call2 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #11
%next = getelementptr inbounds %struct._set, ptr %p.018, i64 0, i32 2
store ptr %call2, ptr %next, align 8, !tbaa !13
%call4 = tail call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #11
store ptr %call4, ptr %call2, align 8, !tbaa !5
store i32 %i.017, ptr %call4, align 4, !tbaa !11
%eCnt = getelementptr inbounds %struct._set, ptr %call2, i64 0, i32 1
store i32 1, ptr %eCnt, align 8, !tbaa !12
%inc = add nuw nsw i32 %i.017, 1
%exitcond.not = icmp eq i32 %inc, %n
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !14
for.end: ; preds = %if.end, %if.end.peel
%p.1.lcssa = phi ptr [ %call.peel, %if.end.peel ], [ %call2, %if.end ]
%next6 = getelementptr inbounds %struct._set, ptr %p.1.lcssa, i64 0, i32 2
store ptr null, ptr %next6, align 8, !tbaa !13
ret ptr %call.peel
}
; 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 @printSet(ptr noundef readonly %head) local_unnamed_addr #3 {
entry:
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
%cmp.not13 = icmp eq ptr %head, null
br i1 %cmp.not13, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%p.014 = phi ptr [ %5, %for.end ], [ %head, %entry ]
%eCnt = getelementptr inbounds %struct._set, ptr %p.014, i64 0, i32 1
%0 = load i32, ptr %eCnt, align 8, !tbaa !12
%cmp111 = icmp sgt i32 %0, 0
br i1 %cmp111, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%1 = load ptr, ptr %p.014, align 8, !tbaa !5
%arrayidx = getelementptr inbounds i32, ptr %1, i64 %indvars.iv
%2 = load i32, ptr %arrayidx, align 4, !tbaa !11
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %eCnt, align 8, !tbaa !12
%4 = sext i32 %3 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !17
for.end: ; preds = %for.body, %for.cond.preheader
%putchar = tail call i32 @putchar(i32 10)
%next = getelementptr inbounds %struct._set, ptr %p.014, i64 0, i32 2
%5 = load ptr, ptr %next, align 8, !tbaa !13
%cmp.not = icmp eq ptr %5, null
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !18
while.end: ; preds = %for.end, %entry
%puts10 = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @getTarget(ptr noundef readonly %head, i32 noundef %target) local_unnamed_addr #5 {
entry:
%cmp.not15 = icmp eq ptr %head, null
br i1 %cmp.not15, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%p.016 = phi ptr [ %3, %for.end ], [ %head, %entry ]
%eCnt = getelementptr inbounds %struct._set, ptr %p.016, i64 0, i32 1
%0 = load i32, ptr %eCnt, align 8, !tbaa !12
%cmp113 = icmp sgt i32 %0, 0
br i1 %cmp113, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %for.cond.preheader
%1 = load ptr, ptr %p.016, align 8, !tbaa !5
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !19
for.body: ; preds = %for.body.lr.ph, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i32, ptr %1, i64 %indvars.iv
%2 = load i32, ptr %arrayidx, align 4, !tbaa !11
%cmp2 = icmp eq i32 %2, %target
br i1 %cmp2, label %cleanup, label %for.cond
for.end: ; preds = %for.cond, %for.cond.preheader
%next = getelementptr inbounds %struct._set, ptr %p.016, i64 0, i32 2
%3 = load ptr, ptr %next, align 8, !tbaa !13
%cmp.not = icmp eq ptr %3, null
br i1 %cmp.not, label %cleanup, label %for.cond.preheader, !llvm.loop !20
cleanup: ; preds = %for.end, %for.body, %entry
%p.012 = phi ptr [ null, %entry ], [ %p.016, %for.body ], [ null, %for.end ]
ret ptr %p.012
}
; Function Attrs: nounwind uwtable
define dso_local ptr @del(ptr noundef %head, ptr noundef %target) local_unnamed_addr #6 {
entry:
%cmp = icmp eq ptr %head, %target
br i1 %cmp, label %if.then, label %while.cond
if.then: ; preds = %entry
%next = getelementptr inbounds %struct._set, ptr %head, i64 0, i32 2
%0 = load ptr, ptr %next, align 8, !tbaa !13
br label %cleanup.sink.split
while.cond: ; preds = %entry, %land.rhs
%p.0 = phi ptr [ %1, %land.rhs ], [ %head, %entry ]
%cond = icmp eq ptr %p.0, null
br i1 %cond, label %cleanup, label %land.rhs
land.rhs: ; preds = %while.cond
%next2 = getelementptr inbounds %struct._set, ptr %p.0, i64 0, i32 2
%1 = load ptr, ptr %next2, align 8, !tbaa !13
%cmp3.not = icmp eq ptr %1, %target
br i1 %cmp3.not, label %if.end7, label %while.cond, !llvm.loop !21
if.end7: ; preds = %land.rhs
%next2.le = getelementptr inbounds %struct._set, ptr %p.0, i64 0, i32 2
%next8 = getelementptr inbounds %struct._set, ptr %target, i64 0, i32 2
%2 = load ptr, ptr %next8, align 8, !tbaa !13
store ptr %2, ptr %next2.le, align 8, !tbaa !13
br label %cleanup.sink.split
cleanup.sink.split: ; preds = %if.then, %if.end7
%target.sink27 = phi ptr [ %target, %if.end7 ], [ %head, %if.then ]
%retval.0.ph = phi ptr [ %head, %if.end7 ], [ %0, %if.then ]
%3 = load ptr, ptr %target.sink27, align 8, !tbaa !5
tail call void @free(ptr noundef %3) #12
tail call void @free(ptr noundef %target.sink27) #12
br label %cleanup
cleanup: ; preds = %while.cond, %cleanup.sink.split
%retval.0 = phi ptr [ %retval.0.ph, %cleanup.sink.split ], [ %head, %while.cond ]
ret ptr %retval.0
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: nounwind uwtable
define dso_local ptr @unite(ptr noundef %head, i32 noundef %x, i32 noundef %y) local_unnamed_addr #6 {
entry:
%cmp.not15.i = icmp eq ptr %head, null
br i1 %cmp.not15.i, label %cleanup, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %entry, %for.end.i
%p.016.i = phi ptr [ %3, %for.end.i ], [ %head, %entry ]
%eCnt.i = getelementptr inbounds %struct._set, ptr %p.016.i, i64 0, i32 1
%0 = load i32, ptr %eCnt.i, align 8, !tbaa !12
%cmp113.i = icmp sgt i32 %0, 0
br i1 %cmp113.i, label %for.body.lr.ph.i, label %for.end.i
for.body.lr.ph.i: ; preds = %for.cond.preheader.i
%1 = load ptr, ptr %p.016.i, align 8, !tbaa !5
%wide.trip.count.i = zext i32 %0 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %for.end.i, label %for.body.i, !llvm.loop !19
for.body.i: ; preds = %for.cond.i, %for.body.lr.ph.i
%indvars.iv.i = phi i64 [ 0, %for.body.lr.ph.i ], [ %indvars.iv.next.i, %for.cond.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %1, i64 %indvars.iv.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !11
%cmp2.i = icmp eq i32 %2, %x
br i1 %cmp2.i, label %for.cond.preheader.i43.preheader, label %for.cond.i
for.end.i: ; preds = %for.cond.i, %for.cond.preheader.i
%next.i = getelementptr inbounds %struct._set, ptr %p.016.i, i64 0, i32 2
%3 = load ptr, ptr %next.i, align 8, !tbaa !13
%cmp.not.i = icmp eq ptr %3, null
br i1 %cmp.not.i, label %for.cond.preheader.i43.preheader, label %for.cond.preheader.i, !llvm.loop !20
for.cond.preheader.i43.preheader: ; preds = %for.end.i, %for.body.i
%p.012.i = phi ptr [ %p.016.i, %for.body.i ], [ null, %for.end.i ]
br label %for.cond.preheader.i43
for.cond.preheader.i43: ; preds = %for.cond.preheader.i43.preheader, %for.end.i47
%p.016.i44 = phi ptr [ %7, %for.end.i47 ], [ %head, %for.cond.preheader.i43.preheader ]
%eCnt.i45 = getelementptr inbounds %struct._set, ptr %p.016.i44, i64 0, i32 1
%4 = load i32, ptr %eCnt.i45, align 8, !tbaa !12
%cmp113.i46 = icmp sgt i32 %4, 0
br i1 %cmp113.i46, label %for.body.lr.ph.i51, label %for.end.i47
for.body.lr.ph.i51: ; preds = %for.cond.preheader.i43
%5 = load ptr, ptr %p.016.i44, align 8, !tbaa !5
%wide.trip.count.i52 = zext i32 %4 to i64
br label %for.body.i53
for.cond.i57: ; preds = %for.body.i53
%indvars.iv.next.i58 = add nuw nsw i64 %indvars.iv.i54, 1
%exitcond.not.i59 = icmp eq i64 %indvars.iv.next.i58, %wide.trip.count.i52
br i1 %exitcond.not.i59, label %for.end.i47, label %for.body.i53, !llvm.loop !19
for.body.i53: ; preds = %for.cond.i57, %for.body.lr.ph.i51
%indvars.iv.i54 = phi i64 [ 0, %for.body.lr.ph.i51 ], [ %indvars.iv.next.i58, %for.cond.i57 ]
%arrayidx.i55 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv.i54
%6 = load i32, ptr %arrayidx.i55, align 4, !tbaa !11
%cmp2.i56 = icmp eq i32 %6, %y
br i1 %cmp2.i56, label %getTarget.exit60, label %for.cond.i57
for.end.i47: ; preds = %for.cond.i57, %for.cond.preheader.i43
%next.i48 = getelementptr inbounds %struct._set, ptr %p.016.i44, i64 0, i32 2
%7 = load ptr, ptr %next.i48, align 8, !tbaa !13
%cmp.not.i49 = icmp eq ptr %7, null
br i1 %cmp.not.i49, label %cleanup, label %for.cond.preheader.i43, !llvm.loop !20
getTarget.exit60: ; preds = %for.body.i53
%eCnt.i45.le = getelementptr inbounds %struct._set, ptr %p.016.i44, i64 0, i32 1
%cmp = icmp eq ptr %p.012.i, null
%cmp4 = icmp eq ptr %p.012.i, %p.016.i44
%or.cond41 = or i1 %cmp, %cmp4
br i1 %or.cond41, label %cleanup, label %if.end
if.end: ; preds = %getTarget.exit60
%8 = load ptr, ptr %p.012.i, align 8, !tbaa !5
%eCnt = getelementptr inbounds %struct._set, ptr %p.012.i, i64 0, i32 1
%9 = load i32, ptr %eCnt, align 8, !tbaa !12
%add = add nsw i32 %4, %9
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 2
%call6 = tail call ptr @realloc(ptr noundef %8, i64 noundef %mul) #13
store ptr %call6, ptr %p.012.i, align 8, !tbaa !5
%10 = load i32, ptr %eCnt.i45.le, align 8, !tbaa !12
%cmp1075 = icmp sgt i32 %10, 0
br i1 %cmp1075, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %if.end
%11 = load i32, ptr %eCnt, align 8, !tbaa !12
%12 = load ptr, ptr %p.016.i44, align 8, !tbaa !5
%13 = sext i32 %11 to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv84 = phi i64 [ %13, %for.body.lr.ph ], [ %indvars.iv.next85, %for.body ]
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %12, i64 %indvars.iv
%14 = load i32, ptr %arrayidx, align 4, !tbaa !11
%arrayidx15 = getelementptr inbounds i32, ptr %call6, i64 %indvars.iv84
store i32 %14, ptr %arrayidx15, align 4, !tbaa !11
%indvars.iv.next85 = add nsw i64 %indvars.iv84, 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%15 = load i32, ptr %eCnt.i45.le, align 8, !tbaa !12
%16 = sext i32 %15 to i64
%cmp10 = icmp slt i64 %indvars.iv.next, %16
br i1 %cmp10, label %for.body, label %for.end, !llvm.loop !22
for.end: ; preds = %for.body, %if.end
%.lcssa = phi i32 [ %10, %if.end ], [ %15, %for.body ]
%17 = load i32, ptr %eCnt, align 8, !tbaa !12
%add19 = add nsw i32 %17, %.lcssa
store i32 %add19, ptr %eCnt, align 8, !tbaa !12
%cmp.i = icmp eq ptr %p.016.i44, %head
br i1 %cmp.i, label %if.then.i, label %while.cond.i
if.then.i: ; preds = %for.end
%next.i61 = getelementptr inbounds %struct._set, ptr %head, i64 0, i32 2
%18 = load ptr, ptr %next.i61, align 8, !tbaa !13
br label %cleanup.sink.split.i
while.cond.i: ; preds = %for.end, %land.rhs.i
%p.0.i = phi ptr [ %19, %land.rhs.i ], [ %head, %for.end ]
%cond.i = icmp eq ptr %p.0.i, null
br i1 %cond.i, label %cleanup, label %land.rhs.i
land.rhs.i: ; preds = %while.cond.i
%next2.i = getelementptr inbounds %struct._set, ptr %p.0.i, i64 0, i32 2
%19 = load ptr, ptr %next2.i, align 8, !tbaa !13
%cmp3.not.i = icmp eq ptr %19, %p.016.i44
br i1 %cmp3.not.i, label %if.end7.i, label %while.cond.i, !llvm.loop !21
if.end7.i: ; preds = %land.rhs.i
%next2.i.le = getelementptr inbounds %struct._set, ptr %p.0.i, i64 0, i32 2
%next8.i = getelementptr inbounds %struct._set, ptr %p.016.i44, i64 0, i32 2
%20 = load ptr, ptr %next8.i, align 8, !tbaa !13
store ptr %20, ptr %next2.i.le, align 8, !tbaa !13
br label %cleanup.sink.split.i
cleanup.sink.split.i: ; preds = %if.end7.i, %if.then.i
%target.sink27.i = phi ptr [ %p.016.i44, %if.end7.i ], [ %head, %if.then.i ]
%retval.0.ph.i = phi ptr [ %head, %if.end7.i ], [ %18, %if.then.i ]
%21 = load ptr, ptr %target.sink27.i, align 8, !tbaa !5
tail call void @free(ptr noundef %21) #12
tail call void @free(ptr noundef nonnull %target.sink27.i) #12
br label %cleanup
cleanup: ; preds = %for.end.i47, %while.cond.i, %entry, %cleanup.sink.split.i, %getTarget.exit60
%retval.0 = phi ptr [ %head, %getTarget.exit60 ], [ %retval.0.ph.i, %cleanup.sink.split.i ], [ null, %entry ], [ %head, %while.cond.i ], [ %head, %for.end.i47 ]
ret ptr %retval.0
}
; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #8
; Function Attrs: nofree nounwind uwtable
define dso_local void @same(ptr noundef readonly %head, i32 noundef %x, i32 noundef %y) local_unnamed_addr #3 {
entry:
%cmp.not15.i = icmp eq ptr %head, null
br i1 %cmp.not15.i, label %if.end, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %entry, %for.end.i
%p.016.i = phi ptr [ %3, %for.end.i ], [ %head, %entry ]
%eCnt.i = getelementptr inbounds %struct._set, ptr %p.016.i, i64 0, i32 1
%0 = load i32, ptr %eCnt.i, align 8, !tbaa !12
%cmp113.i = icmp sgt i32 %0, 0
br i1 %cmp113.i, label %for.body.lr.ph.i, label %for.end.i
for.body.lr.ph.i: ; preds = %for.cond.preheader.i
%1 = load ptr, ptr %p.016.i, align 8, !tbaa !5
%wide.trip.count.i = zext i32 %0 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %for.end.i, label %for.body.i, !llvm.loop !19
for.body.i: ; preds = %for.cond.i, %for.body.lr.ph.i
%indvars.iv.i = phi i64 [ 0, %for.body.lr.ph.i ], [ %indvars.iv.next.i, %for.cond.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %1, i64 %indvars.iv.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !11
%cmp2.i = icmp eq i32 %2, %x
br i1 %cmp2.i, label %for.cond.preheader.i7.preheader, label %for.cond.i
for.end.i: ; preds = %for.cond.i, %for.cond.preheader.i
%next.i = getelementptr inbounds %struct._set, ptr %p.016.i, i64 0, i32 2
%3 = load ptr, ptr %next.i, align 8, !tbaa !13
%cmp.not.i = icmp eq ptr %3, null
br i1 %cmp.not.i, label %for.cond.preheader.i7.preheader, label %for.cond.preheader.i, !llvm.loop !20
for.cond.preheader.i7.preheader: ; preds = %for.end.i, %for.body.i
%p.012.i = phi ptr [ %p.016.i, %for.body.i ], [ null, %for.end.i ]
br label %for.cond.preheader.i7
for.cond.preheader.i7: ; preds = %for.cond.preheader.i7.preheader, %for.end.i11
%p.016.i8 = phi ptr [ %7, %for.end.i11 ], [ %head, %for.cond.preheader.i7.preheader ]
%eCnt.i9 = getelementptr inbounds %struct._set, ptr %p.016.i8, i64 0, i32 1
%4 = load i32, ptr %eCnt.i9, align 8, !tbaa !12
%cmp113.i10 = icmp sgt i32 %4, 0
br i1 %cmp113.i10, label %for.body.lr.ph.i15, label %for.end.i11
for.body.lr.ph.i15: ; preds = %for.cond.preheader.i7
%5 = load ptr, ptr %p.016.i8, align 8, !tbaa !5
%wide.trip.count.i16 = zext i32 %4 to i64
br label %for.body.i17
for.cond.i21: ; preds = %for.body.i17
%indvars.iv.next.i22 = add nuw nsw i64 %indvars.iv.i18, 1
%exitcond.not.i23 = icmp eq i64 %indvars.iv.next.i22, %wide.trip.count.i16
br i1 %exitcond.not.i23, label %for.end.i11, label %for.body.i17, !llvm.loop !19
for.body.i17: ; preds = %for.cond.i21, %for.body.lr.ph.i15
%indvars.iv.i18 = phi i64 [ 0, %for.body.lr.ph.i15 ], [ %indvars.iv.next.i22, %for.cond.i21 ]
%arrayidx.i19 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv.i18
%6 = load i32, ptr %arrayidx.i19, align 4, !tbaa !11
%cmp2.i20 = icmp eq i32 %6, %y
br i1 %cmp2.i20, label %getTarget.exit24, label %for.cond.i21
for.end.i11: ; preds = %for.cond.i21, %for.cond.preheader.i7
%next.i12 = getelementptr inbounds %struct._set, ptr %p.016.i8, i64 0, i32 2
%7 = load ptr, ptr %next.i12, align 8, !tbaa !13
%cmp.not.i13 = icmp eq ptr %7, null
br i1 %cmp.not.i13, label %getTarget.exit24, label %for.cond.preheader.i7, !llvm.loop !20
getTarget.exit24: ; preds = %for.end.i11, %for.body.i17
%p.012.i14 = phi ptr [ %p.016.i8, %for.body.i17 ], [ null, %for.end.i11 ]
%cmp = icmp eq ptr %p.012.i, %p.012.i14
%spec.select = select i1 %cmp, ptr @str.10, ptr @str.9
br label %if.end
if.end: ; preds = %getTarget.exit24, %entry
%str.9.sink = phi ptr [ @str.10, %entry ], [ %spec.select, %getTarget.exit24 ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.9.sink)
ret void
}
; Function Attrs: nounwind uwtable
define dso_local void @delAll(ptr noundef %head) local_unnamed_addr #6 {
entry:
%cmp.not5 = icmp eq ptr %head, null
br i1 %cmp.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%p.06 = phi ptr [ %0, %while.body ], [ %head, %entry ]
%next = getelementptr inbounds %struct._set, ptr %p.06, i64 0, i32 2
%0 = load ptr, ptr %next, align 8, !tbaa !13
%1 = load ptr, ptr %p.06, align 8, !tbaa !5
tail call void @free(ptr noundef %1) #12
tail call void @free(ptr noundef nonnull %p.06) #12
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !23
while.end: ; preds = %while.body, %entry
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #6 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%com = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #12
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp16.i = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp16.i)
%call.peel.i = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #11
%call4.peel.i = call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #11
store ptr %call4.peel.i, ptr %call.peel.i, align 8, !tbaa !5
store i32 0, ptr %call4.peel.i, align 4, !tbaa !11
%eCnt.peel.i = getelementptr inbounds %struct._set, ptr %call.peel.i, i64 0, i32 1
store i32 1, ptr %eCnt.peel.i, align 8, !tbaa !12
%exitcond.peel.not.i = icmp eq i32 %0, 1
br i1 %exitcond.peel.not.i, label %initSet.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%p.018.i = phi ptr [ %call2.i, %if.end.i ], [ %call.peel.i, %entry ]
%i.017.i = phi i32 [ %inc.i, %if.end.i ], [ 1, %entry ]
%call2.i = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #11
%next.i = getelementptr inbounds %struct._set, ptr %p.018.i, i64 0, i32 2
store ptr %call2.i, ptr %next.i, align 8, !tbaa !13
%call4.i = call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #11
store ptr %call4.i, ptr %call2.i, align 8, !tbaa !5
store i32 %i.017.i, ptr %call4.i, align 4, !tbaa !11
%eCnt.i = getelementptr inbounds %struct._set, ptr %call2.i, i64 0, i32 1
store i32 1, ptr %eCnt.i, align 8, !tbaa !12
%inc.i = add nuw nsw i32 %i.017.i, 1
%exitcond.not.i = icmp eq i32 %inc.i, %0
br i1 %exitcond.not.i, label %initSet.exit, label %if.end.i, !llvm.loop !14
initSet.exit: ; preds = %if.end.i, %entry
%p.1.lcssa.i = phi ptr [ %call.peel.i, %entry ], [ %call2.i, %if.end.i ]
%next6.i = getelementptr inbounds %struct._set, ptr %p.1.lcssa.i, i64 0, i32 2
store ptr null, ptr %next6.i, align 8, !tbaa !13
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #12
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %q)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %com) #12
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #12
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #12
%1 = load i32, ptr %q, align 4, !tbaa !11
%cmp15 = icmp sgt i32 %1, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %initSet.exit, %for.inc
%head.017 = phi ptr [ %head.1, %for.inc ], [ %call.peel.i, %initSet.exit ]
%i.016 = phi i32 [ %inc, %for.inc ], [ 0, %initSet.exit ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull %com, ptr noundef nonnull %x, ptr noundef nonnull %y)
%2 = load i32, ptr %com, align 4, !tbaa !11
switch i32 %2, label %for.inc [
i32 0, label %sw.bb
i32 1, label %sw.bb5
]
sw.bb: ; preds = %for.body
%3 = load i32, ptr %x, align 4, !tbaa !11
%4 = load i32, ptr %y, align 4, !tbaa !11
%call4 = call ptr @unite(ptr noundef %head.017, i32 noundef %3, i32 noundef %4)
br label %for.inc
sw.bb5: ; preds = %for.body
%5 = load i32, ptr %x, align 4, !tbaa !11
%6 = load i32, ptr %y, align 4, !tbaa !11
%cmp.not15.i.i = icmp eq ptr %head.017, null
br i1 %cmp.not15.i.i, label %same.exit, label %for.cond.preheader.i.i
for.cond.preheader.i.i: ; preds = %sw.bb5, %for.end.i.i
%p.016.i.i = phi ptr [ %10, %for.end.i.i ], [ %head.017, %sw.bb5 ]
%eCnt.i.i = getelementptr inbounds %struct._set, ptr %p.016.i.i, i64 0, i32 1
%7 = load i32, ptr %eCnt.i.i, align 8, !tbaa !12
%cmp113.i.i = icmp sgt i32 %7, 0
br i1 %cmp113.i.i, label %for.body.lr.ph.i.i, label %for.end.i.i
for.body.lr.ph.i.i: ; preds = %for.cond.preheader.i.i
%8 = load ptr, ptr %p.016.i.i, align 8, !tbaa !5
%wide.trip.count.i.i = zext i32 %7 to i64
br label %for.body.i.i
for.cond.i.i: ; preds = %for.body.i.i
%indvars.iv.next.i.i = add nuw nsw i64 %indvars.iv.i.i, 1
%exitcond.not.i.i = icmp eq i64 %indvars.iv.next.i.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.i, label %for.end.i.i, label %for.body.i.i, !llvm.loop !19
for.body.i.i: ; preds = %for.cond.i.i, %for.body.lr.ph.i.i
%indvars.iv.i.i = phi i64 [ 0, %for.body.lr.ph.i.i ], [ %indvars.iv.next.i.i, %for.cond.i.i ]
%arrayidx.i.i = getelementptr inbounds i32, ptr %8, i64 %indvars.iv.i.i
%9 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !11
%cmp2.i.i = icmp eq i32 %9, %5
br i1 %cmp2.i.i, label %for.cond.preheader.i7.preheader.i, label %for.cond.i.i
for.end.i.i: ; preds = %for.cond.i.i, %for.cond.preheader.i.i
%next.i.i = getelementptr inbounds %struct._set, ptr %p.016.i.i, i64 0, i32 2
%10 = load ptr, ptr %next.i.i, align 8, !tbaa !13
%cmp.not.i.i = icmp eq ptr %10, null
br i1 %cmp.not.i.i, label %for.cond.preheader.i7.preheader.i, label %for.cond.preheader.i.i, !llvm.loop !20
for.cond.preheader.i7.preheader.i: ; preds = %for.end.i.i, %for.body.i.i
%p.012.i.i = phi ptr [ %p.016.i.i, %for.body.i.i ], [ null, %for.end.i.i ]
br label %for.cond.preheader.i7.i
for.cond.preheader.i7.i: ; preds = %for.end.i11.i, %for.cond.preheader.i7.preheader.i
%p.016.i8.i = phi ptr [ %14, %for.end.i11.i ], [ %head.017, %for.cond.preheader.i7.preheader.i ]
%eCnt.i9.i = getelementptr inbounds %struct._set, ptr %p.016.i8.i, i64 0, i32 1
%11 = load i32, ptr %eCnt.i9.i, align 8, !tbaa !12
%cmp113.i10.i = icmp sgt i32 %11, 0
br i1 %cmp113.i10.i, label %for.body.lr.ph.i15.i, label %for.end.i11.i
for.body.lr.ph.i15.i: ; preds = %for.cond.preheader.i7.i
%12 = load ptr, ptr %p.016.i8.i, align 8, !tbaa !5
%wide.trip.count.i16.i = zext i32 %11 to i64
br label %for.body.i17.i
for.cond.i21.i: ; preds = %for.body.i17.i
%indvars.iv.next.i22.i = add nuw nsw i64 %indvars.iv.i18.i, 1
%exitcond.not.i23.i = icmp eq i64 %indvars.iv.next.i22.i, %wide.trip.count.i16.i
br i1 %exitcond.not.i23.i, label %for.end.i11.i, label %for.body.i17.i, !llvm.loop !19
for.body.i17.i: ; preds = %for.cond.i21.i, %for.body.lr.ph.i15.i
%indvars.iv.i18.i = phi i64 [ 0, %for.body.lr.ph.i15.i ], [ %indvars.iv.next.i22.i, %for.cond.i21.i ]
%arrayidx.i19.i = getelementptr inbounds i32, ptr %12, i64 %indvars.iv.i18.i
%13 = load i32, ptr %arrayidx.i19.i, align 4, !tbaa !11
%cmp2.i20.i = icmp eq i32 %13, %6
br i1 %cmp2.i20.i, label %getTarget.exit24.i, label %for.cond.i21.i
for.end.i11.i: ; preds = %for.cond.i21.i, %for.cond.preheader.i7.i
%next.i12.i = getelementptr inbounds %struct._set, ptr %p.016.i8.i, i64 0, i32 2
%14 = load ptr, ptr %next.i12.i, align 8, !tbaa !13
%cmp.not.i13.i = icmp eq ptr %14, null
br i1 %cmp.not.i13.i, label %getTarget.exit24.i, label %for.cond.preheader.i7.i, !llvm.loop !20
getTarget.exit24.i: ; preds = %for.end.i11.i, %for.body.i17.i
%p.012.i14.i = phi ptr [ %p.016.i8.i, %for.body.i17.i ], [ null, %for.end.i11.i ]
%cmp.i = icmp eq ptr %p.012.i.i, %p.012.i14.i
%spec.select.i = select i1 %cmp.i, ptr @str.10, ptr @str.9
br label %same.exit
same.exit: ; preds = %sw.bb5, %getTarget.exit24.i
%str.9.sink.i = phi ptr [ @str.10, %sw.bb5 ], [ %spec.select.i, %getTarget.exit24.i ]
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) %str.9.sink.i)
br label %for.inc
for.inc: ; preds = %sw.bb, %same.exit, %for.body
%head.1 = phi ptr [ %head.017, %for.body ], [ %head.017, %same.exit ], [ %call4, %sw.bb ]
%inc = add nuw nsw i32 %i.016, 1
%15 = load i32, ptr %q, align 4, !tbaa !11
%cmp = icmp slt i32 %inc, %15
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !24
for.end: ; preds = %for.inc, %initSet.exit
%head.0.lcssa = phi ptr [ %call.peel.i, %initSet.exit ], [ %head.1, %for.inc ]
%cmp.not5.i = icmp eq ptr %head.0.lcssa, null
br i1 %cmp.not5.i, label %delAll.exit, label %while.body.i
while.body.i: ; preds = %for.end, %while.body.i
%p.06.i = phi ptr [ %16, %while.body.i ], [ %head.0.lcssa, %for.end ]
%next.i10 = getelementptr inbounds %struct._set, ptr %p.06.i, i64 0, i32 2
%16 = load ptr, ptr %next.i10, align 8, !tbaa !13
%17 = load ptr, ptr %p.06.i, align 8, !tbaa !5
call void @free(ptr noundef %17) #12
call void @free(ptr noundef nonnull %p.06.i) #12
%cmp.not.i = icmp eq ptr %16, null
br i1 %cmp.not.i, label %delAll.exit, label %while.body.i, !llvm.loop !23
delAll.exit: ; preds = %while.body.i, %for.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %com) #12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #12
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 #9
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #9
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #10
attributes #0 = { nofree nounwind memory(write, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 uwtable "min-legal-vector-width"="0" "no-trapping-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 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 #6 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { nounwind }
attributes #13 = { nounwind allocsize(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 0}
!6 = !{!"_set", !7, i64 0, !10, i64 8, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = !{!6, !10, i64 8}
!13 = !{!6, !7, i64 16}
!14 = distinct !{!14, !15, !16}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}
!19 = distinct !{!19, !15}
!20 = distinct !{!20, !15}
!21 = distinct !{!21, !15}
!22 = distinct !{!22, !15}
!23 = distinct !{!23, !15}
!24 = distinct !{!24, !15}
|
#include <stdio.h>
int main()
{
int n,i,j,count,flag=0;
scanf("%d",&n);
char a[n][n];
for(i=0;i<n;i++)
scanf("%s",&a[i]);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
count=0;
if((i-1)>=0&&a[i-1][j]=='o') count++;
if((j-1)>=0&&a[i][j-1]=='o') count++;
if((i+1)<n&&a[i+1][j]=='o') count++;
if((j+1)<n&&a[i][j+1]=='o') count++;
if(count%2!=0)
{
flag=1;
break;
}
}
if(flag) break;
}
if(flag) printf("NO\n");
else printf("YES\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_20884/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_20884/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%3 = mul nuw i64 %1, %1
%vla = alloca i8, i64 %3, align 16
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp104 = icmp sgt i32 %4, 0
br i1 %cmp104, label %for.body, label %if.end77
for.cond2.preheader: ; preds = %for.body
%cmp3.not133 = icmp sgt i32 %7, 0
br i1 %cmp3.not133, label %for.cond5.preheader.preheader, label %if.end77
for.cond5.preheader.preheader: ; preds = %for.cond2.preheader
%5 = zext i32 %7 to i64
%wide.trip.count168 = zext i32 %7 to i64
%cmp47.peel.not = icmp eq i32 %7, 1
%cmp47.us123.peel.not = icmp eq i32 %7, 1
%cmp47.us.peel.not = icmp eq i32 %7, 1
br label %for.cond5.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%6 = mul nuw nsw i64 %indvars.iv, %1
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %6
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond5.preheader.preheader, %for.inc70
%indvars.iv164 = phi i64 [ 0, %for.cond5.preheader.preheader ], [ %indvars.iv.next165, %for.inc70 ]
%cmp8.not = icmp eq i64 %indvars.iv164, 0
%9 = add nuw i64 %indvars.iv164, 4294967295
%idxprom10 = and i64 %9, 4294967295
%10 = mul nuw nsw i64 %idxprom10, %1
%arrayidx11 = getelementptr inbounds i8, ptr %vla, i64 %10
%11 = mul nuw nsw i64 %indvars.iv164, %1
%arrayidx22 = getelementptr inbounds i8, ptr %vla, i64 %11
%indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1
%cmp32 = icmp ult i64 %indvars.iv.next165, %5
%12 = mul nuw nsw i64 %indvars.iv.next165, %1
%arrayidx37 = getelementptr inbounds i8, ptr %vla, i64 %12
%cmp32.fr = freeze i1 %cmp32
br i1 %cmp32.fr, label %for.body7.us.peel, label %for.cond5.preheader.split
for.body7.us.peel: ; preds = %for.cond5.preheader
br i1 %cmp8.not, label %if.end31.us.peel, label %land.lhs.true.us.peel
land.lhs.true.us.peel: ; preds = %for.body7.us.peel
%13 = load i8, ptr %arrayidx11, align 1, !tbaa !11
%cmp14.us.peel = icmp eq i8 %13, 111
%spec.select.us.peel = zext i1 %cmp14.us.peel to i32
br label %if.end31.us.peel
if.end31.us.peel: ; preds = %for.body7.us.peel, %land.lhs.true.us.peel
%count.0.us.peel = phi i32 [ 0, %for.body7.us.peel ], [ %spec.select.us.peel, %land.lhs.true.us.peel ]
%14 = load i8, ptr %arrayidx37, align 1, !tbaa !11
%cmp41.us.peel = icmp eq i8 %14, 111
%inc44.us.peel = zext i1 %cmp41.us.peel to i32
%spec.select102.us.peel = add nuw nsw i32 %count.0.us.peel, %inc44.us.peel
br i1 %cmp47.us.peel.not, label %if.end60.us.peel, label %land.lhs.true49.us.peel
land.lhs.true49.us.peel: ; preds = %if.end31.us.peel
%arrayidx54.us.peel = getelementptr inbounds i8, ptr %arrayidx22, i64 1
%15 = load i8, ptr %arrayidx54.us.peel, align 1, !tbaa !11
%cmp56.us.peel = icmp eq i8 %15, 111
%inc59.us.peel = zext i1 %cmp56.us.peel to i32
%spec.select103.us.peel = add nuw nsw i32 %spec.select102.us.peel, %inc59.us.peel
br label %if.end60.us.peel
if.end60.us.peel: ; preds = %land.lhs.true49.us.peel, %if.end31.us.peel
%count.3.us.peel = phi i32 [ %spec.select102.us.peel, %if.end31.us.peel ], [ %spec.select103.us.peel, %land.lhs.true49.us.peel ]
%16 = and i32 %count.3.us.peel, 1
%cmp61.not.us.peel = icmp eq i32 %16, 0
br i1 %cmp61.not.us.peel, label %for.cond5.us, label %if.end77
for.cond5.us: ; preds = %if.end60.us.peel, %if.end60.us
%indvars.iv156 = phi i64 [ %indvars.iv.next157, %if.end60.us ], [ 1, %if.end60.us.peel ]
%exitcond161.not = icmp eq i64 %indvars.iv156, %wide.trip.count168
br i1 %exitcond161.not, label %for.inc70, label %for.body7.us
for.body7.us: ; preds = %for.cond5.us
br i1 %cmp8.not, label %if.end31.us, label %land.lhs.true.us
land.lhs.true.us: ; preds = %for.body7.us
%arrayidx13.us = getelementptr inbounds i8, ptr %arrayidx11, i64 %indvars.iv156
%17 = load i8, ptr %arrayidx13.us, align 1, !tbaa !11
%cmp14.us = icmp eq i8 %17, 111
%spec.select.us = zext i1 %cmp14.us to i32
br label %if.end31.us
if.end31.us: ; preds = %land.lhs.true.us, %for.body7.us
%count.0.us = phi i32 [ 0, %for.body7.us ], [ %spec.select.us, %land.lhs.true.us ]
%18 = add nuw i64 %indvars.iv156, 4294967295
%idxprom24.us = and i64 %18, 4294967295
%arrayidx25.us = getelementptr inbounds i8, ptr %arrayidx22, i64 %idxprom24.us
%19 = load i8, ptr %arrayidx25.us, align 1, !tbaa !11
%cmp27.us = icmp eq i8 %19, 111
%inc30.us = zext i1 %cmp27.us to i32
%spec.select101.us = add nuw nsw i32 %count.0.us, %inc30.us
%arrayidx39.us = getelementptr inbounds i8, ptr %arrayidx37, i64 %indvars.iv156
%20 = load i8, ptr %arrayidx39.us, align 1, !tbaa !11
%cmp41.us = icmp eq i8 %20, 111
%inc44.us = zext i1 %cmp41.us to i32
%spec.select102.us = add nuw nsw i32 %spec.select101.us, %inc44.us
%indvars.iv.next157 = add nuw nsw i64 %indvars.iv156, 1
%21 = trunc i64 %indvars.iv.next157 to i32
%cmp47.us = icmp sgt i32 %7, %21
br i1 %cmp47.us, label %land.lhs.true49.us, label %if.end60.us
land.lhs.true49.us: ; preds = %if.end31.us
%arrayidx54.us = getelementptr inbounds i8, ptr %arrayidx22, i64 %indvars.iv.next157
%22 = load i8, ptr %arrayidx54.us, align 1, !tbaa !11
%cmp56.us = icmp eq i8 %22, 111
%inc59.us = zext i1 %cmp56.us to i32
%spec.select103.us = add nuw nsw i32 %spec.select102.us, %inc59.us
br label %if.end60.us
if.end60.us: ; preds = %land.lhs.true49.us, %if.end31.us
%count.3.us = phi i32 [ %spec.select102.us, %if.end31.us ], [ %spec.select103.us, %land.lhs.true49.us ]
%23 = and i32 %count.3.us, 1
%cmp61.not.us = icmp eq i32 %23, 0
br i1 %cmp61.not.us, label %for.cond5.us, label %if.end77, !llvm.loop !12
for.cond5.preheader.split: ; preds = %for.cond5.preheader
br i1 %cmp8.not, label %if.end31.us120.peel, label %if.end31.peel
if.end31.peel: ; preds = %for.cond5.preheader.split
%24 = load i8, ptr %arrayidx11, align 1, !tbaa !11
%cmp14.peel = icmp eq i8 %24, 111
%spec.select.peel = zext i1 %cmp14.peel to i32
br i1 %cmp47.peel.not, label %if.end60.peel, label %land.lhs.true49.peel
land.lhs.true49.peel: ; preds = %if.end31.peel
%arrayidx54.peel = getelementptr inbounds i8, ptr %arrayidx22, i64 1
%25 = load i8, ptr %arrayidx54.peel, align 1, !tbaa !11
%cmp56.peel = icmp eq i8 %25, 111
%inc59.peel = zext i1 %cmp56.peel to i32
%spec.select103.peel = add nuw nsw i32 %spec.select.peel, %inc59.peel
br label %if.end60.peel
if.end60.peel: ; preds = %land.lhs.true49.peel, %if.end31.peel
%count.3.peel = phi i32 [ %spec.select.peel, %if.end31.peel ], [ %spec.select103.peel, %land.lhs.true49.peel ]
%26 = and i32 %count.3.peel, 1
%cmp61.not.peel = icmp eq i32 %26, 0
br i1 %cmp61.not.peel, label %for.cond5, label %if.end77
if.end31.us120.peel: ; preds = %for.cond5.preheader.split
br i1 %cmp47.us123.peel.not, label %for.cond5.us106.preheader, label %if.end60.us130.peel
if.end60.us130.peel: ; preds = %if.end31.us120.peel
%arrayidx54.us126.peel = getelementptr inbounds i8, ptr %arrayidx22, i64 1
%27 = load i8, ptr %arrayidx54.us126.peel, align 1, !tbaa !11
%cmp56.us127.peel.not = icmp eq i8 %27, 111
br i1 %cmp56.us127.peel.not, label %if.end77, label %for.cond5.us106.preheader
for.cond5.us106.preheader: ; preds = %if.end31.us120.peel, %if.end60.us130.peel
br label %for.cond5.us106
for.cond5.us106: ; preds = %for.cond5.us106.preheader, %if.end60.us130
%indvars.iv148 = phi i64 [ %indvars.iv.next149, %if.end60.us130 ], [ 1, %for.cond5.us106.preheader ]
%exitcond153.not = icmp eq i64 %indvars.iv148, %wide.trip.count168
br i1 %exitcond153.not, label %for.inc70, label %if.end31.us120
if.end31.us120: ; preds = %for.cond5.us106
%28 = add nuw i64 %indvars.iv148, 4294967295
%idxprom24.us115 = and i64 %28, 4294967295
%arrayidx25.us116 = getelementptr inbounds i8, ptr %arrayidx22, i64 %idxprom24.us115
%29 = load i8, ptr %arrayidx25.us116, align 1, !tbaa !11
%cmp27.us117 = icmp eq i8 %29, 111
%inc30.us118 = zext i1 %cmp27.us117 to i32
%indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
%30 = trunc i64 %indvars.iv.next149 to i32
%cmp47.us123 = icmp sgt i32 %7, %30
br i1 %cmp47.us123, label %land.lhs.true49.us124, label %if.end60.us130
land.lhs.true49.us124: ; preds = %if.end31.us120
%arrayidx54.us126 = getelementptr inbounds i8, ptr %arrayidx22, i64 %indvars.iv.next149
%31 = load i8, ptr %arrayidx54.us126, align 1, !tbaa !11
%cmp56.us127 = icmp eq i8 %31, 111
%inc59.us128 = zext i1 %cmp56.us127 to i32
%spec.select103.us129 = add nuw nsw i32 %inc30.us118, %inc59.us128
br label %if.end60.us130
if.end60.us130: ; preds = %land.lhs.true49.us124, %if.end31.us120
%count.3.us131 = phi i32 [ %inc30.us118, %if.end31.us120 ], [ %spec.select103.us129, %land.lhs.true49.us124 ]
%32 = and i32 %count.3.us131, 1
%cmp61.not.us132 = icmp eq i32 %32, 0
br i1 %cmp61.not.us132, label %for.cond5.us106, label %if.end77, !llvm.loop !14
for.cond5: ; preds = %if.end60.peel, %if.end60
%indvars.iv142 = phi i64 [ %indvars.iv.next143, %if.end60 ], [ 1, %if.end60.peel ]
%exitcond.not = icmp eq i64 %indvars.iv142, %wide.trip.count168
br i1 %exitcond.not, label %for.inc70, label %if.end31
if.end31: ; preds = %for.cond5
%arrayidx13 = getelementptr inbounds i8, ptr %arrayidx11, i64 %indvars.iv142
%33 = load i8, ptr %arrayidx13, align 1, !tbaa !11
%cmp14 = icmp eq i8 %33, 111
%spec.select = zext i1 %cmp14 to i32
%34 = add nuw i64 %indvars.iv142, 4294967295
%idxprom24 = and i64 %34, 4294967295
%arrayidx25 = getelementptr inbounds i8, ptr %arrayidx22, i64 %idxprom24
%35 = load i8, ptr %arrayidx25, align 1, !tbaa !11
%cmp27 = icmp eq i8 %35, 111
%inc30 = zext i1 %cmp27 to i32
%spec.select101 = add nuw nsw i32 %inc30, %spec.select
%indvars.iv.next143 = add nuw nsw i64 %indvars.iv142, 1
%36 = trunc i64 %indvars.iv.next143 to i32
%cmp47 = icmp sgt i32 %7, %36
br i1 %cmp47, label %land.lhs.true49, label %if.end60
land.lhs.true49: ; preds = %if.end31
%arrayidx54 = getelementptr inbounds i8, ptr %arrayidx22, i64 %indvars.iv.next143
%37 = load i8, ptr %arrayidx54, align 1, !tbaa !11
%cmp56 = icmp eq i8 %37, 111
%inc59 = zext i1 %cmp56 to i32
%spec.select103 = add nuw nsw i32 %spec.select101, %inc59
br label %if.end60
if.end60: ; preds = %land.lhs.true49, %if.end31
%count.3 = phi i32 [ %spec.select101, %if.end31 ], [ %spec.select103, %land.lhs.true49 ]
%38 = and i32 %count.3, 1
%cmp61.not = icmp eq i32 %38, 0
br i1 %cmp61.not, label %for.cond5, label %if.end77, !llvm.loop !15
for.inc70: ; preds = %for.cond5, %for.cond5.us106, %for.cond5.us
%exitcond169.not = icmp eq i64 %indvars.iv.next165, %wide.trip.count168
br i1 %exitcond169.not, label %if.end77, label %for.cond5.preheader, !llvm.loop !16
if.end77: ; preds = %for.inc70, %if.end60.us.peel, %if.end60.us130.peel, %if.end60.peel, %if.end60, %if.end60.us130, %if.end60.us, %for.cond2.preheader, %entry
%str.sink = phi ptr [ @str, %entry ], [ @str, %for.cond2.preheader ], [ @str.4, %if.end60.us ], [ @str.4, %if.end60.us130 ], [ @str.4, %if.end60 ], [ @str.4, %if.end60.peel ], [ @str.4, %if.end60.us130.peel ], [ @str.4, %if.end60.us.peel ], [ @str, %for.inc70 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = distinct !{!14, !10, !13}
!15 = distinct !{!15, !10, !13}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
void sort(int l[], int n)
{
for (int i = 0; i < n - 1; i++){
for (int j = n - 1; j > i; j--){
if (l[j] > l[j - 1]){
int temp = l[j];
l[j] = l[j - 1];
l[j - 1] = temp;
}
}
}
}
#include <stdio.h>
int count(int l[], int m1, int m2, int d)
{
int p1 = m1, p2 = m2;
while (p1 < p2){
int c = (p2 + p1) / 2;
if (l[c] > d){
if (c == m2){
return m2 - m1 + 1;
}
if (l[c + 1] > d){
p1 = c + 1;
}else{
return c - m1 + 1;
}
}else{
if (c == m1) return 0;
p2 = c - 1;
}
}
if (l[p1] > d){
return p1 - m1 + 1;
}else{
return 0;
}
}
int main(void)
{
int n;
scanf("%d", &n);
int l[n];
for (int i = 0; i < n; i++){
scanf("%d", &l[i]);
}
sort(l, n);
int ans = 0;
for (int i = 0; i < n - 2; i++){
for (int j = i + 1; j < n - 1; j++){
ans += count(l, j + 1, n - 1, l[i] - l[j]);
}
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208890/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208890/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @sort(ptr nocapture noundef %l, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp39 = icmp sgt i32 %n, 1
br i1 %cmp39, label %for.cond2.preheader.preheader, label %for.cond.cleanup
for.cond2.preheader.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
%0 = zext i32 %n to i64
%1 = add nsw i64 %0, -1
%wide.trip.count = zext i32 %sub to i64
%arrayidx.phi.trans.insert = getelementptr inbounds i32, ptr %l, i64 %1
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.cond.cleanup4
%indvars.iv42 = phi i64 [ 0, %for.cond2.preheader.preheader ], [ %indvars.iv.next43, %for.cond.cleanup4 ]
%.pre = load i32, ptr %arrayidx.phi.trans.insert, align 4, !tbaa !5
br label %for.body5
for.cond.cleanup: ; preds = %for.cond.cleanup4, %entry
ret void
for.cond.cleanup4: ; preds = %for.inc
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%exitcond.not = icmp eq i64 %indvars.iv.next43, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.cond2.preheader, !llvm.loop !9
for.body5: ; preds = %for.cond2.preheader, %for.inc
%2 = phi i32 [ %.pre, %for.cond2.preheader ], [ %4, %for.inc ]
%indvars.iv = phi i64 [ %1, %for.cond2.preheader ], [ %indvars.iv.next, %for.inc ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%arrayidx8 = getelementptr inbounds i32, ptr %l, i64 %indvars.iv.next
%3 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %2, %3
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body5
%arrayidx = getelementptr inbounds i32, ptr %l, i64 %indvars.iv
store i32 %3, ptr %arrayidx, align 4, !tbaa !5
store i32 %2, ptr %arrayidx8, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body5, %if.then
%4 = phi i32 [ %3, %for.body5 ], [ %2, %if.then ]
%cmp3 = icmp sgt i64 %indvars.iv.next, %indvars.iv42
br i1 %cmp3, label %for.body5, label %for.cond.cleanup4, !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: 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: read) uwtable
define dso_local i32 @count(ptr nocapture noundef readonly %l, i32 noundef %m1, i32 noundef %m2, i32 noundef %d) local_unnamed_addr #2 {
entry:
%cmp58 = icmp slt i32 %m1, %m2
br i1 %cmp58, label %while.body, label %while.end
while.body: ; preds = %entry, %cleanup
%p2.060 = phi i32 [ %p2.2, %cleanup ], [ %m2, %entry ]
%p1.059 = phi i32 [ %p1.2, %cleanup ], [ %m1, %entry ]
%add = add nsw i32 %p2.060, %p1.059
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %l, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %0, %d
br i1 %cmp1, label %if.then, label %if.else14
if.then: ; preds = %while.body
%cmp2 = icmp eq i32 %div, %m2
br i1 %cmp2, label %if.then3, label %if.end
if.then3: ; preds = %if.then
%reass.sub62 = sub i32 %m2, %m1
%add4 = add i32 %reass.sub62, 1
br label %cleanup27
if.end: ; preds = %if.then
%add5 = add nsw i32 %div, 1
%idxprom6 = sext i32 %add5 to i64
%arrayidx7 = getelementptr inbounds i32, ptr %l, i64 %idxprom6
%1 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %1, %d
br i1 %cmp8, label %cleanup, label %if.else
if.else: ; preds = %if.end
%reass.sub = sub i32 %div, %m1
%add12 = add i32 %reass.sub, 1
br label %cleanup27
if.else14: ; preds = %while.body
%cmp15 = icmp eq i32 %div, %m1
br i1 %cmp15, label %cleanup27, label %if.end17
if.end17: ; preds = %if.else14
%sub18 = add nsw i32 %div, -1
br label %cleanup
cleanup: ; preds = %if.end17, %if.end
%p1.2 = phi i32 [ %p1.059, %if.end17 ], [ %add5, %if.end ]
%p2.2 = phi i32 [ %sub18, %if.end17 ], [ %p2.060, %if.end ]
%cmp = icmp slt i32 %p1.2, %p2.2
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !12
while.end: ; preds = %cleanup, %entry
%p1.0.lcssa = phi i32 [ %m1, %entry ], [ %p1.2, %cleanup ]
%idxprom20 = sext i32 %p1.0.lcssa to i64
%arrayidx21 = getelementptr inbounds i32, ptr %l, i64 %idxprom20
%2 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %2, %d
br i1 %cmp22, label %if.then23, label %cleanup27
if.then23: ; preds = %while.end
%reass.sub61 = sub i32 %p1.0.lcssa, %m1
%add25 = add i32 %reass.sub61, 1
br label %cleanup27
cleanup27: ; preds = %if.else14, %if.else, %if.then3, %while.end, %if.then23
%retval.2 = phi i32 [ %add25, %if.then23 ], [ 0, %while.end ], [ %add12, %if.else ], [ %add4, %if.then3 ], [ 0, %if.else14 ]
ret i32 %retval.2
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %3, 0
br i1 %cmp42, label %for.body, label %for.cond.cleanup5
for.cond.cleanup: ; preds = %for.body
%cmp39.i = icmp sgt i32 %10, 1
br i1 %cmp39.i, label %for.cond2.preheader.preheader.i, label %for.cond.cleanup5
for.cond2.preheader.preheader.i: ; preds = %for.cond.cleanup
%sub.i = add nsw i32 %10, -1
%4 = zext i32 %10 to i64
%5 = add nsw i64 %4, -1
%wide.trip.count.i = zext i32 %sub.i to i64
%arrayidx.phi.trans.insert.i = getelementptr inbounds i32, ptr %vla, i64 %5
br label %for.cond2.preheader.i
for.cond2.preheader.i: ; preds = %for.cond.cleanup4.i, %for.cond2.preheader.preheader.i
%indvars.iv42.i = phi i64 [ 0, %for.cond2.preheader.preheader.i ], [ %indvars.iv.next43.i, %for.cond.cleanup4.i ]
%.pre.i = load i32, ptr %arrayidx.phi.trans.insert.i, align 4, !tbaa !5
br label %for.body5.i
for.cond.cleanup4.i: ; preds = %for.inc.i
%indvars.iv.next43.i = add nuw nsw i64 %indvars.iv42.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next43.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %sort.exit, label %for.cond2.preheader.i, !llvm.loop !9
for.body5.i: ; preds = %for.inc.i, %for.cond2.preheader.i
%6 = phi i32 [ %.pre.i, %for.cond2.preheader.i ], [ %8, %for.inc.i ]
%indvars.iv.i = phi i64 [ %5, %for.cond2.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%arrayidx8.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next.i
%7 = load i32, ptr %arrayidx8.i, align 4, !tbaa !5
%cmp9.i = icmp sgt i32 %6, %7
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body5.i
%arrayidx.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i
store i32 %7, ptr %arrayidx.i, align 4, !tbaa !5
store i32 %6, ptr %arrayidx8.i, align 4, !tbaa !5
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body5.i
%8 = phi i32 [ %7, %for.body5.i ], [ %6, %if.then.i ]
%cmp3.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv42.i
br i1 %cmp3.i, label %for.body5.i, label %for.cond.cleanup4.i, !llvm.loop !11
sort.exit: ; preds = %for.cond.cleanup4.i
%cmp448 = icmp sgt i32 %10, 2
br i1 %cmp448, label %for.body6.lr.ph, label %for.cond.cleanup5
for.body6.lr.ph: ; preds = %sort.exit
%sub = add nsw i32 %10, -2
%sub8 = add nsw i32 %10, -1
%9 = zext i32 %sub8 to i64
%wide.trip.count65 = zext i32 %sub to i64
%wide.trip.count = zext i32 %sub8 to i64
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp = icmp slt i64 %indvars.iv.next, %11
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.cond3.loopexit: ; preds = %count.exit, %for.body6
%ans.1.lcssa = phi i32 [ %ans.049, %for.body6 ], [ %add20, %count.exit ]
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%exitcond66.not = icmp eq i64 %indvars.iv.next63, %wide.trip.count65
br i1 %exitcond66.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !14
for.cond.cleanup5: ; preds = %for.cond3.loopexit, %entry, %for.cond.cleanup, %sort.exit
%ans.0.lcssa = phi i32 [ 0, %sort.exit ], [ 0, %for.cond.cleanup ], [ 0, %entry ], [ %ans.1.lcssa, %for.cond3.loopexit ]
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
for.body6: ; preds = %for.body6.lr.ph, %for.cond3.loopexit
%indvars.iv62 = phi i64 [ 0, %for.body6.lr.ph ], [ %indvars.iv.next63, %for.cond3.loopexit ]
%indvars.iv57 = phi i64 [ 1, %for.body6.lr.ph ], [ %indvars.iv.next58, %for.cond3.loopexit ]
%ans.049 = phi i32 [ 0, %for.body6.lr.ph ], [ %ans.1.lcssa, %for.cond3.loopexit ]
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%cmp944 = icmp ult i64 %indvars.iv.next63, %9
br i1 %cmp944, label %for.body11.lr.ph, label %for.cond3.loopexit
for.body11.lr.ph: ; preds = %for.body6
%arrayidx15 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv62
%12 = load i32, ptr %arrayidx15, align 4, !tbaa !5
br label %for.body11
for.body11: ; preds = %for.body11.lr.ph, %count.exit
%indvars.iv59 = phi i64 [ %indvars.iv57, %for.body11.lr.ph ], [ %indvars.iv.next60, %count.exit ]
%ans.145 = phi i32 [ %ans.049, %for.body11.lr.ph ], [ %add20, %count.exit ]
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%13 = trunc i64 %indvars.iv59 to i32
%add12.neg = xor i32 %13, -1
%arrayidx17 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv59
%14 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%sub18 = sub nsw i32 %12, %14
%15 = trunc i64 %indvars.iv.next60 to i32
%cmp58.i = icmp sgt i32 %sub8, %15
br i1 %cmp58.i, label %while.body.i, label %while.end.i
while.body.i: ; preds = %for.body11, %cleanup.i
%p2.060.i = phi i32 [ %p2.2.i, %cleanup.i ], [ %sub8, %for.body11 ]
%p1.059.i = phi i32 [ %p1.2.i, %cleanup.i ], [ %15, %for.body11 ]
%add.i = add nsw i32 %p1.059.i, %p2.060.i
%div.i = sdiv i32 %add.i, 2
%idxprom.i = sext i32 %div.i to i64
%arrayidx.i37 = getelementptr inbounds i32, ptr %vla, i64 %idxprom.i
%16 = load i32, ptr %arrayidx.i37, align 4, !tbaa !5
%cmp1.i = icmp sgt i32 %16, %sub18
br i1 %cmp1.i, label %if.then.i38, label %if.else14.i
if.then.i38: ; preds = %while.body.i
%cmp2.i = icmp eq i32 %div.i, %sub8
br i1 %cmp2.i, label %if.then3.i, label %if.end.i
if.then3.i: ; preds = %if.then.i38
%add4.i = add i32 %10, %add12.neg
br label %count.exit
if.end.i: ; preds = %if.then.i38
%add5.i = add nsw i32 %div.i, 1
%idxprom6.i = sext i32 %add5.i to i64
%arrayidx7.i = getelementptr inbounds i32, ptr %vla, i64 %idxprom6.i
%17 = load i32, ptr %arrayidx7.i, align 4, !tbaa !5
%cmp8.i = icmp sgt i32 %17, %sub18
br i1 %cmp8.i, label %cleanup.i, label %if.else.i
if.else.i: ; preds = %if.end.i
%add12.i = sub i32 %div.i, %13
br label %count.exit
if.else14.i: ; preds = %while.body.i
%18 = zext i32 %div.i to i64
%cmp15.i = icmp eq i64 %indvars.iv.next60, %18
br i1 %cmp15.i, label %count.exit, label %if.end17.i
if.end17.i: ; preds = %if.else14.i
%sub18.i = add nsw i32 %div.i, -1
br label %cleanup.i
cleanup.i: ; preds = %if.end17.i, %if.end.i
%p1.2.i = phi i32 [ %p1.059.i, %if.end17.i ], [ %add5.i, %if.end.i ]
%p2.2.i = phi i32 [ %sub18.i, %if.end17.i ], [ %p2.060.i, %if.end.i ]
%cmp.i = icmp slt i32 %p1.2.i, %p2.2.i
br i1 %cmp.i, label %while.body.i, label %while.end.i, !llvm.loop !12
while.end.i: ; preds = %cleanup.i, %for.body11
%p1.0.lcssa.i = phi i32 [ %15, %for.body11 ], [ %p1.2.i, %cleanup.i ]
%idxprom20.i = sext i32 %p1.0.lcssa.i to i64
%arrayidx21.i = getelementptr inbounds i32, ptr %vla, i64 %idxprom20.i
%19 = load i32, ptr %arrayidx21.i, align 4, !tbaa !5
%cmp22.i = icmp sgt i32 %19, %sub18
%add25.i = sub i32 %p1.0.lcssa.i, %13
%spec.select = select i1 %cmp22.i, i32 %add25.i, i32 0
br label %count.exit
count.exit: ; preds = %if.else14.i, %while.end.i, %if.then3.i, %if.else.i
%retval.2.i = phi i32 [ %add12.i, %if.else.i ], [ %add4.i, %if.then3.i ], [ %spec.select, %while.end.i ], [ 0, %if.else14.i ]
%add20 = add nsw i32 %retval.2.i, %ans.145
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.cond3.loopexit, label %for.body11, !llvm.loop !15
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #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
declare void @llvm.stackrestore.p0(ptr) #5
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
/*2019/10/19 */
/*template*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define MOD 1000000007
#define MIN 999999999
#define MAX -999999999
typedef long long int ll;
typedef unsigned long long int ull;
void llswap(ll *x,ll *y){ll tmp;tmp=*x;*x=*y;*y=tmp;}
void swap(int *x,int *y){int tmp;tmp=*x;*x=*y;*y=tmp;}
int rmax(int x,int y){return x>y?x:y;}
int rmin(int x,int y){return x>y?y:x;}
ll llrmax(ll x,ll y){return x>y?x:y;}
ll llrmin(ll x,ll y){return x>y?y:x;}
int asc(const void *a,const void *b){if(*(int*)a < *(int*)b)return -1;else if(*(int*)a == *(int*)b)return 0;else return 1;}
int desc(const void *a,const void *b){if(*(int*)a < *(int*)b)return 1;else if(*(int*)a == *(int*)b)return 0;else return -1;}
int llasc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return -1;else if(*(ll*)a == *(ll*)b)return 0;else return 1;}
int lldesc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return 1;else if(*(ll*)a == *(ll*)b)return 0;else return -1;}
int gcd(int x,int y){if(y==0)return x;return gcd(y,x%y);}
//int asc_t(const void *a,const void *b){if(((pair_t*)a)->d < ((pair_t*)b)->d)return -1;else if(((pair_t*)a)->d == ((pair_t*)b)->d)return 0;else return 1;}
//int asc_t(const void *a,const void *b){if(((pair_t*)a)->d < ((pair_t*)b)->d)return 1;else if(((pair_t*)a)->d == ((pair_t*)b)->d)return 0;else return -1;}
int main(){
int n,l[2000];
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&l[i]);
}
int ans=0;
qsort(l,n,sizeof(int),asc);
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
for(int k=j+1;k<n;k++){
if(l[i]<l[j]+l[k]&&l[j]<l[i]+l[k]&&l[k]<l[i]+l[j]){
ans++;
}else{
break;
}
}
}
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208948/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208948/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @llswap(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %x, align 8, !tbaa !5
%1 = load i64, ptr %y, align 8, !tbaa !5
store i64 %1, ptr %x, align 8, !tbaa !5
store i64 %0, ptr %y, 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 norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %x, align 4, !tbaa !9
%1 = load i32, ptr %y, align 4, !tbaa !9
store i32 %1, ptr %x, align 4, !tbaa !9
store i32 %0, ptr %y, align 4, !tbaa !9
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @rmax(i32 noundef %x, i32 noundef %y) local_unnamed_addr #2 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %x, i32 %y)
ret i32 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @rmin(i32 noundef %x, i32 noundef %y) local_unnamed_addr #2 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %x, i32 %y)
ret i32 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llrmax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #2 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llrmin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #2 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #3 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !9
%1 = load i32, ptr %b, align 4, !tbaa !9
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !9
%1 = load i32, ptr %b, align 4, !tbaa !9
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llasc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #3 {
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 ne i64 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @lldesc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #3 {
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 ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %x, i32 noundef %y) local_unnamed_addr #4 {
entry:
%cmp4 = icmp eq i32 %y, 0
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%y.tr6 = phi i32 [ %rem, %if.end ], [ %y, %entry ]
%x.tr5 = phi i32 [ %y.tr6, %if.end ], [ %x, %entry ]
%rem = srem i32 %x.tr5, %y.tr6
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
%x.tr.lcssa = phi i32 [ %x, %entry ], [ %y.tr6, %if.end ]
ret i32 %x.tr.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%n = alloca i32, align 4
%l = alloca [2000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %l) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !9
%cmp83 = icmp sgt i32 %0, 0
br i1 %cmp83, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %4, %for.body ]
call void @qsort(ptr noundef nonnull %l, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @asc) #9
%1 = load i32, ptr %n, align 4, !tbaa !9
%cmp494 = icmp sgt i32 %1, 0
br i1 %cmp494, label %for.body7.preheader, label %for.cond.cleanup6
for.body7.preheader: ; preds = %for.cond.cleanup
%2 = zext i32 %1 to i64
%wide.trip.count115 = zext i32 %1 to i64
br label %for.body7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [2000 x i32], ptr %l, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !9
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
for.cond3.loopexit: ; preds = %cleanup, %for.body7
%ans.1.lcssa = phi i32 [ %ans.095, %for.body7 ], [ %ans.2.lcssa, %cleanup ]
%indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
%indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
%exitcond116.not = icmp eq i64 %indvars.iv.next113, %wide.trip.count115
br i1 %exitcond116.not, label %for.cond.cleanup6, label %for.body7, !llvm.loop !13
for.cond.cleanup6: ; preds = %for.cond3.loopexit, %for.cond.cleanup
%ans.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %ans.1.lcssa, %for.cond3.loopexit ]
%call59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %l) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
for.body7: ; preds = %for.body7.preheader, %for.cond3.loopexit
%indvars.iv112 = phi i64 [ 0, %for.body7.preheader ], [ %indvars.iv.next113, %for.cond3.loopexit ]
%indvars.iv107 = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next108, %for.cond3.loopexit ]
%indvars.iv100 = phi i64 [ 2, %for.body7.preheader ], [ %indvars.iv.next101, %for.cond3.loopexit ]
%ans.095 = phi i32 [ 0, %for.body7.preheader ], [ %ans.1.lcssa, %for.cond3.loopexit ]
%indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
%cmp990 = icmp ult i64 %indvars.iv.next113, %2
br i1 %cmp990, label %for.body12.lr.ph, label %for.cond3.loopexit
for.body12.lr.ph: ; preds = %for.body7
%arrayidx20 = getelementptr inbounds [2000 x i32], ptr %l, i64 0, i64 %indvars.iv112
br label %for.body12
for.body12: ; preds = %for.body12.lr.ph, %cleanup
%indvars.iv109 = phi i64 [ %indvars.iv107, %for.body12.lr.ph ], [ %indvars.iv.next110, %cleanup ]
%indvars.iv102 = phi i64 [ %indvars.iv100, %for.body12.lr.ph ], [ %indvars.iv.next103, %cleanup ]
%ans.191 = phi i32 [ %ans.095, %for.body12.lr.ph ], [ %ans.2.lcssa, %cleanup ]
%indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
%5 = trunc i64 %indvars.iv.next110 to i32
%cmp1585 = icmp sgt i32 %1, %5
br i1 %cmp1585, label %for.body18.lr.ph, label %cleanup
for.body18.lr.ph: ; preds = %for.body12
%6 = load i32, ptr %arrayidx20, align 4, !tbaa !9
%arrayidx22 = getelementptr inbounds [2000 x i32], ptr %l, i64 0, i64 %indvars.iv109
%7 = load i32, ptr %arrayidx22, align 4, !tbaa !9
%add44 = add nsw i32 %7, %6
br label %for.body18
for.body18: ; preds = %for.body18.lr.ph, %if.then
%indvars.iv104 = phi i64 [ %indvars.iv102, %for.body18.lr.ph ], [ %indvars.iv.next105, %if.then ]
%ans.286 = phi i32 [ %ans.191, %for.body18.lr.ph ], [ %inc47, %if.then ]
%arrayidx24 = getelementptr inbounds [2000 x i32], ptr %l, i64 0, i64 %indvars.iv104
%8 = load i32, ptr %arrayidx24, align 4, !tbaa !9
%add25 = add nsw i32 %8, %7
%cmp26 = icmp slt i32 %6, %add25
%add34 = add nsw i32 %8, %6
%cmp35 = icmp slt i32 %7, %add34
%or.cond = select i1 %cmp26, i1 %cmp35, i1 false
%cmp45 = icmp slt i32 %8, %add44
%or.cond82 = select i1 %or.cond, i1 %cmp45, i1 false
br i1 %or.cond82, label %if.then, label %cleanup
if.then: ; preds = %for.body18
%inc47 = add nsw i32 %ans.286, 1
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%9 = trunc i64 %indvars.iv.next105 to i32
%cmp15 = icmp sgt i32 %1, %9
br i1 %cmp15, label %for.body18, label %cleanup, !llvm.loop !14
cleanup: ; preds = %if.then, %for.body18, %for.body12
%ans.2.lcssa = phi i32 [ %ans.191, %for.body12 ], [ %ans.286, %for.body18 ], [ %inc47, %if.then ]
%indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
%exitcond.not = icmp eq i64 %indvars.iv.next110, %wide.trip.count115
br i1 %exitcond.not, label %for.cond3.loopexit, label %for.body12, !llvm.loop !15
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #8
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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
|
#include <stdio.h>
int N;
int a;
int main(){
int i;
int x=0;
long long int ans=0;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&a);
ans=ans+(a+x)/2;
if(a==0)x=0;
else x=(a+x)%2;
}
printf("%lld\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_208991/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_208991/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@a = dso_local global i32 0, align 4
@.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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%ans.013 = phi i64 [ %add2, %for.body ], [ 0, %entry ]
%x.012 = phi i32 [ %x.1, %for.body ], [ 0, %entry ]
%i.011 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @a)
%1 = load i32, ptr @a, align 4, !tbaa !5
%add = add nsw i32 %1, %x.012
%div = sdiv i32 %add, 2
%conv = sext i32 %div to i64
%add2 = add nsw i64 %ans.013, %conv
%cmp3 = icmp eq i32 %1, 0
%rem = srem i32 %add, 2
%x.1 = select i1 %cmp3, i32 0, i32 %rem
%inc = add nuw nsw i32 %i.011, 1
%2 = load i32, ptr @N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%ans.0.lcssa = phi i64 [ 0, %entry ], [ %add2, %for.body ]
%call6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int time[86400]={},h,m,s,i,n,sum,ans;
while(scanf("%d",&n)){
if(n==0) break;
for(i=0;i<n;i++){
scanf("%d:%d:%d",&h,&m,&s);
s+=3600*h+60*m;
time[s]+=1;
scanf("%d:%d:%d",&h,&m,&s);
s+=3600*h+60*m;
time[s]-=1;
}
ans=0;
sum=0;
for(i=0;i<86400;i++){
sum+=time[i];
time[i]=0;
if(sum>ans) ans=sum;
}
printf("%d\n",ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209033/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209033/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d:%d:%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%time = alloca [86400 x i32], align 16
%h = alloca i32, align 4
%m = alloca i32, align 4
%s = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 345600, ptr nonnull %time) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(345600) %time, i8 0, i64 345600, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool42 = icmp eq i32 %call41, 0
%0 = load i32, ptr %n, align 4
%cmp43 = icmp eq i32 %0, 0
%or.cond44 = select i1 %tobool42, i1 true, i1 %cmp43
br i1 %or.cond44, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end26
%1 = phi i32 [ %14, %for.end26 ], [ %0, %entry ]
%cmp136 = icmp sgt i32 %1, 0
br i1 %cmp136, label %for.body, label %for.body15.preheader
for.body: ; preds = %for.cond.preheader, %for.body
%i.037 = phi i32 [ %inc, %for.body ], [ 0, %for.cond.preheader ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h, ptr noundef nonnull %m, ptr noundef nonnull %s)
%2 = load i32, ptr %h, align 4, !tbaa !5
%mul = mul nsw i32 %2, 3600
%3 = load i32, ptr %m, align 4, !tbaa !5
%mul3 = mul nsw i32 %3, 60
%add = add nsw i32 %mul3, %mul
%4 = load i32, ptr %s, align 4, !tbaa !5
%add4 = add nsw i32 %add, %4
store i32 %add4, ptr %s, align 4, !tbaa !5
%idxprom = sext i32 %add4 to i64
%arrayidx = getelementptr inbounds [86400 x i32], ptr %time, i64 0, i64 %idxprom
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add5 = add nsw i32 %5, 1
store i32 %add5, ptr %arrayidx, align 4, !tbaa !5
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h, ptr noundef nonnull %m, ptr noundef nonnull %s)
%6 = load i32, ptr %h, align 4, !tbaa !5
%mul7 = mul nsw i32 %6, 3600
%7 = load i32, ptr %m, align 4, !tbaa !5
%mul8 = mul nsw i32 %7, 60
%add9 = add nsw i32 %mul8, %mul7
%8 = load i32, ptr %s, align 4, !tbaa !5
%add10 = add nsw i32 %add9, %8
store i32 %add10, ptr %s, align 4, !tbaa !5
%idxprom11 = sext i32 %add10 to i64
%arrayidx12 = getelementptr inbounds [86400 x i32], ptr %time, i64 0, i64 %idxprom11
%9 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%sub = add nsw i32 %9, -1
store i32 %sub, ptr %arrayidx12, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.037, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc, %10
br i1 %cmp1, label %for.body, label %for.body15.preheader, !llvm.loop !9
for.body15.preheader: ; preds = %for.body, %for.cond.preheader
br label %for.body15
for.body15: ; preds = %for.body15, %for.body15.preheader
%indvars.iv = phi i64 [ 0, %for.body15.preheader ], [ %indvars.iv.next.2, %for.body15 ]
%ans.040 = phi i32 [ 0, %for.body15.preheader ], [ %spec.select.2, %for.body15 ]
%sum.039 = phi i32 [ 0, %for.body15.preheader ], [ %add18.2, %for.body15 ]
%arrayidx17 = getelementptr inbounds [86400 x i32], ptr %time, i64 0, i64 %indvars.iv
%11 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%add18 = add nsw i32 %11, %sum.039
store i32 0, ptr %arrayidx17, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %add18, i32 %ans.040)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx17.1 = getelementptr inbounds [86400 x i32], ptr %time, i64 0, i64 %indvars.iv.next
%12 = load i32, ptr %arrayidx17.1, align 4, !tbaa !5
%add18.1 = add nsw i32 %12, %add18
store i32 0, ptr %arrayidx17.1, align 4, !tbaa !5
%spec.select.1 = call i32 @llvm.smax.i32(i32 %add18.1, i32 %spec.select)
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx17.2 = getelementptr inbounds [86400 x i32], ptr %time, i64 0, i64 %indvars.iv.next.1
%13 = load i32, ptr %arrayidx17.2, align 4, !tbaa !5
%add18.2 = add nsw i32 %13, %add18.1
store i32 0, ptr %arrayidx17.2, align 4, !tbaa !5
%spec.select.2 = call i32 @llvm.smax.i32(i32 %add18.2, i32 %spec.select.1)
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 86400
br i1 %exitcond.not.2, label %for.end26, label %for.body15, !llvm.loop !11
for.end26: ; preds = %for.body15
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.select.2)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool = icmp eq i32 %call, 0
%14 = load i32, ptr %n, align 4
%cmp = icmp eq i32 %14, 0
%or.cond = select i1 %tobool, i1 true, i1 %cmp
br i1 %or.cond, label %while.end, label %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end26, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 345600, ptr nonnull %time) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void){
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
printf("%d",a*b-c*b-d*a+c*d);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209077/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209077/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%2 = load i32, ptr %c, align 4, !tbaa !5
%mul6 = sub i32 %0, %2
%sub = mul i32 %mul6, %1
%3 = load i32, ptr %d, align 4, !tbaa !5
%reass.add = sub i32 %2, %0
%reass.mul = mul i32 %reass.add, %3
%add = add i32 %reass.mul, %sub
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int H, W;
do {
scanf("%d %d", &H, &W);
} while (H < 1 || H > 20 || W < 1 || W > 20);
int h, w;
do {
scanf("%d %d", &h, &w);
} while (h < 1 || h > H || w < 1 || w > W);
int n;
n = (H * W) - (h * W) - (w * H) + (h * w);
printf("%d\n", n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209127/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209127/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%H = alloca i32, align 4
%W = alloca i32, align 4
%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
br label %do.body
do.body: ; preds = %do.body, %entry
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%0 = load i32, ptr %H, align 4
%1 = add i32 %0, -21
%or.cond = icmp ult i32 %1, -20
%2 = load i32, ptr %W, align 4
%cmp3 = icmp slt i32 %2, 1
%or.cond22 = select i1 %or.cond, i1 true, i1 %cmp3
%cmp4 = icmp sgt i32 %2, 20
%or.cond24 = select i1 %or.cond22, i1 true, i1 %cmp4
br i1 %or.cond24, label %do.body, label %do.end, !llvm.loop !5
do.end: ; preds = %do.body
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
br label %do.body5
do.body5: ; preds = %do.body5.backedge, %do.end
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%3 = load i32, ptr %h, align 4, !tbaa !7
%cmp8 = icmp slt i32 %3, 1
br i1 %cmp8, label %do.body5.backedge, label %lor.lhs.false9
lor.lhs.false9: ; preds = %do.body5
%4 = load i32, ptr %H, align 4, !tbaa !7
%cmp10 = icmp sgt i32 %3, %4
%5 = load i32, ptr %w, align 4
%cmp12 = icmp slt i32 %5, 1
%or.cond23 = select i1 %cmp10, i1 true, i1 %cmp12
%6 = load i32, ptr %W, align 4
%cmp14 = icmp sgt i32 %5, %6
%or.cond32 = select i1 %or.cond23, i1 true, i1 %cmp14
br i1 %or.cond32, label %do.body5.backedge, label %do.end16
do.body5.backedge: ; preds = %lor.lhs.false9, %do.body5
br label %do.body5, !llvm.loop !11
do.end16: ; preds = %lor.lhs.false9
%mul28 = sub i32 %4, %3
%sub = mul i32 %6, %mul28
%reass.add = sub i32 %3, %4
%reass.mul = mul i32 %reass.add, %5
%add = add i32 %reass.mul, %sub
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #3
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: 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include <stdio.h>
int osero(int c,int d, int e, int f){
int a = c -e;
int b = d - f;
printf("%d\n", a * b);
return 0;
}
int main(){
int H,W,h,w;
scanf("%d %d",&H,&W);
scanf("%d %d",&h,&w);
osero(H,W,h,w);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209170/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209170/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @osero(i32 noundef %c, i32 noundef %d, i32 noundef %e, i32 noundef %f) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %c, %e
%sub1 = sub nsw i32 %d, %f
%mul = mul nsw i32 %sub1, %sub
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %mul)
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
%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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %H, ptr noundef nonnull %W)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %H, align 4, !tbaa !5
%1 = load i32, ptr %W, align 4, !tbaa !5
%2 = load i32, ptr %h, align 4, !tbaa !5
%3 = load i32, ptr %w, align 4, !tbaa !5
%sub.i = sub nsw i32 %0, %2
%sub1.i = sub nsw i32 %1, %3
%mul.i = mul nsw i32 %sub1.i, %sub.i
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %mul.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #3
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int H,W,h,w;
scanf("%d%d",&H,&W);
scanf("%d%d",&h,&w);
printf("%d",H*W-h*W-(H*w-h*w));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209213/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209213/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
%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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #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 %H, ptr noundef nonnull %W)
%call1 = 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
%1 = load i32, ptr %W, align 4, !tbaa !5
%2 = load i32, ptr %h, align 4, !tbaa !5
%mul8 = sub i32 %0, %2
%sub = mul i32 %mul8, %1
%3 = load i32, ptr %w, align 4, !tbaa !5
%mul39.neg = sub i32 %2, %0
%sub5.neg = mul i32 %mul39.neg, %3
%sub6 = add i32 %sub5.neg, %sub
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub6)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #3
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: 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 H,W,h,w;
int answer;
scanf("%d %d",&H,&W);
scanf("%d %d",&h,&w);
answer=H*W-H*w-h*W+h*w;
printf("%d\n",answer);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209271/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209271/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%H = alloca i32, align 4
%W = alloca i32, align 4
%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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #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 %H, ptr noundef nonnull %W)
%call1 = 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
%1 = load i32, ptr %W, align 4, !tbaa !5
%2 = load i32, ptr %w, align 4, !tbaa !5
%mul27 = sub i32 %1, %2
%sub = mul i32 %mul27, %0
%3 = load i32, ptr %h, align 4, !tbaa !5
%reass.add = sub i32 %2, %1
%reass.mul = mul i32 %reass.add, %3
%add = add i32 %reass.mul, %sub
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #3
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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
char str[20][20];
int H,W,h,w;
int i,j,result = 0;
scanf("%d %d",&H,&W);
scanf("%d %d",&h,&w);
for(i = 0;i < H;i++){
for(j = 0;j < W;j++){
str[i][j] = 0;
}
}
for(i = 0;i < h;i++){
for(j = 0;j < W;j++){
str[i][j] = 1;
}
}
for(i = 0;i < w;i++){
for(j = 0;j < H;j++){
str[j][i] = 1;
}
}
for(i = 0;i < H;i++){
for(j = 0;j < W;j++){
if(str[i][j] != 1){
result++;
}
}
}
printf("%d",result);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209314/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209314/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [20 x [20 x i8]], align 16
%H = alloca i32, align 4
%W = alloca i32, align 4
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %str) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%call1 = 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
%cmp87 = icmp sgt i32 %0, 0
br i1 %cmp87, label %for.cond2.preheader.lr.ph, label %for.cond10.preheader
for.cond2.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr %W, align 4, !tbaa !5
%cmp385 = icmp sgt i32 %1, 0
br i1 %cmp385, label %for.cond2.preheader.us.preheader, label %for.cond10.preheader
for.cond2.preheader.us.preheader: ; preds = %for.cond2.preheader.lr.ph
%2 = zext i32 %1 to i64
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond10.preheader.loopexit.unr-lcssa, label %for.cond2.preheader.us.preheader.new
for.cond2.preheader.us.preheader.new: ; preds = %for.cond2.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967288
%invariant.gep = getelementptr i8, ptr %str, i64 40
%invariant.gep153 = getelementptr i8, ptr %str, i64 60
%invariant.gep155 = getelementptr i8, ptr %str, i64 80
%invariant.gep157 = getelementptr i8, ptr %str, i64 100
%invariant.gep159 = getelementptr i8, ptr %str, i64 120
%invariant.gep161 = getelementptr i8, ptr %str, i64 140
br label %for.cond2.preheader.us
for.cond2.preheader.us: ; preds = %for.cond2.preheader.us, %for.cond2.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond2.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond2.preheader.us ]
%niter = phi i64 [ 0, %for.cond2.preheader.us.preheader.new ], [ %niter.next.7, %for.cond2.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 20
%scevgep = getelementptr i8, ptr %str, i64 %4
call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !9
%5 = mul nuw i64 %indvar, 20
%6 = or i64 %5, 20
%scevgep.1 = getelementptr i8, ptr %str, i64 %6
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.1, i8 0, i64 %2, i1 false), !tbaa !9
%7 = mul nuw i64 %indvar, 20
%gep = getelementptr i8, ptr %invariant.gep, i64 %7
call void @llvm.memset.p0.i64(ptr align 8 %gep, i8 0, i64 %2, i1 false), !tbaa !9
%8 = mul nuw i64 %indvar, 20
%gep154 = getelementptr i8, ptr %invariant.gep153, i64 %8
call void @llvm.memset.p0.i64(ptr align 4 %gep154, i8 0, i64 %2, i1 false), !tbaa !9
%9 = mul nuw i64 %indvar, 20
%gep156 = getelementptr i8, ptr %invariant.gep155, i64 %9
call void @llvm.memset.p0.i64(ptr align 16 %gep156, i8 0, i64 %2, i1 false), !tbaa !9
%10 = mul nuw i64 %indvar, 20
%gep158 = getelementptr i8, ptr %invariant.gep157, i64 %10
call void @llvm.memset.p0.i64(ptr align 4 %gep158, i8 0, i64 %2, i1 false), !tbaa !9
%11 = mul nuw i64 %indvar, 20
%gep160 = getelementptr i8, ptr %invariant.gep159, i64 %11
call void @llvm.memset.p0.i64(ptr align 8 %gep160, i8 0, i64 %2, i1 false), !tbaa !9
%12 = mul nuw i64 %indvar, 20
%gep162 = getelementptr i8, ptr %invariant.gep161, i64 %12
call void @llvm.memset.p0.i64(ptr align 4 %gep162, i8 0, i64 %2, i1 false), !tbaa !9
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond10.preheader.loopexit.unr-lcssa, label %for.cond2.preheader.us, !llvm.loop !10
for.cond10.preheader.loopexit.unr-lcssa: ; preds = %for.cond2.preheader.us, %for.cond2.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond2.preheader.us.preheader ], [ %indvar.next.7, %for.cond2.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond10.preheader, label %for.cond2.preheader.us.epil
for.cond2.preheader.us.epil: ; preds = %for.cond10.preheader.loopexit.unr-lcssa, %for.cond2.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond2.preheader.us.epil ], [ %indvar.unr, %for.cond10.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond2.preheader.us.epil ], [ 0, %for.cond10.preheader.loopexit.unr-lcssa ]
%13 = mul nuw nsw i64 %indvar.epil, 20
%scevgep.epil = getelementptr i8, ptr %str, i64 %13
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !9
%indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond10.preheader, label %for.cond2.preheader.us.epil, !llvm.loop !12
for.cond10.preheader: ; preds = %for.cond10.preheader.loopexit.unr-lcssa, %for.cond2.preheader.us.epil, %for.cond2.preheader.lr.ph, %entry
%14 = load i32, ptr %h, align 4, !tbaa !5
%cmp1191 = icmp sgt i32 %14, 0
br i1 %cmp1191, label %for.cond13.preheader.lr.ph, label %for.cond26.preheader
for.cond13.preheader.lr.ph: ; preds = %for.cond10.preheader
%15 = load i32, ptr %W, align 4, !tbaa !5
%cmp1489 = icmp sgt i32 %15, 0
br i1 %cmp1489, label %for.cond13.preheader.us.preheader, label %for.cond26.preheader
for.cond13.preheader.us.preheader: ; preds = %for.cond13.preheader.lr.ph
%16 = zext i32 %15 to i64
%wide.trip.count117 = zext i32 %14 to i64
%xtraiter141 = and i64 %wide.trip.count117, 7
%17 = icmp ult i32 %14, 8
br i1 %17, label %for.cond26.preheader.loopexit.unr-lcssa, label %for.cond13.preheader.us.preheader.new
for.cond13.preheader.us.preheader.new: ; preds = %for.cond13.preheader.us.preheader
%unroll_iter144 = and i64 %wide.trip.count117, 4294967288
%invariant.gep163 = getelementptr i8, ptr %str, i64 40
%invariant.gep165 = getelementptr i8, ptr %str, i64 60
%invariant.gep167 = getelementptr i8, ptr %str, i64 80
%invariant.gep169 = getelementptr i8, ptr %str, i64 100
%invariant.gep171 = getelementptr i8, ptr %str, i64 120
%invariant.gep173 = getelementptr i8, ptr %str, i64 140
br label %for.cond13.preheader.us
for.cond13.preheader.us: ; preds = %for.cond13.preheader.us, %for.cond13.preheader.us.preheader.new
%indvar112 = phi i64 [ 0, %for.cond13.preheader.us.preheader.new ], [ %indvar.next113.7, %for.cond13.preheader.us ]
%niter145 = phi i64 [ 0, %for.cond13.preheader.us.preheader.new ], [ %niter145.next.7, %for.cond13.preheader.us ]
%18 = mul nuw nsw i64 %indvar112, 20
%scevgep114 = getelementptr i8, ptr %str, i64 %18
call void @llvm.memset.p0.i64(ptr align 16 %scevgep114, i8 1, i64 %16, i1 false), !tbaa !9
%19 = mul nuw i64 %indvar112, 20
%20 = or i64 %19, 20
%scevgep114.1 = getelementptr i8, ptr %str, i64 %20
call void @llvm.memset.p0.i64(ptr align 4 %scevgep114.1, i8 1, i64 %16, i1 false), !tbaa !9
%21 = mul nuw i64 %indvar112, 20
%gep164 = getelementptr i8, ptr %invariant.gep163, i64 %21
call void @llvm.memset.p0.i64(ptr align 8 %gep164, i8 1, i64 %16, i1 false), !tbaa !9
%22 = mul nuw i64 %indvar112, 20
%gep166 = getelementptr i8, ptr %invariant.gep165, i64 %22
call void @llvm.memset.p0.i64(ptr align 4 %gep166, i8 1, i64 %16, i1 false), !tbaa !9
%23 = mul nuw i64 %indvar112, 20
%gep168 = getelementptr i8, ptr %invariant.gep167, i64 %23
call void @llvm.memset.p0.i64(ptr align 16 %gep168, i8 1, i64 %16, i1 false), !tbaa !9
%24 = mul nuw i64 %indvar112, 20
%gep170 = getelementptr i8, ptr %invariant.gep169, i64 %24
call void @llvm.memset.p0.i64(ptr align 4 %gep170, i8 1, i64 %16, i1 false), !tbaa !9
%25 = mul nuw i64 %indvar112, 20
%gep172 = getelementptr i8, ptr %invariant.gep171, i64 %25
call void @llvm.memset.p0.i64(ptr align 8 %gep172, i8 1, i64 %16, i1 false), !tbaa !9
%26 = mul nuw i64 %indvar112, 20
%gep174 = getelementptr i8, ptr %invariant.gep173, i64 %26
call void @llvm.memset.p0.i64(ptr align 4 %gep174, i8 1, i64 %16, i1 false), !tbaa !9
%indvar.next113.7 = add nuw nsw i64 %indvar112, 8
%niter145.next.7 = add i64 %niter145, 8
%niter145.ncmp.7 = icmp eq i64 %niter145.next.7, %unroll_iter144
br i1 %niter145.ncmp.7, label %for.cond26.preheader.loopexit.unr-lcssa, label %for.cond13.preheader.us, !llvm.loop !14
for.cond26.preheader.loopexit.unr-lcssa: ; preds = %for.cond13.preheader.us, %for.cond13.preheader.us.preheader
%indvar112.unr = phi i64 [ 0, %for.cond13.preheader.us.preheader ], [ %indvar.next113.7, %for.cond13.preheader.us ]
%lcmp.mod143.not = icmp eq i64 %xtraiter141, 0
br i1 %lcmp.mod143.not, label %for.cond26.preheader, label %for.cond13.preheader.us.epil
for.cond13.preheader.us.epil: ; preds = %for.cond26.preheader.loopexit.unr-lcssa, %for.cond13.preheader.us.epil
%indvar112.epil = phi i64 [ %indvar.next113.epil, %for.cond13.preheader.us.epil ], [ %indvar112.unr, %for.cond26.preheader.loopexit.unr-lcssa ]
%epil.iter142 = phi i64 [ %epil.iter142.next, %for.cond13.preheader.us.epil ], [ 0, %for.cond26.preheader.loopexit.unr-lcssa ]
%27 = mul nuw nsw i64 %indvar112.epil, 20
%scevgep114.epil = getelementptr i8, ptr %str, i64 %27
call void @llvm.memset.p0.i64(ptr align 4 %scevgep114.epil, i8 1, i64 %16, i1 false), !tbaa !9
%indvar.next113.epil = add nuw nsw i64 %indvar112.epil, 1
%epil.iter142.next = add i64 %epil.iter142, 1
%epil.iter142.cmp.not = icmp eq i64 %epil.iter142.next, %xtraiter141
br i1 %epil.iter142.cmp.not, label %for.cond26.preheader, label %for.cond13.preheader.us.epil, !llvm.loop !15
for.cond26.preheader: ; preds = %for.cond26.preheader.loopexit.unr-lcssa, %for.cond13.preheader.us.epil, %for.cond13.preheader.lr.ph, %for.cond10.preheader
%28 = load i32, ptr %w, align 4, !tbaa !5
%cmp2795 = icmp sgt i32 %28, 0
br i1 %cmp2795, label %for.cond29.preheader.lr.ph, label %for.cond42.preheader
for.cond29.preheader.lr.ph: ; preds = %for.cond26.preheader
br i1 %cmp87, label %for.cond29.preheader.us.preheader, label %for.end60
for.cond29.preheader.us.preheader: ; preds = %for.cond29.preheader.lr.ph
%wide.trip.count125 = zext i32 %28 to i64
%wide.trip.count120 = zext i32 %0 to i64
%xtraiter146 = and i64 %wide.trip.count120, 3
%29 = icmp ult i32 %0, 4
%unroll_iter149 = and i64 %wide.trip.count120, 4294967292
%lcmp.mod148.not = icmp eq i64 %xtraiter146, 0
br label %for.cond29.preheader.us
for.cond29.preheader.us: ; preds = %for.cond29.preheader.us.preheader, %for.cond29.for.inc39_crit_edge.us
%indvars.iv122 = phi i64 [ 0, %for.cond29.preheader.us.preheader ], [ %indvars.iv.next123, %for.cond29.for.inc39_crit_edge.us ]
br i1 %29, label %for.cond29.for.inc39_crit_edge.us.unr-lcssa, label %for.body31.us
for.body31.us: ; preds = %for.cond29.preheader.us, %for.body31.us
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body31.us ], [ 0, %for.cond29.preheader.us ]
%niter150 = phi i64 [ %niter150.next.3, %for.body31.us ], [ 0, %for.cond29.preheader.us ]
%arrayidx35.us = getelementptr inbounds [20 x [20 x i8]], ptr %str, i64 0, i64 %indvars.iv, i64 %indvars.iv122
store i8 1, ptr %arrayidx35.us, align 1, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx35.us.1 = getelementptr inbounds [20 x [20 x i8]], ptr %str, i64 0, i64 %indvars.iv.next, i64 %indvars.iv122
store i8 1, ptr %arrayidx35.us.1, align 1, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx35.us.2 = getelementptr inbounds [20 x [20 x i8]], ptr %str, i64 0, i64 %indvars.iv.next.1, i64 %indvars.iv122
store i8 1, ptr %arrayidx35.us.2, align 1, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx35.us.3 = getelementptr inbounds [20 x [20 x i8]], ptr %str, i64 0, i64 %indvars.iv.next.2, i64 %indvars.iv122
store i8 1, ptr %arrayidx35.us.3, align 1, !tbaa !9
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter150.next.3 = add i64 %niter150, 4
%niter150.ncmp.3 = icmp eq i64 %niter150.next.3, %unroll_iter149
br i1 %niter150.ncmp.3, label %for.cond29.for.inc39_crit_edge.us.unr-lcssa, label %for.body31.us, !llvm.loop !16
for.cond29.for.inc39_crit_edge.us.unr-lcssa: ; preds = %for.body31.us, %for.cond29.preheader.us
%indvars.iv.unr = phi i64 [ 0, %for.cond29.preheader.us ], [ %indvars.iv.next.3, %for.body31.us ]
br i1 %lcmp.mod148.not, label %for.cond29.for.inc39_crit_edge.us, label %for.body31.us.epil
for.body31.us.epil: ; preds = %for.cond29.for.inc39_crit_edge.us.unr-lcssa, %for.body31.us.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body31.us.epil ], [ %indvars.iv.unr, %for.cond29.for.inc39_crit_edge.us.unr-lcssa ]
%epil.iter147 = phi i64 [ %epil.iter147.next, %for.body31.us.epil ], [ 0, %for.cond29.for.inc39_crit_edge.us.unr-lcssa ]
%arrayidx35.us.epil = getelementptr inbounds [20 x [20 x i8]], ptr %str, i64 0, i64 %indvars.iv.epil, i64 %indvars.iv122
store i8 1, ptr %arrayidx35.us.epil, align 1, !tbaa !9
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter147.next = add i64 %epil.iter147, 1
%epil.iter147.cmp.not = icmp eq i64 %epil.iter147.next, %xtraiter146
br i1 %epil.iter147.cmp.not, label %for.cond29.for.inc39_crit_edge.us, label %for.body31.us.epil, !llvm.loop !17
for.cond29.for.inc39_crit_edge.us: ; preds = %for.body31.us.epil, %for.cond29.for.inc39_crit_edge.us.unr-lcssa
%indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
%exitcond126.not = icmp eq i64 %indvars.iv.next123, %wide.trip.count125
br i1 %exitcond126.not, label %for.cond42.preheader, label %for.cond29.preheader.us, !llvm.loop !18
for.cond42.preheader: ; preds = %for.cond29.for.inc39_crit_edge.us, %for.cond26.preheader
br i1 %cmp87, label %for.cond45.preheader.lr.ph, label %for.end60
for.cond45.preheader.lr.ph: ; preds = %for.cond42.preheader
%30 = load i32, ptr %W, align 4, !tbaa !5
%cmp4697 = icmp sgt i32 %30, 0
br i1 %cmp4697, label %for.cond45.preheader.us.preheader, label %for.end60
for.cond45.preheader.us.preheader: ; preds = %for.cond45.preheader.lr.ph
%wide.trip.count135 = zext i32 %0 to i64
%wide.trip.count130 = zext i32 %30 to i64
%min.iters.check = icmp ult i32 %30, 8
%n.vec = and i64 %wide.trip.count130, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count130
br label %for.cond45.preheader.us
for.cond45.preheader.us: ; preds = %for.cond45.preheader.us.preheader, %for.cond45.for.inc58_crit_edge.us
%indvars.iv132 = phi i64 [ 0, %for.cond45.preheader.us.preheader ], [ %indvars.iv.next133, %for.cond45.for.inc58_crit_edge.us ]
%result.0103.us = phi i32 [ 0, %for.cond45.preheader.us.preheader ], [ %spec.select.us.lcssa, %for.cond45.for.inc58_crit_edge.us ]
br i1 %min.iters.check, label %for.body47.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond45.preheader.us
%31 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %result.0103.us, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %31, %vector.ph ], [ %38, %vector.body ]
%vec.phi137 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %39, %vector.body ]
%32 = getelementptr inbounds [20 x [20 x i8]], ptr %str, i64 0, i64 %indvars.iv132, i64 %index
%wide.load = load <4 x i8>, ptr %32, align 4, !tbaa !9
%33 = getelementptr inbounds i8, ptr %32, i64 4
%wide.load138 = load <4 x i8>, ptr %33, align 4, !tbaa !9
%34 = icmp ne <4 x i8> %wide.load, <i8 1, i8 1, i8 1, i8 1>
%35 = icmp ne <4 x i8> %wide.load138, <i8 1, i8 1, i8 1, i8 1>
%36 = zext <4 x i1> %34 to <4 x i32>
%37 = zext <4 x i1> %35 to <4 x i32>
%38 = add <4 x i32> %vec.phi, %36
%39 = add <4 x i32> %vec.phi137, %37
%index.next = add nuw i64 %index, 8
%40 = icmp eq i64 %index.next, %n.vec
br i1 %40, label %middle.block, label %vector.body, !llvm.loop !19
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %39, %38
%41 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond45.for.inc58_crit_edge.us, label %for.body47.us.preheader
for.body47.us.preheader: ; preds = %for.cond45.preheader.us, %middle.block
%indvars.iv127.ph = phi i64 [ 0, %for.cond45.preheader.us ], [ %n.vec, %middle.block ]
%result.199.us.ph = phi i32 [ %result.0103.us, %for.cond45.preheader.us ], [ %41, %middle.block ]
br label %for.body47.us
for.body47.us: ; preds = %for.body47.us.preheader, %for.body47.us
%indvars.iv127 = phi i64 [ %indvars.iv.next128, %for.body47.us ], [ %indvars.iv127.ph, %for.body47.us.preheader ]
%result.199.us = phi i32 [ %spec.select.us, %for.body47.us ], [ %result.199.us.ph, %for.body47.us.preheader ]
%arrayidx51.us = getelementptr inbounds [20 x [20 x i8]], ptr %str, i64 0, i64 %indvars.iv132, i64 %indvars.iv127
%42 = load i8, ptr %arrayidx51.us, align 1, !tbaa !9
%cmp52.not.us = icmp ne i8 %42, 1
%inc54.us = zext i1 %cmp52.not.us to i32
%spec.select.us = add nsw i32 %result.199.us, %inc54.us
%indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
%exitcond131.not = icmp eq i64 %indvars.iv.next128, %wide.trip.count130
br i1 %exitcond131.not, label %for.cond45.for.inc58_crit_edge.us, label %for.body47.us, !llvm.loop !22
for.cond45.for.inc58_crit_edge.us: ; preds = %for.body47.us, %middle.block
%spec.select.us.lcssa = phi i32 [ %41, %middle.block ], [ %spec.select.us, %for.body47.us ]
%indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
%exitcond136.not = icmp eq i64 %indvars.iv.next133, %wide.trip.count135
br i1 %exitcond136.not, label %for.end60, label %for.cond45.preheader.us, !llvm.loop !23
for.end60: ; preds = %for.cond45.for.inc58_crit_edge.us, %for.cond29.preheader.lr.ph, %for.cond45.preheader.lr.ph, %for.cond42.preheader
%result.0.lcssa = phi i32 [ 0, %for.cond42.preheader ], [ 0, %for.cond45.preheader.lr.ph ], [ 0, %for.cond29.preheader.lr.ph ], [ %spec.select.us.lcssa, %for.cond45.for.inc58_crit_edge.us ]
%call61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %result.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %str) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11, !20, !21}
!20 = !{!"llvm.loop.isvectorized", i32 1}
!21 = !{!"llvm.loop.unroll.runtime.disable"}
!22 = distinct !{!22, !11, !21, !20}
!23 = distinct !{!23, !11}
|
/*
* main.c
*
* Created on: 2019/03/09
* Author: family
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main()
{
int H, W, h, w;
int remain = 0;
scanf("%d %d", &H, &W);
scanf("%d %d", &h, &w);
remain = H * W;
remain -= (W * h);
remain -= ((H - h) * w);
printf("%d\n",remain);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209358/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209358/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%H = alloca i32, align 4
%W = alloca i32, align 4
%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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #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 %H, ptr noundef nonnull %W)
%call1 = 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
%1 = load i32, ptr %W, align 4, !tbaa !5
%2 = load i32, ptr %h, align 4, !tbaa !5
%mul9 = sub i32 %0, %2
%sub = mul i32 %mul9, %1
%sub3.neg = sub i32 %2, %0
%3 = load i32, ptr %w, align 4, !tbaa !5
%mul4.neg = mul i32 %sub3.neg, %3
%sub5 = add i32 %mul4.neg, %sub
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub5)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #3
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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
int main(int argc, char const *argv[])
{
int H,W,a,b;
scanf("%d%d%d%d",&H,&W,&a,&b);
printf("%d\n",(H - a) * (W - b));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209408/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209408/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
%a = alloca i32, align 4
%b = 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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %H, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %W, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%sub1 = sub nsw i32 %2, %3
%mul = mul nsw i32 %sub1, %sub
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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: 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"}
|
//
// main.c
// Space Coconut Grab
//
// Created by x15071xx on 2016/06/09.
// Copyright ?? 2016??´ AIT. All rights reserved.
//
#include <stdio.h>
int main(int argc, const char * argv[]) {
int x=0,y=0,z=0;
int e,m=99999;
while (1) {
m=99999999;
scanf("%d",&e);
if (e==0) {
break;
}
for (z=0; z*z*z <= e; z++) {
for (y=0; y*y + z*z*z <= e; y++) {
x = e - z*z*z - y*y;
if (m > x+y+z){
m = x+y+z;
}
}
}
printf("%d\n",m);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209473/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209473/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%e = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %e) #4
%call50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %e)
%0 = load i32, ptr %e, align 4, !tbaa !5
%cmp51 = icmp eq i32 %0, 0
br i1 %cmp51, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end22
%1 = phi i32 [ %2, %for.end22 ], [ %0, %entry ]
%cmp2.not46 = icmp slt i32 %1, 0
br i1 %cmp2.not46, label %for.end22, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.cond.preheader, %for.inc20
%mul149 = phi i32 [ %mul1, %for.inc20 ], [ 0, %for.cond.preheader ]
%m.048 = phi i32 [ %spec.select, %for.inc20 ], [ 99999999, %for.cond.preheader ]
%z.047 = phi i32 [ %inc21, %for.inc20 ], [ 0, %for.cond.preheader ]
%sub12 = add i32 %z.047, %1
br label %for.body8
for.body8: ; preds = %for.cond3.preheader, %for.body8
%add45 = phi i32 [ %mul149, %for.cond3.preheader ], [ %add, %for.body8 ]
%m.144 = phi i32 [ %m.048, %for.cond3.preheader ], [ %spec.select, %for.body8 ]
%y.043 = phi i32 [ 0, %for.cond3.preheader ], [ %inc, %for.body8 ]
%add13 = add i32 %sub12, %y.043
%add14 = sub i32 %add13, %add45
%spec.select = call i32 @llvm.smin.i32(i32 %m.144, i32 %add14)
%inc = add nuw nsw i32 %y.043, 1
%mul4 = mul nsw i32 %inc, %inc
%add = add nuw nsw i32 %mul4, %mul149
%cmp7.not = icmp sgt i32 %add, %1
br i1 %cmp7.not, label %for.inc20, label %for.body8, !llvm.loop !9
for.inc20: ; preds = %for.body8
%inc21 = add nuw nsw i32 %z.047, 1
%mul = mul nsw i32 %inc21, %inc21
%mul1 = mul nsw i32 %mul, %inc21
%cmp2.not = icmp sgt i32 %mul1, %1
br i1 %cmp2.not, label %for.end22, label %for.cond3.preheader, !llvm.loop !11
for.end22: ; preds = %for.inc20, %for.cond.preheader
%m.0.lcssa = phi i32 [ 99999999, %for.cond.preheader ], [ %spec.select, %for.inc20 ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %m.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %e)
%2 = load i32, ptr %e, align 4, !tbaa !5
%cmp = icmp eq i32 %2, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end22, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %e) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(){
long long int a,b,count=0,temp;
scanf("%I64d %I64d",&a,&b);
while(a&&b){
if(a>b){
temp=a/b;
a=a-temp*b;
count+=temp;
}
else{
temp=b/a;
b=b-temp*a;
count+=temp;
}
}
printf("%I64d",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_20956/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_20956/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%I64d %I64d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%I64d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%a.promoted = load i64, ptr %a, align 8, !tbaa !5
%b.promoted = load i64, ptr %b, align 8
%tobool17 = icmp ne i64 %a.promoted, 0
%tobool118 = icmp ne i64 %b.promoted, 0
%0 = select i1 %tobool17, i1 %tobool118, i1 false
br i1 %0, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end
%count.021 = phi i64 [ %count.1, %if.end ], [ 0, %entry ]
%sub1420 = phi i64 [ %sub13, %if.end ], [ %a.promoted, %entry ]
%sub41619 = phi i64 [ %sub415, %if.end ], [ %b.promoted, %entry ]
%cmp = icmp sgt i64 %sub1420, %sub41619
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %while.body
%div = sdiv i64 %sub1420, %sub41619
%mul = mul nsw i64 %div, %sub41619
%sub.recomposed = srem i64 %sub1420, %sub41619
store i64 %sub.recomposed, ptr %a, align 8, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%div2 = sdiv i64 %sub41619, %sub1420
%mul3 = mul nsw i64 %div2, %sub1420
%sub4.recomposed = srem i64 %sub41619, %sub1420
store i64 %sub4.recomposed, ptr %b, align 8, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%sub415 = phi i64 [ %sub41619, %if.then ], [ %sub4.recomposed, %if.else ]
%sub13 = phi i64 [ %sub.recomposed, %if.then ], [ %sub1420, %if.else ]
%div.pn = phi i64 [ %div, %if.then ], [ %div2, %if.else ]
%count.1 = add nsw i64 %div.pn, %count.021
%tobool = icmp ne i64 %sub13, 0
%tobool1 = icmp ne i64 %sub415, 0
%1 = select i1 %tobool, i1 %tobool1, i1 false
br i1 %1, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %if.end, %entry
%count.0.lcssa = phi i64 [ 0, %entry ], [ %count.1, %if.end ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void) {
long long int a,b,ans,temp;
scanf("%lld%lld",&a,&b);
ans=0;
while(a%b!=0)
{
ans=ans+a/b;
temp=b;
b=a%b;
a=temp;
}
ans=ans+a/b;
printf("%lld\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_20961/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_20961/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%a.promoted = load i64, ptr %a, align 8, !tbaa !5
%b.promoted = load i64, ptr %b, align 8, !tbaa !5
%rem9 = srem i64 %a.promoted, %b.promoted
%cmp.not10 = icmp eq i64 %rem9, 0
br i1 %cmp.not10, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%rem13 = phi i64 [ %rem, %while.body ], [ %rem9, %entry ]
%ans.012 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%0 = phi i64 [ %rem811, %while.body ], [ %a.promoted, %entry ]
%rem811 = phi i64 [ %rem13, %while.body ], [ %b.promoted, %entry ]
%div = sdiv i64 %0, %rem811
%add = add nsw i64 %div, %ans.012
%rem = srem i64 %rem811, %rem13
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i64 %rem13, ptr %b, align 8, !tbaa !5
store i64 %rem811, ptr %a, align 8, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%ans.0.lcssa = phi i64 [ %add, %while.cond.while.end_crit_edge ], [ 0, %entry ]
%.lcssa7 = phi i64 [ %rem811, %while.cond.while.end_crit_edge ], [ %a.promoted, %entry ]
%.lcssa = phi i64 [ %rem13, %while.cond.while.end_crit_edge ], [ %b.promoted, %entry ]
%div2 = sdiv i64 %.lcssa7, %.lcssa
%add3 = add nsw i64 %div2, %ans.0.lcssa
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add3)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <string.h>
#include <stdio.h>
int main()
{ char s[201];
scanf("%s",s);
int l=strlen(s);
for(int i=l/2-2;i>0;i--){
int cnt=0;
for(int j=0;j<i;j++){
if(s[j]==s[i+j]){
cnt++;
}else{
break;
}
if(cnt==i){
printf("%d",i*2);
return 0;
}
}
}
printf("2");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209660/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209660/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [201 x i8], align 16
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%conv = trunc i64 %call2 to i32
%cmp46 = icmp slt i32 %conv, 6
br i1 %cmp46, label %for.end26, label %for.cond4.preheader.preheader
for.cond4.preheader.preheader: ; preds = %entry
%div6264 = lshr i32 %conv, 1
%0 = add nsw i32 %div6264, -3
%1 = zext i32 %0 to i64
%narrow = add nsw i32 %div6264, -2
%2 = zext i32 %narrow to i64
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond4.preheader.preheader, %for.inc23
%indvars.iv57 = phi i64 [ %2, %for.cond4.preheader.preheader ], [ %indvars.iv.next58, %for.inc23 ]
%indvars.iv55 = phi i64 [ %1, %for.cond4.preheader.preheader ], [ %indvars.iv.next56, %for.inc23 ]
br label %for.body8
for.cond4: ; preds = %if.then
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%cmp5 = icmp slt i64 %indvars.iv.next, %indvars.iv57
br i1 %cmp5, label %for.body8, label %for.inc23, !llvm.loop !5
for.body8: ; preds = %for.cond4.preheader, %for.cond4
%indvars.iv = phi i64 [ 0, %for.cond4.preheader ], [ %indvars.iv.next, %for.cond4 ]
%arrayidx = getelementptr inbounds [201 x i8], ptr %s, i64 0, i64 %indvars.iv
%3 = load i8, ptr %arrayidx, align 1, !tbaa !7
%4 = add nsw i64 %indvars.iv, %indvars.iv57
%arrayidx11 = getelementptr inbounds [201 x i8], ptr %s, i64 0, i64 %4
%5 = load i8, ptr %arrayidx11, align 1, !tbaa !7
%cmp13 = icmp eq i8 %3, %5
br i1 %cmp13, label %if.then, label %for.inc23
if.then: ; preds = %for.body8
%exitcond = icmp eq i64 %indvars.iv, %indvars.iv55
br i1 %exitcond, label %if.then17, label %for.cond4
if.then17: ; preds = %if.then
%6 = trunc i64 %indvars.iv57 to i32
%mul = shl nuw nsw i32 %6, 1
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
br label %cleanup28
for.inc23: ; preds = %for.cond4, %for.body8
%indvars.iv.next58 = add nsw i64 %indvars.iv57, -1
%cmp = icmp slt i64 %indvars.iv57, 2
%indvars.iv.next56 = add nsw i64 %indvars.iv55, -1
br i1 %cmp, label %for.end26, label %for.cond4.preheader, !llvm.loop !10
for.end26: ; preds = %for.inc23, %entry
%putchar = call i32 @putchar(i32 50)
br label %cleanup28
cleanup28: ; preds = %if.then17, %for.end26
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = distinct !{!10, !6}
|
#include<stdio.h>
#include<string.h>
char s[401];
int main(void)
{
int sn;
char tmp_s[200];
scanf( "%s", s );
sn = strlen( s );
while(1) {
sn -= 2;
strcpy( tmp_s, s + sn/2 );
if ( strncmp( s, tmp_s, sn / 2 ) == 0 ) break;
}
printf( "%d\n", sn );
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209710/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209710/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@s = dso_local global [401 x i8] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%tmp_s = alloca [200 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %tmp_s) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @s)
%call1 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @s) #6
%conv = trunc i64 %call1 to i32
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%sn.0 = phi i32 [ %conv, %entry ], [ %sub, %while.cond ]
%sub = add nsw i32 %sn.0, -2
%div = sdiv i32 %sub, 2
%idx.ext = sext i32 %div to i64
%add.ptr = getelementptr inbounds i8, ptr @s, i64 %idx.ext
%call2 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %tmp_s, ptr noundef nonnull dereferenceable(1) %add.ptr) #5
%call6 = call i32 @strncmp(ptr noundef nonnull @s, ptr noundef nonnull %tmp_s, i64 noundef %idx.ext) #6
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %while.end, label %while.cond
while.end: ; preds = %while.cond
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %tmp_s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
#include <string.h>
int main(void)
{
char s[200] = {};
int i = 0, len = 0, half = 0, j, count = 0;
scanf("%s", s);
len = strlen(s);
for (i = len - 2; i >= 2;i -= 2){
count = 0;
half = i / 2;
for (j = 0;j < half;j++) {
if (s[j] == s[half + j]) {
count++;
}
}
if (count == half) {
break;
}
}
printf("%d\n", count * 2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209754/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209754/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [200 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %s) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) %s, i8 0, i64 200, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #7
%conv = trunc i64 %call2 to i32
%cmp37 = icmp sgt i32 %conv, 3
br i1 %cmp37, label %for.body.preheader, label %for.end21
for.body.preheader: ; preds = %entry
%0 = add i32 %conv, -2
br label %for.body
for.body: ; preds = %for.body.preheader, %for.end
%indvar = phi i32 [ 0, %for.body.preheader ], [ %indvar.next, %for.end ]
%i.038.in = phi i32 [ %conv, %for.body.preheader ], [ %i.038, %for.end ]
%1 = shl i32 %indvar, 1
%2 = sub i32 %0, %1
%3 = lshr i32 %2, 1
%4 = call i32 @llvm.umax.i32(i32 %3, i32 1)
%umax = zext i32 %4 to i64
%i.038 = add nsw i32 %i.038.in, -2
%div32 = lshr i32 %i.038, 1
%cmp533.not = icmp ult i32 %i.038, 2
br i1 %cmp533.not, label %for.end, label %for.body7.preheader
for.body7.preheader: ; preds = %for.body
%5 = zext i32 %div32 to i64
%min.iters.check = icmp ult i32 %2, 16
br i1 %min.iters.check, label %for.body7.preheader47, label %vector.ph
vector.ph: ; preds = %for.body7.preheader
%n.vec = and i64 %umax, 2147483640
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %15, %vector.body ]
%vec.phi43 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %16, %vector.body ]
%6 = getelementptr inbounds [200 x i8], ptr %s, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %6, align 8, !tbaa !5
%7 = getelementptr inbounds i8, ptr %6, i64 4
%wide.load44 = load <4 x i8>, ptr %7, align 4, !tbaa !5
%8 = add nuw nsw i64 %index, %5
%9 = getelementptr inbounds [200 x i8], ptr %s, i64 0, i64 %8
%wide.load45 = load <4 x i8>, ptr %9, align 1, !tbaa !5
%10 = getelementptr inbounds i8, ptr %9, i64 4
%wide.load46 = load <4 x i8>, ptr %10, align 1, !tbaa !5
%11 = icmp eq <4 x i8> %wide.load, %wide.load45
%12 = icmp eq <4 x i8> %wide.load44, %wide.load46
%13 = zext <4 x i1> %11 to <4 x i32>
%14 = zext <4 x i1> %12 to <4 x i32>
%15 = add <4 x i32> %vec.phi, %13
%16 = add <4 x i32> %vec.phi43, %14
%index.next = add nuw i64 %index, 8
%17 = icmp eq i64 %index.next, %n.vec
br i1 %17, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %16, %15
%18 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %umax
br i1 %cmp.n, label %for.end, label %for.body7.preheader47
for.body7.preheader47: ; preds = %for.body7.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body7.preheader ], [ %n.vec, %middle.block ]
%count.135.ph = phi i32 [ 0, %for.body7.preheader ], [ %18, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader47, %for.body7
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body7 ], [ %indvars.iv.ph, %for.body7.preheader47 ]
%count.135 = phi i32 [ %spec.select, %for.body7 ], [ %count.135.ph, %for.body7.preheader47 ]
%arrayidx = getelementptr inbounds [200 x i8], ptr %s, i64 0, i64 %indvars.iv
%19 = load i8, ptr %arrayidx, align 1, !tbaa !5
%20 = add nuw nsw i64 %indvars.iv, %5
%arrayidx10 = getelementptr inbounds [200 x i8], ptr %s, i64 0, i64 %20
%21 = load i8, ptr %arrayidx10, align 1, !tbaa !5
%cmp12 = icmp eq i8 %19, %21
%inc = zext i1 %cmp12 to i32
%spec.select = add nuw nsw i32 %count.135, %inc
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%cmp5 = icmp ult i64 %indvars.iv.next, %5
br i1 %cmp5, label %for.body7, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body7, %middle.block, %for.body
%count.1.lcssa = phi i32 [ 0, %for.body ], [ %18, %middle.block ], [ %spec.select, %for.body7 ]
%cmp15 = icmp ne i32 %count.1.lcssa, %div32
%cmp = icmp sgt i32 %i.038.in, 5
%or.cond = and i1 %cmp15, %cmp
%indvar.next = add i32 %indvar, 1
br i1 %or.cond, label %for.body, label %for.end21.loopexit, !llvm.loop !13
for.end21.loopexit: ; preds = %for.end
%22 = shl nsw i32 %count.1.lcssa, 1
br label %for.end21
for.end21: ; preds = %for.end21.loopexit, %entry
%count.3 = phi i32 [ 0, %entry ], [ %22, %for.end21.loopexit ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.3)
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %s) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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(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) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
!13 = distinct !{!13, !9}
|
// AOJ Volume 0 Problem 0012
#include <stdio.h>
#include <math.h>
typedef struct {
double x1;
double y1;
double x2;
double y2;
} LINE;
int cross(LINE *l1, LINE *l2)
{
double ta, tb, tc, td;
// ta=(x3-x4)*(y1-y3)+(y3-y4)*(x3-x1)
// tb=(x3-x4)*(y2-y3)+(y3-y4)*(x3-x2)
// tc=(x1-x2)*(y3-y1)+(y1-y2)*(x1-x3)
// td=(x1-x2)*(y4-y1)+(y1-y2)*(x1-x4)
ta = (l2->x1 - l2->x2) * (l1->y1 - l2->y1) + (l2->y1 - l2->y2) * (l2->x1 - l1->x1);
tb = (l2->x1 - l2->x2) * (l1->y2 - l2->y1) + (l2->y1 - l2->y2) * (l2->x1 - l1->x2);
tc = (l1->x1 - l1->x2) * (l2->y1 - l1->y1) + (l1->y1 - l1->y2) * (l1->x1 - l2->x1);
td = (l1->x1 - l1->x2) * (l2->y2 - l1->y1) + (l1->y1 - l1->y2) * (l1->x1 - l2->x2);
if ((ta * tb <= 0) && (tc * td <= 0)){
// printf("[C]");
return (1);
}
// printf("[X]");
return (0);
}
int main(void)
{
double xa, ya, xb, yb, xc, yc, xd, yd;
double xg, yg;
LINE a, b, c, x;
int flag;
int in_flag;
while (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",
&xa, &ya, &xb, &yb, &xc, &yc, &xd, &yd) != EOF){
flag = 0;
xg = (xa + xb + xc) / 3.0;
yg = (ya + yb + yc) / 3.0;
a.x1 = xa;
a.y1 = ya;
a.x2 = xb;
a.y2 = yb;
b.x1 = xb;
b.y1 = yb;
b.x2 = xc;
b.y2 = yc;
c.x1 = xc;
c.y1 = yc;
c.x2 = xa;
c.y2 = ya;
x.x1 = xg;
x.y1 = yg;
x.x2 = xd;
x.y2 = yd;
in_flag = cross(&a, &x);
in_flag += cross(&b, &x);
in_flag += cross(&c, &x);
if (in_flag == 0){
flag = 1;
}
xg = (xa + xb + xd) / 3.0;
yg = (ya + yb + yd) / 3.0;
a.x1 = xa;
a.y1 = ya;
a.x2 = xb;
a.y2 = yb;
b.x1 = xb;
b.y1 = yb;
b.x2 = xd;
b.y2 = yd;
c.x1 = xd;
c.y1 = yd;
c.x2 = xa;
c.y2 = ya;
x.x1 = xg;
x.y1 = yg;
x.x2 = xc;
x.y2 = yc;
in_flag = cross(&a, &x);
in_flag += cross(&b, &x);
in_flag += cross(&c, &x);
if (in_flag == 0){
flag = 1;
}
xg = (xa + xc + xd) / 3.0;
yg = (ya + yc + yd) / 3.0;
a.x1 = xa;
a.y1 = ya;
a.x2 = xc;
a.y2 = yc;
b.x1 = xc;
b.y1 = yc;
b.x2 = xd;
b.y2 = yd;
c.x1 = xd;
c.y1 = yd;
c.x2 = xa;
c.y2 = ya;
x.x1 = xg;
x.y1 = yg;
x.x2 = xb;
x.y2 = yb;
in_flag = cross(&a, &x);
in_flag += cross(&b, &x);
in_flag += cross(&c, &x);
if (in_flag == 0){
flag = 1;
}
xg = (xb + xc + xd) / 3.0;
yg = (yb + yc + yd) / 3.0;
a.x1 = xb;
a.y1 = yb;
a.x2 = xc;
a.y2 = yc;
b.x1 = xc;
b.y1 = yc;
b.x2 = xd;
b.y2 = yd;
c.x1 = xd;
c.y1 = yd;
c.x2 = xb;
c.y2 = yb;
x.x1 = xg;
x.y1 = yg;
x.x2 = xa;
x.y2 = ya;
in_flag = cross(&a, &x);
in_flag += cross(&b, &x);
in_flag += cross(&c, &x);
if (in_flag == 0){
flag = 1;
}
if (flag == 1){
printf("NO\n");
}
else {
printf("YES\n");
}
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209798/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209798/source.c"
target datalayout = "e-m:e-p270: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.LINE = type { double, double, double, double }
@.str = private unnamed_addr constant [32 x i8] c"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf\00", align 1
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cross(ptr nocapture noundef readonly %l1, ptr nocapture noundef readonly %l2) local_unnamed_addr #0 {
entry:
%0 = load double, ptr %l2, align 8, !tbaa !5
%x2 = getelementptr inbounds %struct.LINE, ptr %l2, i64 0, i32 2
%1 = load double, ptr %x2, align 8, !tbaa !10
%sub = fsub double %0, %1
%y11 = getelementptr inbounds %struct.LINE, ptr %l2, i64 0, i32 1
%2 = load double, ptr %y11, align 8, !tbaa !11
%y2 = getelementptr inbounds %struct.LINE, ptr %l2, i64 0, i32 3
%3 = load double, ptr %y2, align 8, !tbaa !12
%sub4 = fsub double %2, %3
%4 = load <2 x double>, ptr %l1, align 8, !tbaa !13
%y212 = getelementptr inbounds %struct.LINE, ptr %l1, i64 0, i32 3
%5 = load double, ptr %y212, align 8, !tbaa !12
%x219 = getelementptr inbounds %struct.LINE, ptr %l1, i64 0, i32 2
%6 = load double, ptr %x219, align 8, !tbaa !10
%7 = shufflevector <2 x double> %4, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%8 = insertelement <2 x double> %7, double %5, i64 1
%9 = insertelement <2 x double> poison, double %2, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = fsub <2 x double> %8, %10
%12 = insertelement <2 x double> poison, double %0, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = insertelement <2 x double> %4, double %6, i64 1
%15 = fsub <2 x double> %13, %14
%16 = insertelement <2 x double> poison, double %sub4, i64 0
%17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer
%18 = fmul <2 x double> %17, %15
%19 = insertelement <2 x double> poison, double %sub, i64 0
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
%21 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %20, <2 x double> %11, <2 x double> %18)
%shift = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%22 = fmul <2 x double> %21, %shift
%mul = extractelement <2 x double> %22, i64 0
%cmp = fcmp ugt double %mul, 0.000000e+00
br i1 %cmp, label %if.end, label %land.lhs.true
land.lhs.true: ; preds = %entry
%23 = extractelement <2 x double> %4, i64 0
%sub24 = fsub double %23, %6
%24 = insertelement <2 x double> %9, double %3, i64 1
%25 = fsub <2 x double> %24, %7
%26 = insertelement <2 x double> poison, double %1, i64 0
%27 = insertelement <2 x double> %26, double %5, i64 1
%28 = fsub <2 x double> %4, %27
%sub33 = fsub double %23, %0
%29 = shufflevector <2 x double> %28, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%30 = insertelement <2 x double> %29, double %sub33, i64 1
%31 = fmul <2 x double> %28, %30
%32 = shufflevector <2 x double> %31, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%33 = insertelement <2 x double> poison, double %sub24, i64 0
%34 = shufflevector <2 x double> %33, <2 x double> poison, <2 x i32> zeroinitializer
%35 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %34, <2 x double> %25, <2 x double> %32)
%shift83 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%36 = fmul <2 x double> %35, %shift83
%mul48 = extractelement <2 x double> %36, i64 0
%cmp49 = fcmp ugt double %mul48, 0.000000e+00
br i1 %cmp49, label %if.end, label %cleanup
if.end: ; preds = %land.lhs.true, %entry
br label %cleanup
cleanup: ; preds = %land.lhs.true, %if.end
%retval.0 = phi i32 [ 0, %if.end ], [ 1, %land.lhs.true ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%xa = alloca double, align 8
%ya = alloca double, align 8
%xb = alloca double, align 8
%yb = alloca double, align 8
%xc = alloca double, align 8
%yc = alloca double, align 8
%xd = alloca double, align 8
%yd = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %xa) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %ya) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %xb) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %yb) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %xc) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %yc) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %xd) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %yd) #7
%call547 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %xa, ptr noundef nonnull %ya, ptr noundef nonnull %xb, ptr noundef nonnull %yb, ptr noundef nonnull %xc, ptr noundef nonnull %yc, ptr noundef nonnull %xd, ptr noundef nonnull %yd)
%cmp.not548 = icmp eq i32 %call547, -1
br i1 %cmp.not548, label %while.end, label %while.body
while.body: ; preds = %entry, %cross.exit465
%0 = load double, ptr %xa, align 8, !tbaa !13
%1 = load double, ptr %xb, align 8, !tbaa !13
%2 = load double, ptr %xc, align 8, !tbaa !13
%3 = load double, ptr %ya, align 8, !tbaa !13
%4 = load double, ptr %yb, align 8, !tbaa !13
%5 = insertelement <2 x double> poison, double %3, i64 0
%6 = insertelement <2 x double> %5, double %0, i64 1
%7 = insertelement <2 x double> poison, double %4, i64 0
%8 = insertelement <2 x double> %7, double %1, i64 1
%9 = fadd <2 x double> %6, %8
%10 = load double, ptr %yc, align 8, !tbaa !13
%11 = load double, ptr %xd, align 8, !tbaa !13
%12 = load double, ptr %yd, align 8, !tbaa !13
%13 = insertelement <2 x double> poison, double %10, i64 0
%14 = insertelement <2 x double> %13, double %2, i64 1
%15 = fadd <2 x double> %9, %14
%16 = fdiv <2 x double> %15, <double 3.000000e+00, double 3.000000e+00>
%17 = extractelement <2 x double> %16, i64 1
%sub.i = fsub double %17, %11
%sub7.i = fsub double %17, %0
%18 = insertelement <2 x double> %5, double %4, i64 1
%19 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer
%20 = fsub <2 x double> %18, %19
%21 = insertelement <2 x double> poison, double %12, i64 0
%22 = insertelement <2 x double> %21, double %1, i64 1
%23 = fsub <2 x double> %16, %22
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> <i32 poison, i32 0>
%25 = insertelement <2 x double> %24, double %sub7.i, i64 0
%26 = fmul <2 x double> %23, %25
%27 = insertelement <2 x double> poison, double %sub.i, i64 0
%28 = shufflevector <2 x double> %27, <2 x double> poison, <2 x i32> zeroinitializer
%29 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %28, <2 x double> %20, <2 x double> %26)
%30 = extractelement <2 x double> %29, i64 0
%31 = extractelement <2 x double> %29, i64 1
%mul.i = fmul double %30, %31
%cmp.i = fcmp ugt double %mul.i, 0.000000e+00
br i1 %cmp.i, label %if.end.i, label %land.lhs.true.i
land.lhs.true.i: ; preds = %while.body
%sub24.i = fsub double %0, %1
%32 = insertelement <2 x double> %16, double %12, i64 1
%33 = shufflevector <2 x double> %5, <2 x double> poison, <2 x i32> zeroinitializer
%34 = fsub <2 x double> %32, %33
%sub30.i = fsub double %3, %4
%35 = insertelement <2 x double> poison, double %0, i64 0
%36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> zeroinitializer
%37 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%38 = insertelement <2 x double> %37, double %11, i64 1
%39 = fsub <2 x double> %36, %38
%40 = insertelement <2 x double> poison, double %sub30.i, i64 0
%41 = shufflevector <2 x double> %40, <2 x double> poison, <2 x i32> zeroinitializer
%42 = fmul <2 x double> %41, %39
%43 = insertelement <2 x double> poison, double %sub24.i, i64 0
%44 = shufflevector <2 x double> %43, <2 x double> poison, <2 x i32> zeroinitializer
%45 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %44, <2 x double> %34, <2 x double> %42)
%shift = shufflevector <2 x double> %45, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%46 = fmul <2 x double> %45, %shift
%mul48.i = extractelement <2 x double> %46, i64 0
%cmp49.i = fcmp ugt double %mul48.i, 0.000000e+00
br i1 %cmp49.i, label %if.end.i, label %cross.exit
if.end.i: ; preds = %land.lhs.true.i, %while.body
br label %cross.exit
cross.exit: ; preds = %land.lhs.true.i, %if.end.i
%retval.0.i = phi i32 [ 0, %if.end.i ], [ 1, %land.lhs.true.i ]
%47 = extractelement <2 x double> %16, i64 0
%sub14.i146 = fsub double %10, %47
%sub20.i148 = fsub double %17, %2
%48 = extractelement <2 x double> %23, i64 0
%mul21.i149 = fmul double %sub20.i148, %48
%49 = call double @llvm.fmuladd.f64(double %sub.i, double %sub14.i146, double %mul21.i149)
%mul.i150 = fmul double %31, %49
%cmp.i151 = fcmp ugt double %mul.i150, 0.000000e+00
br i1 %cmp.i151, label %if.end.i164, label %land.lhs.true.i152
land.lhs.true.i152: ; preds = %cross.exit
%sub24.i153 = fsub double %1, %2
%50 = insertelement <2 x double> %16, double %12, i64 1
%51 = shufflevector <2 x double> %7, <2 x double> poison, <2 x i32> zeroinitializer
%52 = fsub <2 x double> %50, %51
%sub30.i155 = fsub double %4, %10
%53 = insertelement <2 x double> poison, double %1, i64 0
%54 = shufflevector <2 x double> %53, <2 x double> poison, <2 x i32> zeroinitializer
%55 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%56 = insertelement <2 x double> %55, double %11, i64 1
%57 = fsub <2 x double> %54, %56
%58 = insertelement <2 x double> poison, double %sub30.i155, i64 0
%59 = shufflevector <2 x double> %58, <2 x double> poison, <2 x i32> zeroinitializer
%60 = fmul <2 x double> %59, %57
%61 = insertelement <2 x double> poison, double %sub24.i153, i64 0
%62 = shufflevector <2 x double> %61, <2 x double> poison, <2 x i32> zeroinitializer
%63 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %62, <2 x double> %52, <2 x double> %60)
%shift549 = shufflevector <2 x double> %63, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%64 = fmul <2 x double> %63, %shift549
%mul48.i161 = extractelement <2 x double> %64, i64 0
%cmp49.i162 = fcmp ugt double %mul48.i161, 0.000000e+00
br i1 %cmp49.i162, label %if.end.i164, label %cross.exit165
if.end.i164: ; preds = %land.lhs.true.i152, %cross.exit
br label %cross.exit165
cross.exit165: ; preds = %land.lhs.true.i152, %if.end.i164
%retval.0.i163 = phi i32 [ 0, %if.end.i164 ], [ 1, %land.lhs.true.i152 ]
%add19 = add nuw nsw i32 %retval.0.i163, %retval.0.i
%mul.i180 = fmul double %49, %30
%cmp.i181 = fcmp ugt double %mul.i180, 0.000000e+00
br i1 %cmp.i181, label %if.end.i194, label %land.lhs.true.i182
land.lhs.true.i182: ; preds = %cross.exit165
%sub24.i183 = fsub double %2, %0
%65 = insertelement <2 x double> %16, double %12, i64 1
%66 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> zeroinitializer
%67 = fsub <2 x double> %65, %66
%sub30.i185 = fsub double %10, %3
%68 = insertelement <2 x double> poison, double %2, i64 0
%69 = shufflevector <2 x double> %68, <2 x double> poison, <2 x i32> zeroinitializer
%70 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%71 = insertelement <2 x double> %70, double %11, i64 1
%72 = fsub <2 x double> %69, %71
%73 = insertelement <2 x double> poison, double %sub30.i185, i64 0
%74 = shufflevector <2 x double> %73, <2 x double> poison, <2 x i32> zeroinitializer
%75 = fmul <2 x double> %74, %72
%76 = insertelement <2 x double> poison, double %sub24.i183, i64 0
%77 = shufflevector <2 x double> %76, <2 x double> poison, <2 x i32> zeroinitializer
%78 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %77, <2 x double> %67, <2 x double> %75)
%shift550 = shufflevector <2 x double> %78, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%79 = fmul <2 x double> %78, %shift550
%mul48.i191 = extractelement <2 x double> %79, i64 0
%cmp49.i192 = fcmp ugt double %mul48.i191, 0.000000e+00
br i1 %cmp49.i192, label %if.end.i194, label %cross.exit195
if.end.i194: ; preds = %land.lhs.true.i182, %cross.exit165
br label %cross.exit195
cross.exit195: ; preds = %land.lhs.true.i182, %if.end.i194
%retval.0.i193.neg = phi i32 [ 0, %if.end.i194 ], [ -1, %land.lhs.true.i182 ]
%cmp22 = icmp eq i32 %add19, %retval.0.i193.neg
%80 = insertelement <2 x double> %21, double %11, i64 1
%81 = fadd <2 x double> %9, %80
%82 = fdiv <2 x double> %81, <double 3.000000e+00, double 3.000000e+00>
%83 = extractelement <2 x double> %82, i64 1
%sub.i197 = fsub double %83, %2
%sub7.i203 = fsub double %83, %0
%84 = shufflevector <2 x double> %82, <2 x double> poison, <2 x i32> zeroinitializer
%85 = fsub <2 x double> %18, %84
%86 = insertelement <2 x double> %13, double %1, i64 1
%87 = fsub <2 x double> %82, %86
%88 = shufflevector <2 x double> %87, <2 x double> poison, <2 x i32> <i32 poison, i32 0>
%89 = insertelement <2 x double> %88, double %sub7.i203, i64 0
%90 = fmul <2 x double> %87, %89
%91 = insertelement <2 x double> poison, double %sub.i197, i64 0
%92 = shufflevector <2 x double> %91, <2 x double> poison, <2 x i32> zeroinitializer
%93 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %92, <2 x double> %85, <2 x double> %90)
%94 = extractelement <2 x double> %93, i64 0
%95 = extractelement <2 x double> %93, i64 1
%mul.i210 = fmul double %94, %95
%cmp.i211 = fcmp ugt double %mul.i210, 0.000000e+00
br i1 %cmp.i211, label %if.end.i224, label %land.lhs.true.i212
land.lhs.true.i212: ; preds = %cross.exit195
%sub24.i213 = fsub double %0, %1
%96 = shufflevector <2 x double> %13, <2 x double> %82, <2 x i32> <i32 0, i32 2>
%97 = shufflevector <2 x double> %5, <2 x double> poison, <2 x i32> zeroinitializer
%98 = fsub <2 x double> %96, %97
%sub30.i215 = fsub double %3, %4
%99 = insertelement <2 x double> poison, double %0, i64 0
%100 = shufflevector <2 x double> %99, <2 x double> poison, <2 x i32> zeroinitializer
%101 = insertelement <2 x double> %82, double %2, i64 0
%102 = fsub <2 x double> %100, %101
%103 = insertelement <2 x double> poison, double %sub30.i215, i64 0
%104 = shufflevector <2 x double> %103, <2 x double> poison, <2 x i32> zeroinitializer
%105 = fmul <2 x double> %104, %102
%106 = insertelement <2 x double> poison, double %sub24.i213, i64 0
%107 = shufflevector <2 x double> %106, <2 x double> poison, <2 x i32> zeroinitializer
%108 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %107, <2 x double> %98, <2 x double> %105)
%shift551 = shufflevector <2 x double> %108, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%109 = fmul <2 x double> %108, %shift551
%mul48.i221 = extractelement <2 x double> %109, i64 0
%cmp49.i222 = fcmp ugt double %mul48.i221, 0.000000e+00
br i1 %cmp49.i222, label %if.end.i224, label %cross.exit225
if.end.i224: ; preds = %land.lhs.true.i212, %cross.exit195
br label %cross.exit225
cross.exit225: ; preds = %land.lhs.true.i212, %if.end.i224
%retval.0.i223 = phi i32 [ 0, %if.end.i224 ], [ 1, %land.lhs.true.i212 ]
%110 = extractelement <2 x double> %82, i64 0
%sub14.i236 = fsub double %12, %110
%sub20.i238 = fsub double %83, %11
%111 = extractelement <2 x double> %87, i64 0
%mul21.i239 = fmul double %sub20.i238, %111
%112 = call double @llvm.fmuladd.f64(double %sub.i197, double %sub14.i236, double %mul21.i239)
%mul.i240 = fmul double %95, %112
%cmp.i241 = fcmp ugt double %mul.i240, 0.000000e+00
br i1 %cmp.i241, label %if.end.i254, label %land.lhs.true.i242
land.lhs.true.i242: ; preds = %cross.exit225
%sub24.i243 = fsub double %1, %11
%113 = shufflevector <2 x double> %13, <2 x double> %82, <2 x i32> <i32 0, i32 2>
%114 = shufflevector <2 x double> %7, <2 x double> poison, <2 x i32> zeroinitializer
%115 = fsub <2 x double> %113, %114
%sub30.i245 = fsub double %4, %12
%116 = insertelement <2 x double> poison, double %1, i64 0
%117 = shufflevector <2 x double> %116, <2 x double> poison, <2 x i32> zeroinitializer
%118 = insertelement <2 x double> %82, double %2, i64 0
%119 = fsub <2 x double> %117, %118
%120 = insertelement <2 x double> poison, double %sub30.i245, i64 0
%121 = shufflevector <2 x double> %120, <2 x double> poison, <2 x i32> zeroinitializer
%122 = fmul <2 x double> %121, %119
%123 = insertelement <2 x double> poison, double %sub24.i243, i64 0
%124 = shufflevector <2 x double> %123, <2 x double> poison, <2 x i32> zeroinitializer
%125 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %124, <2 x double> %115, <2 x double> %122)
%shift552 = shufflevector <2 x double> %125, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%126 = fmul <2 x double> %125, %shift552
%mul48.i251 = extractelement <2 x double> %126, i64 0
%cmp49.i252 = fcmp ugt double %mul48.i251, 0.000000e+00
br i1 %cmp49.i252, label %if.end.i254, label %cross.exit255
if.end.i254: ; preds = %land.lhs.true.i242, %cross.exit225
br label %cross.exit255
cross.exit255: ; preds = %land.lhs.true.i242, %if.end.i254
%retval.0.i253 = phi i32 [ 0, %if.end.i254 ], [ 1, %land.lhs.true.i242 ]
%add47 = add nuw nsw i32 %retval.0.i253, %retval.0.i223
%mul.i270 = fmul double %112, %94
%cmp.i271 = fcmp ugt double %mul.i270, 0.000000e+00
br i1 %cmp.i271, label %if.end.i284, label %land.lhs.true.i272
land.lhs.true.i272: ; preds = %cross.exit255
%sub24.i273 = fsub double %11, %0
%127 = shufflevector <2 x double> %13, <2 x double> %82, <2 x i32> <i32 0, i32 2>
%128 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%129 = fsub <2 x double> %127, %128
%sub30.i275 = fsub double %12, %3
%130 = insertelement <2 x double> poison, double %11, i64 0
%131 = shufflevector <2 x double> %130, <2 x double> poison, <2 x i32> zeroinitializer
%132 = insertelement <2 x double> %82, double %2, i64 0
%133 = fsub <2 x double> %131, %132
%134 = insertelement <2 x double> poison, double %sub30.i275, i64 0
%135 = shufflevector <2 x double> %134, <2 x double> poison, <2 x i32> zeroinitializer
%136 = fmul <2 x double> %135, %133
%137 = insertelement <2 x double> poison, double %sub24.i273, i64 0
%138 = shufflevector <2 x double> %137, <2 x double> poison, <2 x i32> zeroinitializer
%139 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %138, <2 x double> %129, <2 x double> %136)
%shift553 = shufflevector <2 x double> %139, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%140 = fmul <2 x double> %139, %shift553
%mul48.i281 = extractelement <2 x double> %140, i64 0
%cmp49.i282 = fcmp ugt double %mul48.i281, 0.000000e+00
br i1 %cmp49.i282, label %if.end.i284, label %cross.exit285
if.end.i284: ; preds = %land.lhs.true.i272, %cross.exit255
br label %cross.exit285
cross.exit285: ; preds = %land.lhs.true.i272, %if.end.i284
%retval.0.i283.neg = phi i32 [ 0, %if.end.i284 ], [ -1, %land.lhs.true.i272 ]
%cmp50 = icmp eq i32 %add47, %retval.0.i283.neg
%141 = fadd <2 x double> %6, %14
%142 = fadd <2 x double> %141, %80
%143 = fdiv <2 x double> %142, <double 3.000000e+00, double 3.000000e+00>
%144 = extractelement <2 x double> %143, i64 1
%sub.i287 = fsub double %144, %1
%sub7.i293 = fsub double %144, %0
%145 = insertelement <2 x double> %5, double %10, i64 1
%146 = shufflevector <2 x double> %143, <2 x double> poison, <2 x i32> zeroinitializer
%147 = fsub <2 x double> %145, %146
%148 = insertelement <2 x double> %7, double %2, i64 1
%149 = fsub <2 x double> %143, %148
%150 = shufflevector <2 x double> %149, <2 x double> poison, <2 x i32> <i32 poison, i32 0>
%151 = insertelement <2 x double> %150, double %sub7.i293, i64 0
%152 = fmul <2 x double> %149, %151
%153 = insertelement <2 x double> poison, double %sub.i287, i64 0
%154 = shufflevector <2 x double> %153, <2 x double> poison, <2 x i32> zeroinitializer
%155 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %154, <2 x double> %147, <2 x double> %152)
%156 = extractelement <2 x double> %155, i64 0
%157 = extractelement <2 x double> %155, i64 1
%mul.i300 = fmul double %156, %157
%cmp.i301 = fcmp ugt double %mul.i300, 0.000000e+00
br i1 %cmp.i301, label %if.end.i314, label %land.lhs.true.i302
land.lhs.true.i302: ; preds = %cross.exit285
%sub24.i303 = fsub double %0, %2
%158 = shufflevector <2 x double> %7, <2 x double> %143, <2 x i32> <i32 0, i32 2>
%159 = shufflevector <2 x double> %5, <2 x double> poison, <2 x i32> zeroinitializer
%160 = fsub <2 x double> %158, %159
%sub30.i305 = fsub double %3, %10
%161 = insertelement <2 x double> poison, double %0, i64 0
%162 = shufflevector <2 x double> %161, <2 x double> poison, <2 x i32> zeroinitializer
%163 = insertelement <2 x double> %143, double %1, i64 0
%164 = fsub <2 x double> %162, %163
%165 = insertelement <2 x double> poison, double %sub30.i305, i64 0
%166 = shufflevector <2 x double> %165, <2 x double> poison, <2 x i32> zeroinitializer
%167 = fmul <2 x double> %166, %164
%168 = insertelement <2 x double> poison, double %sub24.i303, i64 0
%169 = shufflevector <2 x double> %168, <2 x double> poison, <2 x i32> zeroinitializer
%170 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %169, <2 x double> %160, <2 x double> %167)
%shift554 = shufflevector <2 x double> %170, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%171 = fmul <2 x double> %170, %shift554
%mul48.i311 = extractelement <2 x double> %171, i64 0
%cmp49.i312 = fcmp ugt double %mul48.i311, 0.000000e+00
br i1 %cmp49.i312, label %if.end.i314, label %cross.exit315
if.end.i314: ; preds = %land.lhs.true.i302, %cross.exit285
br label %cross.exit315
cross.exit315: ; preds = %land.lhs.true.i302, %if.end.i314
%retval.0.i313 = phi i32 [ 0, %if.end.i314 ], [ 1, %land.lhs.true.i302 ]
%172 = extractelement <2 x double> %143, i64 0
%sub14.i326 = fsub double %12, %172
%sub20.i328 = fsub double %144, %11
%173 = extractelement <2 x double> %149, i64 0
%mul21.i329 = fmul double %sub20.i328, %173
%174 = call double @llvm.fmuladd.f64(double %sub.i287, double %sub14.i326, double %mul21.i329)
%mul.i330 = fmul double %157, %174
%cmp.i331 = fcmp ugt double %mul.i330, 0.000000e+00
br i1 %cmp.i331, label %if.end.i344, label %land.lhs.true.i332
land.lhs.true.i332: ; preds = %cross.exit315
%sub24.i333 = fsub double %2, %11
%175 = shufflevector <2 x double> %7, <2 x double> %143, <2 x i32> <i32 0, i32 2>
%176 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> zeroinitializer
%177 = fsub <2 x double> %175, %176
%sub30.i335 = fsub double %10, %12
%178 = insertelement <2 x double> poison, double %2, i64 0
%179 = shufflevector <2 x double> %178, <2 x double> poison, <2 x i32> zeroinitializer
%180 = insertelement <2 x double> %143, double %1, i64 0
%181 = fsub <2 x double> %179, %180
%182 = insertelement <2 x double> poison, double %sub30.i335, i64 0
%183 = shufflevector <2 x double> %182, <2 x double> poison, <2 x i32> zeroinitializer
%184 = fmul <2 x double> %183, %181
%185 = insertelement <2 x double> poison, double %sub24.i333, i64 0
%186 = shufflevector <2 x double> %185, <2 x double> poison, <2 x i32> zeroinitializer
%187 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %186, <2 x double> %177, <2 x double> %184)
%shift555 = shufflevector <2 x double> %187, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%188 = fmul <2 x double> %187, %shift555
%mul48.i341 = extractelement <2 x double> %188, i64 0
%cmp49.i342 = fcmp ugt double %mul48.i341, 0.000000e+00
br i1 %cmp49.i342, label %if.end.i344, label %cross.exit345
if.end.i344: ; preds = %land.lhs.true.i332, %cross.exit315
br label %cross.exit345
cross.exit345: ; preds = %land.lhs.true.i332, %if.end.i344
%retval.0.i343 = phi i32 [ 0, %if.end.i344 ], [ 1, %land.lhs.true.i332 ]
%add77 = add nuw nsw i32 %retval.0.i343, %retval.0.i313
%mul.i360 = fmul double %174, %156
%cmp.i361 = fcmp ugt double %mul.i360, 0.000000e+00
br i1 %cmp.i361, label %if.end.i374, label %land.lhs.true.i362
land.lhs.true.i362: ; preds = %cross.exit345
%sub24.i363 = fsub double %11, %0
%189 = shufflevector <2 x double> %7, <2 x double> %143, <2 x i32> <i32 0, i32 2>
%190 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%191 = fsub <2 x double> %189, %190
%sub30.i365 = fsub double %12, %3
%192 = insertelement <2 x double> poison, double %11, i64 0
%193 = shufflevector <2 x double> %192, <2 x double> poison, <2 x i32> zeroinitializer
%194 = insertelement <2 x double> %143, double %1, i64 0
%195 = fsub <2 x double> %193, %194
%196 = insertelement <2 x double> poison, double %sub30.i365, i64 0
%197 = shufflevector <2 x double> %196, <2 x double> poison, <2 x i32> zeroinitializer
%198 = fmul <2 x double> %197, %195
%199 = insertelement <2 x double> poison, double %sub24.i363, i64 0
%200 = shufflevector <2 x double> %199, <2 x double> poison, <2 x i32> zeroinitializer
%201 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %200, <2 x double> %191, <2 x double> %198)
%shift556 = shufflevector <2 x double> %201, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%202 = fmul <2 x double> %201, %shift556
%mul48.i371 = extractelement <2 x double> %202, i64 0
%cmp49.i372 = fcmp ugt double %mul48.i371, 0.000000e+00
br i1 %cmp49.i372, label %if.end.i374, label %cross.exit375
if.end.i374: ; preds = %land.lhs.true.i362, %cross.exit345
br label %cross.exit375
cross.exit375: ; preds = %land.lhs.true.i362, %if.end.i374
%retval.0.i373.neg = phi i32 [ 0, %if.end.i374 ], [ -1, %land.lhs.true.i362 ]
%cmp80 = icmp eq i32 %add77, %retval.0.i373.neg
%203 = fadd <2 x double> %8, %14
%204 = fadd <2 x double> %203, %80
%205 = fdiv <2 x double> %204, <double 3.000000e+00, double 3.000000e+00>
%206 = extractelement <2 x double> %205, i64 1
%sub.i377 = fsub double %206, %0
%sub7.i383 = fsub double %206, %1
%207 = insertelement <2 x double> %7, double %10, i64 1
%208 = shufflevector <2 x double> %205, <2 x double> poison, <2 x i32> zeroinitializer
%209 = fsub <2 x double> %207, %208
%210 = insertelement <2 x double> %5, double %2, i64 1
%211 = fsub <2 x double> %205, %210
%212 = shufflevector <2 x double> %211, <2 x double> poison, <2 x i32> <i32 poison, i32 0>
%213 = insertelement <2 x double> %212, double %sub7.i383, i64 0
%214 = fmul <2 x double> %211, %213
%215 = insertelement <2 x double> poison, double %sub.i377, i64 0
%216 = shufflevector <2 x double> %215, <2 x double> poison, <2 x i32> zeroinitializer
%217 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %216, <2 x double> %209, <2 x double> %214)
%218 = extractelement <2 x double> %217, i64 0
%219 = extractelement <2 x double> %217, i64 1
%mul.i390 = fmul double %218, %219
%cmp.i391 = fcmp ugt double %mul.i390, 0.000000e+00
br i1 %cmp.i391, label %if.end.i404, label %land.lhs.true.i392
land.lhs.true.i392: ; preds = %cross.exit375
%sub24.i393 = fsub double %1, %2
%220 = shufflevector <2 x double> %5, <2 x double> %205, <2 x i32> <i32 0, i32 2>
%221 = shufflevector <2 x double> %7, <2 x double> poison, <2 x i32> zeroinitializer
%222 = fsub <2 x double> %220, %221
%sub30.i395 = fsub double %4, %10
%223 = insertelement <2 x double> poison, double %1, i64 0
%224 = shufflevector <2 x double> %223, <2 x double> poison, <2 x i32> zeroinitializer
%225 = insertelement <2 x double> %205, double %0, i64 0
%226 = fsub <2 x double> %224, %225
%227 = insertelement <2 x double> poison, double %sub30.i395, i64 0
%228 = shufflevector <2 x double> %227, <2 x double> poison, <2 x i32> zeroinitializer
%229 = fmul <2 x double> %228, %226
%230 = insertelement <2 x double> poison, double %sub24.i393, i64 0
%231 = shufflevector <2 x double> %230, <2 x double> poison, <2 x i32> zeroinitializer
%232 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %231, <2 x double> %222, <2 x double> %229)
%shift557 = shufflevector <2 x double> %232, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%233 = fmul <2 x double> %232, %shift557
%mul48.i401 = extractelement <2 x double> %233, i64 0
%cmp49.i402 = fcmp ugt double %mul48.i401, 0.000000e+00
br i1 %cmp49.i402, label %if.end.i404, label %cross.exit405
if.end.i404: ; preds = %land.lhs.true.i392, %cross.exit375
br label %cross.exit405
cross.exit405: ; preds = %land.lhs.true.i392, %if.end.i404
%retval.0.i403 = phi i32 [ 0, %if.end.i404 ], [ 1, %land.lhs.true.i392 ]
%234 = extractelement <2 x double> %205, i64 0
%sub14.i416 = fsub double %12, %234
%sub20.i418 = fsub double %206, %11
%235 = extractelement <2 x double> %211, i64 0
%mul21.i419 = fmul double %sub20.i418, %235
%236 = call double @llvm.fmuladd.f64(double %sub.i377, double %sub14.i416, double %mul21.i419)
%mul.i420 = fmul double %219, %236
%cmp.i421 = fcmp ugt double %mul.i420, 0.000000e+00
br i1 %cmp.i421, label %if.end.i434, label %land.lhs.true.i422
land.lhs.true.i422: ; preds = %cross.exit405
%sub24.i423 = fsub double %2, %11
%237 = shufflevector <2 x double> %5, <2 x double> %205, <2 x i32> <i32 0, i32 2>
%238 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> zeroinitializer
%239 = fsub <2 x double> %237, %238
%sub30.i425 = fsub double %10, %12
%240 = insertelement <2 x double> poison, double %2, i64 0
%241 = shufflevector <2 x double> %240, <2 x double> poison, <2 x i32> zeroinitializer
%242 = insertelement <2 x double> %205, double %0, i64 0
%243 = fsub <2 x double> %241, %242
%244 = insertelement <2 x double> poison, double %sub30.i425, i64 0
%245 = shufflevector <2 x double> %244, <2 x double> poison, <2 x i32> zeroinitializer
%246 = fmul <2 x double> %245, %243
%247 = insertelement <2 x double> poison, double %sub24.i423, i64 0
%248 = shufflevector <2 x double> %247, <2 x double> poison, <2 x i32> zeroinitializer
%249 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %248, <2 x double> %239, <2 x double> %246)
%shift558 = shufflevector <2 x double> %249, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%250 = fmul <2 x double> %249, %shift558
%mul48.i431 = extractelement <2 x double> %250, i64 0
%cmp49.i432 = fcmp ugt double %mul48.i431, 0.000000e+00
br i1 %cmp49.i432, label %if.end.i434, label %cross.exit435
if.end.i434: ; preds = %land.lhs.true.i422, %cross.exit405
br label %cross.exit435
cross.exit435: ; preds = %land.lhs.true.i422, %if.end.i434
%retval.0.i433 = phi i32 [ 0, %if.end.i434 ], [ 1, %land.lhs.true.i422 ]
%add107 = add nuw nsw i32 %retval.0.i433, %retval.0.i403
%mul.i450 = fmul double %236, %218
%cmp.i451 = fcmp ugt double %mul.i450, 0.000000e+00
br i1 %cmp.i451, label %if.end.i464, label %land.lhs.true.i452
land.lhs.true.i452: ; preds = %cross.exit435
%sub24.i453 = fsub double %11, %1
%251 = shufflevector <2 x double> %5, <2 x double> %205, <2 x i32> <i32 0, i32 2>
%252 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%253 = fsub <2 x double> %251, %252
%sub30.i455 = fsub double %12, %4
%254 = insertelement <2 x double> poison, double %11, i64 0
%255 = shufflevector <2 x double> %254, <2 x double> poison, <2 x i32> zeroinitializer
%256 = insertelement <2 x double> %205, double %0, i64 0
%257 = fsub <2 x double> %255, %256
%258 = insertelement <2 x double> poison, double %sub30.i455, i64 0
%259 = shufflevector <2 x double> %258, <2 x double> poison, <2 x i32> zeroinitializer
%260 = fmul <2 x double> %259, %257
%261 = insertelement <2 x double> poison, double %sub24.i453, i64 0
%262 = shufflevector <2 x double> %261, <2 x double> poison, <2 x i32> zeroinitializer
%263 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %262, <2 x double> %253, <2 x double> %260)
%shift559 = shufflevector <2 x double> %263, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%264 = fmul <2 x double> %263, %shift559
%mul48.i461 = extractelement <2 x double> %264, i64 0
%cmp49.i462 = fcmp ugt double %mul48.i461, 0.000000e+00
br i1 %cmp49.i462, label %if.end.i464, label %cross.exit465
if.end.i464: ; preds = %land.lhs.true.i452, %cross.exit435
br label %cross.exit465
cross.exit465: ; preds = %land.lhs.true.i452, %if.end.i464
%retval.0.i463.neg = phi i32 [ 0, %if.end.i464 ], [ -1, %land.lhs.true.i452 ]
%cmp110 = icmp eq i32 %add107, %retval.0.i463.neg
%265 = select i1 %cmp110, i1 true, i1 %cmp80
%266 = select i1 %265, i1 true, i1 %cmp50
%narrow = select i1 %266, i1 true, i1 %cmp22
%str.3.str = select i1 %narrow, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %xa, ptr noundef nonnull %ya, ptr noundef nonnull %xb, ptr noundef nonnull %yb, ptr noundef nonnull %xc, ptr noundef nonnull %yc, ptr noundef nonnull %xd, ptr noundef nonnull %yd)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %cross.exit465, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %yd) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %xd) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %yc) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %xc) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %yb) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %xb) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %ya) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %xa) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #6
attributes #0 = { mustprogress nofree 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 16}
!11 = !{!6, !7, i64 8}
!12 = !{!6, !7, i64 24}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
long long int a,b,c,d,sum=0;
scanf("%I64d %I64d", &a, &b);
do {
d = a / b;
c = a % b;
a = b;
b = c;
sum = sum + d;
}while(c!=0);
printf("%I64d",sum );
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_20987/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_20987/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%I64d %I64d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%I64d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%a.promoted = load i64, ptr %a, align 8, !tbaa !5
%b.promoted = load i64, ptr %b, align 8, !tbaa !5
br label %do.body
do.body: ; preds = %do.body, %entry
%rem4 = phi i64 [ %b.promoted, %entry ], [ %rem, %do.body ]
%0 = phi i64 [ %a.promoted, %entry ], [ %rem4, %do.body ]
%sum.0 = phi i64 [ 0, %entry ], [ %add, %do.body ]
%div = sdiv i64 %0, %rem4
%rem = srem i64 %0, %rem4
%add = add nsw i64 %div, %sum.0
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %do.end, label %do.body, !llvm.loop !9
do.end: ; preds = %do.body
store i64 %rem4, ptr %a, align 8, !tbaa !5
store i64 0, ptr %b, align 8, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define INIT_CAP 100
typedef struct Stack {
int size;
int capacity;
int *data;
} Stack;
static inline void s_init(Stack* s) {
s->size = 0;
s->capacity = INIT_CAP;
s->data = (int *)malloc(sizeof(int) * s->capacity);
}
static inline void s_double(Stack* s) {
s->capacity *= 2;
s->data = (int *)realloc(s->data, sizeof(int) * s->capacity);
}
static inline void s_free(Stack* s) {
free(s->data);
}
static inline void s_push(Stack* s, int data) {
if (s->size >= s->capacity) {
s_double(s);
}
s->data[s->size++] = data;
}
static inline void s_top(Stack* s) {
if (s->size == 0) {
return;
}
printf("%d\n", s->data[s->size-1]);
}
static inline void s_pop(Stack* s) {
if (s->size == 0) {
return;
}
s->size--;
}
int test() {
int n = 1;
Stack S[n];
for (int i=0; i<n; i++) {
Stack s;
s_init(&s);
S[i] = s;
}
s_pop(&S[0]);
s_push(&S[0], -200);
s_push(&S[0], 10000);
s_top(&S[0]);
s_pop(&S[0]);
s_top(&S[0]);
s_push(&S[0], -600000);
s_top(&S[0]);
s_pop(&S[0]);
s_top(&S[0]);
return 0;
}
int answer() {
int n, q, query, t, x;
char a[20];
fgets(a, 20, stdin);
sscanf(a, "%d %d", &n, &q);
Stack S[n];
for (int i=0; i<n; i++) {
Stack s;
s_init(&s);
S[i] = s;
}
while (q--) {
fgets(a, 20, stdin);
sscanf(a, "%d %d %d", &query, &t, &x);
switch (query) {
case 0:
s_push(&S[t], x);
break;
case 1:
s_top(&S[t]);
break;
case 2:
s_pop(&S[t]);
break;
default:
printf("Invalid query = %d\n", query);
break;
}
}
}
int main(void){
answer();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209912/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209912/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Stack = type { i32, i32, ptr }
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [20 x i8] c"Invalid query = %d\0A\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @test() local_unnamed_addr #0 {
s_push.exit:
%call.i38 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 10000)
%call.i49 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef -200)
%call.i74 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef -600000)
%call.i86 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef -200)
ret i32 0
}
; 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
declare ptr @llvm.stacksave.p0() #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2
; Function Attrs: nounwind uwtable
define dso_local i32 @answer() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%query = alloca i32, align 4
%t = alloca i32, align 4
%x = alloca i32, align 4
%a = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %query) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %a) #7
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %a, i32 noundef 20, ptr noundef %0)
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %a, ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %q) #7
%1 = load i32, ptr %n, align 4, !tbaa !9
%2 = zext i32 %1 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.Stack, i64 %2, align 16
%4 = load i32, ptr %n, align 4, !tbaa !9
%cmp25 = icmp sgt i32 %4, 0
br i1 %cmp25, label %for.body.preheader, label %while.cond.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %4 to i64
br label %for.body
while.cond.preheader: ; preds = %for.body, %entry
%5 = load i32, ptr %q, align 4, !tbaa !9
%dec27 = add nsw i32 %5, -1
store i32 %dec27, ptr %q, align 4, !tbaa !9
%tobool.not28 = icmp eq i32 %5, 0
br i1 %tobool.not28, label %while.end, label %while.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%call.i = call noalias dereferenceable_or_null(400) ptr @malloc(i64 noundef 400) #8
%arrayidx = getelementptr inbounds %struct.Stack, ptr %vla, i64 %indvars.iv
store i32 0, ptr %arrayidx, align 16, !tbaa.struct !11
%s.sroa.4.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 4
store i32 100, ptr %s.sroa.4.0.arrayidx.sroa_idx, align 4, !tbaa.struct !12
%s.sroa.5.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 8
store ptr %call.i, ptr %s.sroa.5.0.arrayidx.sroa_idx, align 8, !tbaa.struct !13
%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 %while.cond.preheader, label %for.body, !llvm.loop !14
while.body: ; preds = %while.cond.preheader, %sw.epilog
%6 = load ptr, ptr @stdin, align 8, !tbaa !5
%call4 = call ptr @fgets(ptr noundef nonnull %a, i32 noundef 20, ptr noundef %6)
%call6 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %a, ptr noundef nonnull @.str.1, ptr noundef nonnull %query, ptr noundef nonnull %t, ptr noundef nonnull %x) #7
%7 = load i32, ptr %query, align 4, !tbaa !9
switch i32 %7, label %sw.default [
i32 0, label %sw.bb
i32 1, label %sw.bb9
i32 2, label %sw.bb12
]
sw.bb: ; preds = %while.body
%8 = load i32, ptr %t, align 4, !tbaa !9
%idxprom7 = sext i32 %8 to i64
%arrayidx8 = getelementptr inbounds %struct.Stack, ptr %vla, i64 %idxprom7
%9 = load i32, ptr %x, align 4, !tbaa !9
%10 = load i32, ptr %arrayidx8, align 16, !tbaa !16
%capacity.i18 = getelementptr inbounds %struct.Stack, ptr %vla, i64 %idxprom7, i32 1
%11 = load i32, ptr %capacity.i18, align 4, !tbaa !18
%cmp.not.i = icmp slt i32 %10, %11
br i1 %cmp.not.i, label %entry.if.end_crit_edge.i, label %if.then.i
entry.if.end_crit_edge.i: ; preds = %sw.bb
%data1.phi.trans.insert.i = getelementptr inbounds %struct.Stack, ptr %vla, i64 %idxprom7, i32 2
%.pre.i = load ptr, ptr %data1.phi.trans.insert.i, align 8, !tbaa !19
br label %s_push.exit
if.then.i: ; preds = %sw.bb
%mul.i.i = shl nsw i32 %11, 1
store i32 %mul.i.i, ptr %capacity.i18, align 4, !tbaa !18
%data.i.i = getelementptr inbounds %struct.Stack, ptr %vla, i64 %idxprom7, i32 2
%12 = load ptr, ptr %data.i.i, align 8, !tbaa !19
%conv.i.i = sext i32 %mul.i.i to i64
%mul2.i.i = shl nsw i64 %conv.i.i, 2
%call.i.i = call ptr @realloc(ptr noundef %12, i64 noundef %mul2.i.i) #9
store ptr %call.i.i, ptr %data.i.i, align 8, !tbaa !19
br label %s_push.exit
s_push.exit: ; preds = %entry.if.end_crit_edge.i, %if.then.i
%13 = phi ptr [ %.pre.i, %entry.if.end_crit_edge.i ], [ %call.i.i, %if.then.i ]
%inc.i = add nsw i32 %10, 1
store i32 %inc.i, ptr %arrayidx8, align 16, !tbaa !16
%idxprom.i = sext i32 %10 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %13, i64 %idxprom.i
store i32 %9, ptr %arrayidx.i, align 4, !tbaa !9
br label %sw.epilog
sw.bb9: ; preds = %while.body
%14 = load i32, ptr %t, align 4, !tbaa !9
%idxprom10 = sext i32 %14 to i64
%arrayidx11 = getelementptr inbounds %struct.Stack, ptr %vla, i64 %idxprom10
%15 = load i32, ptr %arrayidx11, align 16, !tbaa !16
%cmp.i = icmp eq i32 %15, 0
br i1 %cmp.i, label %sw.epilog, label %if.end.i
if.end.i: ; preds = %sw.bb9
%data.i19 = getelementptr inbounds %struct.Stack, ptr %vla, i64 %idxprom10, i32 2
%16 = load ptr, ptr %data.i19, align 8, !tbaa !19
%sub.i = add nsw i32 %15, -1
%idxprom.i20 = sext i32 %sub.i to i64
%arrayidx.i21 = getelementptr inbounds i32, ptr %16, i64 %idxprom.i20
%17 = load i32, ptr %arrayidx.i21, align 4, !tbaa !9
%call.i22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %17)
br label %sw.epilog
sw.bb12: ; preds = %while.body
%18 = load i32, ptr %t, align 4, !tbaa !9
%idxprom13 = sext i32 %18 to i64
%arrayidx14 = getelementptr inbounds %struct.Stack, ptr %vla, i64 %idxprom13
%19 = load i32, ptr %arrayidx14, align 16, !tbaa !16
%cmp.i23 = icmp eq i32 %19, 0
br i1 %cmp.i23, label %sw.epilog, label %if.end.i24
if.end.i24: ; preds = %sw.bb12
%dec.i = add nsw i32 %19, -1
store i32 %dec.i, ptr %arrayidx14, align 16, !tbaa !16
br label %sw.epilog
sw.default: ; preds = %while.body
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
br label %sw.epilog
sw.epilog: ; preds = %if.end.i24, %sw.bb12, %if.end.i, %sw.bb9, %sw.default, %s_push.exit
%20 = load i32, ptr %q, align 4, !tbaa !9
%dec = add nsw i32 %20, -1
store i32 %dec, ptr %q, align 4, !tbaa !9
%tobool.not = icmp eq i32 %20, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !20
while.end: ; preds = %sw.epilog, %while.cond.preheader
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %a) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %query) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 undef
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%call = tail call i32 @answer()
ret i32 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 #5
; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #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 nocallback nofree nosync nounwind willreturn }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind allocsize(1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 8, !5}
!12 = !{i64 0, i64 4, !9, i64 4, i64 8, !5}
!13 = !{i64 0, i64 8, !5}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !10, i64 0}
!17 = !{!"Stack", !10, i64 0, !10, i64 4, !6, i64 8}
!18 = !{!17, !10, i64 4}
!19 = !{!17, !6, i64 8}
!20 = distinct !{!20, !15}
|
#include <stdio.h>
int main(){
char S[50];
int N,K;
scanf("%d %d",&N,&K);
getchar();
scanf("%s",&S);
S[K-1]=S[K-1]+32;
printf("%s",&S);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_209963/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_209963/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [50 x i8], align 16
%N = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %S) #3
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 ptr, ptr @stdin, align 8, !tbaa !5
%call.i = call i32 @getc(ptr noundef %0)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %S)
%1 = load i32, ptr %K, align 4, !tbaa !9
%sub = add nsw i32 %1, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [50 x i8], ptr %S, i64 0, i64 %idxprom
%2 = load i8, ptr %arrayidx, align 1, !tbaa !11
%add = add i8 %2, 32
store i8 %add, ptr %arrayidx, align 1, !tbaa !11
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %S)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %S) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
int main() {
int n, k;
char s[50];
scanf("%d %d", &n, &k);
scanf("%s", s);
s[k - 1] = s[k - 1] + 32;
printf("%s", s);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210011/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210011/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%s = alloca [50 x i8], align 16
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 void @llvm.lifetime.start.p0(i64 50, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%0 = load i32, ptr %k, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [50 x i8], ptr %s, i64 0, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%add = add i8 %1, 32
store i8 %add, ptr %arrayidx, align 1, !tbaa !9
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %s)
call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %s) #3
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"}
!9 = !{!7, !7, i64 0}
|
#include<stdio.h>
int main(void){
int N, K;
char S[100];
scanf("%d%d", &N, &K);
scanf("%s" ,S);
S[K-1]+=32;
printf("%s" ,S);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210062/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210062/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
%S = alloca [100 x i8], align 16
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 void @llvm.lifetime.start.p0(i64 100, ptr nonnull %S) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %S)
%0 = load i32, ptr %K, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [100 x i8], ptr %S, i64 0, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%add = add i8 %1, 32
store i8 %add, ptr %arrayidx, align 1, !tbaa !9
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %S)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %S) #3
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"}
!9 = !{!7, !7, i64 0}
|
#include <stdio.h>
int main(){
int N;
int K;
scanf("%d%d",&N,&K);
char S[50];
scanf("%s",S);
S[K-1]=S[K-1]+32;
printf("%s\n",S);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210105/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210105/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
%S = alloca [50 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %S) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %S)
%0 = load i32, ptr %K, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [50 x i8], ptr %S, i64 0, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%add = add i8 %1, 32
store i8 %add, ptr %arrayidx, align 1, !tbaa !9
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %S)
call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %S) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
|
#include<stdio.h>
int main(void){
int N,K,i;
char S[50];
scanf("%d %d",&N,&K);
scanf("%s",S);
S[K-1] = S[K-1] + 32;
printf("%s",S);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210149/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210149/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
%S = alloca [50 x i8], align 16
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 void @llvm.lifetime.start.p0(i64 50, ptr nonnull %S) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %S)
%0 = load i32, ptr %K, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [50 x i8], ptr %S, i64 0, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%add = add i8 %1, 32
store i8 %add, ptr %arrayidx, align 1, !tbaa !9
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %S)
call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %S) #3
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"}
!9 = !{!7, !7, i64 0}
|
#include <stdio.h>
int main(){
int n,k;
char s[50];
scanf("%d %d",&n,&k);
scanf("%s",s );
s[k-1] = s[k-1] + 32;
printf("%s\n",s );
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210192/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210192/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%s = alloca [50 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%0 = load i32, ptr %k, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [50 x i8], ptr %s, i64 0, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%add = add i8 %1, 32
store i8 %add, ptr %arrayidx, align 1, !tbaa !9
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %s)
call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
|
#include <stdio.h>
int main(void)
{
char S[256];
int N = 0;
int K = 0;
scanf("%d %d",&N,&K);
scanf("%s",&S);
if (S[K - 1] == 'A')
{
S[K - 1] = 'a';
}
if (S[K - 1] == 'B') {
S[K - 1] = 'b';
}
if (S[K - 1] == 'C') {
S[K - 1] = 'c';
}
printf("%s\n",S);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210235/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210235/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [256 x i8], align 16
%N = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %S) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
store i32 0, ptr %N, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
store i32 0, ptr %K, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %S)
%0 = load i32, ptr %K, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [256 x i8], ptr %S, i64 0, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%switch.tableidx = add i8 %1, -65
%2 = icmp ult i8 %switch.tableidx, 3
br i1 %2, label %switch.lookup, label %if.end27
switch.lookup: ; preds = %entry
%switch.offset = add i8 %1, 32
store i8 %switch.offset, ptr %arrayidx, align 1, !tbaa !9
br label %if.end27
if.end27: ; preds = %entry, %switch.lookup
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %S)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 256, 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
|
#include <ctype.h>
#include <stdio.h>
int main()
{
int n, k;
char s[51];
scanf("%d", &n);
scanf("%d", &k);
scanf("%s",s);
s[k - 1] = tolower(s[k - 1]);
printf("%s", s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210286/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210286/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; 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
%s = alloca [51 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 51, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%call3 = tail call ptr @__ctype_tolower_loc() #5
%0 = load ptr, ptr %call3, align 8, !tbaa !5
%1 = load i32, ptr %k, align 4, !tbaa !9
%sub = add nsw i32 %1, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [51 x i8], ptr %s, i64 0, i64 %idxprom
%2 = load i8, ptr %arrayidx, align 1, !tbaa !11
%idxprom4 = sext i8 %2 to i64
%arrayidx5 = getelementptr inbounds i32, ptr %0, i64 %idxprom4
%3 = load i32, ptr %arrayidx5, align 4, !tbaa !9
%conv6 = trunc i32 %3 to i8
store i8 %conv6, ptr %arrayidx, align 1, !tbaa !11
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %s)
call void @llvm.lifetime.end.p0(i64 51, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_tolower_loc() local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
|
#include <stdio.h>
int main()
{
int n,k;
scanf("%d %d", &n, &k);
getchar();
char s[n];
scanf("%s", s);
for ( int i = 0; i < n; i++ ) {
if ( i + 1 != k ) printf("%c", s[i]);
else {
if ( s[i] == 'A' ) printf("a");
else if ( s[i] == 'B' ) printf("b");
else printf("c");
}
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210329/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210329/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = call i32 @getc(ptr noundef %0)
%1 = load i32, ptr %n, align 4, !tbaa !9
%2 = zext i32 %1 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %2, align 16
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla)
%4 = load i32, ptr %n, align 4, !tbaa !9
%cmp34 = icmp sgt i32 %4, 0
br i1 %cmp34, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %k, align 4, !tbaa !9
%6 = zext i32 %5 to i64
%cmp3.not = icmp eq i64 %indvars.iv.next, %6
%arrayidx6 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv
%7 = load i8, ptr %arrayidx6, align 1, !tbaa !11
%conv = sext i8 %7 to i32
%switch.selectcmp = icmp eq i8 %7, 66
%switch.select = select i1 %switch.selectcmp, i32 98, i32 99
%switch.selectcmp37 = icmp eq i8 %7, 65
%switch.select38 = select i1 %switch.selectcmp37, i32 97, i32 %switch.select
%conv.sink = select i1 %cmp3.not, i32 %switch.select38, i32 %conv
%putchar33 = call i32 @putchar(i32 %conv.sink)
%8 = load i32, ptr %n, align 4, !tbaa !9
%9 = sext i32 %8 to i64
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !12
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
char S[50],num;
int N,K;
scanf("%d%d",&N,&K);
scanf("%s",S);
num=S[K-1];
switch(num){
case 'A':
S[K-1]='a';
break;
case 'B':
S[K-1]='b';
break;
case 'C':
S[K-1]='c';
break;
default:
break;
}
printf("%s\n",S);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210372/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210372/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [50 x i8], align 16
%N = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %S) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %S)
%0 = load i32, ptr %K, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [50 x i8], ptr %S, i64 0, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%conv = sext i8 %1 to i32
%switch.tableidx = add nsw i32 %conv, -65
%2 = icmp ult i32 %switch.tableidx, 3
br i1 %2, label %switch.lookup, label %sw.epilog
switch.lookup: ; preds = %entry
%switch.idx.cast = trunc i32 %switch.tableidx to i8
%switch.offset = add nsw i8 %switch.idx.cast, 97
store i8 %switch.offset, ptr %arrayidx, align 1, !tbaa !9
br label %sw.epilog
sw.epilog: ; preds = %entry, %switch.lookup
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %S)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 50, 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
|
#include <stdio.h>
int main(){
int n,k;
scanf("%d%d",&n,&k);
char s[n];
scanf("%s",s);
s[k-1]+=32;
printf("%s",s);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210415/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210415/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %1, align 16
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla)
%3 = load i32, ptr %k, align 4, !tbaa !5
%sub = add nsw i32 %3, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %idxprom
%4 = load i8, ptr %arrayidx, align 1, !tbaa !9
%add = add i8 %4, 32
store i8 %add, ptr %arrayidx, align 1, !tbaa !9
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %vla)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
|
#include <stdio.h>
int main(void) {
int s;
scanf("%d", &s);
long long dp[s];
for (int i = 0; i <= s; i++) {
if (i < 3)
dp[i] = 0;
else if (i == 3)
dp[i] = 1;
else
dp[i] = dp[i - 3] + dp[i - 1];
dp[i] %= 1000000007;
}
printf("%lld\n", dp[s]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210459/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210459/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i32, ptr %s, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %1, align 16
%3 = load i32, ptr %s, align 4, !tbaa !5
%cmp.not29 = icmp sgt i32 %3, -1
call void @llvm.assume(i1 %cmp.not29)
%arrayidx5 = getelementptr inbounds i64, ptr %vla, i64 3
%4 = add nuw i32 %3, 1
%wide.trip.count = zext i32 %4 to i64
store i64 0, ptr %vla, align 16, !tbaa !9
%exitcond.peel.not = icmp eq i32 %3, 0
br i1 %exitcond.peel.not, label %for.cond.cleanup.loopexit, label %if.end14.peel49
if.end14.peel49: ; preds = %entry
%arrayidx16.peel50 = getelementptr inbounds i64, ptr %vla, i64 1
store i64 0, ptr %arrayidx16.peel50, align 8, !tbaa !9
%exitcond.peel53.not = icmp eq i32 %4, 2
br i1 %exitcond.peel53.not, label %for.cond.cleanup.loopexit, label %if.end14.peel69
if.end14.peel69: ; preds = %if.end14.peel49
%arrayidx16.peel70 = getelementptr inbounds i64, ptr %vla, i64 2
store i64 0, ptr %arrayidx16.peel70, align 16, !tbaa !9
%exitcond.peel73.not = icmp eq i32 %4, 3
br i1 %exitcond.peel73.not, label %for.cond.cleanup.loopexit, label %if.end14.peel89
if.end14.peel89: ; preds = %if.end14.peel69
store i64 1, ptr %arrayidx5, align 8, !tbaa !9
%exitcond.peel93.not = icmp eq i32 %4, 4
br i1 %exitcond.peel93.not, label %for.cond.cleanup.loopexit, label %if.end14.lver.check
if.end14.lver.check: ; preds = %if.end14.peel89
%5 = zext i32 %3 to i64
%6 = add nsw i64 %5, -4
%7 = and i64 %6, 4294967295
%8 = icmp eq i64 %7, 4294967295
%9 = trunc i64 %6 to i32
%10 = icmp ugt i32 %9, -4
%11 = icmp ugt i64 %6, 4294967295
%12 = or i1 %10, %11
%13 = or i1 %8, %12
br i1 %13, label %if.end14.lver.orig, label %if.end14.ph
if.end14.lver.orig: ; preds = %if.end14.lver.check, %if.end14.lver.orig
%indvars.iv.lver.orig = phi i64 [ %indvars.iv.next.lver.orig, %if.end14.lver.orig ], [ 4, %if.end14.lver.check ]
%14 = add nuw i64 %indvars.iv.lver.orig, 4294967293
%idxprom7.lver.orig = and i64 %14, 4294967295
%arrayidx8.lver.orig = getelementptr inbounds i64, ptr %vla, i64 %idxprom7.lver.orig
%15 = load i64, ptr %arrayidx8.lver.orig, align 8, !tbaa !9
%16 = add nuw i64 %indvars.iv.lver.orig, 4294967295
%idxprom10.lver.orig = and i64 %16, 4294967295
%arrayidx11.lver.orig = getelementptr inbounds i64, ptr %vla, i64 %idxprom10.lver.orig
%17 = load i64, ptr %arrayidx11.lver.orig, align 8, !tbaa !9
%add.lver.orig = add nsw i64 %17, %15
%arrayidx16.lver.orig = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv.lver.orig
%rem.lver.orig = srem i64 %add.lver.orig, 1000000007
store i64 %rem.lver.orig, ptr %arrayidx16.lver.orig, align 8, !tbaa !9
%indvars.iv.next.lver.orig = add nuw nsw i64 %indvars.iv.lver.orig, 1
%exitcond.not.lver.orig = icmp eq i64 %indvars.iv.next.lver.orig, %wide.trip.count
br i1 %exitcond.not.lver.orig, label %for.cond.cleanup.loopexit, label %if.end14.lver.orig, !llvm.loop !11
if.end14.ph: ; preds = %if.end14.lver.check
%scevgep = getelementptr i8, ptr %vla, i64 24
%load_initial = load i64, ptr %scevgep, align 8
%18 = add nsw i64 %5, -3
%xtraiter = and i64 %18, 1
%19 = icmp eq i64 %6, 0
br i1 %19, label %for.cond.cleanup.loopexit.loopexit97.unr-lcssa, label %if.end14.ph.new
if.end14.ph.new: ; preds = %if.end14.ph
%unroll_iter = and i64 %18, -2
br label %if.end14
for.cond.cleanup.loopexit.loopexit97.unr-lcssa: ; preds = %if.end14, %if.end14.ph
%store_forwarded.unr = phi i64 [ %load_initial, %if.end14.ph ], [ %rem.1, %if.end14 ]
%indvars.iv.unr = phi i64 [ 4, %if.end14.ph ], [ %indvars.iv.next.1, %if.end14 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup.loopexit, label %if.end14.epil
if.end14.epil: ; preds = %for.cond.cleanup.loopexit.loopexit97.unr-lcssa
%20 = add nuw i64 %indvars.iv.unr, 4294967293
%idxprom7.epil = and i64 %20, 4294967295
%arrayidx8.epil = getelementptr inbounds i64, ptr %vla, i64 %idxprom7.epil
%21 = load i64, ptr %arrayidx8.epil, align 8, !tbaa !9
%add.epil = add nsw i64 %store_forwarded.unr, %21
%arrayidx16.epil = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv.unr
%rem.epil = srem i64 %add.epil, 1000000007
store i64 %rem.epil, ptr %arrayidx16.epil, align 8, !tbaa !9
br label %for.cond.cleanup.loopexit
for.cond.cleanup.loopexit: ; preds = %if.end14.epil, %for.cond.cleanup.loopexit.loopexit97.unr-lcssa, %if.end14.lver.orig, %if.end14.peel89, %if.end14.peel69, %if.end14.peel49, %entry
%idxprom17.phi.trans.insert = zext i32 %3 to i64
%arrayidx18.phi.trans.insert = getelementptr inbounds i64, ptr %vla, i64 %idxprom17.phi.trans.insert
%.pre = load i64, ptr %arrayidx18.phi.trans.insert, align 8, !tbaa !9
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %.pre)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #5
ret i32 0
if.end14: ; preds = %if.end14, %if.end14.ph.new
%store_forwarded = phi i64 [ %load_initial, %if.end14.ph.new ], [ %rem.1, %if.end14 ]
%indvars.iv = phi i64 [ 4, %if.end14.ph.new ], [ %indvars.iv.next.1, %if.end14 ]
%niter = phi i64 [ 0, %if.end14.ph.new ], [ %niter.next.1, %if.end14 ]
%22 = add nuw i64 %indvars.iv, 4294967293
%idxprom7 = and i64 %22, 4294967295
%arrayidx8 = getelementptr inbounds i64, ptr %vla, i64 %idxprom7
%23 = load i64, ptr %arrayidx8, align 8, !tbaa !9
%add = add nsw i64 %store_forwarded, %23
%arrayidx16 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%rem = srem i64 %add, 1000000007
store i64 %rem, ptr %arrayidx16, align 16, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%24 = add nuw i64 %indvars.iv, 4294967294
%idxprom7.1 = and i64 %24, 4294967294
%arrayidx8.1 = getelementptr inbounds i64, ptr %vla, i64 %idxprom7.1
%25 = load i64, ptr %arrayidx8.1, align 16, !tbaa !9
%add.1 = add nsw i64 %rem, %25
%arrayidx16.1 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv.next
%rem.1 = srem i64 %add.1, 1000000007
store i64 %rem.1, ptr %arrayidx16.1, align 8, !tbaa !9
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup.loopexit.loopexit97.unr-lcssa, label %if.end14, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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, !13}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.peeled.count", i32 4}
|
#include<stdio.h>
#define Double double
#define Int int
#define For for
#define Scanf scanf
#define If if
#define Printf printf
#define Roop(i,n) for(i=0;i<n;i++)
#define Roop2(i,n) for(i=1;i<=n;i++)
#define Roop3(i,n) for(i=2;i<=n;i++)
Double dp[101][101],x[101][101];
int main(){
Int i,j,k,n,m;
Double max=0.0;
while( scanf("%d%d",&n,&m),n+m){
Roop(i,n)
Roop(j,n)
Scanf("%lf",&x[i][j]);
Roop2(i,m)
Roop(j,n)
dp[i][j]=(double)(i==1);
Roop3(i,m)
Roop(j,n)
Roop(k,n)
If(dp[i][j]<dp[i-1][k]*x[k][j])
dp[i][j]=dp[i-1][k]*x[k][j];
max=0.0;
Roop(i,n)if(max<dp[m][i])max=dp[m][i];
Printf("%.2lf\n",max);}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210501/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210501/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf\00", align 1
@x = dso_local global [101 x [101 x double]] zeroinitializer, align 16
@dp = dso_local local_unnamed_addr global [101 x [101 x double]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [7 x i8] c"%.2lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
%call151 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = load i32, ptr %m, align 4, !tbaa !5
%add152 = sub i32 0, %1
%tobool.not153 = icmp eq i32 %0, %add152
br i1 %tobool.not153, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end95
%2 = phi i32 [ %30, %for.end95 ], [ %1, %entry ]
%3 = phi i32 [ %29, %for.end95 ], [ %0, %entry ]
%cmp133 = icmp sgt i32 %3, 0
br i1 %cmp133, label %for.cond1.preheader, label %for.cond10.preheader
for.cond10.preheader.loopexit: ; preds = %for.inc7
%.pre = load i32, ptr %m, align 4, !tbaa !5
br label %for.cond10.preheader
for.cond10.preheader: ; preds = %for.cond10.preheader.loopexit, %for.cond.preheader
%4 = phi i32 [ %2, %for.cond.preheader ], [ %.pre, %for.cond10.preheader.loopexit ]
%.lcssa = phi i32 [ %3, %for.cond.preheader ], [ %12, %for.cond10.preheader.loopexit ]
%cmp11.not137 = icmp slt i32 %4, 1
br i1 %cmp11.not137, label %for.cond77.preheader, label %for.cond13.preheader.lr.ph
for.cond13.preheader.lr.ph: ; preds = %for.cond10.preheader
%cmp14135 = icmp sgt i32 %.lcssa, 0
br i1 %cmp14135, label %for.cond13.preheader.us.preheader, label %for.cond28.preheader
for.cond13.preheader.us.preheader: ; preds = %for.cond13.preheader.lr.ph
%5 = add nuw i32 %4, 1
%wide.trip.count168 = zext i32 %5 to i64
%wide.trip.count = zext i32 %.lcssa to i64
%min.iters.check = icmp ult i32 %.lcssa, 4
%n.vec = and i64 %wide.trip.count, 4294967292
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.cond13.preheader.us
for.cond13.preheader.us: ; preds = %for.cond13.preheader.us.preheader, %for.cond13.for.inc25_crit_edge.us
%indvars.iv165 = phi i64 [ 1, %for.cond13.preheader.us.preheader ], [ %indvars.iv.next166, %for.cond13.for.inc25_crit_edge.us ]
%cmp16.us = icmp eq i64 %indvars.iv165, 1
%conv17.us = uitofp i1 %cmp16.us to double
br i1 %min.iters.check, label %for.body15.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond13.preheader.us
%broadcast.splatinsert = insertelement <2 x double> poison, double %conv17.us, i64 0
%broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> 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 ]
%6 = getelementptr inbounds [101 x [101 x double]], ptr @dp, i64 0, i64 %indvars.iv165, i64 %index
store <2 x double> %broadcast.splat, ptr %6, align 8, !tbaa !9
%7 = getelementptr inbounds double, ptr %6, i64 2
store <2 x double> %broadcast.splat, ptr %7, align 8, !tbaa !9
%index.next = add nuw i64 %index, 4
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond13.for.inc25_crit_edge.us, label %for.body15.us.preheader
for.body15.us.preheader: ; preds = %for.cond13.preheader.us, %middle.block
%indvars.iv162.ph = phi i64 [ 0, %for.cond13.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body15.us
for.body15.us: ; preds = %for.body15.us.preheader, %for.body15.us
%indvars.iv162 = phi i64 [ %indvars.iv.next163, %for.body15.us ], [ %indvars.iv162.ph, %for.body15.us.preheader ]
%arrayidx21.us = getelementptr inbounds [101 x [101 x double]], ptr @dp, i64 0, i64 %indvars.iv165, i64 %indvars.iv162
store double %conv17.us, ptr %arrayidx21.us, align 8, !tbaa !9
%indvars.iv.next163 = add nuw nsw i64 %indvars.iv162, 1
%exitcond.not = icmp eq i64 %indvars.iv.next163, %wide.trip.count
br i1 %exitcond.not, label %for.cond13.for.inc25_crit_edge.us, label %for.body15.us, !llvm.loop !15
for.cond13.for.inc25_crit_edge.us: ; preds = %for.body15.us, %middle.block
%indvars.iv.next166 = add nuw nsw i64 %indvars.iv165, 1
%exitcond169.not = icmp eq i64 %indvars.iv.next166, %wide.trip.count168
br i1 %exitcond169.not, label %for.cond28.preheader, label %for.cond13.preheader.us, !llvm.loop !16
for.cond1.preheader: ; preds = %for.cond.preheader, %for.inc7
%9 = phi i32 [ %12, %for.inc7 ], [ %3, %for.cond.preheader ]
%indvars.iv159 = phi i64 [ %indvars.iv.next160, %for.inc7 ], [ 0, %for.cond.preheader ]
%cmp2131 = icmp sgt i32 %9, 0
br i1 %cmp2131, label %for.body3, label %for.cond1.preheader.for.inc7_crit_edge
for.cond1.preheader.for.inc7_crit_edge: ; preds = %for.cond1.preheader
%.pre191 = sext i32 %9 to i64
br label %for.inc7
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 0, %for.cond1.preheader ]
%arrayidx5 = getelementptr inbounds [101 x [101 x double]], ptr @x, i64 0, i64 %indvars.iv159, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %11
br i1 %cmp2, label %for.body3, label %for.inc7, !llvm.loop !17
for.inc7: ; preds = %for.body3, %for.cond1.preheader.for.inc7_crit_edge
%.pre-phi = phi i64 [ %.pre191, %for.cond1.preheader.for.inc7_crit_edge ], [ %11, %for.body3 ]
%12 = phi i32 [ %9, %for.cond1.preheader.for.inc7_crit_edge ], [ %10, %for.body3 ]
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%cmp = icmp slt i64 %indvars.iv.next160, %.pre-phi
br i1 %cmp, label %for.cond1.preheader, label %for.cond10.preheader.loopexit, !llvm.loop !18
for.cond28.preheader: ; preds = %for.cond13.for.inc25_crit_edge.us, %for.cond13.preheader.lr.ph
%cmp29.not145 = icmp slt i32 %4, 2
br i1 %cmp29.not145, label %for.cond77.preheader, label %for.cond32.preheader.lr.ph
for.cond32.preheader.lr.ph: ; preds = %for.cond28.preheader
%cmp33143 = icmp sgt i32 %.lcssa, 0
br i1 %cmp33143, label %for.cond32.preheader.us.preheader, label %for.end95
for.cond32.preheader.us.preheader: ; preds = %for.cond32.preheader.lr.ph
%13 = add nuw i32 %4, 1
%wide.trip.count184 = zext i32 %13 to i64
%wide.trip.count178 = zext i32 %.lcssa to i64
%xtraiter = and i64 %wide.trip.count178, 1
%14 = icmp eq i32 %.lcssa, 1
%unroll_iter = and i64 %wide.trip.count178, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond32.preheader.us
for.cond32.preheader.us: ; preds = %for.cond32.preheader.us.preheader, %for.cond32.for.inc74_crit_edge.split.us.us
%indvars.iv180 = phi i64 [ 2, %for.cond32.preheader.us.preheader ], [ %indvars.iv.next181, %for.cond32.for.inc74_crit_edge.split.us.us ]
%15 = add nsw i64 %indvars.iv180, -1
br label %for.cond36.preheader.us.us
for.cond36.preheader.us.us: ; preds = %for.cond36.for.inc71_crit_edge.us.us, %for.cond32.preheader.us
%indvars.iv175 = phi i64 [ %indvars.iv.next176, %for.cond36.for.inc71_crit_edge.us.us ], [ 0, %for.cond32.preheader.us ]
%arrayidx43.us.us = getelementptr inbounds [101 x [101 x double]], ptr @dp, i64 0, i64 %indvars.iv180, i64 %indvars.iv175
%arrayidx43.promoted.us.us = load double, ptr %arrayidx43.us.us, align 8, !tbaa !9
br i1 %14, label %for.cond36.for.inc71_crit_edge.us.us.unr-lcssa, label %for.body39.us.us
for.body39.us.us: ; preds = %for.cond36.preheader.us.us, %for.inc68.us.us.1
%indvars.iv170 = phi i64 [ %indvars.iv.next171.1, %for.inc68.us.us.1 ], [ 0, %for.cond36.preheader.us.us ]
%16 = phi double [ %22, %for.inc68.us.us.1 ], [ %arrayidx43.promoted.us.us, %for.cond36.preheader.us.us ]
%niter = phi i64 [ %niter.next.1, %for.inc68.us.us.1 ], [ 0, %for.cond36.preheader.us.us ]
%arrayidx47.us.us = getelementptr inbounds [101 x [101 x double]], ptr @dp, i64 0, i64 %15, i64 %indvars.iv170
%17 = load double, ptr %arrayidx47.us.us, align 8, !tbaa !9
%arrayidx51.us.us = getelementptr inbounds [101 x [101 x double]], ptr @x, i64 0, i64 %indvars.iv170, i64 %indvars.iv175
%18 = load double, ptr %arrayidx51.us.us, align 8, !tbaa !9
%mul.us.us = fmul double %17, %18
%cmp52.us.us = fcmp olt double %16, %mul.us.us
br i1 %cmp52.us.us, label %if.then.us.us, label %for.inc68.us.us
if.then.us.us: ; preds = %for.body39.us.us
store double %mul.us.us, ptr %arrayidx43.us.us, align 8, !tbaa !9
br label %for.inc68.us.us
for.inc68.us.us: ; preds = %if.then.us.us, %for.body39.us.us
%19 = phi double [ %16, %for.body39.us.us ], [ %mul.us.us, %if.then.us.us ]
%indvars.iv.next171 = or i64 %indvars.iv170, 1
%arrayidx47.us.us.1 = getelementptr inbounds [101 x [101 x double]], ptr @dp, i64 0, i64 %15, i64 %indvars.iv.next171
%20 = load double, ptr %arrayidx47.us.us.1, align 8, !tbaa !9
%arrayidx51.us.us.1 = getelementptr inbounds [101 x [101 x double]], ptr @x, i64 0, i64 %indvars.iv.next171, i64 %indvars.iv175
%21 = load double, ptr %arrayidx51.us.us.1, align 8, !tbaa !9
%mul.us.us.1 = fmul double %20, %21
%cmp52.us.us.1 = fcmp olt double %19, %mul.us.us.1
br i1 %cmp52.us.us.1, label %if.then.us.us.1, label %for.inc68.us.us.1
if.then.us.us.1: ; preds = %for.inc68.us.us
store double %mul.us.us.1, ptr %arrayidx43.us.us, align 8, !tbaa !9
br label %for.inc68.us.us.1
for.inc68.us.us.1: ; preds = %if.then.us.us.1, %for.inc68.us.us
%22 = phi double [ %19, %for.inc68.us.us ], [ %mul.us.us.1, %if.then.us.us.1 ]
%indvars.iv.next171.1 = add nuw nsw i64 %indvars.iv170, 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.cond36.for.inc71_crit_edge.us.us.unr-lcssa, label %for.body39.us.us, !llvm.loop !20
for.cond36.for.inc71_crit_edge.us.us.unr-lcssa: ; preds = %for.inc68.us.us.1, %for.cond36.preheader.us.us
%indvars.iv170.unr = phi i64 [ 0, %for.cond36.preheader.us.us ], [ %indvars.iv.next171.1, %for.inc68.us.us.1 ]
%.unr = phi double [ %arrayidx43.promoted.us.us, %for.cond36.preheader.us.us ], [ %22, %for.inc68.us.us.1 ]
br i1 %lcmp.mod.not, label %for.cond36.for.inc71_crit_edge.us.us, label %for.body39.us.us.epil
for.body39.us.us.epil: ; preds = %for.cond36.for.inc71_crit_edge.us.us.unr-lcssa
%arrayidx47.us.us.epil = getelementptr inbounds [101 x [101 x double]], ptr @dp, i64 0, i64 %15, i64 %indvars.iv170.unr
%23 = load double, ptr %arrayidx47.us.us.epil, align 8, !tbaa !9
%arrayidx51.us.us.epil = getelementptr inbounds [101 x [101 x double]], ptr @x, i64 0, i64 %indvars.iv170.unr, i64 %indvars.iv175
%24 = load double, ptr %arrayidx51.us.us.epil, align 8, !tbaa !9
%mul.us.us.epil = fmul double %23, %24
%cmp52.us.us.epil = fcmp olt double %.unr, %mul.us.us.epil
br i1 %cmp52.us.us.epil, label %if.then.us.us.epil, label %for.cond36.for.inc71_crit_edge.us.us
if.then.us.us.epil: ; preds = %for.body39.us.us.epil
store double %mul.us.us.epil, ptr %arrayidx43.us.us, align 8, !tbaa !9
br label %for.cond36.for.inc71_crit_edge.us.us
for.cond36.for.inc71_crit_edge.us.us: ; preds = %for.body39.us.us.epil, %if.then.us.us.epil, %for.cond36.for.inc71_crit_edge.us.us.unr-lcssa
%indvars.iv.next176 = add nuw nsw i64 %indvars.iv175, 1
%exitcond179.not = icmp eq i64 %indvars.iv.next176, %wide.trip.count178
br i1 %exitcond179.not, label %for.cond32.for.inc74_crit_edge.split.us.us, label %for.cond36.preheader.us.us, !llvm.loop !21
for.cond32.for.inc74_crit_edge.split.us.us: ; preds = %for.cond36.for.inc71_crit_edge.us.us
%indvars.iv.next181 = add nuw nsw i64 %indvars.iv180, 1
%exitcond185.not = icmp eq i64 %indvars.iv.next181, %wide.trip.count184
br i1 %exitcond185.not, label %for.cond77.preheader, label %for.cond32.preheader.us, !llvm.loop !22
for.cond77.preheader: ; preds = %for.cond32.for.inc74_crit_edge.split.us.us, %for.cond10.preheader, %for.cond28.preheader
%cmp78147 = icmp sgt i32 %.lcssa, 0
br i1 %cmp78147, label %for.body80.lr.ph, label %for.end95
for.body80.lr.ph: ; preds = %for.cond77.preheader
%idxprom81 = sext i32 %4 to i64
%wide.trip.count189 = zext i32 %.lcssa to i64
%xtraiter203 = and i64 %wide.trip.count189, 1
%25 = icmp eq i32 %.lcssa, 1
br i1 %25, label %for.end95.loopexit.unr-lcssa, label %for.body80.lr.ph.new
for.body80.lr.ph.new: ; preds = %for.body80.lr.ph
%unroll_iter206 = and i64 %wide.trip.count189, 4294967294
br label %for.body80
for.body80: ; preds = %for.body80, %for.body80.lr.ph.new
%indvars.iv186 = phi i64 [ 0, %for.body80.lr.ph.new ], [ %indvars.iv.next187.1, %for.body80 ]
%max.0149 = phi double [ 0.000000e+00, %for.body80.lr.ph.new ], [ %max.1.1, %for.body80 ]
%niter207 = phi i64 [ 0, %for.body80.lr.ph.new ], [ %niter207.next.1, %for.body80 ]
%arrayidx84 = getelementptr inbounds [101 x [101 x double]], ptr @dp, i64 0, i64 %idxprom81, i64 %indvars.iv186
%26 = load double, ptr %arrayidx84, align 8, !tbaa !9
%cmp85 = fcmp olt double %max.0149, %26
%max.1 = select i1 %cmp85, double %26, double %max.0149
%indvars.iv.next187 = or i64 %indvars.iv186, 1
%arrayidx84.1 = getelementptr inbounds [101 x [101 x double]], ptr @dp, i64 0, i64 %idxprom81, i64 %indvars.iv.next187
%27 = load double, ptr %arrayidx84.1, align 8, !tbaa !9
%cmp85.1 = fcmp olt double %max.1, %27
%max.1.1 = select i1 %cmp85.1, double %27, double %max.1
%indvars.iv.next187.1 = add nuw nsw i64 %indvars.iv186, 2
%niter207.next.1 = add i64 %niter207, 2
%niter207.ncmp.1 = icmp eq i64 %niter207.next.1, %unroll_iter206
br i1 %niter207.ncmp.1, label %for.end95.loopexit.unr-lcssa, label %for.body80, !llvm.loop !23
for.end95.loopexit.unr-lcssa: ; preds = %for.body80, %for.body80.lr.ph
%max.1.lcssa.ph = phi double [ undef, %for.body80.lr.ph ], [ %max.1.1, %for.body80 ]
%indvars.iv186.unr = phi i64 [ 0, %for.body80.lr.ph ], [ %indvars.iv.next187.1, %for.body80 ]
%max.0149.unr = phi double [ 0.000000e+00, %for.body80.lr.ph ], [ %max.1.1, %for.body80 ]
%lcmp.mod204.not = icmp eq i64 %xtraiter203, 0
br i1 %lcmp.mod204.not, label %for.end95, label %for.body80.epil
for.body80.epil: ; preds = %for.end95.loopexit.unr-lcssa
%arrayidx84.epil = getelementptr inbounds [101 x [101 x double]], ptr @dp, i64 0, i64 %idxprom81, i64 %indvars.iv186.unr
%28 = load double, ptr %arrayidx84.epil, align 8, !tbaa !9
%cmp85.epil = fcmp olt double %max.0149.unr, %28
%max.1.epil = select i1 %cmp85.epil, double %28, double %max.0149.unr
br label %for.end95
for.end95: ; preds = %for.body80.epil, %for.end95.loopexit.unr-lcssa, %for.cond32.preheader.lr.ph, %for.cond77.preheader
%max.0.lcssa = phi double [ 0.000000e+00, %for.cond77.preheader ], [ 0.000000e+00, %for.cond32.preheader.lr.ph ], [ %max.1.lcssa.ph, %for.end95.loopexit.unr-lcssa ], [ %max.1.epil, %for.body80.epil ]
%call96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %max.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%29 = load i32, ptr %n, align 4, !tbaa !5
%30 = load i32, ptr %m, align 4, !tbaa !5
%add = sub i32 0, %30
%tobool.not = icmp eq i32 %29, %add
br i1 %tobool.not, label %while.end, label %for.cond.preheader, !llvm.loop !24
while.end: ; preds = %for.end95, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!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 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12, !19}
!19 = !{!"llvm.loop.unswitch.partial.disable"}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}
|
#include<stdio.h>
#include<string.h>
int main(void) {
int i, j;
int h, w;
scanf("%d", &h);
scanf("%d", &w);
char s[100][100][100];
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
scanf("%s", s[i][j]);
}
}
int ansh;
char answ;
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
if (!strcmp(s[i][j], "snuke")) {
answ = j + 0x41;
ansh = i + 1;
goto UNKO;
}
}
}
UNKO:
printf("%c%d\n", answ, ansh);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210552/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210552/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"snuke\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%s = alloca [100 x [100 x [100 x i8]]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %s) #5
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp47 = icmp sgt i32 %0, 0
%.pre67 = load i32, ptr %w, align 4, !tbaa !5
br i1 %cmp47, label %for.cond2.preheader.lr.ph, label %for.cond11.preheader
for.cond2.preheader.lr.ph: ; preds = %entry
%1 = icmp sgt i32 %.pre67, 0
call void @llvm.assume(i1 %1)
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond2.preheader.lr.ph, %for.inc8
%2 = phi i32 [ %8, %for.inc8 ], [ %0, %for.cond2.preheader.lr.ph ]
%3 = phi i32 [ %9, %for.inc8 ], [ %.pre67, %for.cond2.preheader.lr.ph ]
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.inc8 ], [ 0, %for.cond2.preheader.lr.ph ]
%cmp345 = icmp sgt i32 %3, 0
br i1 %cmp345, label %for.body4, label %for.inc8
for.cond11.preheader: ; preds = %for.inc8, %entry
%4 = phi i32 [ %.pre67, %entry ], [ %9, %for.inc8 ]
%.lcssa = phi i32 [ %0, %entry ], [ %8, %for.inc8 ]
%cmp1549 = icmp sgt i32 %4, 0
call void @llvm.assume(i1 %cmp1549)
%5 = sext i32 %.lcssa to i64
%wide.trip.count = zext i32 %4 to i64
br label %for.cond11.us
for.cond11.us: ; preds = %for.cond11.preheader, %for.cond14.for.inc27_crit_edge.us
%indvars.iv64 = phi i64 [ 0, %for.cond11.preheader ], [ %indvars.iv.next65, %for.cond14.for.inc27_crit_edge.us ]
%cmp12.us = icmp slt i64 %indvars.iv64, %5
call void @llvm.assume(i1 %cmp12.us)
br label %for.body16.us
for.body16.us: ; preds = %for.cond11.us, %for.inc24.us
%indvars.iv61 = phi i64 [ 0, %for.cond11.us ], [ %indvars.iv.next62, %for.inc24.us ]
%arrayidx20.us = getelementptr inbounds [100 x [100 x [100 x i8]]], ptr %s, i64 0, i64 %indvars.iv64, i64 %indvars.iv61
%call22.us = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx20.us, ptr noundef nonnull dereferenceable(6) @.str.2) #6
%tobool.not.us = icmp eq i32 %call22.us, 0
br i1 %tobool.not.us, label %if.then, label %for.inc24.us
for.inc24.us: ; preds = %for.body16.us
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%exitcond.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count
br i1 %exitcond.not, label %for.cond14.for.inc27_crit_edge.us, label %for.body16.us, !llvm.loop !9
for.cond14.for.inc27_crit_edge.us: ; preds = %for.inc24.us
%indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
br label %for.cond11.us, !llvm.loop !11
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100 x [100 x [100 x i8]]], ptr %s, i64 0, i64 %indvars.iv58, i64 %indvars.iv
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %w, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp3, label %for.body4, label %for.inc8.loopexit, !llvm.loop !12
for.inc8.loopexit: ; preds = %for.body4
%.pre = load i32, ptr %h, align 4, !tbaa !5
br label %for.inc8
for.inc8: ; preds = %for.inc8.loopexit, %for.cond2.preheader
%8 = phi i32 [ %.pre, %for.inc8.loopexit ], [ %2, %for.cond2.preheader ]
%9 = phi i32 [ %6, %for.inc8.loopexit ], [ %3, %for.cond2.preheader ]
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%10 = sext i32 %8 to i64
%cmp = icmp slt i64 %indvars.iv.next59, %10
br i1 %cmp, label %for.cond2.preheader, label %for.cond11.preheader, !llvm.loop !13
if.then: ; preds = %for.body16.us
%11 = trunc i64 %indvars.iv64 to i32
%12 = trunc i64 %indvars.iv61 to i32
%add23 = add nuw nsw i32 %11, 1
%conv = shl i32 %12, 24
%sext = add i32 %conv, 1090519040
%13 = ashr exact i32 %sext, 24
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %13, i32 noundef %add23)
call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
|
/* ex 5_4
supercomputerjoi */
#include <stdio.h>
int main(void){
char str[11];
int len = 0, maxLen = 0;
int i;
// input S
scanf("%s", str);
// calculate max length
for(i = 0; i < 11; i++){
// if ATGC len + 1
if(str[i] == 'A' || str[i] == 'T' || str[i] == 'G' || str[i] == 'C'){
len++;
}else{
if(len > maxLen){
maxLen = len;
}
len = 0;
if(str[i] == '\0'){
break;
}
}
}
// output answer
printf("%d\n", maxLen);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210602/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210602/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %str) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load i8, ptr %str, align 1, !tbaa !5
switch i8 %0, label %for.inc.fold.split [
i8 65, label %for.inc
i8 84, label %for.inc
i8 71, label %for.inc
i8 67, label %for.inc
i8 0, label %for.end
]
for.inc.fold.split: ; preds = %entry
br label %for.inc
for.inc: ; preds = %entry, %entry, %entry, %entry, %for.inc.fold.split
%len.1 = phi i32 [ 1, %entry ], [ 1, %entry ], [ 1, %entry ], [ 1, %entry ], [ 0, %for.inc.fold.split ]
%arrayidx.1 = getelementptr inbounds [11 x i8], ptr %str, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %1, label %for.inc.1 [
i8 65, label %if.then.1
i8 84, label %if.then.1
i8 71, label %if.then.1
i8 67, label %if.then.1
i8 0, label %for.end
]
if.then.1: ; preds = %for.inc, %for.inc, %for.inc, %for.inc
%inc.1 = add nuw nsw i32 %len.1, 1
br label %for.inc.1
for.inc.1: ; preds = %for.inc, %if.then.1
%len.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ 0, %for.inc ]
%maxLen.2.1 = phi i32 [ 0, %if.then.1 ], [ %len.1, %for.inc ]
%arrayidx.2 = getelementptr inbounds [11 x i8], ptr %str, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
switch i8 %2, label %if.else.2 [
i8 65, label %if.then.2
i8 84, label %if.then.2
i8 71, label %if.then.2
i8 67, label %if.then.2
]
if.then.2: ; preds = %for.inc.1, %for.inc.1, %for.inc.1, %for.inc.1
%inc.2 = add nuw nsw i32 %len.1.1, 1
br label %for.inc.2
if.else.2: ; preds = %for.inc.1
%spec.select.2 = call i32 @llvm.smax.i32(i32 %len.1.1, i32 %maxLen.2.1)
%cmp26.2 = icmp eq i8 %2, 0
br i1 %cmp26.2, label %for.end, label %for.inc.2
for.inc.2: ; preds = %if.else.2, %if.then.2
%len.1.2 = phi i32 [ %inc.2, %if.then.2 ], [ 0, %if.else.2 ]
%maxLen.2.2 = phi i32 [ %maxLen.2.1, %if.then.2 ], [ %spec.select.2, %if.else.2 ]
%arrayidx.3 = getelementptr inbounds [11 x i8], ptr %str, i64 0, i64 3
%3 = load i8, ptr %arrayidx.3, align 1, !tbaa !5
switch i8 %3, label %if.else.3 [
i8 65, label %if.then.3
i8 84, label %if.then.3
i8 71, label %if.then.3
i8 67, label %if.then.3
]
if.then.3: ; preds = %for.inc.2, %for.inc.2, %for.inc.2, %for.inc.2
%inc.3 = add nuw nsw i32 %len.1.2, 1
br label %for.inc.3
if.else.3: ; preds = %for.inc.2
%spec.select.3 = call i32 @llvm.smax.i32(i32 %len.1.2, i32 %maxLen.2.2)
%cmp26.3 = icmp eq i8 %3, 0
br i1 %cmp26.3, label %for.end, label %for.inc.3
for.inc.3: ; preds = %if.else.3, %if.then.3
%len.1.3 = phi i32 [ %inc.3, %if.then.3 ], [ 0, %if.else.3 ]
%maxLen.2.3 = phi i32 [ %maxLen.2.2, %if.then.3 ], [ %spec.select.3, %if.else.3 ]
%arrayidx.4 = getelementptr inbounds [11 x i8], ptr %str, i64 0, i64 4
%4 = load i8, ptr %arrayidx.4, align 1, !tbaa !5
switch i8 %4, label %if.else.4 [
i8 65, label %if.then.4
i8 84, label %if.then.4
i8 71, label %if.then.4
i8 67, label %if.then.4
]
if.then.4: ; preds = %for.inc.3, %for.inc.3, %for.inc.3, %for.inc.3
%inc.4 = add nuw nsw i32 %len.1.3, 1
br label %for.inc.4
if.else.4: ; preds = %for.inc.3
%spec.select.4 = call i32 @llvm.smax.i32(i32 %len.1.3, i32 %maxLen.2.3)
%cmp26.4 = icmp eq i8 %4, 0
br i1 %cmp26.4, label %for.end, label %for.inc.4
for.inc.4: ; preds = %if.else.4, %if.then.4
%len.1.4 = phi i32 [ %inc.4, %if.then.4 ], [ 0, %if.else.4 ]
%maxLen.2.4 = phi i32 [ %maxLen.2.3, %if.then.4 ], [ %spec.select.4, %if.else.4 ]
%arrayidx.5 = getelementptr inbounds [11 x i8], ptr %str, i64 0, i64 5
%5 = load i8, ptr %arrayidx.5, align 1, !tbaa !5
switch i8 %5, label %if.else.5 [
i8 65, label %if.then.5
i8 84, label %if.then.5
i8 71, label %if.then.5
i8 67, label %if.then.5
]
if.then.5: ; preds = %for.inc.4, %for.inc.4, %for.inc.4, %for.inc.4
%inc.5 = add nuw nsw i32 %len.1.4, 1
br label %for.inc.5
if.else.5: ; preds = %for.inc.4
%spec.select.5 = call i32 @llvm.smax.i32(i32 %len.1.4, i32 %maxLen.2.4)
%cmp26.5 = icmp eq i8 %5, 0
br i1 %cmp26.5, label %for.end, label %for.inc.5
for.inc.5: ; preds = %if.else.5, %if.then.5
%len.1.5 = phi i32 [ %inc.5, %if.then.5 ], [ 0, %if.else.5 ]
%maxLen.2.5 = phi i32 [ %maxLen.2.4, %if.then.5 ], [ %spec.select.5, %if.else.5 ]
%arrayidx.6 = getelementptr inbounds [11 x i8], ptr %str, i64 0, i64 6
%6 = load i8, ptr %arrayidx.6, align 1, !tbaa !5
switch i8 %6, label %if.else.6 [
i8 65, label %if.then.6
i8 84, label %if.then.6
i8 71, label %if.then.6
i8 67, label %if.then.6
]
if.then.6: ; preds = %for.inc.5, %for.inc.5, %for.inc.5, %for.inc.5
%inc.6 = add nuw nsw i32 %len.1.5, 1
br label %for.inc.6
if.else.6: ; preds = %for.inc.5
%spec.select.6 = call i32 @llvm.smax.i32(i32 %len.1.5, i32 %maxLen.2.5)
%cmp26.6 = icmp eq i8 %6, 0
br i1 %cmp26.6, label %for.end, label %for.inc.6
for.inc.6: ; preds = %if.else.6, %if.then.6
%len.1.6 = phi i32 [ %inc.6, %if.then.6 ], [ 0, %if.else.6 ]
%maxLen.2.6 = phi i32 [ %maxLen.2.5, %if.then.6 ], [ %spec.select.6, %if.else.6 ]
%arrayidx.7 = getelementptr inbounds [11 x i8], ptr %str, i64 0, i64 7
%7 = load i8, ptr %arrayidx.7, align 1, !tbaa !5
switch i8 %7, label %if.else.7 [
i8 65, label %if.then.7
i8 84, label %if.then.7
i8 71, label %if.then.7
i8 67, label %if.then.7
]
if.then.7: ; preds = %for.inc.6, %for.inc.6, %for.inc.6, %for.inc.6
%inc.7 = add nuw nsw i32 %len.1.6, 1
br label %for.inc.7
if.else.7: ; preds = %for.inc.6
%spec.select.7 = call i32 @llvm.smax.i32(i32 %len.1.6, i32 %maxLen.2.6)
%cmp26.7 = icmp eq i8 %7, 0
br i1 %cmp26.7, label %for.end, label %for.inc.7
for.inc.7: ; preds = %if.else.7, %if.then.7
%len.1.7 = phi i32 [ %inc.7, %if.then.7 ], [ 0, %if.else.7 ]
%maxLen.2.7 = phi i32 [ %maxLen.2.6, %if.then.7 ], [ %spec.select.7, %if.else.7 ]
%arrayidx.8 = getelementptr inbounds [11 x i8], ptr %str, i64 0, i64 8
%8 = load i8, ptr %arrayidx.8, align 1, !tbaa !5
switch i8 %8, label %if.else.8 [
i8 65, label %if.then.8
i8 84, label %if.then.8
i8 71, label %if.then.8
i8 67, label %if.then.8
]
if.then.8: ; preds = %for.inc.7, %for.inc.7, %for.inc.7, %for.inc.7
%inc.8 = add nuw nsw i32 %len.1.7, 1
br label %for.inc.8
if.else.8: ; preds = %for.inc.7
%spec.select.8 = call i32 @llvm.smax.i32(i32 %len.1.7, i32 %maxLen.2.7)
%cmp26.8 = icmp eq i8 %8, 0
br i1 %cmp26.8, label %for.end, label %for.inc.8
for.inc.8: ; preds = %if.else.8, %if.then.8
%len.1.8 = phi i32 [ %inc.8, %if.then.8 ], [ 0, %if.else.8 ]
%maxLen.2.8 = phi i32 [ %maxLen.2.7, %if.then.8 ], [ %spec.select.8, %if.else.8 ]
%arrayidx.9 = getelementptr inbounds [11 x i8], ptr %str, i64 0, i64 9
%9 = load i8, ptr %arrayidx.9, align 1, !tbaa !5
switch i8 %9, label %if.else.9 [
i8 65, label %if.then.9
i8 84, label %if.then.9
i8 71, label %if.then.9
i8 67, label %if.then.9
]
if.then.9: ; preds = %for.inc.8, %for.inc.8, %for.inc.8, %for.inc.8
%inc.9 = add nuw nsw i32 %len.1.8, 1
br label %for.inc.9
if.else.9: ; preds = %for.inc.8
%spec.select.9 = call i32 @llvm.smax.i32(i32 %len.1.8, i32 %maxLen.2.8)
%cmp26.9 = icmp eq i8 %9, 0
br i1 %cmp26.9, label %for.end, label %for.inc.9
for.inc.9: ; preds = %if.else.9, %if.then.9
%len.1.9 = phi i32 [ %inc.9, %if.then.9 ], [ 0, %if.else.9 ]
%maxLen.2.9 = phi i32 [ %maxLen.2.8, %if.then.9 ], [ %spec.select.9, %if.else.9 ]
%arrayidx.10 = getelementptr inbounds [11 x i8], ptr %str, i64 0, i64 10
%10 = load i8, ptr %arrayidx.10, align 1, !tbaa !5
switch i8 %10, label %if.else.10 [
i8 65, label %for.end
i8 84, label %for.end
i8 71, label %for.end
i8 67, label %for.end
]
if.else.10: ; preds = %for.inc.9
%spec.select.10 = call i32 @llvm.smax.i32(i32 %len.1.9, i32 %maxLen.2.9)
br label %for.end
for.end: ; preds = %for.inc, %entry, %if.else.10, %for.inc.9, %for.inc.9, %for.inc.9, %for.inc.9, %if.else.9, %if.else.8, %if.else.7, %if.else.6, %if.else.5, %if.else.4, %if.else.3, %if.else.2
%maxLen.3 = phi i32 [ %spec.select.2, %if.else.2 ], [ %spec.select.3, %if.else.3 ], [ %spec.select.4, %if.else.4 ], [ %spec.select.5, %if.else.5 ], [ %spec.select.6, %if.else.6 ], [ %spec.select.7, %if.else.7 ], [ %spec.select.8, %if.else.8 ], [ %spec.select.9, %if.else.9 ], [ %spec.select.10, %if.else.10 ], [ %maxLen.2.9, %for.inc.9 ], [ %maxLen.2.9, %for.inc.9 ], [ %maxLen.2.9, %for.inc.9 ], [ %maxLen.2.9, %for.inc.9 ], [ 0, %entry ], [ %len.1, %for.inc ]
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %maxLen.3)
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
/* ex2-4
kas056*/
#include<stdio.h>
#define SIZE 15
int main(void){
char sentence[SIZE];
char *p;
int length = 0;
int maxlen = 0;
scanf("%s", sentence);
p = sentence;//ポインタを連結
//ヌル文字に到達するまで操作を行う
while(*p){
//該当する文字があったらカウント開始。
if(*p == 'A' || *p == 'C' || *p == 'G' || *p == 'T'){
length++;
}
else{//該当するものが続かなければ、カウントをリセットする。
length = 0;
}
if(length > maxlen){
maxlen = length;//最高記録を超えたら更新
}
p++;//次の文字に進む
}
printf("%d", maxlen);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210646/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210646/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%sentence = alloca [15 x i8], align 1
call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %sentence) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sentence)
br label %while.cond
while.cond: ; preds = %if.end, %entry
%p.0 = phi ptr [ %sentence, %entry ], [ %incdec.ptr, %if.end ]
%length.0 = phi i32 [ 0, %entry ], [ %length.1, %if.end ]
%maxlen.0 = phi i32 [ 0, %entry ], [ %spec.select, %if.end ]
%0 = load i8, ptr %p.0, align 1, !tbaa !5
switch i8 %0, label %if.end [
i8 0, label %while.end
i8 65, label %if.then
i8 67, label %if.then
i8 71, label %if.then
i8 84, label %if.then
]
if.then: ; preds = %while.cond, %while.cond, %while.cond, %while.cond
%inc = add nsw i32 %length.0, 1
br label %if.end
if.end: ; preds = %while.cond, %if.then
%length.1 = phi i32 [ %inc, %if.then ], [ 0, %while.cond ]
%spec.select = call i32 @llvm.smax.i32(i32 %length.1, i32 %maxlen.0)
%incdec.ptr = getelementptr inbounds i8, ptr %p.0, i64 1
br label %while.cond, !llvm.loop !8
while.end: ; preds = %while.cond
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %maxlen.0)
call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %sentence) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int n,x,y,ans=0,i,dol=0;
scanf("%d",&n);
x=0;
for(i=1;i<=n;i++)
{
scanf("%d",&y);
ans+=x-y;
if(ans<0)
{
dol+=(-ans);
ans=0;
}
x=y;
}
printf("%d",dol);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21069/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21069/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not11 = icmp slt i32 %0, 1
br i1 %cmp.not11, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%dol.015 = phi i32 [ %spec.select10, %for.body ], [ 0, %entry ]
%i.014 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%ans.013 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%x.012 = phi i32 [ %1, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %y)
%1 = load i32, ptr %y, align 4, !tbaa !5
%sub = sub nsw i32 %x.012, %1
%add = add nsw i32 %sub, %ans.013
%spec.select = call i32 @llvm.smax.i32(i32 %add, i32 0)
%add4 = call i32 @llvm.smin.i32(i32 %add, i32 0)
%spec.select10 = sub i32 %dol.015, %add4
%inc = add nuw nsw i32 %i.014, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.014, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%dol.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select10, %for.body ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %dol.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
#define ll long long int
int cont(char *s,char *res)
{
int count = 0;
int max = 0;
for (int i = 0; i<strlen(s); i++)
{
for (int j=0; j<strlen(res); j++)
{
if (s[i]==res[j])
{
count++;
if (max<count)
max=count;
break;
}
else if (s[i]!=res[j] && j==strlen(res)-1)
{
count = 0;
}
}
}
return max;
}
int main()
{
char res[4]= "ACGT";
char s[11]= {'\0'};
scanf("%s",&s);
int max = 0;
printf("%d",cont(s,res));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210732/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210732/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i32 @cont(ptr nocapture noundef readonly %s, ptr nocapture noundef readonly %res) local_unnamed_addr #0 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%cmp61.not = icmp eq i64 %call, 0
br i1 %cmp61.not, label %for.cond.cleanup, label %for.cond2.preheader.lr.ph
for.cond2.preheader.lr.ph: ; preds = %entry
%call4 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %res) #6
%cmp557.not = icmp eq i64 %call4, 0
%sub = add i64 %call4, -1
br i1 %cmp557.not, label %for.cond.cleanup, label %for.cond2.preheader.us
for.cond2.preheader.us: ; preds = %for.cond2.preheader.lr.ph, %cleanup.us
%indvars.iv70 = phi i64 [ %indvars.iv.next71, %cleanup.us ], [ 0, %for.cond2.preheader.lr.ph ]
%max.063.us = phi i32 [ %max.2.us, %cleanup.us ], [ 0, %for.cond2.preheader.lr.ph ]
%count.062.us = phi i32 [ %count.3.us, %cleanup.us ], [ 0, %for.cond2.preheader.lr.ph ]
%arrayidx.us = getelementptr inbounds i8, ptr %s, i64 %indvars.iv70
%0 = load i8, ptr %arrayidx.us, align 1, !tbaa !5
br label %for.body8.us
for.body8.us: ; preds = %for.cond2.preheader.us, %land.lhs.true.us
%indvars.iv = phi i64 [ 0, %for.cond2.preheader.us ], [ %indvars.iv.next, %land.lhs.true.us ]
%count.158.us = phi i32 [ %count.062.us, %for.cond2.preheader.us ], [ %spec.select55.us, %land.lhs.true.us ]
%arrayidx11.us = getelementptr inbounds i8, ptr %res, i64 %indvars.iv
%1 = load i8, ptr %arrayidx11.us, align 1, !tbaa !5
%cmp13.us = icmp eq i8 %0, %1
br i1 %cmp13.us, label %if.then.us, label %land.lhs.true.us
land.lhs.true.us: ; preds = %for.body8.us
%cmp28.us = icmp eq i64 %sub, %indvars.iv
%spec.select55.us = select i1 %cmp28.us, i32 0, i32 %count.158.us
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %call4
br i1 %exitcond.not, label %cleanup.us, label %for.body8.us, !llvm.loop !8
if.then.us: ; preds = %for.body8.us
%inc.us = add nsw i32 %count.158.us, 1
%cmp15.not.us = icmp sgt i32 %max.063.us, %count.158.us
%spec.select.us = select i1 %cmp15.not.us, i32 %max.063.us, i32 %inc.us
br label %cleanup.us
cleanup.us: ; preds = %land.lhs.true.us, %if.then.us
%count.3.us = phi i32 [ %inc.us, %if.then.us ], [ %spec.select55.us, %land.lhs.true.us ]
%max.2.us = phi i32 [ %spec.select.us, %if.then.us ], [ %max.063.us, %land.lhs.true.us ]
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
%exitcond73.not = icmp eq i64 %indvars.iv.next71, %call
br i1 %exitcond73.not, label %for.cond.cleanup, label %for.cond2.preheader.us, !llvm.loop !10
for.cond.cleanup: ; preds = %cleanup.us, %for.cond2.preheader.lr.ph, %entry
%max.0.lcssa = phi i32 [ 0, %entry ], [ 0, %for.cond2.preheader.lr.ph ], [ %max.2.us, %cleanup.us ]
ret i32 %max.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture 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 i32 @main() local_unnamed_addr #3 {
entry:
%res = alloca [4 x i8], align 4
%s = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %res) #7
store i32 1413956417, ptr %res, align 4
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %s) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(11) %s, i8 0, i64 11, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%cmp61.not.i = icmp eq i64 %call.i, 0
br i1 %cmp61.not.i, label %cont.exit, label %for.cond2.preheader.lr.ph.i
for.cond2.preheader.lr.ph.i: ; preds = %entry
%call4.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %res) #6
%cmp557.not.i = icmp eq i64 %call4.i, 0
%sub.i = add i64 %call4.i, -1
br i1 %cmp557.not.i, label %cont.exit, label %for.cond2.preheader.us.i
for.cond2.preheader.us.i: ; preds = %for.cond2.preheader.lr.ph.i, %cleanup.us.i
%indvars.iv70.i = phi i64 [ %indvars.iv.next71.i, %cleanup.us.i ], [ 0, %for.cond2.preheader.lr.ph.i ]
%max.063.us.i = phi i32 [ %max.2.us.i, %cleanup.us.i ], [ 0, %for.cond2.preheader.lr.ph.i ]
%count.062.us.i = phi i32 [ %count.3.us.i, %cleanup.us.i ], [ 0, %for.cond2.preheader.lr.ph.i ]
%arrayidx.us.i = getelementptr inbounds i8, ptr %s, i64 %indvars.iv70.i
%0 = load i8, ptr %arrayidx.us.i, align 1, !tbaa !5
br label %for.body8.us.i
for.body8.us.i: ; preds = %land.lhs.true.us.i, %for.cond2.preheader.us.i
%indvars.iv.i = phi i64 [ 0, %for.cond2.preheader.us.i ], [ %indvars.iv.next.i, %land.lhs.true.us.i ]
%count.158.us.i = phi i32 [ %count.062.us.i, %for.cond2.preheader.us.i ], [ %spec.select55.us.i, %land.lhs.true.us.i ]
%arrayidx11.us.i = getelementptr inbounds i8, ptr %res, i64 %indvars.iv.i
%1 = load i8, ptr %arrayidx11.us.i, align 1, !tbaa !5
%cmp13.us.i = icmp eq i8 %0, %1
br i1 %cmp13.us.i, label %if.then.us.i, label %land.lhs.true.us.i
land.lhs.true.us.i: ; preds = %for.body8.us.i
%cmp28.us.i = icmp eq i64 %sub.i, %indvars.iv.i
%spec.select55.us.i = select i1 %cmp28.us.i, i32 0, i32 %count.158.us.i
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %call4.i
br i1 %exitcond.not.i, label %cleanup.us.i, label %for.body8.us.i, !llvm.loop !8
if.then.us.i: ; preds = %for.body8.us.i
%inc.us.i = add nsw i32 %count.158.us.i, 1
%cmp15.not.us.i = icmp sgt i32 %max.063.us.i, %count.158.us.i
%spec.select.us.i = select i1 %cmp15.not.us.i, i32 %max.063.us.i, i32 %inc.us.i
br label %cleanup.us.i
cleanup.us.i: ; preds = %land.lhs.true.us.i, %if.then.us.i
%count.3.us.i = phi i32 [ %inc.us.i, %if.then.us.i ], [ %spec.select55.us.i, %land.lhs.true.us.i ]
%max.2.us.i = phi i32 [ %spec.select.us.i, %if.then.us.i ], [ %max.063.us.i, %land.lhs.true.us.i ]
%indvars.iv.next71.i = add nuw nsw i64 %indvars.iv70.i, 1
%exitcond73.not.i = icmp eq i64 %indvars.iv.next71.i, %call.i
br i1 %exitcond73.not.i, label %cont.exit, label %for.cond2.preheader.us.i, !llvm.loop !10
cont.exit: ; preds = %cleanup.us.i, %entry, %for.cond2.preheader.lr.ph.i
%max.0.lcssa.i = phi i32 [ 0, %entry ], [ 0, %for.cond2.preheader.lr.ph.i ], [ %max.2.us.i, %cleanup.us.i ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa.i)
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %s) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %res) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
attributes #0 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind willreturn memory(read) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#include <stdio.h>
#include <string.h>
int main(void) {
char S[10];
scanf("%s", S);
int m;
int n = 0;
for (int i = 0; i < strlen(S); i++) {
m = 0;
if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
m++;
for (int j = i + 1; j < strlen(S); j++) {
if (S[j] == 'A' || S[j] == 'C' || S[j] == 'G' || S[j] == 'T') {
m++;
} else {
break;
}
}
}
if (n < m) {
n = m;
}
}
printf("%d\n", n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210776/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210776/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %S) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %S) #6
%cmp93.not = icmp eq i64 %call2, 0
br i1 %cmp93.not, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = trunc i64 %call2 to i32
br label %for.body
for.cond.cleanup: ; preds = %if.end58, %entry
%n.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %if.end58 ]
%call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %n.0.lcssa)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %S) #5
ret i32 0
for.body: ; preds = %for.body.preheader, %if.end58
%indvars.iv103 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next104.pre-phi, %if.end58 ]
%indvars.iv100 = phi i32 [ %0, %for.body.preheader ], [ %indvars.iv.next101, %if.end58 ]
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %if.end58 ]
%n.094 = phi i32 [ 0, %for.body.preheader ], [ %spec.select, %if.end58 ]
%arrayidx = getelementptr inbounds [10 x i8], ptr %S, i64 0, i64 %indvars.iv103
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %for.body.if.end58_crit_edge [
i8 65, label %if.then
i8 67, label %if.then
i8 71, label %if.then
i8 84, label %if.then
]
for.body.if.end58_crit_edge: ; preds = %for.body
%.pre = add nuw nsw i64 %indvars.iv103, 1
br label %if.end58
if.then: ; preds = %for.body, %for.body, %for.body, %for.body
%2 = add nuw nsw i64 %indvars.iv103, 1
%cmp2888 = icmp ugt i64 %call2, %2
br i1 %cmp2888, label %for.body31, label %if.end58
for.body31: ; preds = %if.then, %if.then55
%indvars.iv98 = phi i64 [ %indvars.iv.next99, %if.then55 ], [ %indvars.iv, %if.then ]
%m.089 = phi i32 [ %inc56, %if.then55 ], [ 1, %if.then ]
%arrayidx33 = getelementptr inbounds [10 x i8], ptr %S, i64 0, i64 %indvars.iv98
%3 = load i8, ptr %arrayidx33, align 1, !tbaa !5
switch i8 %3, label %if.end58 [
i8 65, label %if.then55
i8 67, label %if.then55
i8 71, label %if.then55
i8 84, label %if.then55
]
if.then55: ; preds = %for.body31, %for.body31, %for.body31, %for.body31
%inc56 = add nuw nsw i32 %m.089, 1
%indvars.iv.next99 = add nuw i64 %indvars.iv98, 1
%cmp28 = icmp ugt i64 %call2, %indvars.iv.next99
br i1 %cmp28, label %for.body31, label %if.end58, !llvm.loop !8
if.end58: ; preds = %for.body31, %if.then55, %for.body.if.end58_crit_edge, %if.then
%indvars.iv.next104.pre-phi = phi i64 [ %.pre, %for.body.if.end58_crit_edge ], [ %2, %if.then ], [ %2, %if.then55 ], [ %2, %for.body31 ]
%m.1 = phi i32 [ 0, %for.body.if.end58_crit_edge ], [ 1, %if.then ], [ %m.089, %for.body31 ], [ %indvars.iv100, %if.then55 ]
%spec.select = call i32 @llvm.smax.i32(i32 %n.094, i32 %m.1)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next101 = add i32 %indvars.iv100, -1
%exitcond.not = icmp eq i64 %indvars.iv.next104.pre-phi, %call2
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !10
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#include <stdio.h>
#include <string.h>
int main(){
char str[10];
scanf("%s",str);
int i;
int count = 0;
int count_max = 0;
for(i=0; i<strlen(str); i++){
if(str[i]=='A'||str[i]=='C'||str[i]=='G'||str[i]=='T'){
count++;
if(count>count_max)
count_max=count;
}
else
count=0;
}
printf("%d\n",count_max);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210819/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210819/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %str) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #5
%cmp38.not = icmp eq i64 %call2, 0
br i1 %cmp38.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call2, 1
%0 = icmp eq i64 %call2, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call2, -2
br label %for.body
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%count_max.041 = phi i32 [ 0, %for.body.preheader.new ], [ %count_max.1.1, %for.inc.1 ]
%count.040 = phi i32 [ 0, %for.body.preheader.new ], [ %count.1.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [10 x i8], ptr %str, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %for.inc [
i8 65, label %if.then
i8 67, label %if.then
i8 71, label %if.then
i8 84, label %if.then
]
if.then: ; preds = %for.body, %for.body, %for.body, %for.body
%inc = add nsw i32 %count.040, 1
%cmp24.not = icmp slt i32 %count.040, %count_max.041
%spec.select = select i1 %cmp24.not, i32 %count_max.041, i32 %inc
br label %for.inc
for.inc: ; preds = %if.then, %for.body
%count.1 = phi i32 [ %inc, %if.then ], [ 0, %for.body ]
%count_max.1 = phi i32 [ %spec.select, %if.then ], [ %count_max.041, %for.body ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10 x i8], ptr %str, i64 0, i64 %indvars.iv.next
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %for.inc.1 [
i8 65, label %if.then.1
i8 67, label %if.then.1
i8 71, label %if.then.1
i8 84, label %if.then.1
]
if.then.1: ; preds = %for.inc, %for.inc, %for.inc, %for.inc
%inc.1 = add nsw i32 %count.1, 1
%cmp24.not.1 = icmp slt i32 %count.1, %count_max.1
%spec.select.1 = select i1 %cmp24.not.1, i32 %count_max.1, i32 %inc.1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%count.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ 0, %for.inc ]
%count_max.1.1 = phi i32 [ %spec.select.1, %if.then.1 ], [ %count_max.1, %for.inc ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%count_max.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %count_max.1.1, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%count_max.041.unr = phi i32 [ 0, %for.body.preheader ], [ %count_max.1.1, %for.inc.1 ]
%count.040.unr = phi i32 [ 0, %for.body.preheader ], [ %count.1.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds [10 x i8], ptr %str, i64 0, i64 %indvars.iv.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %for.end [
i8 65, label %if.then.epil
i8 67, label %if.then.epil
i8 71, label %if.then.epil
i8 84, label %if.then.epil
]
if.then.epil: ; preds = %for.body.epil, %for.body.epil, %for.body.epil, %for.body.epil
%inc.epil = add nsw i32 %count.040.unr, 1
%cmp24.not.epil = icmp slt i32 %count.040.unr, %count_max.041.unr
%spec.select.epil = select i1 %cmp24.not.epil, i32 %count_max.041.unr, i32 %inc.epil
br label %for.end
for.end: ; preds = %for.end.loopexit.unr-lcssa, %if.then.epil, %for.body.epil, %entry
%count_max.0.lcssa = phi i32 [ 0, %entry ], [ %count_max.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %spec.select.epil, %if.then.epil ], [ %count_max.041.unr, %for.body.epil ]
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count_max.0.lcssa)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
char s[10];
int i,n=0,x=0;
scanf("%s",s);
for(i=0;i<10;i++){
if(s[i]=='\0') break;
else{
if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
n++;
if(n>x)
x=n;
}
else n=0;
}
}
printf("%d",x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210862/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210862/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
switch i8 %0, label %for.inc [
i8 0, label %for.end
i8 65, label %if.then25
i8 67, label %if.then25
i8 71, label %if.then25
i8 84, label %if.then25
]
if.then25: ; preds = %entry, %entry, %entry, %entry
br label %for.inc
for.inc: ; preds = %if.then25, %entry
%n.1 = phi i32 [ 1, %if.then25 ], [ 0, %entry ]
%arrayidx.1 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %1, label %for.inc.1 [
i8 0, label %for.end
i8 65, label %if.then25.1
i8 67, label %if.then25.1
i8 71, label %if.then25.1
i8 84, label %if.then25.1
]
if.then25.1: ; preds = %for.inc, %for.inc, %for.inc, %for.inc
%inc.1 = add nuw nsw i32 %n.1, 1
br label %for.inc.1
for.inc.1: ; preds = %if.then25.1, %for.inc
%n.1.1 = phi i32 [ %inc.1, %if.then25.1 ], [ 0, %for.inc ]
%x.1.1 = phi i32 [ %inc.1, %if.then25.1 ], [ %n.1, %for.inc ]
%arrayidx.2 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
switch i8 %2, label %for.inc.2 [
i8 0, label %for.end
i8 65, label %if.then25.2
i8 67, label %if.then25.2
i8 71, label %if.then25.2
i8 84, label %if.then25.2
]
if.then25.2: ; preds = %for.inc.1, %for.inc.1, %for.inc.1, %for.inc.1
%inc.2 = add nuw nsw i32 %n.1.1, 1
%cmp26.not.2 = icmp ult i32 %n.1.1, %x.1.1
%spec.select.2 = select i1 %cmp26.not.2, i32 %x.1.1, i32 %inc.2
br label %for.inc.2
for.inc.2: ; preds = %if.then25.2, %for.inc.1
%n.1.2 = phi i32 [ %inc.2, %if.then25.2 ], [ 0, %for.inc.1 ]
%x.1.2 = phi i32 [ %spec.select.2, %if.then25.2 ], [ %x.1.1, %for.inc.1 ]
%arrayidx.3 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 3
%3 = load i8, ptr %arrayidx.3, align 1, !tbaa !5
switch i8 %3, label %for.inc.3 [
i8 0, label %for.end
i8 65, label %if.then25.3
i8 67, label %if.then25.3
i8 71, label %if.then25.3
i8 84, label %if.then25.3
]
if.then25.3: ; preds = %for.inc.2, %for.inc.2, %for.inc.2, %for.inc.2
%inc.3 = add nuw nsw i32 %n.1.2, 1
%cmp26.not.3 = icmp ult i32 %n.1.2, %x.1.2
%spec.select.3 = select i1 %cmp26.not.3, i32 %x.1.2, i32 %inc.3
br label %for.inc.3
for.inc.3: ; preds = %if.then25.3, %for.inc.2
%n.1.3 = phi i32 [ %inc.3, %if.then25.3 ], [ 0, %for.inc.2 ]
%x.1.3 = phi i32 [ %spec.select.3, %if.then25.3 ], [ %x.1.2, %for.inc.2 ]
%arrayidx.4 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 4
%4 = load i8, ptr %arrayidx.4, align 1, !tbaa !5
switch i8 %4, label %for.inc.4 [
i8 0, label %for.end
i8 65, label %if.then25.4
i8 67, label %if.then25.4
i8 71, label %if.then25.4
i8 84, label %if.then25.4
]
if.then25.4: ; preds = %for.inc.3, %for.inc.3, %for.inc.3, %for.inc.3
%inc.4 = add nuw nsw i32 %n.1.3, 1
%cmp26.not.4 = icmp ult i32 %n.1.3, %x.1.3
%spec.select.4 = select i1 %cmp26.not.4, i32 %x.1.3, i32 %inc.4
br label %for.inc.4
for.inc.4: ; preds = %if.then25.4, %for.inc.3
%n.1.4 = phi i32 [ %inc.4, %if.then25.4 ], [ 0, %for.inc.3 ]
%x.1.4 = phi i32 [ %spec.select.4, %if.then25.4 ], [ %x.1.3, %for.inc.3 ]
%arrayidx.5 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 5
%5 = load i8, ptr %arrayidx.5, align 1, !tbaa !5
switch i8 %5, label %for.inc.5 [
i8 0, label %for.end
i8 65, label %if.then25.5
i8 67, label %if.then25.5
i8 71, label %if.then25.5
i8 84, label %if.then25.5
]
if.then25.5: ; preds = %for.inc.4, %for.inc.4, %for.inc.4, %for.inc.4
%inc.5 = add nuw nsw i32 %n.1.4, 1
%cmp26.not.5 = icmp ult i32 %n.1.4, %x.1.4
%spec.select.5 = select i1 %cmp26.not.5, i32 %x.1.4, i32 %inc.5
br label %for.inc.5
for.inc.5: ; preds = %if.then25.5, %for.inc.4
%n.1.5 = phi i32 [ %inc.5, %if.then25.5 ], [ 0, %for.inc.4 ]
%x.1.5 = phi i32 [ %spec.select.5, %if.then25.5 ], [ %x.1.4, %for.inc.4 ]
%arrayidx.6 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 6
%6 = load i8, ptr %arrayidx.6, align 1, !tbaa !5
switch i8 %6, label %for.inc.6 [
i8 0, label %for.end
i8 65, label %if.then25.6
i8 67, label %if.then25.6
i8 71, label %if.then25.6
i8 84, label %if.then25.6
]
if.then25.6: ; preds = %for.inc.5, %for.inc.5, %for.inc.5, %for.inc.5
%inc.6 = add nuw nsw i32 %n.1.5, 1
%cmp26.not.6 = icmp ult i32 %n.1.5, %x.1.5
%spec.select.6 = select i1 %cmp26.not.6, i32 %x.1.5, i32 %inc.6
br label %for.inc.6
for.inc.6: ; preds = %if.then25.6, %for.inc.5
%n.1.6 = phi i32 [ %inc.6, %if.then25.6 ], [ 0, %for.inc.5 ]
%x.1.6 = phi i32 [ %spec.select.6, %if.then25.6 ], [ %x.1.5, %for.inc.5 ]
%arrayidx.7 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 7
%7 = load i8, ptr %arrayidx.7, align 1, !tbaa !5
switch i8 %7, label %for.inc.7 [
i8 0, label %for.end
i8 65, label %if.then25.7
i8 67, label %if.then25.7
i8 71, label %if.then25.7
i8 84, label %if.then25.7
]
if.then25.7: ; preds = %for.inc.6, %for.inc.6, %for.inc.6, %for.inc.6
%inc.7 = add nuw nsw i32 %n.1.6, 1
%cmp26.not.7 = icmp ult i32 %n.1.6, %x.1.6
%spec.select.7 = select i1 %cmp26.not.7, i32 %x.1.6, i32 %inc.7
br label %for.inc.7
for.inc.7: ; preds = %if.then25.7, %for.inc.6
%n.1.7 = phi i32 [ %inc.7, %if.then25.7 ], [ 0, %for.inc.6 ]
%x.1.7 = phi i32 [ %spec.select.7, %if.then25.7 ], [ %x.1.6, %for.inc.6 ]
%arrayidx.8 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 8
%8 = load i8, ptr %arrayidx.8, align 1, !tbaa !5
switch i8 %8, label %for.inc.8 [
i8 0, label %for.end
i8 65, label %if.then25.8
i8 67, label %if.then25.8
i8 71, label %if.then25.8
i8 84, label %if.then25.8
]
if.then25.8: ; preds = %for.inc.7, %for.inc.7, %for.inc.7, %for.inc.7
%inc.8 = add nuw nsw i32 %n.1.7, 1
%cmp26.not.8 = icmp ult i32 %n.1.7, %x.1.7
%spec.select.8 = select i1 %cmp26.not.8, i32 %x.1.7, i32 %inc.8
br label %for.inc.8
for.inc.8: ; preds = %if.then25.8, %for.inc.7
%n.1.8 = phi i32 [ %inc.8, %if.then25.8 ], [ 0, %for.inc.7 ]
%x.1.8 = phi i32 [ %spec.select.8, %if.then25.8 ], [ %x.1.7, %for.inc.7 ]
%arrayidx.9 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 9
%9 = load i8, ptr %arrayidx.9, align 1, !tbaa !5
switch i8 %9, label %for.end [
i8 84, label %if.then25.9
i8 65, label %if.then25.9
i8 67, label %if.then25.9
i8 71, label %if.then25.9
]
if.then25.9: ; preds = %for.inc.8, %for.inc.8, %for.inc.8, %for.inc.8
%inc.9 = add nuw nsw i32 %n.1.8, 1
%cmp26.not.9 = icmp ult i32 %n.1.8, %x.1.8
%spec.select.9 = select i1 %cmp26.not.9, i32 %x.1.8, i32 %inc.9
br label %for.end
for.end: ; preds = %for.inc.8, %if.then25.9, %for.inc.7, %for.inc.6, %for.inc.5, %for.inc.4, %for.inc.3, %for.inc.2, %for.inc.1, %for.inc, %entry
%x.0.lcssa = phi i32 [ 0, %entry ], [ %n.1, %for.inc ], [ %x.1.1, %for.inc.1 ], [ %x.1.2, %for.inc.2 ], [ %x.1.3, %for.inc.3 ], [ %x.1.4, %for.inc.4 ], [ %x.1.5, %for.inc.5 ], [ %x.1.6, %for.inc.6 ], [ %x.1.7, %for.inc.7 ], [ %spec.select.9, %if.then25.9 ], [ %x.1.8, %for.inc.8 ]
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %x.0.lcssa)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
char S[11];
scanf("%s",S);
int i;
int cnt=0;
int ans=0;
for(i=0;S[i]!='\0';i++){
if(S[i]=='A'||S[i]=='T'||S[i]=='C'||S[i]=='G') {
cnt++;
}
else{
if(cnt>ans) ans=cnt;
cnt=0;
}
}
if(cnt>ans) ans=cnt;
printf("%d",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210905/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210905/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %S) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%cnt.0 = phi i32 [ %cnt.1, %for.inc ], [ 0, %entry ]
%ans.0 = phi i32 [ %ans.2, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [11 x i8], ptr %S, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %0, label %if.else [
i8 0, label %for.end
i8 65, label %if.then
i8 84, label %if.then
i8 67, label %if.then
i8 71, label %if.then
]
if.then: ; preds = %for.cond, %for.cond, %for.cond, %for.cond
%inc = add nsw i32 %cnt.0, 1
br label %for.inc
if.else: ; preds = %for.cond
%spec.select = call i32 @llvm.smax.i32(i32 %cnt.0, i32 %ans.0)
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%cnt.1 = phi i32 [ %inc, %if.then ], [ 0, %if.else ]
%ans.2 = phi i32 [ %ans.0, %if.then ], [ %spec.select, %if.else ]
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br label %for.cond, !llvm.loop !8
for.end: ; preds = %for.cond
%spec.select45 = call i32 @llvm.smax.i32(i32 %cnt.0, i32 %ans.0)
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select45)
call void @llvm.lifetime.end.p0(i64 11, 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(){
char *S;
int count=0;
int max=0;
S = (char *)malloc(sizeof(char));
scanf("%s",S);
for(int i=0;i<strlen(S);i++){
if(S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T'){
count++;
if(count>max){
max=count;
}
}else{
count=0;
}
}
printf("%d\n",max);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210949/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210949/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(1) ptr @malloc(i64 noundef 1) #4
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %call)
%call2 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %call) #5
%cmp43.not = icmp eq i64 %call2, 0
br i1 %cmp43.not, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call2, 1
%0 = icmp eq i64 %call2, 1
br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call2, -2
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%max.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %max.1.1, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%max.045.unr = phi i32 [ 0, %for.body.preheader ], [ %max.1.1, %for.inc.1 ]
%count.044.unr = phi i32 [ 0, %for.body.preheader ], [ %count.1.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %call, i64 %indvars.iv.unr
%1 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %1, label %for.cond.cleanup [
i8 65, label %if.then.epil
i8 67, label %if.then.epil
i8 71, label %if.then.epil
i8 84, label %if.then.epil
]
if.then.epil: ; preds = %for.body.epil, %for.body.epil, %for.body.epil, %for.body.epil
%inc.epil = add nsw i32 %count.044.unr, 1
%cmp24.not.epil = icmp slt i32 %count.044.unr, %max.045.unr
%spec.select.epil = select i1 %cmp24.not.epil, i32 %max.045.unr, i32 %inc.epil
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %if.then.epil, %for.body.epil, %entry
%max.0.lcssa = phi i32 [ 0, %entry ], [ %max.1.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %spec.select.epil, %if.then.epil ], [ %max.045.unr, %for.body.epil ]
%call29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa)
ret i32 0
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%max.045 = phi i32 [ 0, %for.body.preheader.new ], [ %max.1.1, %for.inc.1 ]
%count.044 = phi i32 [ 0, %for.body.preheader.new ], [ %count.1.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds i8, ptr %call, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %2, label %for.inc [
i8 65, label %if.then
i8 67, label %if.then
i8 71, label %if.then
i8 84, label %if.then
]
if.then: ; preds = %for.body, %for.body, %for.body, %for.body
%inc = add nsw i32 %count.044, 1
%cmp24.not = icmp slt i32 %count.044, %max.045
%spec.select = select i1 %cmp24.not, i32 %max.045, i32 %inc
br label %for.inc
for.inc: ; preds = %if.then, %for.body
%count.1 = phi i32 [ %inc, %if.then ], [ 0, %for.body ]
%max.1 = phi i32 [ %spec.select, %if.then ], [ %max.045, %for.body ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %call, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %3, label %for.inc.1 [
i8 65, label %if.then.1
i8 67, label %if.then.1
i8 71, label %if.then.1
i8 84, label %if.then.1
]
if.then.1: ; preds = %for.inc, %for.inc, %for.inc, %for.inc
%inc.1 = add nsw i32 %count.1, 1
%cmp24.not.1 = icmp slt i32 %count.1, %max.1
%spec.select.1 = select i1 %cmp24.not.1, i32 %max.1, i32 %inc.1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%count.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ 0, %for.inc ]
%max.1.1 = phi i32 [ %spec.select.1, %if.then.1 ], [ %max.1, %for.inc ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind allocsize(0) }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int t,i,n;
scanf("%d",&t);
int a[t];
for(i=0;i<t;i++)
{
scanf("%d",&a[i]);
n=a[i]/7;
if(a[i]<=7)
{
printf("1\n");
}
else if(a[i]%7==0)
{
printf("%d\n",n);
}
else if(a[i]%7!=0)
{
printf("%d\n",n+1);
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = 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
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %t, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %3, 0
br i1 %cmp29, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%div = sdiv i32 %4, 7
%cmp6 = icmp slt i32 %4, 8
br i1 %cmp6, label %if.then, label %if.else
if.then: ; preds = %for.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.else: ; preds = %for.body
%rem = urem i32 %4, 7
%cmp10 = icmp eq i32 %rem, 0
br i1 %cmp10, label %if.then11, label %if.then18
if.then11: ; preds = %if.else
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %div)
br label %for.inc
if.then18: ; preds = %if.else
%add = add nsw i32 %div, 1
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add)
br label %for.inc
for.inc: ; preds = %if.then, %if.then18, %if.then11
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %t, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
char s[11], i;
int dp[11], max = 0;
scanf("%s", s);
for (i = 0; i <= 10; i++)
dp[i] = 0;
if (s[0] == 'A' || s[0] == 'C' || s[0] == 'T' || s[0] == 'G')
dp[0] = 1;
for (i = 1; s[i] != 0; i++) {
if (s[i] == 'A' || s[i] == 'C' || s[i] == 'T' || s[i] == 'G')
dp[i] = dp[i - 1] + 1;
}
for (i = 0; s[i] != 0; i++)
if (dp[i] > max)
max = dp[i];
printf("%d\n", max);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211049/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211049/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [11 x i8], align 1
%dp = alloca [11 x i32], align 16
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 44, ptr nonnull %dp) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(44) %dp, i8 0, i64 44, i1 false), !tbaa !5
%0 = load i8, ptr %s, align 1
switch i8 %0, label %for.cond21.preheader [
i8 84, label %if.then
i8 71, label %if.then
i8 67, label %if.then
i8 65, label %if.then
]
if.then: ; preds = %entry, %entry, %entry, %entry
store i32 1, ptr %dp, align 16, !tbaa !5
br label %for.cond21.preheader
for.cond21.preheader: ; preds = %entry, %if.then
br label %for.cond21
for.cond21: ; preds = %for.cond21.preheader, %for.inc58
%i.1 = phi i8 [ %inc59, %for.inc58 ], [ 1, %for.cond21.preheader ]
%idxprom22 = sext i8 %i.1 to i64
%arrayidx23 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %idxprom22
%1 = load i8, ptr %arrayidx23, align 1, !tbaa !9
switch i8 %1, label %for.inc58 [
i8 0, label %for.cond61.preheader
i8 65, label %if.then51
i8 67, label %if.then51
i8 84, label %if.then51
i8 71, label %if.then51
]
for.cond61.preheader: ; preds = %for.cond21
%cmp65.not98 = icmp eq i8 %0, 0
br i1 %cmp65.not98, label %for.end78, label %for.body67
if.then51: ; preds = %for.cond21, %for.cond21, %for.cond21, %for.cond21
%sub = add nsw i64 %idxprom22, -1
%arrayidx54 = getelementptr inbounds [11 x i32], ptr %dp, i64 0, i64 %sub
%2 = load i32, ptr %arrayidx54, align 4, !tbaa !5
%add = add nsw i32 %2, 1
%arrayidx56 = getelementptr inbounds [11 x i32], ptr %dp, i64 0, i64 %idxprom22
store i32 %add, ptr %arrayidx56, align 4, !tbaa !5
br label %for.inc58
for.inc58: ; preds = %for.cond21, %if.then51
%inc59 = add i8 %i.1, 1
br label %for.cond21, !llvm.loop !10
for.body67: ; preds = %for.cond61.preheader, %for.body67
%idxprom62101 = phi i64 [ %idxprom62, %for.body67 ], [ 0, %for.cond61.preheader ]
%max.0100 = phi i32 [ %spec.select, %for.body67 ], [ 0, %for.cond61.preheader ]
%i.299 = phi i8 [ %inc77, %for.body67 ], [ 0, %for.cond61.preheader ]
%arrayidx69 = getelementptr inbounds [11 x i32], ptr %dp, i64 0, i64 %idxprom62101
%3 = load i32, ptr %arrayidx69, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %3, i32 %max.0100)
%inc77 = add i8 %i.299, 1
%idxprom62 = sext i8 %inc77 to i64
%arrayidx63 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %idxprom62
%4 = load i8, ptr %arrayidx63, align 1, !tbaa !9
%cmp65.not = icmp eq i8 %4, 0
br i1 %cmp65.not, label %for.end78, label %for.body67, !llvm.loop !12
for.end78: ; preds = %for.body67, %for.cond61.preheader
%max.0.lcssa = phi i32 [ 0, %for.cond61.preheader ], [ %spec.select, %for.body67 ]
%call79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa)
call void @llvm.lifetime.end.p0(i64 44, ptr nonnull %dp) #5
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<ctype.h>
#include<limits.h>
#include<float.h>
#include<math.h>
#include<stdbool.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define ll long long
#define min(x, y) ((x<=y) ? x : y)
#define max(x, y) ((x<=y) ? y : x)
#define loop(a, b, c) for(ll int a = b; a < c; a++)
#define loop_(a, b, c) for(ll int a = b; a >= c; a--)
#define mod1 1000069
#define mod2 1000000007
#define mod3 1000000009
#define mod4 998244353
void solve();
ll modulo(ll a, ll n, ll p);
ll mod_inverse(ll a, ll p);
ll ncr_modp(ll n, ll r, ll p);
ll _gcd(ll b, ll a);
ll _lcm(ll b, ll a);
ll cmp(const void* x, const void* y);
ll binarySearch(ll arr[], ll l, ll r, ll x);
int main(void){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
long t;
scanf(" %ld", &t);
while(t--){
solve();
}
return 0;
}
ll modulo(ll a, ll n, ll p){
ll ret = 1;
while(n){
if(n & 1){
ret *= a;
ret %= p;
}
n >>= 1;
a *= a;
a %= p;
}
return ret;
}
ll mod_inverse(ll a, ll p){
return modulo(a, (p - 2), p);
}
ll ncr_modp(ll n, ll r, ll p){
if (r == 0){
return 1;
}
ll fac[n + 1];
fac[0] = 1;
for(ll i = 1; i <= n; i++){
fac[i] = (fac[i - 1] * i) % p;
}
return (fac[n] * (mod_inverse(fac[r], p) % p) * (mod_inverse(fac[n - r], p) % p)) % p;
}
ll _gcd(ll b, ll a){
if(a < b){
return _gcd(a, b);
}
if(a % b == 0){
return b;
}
return _gcd(a % b , b);
}
ll _lcm(ll b, ll a){
return ((a * b)/_gcd(a, b));
}
ll cmp(const void* x, const void* y){
ll *xx, *yy;
ll res;
xx = (ll *)x;
yy = (ll *)y;
res = *xx - *yy;
return(res);
}
ll binarySearch(ll arr[], ll l, ll r, ll x){
while (l <= r){
ll m = l + (r - l) / 2;
if(arr[m] == x){
return m;
}
if(arr[m] < x){
l = m + 1;
}
else{
r = m - 1;
}
}
return -1;
}
void solve(){
ll n;
scanf(" %lld", &n);
printf(" %lld\n", ( (ll)pow(2, (double)((n/2) + 1)) - 2));
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2111/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2111/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"input.txt\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"r\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = private unnamed_addr constant [11 x i8] c"output.txt\00", align 1
@.str.3 = private unnamed_addr constant [2 x i8] c"w\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.4 = private unnamed_addr constant [5 x i8] c" %ld\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c" %lld\00", align 1
@.str.6 = private unnamed_addr constant [7 x i8] c" %lld\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n.i = alloca i64, align 8
%t = alloca i64, align 8
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %0) #9
%1 = load ptr, ptr @stdout, align 8, !tbaa !5
%call1 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %1) #9
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #9
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %t)
%2 = load i64, ptr %t, align 8, !tbaa !9
%dec3 = add nsw i64 %2, -1
store i64 %dec3, ptr %t, align 8, !tbaa !9
%tobool.not4 = icmp eq i64 %2, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n.i) #9
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %n.i)
%3 = load i64, ptr %n.i, align 8, !tbaa !11
%div.i = sdiv i64 %3, 2
%add.i = add nsw i64 %div.i, 1
%conv.i = sitofp i64 %add.i to double
%exp2.i = call double @exp2(double %conv.i) #9
%conv2.i = fptosi double %exp2.i to i64
%sub.i = add nsw i64 %conv2.i, -2
%call3.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i64 noundef %sub.i)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n.i) #9
%4 = load i64, ptr %t, align 8, !tbaa !9
%dec = add nsw i64 %4, -1
store i64 %dec, ptr %t, align 8, !tbaa !9
%tobool.not = icmp eq i64 %4, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #9
ret i32 0
}
declare ptr @freopen(ptr noundef, ptr noundef, 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @modulo(i64 noundef %a, i64 noundef %n, i64 noundef %p) local_unnamed_addr #4 {
entry:
%tobool.not12 = icmp eq i64 %n, 0
br i1 %tobool.not12, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%ret.015 = phi i64 [ %ret.1, %if.end ], [ 1, %entry ]
%a.addr.014 = phi i64 [ %rem3, %if.end ], [ %a, %entry ]
%n.addr.013 = phi i64 [ %shr, %if.end ], [ %n, %entry ]
%and = and i64 %n.addr.013, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul nsw i64 %ret.015, %a.addr.014
%rem = srem i64 %mul, %p
br label %if.end
if.end: ; preds = %if.then, %while.body
%ret.1 = phi i64 [ %rem, %if.then ], [ %ret.015, %while.body ]
%shr = ashr i64 %n.addr.013, 1
%mul2 = mul nsw i64 %a.addr.014, %a.addr.014
%rem3 = srem i64 %mul2, %p
%tobool.not = icmp ult i64 %n.addr.013, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %if.end, %entry
%ret.0.lcssa = phi i64 [ 1, %entry ], [ %ret.1, %if.end ]
ret i64 %ret.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @mod_inverse(i64 noundef %a, i64 noundef %p) local_unnamed_addr #4 {
entry:
%sub = add nsw i64 %p, -2
%tobool.not12.i = icmp eq i64 %sub, 0
br i1 %tobool.not12.i, label %modulo.exit, label %while.body.i
while.body.i: ; preds = %entry, %if.end.i
%ret.015.i = phi i64 [ %ret.1.i, %if.end.i ], [ 1, %entry ]
%a.addr.014.i = phi i64 [ %rem3.i, %if.end.i ], [ %a, %entry ]
%n.addr.013.i = phi i64 [ %shr.i, %if.end.i ], [ %sub, %entry ]
%and.i = and i64 %n.addr.013.i, 1
%tobool1.not.i = icmp eq i64 %and.i, 0
br i1 %tobool1.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %while.body.i
%mul.i = mul nsw i64 %a.addr.014.i, %ret.015.i
%rem.i = srem i64 %mul.i, %p
br label %if.end.i
if.end.i: ; preds = %if.then.i, %while.body.i
%ret.1.i = phi i64 [ %rem.i, %if.then.i ], [ %ret.015.i, %while.body.i ]
%shr.i = ashr i64 %n.addr.013.i, 1
%mul2.i = mul nsw i64 %a.addr.014.i, %a.addr.014.i
%rem3.i = srem i64 %mul2.i, %p
%tobool.not.i = icmp ult i64 %n.addr.013.i, 2
br i1 %tobool.not.i, label %modulo.exit, label %while.body.i, !llvm.loop !15
modulo.exit: ; preds = %if.end.i, %entry
%ret.0.lcssa.i = phi i64 [ 1, %entry ], [ %ret.1.i, %if.end.i ]
ret i64 %ret.0.lcssa.i
}
; Function Attrs: nofree nosync nounwind uwtable
define dso_local i64 @ncr_modp(i64 noundef %n, i64 noundef %r, i64 noundef %p) local_unnamed_addr #5 {
entry:
%cmp = icmp eq i64 %r, 0
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%add = add i64 %n, 1
%0 = tail call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %add, align 16
store i64 1, ptr %vla, align 16, !tbaa !11
%cmp1.not53 = icmp slt i64 %n, 1
br i1 %cmp1.not53, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %if.end
%load_initial = load i64, ptr %vla, align 16
%xtraiter = and i64 %n, 1
%1 = icmp eq i64 %n, 1
br i1 %1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %n, -2
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%store_forwarded.unr = phi i64 [ %load_initial, %for.body.preheader ], [ %rem.1, %for.body ]
%i.054.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %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
%2 = getelementptr i64, ptr %vla, i64 %i.054.unr
%mul.epil = mul nsw i64 %store_forwarded.unr, %i.054.unr
%rem.epil = srem i64 %mul.epil, %p
store i64 %rem.epil, ptr %2, align 8, !tbaa !11
br label %for.cond.cleanup.loopexit
for.cond.cleanup.loopexit: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%arrayidx5.phi.trans.insert = getelementptr inbounds i64, ptr %vla, i64 %r
%.pre = load i64, ptr %arrayidx5.phi.trans.insert, align 8, !tbaa !11
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %if.end
%3 = phi i64 [ %.pre, %for.cond.cleanup.loopexit ], [ undef, %if.end ]
%arrayidx4 = getelementptr inbounds i64, ptr %vla, i64 %n
%4 = load i64, ptr %arrayidx4, align 8, !tbaa !11
%sub.i = add nsw i64 %p, -2
%tobool.not12.i.i = icmp eq i64 %sub.i, 0
br i1 %tobool.not12.i.i, label %mod_inverse.exit46, label %while.body.i.i
while.body.i.i: ; preds = %for.cond.cleanup, %if.end.i.i
%ret.015.i.i = phi i64 [ %ret.1.i.i, %if.end.i.i ], [ 1, %for.cond.cleanup ]
%a.addr.014.i.i = phi i64 [ %rem3.i.i, %if.end.i.i ], [ %3, %for.cond.cleanup ]
%n.addr.013.i.i = phi i64 [ %shr.i.i, %if.end.i.i ], [ %sub.i, %for.cond.cleanup ]
%and.i.i = and i64 %n.addr.013.i.i, 1
%tobool1.not.i.i = icmp eq i64 %and.i.i, 0
br i1 %tobool1.not.i.i, label %if.end.i.i, label %if.then.i.i
if.then.i.i: ; preds = %while.body.i.i
%mul.i.i = mul nsw i64 %a.addr.014.i.i, %ret.015.i.i
%rem.i.i = srem i64 %mul.i.i, %p
br label %if.end.i.i
if.end.i.i: ; preds = %if.then.i.i, %while.body.i.i
%ret.1.i.i = phi i64 [ %rem.i.i, %if.then.i.i ], [ %ret.015.i.i, %while.body.i.i ]
%shr.i.i = ashr i64 %n.addr.013.i.i, 1
%mul2.i.i = mul nsw i64 %a.addr.014.i.i, %a.addr.014.i.i
%rem3.i.i = srem i64 %mul2.i.i, %p
%tobool.not.i.i = icmp ult i64 %n.addr.013.i.i, 2
br i1 %tobool.not.i.i, label %while.body.i.i30.preheader, label %while.body.i.i, !llvm.loop !15
while.body.i.i30.preheader: ; preds = %if.end.i.i
%rem6 = srem i64 %ret.1.i.i, %p
%mul7 = mul nsw i64 %rem6, %4
%sub8 = sub nsw i64 %n, %r
%arrayidx9 = getelementptr inbounds i64, ptr %vla, i64 %sub8
%5 = load i64, ptr %arrayidx9, align 8, !tbaa !11
br label %while.body.i.i30
while.body.i.i30: ; preds = %while.body.i.i30.preheader, %if.end.i.i39
%ret.015.i.i31 = phi i64 [ %ret.1.i.i40, %if.end.i.i39 ], [ 1, %while.body.i.i30.preheader ]
%a.addr.014.i.i32 = phi i64 [ %rem3.i.i43, %if.end.i.i39 ], [ %5, %while.body.i.i30.preheader ]
%n.addr.013.i.i33 = phi i64 [ %shr.i.i41, %if.end.i.i39 ], [ %sub.i, %while.body.i.i30.preheader ]
%and.i.i34 = and i64 %n.addr.013.i.i33, 1
%tobool1.not.i.i35 = icmp eq i64 %and.i.i34, 0
br i1 %tobool1.not.i.i35, label %if.end.i.i39, label %if.then.i.i36
if.then.i.i36: ; preds = %while.body.i.i30
%mul.i.i37 = mul nsw i64 %a.addr.014.i.i32, %ret.015.i.i31
%rem.i.i38 = srem i64 %mul.i.i37, %p
br label %if.end.i.i39
if.end.i.i39: ; preds = %if.then.i.i36, %while.body.i.i30
%ret.1.i.i40 = phi i64 [ %rem.i.i38, %if.then.i.i36 ], [ %ret.015.i.i31, %while.body.i.i30 ]
%shr.i.i41 = ashr i64 %n.addr.013.i.i33, 1
%mul2.i.i42 = mul nsw i64 %a.addr.014.i.i32, %a.addr.014.i.i32
%rem3.i.i43 = srem i64 %mul2.i.i42, %p
%tobool.not.i.i44 = icmp ult i64 %n.addr.013.i.i33, 2
br i1 %tobool.not.i.i44, label %mod_inverse.exit46, label %while.body.i.i30, !llvm.loop !15
mod_inverse.exit46: ; preds = %if.end.i.i39, %for.cond.cleanup
%mul752 = phi i64 [ %4, %for.cond.cleanup ], [ %mul7, %if.end.i.i39 ]
%ret.0.lcssa.i.i45 = phi i64 [ 1, %for.cond.cleanup ], [ %ret.1.i.i40, %if.end.i.i39 ]
%rem11 = srem i64 %ret.0.lcssa.i.i45, %p
%mul12 = mul nsw i64 %rem11, %mul752
%rem13 = srem i64 %mul12, %p
tail call void @llvm.stackrestore.p0(ptr %0)
br label %return
for.body: ; preds = %for.body, %for.body.preheader.new
%store_forwarded = phi i64 [ %load_initial, %for.body.preheader.new ], [ %rem.1, %for.body ]
%i.054 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%6 = getelementptr i64, ptr %vla, i64 %i.054
%mul = mul nsw i64 %store_forwarded, %i.054
%rem = srem i64 %mul, %p
store i64 %rem, ptr %6, align 8, !tbaa !11
%inc = add nuw i64 %i.054, 1
%7 = getelementptr i64, ptr %vla, i64 %inc
%mul.1 = mul nsw i64 %rem, %inc
%rem.1 = srem i64 %mul.1, %p
store i64 %rem.1, ptr %7, align 8, !tbaa !11
%inc.1 = add nuw i64 %i.054, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !16
return: ; preds = %entry, %mod_inverse.exit46
%retval.0 = phi i64 [ %rem13, %mod_inverse.exit46 ], [ 1, %entry ]
ret i64 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #6
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #6
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @_gcd(i64 noundef %b, i64 noundef %a) local_unnamed_addr #4 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse.backedge, %entry
%b.tr = phi i64 [ %b, %entry ], [ %b.tr.be, %tailrecurse.backedge ]
%a.tr = phi i64 [ %a, %entry ], [ %b.tr, %tailrecurse.backedge ]
%cmp = icmp slt i64 %a.tr, %b.tr
br i1 %cmp, label %tailrecurse.backedge, label %if.end
tailrecurse.backedge: ; preds = %tailrecurse, %if.end
%b.tr.be = phi i64 [ %a.tr, %tailrecurse ], [ %rem, %if.end ]
br label %tailrecurse
if.end: ; preds = %tailrecurse
%rem = srem i64 %a.tr, %b.tr
%cmp1 = icmp eq i64 %rem, 0
br i1 %cmp1, label %return, label %tailrecurse.backedge
return: ; preds = %if.end
ret i64 %b.tr
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @_lcm(i64 noundef %b, i64 noundef %a) local_unnamed_addr #4 {
entry:
br label %tailrecurse.i
tailrecurse.i: ; preds = %tailrecurse.i.backedge, %entry
%b.tr.i = phi i64 [ %a, %entry ], [ %b.tr.i.be, %tailrecurse.i.backedge ]
%a.tr.i = phi i64 [ %b, %entry ], [ %b.tr.i, %tailrecurse.i.backedge ]
%cmp.i = icmp slt i64 %a.tr.i, %b.tr.i
br i1 %cmp.i, label %tailrecurse.i.backedge, label %if.end.i
if.end.i: ; preds = %tailrecurse.i
%rem.i = srem i64 %a.tr.i, %b.tr.i
%cmp1.i = icmp eq i64 %rem.i, 0
br i1 %cmp1.i, label %_gcd.exit, label %tailrecurse.i.backedge
tailrecurse.i.backedge: ; preds = %if.end.i, %tailrecurse.i
%b.tr.i.be = phi i64 [ %a.tr.i, %tailrecurse.i ], [ %rem.i, %if.end.i ]
br label %tailrecurse.i
_gcd.exit: ; preds = %if.end.i
%mul = mul nsw i64 %a, %b
%div = sdiv i64 %mul, %b.tr.i
ret i64 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i64 @cmp(ptr nocapture noundef readonly %x, ptr nocapture noundef readonly %y) local_unnamed_addr #7 {
entry:
%0 = load i64, ptr %x, align 8, !tbaa !11
%1 = load i64, ptr %y, align 8, !tbaa !11
%sub = sub nsw i64 %0, %1
ret i64 %sub
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @binarySearch(ptr nocapture noundef readonly %arr, i64 noundef %l, i64 noundef %r, i64 noundef %x) local_unnamed_addr #8 {
entry:
%cmp.not21 = icmp sgt i64 %l, %r
br i1 %cmp.not21, label %return, label %while.body
while.body: ; preds = %entry, %cleanup
%l.addr.023 = phi i64 [ %l.addr.1, %cleanup ], [ %l, %entry ]
%r.addr.022 = phi i64 [ %r.addr.1, %cleanup ], [ %r, %entry ]
%sub = sub nsw i64 %r.addr.022, %l.addr.023
%div = sdiv i64 %sub, 2
%add = add nsw i64 %div, %l.addr.023
%arrayidx = getelementptr inbounds i64, ptr %arr, i64 %add
%0 = load i64, ptr %arrayidx, align 8, !tbaa !11
%cmp1 = icmp eq i64 %0, %x
br i1 %cmp1, label %return, label %cleanup
cleanup: ; preds = %while.body
%cmp3 = icmp slt i64 %0, %x
%add5 = add nsw i64 %add, 1
%sub6 = add nsw i64 %add, -1
%r.addr.1 = select i1 %cmp3, i64 %r.addr.022, i64 %sub6
%l.addr.1 = select i1 %cmp3, i64 %add5, i64 %l.addr.023
%cmp.not = icmp sgt i64 %l.addr.1, %r.addr.1
br i1 %cmp.not, label %return, label %while.body
return: ; preds = %cleanup, %while.body, %entry
%retval.2 = phi i64 [ -1, %entry ], [ %add, %while.body ], [ -1, %cleanup ]
ret i64 %retval.2
}
; Function Attrs: nounwind uwtable
define dso_local void @solve() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !11
%div = sdiv i64 %0, 2
%add = add nsw i64 %div, 1
%conv = sitofp i64 %add to double
%exp2 = call double @exp2(double %conv) #9
%conv2 = fptosi double %exp2 to i64
%sub = add nsw i64 %conv2, -2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i64 noundef %sub)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #9
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
declare double @exp2(double) local_unnamed_addr
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 = { "no-trapping-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 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 = { nofree nosync nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
|
#include<stdio.h>
int main()
{
int n;
int v[100005];
int odd[100005];
int even[100005];
int i;
int maxvalodd=0;
int maxvaleven=0;
int maxeven=-1;
int maxevenindex=-1;
int maxevenold=-1;
int maxevenindexold=-1;
int maxodd=-1;
int maxoddindex=-1;
int maxoddold=-1;
int maxoddindexold=-1;
int change;
int changeodd;
int changeeven;
for(i=0;i<100005;i++)
{
even[i]=0;
odd[i]=0;
}
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&v[i]);
if((i%2)==0)
{
even[v[i]]++;
if(v[i]>maxvaleven) maxvaleven=v[i];
}else{
odd[v[i]]++;
if(v[i]>maxvalodd) maxvalodd=v[i];
}
}
for(i=1;i<=maxvaleven;i++)
{
if(even[i]>=maxeven)
{
maxevenold=maxeven;
maxevenindexold=maxevenindex;
maxeven=even[i];
maxevenindex=i;
}else if(even[i]>=maxevenold)
{
maxevenold=even[i];
maxevenindexold=i;
}
}
for(i=1;i<=maxvalodd;i++)
{
if(odd[i]>=maxodd)
{
maxoddold=maxodd;
maxoddindexold=maxoddindex;
maxodd=odd[i];
maxoddindex=i;
}else if(odd[i]>=maxoddold)
{
maxoddold=odd[i];
maxoddindexold=i;
}
}
if(maxoddindex==maxevenindex)
{
if(maxevenold==-1) maxevenold=0;
if(maxoddold==-1) maxoddold=0;
if((maxodd+maxevenold)>(maxeven+maxoddold))
{
maxeven=maxevenold;
}else{
maxodd=maxoddold;
}
}
changeodd=n/2 - maxodd;
changeeven=n/2 - maxeven;
change=changeodd+changeeven;
printf("%d\n",change);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211142/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211142/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%v = alloca [100005 x i32], align 16
%odd = alloca [100005 x i32], align 16
%even = alloca [100005 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %odd) #5
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %even) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400020) %even, i8 0, i64 400020, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400020) %odd, i8 0, i64 400020, i1 false), !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp4151 = icmp sgt i32 %0, 0
br i1 %cmp4151, label %for.body5, label %if.then80.thread
for.cond37.preheader: ; preds = %for.inc34
%cmp38.not157 = icmp slt i32 %maxvaleven.1, 1
br i1 %cmp38.not157, label %for.cond58.preheader, label %for.body39.preheader
for.body39.preheader: ; preds = %for.cond37.preheader
%1 = zext i32 %maxvaleven.1 to i64
%xtraiter = and i64 %1, 1
%2 = icmp eq i32 %maxvaleven.1, 1
br i1 %2, label %for.cond58.preheader.loopexit.unr-lcssa, label %for.body39.preheader.new
for.body39.preheader.new: ; preds = %for.body39.preheader
%unroll_iter = and i64 %1, 4294967294
br label %for.body39
for.body5: ; preds = %entry, %for.inc34
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc34 ], [ 0, %entry ]
%maxvalodd.0153 = phi i32 [ %maxvalodd.1, %for.inc34 ], [ 0, %entry ]
%maxvaleven.0152 = phi i32 [ %maxvaleven.1, %for.inc34 ], [ 0, %entry ]
%arrayidx7 = getelementptr inbounds [100005 x i32], ptr %v, i64 0, i64 %indvars.iv
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%rem184 = and i64 %indvars.iv, 1
%cmp9 = icmp eq i64 %rem184, 0
%3 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%idxprom12 = sext i32 %3 to i64
br i1 %cmp9, label %if.then, label %if.else
if.then: ; preds = %for.body5
%arrayidx13 = getelementptr inbounds [100005 x i32], ptr %even, i64 0, i64 %idxprom12
%4 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%inc14 = add nsw i32 %4, 1
store i32 %inc14, ptr %arrayidx13, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %3, i32 %maxvaleven.0152)
br label %for.inc34
if.else: ; preds = %for.body5
%arrayidx24 = getelementptr inbounds [100005 x i32], ptr %odd, i64 0, i64 %idxprom12
%5 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%inc25 = add nsw i32 %5, 1
store i32 %inc25, ptr %arrayidx24, align 4, !tbaa !5
%spec.select147 = call i32 @llvm.smax.i32(i32 %3, i32 %maxvalodd.0153)
br label %for.inc34
for.inc34: ; preds = %if.else, %if.then
%maxvaleven.1 = phi i32 [ %spec.select, %if.then ], [ %maxvaleven.0152, %if.else ]
%maxvalodd.1 = phi i32 [ %maxvalodd.0153, %if.then ], [ %spec.select147, %if.else ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp4 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp4, label %for.body5, label %for.cond37.preheader, !llvm.loop !9
for.cond58.preheader.loopexit.unr-lcssa: ; preds = %for.body39, %for.body39.preheader
%maxeven.1.lcssa.ph = phi i32 [ undef, %for.body39.preheader ], [ %maxeven.1.1, %for.body39 ]
%maxevenindex.1.lcssa.ph = phi i32 [ undef, %for.body39.preheader ], [ %maxevenindex.1.1, %for.body39 ]
%.lcssa.ph = phi i32 [ undef, %for.body39.preheader ], [ %18, %for.body39 ]
%indvars.iv176.unr = phi i64 [ 1, %for.body39.preheader ], [ %indvars.iv.next177.1, %for.body39 ]
%maxevenold.0160.unr = phi i32 [ -1, %for.body39.preheader ], [ %18, %for.body39 ]
%maxevenindex.0159.unr = phi i32 [ -1, %for.body39.preheader ], [ %maxevenindex.1.1, %for.body39 ]
%maxeven.0158.unr = phi i32 [ -1, %for.body39.preheader ], [ %maxeven.1.1, %for.body39 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond58.preheader, label %for.body39.epil
for.body39.epil: ; preds = %for.cond58.preheader.loopexit.unr-lcssa
%arrayidx41.epil = getelementptr inbounds [100005 x i32], ptr %even, i64 0, i64 %indvars.iv176.unr
%8 = load i32, ptr %arrayidx41.epil, align 4, !tbaa !5
%cmp42.not.epil = icmp slt i32 %8, %maxeven.0158.unr
%spec.select148.epil = call i32 @llvm.smax.i32(i32 %8, i32 %maxevenold.0160.unr)
%maxeven.1.epil = call i32 @llvm.smax.i32(i32 %8, i32 %maxeven.0158.unr)
%9 = trunc i64 %indvars.iv176.unr to i32
%maxevenindex.1.epil = select i1 %cmp42.not.epil, i32 %maxevenindex.0159.unr, i32 %9
%maxevenold.1.epil = select i1 %cmp42.not.epil, i32 %spec.select148.epil, i32 %maxeven.0158.unr
%10 = freeze i32 %maxevenold.1.epil
br label %for.cond58.preheader
for.cond58.preheader: ; preds = %for.body39.epil, %for.cond58.preheader.loopexit.unr-lcssa, %for.cond37.preheader
%maxeven.0.lcssa = phi i32 [ -1, %for.cond37.preheader ], [ %maxeven.1.lcssa.ph, %for.cond58.preheader.loopexit.unr-lcssa ], [ %maxeven.1.epil, %for.body39.epil ]
%maxevenindex.0.lcssa = phi i32 [ -1, %for.cond37.preheader ], [ %maxevenindex.1.lcssa.ph, %for.cond58.preheader.loopexit.unr-lcssa ], [ %maxevenindex.1.epil, %for.body39.epil ]
%maxevenold.0.lcssa = phi i32 [ -1, %for.cond37.preheader ], [ %.lcssa.ph, %for.cond58.preheader.loopexit.unr-lcssa ], [ %10, %for.body39.epil ]
%cmp59.not165 = icmp slt i32 %maxvalodd.1, 1
br i1 %cmp59.not165, label %for.end78, label %for.body60.preheader
for.body60.preheader: ; preds = %for.cond58.preheader
%11 = zext i32 %maxvalodd.1 to i64
%xtraiter236 = and i64 %11, 1
%12 = icmp eq i32 %maxvalodd.1, 1
br i1 %12, label %for.end78.loopexit.unr-lcssa, label %for.body60.preheader.new
for.body60.preheader.new: ; preds = %for.body60.preheader
%unroll_iter241 = and i64 %11, 4294967294
br label %for.body60
for.body39: ; preds = %for.body39, %for.body39.preheader.new
%indvars.iv176 = phi i64 [ 1, %for.body39.preheader.new ], [ %indvars.iv.next177.1, %for.body39 ]
%maxevenold.0160 = phi i32 [ -1, %for.body39.preheader.new ], [ %18, %for.body39 ]
%maxevenindex.0159 = phi i32 [ -1, %for.body39.preheader.new ], [ %maxevenindex.1.1, %for.body39 ]
%maxeven.0158 = phi i32 [ -1, %for.body39.preheader.new ], [ %maxeven.1.1, %for.body39 ]
%niter = phi i64 [ 0, %for.body39.preheader.new ], [ %niter.next.1, %for.body39 ]
%arrayidx41 = getelementptr inbounds [100005 x i32], ptr %even, i64 0, i64 %indvars.iv176
%13 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%cmp42.not = icmp slt i32 %13, %maxeven.0158
%spec.select148 = call i32 @llvm.smax.i32(i32 %13, i32 %maxevenold.0160)
%maxeven.1 = call i32 @llvm.smax.i32(i32 %13, i32 %maxeven.0158)
%14 = trunc i64 %indvars.iv176 to i32
%maxevenindex.1 = select i1 %cmp42.not, i32 %maxevenindex.0159, i32 %14
%maxevenold.1 = select i1 %cmp42.not, i32 %spec.select148, i32 %maxeven.0158
%15 = freeze i32 %maxevenold.1
%indvars.iv.next177 = add nuw nsw i64 %indvars.iv176, 1
%arrayidx41.1 = getelementptr inbounds [100005 x i32], ptr %even, i64 0, i64 %indvars.iv.next177
%16 = load i32, ptr %arrayidx41.1, align 4, !tbaa !5
%cmp42.not.1 = icmp slt i32 %16, %maxeven.1
%spec.select148.1 = call i32 @llvm.smax.i32(i32 %16, i32 %15)
%maxeven.1.1 = call i32 @llvm.smax.i32(i32 %16, i32 %maxeven.1)
%17 = trunc i64 %indvars.iv.next177 to i32
%maxevenindex.1.1 = select i1 %cmp42.not.1, i32 %maxevenindex.1, i32 %17
%maxevenold.1.1 = select i1 %cmp42.not.1, i32 %spec.select148.1, i32 %maxeven.1
%18 = freeze i32 %maxevenold.1.1
%indvars.iv.next177.1 = add nuw nsw i64 %indvars.iv176, 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.cond58.preheader.loopexit.unr-lcssa, label %for.body39, !llvm.loop !11
for.body60: ; preds = %for.body60, %for.body60.preheader.new
%indvars.iv179 = phi i64 [ 1, %for.body60.preheader.new ], [ %indvars.iv.next180.1, %for.body60 ]
%maxoddold.0168 = phi i32 [ -1, %for.body60.preheader.new ], [ %maxoddold.1.1, %for.body60 ]
%maxoddindex.0167 = phi i32 [ -1, %for.body60.preheader.new ], [ %maxoddindex.1.1, %for.body60 ]
%maxodd.0166 = phi i32 [ -1, %for.body60.preheader.new ], [ %maxodd.1.1, %for.body60 ]
%niter242 = phi i64 [ 0, %for.body60.preheader.new ], [ %niter242.next.1, %for.body60 ]
%arrayidx62 = getelementptr inbounds [100005 x i32], ptr %odd, i64 0, i64 %indvars.iv179
%19 = load i32, ptr %arrayidx62, align 4, !tbaa !5
%cmp63.not = icmp slt i32 %19, %maxodd.0166
%spec.select149 = call i32 @llvm.smax.i32(i32 %19, i32 %maxoddold.0168)
%maxodd.1 = call i32 @llvm.smax.i32(i32 %19, i32 %maxodd.0166)
%20 = trunc i64 %indvars.iv179 to i32
%maxoddindex.1 = select i1 %cmp63.not, i32 %maxoddindex.0167, i32 %20
%maxoddold.1 = select i1 %cmp63.not, i32 %spec.select149, i32 %maxodd.0166
%indvars.iv.next180 = add nuw nsw i64 %indvars.iv179, 1
%arrayidx62.1 = getelementptr inbounds [100005 x i32], ptr %odd, i64 0, i64 %indvars.iv.next180
%21 = load i32, ptr %arrayidx62.1, align 4, !tbaa !5
%cmp63.not.1 = icmp slt i32 %21, %maxodd.1
%spec.select149.1 = call i32 @llvm.smax.i32(i32 %21, i32 %maxoddold.1)
%maxodd.1.1 = call i32 @llvm.smax.i32(i32 %21, i32 %maxodd.1)
%22 = trunc i64 %indvars.iv.next180 to i32
%maxoddindex.1.1 = select i1 %cmp63.not.1, i32 %maxoddindex.1, i32 %22
%maxoddold.1.1 = select i1 %cmp63.not.1, i32 %spec.select149.1, i32 %maxodd.1
%indvars.iv.next180.1 = add nuw nsw i64 %indvars.iv179, 2
%niter242.next.1 = add i64 %niter242, 2
%niter242.ncmp.1 = icmp eq i64 %niter242.next.1, %unroll_iter241
br i1 %niter242.ncmp.1, label %for.end78.loopexit.unr-lcssa, label %for.body60, !llvm.loop !12
for.end78.loopexit.unr-lcssa: ; preds = %for.body60, %for.body60.preheader
%maxodd.1.lcssa.ph = phi i32 [ undef, %for.body60.preheader ], [ %maxodd.1.1, %for.body60 ]
%maxoddindex.1.lcssa.ph = phi i32 [ undef, %for.body60.preheader ], [ %maxoddindex.1.1, %for.body60 ]
%maxoddold.1.lcssa.ph = phi i32 [ undef, %for.body60.preheader ], [ %maxoddold.1.1, %for.body60 ]
%indvars.iv179.unr = phi i64 [ 1, %for.body60.preheader ], [ %indvars.iv.next180.1, %for.body60 ]
%maxoddold.0168.unr = phi i32 [ -1, %for.body60.preheader ], [ %maxoddold.1.1, %for.body60 ]
%maxoddindex.0167.unr = phi i32 [ -1, %for.body60.preheader ], [ %maxoddindex.1.1, %for.body60 ]
%maxodd.0166.unr = phi i32 [ -1, %for.body60.preheader ], [ %maxodd.1.1, %for.body60 ]
%lcmp.mod237.not = icmp eq i64 %xtraiter236, 0
br i1 %lcmp.mod237.not, label %for.end78, label %for.body60.epil
for.body60.epil: ; preds = %for.end78.loopexit.unr-lcssa
%arrayidx62.epil = getelementptr inbounds [100005 x i32], ptr %odd, i64 0, i64 %indvars.iv179.unr
%23 = load i32, ptr %arrayidx62.epil, align 4, !tbaa !5
%cmp63.not.epil = icmp slt i32 %23, %maxodd.0166.unr
%spec.select149.epil = call i32 @llvm.smax.i32(i32 %23, i32 %maxoddold.0168.unr)
%maxodd.1.epil = call i32 @llvm.smax.i32(i32 %23, i32 %maxodd.0166.unr)
%24 = trunc i64 %indvars.iv179.unr to i32
%maxoddindex.1.epil = select i1 %cmp63.not.epil, i32 %maxoddindex.0167.unr, i32 %24
%maxoddold.1.epil = select i1 %cmp63.not.epil, i32 %spec.select149.epil, i32 %maxodd.0166.unr
br label %for.end78
for.end78: ; preds = %for.body60.epil, %for.end78.loopexit.unr-lcssa, %for.cond58.preheader
%maxodd.0.lcssa = phi i32 [ -1, %for.cond58.preheader ], [ %maxodd.1.lcssa.ph, %for.end78.loopexit.unr-lcssa ], [ %maxodd.1.epil, %for.body60.epil ]
%maxoddindex.0.lcssa = phi i32 [ -1, %for.cond58.preheader ], [ %maxoddindex.1.lcssa.ph, %for.end78.loopexit.unr-lcssa ], [ %maxoddindex.1.epil, %for.body60.epil ]
%maxoddold.0.lcssa = phi i32 [ -1, %for.cond58.preheader ], [ %maxoddold.1.lcssa.ph, %for.end78.loopexit.unr-lcssa ], [ %maxoddold.1.epil, %for.body60.epil ]
%cmp79 = icmp eq i32 %maxoddindex.0.lcssa, %maxevenindex.0.lcssa
br i1 %cmp79, label %if.then80, label %if.end92
if.then80: ; preds = %for.end78
%cmp81 = icmp eq i32 %maxevenold.0.lcssa, -1
br i1 %cmp81, label %if.then80.thread, label %25
if.then80.thread: ; preds = %entry, %if.then80
%maxeven.0.lcssa198210230 = phi i32 [ %maxeven.0.lcssa, %if.then80 ], [ -1, %entry ]
%.lcssa190197212228 = phi i32 [ %6, %if.then80 ], [ %0, %entry ]
%maxodd.0.lcssa213226 = phi i32 [ %maxodd.0.lcssa, %if.then80 ], [ -1, %entry ]
%maxoddold.0.lcssa214224 = phi i32 [ %maxoddold.0.lcssa, %if.then80 ], [ -1, %entry ]
br label %25
25: ; preds = %if.then80, %if.then80.thread
%maxeven.0.lcssa198210229 = phi i32 [ %maxeven.0.lcssa198210230, %if.then80.thread ], [ %maxeven.0.lcssa, %if.then80 ]
%.lcssa190197212227 = phi i32 [ %.lcssa190197212228, %if.then80.thread ], [ %6, %if.then80 ]
%maxodd.0.lcssa213225 = phi i32 [ %maxodd.0.lcssa213226, %if.then80.thread ], [ %maxodd.0.lcssa, %if.then80 ]
%maxoddold.0.lcssa214223 = phi i32 [ %maxoddold.0.lcssa214224, %if.then80.thread ], [ %maxoddold.0.lcssa, %if.then80 ]
%26 = phi i32 [ 0, %if.then80.thread ], [ %maxevenold.0.lcssa, %if.then80 ]
%maxoddold.0.lcssa214223.fr = freeze i32 %maxoddold.0.lcssa214223
%cmp84 = icmp eq i32 %maxoddold.0.lcssa214223.fr, -1
%spec.select231 = select i1 %cmp84, i32 0, i32 %maxoddold.0.lcssa214223.fr
%add = add nsw i32 %maxodd.0.lcssa213225, %26
%add87 = add nsw i32 %spec.select231, %maxeven.0.lcssa198210229
%cmp88 = icmp sgt i32 %add, %add87
%spec.store.select.maxeven.0 = select i1 %cmp88, i32 %26, i32 %maxeven.0.lcssa198210229
%maxodd.0.spec.store.select97 = select i1 %cmp88, i32 %maxodd.0.lcssa213225, i32 %spec.select231
br label %if.end92
if.end92: ; preds = %25, %for.end78
%.lcssa190197211 = phi i32 [ %6, %for.end78 ], [ %.lcssa190197212227, %25 ]
%maxeven.2 = phi i32 [ %maxeven.0.lcssa, %for.end78 ], [ %spec.store.select.maxeven.0, %25 ]
%maxodd.2 = phi i32 [ %maxodd.0.lcssa, %for.end78 ], [ %maxodd.0.spec.store.select97, %25 ]
%div = sdiv i32 %.lcssa190197211, 2
%factor = shl nsw i32 %div, 1
%27 = add i32 %maxeven.2, %maxodd.2
%add95 = sub i32 %factor, %27
%call96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add95)
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %even) #5
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %odd) #5
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
#include<string.h>
typedef int32_t flow_type;
const flow_type flow_inf = 200;
typedef struct flow_edge {
int32_t vertex;
int32_t next;
flow_type capacity;
} flow_edge;
typedef struct maxFlowGraph {
flow_edge *edge;
int32_t *start;
int32_t vertex_num;
int32_t pointer;
int32_t edge_length;
} graph;
graph* new_graph (const int32_t vertex_num) {
graph *g = (graph *) calloc (1, sizeof (graph));
g->vertex_num = vertex_num;
const int32_t initial_length = 4;
g->edge = (flow_edge *) calloc (initial_length, sizeof (flow_edge));
g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t));
g->pointer = 0;
g->edge_length = initial_length;
for (int32_t i = 0; i < vertex_num; ++i) {
g->start[i] = -1;
}
return g;
}
void free_graph (graph * const g) {
free (g->edge);
free (g->start);
free (g);
}
void add_edge (graph * const g, const int32_t from, const int32_t to, const flow_type capa) {
if (g->pointer == g->edge_length) {
g->edge_length *= 2;
g->edge = (flow_edge *) realloc (g->edge, sizeof (flow_edge) * g->edge_length);
}
const int32_t p = g->pointer;
g->edge[p] = (flow_edge) {to, g->start[from], capa};
g->start[from] = p;
g->edge[p + 1] = (flow_edge) {from, g->start[to], 0};
g->start[to] = p + 1;
g->pointer += 2;
}
flow_type dinic_dfs (const int32_t v, graph * const g, const int32_t dst, const int32_t * const level, int32_t * const iter, flow_type e) {
if (v == dst) return e;
flow_type sum = 0;
for (int32_t p = iter[v]; p != -1; p = g->edge[p].next, iter[v] = p) {
const int32_t u = g->edge[p].vertex;
const flow_type capa = g->edge[p].capacity;
if (level[u] <= level[v] || capa <= 0) continue;
const flow_type f = dinic_dfs (u, g, dst, level, iter, capa < e ? capa : e);
if (f > 0) {
g->edge[p].capacity -= f;
g->edge[p ^ 1].capacity += f;
sum += f;
e -= f;
if (e <= 0) return sum;
}
}
return sum;
}
flow_type dinic (graph * const g, const int32_t src, const int32_t dst) {
const int32_t vertex_num = g->vertex_num;
int32_t * const level = (int32_t *) calloc (vertex_num, sizeof (int32_t));
int32_t * const queue = (int32_t *) calloc (vertex_num, sizeof (int32_t));
int32_t * const iter = (int32_t *) calloc (vertex_num, sizeof (int32_t));
flow_type flow = 0;
while (1) {
memset (level, 0, sizeof (int32_t) * vertex_num);
level[dst] = vertex_num;
int32_t front = 0;
int32_t last = 0;
queue[last++] = dst;
while (front < last && level[src] == 0) {
const int32_t v = queue[front++];
for (int32_t p = g->start[v]; p != -1; p = g->edge[p].next) {
const int32_t u = g->edge[p].vertex;
if (g->edge[p^1].capacity > 0 && level[u] == 0) {
level[u] = level[v] - 1;
queue[last++] = u;
}
}
}
if (level[src] == 0) break;
memcpy (iter, g->start, sizeof (int32_t) * vertex_num);
while (1) {
flow_type f = dinic_dfs (src, g, dst, level, iter, flow_inf);
if (f <= 0) break;
flow += f;
}
}
free (level);
free (queue);
free (iter);
return flow;
}
typedef int32_t i32;
void run (void) {
i32 h, w;
scanf ("%" SCNi32 "%" SCNi32, &h, &w);
char *a = (char *) calloc (h * w + 1, sizeof (char));
for (i32 i = 0; i < h; ++i) {
scanf ("%s", a + i * w);
}
graph *g = new_graph (2 * h * w);
i32 src = -1;
i32 dst = -1;
for (i32 i = 0; i < h; ++i) {
for (i32 j = 0; j < w; ++j) {
if (a[i * w + j] == '.') continue;
if (a[i * w + j] == 'S') {
src = i * w + j;
add_edge (g, h * w + i * w + j, i * w + j, flow_inf);
} else if (a[i * w + j] == 'T') {
dst = i * w + j;
add_edge (g, h * w + i * w + j, i * w + j, flow_inf);
} else {
add_edge (g, h * w + i * w + j, i * w + j, 1);
}
for (i32 k = 0; k < h; ++k) {
if (k == i || a[k * w + j] == '.') continue;
add_edge (g, i * w + j, h * w + k * w + j, flow_inf);
}
for (i32 k = 0; k < w; ++k) {
if (k == j || a[i * w + k] == '.') continue;
add_edge (g, i * w + j, h * w + i * w + k, flow_inf);
}
}
}
i32 ans = dinic (g, src, dst);
if (ans >= flow_inf) {
puts("-1");
} else {
printf ("%" PRIi32 "\n",ans);
}
}
int main (void) {
run ();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211193/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211193/source.c"
target datalayout = "e-m:e-p270: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.maxFlowGraph = type { ptr, ptr, i32, i32, i32 }
%struct.flow_edge = type { i32, i32, i32 }
@flow_inf = dso_local local_unnamed_addr constant i32 200, align 4
@.str = private unnamed_addr constant [5 x i8] c"%i%i\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%i\0A\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @new_graph(i32 noundef %vertex_num) local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(32) ptr @calloc(i64 noundef 1, i64 noundef 32) #12
%vertex_num1 = getelementptr inbounds %struct.maxFlowGraph, ptr %call, i64 0, i32 2
store i32 %vertex_num, ptr %vertex_num1, align 8, !tbaa !5
%call2 = tail call noalias dereferenceable_or_null(48) ptr @calloc(i64 noundef 4, i64 noundef 12) #12
store ptr %call2, ptr %call, align 8, !tbaa !11
%conv = sext i32 %vertex_num to i64
%call3 = tail call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #12
%start = getelementptr inbounds %struct.maxFlowGraph, ptr %call, i64 0, i32 1
store ptr %call3, ptr %start, align 8, !tbaa !12
%edge_length = getelementptr inbounds %struct.maxFlowGraph, ptr %call, i64 0, i32 4
store i32 4, ptr %edge_length, align 8, !tbaa !13
%cmp16 = icmp sgt i32 %vertex_num, 0
br i1 %cmp16, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = zext i32 %vertex_num to i64
%1 = shl nuw nsw i64 %0, 2
tail call void @llvm.memset.p0.i64(ptr align 4 %call3, i8 -1, i64 %1, i1 false), !tbaa !14
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body.preheader, %entry
ret ptr %call
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nounwind willreturn uwtable
define dso_local void @free_graph(ptr nocapture noundef %g) local_unnamed_addr #3 {
entry:
%0 = load ptr, ptr %g, align 8, !tbaa !11
tail call void @free(ptr noundef %0) #13
%start = getelementptr inbounds %struct.maxFlowGraph, ptr %g, i64 0, i32 1
%1 = load ptr, ptr %start, align 8, !tbaa !12
tail call void @free(ptr noundef %1) #13
tail call void @free(ptr noundef %g) #13
ret void
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nounwind willreturn uwtable
define dso_local void @add_edge(ptr nocapture noundef %g, i32 noundef %from, i32 noundef %to, i32 noundef %capa) local_unnamed_addr #3 {
entry:
%pointer = getelementptr inbounds %struct.maxFlowGraph, ptr %g, i64 0, i32 3
%0 = load i32, ptr %pointer, align 4, !tbaa !15
%edge_length = getelementptr inbounds %struct.maxFlowGraph, ptr %g, i64 0, i32 4
%1 = load i32, ptr %edge_length, align 8, !tbaa !13
%cmp = icmp eq i32 %0, %1
%.pre48 = load ptr, ptr %g, align 8, !tbaa !11
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%mul = shl nsw i32 %0, 1
store i32 %mul, ptr %edge_length, align 8, !tbaa !13
%conv = sext i32 %mul to i64
%mul3 = mul nsw i64 %conv, 12
%call = tail call ptr @realloc(ptr noundef %.pre48, i64 noundef %mul3) #14
store ptr %call, ptr %g, align 8, !tbaa !11
%.pre = load i32, ptr %pointer, align 4, !tbaa !15
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi ptr [ %call, %if.then ], [ %.pre48, %entry ]
%3 = phi i32 [ %.pre, %if.then ], [ %0, %entry ]
%idxprom = sext i32 %3 to i64
%arrayidx = getelementptr inbounds %struct.flow_edge, ptr %2, i64 %idxprom
%start = getelementptr inbounds %struct.maxFlowGraph, ptr %g, i64 0, i32 1
%4 = load ptr, ptr %start, align 8, !tbaa !12
%idxprom7 = sext i32 %from to i64
%arrayidx8 = getelementptr inbounds i32, ptr %4, i64 %idxprom7
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !14
store i32 %to, ptr %arrayidx, align 4, !tbaa.struct !16
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 4
store i32 %5, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx, align 4, !tbaa.struct !17
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 8
store i32 %capa, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx, align 4, !tbaa.struct !18
%6 = load ptr, ptr %start, align 8, !tbaa !12
%arrayidx11 = getelementptr inbounds i32, ptr %6, i64 %idxprom7
store i32 %3, ptr %arrayidx11, align 4, !tbaa !14
%7 = load ptr, ptr %g, align 8, !tbaa !11
%add = add nsw i32 %3, 1
%idxprom13 = sext i32 %add to i64
%arrayidx14 = getelementptr inbounds %struct.flow_edge, ptr %7, i64 %idxprom13
%idxprom19 = sext i32 %to to i64
%arrayidx20 = getelementptr inbounds i32, ptr %6, i64 %idxprom19
%8 = load i32, ptr %arrayidx20, align 4, !tbaa !14
store i32 %from, ptr %arrayidx14, align 4, !tbaa.struct !16
%.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx = getelementptr inbounds i8, ptr %arrayidx14, i64 4
store i32 %8, ptr %.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx, align 4, !tbaa.struct !17
%.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx = getelementptr inbounds i8, ptr %arrayidx14, i64 8
store i32 0, ptr %.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx, align 4, !tbaa.struct !18
%9 = load ptr, ptr %start, align 8, !tbaa !12
%arrayidx25 = getelementptr inbounds i32, ptr %9, i64 %idxprom19
store i32 %add, ptr %arrayidx25, align 4, !tbaa !14
%10 = load i32, ptr %pointer, align 4, !tbaa !15
%add27 = add nsw i32 %10, 2
store i32 %add27, ptr %pointer, align 4, !tbaa !15
ret void
}
; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @dinic_dfs(i32 noundef %v, ptr nocapture noundef readonly %g, i32 noundef %dst, ptr nocapture noundef readonly %level, ptr nocapture noundef %iter, i32 noundef %e) local_unnamed_addr #7 {
entry:
%cmp = icmp eq i32 %v, %dst
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom = sext i32 %v to i64
%arrayidx = getelementptr inbounds i32, ptr %iter, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !14
%cmp1.not83 = icmp eq i32 %0, -1
br i1 %cmp1.not83, label %return, label %for.body.lr.ph
for.body.lr.ph: ; preds = %if.end
%arrayidx10 = getelementptr inbounds i32, ptr %level, i64 %idxprom
%.pre = load ptr, ptr %g, align 8, !tbaa !11
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%1 = phi ptr [ %.pre, %for.body.lr.ph ], [ %8, %for.inc ]
%e.addr.086 = phi i32 [ %e, %for.body.lr.ph ], [ %e.addr.3.ph, %for.inc ]
%sum.085 = phi i32 [ 0, %for.body.lr.ph ], [ %sum.3.ph, %for.inc ]
%p.084 = phi i32 [ %0, %for.body.lr.ph ], [ %9, %for.inc ]
%idxprom2 = sext i32 %p.084 to i64
%arrayidx3 = getelementptr inbounds %struct.flow_edge, ptr %1, i64 %idxprom2
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !19
%capacity = getelementptr inbounds %struct.flow_edge, ptr %1, i64 %idxprom2, i32 2
%3 = load i32, ptr %capacity, align 4, !tbaa !21
%idxprom7 = sext i32 %2 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %level, i64 %idxprom7
%4 = load i32, ptr %arrayidx8, align 4, !tbaa !14
%5 = load i32, ptr %arrayidx10, align 4, !tbaa !14
%cmp11 = icmp sle i32 %4, %5
%cmp12 = icmp slt i32 %3, 1
%or.cond = select i1 %cmp11, i1 true, i1 %cmp12
br i1 %or.cond, label %for.inc, label %if.end14
if.end14: ; preds = %for.body
%cond = tail call i32 @llvm.smin.i32(i32 %3, i32 %e.addr.086)
%call = tail call i32 @dinic_dfs(i32 noundef %2, ptr noundef nonnull %g, i32 noundef %dst, ptr noundef nonnull %level, ptr noundef nonnull %iter, i32 noundef %cond)
%cmp16 = icmp sgt i32 %call, 0
%.pre88 = load ptr, ptr %g, align 8, !tbaa !11
br i1 %cmp16, label %if.then17, label %for.inc
if.then17: ; preds = %if.end14
%capacity21 = getelementptr inbounds %struct.flow_edge, ptr %.pre88, i64 %idxprom2, i32 2
%6 = load i32, ptr %capacity21, align 4, !tbaa !21
%sub = sub nsw i32 %6, %call
store i32 %sub, ptr %capacity21, align 4, !tbaa !21
%xor = xor i32 %p.084, 1
%idxprom23 = sext i32 %xor to i64
%capacity25 = getelementptr inbounds %struct.flow_edge, ptr %.pre88, i64 %idxprom23, i32 2
%7 = load i32, ptr %capacity25, align 4, !tbaa !21
%add = add nsw i32 %7, %call
store i32 %add, ptr %capacity25, align 4, !tbaa !21
%add26 = add nsw i32 %call, %sum.085
%sub27 = sub nsw i32 %e.addr.086, %call
%cmp28 = icmp slt i32 %sub27, 1
br i1 %cmp28, label %return, label %for.inc
for.inc: ; preds = %if.end14, %if.then17, %for.body
%8 = phi ptr [ %1, %for.body ], [ %.pre88, %if.then17 ], [ %.pre88, %if.end14 ]
%sum.3.ph = phi i32 [ %sum.085, %for.body ], [ %add26, %if.then17 ], [ %sum.085, %if.end14 ]
%e.addr.3.ph = phi i32 [ %e.addr.086, %for.body ], [ %sub27, %if.then17 ], [ %e.addr.086, %if.end14 ]
%next = getelementptr inbounds %struct.flow_edge, ptr %8, i64 %idxprom2, i32 1
%9 = load i32, ptr %next, align 4, !tbaa !22
store i32 %9, ptr %arrayidx, align 4, !tbaa !14
%cmp1.not = icmp eq i32 %9, -1
br i1 %cmp1.not, label %return, label %for.body, !llvm.loop !23
return: ; preds = %if.then17, %for.inc, %if.end, %entry
%retval.5 = phi i32 [ %e, %entry ], [ 0, %if.end ], [ %add26, %if.then17 ], [ %sum.3.ph, %for.inc ]
ret i32 %retval.5
}
; Function Attrs: nounwind uwtable
define dso_local i32 @dinic(ptr nocapture noundef readonly %g, i32 noundef %src, i32 noundef %dst) local_unnamed_addr #8 {
entry:
%vertex_num1 = getelementptr inbounds %struct.maxFlowGraph, ptr %g, i64 0, i32 2
%0 = load i32, ptr %vertex_num1, align 8, !tbaa !5
%conv = sext i32 %0 to i64
%call = tail call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #12
%call3 = tail call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #12
%call5 = tail call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #12
%mul = shl nsw i64 %conv, 2
%idxprom = sext i32 %dst to i64
%arrayidx = getelementptr inbounds i32, ptr %call, i64 %idxprom
%idxprom11 = sext i32 %src to i64
%arrayidx12 = getelementptr inbounds i32, ptr %call, i64 %idxprom11
%start = getelementptr inbounds %struct.maxFlowGraph, ptr %g, i64 0, i32 1
br label %while.cond
while.cond: ; preds = %while.cond53, %entry
%flow.0 = phi i32 [ 0, %entry ], [ %flow.1, %while.cond53 ]
tail call void @llvm.memset.p0.i64(ptr align 4 %call, i8 0, i64 %mul, i1 false)
store i32 %0, ptr %arrayidx, align 4, !tbaa !14
store i32 %dst, ptr %call3, align 4, !tbaa !14
br label %land.rhs
while.cond9.loopexit: ; preds = %if.end, %while.body15
%last.1.lcssa = phi i32 [ %last.0119, %while.body15 ], [ %last.2, %if.end ]
%1 = sext i32 %last.1.lcssa to i64
%cmp = icmp slt i64 %indvars.iv.next, %1
br i1 %cmp, label %land.rhs, label %while.end, !llvm.loop !25
land.rhs: ; preds = %while.cond, %while.cond9.loopexit
%indvars.iv = phi i64 [ 0, %while.cond ], [ %indvars.iv.next, %while.cond9.loopexit ]
%last.0119 = phi i32 [ 1, %while.cond ], [ %last.1.lcssa, %while.cond9.loopexit ]
%2 = load i32, ptr %arrayidx12, align 4, !tbaa !14
%cmp13 = icmp eq i32 %2, 0
br i1 %cmp13, label %while.body15, label %if.end49
while.body15: ; preds = %land.rhs
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx18 = getelementptr inbounds i32, ptr %call3, i64 %indvars.iv
%3 = load i32, ptr %arrayidx18, align 4, !tbaa !14
%4 = load ptr, ptr %start, align 8, !tbaa !12
%idxprom19 = sext i32 %3 to i64
%arrayidx20 = getelementptr inbounds i32, ptr %4, i64 %idxprom19
%p.0115 = load i32, ptr %arrayidx20, align 4, !tbaa !14
%cmp21.not116 = icmp eq i32 %p.0115, -1
br i1 %cmp21.not116, label %while.cond9.loopexit, label %for.body.lr.ph
for.body.lr.ph: ; preds = %while.body15
%5 = load ptr, ptr %g, align 8, !tbaa !11
%arrayidx35 = getelementptr inbounds i32, ptr %call, i64 %idxprom19
br label %for.body
for.body: ; preds = %for.body.lr.ph, %if.end
%p.0118 = phi i32 [ %p.0115, %for.body.lr.ph ], [ %p.0, %if.end ]
%last.1117 = phi i32 [ %last.0119, %for.body.lr.ph ], [ %last.2, %if.end ]
%idxprom23 = sext i32 %p.0118 to i64
%arrayidx24 = getelementptr inbounds %struct.flow_edge, ptr %5, i64 %idxprom23
%6 = load i32, ptr %arrayidx24, align 4, !tbaa !19
%xor = xor i32 %p.0118, 1
%idxprom26 = sext i32 %xor to i64
%capacity = getelementptr inbounds %struct.flow_edge, ptr %5, i64 %idxprom26, i32 2
%7 = load i32, ptr %capacity, align 4, !tbaa !21
%cmp28 = icmp sgt i32 %7, 0
br i1 %cmp28, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %for.body
%idxprom30 = sext i32 %6 to i64
%arrayidx31 = getelementptr inbounds i32, ptr %call, i64 %idxprom30
%8 = load i32, ptr %arrayidx31, align 4, !tbaa !14
%cmp32 = icmp eq i32 %8, 0
br i1 %cmp32, label %if.then, label %if.end
if.then: ; preds = %land.lhs.true
%9 = load i32, ptr %arrayidx35, align 4, !tbaa !14
%sub = add nsw i32 %9, -1
store i32 %sub, ptr %arrayidx31, align 4, !tbaa !14
%inc38 = add nsw i32 %last.1117, 1
%idxprom39 = sext i32 %last.1117 to i64
%arrayidx40 = getelementptr inbounds i32, ptr %call3, i64 %idxprom39
store i32 %6, ptr %arrayidx40, align 4, !tbaa !14
br label %if.end
if.end: ; preds = %if.then, %land.lhs.true, %for.body
%last.2 = phi i32 [ %inc38, %if.then ], [ %last.1117, %land.lhs.true ], [ %last.1117, %for.body ]
%next = getelementptr inbounds %struct.flow_edge, ptr %5, i64 %idxprom23, i32 1
%p.0 = load i32, ptr %next, align 4, !tbaa !14
%cmp21.not = icmp eq i32 %p.0, -1
br i1 %cmp21.not, label %while.cond9.loopexit, label %for.body, !llvm.loop !26
while.end: ; preds = %while.cond9.loopexit
%.pre = load i32, ptr %arrayidx12, align 4, !tbaa !14
%cmp46 = icmp eq i32 %.pre, 0
br i1 %cmp46, label %while.end65, label %if.end49
if.end49: ; preds = %land.rhs, %while.end
%10 = load ptr, ptr %start, align 8, !tbaa !12
tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %call5, ptr align 4 %10, i64 %mul, i1 false)
br label %while.cond53
while.cond53: ; preds = %while.cond53, %if.end49
%flow.1 = phi i32 [ %flow.0, %if.end49 ], [ %add, %while.cond53 ]
%call55 = tail call i32 @dinic_dfs(i32 noundef %src, ptr noundef %g, i32 noundef %dst, ptr noundef %call, ptr noundef %call5, i32 noundef 200)
%cmp56 = icmp slt i32 %call55, 1
%add = add nsw i32 %call55, %flow.1
br i1 %cmp56, label %while.cond, label %while.cond53
while.end65: ; preds = %while.end
tail call void @free(ptr noundef nonnull %call) #13
tail call void @free(ptr noundef %call3) #13
tail call void @free(ptr noundef %call5) #13
ret i32 %flow.0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #9
; Function Attrs: nounwind uwtable
define dso_local void @run() local_unnamed_addr #8 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #13
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #13
%call = 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 !14
%1 = load i32, ptr %w, align 4, !tbaa !14
%mul = mul nsw i32 %1, %0
%add = add nsw i32 %mul, 1
%conv = sext i32 %add to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 1) #12
%cmp310 = icmp sgt i32 %0, 0
br i1 %cmp310, label %for.body, label %for.cond.cleanup
for.cond.cleanup.loopexit: ; preds = %for.body
%.pre = load i32, ptr %w, align 4, !tbaa !14
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
%2 = phi i32 [ %1, %entry ], [ %.pre, %for.cond.cleanup.loopexit ]
%3 = phi i32 [ %0, %entry ], [ %8, %for.cond.cleanup.loopexit ]
%mul5 = shl nsw i32 %3, 1
%mul6 = mul nsw i32 %2, %mul5
%call.i = call noalias dereferenceable_or_null(32) ptr @calloc(i64 noundef 1, i64 noundef 32) #12
%vertex_num1.i = getelementptr inbounds %struct.maxFlowGraph, ptr %call.i, i64 0, i32 2
store i32 %mul6, ptr %vertex_num1.i, align 8, !tbaa !5
%call2.i = call noalias dereferenceable_or_null(48) ptr @calloc(i64 noundef 4, i64 noundef 12) #12
store ptr %call2.i, ptr %call.i, align 8, !tbaa !11
%conv.i = sext i32 %mul6 to i64
%call3.i = call noalias ptr @calloc(i64 noundef %conv.i, i64 noundef 4) #12
%start.i = getelementptr inbounds %struct.maxFlowGraph, ptr %call.i, i64 0, i32 1
store ptr %call3.i, ptr %start.i, align 8, !tbaa !12
%edge_length.i = getelementptr inbounds %struct.maxFlowGraph, ptr %call.i, i64 0, i32 4
store i32 4, ptr %edge_length.i, align 8, !tbaa !13
%cmp16.i = icmp sgt i32 %mul6, 0
br i1 %cmp16.i, label %for.body.preheader.i, label %new_graph.exit
for.body.preheader.i: ; preds = %for.cond.cleanup
%4 = zext i32 %mul6 to i64
%5 = shl nuw nsw i64 %4, 2
call void @llvm.memset.p0.i64(ptr align 4 %call3.i, i8 -1, i64 %5, i1 false), !tbaa !14
br label %new_graph.exit
new_graph.exit: ; preds = %for.cond.cleanup, %for.body.preheader.i
%cmp10323 = icmp sgt i32 %3, 0
br i1 %cmp10323, label %for.cond14.preheader.lr.ph, label %for.cond.cleanup12
for.cond14.preheader.lr.ph: ; preds = %new_graph.exit
%pointer.i198 = getelementptr inbounds %struct.maxFlowGraph, ptr %call.i, i64 0, i32 3
%6 = icmp sgt i32 %2, 0
br i1 %6, label %for.cond14.preheader, label %for.cond.cleanup12
for.body: ; preds = %entry, %for.body
%i.0311 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%7 = load i32, ptr %w, align 4, !tbaa !14
%mul3 = mul nsw i32 %7, %i.0311
%idx.ext = sext i32 %mul3 to i64
%add.ptr = getelementptr inbounds i8, ptr %call1, i64 %idx.ext
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %add.ptr)
%inc = add nuw nsw i32 %i.0311, 1
%8 = load i32, ptr %h, align 4, !tbaa !14
%cmp = icmp slt i32 %inc, %8
br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit, !llvm.loop !27
for.cond14.preheader: ; preds = %for.cond14.preheader.lr.ph, %for.cond.cleanup17
%9 = phi i32 [ %18, %for.cond.cleanup17 ], [ %3, %for.cond14.preheader.lr.ph ]
%10 = phi i32 [ %19, %for.cond.cleanup17 ], [ %2, %for.cond14.preheader.lr.ph ]
%11 = phi i32 [ %20, %for.cond.cleanup17 ], [ 4, %for.cond14.preheader.lr.ph ]
%12 = phi i32 [ %21, %for.cond.cleanup17 ], [ 4, %for.cond14.preheader.lr.ph ]
%13 = phi i32 [ %22, %for.cond.cleanup17 ], [ 4, %for.cond14.preheader.lr.ph ]
%14 = phi i32 [ %23, %for.cond.cleanup17 ], [ 4, %for.cond14.preheader.lr.ph ]
%.pre48.i201335 = phi ptr [ %.pre48.i201332, %for.cond.cleanup17 ], [ %call2.i, %for.cond14.preheader.lr.ph ]
%15 = phi i32 [ %24, %for.cond.cleanup17 ], [ 4, %for.cond14.preheader.lr.ph ]
%16 = phi i32 [ %25, %for.cond.cleanup17 ], [ 0, %for.cond14.preheader.lr.ph ]
%17 = phi i32 [ %26, %for.cond.cleanup17 ], [ %2, %for.cond14.preheader.lr.ph ]
%i8.0326 = phi i32 [ %inc121, %for.cond.cleanup17 ], [ 0, %for.cond14.preheader.lr.ph ]
%dst.0325 = phi i32 [ %dst.1.lcssa, %for.cond.cleanup17 ], [ -1, %for.cond14.preheader.lr.ph ]
%src.0324 = phi i32 [ %src.1.lcssa, %for.cond.cleanup17 ], [ -1, %for.cond14.preheader.lr.ph ]
%cmp15316 = icmp sgt i32 %17, 0
br i1 %cmp15316, label %for.body18, label %for.cond.cleanup17
for.cond.cleanup12: ; preds = %for.cond.cleanup17, %for.cond14.preheader.lr.ph, %new_graph.exit
%src.0.lcssa = phi i32 [ -1, %new_graph.exit ], [ -1, %for.cond14.preheader.lr.ph ], [ %src.1.lcssa, %for.cond.cleanup17 ]
%dst.0.lcssa = phi i32 [ -1, %new_graph.exit ], [ -1, %for.cond14.preheader.lr.ph ], [ %dst.1.lcssa, %for.cond.cleanup17 ]
%call123 = call i32 @dinic(ptr noundef nonnull %call.i, i32 noundef %src.0.lcssa, i32 noundef %dst.0.lcssa)
%cmp124 = icmp sgt i32 %call123, 199
br i1 %cmp124, label %if.then126, label %if.else128
for.cond.cleanup17.loopexit: ; preds = %for.inc117
%.pre344 = load i32, ptr %h, align 4, !tbaa !14
br label %for.cond.cleanup17
for.cond.cleanup17: ; preds = %for.cond.cleanup17.loopexit, %for.cond14.preheader
%18 = phi i32 [ %9, %for.cond14.preheader ], [ %.pre344, %for.cond.cleanup17.loopexit ]
%19 = phi i32 [ %10, %for.cond14.preheader ], [ %119, %for.cond.cleanup17.loopexit ]
%20 = phi i32 [ %11, %for.cond14.preheader ], [ %120, %for.cond.cleanup17.loopexit ]
%21 = phi i32 [ %12, %for.cond14.preheader ], [ %121, %for.cond.cleanup17.loopexit ]
%22 = phi i32 [ %13, %for.cond14.preheader ], [ %122, %for.cond.cleanup17.loopexit ]
%23 = phi i32 [ %14, %for.cond14.preheader ], [ %123, %for.cond.cleanup17.loopexit ]
%.pre48.i201332 = phi ptr [ %.pre48.i201335, %for.cond14.preheader ], [ %.pre48.i201333, %for.cond.cleanup17.loopexit ]
%24 = phi i32 [ %15, %for.cond14.preheader ], [ %124, %for.cond.cleanup17.loopexit ]
%25 = phi i32 [ %16, %for.cond14.preheader ], [ %125, %for.cond.cleanup17.loopexit ]
%26 = phi i32 [ %17, %for.cond14.preheader ], [ %119, %for.cond.cleanup17.loopexit ]
%src.1.lcssa = phi i32 [ %src.0324, %for.cond14.preheader ], [ %src.3, %for.cond.cleanup17.loopexit ]
%dst.1.lcssa = phi i32 [ %dst.0325, %for.cond14.preheader ], [ %dst.3, %for.cond.cleanup17.loopexit ]
%inc121 = add nuw nsw i32 %i8.0326, 1
%cmp10 = icmp slt i32 %inc121, %18
br i1 %cmp10, label %for.cond14.preheader, label %for.cond.cleanup12, !llvm.loop !28
for.body18: ; preds = %for.cond14.preheader, %for.inc117
%27 = phi i32 [ %119, %for.inc117 ], [ %10, %for.cond14.preheader ]
%28 = phi i32 [ %120, %for.inc117 ], [ %11, %for.cond14.preheader ]
%29 = phi i32 [ %121, %for.inc117 ], [ %12, %for.cond14.preheader ]
%30 = phi i32 [ %122, %for.inc117 ], [ %13, %for.cond14.preheader ]
%31 = phi i32 [ %123, %for.inc117 ], [ %14, %for.cond14.preheader ]
%.pre48.i229 = phi ptr [ %.pre48.i201333, %for.inc117 ], [ %.pre48.i201335, %for.cond14.preheader ]
%32 = phi i32 [ %124, %for.inc117 ], [ %15, %for.cond14.preheader ]
%33 = phi i32 [ %125, %for.inc117 ], [ %16, %for.cond14.preheader ]
%34 = phi i32 [ %119, %for.inc117 ], [ %17, %for.cond14.preheader ]
%j.0319 = phi i32 [ %inc118, %for.inc117 ], [ 0, %for.cond14.preheader ]
%dst.1318 = phi i32 [ %dst.3, %for.inc117 ], [ %dst.0325, %for.cond14.preheader ]
%src.1317 = phi i32 [ %src.3, %for.inc117 ], [ %src.0324, %for.cond14.preheader ]
%mul19 = mul nsw i32 %34, %i8.0326
%add20 = add nsw i32 %mul19, %j.0319
%idxprom = sext i32 %add20 to i64
%arrayidx = getelementptr inbounds i8, ptr %call1, i64 %idxprom
%35 = load i8, ptr %arrayidx, align 1, !tbaa !30
switch i8 %35, label %if.else56 [
i8 46, label %for.inc117
i8 83, label %if.then31
i8 84, label %if.then47
]
if.then31: ; preds = %for.body18
%36 = load i32, ptr %h, align 4, !tbaa !14
%mul34191 = add i32 %36, %i8.0326
%add36 = mul i32 %mul34191, %34
%add37 = add nsw i32 %add36, %j.0319
%cmp.i = icmp eq i32 %33, %31
br i1 %cmp.i, label %if.then.i, label %add_edge.exit
if.then.i: ; preds = %if.then31
%mul.i = shl nsw i32 %31, 1
store i32 %mul.i, ptr %edge_length.i, align 8, !tbaa !13
%conv.i196 = sext i32 %mul.i to i64
%mul3.i = mul nsw i64 %conv.i196, 12
%call.i197 = call ptr @realloc(ptr noundef %.pre48.i229, i64 noundef %mul3.i) #14
store ptr %call.i197, ptr %call.i, align 8, !tbaa !11
br label %add_edge.exit
add_edge.exit: ; preds = %if.then31, %if.then.i
%37 = phi i32 [ %mul.i, %if.then.i ], [ %28, %if.then31 ]
%38 = phi i32 [ %mul.i, %if.then.i ], [ %29, %if.then31 ]
%39 = phi i32 [ %mul.i, %if.then.i ], [ %30, %if.then31 ]
%40 = phi i32 [ %mul.i, %if.then.i ], [ %31, %if.then31 ]
%41 = phi ptr [ %call.i197, %if.then.i ], [ %.pre48.i229, %if.then31 ]
%idxprom.i = sext i32 %33 to i64
%arrayidx.i = getelementptr inbounds %struct.flow_edge, ptr %41, i64 %idxprom.i
%idxprom7.i = sext i32 %add37 to i64
%arrayidx8.i = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom7.i
%42 = load i32, ptr %arrayidx8.i, align 4, !tbaa !14
store i32 %add20, ptr %arrayidx.i, align 4, !tbaa.struct !16
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx.i, i64 4
store i32 %42, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i, align 4, !tbaa.struct !17
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx.i, i64 8
store i32 200, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i, align 4, !tbaa.struct !18
store i32 %33, ptr %arrayidx8.i, align 4, !tbaa !14
%43 = load ptr, ptr %call.i, align 8, !tbaa !11
%add.i = add nsw i32 %33, 1
%idxprom13.i = sext i32 %add.i to i64
%arrayidx14.i = getelementptr inbounds %struct.flow_edge, ptr %43, i64 %idxprom13.i
%arrayidx20.i = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom
%44 = load i32, ptr %arrayidx20.i, align 4, !tbaa !14
store i32 %add37, ptr %arrayidx14.i, align 4, !tbaa.struct !16
%.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx14.i, i64 4
store i32 %44, ptr %.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i, align 4, !tbaa.struct !17
%.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx14.i, i64 8
store i32 0, ptr %.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i, align 4, !tbaa.struct !18
store i32 %add.i, ptr %arrayidx20.i, align 4, !tbaa !14
br label %if.end64
if.then47: ; preds = %for.body18
%45 = load i32, ptr %h, align 4, !tbaa !14
%mul50190 = add i32 %45, %i8.0326
%add52 = mul i32 %mul50190, %34
%add53 = add nsw i32 %add52, %j.0319
%cmp.i200 = icmp eq i32 %33, %32
br i1 %cmp.i200, label %if.then.i219, label %add_edge.exit225
if.then.i219: ; preds = %if.then47
%mul.i220 = shl nsw i32 %32, 1
store i32 %mul.i220, ptr %edge_length.i, align 8, !tbaa !13
%conv.i221 = sext i32 %mul.i220 to i64
%mul3.i222 = mul nsw i64 %conv.i221, 12
%call.i223 = call ptr @realloc(ptr noundef %.pre48.i229, i64 noundef %mul3.i222) #14
store ptr %call.i223, ptr %call.i, align 8, !tbaa !11
br label %add_edge.exit225
add_edge.exit225: ; preds = %if.then47, %if.then.i219
%46 = phi i32 [ %mul.i220, %if.then.i219 ], [ %28, %if.then47 ]
%47 = phi i32 [ %mul.i220, %if.then.i219 ], [ %29, %if.then47 ]
%48 = phi i32 [ %mul.i220, %if.then.i219 ], [ %30, %if.then47 ]
%49 = phi i32 [ %mul.i220, %if.then.i219 ], [ %31, %if.then47 ]
%50 = phi i32 [ %mul.i220, %if.then.i219 ], [ %32, %if.then47 ]
%51 = phi ptr [ %call.i223, %if.then.i219 ], [ %.pre48.i229, %if.then47 ]
%idxprom.i202 = sext i32 %33 to i64
%arrayidx.i203 = getelementptr inbounds %struct.flow_edge, ptr %51, i64 %idxprom.i202
%idxprom7.i205 = sext i32 %add53 to i64
%arrayidx8.i206 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom7.i205
%52 = load i32, ptr %arrayidx8.i206, align 4, !tbaa !14
store i32 %add20, ptr %arrayidx.i203, align 4, !tbaa.struct !16
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i207 = getelementptr inbounds i8, ptr %arrayidx.i203, i64 4
store i32 %52, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i207, align 4, !tbaa.struct !17
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i208 = getelementptr inbounds i8, ptr %arrayidx.i203, i64 8
store i32 200, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i208, align 4, !tbaa.struct !18
store i32 %33, ptr %arrayidx8.i206, align 4, !tbaa !14
%53 = load ptr, ptr %call.i, align 8, !tbaa !11
%add.i210 = add nsw i32 %33, 1
%idxprom13.i211 = sext i32 %add.i210 to i64
%arrayidx14.i212 = getelementptr inbounds %struct.flow_edge, ptr %53, i64 %idxprom13.i211
%arrayidx20.i214 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom
%54 = load i32, ptr %arrayidx20.i214, align 4, !tbaa !14
store i32 %add53, ptr %arrayidx14.i212, align 4, !tbaa.struct !16
%.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i215 = getelementptr inbounds i8, ptr %arrayidx14.i212, i64 4
store i32 %54, ptr %.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i215, align 4, !tbaa.struct !17
%.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i216 = getelementptr inbounds i8, ptr %arrayidx14.i212, i64 8
store i32 0, ptr %.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i216, align 4, !tbaa.struct !18
store i32 %add.i210, ptr %arrayidx20.i214, align 4, !tbaa !14
br label %if.end64
if.else56: ; preds = %for.body18
%55 = load i32, ptr %h, align 4, !tbaa !14
%mul57189 = add i32 %55, %i8.0326
%add59 = mul i32 %mul57189, %34
%add60 = add nsw i32 %add59, %j.0319
%cmp.i228 = icmp eq i32 %33, %30
br i1 %cmp.i228, label %if.then.i247, label %add_edge.exit253
if.then.i247: ; preds = %if.else56
%mul.i248 = shl nsw i32 %30, 1
store i32 %mul.i248, ptr %edge_length.i, align 8, !tbaa !13
%conv.i249 = sext i32 %mul.i248 to i64
%mul3.i250 = mul nsw i64 %conv.i249, 12
%call.i251 = call ptr @realloc(ptr noundef %.pre48.i229, i64 noundef %mul3.i250) #14
store ptr %call.i251, ptr %call.i, align 8, !tbaa !11
br label %add_edge.exit253
add_edge.exit253: ; preds = %if.else56, %if.then.i247
%56 = phi i32 [ %mul.i248, %if.then.i247 ], [ %28, %if.else56 ]
%57 = phi i32 [ %mul.i248, %if.then.i247 ], [ %29, %if.else56 ]
%58 = phi i32 [ %mul.i248, %if.then.i247 ], [ %30, %if.else56 ]
%59 = phi ptr [ %call.i251, %if.then.i247 ], [ %.pre48.i229, %if.else56 ]
%idxprom.i230 = sext i32 %33 to i64
%arrayidx.i231 = getelementptr inbounds %struct.flow_edge, ptr %59, i64 %idxprom.i230
%idxprom7.i233 = sext i32 %add60 to i64
%arrayidx8.i234 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom7.i233
%60 = load i32, ptr %arrayidx8.i234, align 4, !tbaa !14
store i32 %add20, ptr %arrayidx.i231, align 4, !tbaa.struct !16
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i235 = getelementptr inbounds i8, ptr %arrayidx.i231, i64 4
store i32 %60, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i235, align 4, !tbaa.struct !17
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i236 = getelementptr inbounds i8, ptr %arrayidx.i231, i64 8
store i32 1, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i236, align 4, !tbaa.struct !18
store i32 %33, ptr %arrayidx8.i234, align 4, !tbaa !14
%61 = load ptr, ptr %call.i, align 8, !tbaa !11
%add.i238 = add nsw i32 %33, 1
%idxprom13.i239 = sext i32 %add.i238 to i64
%arrayidx14.i240 = getelementptr inbounds %struct.flow_edge, ptr %61, i64 %idxprom13.i239
%arrayidx20.i242 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom
%62 = load i32, ptr %arrayidx20.i242, align 4, !tbaa !14
store i32 %add60, ptr %arrayidx14.i240, align 4, !tbaa.struct !16
%.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i243 = getelementptr inbounds i8, ptr %arrayidx14.i240, i64 4
store i32 %62, ptr %.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i243, align 4, !tbaa.struct !17
%.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i244 = getelementptr inbounds i8, ptr %arrayidx14.i240, i64 8
store i32 0, ptr %.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i244, align 4, !tbaa.struct !18
store i32 %add.i238, ptr %arrayidx20.i242, align 4, !tbaa !14
br label %if.end64
if.end64: ; preds = %add_edge.exit225, %add_edge.exit253, %add_edge.exit
%63 = phi i32 [ %46, %add_edge.exit225 ], [ %56, %add_edge.exit253 ], [ %37, %add_edge.exit ]
%64 = phi i32 [ %47, %add_edge.exit225 ], [ %57, %add_edge.exit253 ], [ %38, %add_edge.exit ]
%65 = phi i32 [ %48, %add_edge.exit225 ], [ %58, %add_edge.exit253 ], [ %39, %add_edge.exit ]
%66 = phi i32 [ %49, %add_edge.exit225 ], [ %58, %add_edge.exit253 ], [ %40, %add_edge.exit ]
%.pre48.i201341 = phi ptr [ %53, %add_edge.exit225 ], [ %61, %add_edge.exit253 ], [ %43, %add_edge.exit ]
%67 = phi i32 [ %50, %add_edge.exit225 ], [ %58, %add_edge.exit253 ], [ %40, %add_edge.exit ]
%src.2 = phi i32 [ %src.1317, %add_edge.exit225 ], [ %src.1317, %add_edge.exit253 ], [ %add20, %add_edge.exit ]
%dst.2 = phi i32 [ %add20, %add_edge.exit225 ], [ %dst.1318, %add_edge.exit253 ], [ %dst.1318, %add_edge.exit ]
%add27.i218.sink = add nsw i32 %33, 2
store i32 %add27.i218.sink, ptr %pointer.i198, align 4, !tbaa !15
%68 = load i32, ptr %h, align 4, !tbaa !14
%cmp66312 = icmp sgt i32 %68, 0
br i1 %cmp66312, label %for.body69, label %for.cond91.preheader
for.cond91.preheader: ; preds = %for.inc87, %if.end64
%69 = phi i32 [ %63, %if.end64 ], [ %91, %for.inc87 ]
%70 = phi i32 [ %64, %if.end64 ], [ %93, %for.inc87 ]
%71 = phi i32 [ %65, %if.end64 ], [ %94, %for.inc87 ]
%72 = phi i32 [ %66, %if.end64 ], [ %95, %for.inc87 ]
%.pre48.i201338 = phi ptr [ %.pre48.i201341, %if.end64 ], [ %.pre48.i201339, %for.inc87 ]
%73 = phi i32 [ %67, %if.end64 ], [ %96, %for.inc87 ]
%74 = phi i32 [ %add27.i218.sink, %if.end64 ], [ %97, %for.inc87 ]
%75 = load i32, ptr %w, align 4, !tbaa !14
%cmp92314 = icmp sgt i32 %75, 0
br i1 %cmp92314, label %for.body95, label %for.inc117
for.body69: ; preds = %if.end64, %for.inc87
%76 = phi i32 [ %91, %for.inc87 ], [ %63, %if.end64 ]
%77 = phi i32 [ %92, %for.inc87 ], [ %68, %if.end64 ]
%78 = phi i32 [ %93, %for.inc87 ], [ %64, %if.end64 ]
%79 = phi i32 [ %94, %for.inc87 ], [ %65, %if.end64 ]
%80 = phi i32 [ %95, %for.inc87 ], [ %66, %if.end64 ]
%.pre48.i257 = phi ptr [ %.pre48.i201339, %for.inc87 ], [ %.pre48.i201341, %if.end64 ]
%81 = phi i32 [ %96, %for.inc87 ], [ %67, %if.end64 ]
%82 = phi i32 [ %97, %for.inc87 ], [ %add27.i218.sink, %if.end64 ]
%k.0313 = phi i32 [ %inc88, %for.inc87 ], [ 0, %if.end64 ]
%cmp70 = icmp eq i32 %k.0313, %i8.0326
br i1 %cmp70, label %for.inc87, label %lor.lhs.false
lor.lhs.false: ; preds = %for.body69
%83 = load i32, ptr %w, align 4, !tbaa !14
%mul72 = mul nsw i32 %83, %k.0313
%add73 = add nsw i32 %mul72, %j.0319
%idxprom74 = sext i32 %add73 to i64
%arrayidx75 = getelementptr inbounds i8, ptr %call1, i64 %idxprom74
%84 = load i8, ptr %arrayidx75, align 1, !tbaa !30
%cmp77 = icmp eq i8 %84, 46
br i1 %cmp77, label %for.inc87, label %if.end80
if.end80: ; preds = %lor.lhs.false
%mul81 = mul nsw i32 %83, %i8.0326
%add82 = add nsw i32 %mul81, %j.0319
%mul83193 = add i32 %77, %k.0313
%add85 = mul i32 %83, %mul83193
%add86 = add nsw i32 %add85, %j.0319
%cmp.i256 = icmp eq i32 %82, %78
br i1 %cmp.i256, label %if.then.i275, label %add_edge.exit281
if.then.i275: ; preds = %if.end80
%mul.i276 = shl nsw i32 %78, 1
store i32 %mul.i276, ptr %edge_length.i, align 8, !tbaa !13
%conv.i277 = sext i32 %mul.i276 to i64
%mul3.i278 = mul nsw i64 %conv.i277, 12
%call.i279 = call ptr @realloc(ptr noundef %.pre48.i257, i64 noundef %mul3.i278) #14
store ptr %call.i279, ptr %call.i, align 8, !tbaa !11
br label %add_edge.exit281
add_edge.exit281: ; preds = %if.end80, %if.then.i275
%85 = phi i32 [ %mul.i276, %if.then.i275 ], [ %76, %if.end80 ]
%86 = phi i32 [ %mul.i276, %if.then.i275 ], [ %78, %if.end80 ]
%87 = phi ptr [ %call.i279, %if.then.i275 ], [ %.pre48.i257, %if.end80 ]
%idxprom.i258 = sext i32 %82 to i64
%arrayidx.i259 = getelementptr inbounds %struct.flow_edge, ptr %87, i64 %idxprom.i258
%idxprom7.i261 = sext i32 %add82 to i64
%arrayidx8.i262 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom7.i261
%88 = load i32, ptr %arrayidx8.i262, align 4, !tbaa !14
store i32 %add86, ptr %arrayidx.i259, align 4, !tbaa.struct !16
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i263 = getelementptr inbounds i8, ptr %arrayidx.i259, i64 4
store i32 %88, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i263, align 4, !tbaa.struct !17
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i264 = getelementptr inbounds i8, ptr %arrayidx.i259, i64 8
store i32 200, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i264, align 4, !tbaa.struct !18
store i32 %82, ptr %arrayidx8.i262, align 4, !tbaa !14
%89 = load ptr, ptr %call.i, align 8, !tbaa !11
%add.i266 = add nsw i32 %82, 1
%idxprom13.i267 = sext i32 %add.i266 to i64
%arrayidx14.i268 = getelementptr inbounds %struct.flow_edge, ptr %89, i64 %idxprom13.i267
%idxprom19.i269 = sext i32 %add86 to i64
%arrayidx20.i270 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom19.i269
%90 = load i32, ptr %arrayidx20.i270, align 4, !tbaa !14
store i32 %add82, ptr %arrayidx14.i268, align 4, !tbaa.struct !16
%.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i271 = getelementptr inbounds i8, ptr %arrayidx14.i268, i64 4
store i32 %90, ptr %.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i271, align 4, !tbaa.struct !17
%.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i272 = getelementptr inbounds i8, ptr %arrayidx14.i268, i64 8
store i32 0, ptr %.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i272, align 4, !tbaa.struct !18
store i32 %add.i266, ptr %arrayidx20.i270, align 4, !tbaa !14
%add27.i274 = add nsw i32 %82, 2
store i32 %add27.i274, ptr %pointer.i198, align 4, !tbaa !15
%.pre342 = load i32, ptr %h, align 4, !tbaa !14
br label %for.inc87
for.inc87: ; preds = %for.body69, %lor.lhs.false, %add_edge.exit281
%91 = phi i32 [ %76, %for.body69 ], [ %76, %lor.lhs.false ], [ %85, %add_edge.exit281 ]
%92 = phi i32 [ %77, %for.body69 ], [ %77, %lor.lhs.false ], [ %.pre342, %add_edge.exit281 ]
%93 = phi i32 [ %78, %for.body69 ], [ %78, %lor.lhs.false ], [ %86, %add_edge.exit281 ]
%94 = phi i32 [ %79, %for.body69 ], [ %79, %lor.lhs.false ], [ %86, %add_edge.exit281 ]
%95 = phi i32 [ %80, %for.body69 ], [ %80, %lor.lhs.false ], [ %86, %add_edge.exit281 ]
%.pre48.i201339 = phi ptr [ %.pre48.i257, %for.body69 ], [ %.pre48.i257, %lor.lhs.false ], [ %89, %add_edge.exit281 ]
%96 = phi i32 [ %81, %for.body69 ], [ %81, %lor.lhs.false ], [ %86, %add_edge.exit281 ]
%97 = phi i32 [ %82, %for.body69 ], [ %82, %lor.lhs.false ], [ %add27.i274, %add_edge.exit281 ]
%inc88 = add nuw nsw i32 %k.0313, 1
%cmp66 = icmp slt i32 %inc88, %92
br i1 %cmp66, label %for.body69, label %for.cond91.preheader, !llvm.loop !31
for.body95: ; preds = %for.cond91.preheader, %for.inc114
%98 = phi i32 [ %112, %for.inc114 ], [ %75, %for.cond91.preheader ]
%99 = phi i32 [ %113, %for.inc114 ], [ %69, %for.cond91.preheader ]
%100 = phi i32 [ %114, %for.inc114 ], [ %70, %for.cond91.preheader ]
%101 = phi i32 [ %115, %for.inc114 ], [ %71, %for.cond91.preheader ]
%102 = phi i32 [ %116, %for.inc114 ], [ %72, %for.cond91.preheader ]
%.pre48.i285 = phi ptr [ %.pre48.i201337, %for.inc114 ], [ %.pre48.i201338, %for.cond91.preheader ]
%103 = phi i32 [ %117, %for.inc114 ], [ %73, %for.cond91.preheader ]
%104 = phi i32 [ %118, %for.inc114 ], [ %74, %for.cond91.preheader ]
%k90.0315 = phi i32 [ %inc115, %for.inc114 ], [ 0, %for.cond91.preheader ]
%cmp96 = icmp eq i32 %k90.0315, %j.0319
br i1 %cmp96, label %for.inc114, label %lor.lhs.false98
lor.lhs.false98: ; preds = %for.body95
%mul99 = mul nsw i32 %98, %i8.0326
%add100 = add nsw i32 %mul99, %k90.0315
%idxprom101 = sext i32 %add100 to i64
%arrayidx102 = getelementptr inbounds i8, ptr %call1, i64 %idxprom101
%105 = load i8, ptr %arrayidx102, align 1, !tbaa !30
%cmp104 = icmp eq i8 %105, 46
br i1 %cmp104, label %for.inc114, label %if.end107
if.end107: ; preds = %lor.lhs.false98
%add109 = add nsw i32 %mul99, %j.0319
%106 = load i32, ptr %h, align 4, !tbaa !14
%mul110192 = add i32 %106, %i8.0326
%add112 = mul i32 %mul110192, %98
%add113 = add nsw i32 %add112, %k90.0315
%cmp.i284 = icmp eq i32 %104, %99
br i1 %cmp.i284, label %if.then.i303, label %add_edge.exit309
if.then.i303: ; preds = %if.end107
%mul.i304 = shl nsw i32 %99, 1
store i32 %mul.i304, ptr %edge_length.i, align 8, !tbaa !13
%conv.i305 = sext i32 %mul.i304 to i64
%mul3.i306 = mul nsw i64 %conv.i305, 12
%call.i307 = call ptr @realloc(ptr noundef %.pre48.i285, i64 noundef %mul3.i306) #14
store ptr %call.i307, ptr %call.i, align 8, !tbaa !11
br label %add_edge.exit309
add_edge.exit309: ; preds = %if.end107, %if.then.i303
%107 = phi i32 [ %mul.i304, %if.then.i303 ], [ %99, %if.end107 ]
%108 = phi ptr [ %call.i307, %if.then.i303 ], [ %.pre48.i285, %if.end107 ]
%idxprom.i286 = sext i32 %104 to i64
%arrayidx.i287 = getelementptr inbounds %struct.flow_edge, ptr %108, i64 %idxprom.i286
%idxprom7.i289 = sext i32 %add109 to i64
%arrayidx8.i290 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom7.i289
%109 = load i32, ptr %arrayidx8.i290, align 4, !tbaa !14
store i32 %add113, ptr %arrayidx.i287, align 4, !tbaa.struct !16
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i291 = getelementptr inbounds i8, ptr %arrayidx.i287, i64 4
store i32 %109, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i291, align 4, !tbaa.struct !17
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i292 = getelementptr inbounds i8, ptr %arrayidx.i287, i64 8
store i32 200, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i292, align 4, !tbaa.struct !18
store i32 %104, ptr %arrayidx8.i290, align 4, !tbaa !14
%110 = load ptr, ptr %call.i, align 8, !tbaa !11
%add.i294 = add nsw i32 %104, 1
%idxprom13.i295 = sext i32 %add.i294 to i64
%arrayidx14.i296 = getelementptr inbounds %struct.flow_edge, ptr %110, i64 %idxprom13.i295
%idxprom19.i297 = sext i32 %add113 to i64
%arrayidx20.i298 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom19.i297
%111 = load i32, ptr %arrayidx20.i298, align 4, !tbaa !14
store i32 %add109, ptr %arrayidx14.i296, align 4, !tbaa.struct !16
%.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i299 = getelementptr inbounds i8, ptr %arrayidx14.i296, i64 4
store i32 %111, ptr %.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i299, align 4, !tbaa.struct !17
%.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i300 = getelementptr inbounds i8, ptr %arrayidx14.i296, i64 8
store i32 0, ptr %.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i300, align 4, !tbaa.struct !18
store i32 %add.i294, ptr %arrayidx20.i298, align 4, !tbaa !14
%add27.i302 = add nsw i32 %104, 2
store i32 %add27.i302, ptr %pointer.i198, align 4, !tbaa !15
%.pre343 = load i32, ptr %w, align 4, !tbaa !14
br label %for.inc114
for.inc114: ; preds = %for.body95, %lor.lhs.false98, %add_edge.exit309
%112 = phi i32 [ %98, %for.body95 ], [ %98, %lor.lhs.false98 ], [ %.pre343, %add_edge.exit309 ]
%113 = phi i32 [ %99, %for.body95 ], [ %99, %lor.lhs.false98 ], [ %107, %add_edge.exit309 ]
%114 = phi i32 [ %100, %for.body95 ], [ %100, %lor.lhs.false98 ], [ %107, %add_edge.exit309 ]
%115 = phi i32 [ %101, %for.body95 ], [ %101, %lor.lhs.false98 ], [ %107, %add_edge.exit309 ]
%116 = phi i32 [ %102, %for.body95 ], [ %102, %lor.lhs.false98 ], [ %107, %add_edge.exit309 ]
%.pre48.i201337 = phi ptr [ %.pre48.i285, %for.body95 ], [ %.pre48.i285, %lor.lhs.false98 ], [ %110, %add_edge.exit309 ]
%117 = phi i32 [ %103, %for.body95 ], [ %103, %lor.lhs.false98 ], [ %107, %add_edge.exit309 ]
%118 = phi i32 [ %104, %for.body95 ], [ %104, %lor.lhs.false98 ], [ %add27.i302, %add_edge.exit309 ]
%inc115 = add nuw nsw i32 %k90.0315, 1
%cmp92 = icmp slt i32 %inc115, %112
br i1 %cmp92, label %for.body95, label %for.inc117, !llvm.loop !32
for.inc117: ; preds = %for.inc114, %for.cond91.preheader, %for.body18
%119 = phi i32 [ %27, %for.body18 ], [ %75, %for.cond91.preheader ], [ %112, %for.inc114 ]
%120 = phi i32 [ %28, %for.body18 ], [ %69, %for.cond91.preheader ], [ %113, %for.inc114 ]
%121 = phi i32 [ %29, %for.body18 ], [ %70, %for.cond91.preheader ], [ %114, %for.inc114 ]
%122 = phi i32 [ %30, %for.body18 ], [ %71, %for.cond91.preheader ], [ %115, %for.inc114 ]
%123 = phi i32 [ %31, %for.body18 ], [ %72, %for.cond91.preheader ], [ %116, %for.inc114 ]
%.pre48.i201333 = phi ptr [ %.pre48.i229, %for.body18 ], [ %.pre48.i201338, %for.cond91.preheader ], [ %.pre48.i201337, %for.inc114 ]
%124 = phi i32 [ %32, %for.body18 ], [ %73, %for.cond91.preheader ], [ %117, %for.inc114 ]
%125 = phi i32 [ %33, %for.body18 ], [ %74, %for.cond91.preheader ], [ %118, %for.inc114 ]
%src.3 = phi i32 [ %src.1317, %for.body18 ], [ %src.2, %for.cond91.preheader ], [ %src.2, %for.inc114 ]
%dst.3 = phi i32 [ %dst.1318, %for.body18 ], [ %dst.2, %for.cond91.preheader ], [ %dst.2, %for.inc114 ]
%inc118 = add nuw nsw i32 %j.0319, 1
%cmp15 = icmp slt i32 %inc118, %119
br i1 %cmp15, label %for.body18, label %for.cond.cleanup17.loopexit, !llvm.loop !33
if.then126: ; preds = %for.cond.cleanup12
%call127 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end130
if.else128: ; preds = %for.cond.cleanup12
%call129 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %call123)
br label %if.end130
if.end130: ; preds = %if.else128, %if.then126
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #13
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #13
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nofree nounwind
declare noundef i32 @puts(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: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #8 {
entry:
tail call void @run()
ret i32 0
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #11
attributes #0 = { mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,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 #3 = { mustprogress nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 #8 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #10 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #12 = { nounwind allocsize(0,1) }
attributes #13 = { nounwind }
attributes #14 = { nounwind allocsize(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, !10, i64 16}
!6 = !{!"maxFlowGraph", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !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 0}
!12 = !{!6, !7, i64 8}
!13 = !{!6, !10, i64 24}
!14 = !{!10, !10, i64 0}
!15 = !{!6, !10, i64 20}
!16 = !{i64 0, i64 4, !14, i64 4, i64 4, !14, i64 8, i64 4, !14}
!17 = !{i64 0, i64 4, !14, i64 4, i64 4, !14}
!18 = !{i64 0, i64 4, !14}
!19 = !{!20, !10, i64 0}
!20 = !{!"flow_edge", !10, i64 0, !10, i64 4, !10, i64 8}
!21 = !{!20, !10, i64 8}
!22 = !{!20, !10, i64 4}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = distinct !{!25, !24}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !24}
!28 = distinct !{!28, !24, !29}
!29 = !{!"llvm.loop.unswitch.partial.disable"}
!30 = !{!8, !8, i64 0}
!31 = distinct !{!31, !24}
!32 = distinct !{!32, !24}
!33 = distinct !{!33, !24}
|
#include<stdio.h>
int main(void){
int N, K;
scanf("%d%d",&N,&K);
if( (N + 1) / 2 >= K){
printf("YES");
}
else{
printf("NO");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211236/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211236/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%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
%add = add nsw i32 %0, 1
%div = sdiv i32 %add, 2
%1 = load i32, ptr %K, align 4, !tbaa !5
%cmp.not = icmp slt i32 %div, %1
%.str.2..str.1 = select i1 %cmp.not, ptr @.str.2, ptr @.str.1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
// your code goes here
int n,s,min,i,x,y;
scanf("%d%d",&n,&s);
min=100;
int flag=0;
for(i=0;i<n;i++)
{
scanf("%d%d",&x,&y);
if(y!=0)
x=x+1;
if(s>=x)
{
if(y!=0&&y<min)
min=y;
flag=1;
}
}
if(flag==1)
printf("%d\n",100-min);
else
printf("-1\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21128/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21128/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@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:
%n = alloca i32, align 4
%s = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %s)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body, label %if.else
for.body: ; preds = %entry, %if.end
%flag.020 = phi i32 [ %flag.1, %if.end ], [ 0, %entry ]
%i.019 = phi i32 [ %inc, %if.end ], [ 0, %entry ]
%min.018 = phi i32 [ %min.2, %if.end ], [ 100, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%1 = load i32, ptr %y, align 4, !tbaa !5
%cmp2.not = icmp eq i32 %1, 0
%.pre = load i32, ptr %x, align 4, !tbaa !5
br i1 %cmp2.not, label %if.end, label %if.then
if.then: ; preds = %for.body
%add = add nsw i32 %.pre, 1
store i32 %add, ptr %x, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %for.body
%2 = phi i32 [ %add, %if.then ], [ %.pre, %for.body ]
%3 = load i32, ptr %s, align 4, !tbaa !5
%cmp3.not = icmp slt i32 %3, %2
%cmp5.not = icmp ne i32 %1, 0
%cmp6 = icmp slt i32 %1, %min.018
%or.cond = select i1 %cmp5.not, i1 %cmp6, i1 false
%min.1 = select i1 %or.cond, i32 %1, i32 %min.018
%min.2 = select i1 %cmp3.not, i32 %min.018, i32 %min.1
%flag.1 = select i1 %cmp3.not, i32 %flag.020, i32 1
%inc = add nuw nsw i32 %i.019, 1
%4 = load i32, ptr %n, 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 = %if.end
%5 = icmp eq i32 %flag.1, 1
br i1 %5, label %if.then11, label %if.else
if.then11: ; preds = %for.end
%6 = sub nsw i32 100, %min.2
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
br label %if.end14
if.else: ; preds = %entry, %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end14
if.end14: ; preds = %if.else, %if.then11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int n, k, ans;
scanf("%d%d", &n, &k);
if(n%2==0){
ans=n/2;
}
else{
ans=n/2+1;
}
if(ans>=k) printf("YES\n");
else printf("NO\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211322/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211322/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [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
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, 1
%div = sdiv i32 %0, 2
%ans.0 = add nsw i32 %div, %1
%2 = load i32, ptr %k, align 4, !tbaa !5
%cmp2.not = icmp slt i32 %ans.0, %2
%str.sink = select i1 %cmp2.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#define N 128
#define INT(X) \
( *( (const int *)(X) ) )
static int
compare (
const void * a,
const void * b
)
{
return ( INT( b ) - INT( a ) );
}
/** Application main entry point. */
int
main (
int argc,
char * argv[ ]
)
{
struct ti
{
int pt;
int no;
} p[ N ] = { { 0 } };
int res[ N ];
int n, i;
scanf ( "%d", &n );
for ( i = 0; i < n; ++i )
{
p[ i ].no = i;
}
{ const int lc = n * ( n - 1 ) / 2;
for ( i = 0; i < lc; ++i )
{
int an, bn, ap, bp;
scanf ( "%d%d%d%d", &an, &bn, &ap, &bp );
p[ an - 1 ].pt += 3 * !!( ap > bp ) + !!( ap == bp );
p[ bn - 1 ].pt += 3 * !!( bp > ap ) + !!( bp == ap );
}
}
qsort ( p, n, sizeof ( struct ti ), compare );
for ( i = 0; i < n; ++i )
{
res[ p[ i ].no ] = i + 1;
if ( i > 0 && p[ i ].pt == p[ i - 1 ].pt )
{
res[ p[ i ].no ] = res[ p[ i - 1 ].no ];
}
}
for ( i = 0; i < n; ++i )
{
printf ( "%d\n", res[ i ] );
}
return ( 0 );
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211380/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211380/source.c"
target datalayout = "e-m:e-p270: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.ti = type { i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%p = alloca [128 x %struct.ti], align 16
%res = alloca [128 x i32], align 16
%n = alloca i32, align 4
%an = alloca i32, align 4
%bn = alloca i32, align 4
%ap = alloca i32, align 4
%bp = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %p) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %p, i8 0, i64 1024, i1 false)
call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %res) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp99 = icmp sgt i32 %0, 0
br i1 %cmp99, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 7
%1 = icmp ult i32 %0, 8
br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967288
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%no = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %indvars.iv, i32 1
%2 = trunc i64 %indvars.iv to i32
store i32 %2, ptr %no, align 4, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%no.1 = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %indvars.iv.next, i32 1
%3 = trunc i64 %indvars.iv.next to i32
store i32 %3, ptr %no.1, align 4, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%no.2 = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %indvars.iv.next.1, i32 1
%4 = trunc i64 %indvars.iv.next.1 to i32
store i32 %4, ptr %no.2, align 4, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%no.3 = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %indvars.iv.next.2, i32 1
%5 = trunc i64 %indvars.iv.next.2 to i32
store i32 %5, ptr %no.3, align 4, !tbaa !9
%indvars.iv.next.3 = or i64 %indvars.iv, 4
%no.4 = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %indvars.iv.next.3, i32 1
%6 = trunc i64 %indvars.iv.next.3 to i32
store i32 %6, ptr %no.4, align 4, !tbaa !9
%indvars.iv.next.4 = or i64 %indvars.iv, 5
%no.5 = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %indvars.iv.next.4, i32 1
%7 = trunc i64 %indvars.iv.next.4 to i32
store i32 %7, ptr %no.5, align 4, !tbaa !9
%indvars.iv.next.5 = or i64 %indvars.iv, 6
%no.6 = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %indvars.iv.next.5, i32 1
%8 = trunc i64 %indvars.iv.next.5 to i32
store i32 %8, ptr %no.6, align 4, !tbaa !9
%indvars.iv.next.6 = or i64 %indvars.iv, 7
%no.7 = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %indvars.iv.next.6, i32 1
%9 = trunc i64 %indvars.iv.next.6 to i32
store i32 %9, ptr %no.7, align 4, !tbaa !9
%indvars.iv.next.7 = add nuw nsw i64 %indvars.iv, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !11
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%no.epil = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %indvars.iv.epil, i32 1
%10 = trunc i64 %indvars.iv.epil to i32
store i32 %10, ptr %no.epil, align 4, !tbaa !9
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !13
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%sub = add nsw i32 %0, -1
%mul = mul nsw i32 %sub, %0
%div = sdiv i32 %mul, 2
%cmp2101 = icmp sgt i32 %mul, 1
br i1 %cmp2101, label %for.body3, label %for.end36
for.body3: ; preds = %for.end, %for.body3
%i.1102 = phi i32 [ %inc35, %for.body3 ], [ 0, %for.end ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %an) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %bn) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ap) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %bp) #6
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %an, ptr noundef nonnull %bn, ptr noundef nonnull %ap, ptr noundef nonnull %bp)
%11 = load i32, ptr %ap, align 4, !tbaa !5
%12 = load i32, ptr %bp, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %11, %12
%mul7 = select i1 %cmp5, i32 3, i32 0
%cmp8 = icmp eq i32 %11, %12
%lnot.ext12 = zext i1 %cmp8 to i32
%add = add nuw nsw i32 %mul7, %lnot.ext12
%13 = load i32, ptr %an, align 4, !tbaa !5
%sub13 = add nsw i32 %13, -1
%idxprom14 = sext i32 %sub13 to i64
%arrayidx15 = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %idxprom14
%14 = load i32, ptr %arrayidx15, align 8, !tbaa !15
%add16 = add nsw i32 %add, %14
store i32 %add16, ptr %arrayidx15, align 8, !tbaa !15
%cmp17 = icmp sgt i32 %12, %11
%mul22 = select i1 %cmp17, i32 3, i32 0
%add28 = add nuw nsw i32 %mul22, %lnot.ext12
%15 = load i32, ptr %bn, align 4, !tbaa !5
%sub29 = add nsw i32 %15, -1
%idxprom30 = sext i32 %sub29 to i64
%arrayidx31 = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %idxprom30
%16 = load i32, ptr %arrayidx31, align 8, !tbaa !15
%add33 = add nsw i32 %add28, %16
store i32 %add33, ptr %arrayidx31, align 8, !tbaa !15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %bp) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ap) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %bn) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %an) #6
%inc35 = add nuw nsw i32 %i.1102, 1
%exitcond108.not = icmp eq i32 %inc35, %div
br i1 %exitcond108.not, label %for.end36.loopexit, label %for.body3, !llvm.loop !16
for.end36.loopexit: ; preds = %for.body3
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.end36
for.end36: ; preds = %for.end36.loopexit, %for.end
%17 = phi i32 [ %.pre, %for.end36.loopexit ], [ %0, %for.end ]
%conv = sext i32 %17 to i64
call void @qsort(ptr noundef nonnull %p, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @compare) #6
%18 = load i32, ptr %n, align 4, !tbaa !5
%cmp38103 = icmp sgt i32 %18, 0
br i1 %cmp38103, label %for.inc69.peel, label %for.end81
for.inc69.peel: ; preds = %for.end36
%wide.trip.count113 = zext i32 %18 to i64
%no44.peel = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 0, i32 1
%19 = load i32, ptr %no44.peel, align 4, !tbaa !9
%idxprom45.peel = sext i32 %19 to i64
%arrayidx46.peel = getelementptr inbounds [128 x i32], ptr %res, i64 0, i64 %idxprom45.peel
store i32 1, ptr %arrayidx46.peel, align 4, !tbaa !5
%exitcond114.peel.not = icmp eq i32 %18, 1
br i1 %exitcond114.peel.not, label %for.body75.preheader, label %land.lhs.true
for.cond72.preheader: ; preds = %for.inc69
br i1 %cmp38103, label %for.body75.preheader, label %for.end81
for.body75.preheader: ; preds = %for.inc69.peel, %for.cond72.preheader
br label %for.body75
land.lhs.true: ; preds = %for.inc69.peel, %for.inc69
%indvars.iv109 = phi i64 [ %indvars.iv.next110, %for.inc69 ], [ 1, %for.inc69.peel ]
%indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
%no44 = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %indvars.iv109, i32 1
%20 = load i32, ptr %no44, align 4, !tbaa !9
%idxprom45 = sext i32 %20 to i64
%arrayidx46 = getelementptr inbounds [128 x i32], ptr %res, i64 0, i64 %idxprom45
%21 = trunc i64 %indvars.iv.next110 to i32
store i32 %21, ptr %arrayidx46, align 4, !tbaa !5
%arrayidx43 = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %indvars.iv109
%22 = load i32, ptr %arrayidx43, align 8, !tbaa !15
%23 = add nuw i64 %indvars.iv109, 4294967295
%idxprom53 = and i64 %23, 4294967295
%arrayidx54 = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %idxprom53
%24 = load i32, ptr %arrayidx54, align 8, !tbaa !15
%cmp56 = icmp eq i32 %22, %24
br i1 %cmp56, label %if.then, label %for.inc69
if.then: ; preds = %land.lhs.true
%no61 = getelementptr inbounds [128 x %struct.ti], ptr %p, i64 0, i64 %idxprom53, i32 1
%25 = load i32, ptr %no61, align 4, !tbaa !9
%idxprom62 = sext i32 %25 to i64
%arrayidx63 = getelementptr inbounds [128 x i32], ptr %res, i64 0, i64 %idxprom62
%26 = load i32, ptr %arrayidx63, align 4, !tbaa !5
store i32 %26, ptr %arrayidx46, align 4, !tbaa !5
br label %for.inc69
for.inc69: ; preds = %land.lhs.true, %if.then
%exitcond114.not = icmp eq i64 %indvars.iv.next110, %wide.trip.count113
br i1 %exitcond114.not, label %for.cond72.preheader, label %land.lhs.true, !llvm.loop !17
for.body75: ; preds = %for.body75.preheader, %for.body75
%indvars.iv116 = phi i64 [ %indvars.iv.next117, %for.body75 ], [ 0, %for.body75.preheader ]
%arrayidx77 = getelementptr inbounds [128 x i32], ptr %res, i64 0, i64 %indvars.iv116
%27 = load i32, ptr %arrayidx77, align 4, !tbaa !5
%call78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%indvars.iv.next117 = add nuw nsw i64 %indvars.iv116, 1
%28 = load i32, ptr %n, align 4, !tbaa !5
%29 = sext i32 %28 to i64
%cmp73 = icmp slt i64 %indvars.iv.next117, %29
br i1 %cmp73, label %for.body75, label %for.end81, !llvm.loop !19
for.end81: ; preds = %for.body75, %for.end36, %for.cond72.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %res) #6
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %p) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define internal i32 @compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"ti", !6, i64 0, !6, i64 4}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = !{!10, !6, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12, !18}
!18 = !{!"llvm.loop.peeled.count", i32 1}
!19 = distinct !{!19, !12}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void){
long long A,B,C;
long long K;
scanf("%lld %lld %lld %lld",&A,&B,&C,&K);
//printf("%lld %lld %lld %lld\n",A,B,C,K);
long long ans=A-B;
if(K%2==0){
if(ans>1000000000000000000) printf("Unfair\n");
else printf("%lld\n",ans);
}
else{
ans*=-1;
if(ans>1000000000000000000) printf("Unfair\n");
else printf("%lld\n",ans);
}
return 0;
if(A==B && B==C){
printf("0\n");
return 0;
}
for(long long i=0;i<K;i++){
long long AB=A+B;
long long BC=B+C;
long long CA=C+A;
A=BC; B=CA; C=AB;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211430/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211430/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [20 x i8] c"%lld %lld %lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str.3 = private unnamed_addr constant [7 x i8] c"Unfair\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i64, align 8
%B = alloca i64, align 8
%C = alloca i64, align 8
%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 %C) #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 %C, ptr noundef nonnull %K)
%0 = load i64, ptr %A, align 8, !tbaa !5
%1 = load i64, ptr %B, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%2 = load i64, ptr %K, align 8, !tbaa !5
%3 = and i64 %2, 1
%cmp = icmp eq i64 %3, 0
br i1 %cmp, label %if.then, label %if.else5
if.then: ; preds = %entry
%cmp1 = icmp sgt i64 %sub, 1000000000000000000
br i1 %cmp1, label %if.then2, label %if.else
if.then2: ; preds = %if.then
%puts17 = call i32 @puts(ptr nonnull dereferenceable(1) @str.3)
br label %if.end12
if.else: ; preds = %if.then
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sub)
br label %if.end12
if.else5: ; preds = %entry
%cmp6 = icmp slt i64 %sub, -1000000000000000000
br i1 %cmp6, label %if.then7, label %if.else9
if.then7: ; preds = %if.else5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.3)
br label %if.end12
if.else9: ; preds = %if.else5
%mul = sub nsw i64 0, %sub
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %mul)
br label %if.end12
if.end12: ; preds = %if.then7, %if.else9, %if.then2, %if.else
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %C) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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"}
|
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#define inf 100000000
#define INF 9223372036854775807
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
int mod=(int)1e09+7;
int in(void){
int i;scanf("%d",&i);
return i;
}
long long llin(void){
long long i;scanf("%lld",&i);
return i;
}
double din(void){
double i;scanf("%lf",&i);
return i;
}
void chin(char s[]){
scanf("%s",s);
}
void print(int a){
printf("%d\n",a);
}
void llprint(long long a){
printf("%lld\n",a);
}
void dprint(double a){
printf("%.10f\n",a);
}
void print2(int a,int b){
printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
return a>b?a:b;
}
long long min(long long a,long long b){
return a<b?a:b;
}
int cmp(const void *a,const void *b){
return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
int t=*a;
*a=*b;
*b=t;
}
long long gcd(long long x,long long y){
return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
return x/gcd(x,y)*y;
}
// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct
int main(void){
int a=in(),b=in(),c=in();
long long k=llin();
print((a-b)*pow(-1,k%2));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211489/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211489/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@mod = dso_local local_unnamed_addr global i32 1000000007, align 4
@.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 [4 x i8] c"%lf\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.6 = private unnamed_addr constant [7 x i8] c"%.10f\0A\00", align 1
@.str.7 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #0 {
entry:
%i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #11
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%0 = load i32, ptr %i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #11
ret i32 %0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @llin() local_unnamed_addr #0 {
entry:
%i = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #11
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %i)
%0 = load i64, ptr %i, align 8, !tbaa !9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #11
ret i64 %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local double @din() local_unnamed_addr #0 {
entry:
%i = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #11
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %i)
%0 = load double, ptr %i, align 8, !tbaa !11
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #11
ret double %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @chin(ptr noundef %s) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef %s)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(i32 noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %a)
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 @llprint(i64 noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %a)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @dprint(double noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, double noundef %a)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print2(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %a, i32 noundef %b)
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_r(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @char_cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #12
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @char_cmp_r(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #12
ret i32 %call
}
; 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 #7 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #8 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse, %entry
%x.tr = phi i64 [ %x, %entry ], [ %y.tr, %tailrecurse ]
%y.tr = phi i64 [ %y, %entry ], [ %rem, %tailrecurse ]
%rem = srem i64 %x.tr, %y.tr
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %cond.end, label %tailrecurse
cond.end: ; preds = %tailrecurse
ret i64 %y.tr
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lcm(i64 noundef %x, i64 noundef %y) local_unnamed_addr #8 {
entry:
br label %tailrecurse.i
tailrecurse.i: ; preds = %tailrecurse.i, %entry
%x.tr.i = phi i64 [ %x, %entry ], [ %y.tr.i, %tailrecurse.i ]
%y.tr.i = phi i64 [ %y, %entry ], [ %rem.i, %tailrecurse.i ]
%rem.i = srem i64 %x.tr.i, %y.tr.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %tailrecurse.i
gcd.exit: ; preds = %tailrecurse.i
%div = sdiv i64 %x, %y.tr.i
%mul = mul nsw i64 %div, %y
ret i64 %mul
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%i.i11 = alloca i64, align 8
%i.i9 = alloca i32, align 4
%i.i7 = alloca i32, align 4
%i.i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i) #11
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i.i)
%0 = load i32, ptr %i.i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i) #11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i7) #11
%call.i8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i.i7)
%1 = load i32, ptr %i.i7, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i7) #11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i9) #11
%call.i10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i.i9)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i9) #11
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i.i11) #11
%call.i12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %i.i11)
%2 = load i64, ptr %i.i11, align 8, !tbaa !9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i.i11) #11
%sub = sub nsw i32 %0, %1
%conv = sitofp i32 %sub to double
%rem = srem i64 %2, 2
%conv4 = sitofp i64 %rem to double
%call5 = call double @pow(double noundef -1.000000e+00, double noundef %conv4) #11
%mul = fmul double %call5, %conv
%conv6 = fptosi double %mul to i32
%call.i13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %conv6)
ret i32 0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #10
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-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: 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 #8 = { 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 #9 = { 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 #10 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #11 = { nounwind }
attributes #12 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
|
#include <stdio.h>
#include <string.h>
int a[11][6], b[11][6];
int main(void)
{
int n, m=5;
while (scanf("%d", &n), n) {
int i, j, k, l, res, changed;
memset(a, -1, sizeof(a));
for(i=0;i<n;++i) for(j=0;j<m;++j) scanf("%d", &b[i][j]);
res=0;
changed=1;
while (changed) {
memcpy(a, b, sizeof(a));
changed=0;
for(i=n-1;i>=0;--i) {
for(j=m;j>=3;--j) {
for(k=0;k<=m-j;++k) {
int t=a[i][k], ok=t>0;
for(l=1;l<j;++l) ok=ok&(t==a[i][k+l]);
if (ok) {
for(l=0;l<j;++l) a[i][k+l]=0;
res+=t*j;
changed=1;
goto NEXTROW;
}
}
}
NEXTROW:;
}
memset(b, 0, sizeof(b));
for(j=0;j<m;++j)
for(i=k=n-1;i>=0;--i)
if (a[i][j]) b[k--][j]=a[i][j];
}
printf("%d\n", res);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211531/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211531/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@a = dso_local local_unnamed_addr global [11 x [6 x i32]] zeroinitializer, align 16
@b = dso_local global [11 x [6 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call176 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not177 = icmp eq i32 %0, 0
br i1 %tobool.not177, label %while.end96, label %while.body
while.body: ; preds = %entry, %while.end
%1 = phi i32 [ %51, %while.end ], [ %0, %entry ]
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(264) @a, i8 -1, i64 264, i1 false)
%cmp150 = icmp sgt i32 %1, 0
br i1 %cmp150, label %for.cond1.preheader, label %while.cond10.preheader
while.cond10.preheader: ; preds = %for.cond1.preheader, %while.body
%.lcssa = phi i32 [ %1, %while.body ], [ %12, %for.cond1.preheader ]
%cmp14165 = icmp sgt i32 %.lcssa, 0
%sub68 = add i32 %.lcssa, -1
%2 = zext i32 %sub68 to i64
%3 = mul nuw nsw i64 %2, 24
%4 = zext i32 %.lcssa to i64
%5 = getelementptr i8, ptr @a, i64 %3
%6 = add nuw nsw i64 %2, 1
%xtraiter = and i64 %6, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%arrayidx76.us.prol = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %2, i64 0
%dec83.us.prol = add i32 %.lcssa, -2
%idxprom84.us.prol = sext i32 %sub68 to i64
%arrayidx87.us.prol = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us.prol, i64 0
%indvars.iv.next256.prol = add nsw i64 %2, -1
%7 = icmp eq i32 %sub68, 0
%xtraiter308 = and i64 %6, 1
%lcmp.mod309.not = icmp eq i64 %xtraiter308, 0
%arrayidx76.us.1.prol = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %2, i64 1
%dec83.us.1.prol = add i32 %.lcssa, -2
%idxprom84.us.1.prol = sext i32 %sub68 to i64
%arrayidx87.us.1.prol = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us.1.prol, i64 1
%indvars.iv.next256.1.prol = add nsw i64 %2, -1
%8 = icmp eq i32 %sub68, 0
%xtraiter310 = and i64 %6, 1
%lcmp.mod311.not = icmp eq i64 %xtraiter310, 0
%arrayidx76.us.2.prol = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %2, i64 2
%dec83.us.2.prol = add i32 %.lcssa, -2
%idxprom84.us.2.prol = sext i32 %sub68 to i64
%arrayidx87.us.2.prol = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us.2.prol, i64 2
%indvars.iv.next256.2.prol = add nsw i64 %2, -1
%9 = icmp eq i32 %sub68, 0
%xtraiter312 = and i64 %6, 1
%lcmp.mod313.not = icmp eq i64 %xtraiter312, 0
%arrayidx76.us.3.prol = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %2, i64 3
%dec83.us.3.prol = add i32 %.lcssa, -2
%idxprom84.us.3.prol = sext i32 %sub68 to i64
%arrayidx87.us.3.prol = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us.3.prol, i64 3
%indvars.iv.next256.3.prol = add nsw i64 %2, -1
%10 = icmp eq i32 %sub68, 0
%xtraiter314 = and i64 %6, 1
%lcmp.mod315.not = icmp eq i64 %xtraiter314, 0
%arrayidx76.us.4.prol = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %2, i64 4
%dec83.us.4.prol = add i32 %.lcssa, -2
%idxprom84.us.4.prol = sext i32 %sub68 to i64
%arrayidx87.us.4.prol = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us.4.prol, i64 4
%indvars.iv.next256.4.prol = add nsw i64 %2, -1
%11 = icmp eq i32 %sub68, 0
br label %while.body12
for.cond1.preheader: ; preds = %while.body, %for.cond1.preheader
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond1.preheader ], [ 0, %while.body ]
%arrayidx5 = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %indvars.iv, i64 0
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5)
%arrayidx5.1 = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %indvars.iv, i64 1
%call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1)
%arrayidx5.2 = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %indvars.iv, i64 2
%call6.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2)
%arrayidx5.3 = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %indvars.iv, i64 3
%call6.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.3)
%arrayidx5.4 = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %indvars.iv, i64 4
%call6.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.4)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp = icmp slt i64 %indvars.iv.next, %13
br i1 %cmp, label %for.cond1.preheader, label %while.cond10.preheader, !llvm.loop !9
while.cond10.loopexit: ; preds = %for.body72.us.4.prol.loopexit, %for.inc89.us.4.1, %for.end63
%tobool11.not = icmp eq i32 %changed.5, 0
br i1 %tobool11.not, label %while.end, label %while.body12, !llvm.loop !11
while.body12: ; preds = %while.cond10.preheader, %while.cond10.loopexit
%res.0175 = phi i32 [ 0, %while.cond10.preheader ], [ %res.5, %while.cond10.loopexit ]
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(264) @a, ptr noundef nonnull align 16 dereferenceable(264) @b, i64 264, i1 false)
br i1 %cmp14165, label %for.body22.us.preheader, label %while.cond10.loopexit.thread
while.cond10.loopexit.thread: ; preds = %while.body12
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(264) @b, i8 0, i64 264, i1 false)
br label %while.end
for.body22.us.preheader: ; preds = %while.body12, %for.inc61
%indvars.iv252 = phi i64 [ %indvars.iv.next253, %for.inc61 ], [ %4, %while.body12 ]
%indvar = phi i64 [ %indvar.next, %for.inc61 ], [ 0, %while.body12 ]
%changed.1167 = phi i32 [ %changed.5, %for.inc61 ], [ 0, %while.body12 ]
%res.1166 = phi i32 [ %res.5, %for.inc61 ], [ %res.0175, %while.body12 ]
%14 = mul nsw i64 %indvar, -24
%scevgep = getelementptr i8, ptr %5, i64 %14
%indvars.iv.next253 = add nsw i64 %indvars.iv252, -1
%idxprom23 = and i64 %indvars.iv.next253, 4294967295
%arrayidx26.us = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 0
%15 = load i32, ptr %arrayidx26.us, align 8, !tbaa !5
%cmp27.us = icmp sgt i32 %15, 0
%arrayidx35.us = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 1
%16 = load i32, ptr %arrayidx35.us, align 4, !tbaa !5
%cmp36.us = icmp eq i32 %15, %16
%narrow = and i1 %cmp36.us, %cmp27.us
%arrayidx35.us.1239 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 2
%17 = load i32, ptr %arrayidx35.us.1239, align 8, !tbaa !5
%cmp36.us.1240 = icmp eq i32 %15, %17
%arrayidx35.us.2243 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 3
%18 = load i32, ptr %arrayidx35.us.2243, align 4, !tbaa !5
%cmp36.us.2244 = icmp eq i32 %15, %18
%arrayidx35.us.3 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 4
%19 = load i32, ptr %arrayidx35.us.3, align 8, !tbaa !5
%cmp36.us.3 = icmp eq i32 %15, %19
%20 = select i1 %cmp36.us.3, i1 %cmp36.us.2244, i1 false
%21 = select i1 %20, i1 %cmp36.us.1240, i1 false
%narrow266 = select i1 %21, i1 %narrow, i1 false
br i1 %narrow266, label %for.cond42.loopexit, label %for.body22.us.preheader.1
for.cond42.loopexit: ; preds = %for.body22.us.preheader, %for.inc56.us.1, %for.body22.us.preheader.1, %for.inc56.us.2.1, %for.inc56.us.2, %for.body22.us.preheader.2
%j.1161.lcssa188.wide = phi i32 [ 5, %for.body22.us.preheader ], [ 4, %for.inc56.us.1 ], [ 4, %for.body22.us.preheader.1 ], [ 3, %for.inc56.us.2.1 ], [ 3, %for.inc56.us.2 ], [ 3, %for.body22.us.preheader.2 ]
%k.0157.us.lcssa.wide = phi i64 [ 0, %for.body22.us.preheader ], [ 4, %for.inc56.us.1 ], [ 0, %for.body22.us.preheader.1 ], [ 8, %for.inc56.us.2.1 ], [ 4, %for.inc56.us.2 ], [ 0, %for.body22.us.preheader.2 ]
%.lcssa185 = phi i32 [ %15, %for.body22.us.preheader ], [ %25, %for.inc56.us.1 ], [ %24, %for.body22.us.preheader.1 ], [ %33, %for.inc56.us.2.1 ], [ %32, %for.inc56.us.2 ], [ %31, %for.body22.us.preheader.2 ]
%scevgep247 = getelementptr i8, ptr %scevgep, i64 %k.0157.us.lcssa.wide
%22 = shl nuw nsw i32 %j.1161.lcssa188.wide, 2
%23 = zext i32 %22 to i64
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep247, i8 0, i64 %23, i1 false), !tbaa !5
%mul = mul nsw i32 %.lcssa185, %j.1161.lcssa188.wide
%add54 = add nsw i32 %mul, %res.1166
br label %for.inc61
for.body22.us.preheader.1: ; preds = %for.body22.us.preheader
%arrayidx26.us.1 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 0
%24 = load i32, ptr %arrayidx26.us.1, align 8, !tbaa !5
%cmp27.us.1 = icmp sgt i32 %24, 0
%arrayidx35.us.1 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 1
%25 = load i32, ptr %arrayidx35.us.1, align 4, !tbaa !5
%cmp36.us.1 = icmp eq i32 %24, %25
%narrow267 = and i1 %cmp36.us.1, %cmp27.us.1
%arrayidx35.us.1.1 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 2
%26 = load i32, ptr %arrayidx35.us.1.1, align 8, !tbaa !5
%cmp36.us.1.1 = icmp eq i32 %24, %26
%arrayidx35.us.1.2 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 3
%27 = load i32, ptr %arrayidx35.us.1.2, align 4, !tbaa !5
%cmp36.us.1.2 = icmp eq i32 %24, %27
%28 = select i1 %cmp36.us.1.2, i1 %cmp36.us.1.1, i1 false
%narrow269 = select i1 %28, i1 %narrow267, i1 false
br i1 %narrow269, label %for.cond42.loopexit, label %for.inc56.us.1
for.inc56.us.1: ; preds = %for.body22.us.preheader.1
%cmp27.us.1.1 = icmp sgt i32 %25, 0
%cmp36.us.1.1237 = icmp eq i32 %25, %26
%narrow270 = and i1 %cmp36.us.1.1237, %cmp27.us.1.1
%cmp36.us.1.1.1 = icmp eq i32 %25, %27
%arrayidx35.us.1.2.1 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 4
%29 = load i32, ptr %arrayidx35.us.1.2.1, align 8, !tbaa !5
%cmp36.us.1.2.1 = icmp eq i32 %25, %29
%30 = and i1 %cmp36.us.1.2.1, %cmp36.us.1.1.1
%narrow272 = select i1 %30, i1 %narrow270, i1 false
br i1 %narrow272, label %for.cond42.loopexit, label %for.body22.us.preheader.2
for.body22.us.preheader.2: ; preds = %for.inc56.us.1
%arrayidx26.us.2 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 0
%31 = load i32, ptr %arrayidx26.us.2, align 8, !tbaa !5
%cmp27.us.2 = icmp sgt i32 %31, 0
%arrayidx35.us.2 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 1
%32 = load i32, ptr %arrayidx35.us.2, align 4, !tbaa !5
%cmp36.us.2 = icmp eq i32 %31, %32
%narrow273 = and i1 %cmp36.us.2, %cmp27.us.2
%arrayidx35.us.2.1 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 2
%33 = load i32, ptr %arrayidx35.us.2.1, align 8, !tbaa !5
%cmp36.us.2.1 = icmp eq i32 %31, %33
%narrow274 = select i1 %cmp36.us.2.1, i1 %narrow273, i1 false
br i1 %narrow274, label %for.cond42.loopexit, label %for.inc56.us.2
for.inc56.us.2: ; preds = %for.body22.us.preheader.2
%cmp27.us.2.1 = icmp sgt i32 %32, 0
%cmp36.us.2.1234 = icmp eq i32 %32, %33
%narrow275 = and i1 %cmp36.us.2.1234, %cmp27.us.2.1
%arrayidx35.us.2.1.1 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 3
%34 = load i32, ptr %arrayidx35.us.2.1.1, align 4, !tbaa !5
%cmp36.us.2.1.1 = icmp eq i32 %32, %34
%narrow276 = and i1 %cmp36.us.2.1.1, %narrow275
br i1 %narrow276, label %for.cond42.loopexit, label %for.inc56.us.2.1
for.inc56.us.2.1: ; preds = %for.inc56.us.2
%cmp27.us.2.2 = icmp sgt i32 %33, 0
%cmp36.us.2.2 = icmp eq i32 %33, %34
%narrow277 = and i1 %cmp36.us.2.2, %cmp27.us.2.2
%arrayidx35.us.2.1.2 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %idxprom23, i64 4
%35 = load i32, ptr %arrayidx35.us.2.1.2, align 8, !tbaa !5
%cmp36.us.2.1.2 = icmp eq i32 %33, %35
%narrow278 = and i1 %cmp36.us.2.1.2, %narrow277
br i1 %narrow278, label %for.cond42.loopexit, label %for.inc61
for.inc61: ; preds = %for.inc56.us.2.1, %for.cond42.loopexit
%res.5 = phi i32 [ %add54, %for.cond42.loopexit ], [ %res.1166, %for.inc56.us.2.1 ]
%changed.5 = phi i32 [ 1, %for.cond42.loopexit ], [ %changed.1167, %for.inc56.us.2.1 ]
%indvar.next = add nuw nsw i64 %indvar, 1
%exitcond.not = icmp eq i64 %indvar.next, %4
br i1 %exitcond.not, label %for.end63, label %for.body22.us.preheader, !llvm.loop !12
for.end63: ; preds = %for.inc61
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(264) @b, i8 0, i64 264, i1 false)
br i1 %cmp14165, label %for.body72.us.preheader, label %while.cond10.loopexit
for.body72.us.preheader: ; preds = %for.end63
br i1 %lcmp.mod.not, label %for.body72.us.prol.loopexit, label %for.body72.us.prol
for.body72.us.prol: ; preds = %for.body72.us.preheader
%36 = load i32, ptr %arrayidx76.us.prol, align 8, !tbaa !5
%tobool77.not.us.prol = icmp eq i32 %36, 0
br i1 %tobool77.not.us.prol, label %for.body72.us.prol.loopexit, label %if.then78.us.prol
if.then78.us.prol: ; preds = %for.body72.us.prol
store i32 %36, ptr %arrayidx87.us.prol, align 8, !tbaa !5
br label %for.body72.us.prol.loopexit
for.body72.us.prol.loopexit: ; preds = %for.body72.us.prol, %if.then78.us.prol, %for.body72.us.preheader
%indvars.iv255.unr = phi i64 [ %2, %for.body72.us.preheader ], [ %indvars.iv.next256.prol, %if.then78.us.prol ], [ %indvars.iv.next256.prol, %for.body72.us.prol ]
%k.1173.us.unr = phi i32 [ %sub68, %for.body72.us.preheader ], [ %dec83.us.prol, %if.then78.us.prol ], [ %sub68, %for.body72.us.prol ]
br i1 %7, label %for.body72.us.1.preheader, label %for.body72.us
for.body72.us: ; preds = %for.body72.us.prol.loopexit, %for.inc89.us.1307
%indvars.iv255 = phi i64 [ %indvars.iv.next256.1305, %for.inc89.us.1307 ], [ %indvars.iv255.unr, %for.body72.us.prol.loopexit ]
%k.1173.us = phi i32 [ %k.2.us.1304, %for.inc89.us.1307 ], [ %k.1173.us.unr, %for.body72.us.prol.loopexit ]
%arrayidx76.us = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %indvars.iv255, i64 0
%37 = load i32, ptr %arrayidx76.us, align 8, !tbaa !5
%tobool77.not.us = icmp eq i32 %37, 0
br i1 %tobool77.not.us, label %for.inc89.us, label %if.then78.us
if.then78.us: ; preds = %for.body72.us
%dec83.us = add nsw i32 %k.1173.us, -1
%idxprom84.us = sext i32 %k.1173.us to i64
%arrayidx87.us = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us, i64 0
store i32 %37, ptr %arrayidx87.us, align 8, !tbaa !5
br label %for.inc89.us
for.inc89.us: ; preds = %if.then78.us, %for.body72.us
%k.2.us = phi i32 [ %dec83.us, %if.then78.us ], [ %k.1173.us, %for.body72.us ]
%indvars.iv.next256 = add nsw i64 %indvars.iv255, -1
%arrayidx76.us.1297 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %indvars.iv.next256, i64 0
%38 = load i32, ptr %arrayidx76.us.1297, align 8, !tbaa !5
%tobool77.not.us.1298 = icmp eq i32 %38, 0
br i1 %tobool77.not.us.1298, label %for.inc89.us.1307, label %if.then78.us.1303
if.then78.us.1303: ; preds = %for.inc89.us
%dec83.us.1300 = add nsw i32 %k.2.us, -1
%idxprom84.us.1301 = sext i32 %k.2.us to i64
%arrayidx87.us.1302 = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us.1301, i64 0
store i32 %38, ptr %arrayidx87.us.1302, align 8, !tbaa !5
br label %for.inc89.us.1307
for.inc89.us.1307: ; preds = %if.then78.us.1303, %for.inc89.us
%k.2.us.1304 = phi i32 [ %dec83.us.1300, %if.then78.us.1303 ], [ %k.2.us, %for.inc89.us ]
%indvars.iv.next256.1305 = add nsw i64 %indvars.iv255, -2
%cmp70.us.1306 = icmp sgt i64 %indvars.iv255, 1
br i1 %cmp70.us.1306, label %for.body72.us, label %for.body72.us.1.preheader, !llvm.loop !13
for.body72.us.1.preheader: ; preds = %for.inc89.us.1307, %for.body72.us.prol.loopexit
br i1 %lcmp.mod309.not, label %for.body72.us.1.prol.loopexit, label %for.body72.us.1.prol
for.body72.us.1.prol: ; preds = %for.body72.us.1.preheader
%39 = load i32, ptr %arrayidx76.us.1.prol, align 4, !tbaa !5
%tobool77.not.us.1.prol = icmp eq i32 %39, 0
br i1 %tobool77.not.us.1.prol, label %for.body72.us.1.prol.loopexit, label %if.then78.us.1.prol
if.then78.us.1.prol: ; preds = %for.body72.us.1.prol
store i32 %39, ptr %arrayidx87.us.1.prol, align 4, !tbaa !5
br label %for.body72.us.1.prol.loopexit
for.body72.us.1.prol.loopexit: ; preds = %for.body72.us.1.prol, %if.then78.us.1.prol, %for.body72.us.1.preheader
%indvars.iv255.1.unr = phi i64 [ %2, %for.body72.us.1.preheader ], [ %indvars.iv.next256.1.prol, %if.then78.us.1.prol ], [ %indvars.iv.next256.1.prol, %for.body72.us.1.prol ]
%k.1173.us.1.unr = phi i32 [ %sub68, %for.body72.us.1.preheader ], [ %dec83.us.1.prol, %if.then78.us.1.prol ], [ %sub68, %for.body72.us.1.prol ]
br i1 %8, label %for.body72.us.2.preheader, label %for.body72.us.1
for.body72.us.1: ; preds = %for.body72.us.1.prol.loopexit, %for.inc89.us.1.1
%indvars.iv255.1 = phi i64 [ %indvars.iv.next256.1.1, %for.inc89.us.1.1 ], [ %indvars.iv255.1.unr, %for.body72.us.1.prol.loopexit ]
%k.1173.us.1 = phi i32 [ %k.2.us.1.1, %for.inc89.us.1.1 ], [ %k.1173.us.1.unr, %for.body72.us.1.prol.loopexit ]
%arrayidx76.us.1 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %indvars.iv255.1, i64 1
%40 = load i32, ptr %arrayidx76.us.1, align 4, !tbaa !5
%tobool77.not.us.1 = icmp eq i32 %40, 0
br i1 %tobool77.not.us.1, label %for.inc89.us.1, label %if.then78.us.1
if.then78.us.1: ; preds = %for.body72.us.1
%dec83.us.1 = add nsw i32 %k.1173.us.1, -1
%idxprom84.us.1 = sext i32 %k.1173.us.1 to i64
%arrayidx87.us.1 = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us.1, i64 1
store i32 %40, ptr %arrayidx87.us.1, align 4, !tbaa !5
br label %for.inc89.us.1
for.inc89.us.1: ; preds = %if.then78.us.1, %for.body72.us.1
%k.2.us.1 = phi i32 [ %dec83.us.1, %if.then78.us.1 ], [ %k.1173.us.1, %for.body72.us.1 ]
%indvars.iv.next256.1 = add nsw i64 %indvars.iv255.1, -1
%arrayidx76.us.1.1 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %indvars.iv.next256.1, i64 1
%41 = load i32, ptr %arrayidx76.us.1.1, align 4, !tbaa !5
%tobool77.not.us.1.1 = icmp eq i32 %41, 0
br i1 %tobool77.not.us.1.1, label %for.inc89.us.1.1, label %if.then78.us.1.1
if.then78.us.1.1: ; preds = %for.inc89.us.1
%dec83.us.1.1 = add nsw i32 %k.2.us.1, -1
%idxprom84.us.1.1 = sext i32 %k.2.us.1 to i64
%arrayidx87.us.1.1 = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us.1.1, i64 1
store i32 %41, ptr %arrayidx87.us.1.1, align 4, !tbaa !5
br label %for.inc89.us.1.1
for.inc89.us.1.1: ; preds = %if.then78.us.1.1, %for.inc89.us.1
%k.2.us.1.1 = phi i32 [ %dec83.us.1.1, %if.then78.us.1.1 ], [ %k.2.us.1, %for.inc89.us.1 ]
%indvars.iv.next256.1.1 = add nsw i64 %indvars.iv255.1, -2
%cmp70.us.1.1 = icmp sgt i64 %indvars.iv255.1, 1
br i1 %cmp70.us.1.1, label %for.body72.us.1, label %for.body72.us.2.preheader, !llvm.loop !13
for.body72.us.2.preheader: ; preds = %for.inc89.us.1.1, %for.body72.us.1.prol.loopexit
br i1 %lcmp.mod311.not, label %for.body72.us.2.prol.loopexit, label %for.body72.us.2.prol
for.body72.us.2.prol: ; preds = %for.body72.us.2.preheader
%42 = load i32, ptr %arrayidx76.us.2.prol, align 8, !tbaa !5
%tobool77.not.us.2.prol = icmp eq i32 %42, 0
br i1 %tobool77.not.us.2.prol, label %for.body72.us.2.prol.loopexit, label %if.then78.us.2.prol
if.then78.us.2.prol: ; preds = %for.body72.us.2.prol
store i32 %42, ptr %arrayidx87.us.2.prol, align 8, !tbaa !5
br label %for.body72.us.2.prol.loopexit
for.body72.us.2.prol.loopexit: ; preds = %for.body72.us.2.prol, %if.then78.us.2.prol, %for.body72.us.2.preheader
%indvars.iv255.2.unr = phi i64 [ %2, %for.body72.us.2.preheader ], [ %indvars.iv.next256.2.prol, %if.then78.us.2.prol ], [ %indvars.iv.next256.2.prol, %for.body72.us.2.prol ]
%k.1173.us.2.unr = phi i32 [ %sub68, %for.body72.us.2.preheader ], [ %dec83.us.2.prol, %if.then78.us.2.prol ], [ %sub68, %for.body72.us.2.prol ]
br i1 %9, label %for.body72.us.3.preheader, label %for.body72.us.2
for.body72.us.2: ; preds = %for.body72.us.2.prol.loopexit, %for.inc89.us.2.1
%indvars.iv255.2 = phi i64 [ %indvars.iv.next256.2.1, %for.inc89.us.2.1 ], [ %indvars.iv255.2.unr, %for.body72.us.2.prol.loopexit ]
%k.1173.us.2 = phi i32 [ %k.2.us.2.1, %for.inc89.us.2.1 ], [ %k.1173.us.2.unr, %for.body72.us.2.prol.loopexit ]
%arrayidx76.us.2 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %indvars.iv255.2, i64 2
%43 = load i32, ptr %arrayidx76.us.2, align 8, !tbaa !5
%tobool77.not.us.2 = icmp eq i32 %43, 0
br i1 %tobool77.not.us.2, label %for.inc89.us.2, label %if.then78.us.2
if.then78.us.2: ; preds = %for.body72.us.2
%dec83.us.2 = add nsw i32 %k.1173.us.2, -1
%idxprom84.us.2 = sext i32 %k.1173.us.2 to i64
%arrayidx87.us.2 = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us.2, i64 2
store i32 %43, ptr %arrayidx87.us.2, align 8, !tbaa !5
br label %for.inc89.us.2
for.inc89.us.2: ; preds = %if.then78.us.2, %for.body72.us.2
%k.2.us.2 = phi i32 [ %dec83.us.2, %if.then78.us.2 ], [ %k.1173.us.2, %for.body72.us.2 ]
%indvars.iv.next256.2 = add nsw i64 %indvars.iv255.2, -1
%arrayidx76.us.2.1 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %indvars.iv.next256.2, i64 2
%44 = load i32, ptr %arrayidx76.us.2.1, align 8, !tbaa !5
%tobool77.not.us.2.1 = icmp eq i32 %44, 0
br i1 %tobool77.not.us.2.1, label %for.inc89.us.2.1, label %if.then78.us.2.1
if.then78.us.2.1: ; preds = %for.inc89.us.2
%dec83.us.2.1 = add nsw i32 %k.2.us.2, -1
%idxprom84.us.2.1 = sext i32 %k.2.us.2 to i64
%arrayidx87.us.2.1 = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us.2.1, i64 2
store i32 %44, ptr %arrayidx87.us.2.1, align 8, !tbaa !5
br label %for.inc89.us.2.1
for.inc89.us.2.1: ; preds = %if.then78.us.2.1, %for.inc89.us.2
%k.2.us.2.1 = phi i32 [ %dec83.us.2.1, %if.then78.us.2.1 ], [ %k.2.us.2, %for.inc89.us.2 ]
%indvars.iv.next256.2.1 = add nsw i64 %indvars.iv255.2, -2
%cmp70.us.2.1 = icmp sgt i64 %indvars.iv255.2, 1
br i1 %cmp70.us.2.1, label %for.body72.us.2, label %for.body72.us.3.preheader, !llvm.loop !13
for.body72.us.3.preheader: ; preds = %for.inc89.us.2.1, %for.body72.us.2.prol.loopexit
br i1 %lcmp.mod313.not, label %for.body72.us.3.prol.loopexit, label %for.body72.us.3.prol
for.body72.us.3.prol: ; preds = %for.body72.us.3.preheader
%45 = load i32, ptr %arrayidx76.us.3.prol, align 4, !tbaa !5
%tobool77.not.us.3.prol = icmp eq i32 %45, 0
br i1 %tobool77.not.us.3.prol, label %for.body72.us.3.prol.loopexit, label %if.then78.us.3.prol
if.then78.us.3.prol: ; preds = %for.body72.us.3.prol
store i32 %45, ptr %arrayidx87.us.3.prol, align 4, !tbaa !5
br label %for.body72.us.3.prol.loopexit
for.body72.us.3.prol.loopexit: ; preds = %for.body72.us.3.prol, %if.then78.us.3.prol, %for.body72.us.3.preheader
%indvars.iv255.3.unr = phi i64 [ %2, %for.body72.us.3.preheader ], [ %indvars.iv.next256.3.prol, %if.then78.us.3.prol ], [ %indvars.iv.next256.3.prol, %for.body72.us.3.prol ]
%k.1173.us.3.unr = phi i32 [ %sub68, %for.body72.us.3.preheader ], [ %dec83.us.3.prol, %if.then78.us.3.prol ], [ %sub68, %for.body72.us.3.prol ]
br i1 %10, label %for.body72.us.4.preheader, label %for.body72.us.3
for.body72.us.3: ; preds = %for.body72.us.3.prol.loopexit, %for.inc89.us.3.1
%indvars.iv255.3 = phi i64 [ %indvars.iv.next256.3.1, %for.inc89.us.3.1 ], [ %indvars.iv255.3.unr, %for.body72.us.3.prol.loopexit ]
%k.1173.us.3 = phi i32 [ %k.2.us.3.1, %for.inc89.us.3.1 ], [ %k.1173.us.3.unr, %for.body72.us.3.prol.loopexit ]
%arrayidx76.us.3 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %indvars.iv255.3, i64 3
%46 = load i32, ptr %arrayidx76.us.3, align 4, !tbaa !5
%tobool77.not.us.3 = icmp eq i32 %46, 0
br i1 %tobool77.not.us.3, label %for.inc89.us.3, label %if.then78.us.3
if.then78.us.3: ; preds = %for.body72.us.3
%dec83.us.3 = add nsw i32 %k.1173.us.3, -1
%idxprom84.us.3 = sext i32 %k.1173.us.3 to i64
%arrayidx87.us.3 = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us.3, i64 3
store i32 %46, ptr %arrayidx87.us.3, align 4, !tbaa !5
br label %for.inc89.us.3
for.inc89.us.3: ; preds = %if.then78.us.3, %for.body72.us.3
%k.2.us.3 = phi i32 [ %dec83.us.3, %if.then78.us.3 ], [ %k.1173.us.3, %for.body72.us.3 ]
%indvars.iv.next256.3 = add nsw i64 %indvars.iv255.3, -1
%arrayidx76.us.3.1 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %indvars.iv.next256.3, i64 3
%47 = load i32, ptr %arrayidx76.us.3.1, align 4, !tbaa !5
%tobool77.not.us.3.1 = icmp eq i32 %47, 0
br i1 %tobool77.not.us.3.1, label %for.inc89.us.3.1, label %if.then78.us.3.1
if.then78.us.3.1: ; preds = %for.inc89.us.3
%dec83.us.3.1 = add nsw i32 %k.2.us.3, -1
%idxprom84.us.3.1 = sext i32 %k.2.us.3 to i64
%arrayidx87.us.3.1 = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us.3.1, i64 3
store i32 %47, ptr %arrayidx87.us.3.1, align 4, !tbaa !5
br label %for.inc89.us.3.1
for.inc89.us.3.1: ; preds = %if.then78.us.3.1, %for.inc89.us.3
%k.2.us.3.1 = phi i32 [ %dec83.us.3.1, %if.then78.us.3.1 ], [ %k.2.us.3, %for.inc89.us.3 ]
%indvars.iv.next256.3.1 = add nsw i64 %indvars.iv255.3, -2
%cmp70.us.3.1 = icmp sgt i64 %indvars.iv255.3, 1
br i1 %cmp70.us.3.1, label %for.body72.us.3, label %for.body72.us.4.preheader, !llvm.loop !13
for.body72.us.4.preheader: ; preds = %for.inc89.us.3.1, %for.body72.us.3.prol.loopexit
br i1 %lcmp.mod315.not, label %for.body72.us.4.prol.loopexit, label %for.body72.us.4.prol
for.body72.us.4.prol: ; preds = %for.body72.us.4.preheader
%48 = load i32, ptr %arrayidx76.us.4.prol, align 8, !tbaa !5
%tobool77.not.us.4.prol = icmp eq i32 %48, 0
br i1 %tobool77.not.us.4.prol, label %for.body72.us.4.prol.loopexit, label %if.then78.us.4.prol
if.then78.us.4.prol: ; preds = %for.body72.us.4.prol
store i32 %48, ptr %arrayidx87.us.4.prol, align 8, !tbaa !5
br label %for.body72.us.4.prol.loopexit
for.body72.us.4.prol.loopexit: ; preds = %for.body72.us.4.prol, %if.then78.us.4.prol, %for.body72.us.4.preheader
%indvars.iv255.4.unr = phi i64 [ %2, %for.body72.us.4.preheader ], [ %indvars.iv.next256.4.prol, %if.then78.us.4.prol ], [ %indvars.iv.next256.4.prol, %for.body72.us.4.prol ]
%k.1173.us.4.unr = phi i32 [ %sub68, %for.body72.us.4.preheader ], [ %dec83.us.4.prol, %if.then78.us.4.prol ], [ %sub68, %for.body72.us.4.prol ]
br i1 %11, label %while.cond10.loopexit, label %for.body72.us.4
for.body72.us.4: ; preds = %for.body72.us.4.prol.loopexit, %for.inc89.us.4.1
%indvars.iv255.4 = phi i64 [ %indvars.iv.next256.4.1, %for.inc89.us.4.1 ], [ %indvars.iv255.4.unr, %for.body72.us.4.prol.loopexit ]
%k.1173.us.4 = phi i32 [ %k.2.us.4.1, %for.inc89.us.4.1 ], [ %k.1173.us.4.unr, %for.body72.us.4.prol.loopexit ]
%arrayidx76.us.4 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %indvars.iv255.4, i64 4
%49 = load i32, ptr %arrayidx76.us.4, align 8, !tbaa !5
%tobool77.not.us.4 = icmp eq i32 %49, 0
br i1 %tobool77.not.us.4, label %for.inc89.us.4, label %if.then78.us.4
if.then78.us.4: ; preds = %for.body72.us.4
%dec83.us.4 = add nsw i32 %k.1173.us.4, -1
%idxprom84.us.4 = sext i32 %k.1173.us.4 to i64
%arrayidx87.us.4 = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us.4, i64 4
store i32 %49, ptr %arrayidx87.us.4, align 8, !tbaa !5
br label %for.inc89.us.4
for.inc89.us.4: ; preds = %if.then78.us.4, %for.body72.us.4
%k.2.us.4 = phi i32 [ %dec83.us.4, %if.then78.us.4 ], [ %k.1173.us.4, %for.body72.us.4 ]
%indvars.iv.next256.4 = add nsw i64 %indvars.iv255.4, -1
%arrayidx76.us.4.1 = getelementptr inbounds [11 x [6 x i32]], ptr @a, i64 0, i64 %indvars.iv.next256.4, i64 4
%50 = load i32, ptr %arrayidx76.us.4.1, align 8, !tbaa !5
%tobool77.not.us.4.1 = icmp eq i32 %50, 0
br i1 %tobool77.not.us.4.1, label %for.inc89.us.4.1, label %if.then78.us.4.1
if.then78.us.4.1: ; preds = %for.inc89.us.4
%dec83.us.4.1 = add nsw i32 %k.2.us.4, -1
%idxprom84.us.4.1 = sext i32 %k.2.us.4 to i64
%arrayidx87.us.4.1 = getelementptr inbounds [11 x [6 x i32]], ptr @b, i64 0, i64 %idxprom84.us.4.1, i64 4
store i32 %50, ptr %arrayidx87.us.4.1, align 8, !tbaa !5
br label %for.inc89.us.4.1
for.inc89.us.4.1: ; preds = %if.then78.us.4.1, %for.inc89.us.4
%k.2.us.4.1 = phi i32 [ %dec83.us.4.1, %if.then78.us.4.1 ], [ %k.2.us.4, %for.inc89.us.4 ]
%indvars.iv.next256.4.1 = add nsw i64 %indvars.iv255.4, -2
%cmp70.us.4.1 = icmp sgt i64 %indvars.iv255.4, 1
br i1 %cmp70.us.4.1, label %for.body72.us.4, label %while.cond10.loopexit, !llvm.loop !13
while.end: ; preds = %while.cond10.loopexit, %while.cond10.loopexit.thread
%res.1.lcssa281288 = phi i32 [ %res.0175, %while.cond10.loopexit.thread ], [ %res.5, %while.cond10.loopexit ]
%call95 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %res.1.lcssa281288)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%51 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %51, 0
br i1 %tobool.not, label %while.end96, label %while.body, !llvm.loop !14
while.end96: ; preds = %while.end, %entry
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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <limits.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>
#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
#define SWAP(type, a, b) { const type tmp = a; a = b; b = tmp; }
int compare_sz_asc(const void* a, const void* b) {
return *((size_t*)a) < *((size_t*)b) ? -1 : 1;
}
int compare_sz_desc(const void* a, const void* b) {
return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}
int compare_i64_asc(const void* a, const void* b) {
return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}
int compare_i64_desc(const void* a, const void* b) {
return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1;
}
int compare_u64_asc(const void* a, const void* b) {
return *((uint64_t*)a) < *((uint64_t*)b) ? -1 : 1;
}
int compare_u64_desc(const void* a, const void* b) {
return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}
int compare_c_asc(const void* a, const void* b) {
return *((char*)a) < *((char*)b) ? -1 : 1;
}
int compare_c_desc(const void* a, const void* b) {
return *((char*)a) > * ((char*)b) ? -1 : 1;
}
int compare_dp_asc(const void* a, const void* b) {
return *((double*)a) < *((double*)b) ? -1 : 1;
}
static uint64_t modinvU64(const uint64_t a, const uint64_t m) {
int64_t aa = (int64_t)a;
const int64_t mm = (int64_t)m;
int64_t b = mm;
int64_t u = 1;
int64_t v = 0;
while (b != 0) {
const int64_t t = aa / b;
aa -= t * b;
SWAP(uint64_t, aa, b);
u -= t * v;
SWAP(uint64_t, u, v);
}
u %= mm;
if (u < 0) {
u += m;
}
return (uint64_t)u;
}
static size_t powSz(const size_t base, const size_t exp) {
if (exp == 0) {
return 1;
}
if (exp == 1) {
return base;
}
if (exp % 2 == 0) {
return powSz(base * base, exp / 2);
}
else {
return base * powSz(base, exp - 1);
}
}
static uint64_t powU64(const uint64_t base, const uint64_t exp) {
if (exp == 0) {
return 1;
}
if (exp == 1) {
return base;
}
if (exp % 2 == 0) {
return powU64(base * base, exp / 2);
}
else {
return base * powU64(base, exp - 1);
}
}
static uint64_t powU64WMod(const uint64_t base, const uint64_t exp, const uint64_t m) {
if (exp == 0) {
return 1;
}
if (exp == 1) {
return base % m;
}
if (exp % 2 == 0) {
return powU64WMod(base * base % m, exp / 2, m);
}
else {
return base * powU64WMod(base, exp - 1, m) % m;
}
}
static size_t comb(const size_t n, const size_t r) {
size_t result = 1;
for (size_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
static uint64_t combU64(const uint64_t n, const uint64_t r) {
uint64_t result = 1;
for (uint64_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
static uint64_t combU64WMod(const uint64_t n, const uint64_t r, const uint64_t m) {
uint64_t result = 1;
for (uint64_t i = 0; i < r; i++) {
result = result * (n - i) % m;
result = result * modinvU64(i + 1, m) % m;
}
return result;
}
static uint64_t permU64WMod(const uint64_t n, const uint64_t m) {
uint64_t result = 1;
for (uint64_t v = 2; v <= n; v++) {
result *= v;
result %= m;
}
return result;
}
static size_t gcdZu(size_t m, size_t n) {
size_t temp;
while (m % n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
static uint64_t gcdU64(uint64_t m, uint64_t n)
{
uint64_t temp;
while (m % n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
typedef struct {
uint64_t val;
}BHeap_Val;
#define BHEAP_VAL_TYPE BHeap_Val
#define BHEAP_INVALID_NODE ((size_t)100000000)
typedef struct {
BHEAP_VAL_TYPE val;
} BHeap_Node;
struct _BHeap_Ctx {
size_t size;
int (*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node);
void(*notifyNodeChange)(const struct _BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList);
BHeap_Node* node;
};
typedef struct _BHeap_Ctx BHeap_Ctx;
static void bHeap_Init(BHeap_Ctx* const ctx, int(*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node), void(*notifyNodeChange)(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList), BHeap_Node* const nodes) {
ctx->size = 0;
ctx->compare = compare;
ctx->notifyNodeChange = notifyNodeChange;
ctx->node = nodes;
}
static void bHeap_Swap(BHeap_Ctx* const ctx, const size_t node0, const size_t node1) {
const BHEAP_VAL_TYPE tmp = ctx->node[node0].val;
ctx->node[node0].val = ctx->node[node1].val;
ctx->node[node1].val = tmp;
if (ctx->notifyNodeChange != NULL) {
const size_t nodeList[2] = { node0,node1 };
ctx->notifyNodeChange(ctx, 2, nodeList);
}
}
static void bHeap_UpHeap(BHeap_Ctx* const ctx, const size_t nodeIdx) {
if (nodeIdx == 0) {
return;
}
const size_t parentIdx = (nodeIdx + 1) / 2 - 1;
const int compareResult = ctx->compare(&(ctx->node[parentIdx].val), &(ctx->node[nodeIdx].val));
if (0 < compareResult) {
bHeap_Swap(ctx, nodeIdx, parentIdx);
if (parentIdx != 0) {
bHeap_UpHeap(ctx, parentIdx);
}
}
}
static void bHeap_DownHeap(BHeap_Ctx* const ctx, const size_t nodeIdx) {
if (ctx->size - 1 <= nodeIdx) {
return;
}
const size_t leftIdx = 2 * (nodeIdx + 1) - 1;
if (leftIdx < ctx->size) {
const int leftResult = ctx->compare(&(ctx->node[nodeIdx].val), &(ctx->node[leftIdx].val));
size_t swapTarget = leftResult < 0 ? BHEAP_INVALID_NODE : leftIdx;
const size_t rightIdx = leftIdx + 1;
if (rightIdx < ctx->size) {
const int rightResult = ctx->compare(&(ctx->node[nodeIdx].val), &(ctx->node[rightIdx].val));
if (swapTarget == BHEAP_INVALID_NODE) {
if (0 < rightResult) {
swapTarget = rightIdx;
}
}
else {
if (0 < rightResult) {
const int rightLeftResult = ctx->compare(&(ctx->node[leftIdx].val), &(ctx->node[rightIdx].val));
if (0 < rightLeftResult) {
swapTarget = rightIdx;
}
}
}
}
if (swapTarget != BHEAP_INVALID_NODE) {
bHeap_Swap(ctx, nodeIdx, swapTarget);
bHeap_DownHeap(ctx, swapTarget);
}
}
}
static void bHeap_Add(BHeap_Ctx* const ctx, const BHEAP_VAL_TYPE val) {
ctx->node[ctx->size].val = val;
ctx->size++;
if (ctx->notifyNodeChange != NULL) {
const size_t node = ctx->size - 1;
ctx->notifyNodeChange(ctx, 1, &node);
}
bHeap_UpHeap(ctx, ctx->size - 1);
}
static void bHeap_RemoveTop(BHeap_Ctx* const ctx) {
if (ctx->size == 0) {
return;
}
if (ctx->size == 1) {
ctx->size--;
return;
}
ctx->node[0].val = ctx->node[ctx->size - 1].val;
if (ctx->notifyNodeChange != NULL) {
const size_t node = 0;
ctx->notifyNodeChange(ctx, 1, &node);
}
ctx->size--;
bHeap_DownHeap(ctx, 0);
}
static void bHeap_RemoveNode(BHeap_Ctx* const ctx, const size_t node) {
if (node == ctx->size - 1) {
ctx->size--;
}
else {
ctx->node[node].val = ctx->node[ctx->size - 1].val;
ctx->size--;
if (ctx->notifyNodeChange != NULL) {
ctx->notifyNodeChange(ctx, 1, &node);
}
bHeap_DownHeap(ctx, node);
bHeap_UpHeap(ctx, node);
}
}
static BHEAP_VAL_TYPE* bHeap_GetTopVal(const BHeap_Ctx* const ctx) {
return ctx->size == 0 ? NULL : &(ctx->node[0].val);
}
typedef struct {
uint64_t cnt;
size_t* child;
size_t numChild;
size_t maxNumChild;
} Tree_Node;
#define TREE_INIT_ALLOC (128)
static Tree_Node tree_Node[200000];
static void tree_Init(const uint64_t N) {
for (uint64_t i = 0; i < N; i++) {
tree_Node[i].cnt = 0;
tree_Node[i].numChild = 0;
tree_Node[i].child = malloc(sizeof(size_t) * TREE_INIT_ALLOC);
tree_Node[i].maxNumChild = TREE_INIT_ALLOC;
}
}
static void tree_AddChild(const size_t parent, const size_t child) {
if (tree_Node[parent].maxNumChild <= tree_Node[parent].numChild) {
tree_Node[parent].child = realloc(tree_Node[parent].child, sizeof(size_t) * tree_Node[parent].maxNumChild * 2);
tree_Node[parent].maxNumChild *= 2;
}
tree_Node[parent].child[tree_Node[parent].numChild] = child;
tree_Node[parent].numChild++;
}
static BHeap_Node BN_Asc[200000];
static BHeap_Node BN_Desc[200000];
static int _bHeap_Compare_Asc(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node) {
return parent->val <= node->val ? -1 : 1;
}
static int _bHeap_Compare_Desc(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node) {
return parent->val >= node->val ? -1 : 1;
}
static size_t PBHeap_Asc_Idx[200000];
static size_t PBHeap_Desc_Idx[200000];
static void _bHeap_NotifyNodeChange_Asc(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList) {
for (size_t i = 0; i < nodeListSize; i++) {
PBHeap_Asc_Idx[ctx->node[nodeList[i]].val.val] = nodeList[i];
}
}
static void _bHeap_NotifyNodeChange_Desc(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList) {
for (size_t i = 0; i < nodeListSize; i++) {
PBHeap_Desc_Idx[ctx->node[nodeList[i]].val.val] = nodeList[i];
}
}
#define UF_ROOT ((size_t)10000000)
typedef struct {
size_t parent;
uint64_t w;
uint64_t v;
uint64_t wSum;
uint64_t vSum;
} UF_Node;
static UF_Node uf_Node[101];
static size_t uf_GetRoot(const size_t idx) {
if (uf_Node[idx].parent == UF_ROOT) {
return idx;
}
const size_t root = uf_GetRoot(uf_Node[idx].parent);
uf_Node[idx].parent = root;
return root;
}
static void uf_Merge(const size_t a, const size_t b) {
const size_t aRoot = uf_GetRoot(a);
const size_t bRoot = uf_GetRoot(b);
if (aRoot != bRoot) {
uf_Node[aRoot].parent = bRoot;
uf_Node[bRoot].wSum += uf_Node[aRoot].wSum;
uf_Node[bRoot].vSum += uf_Node[aRoot].vSum;
}
}
#define MOD_VAL (UINT64_C(1000000007))
static uint64_t cnt[100000];
static uint64_t A[100000];
int main(void) {
uint64_t T[2],A[2],B[2];
scanf("%"PRIu64"%"PRIu64"%"PRIu64"%"PRIu64"%"PRIu64"%"PRIu64, &T[0], &T[1], &A[0], &A[1], &B[0], &B[1]);
uint64_t pace[2];
pace[0] = T[0] * A[0] + T[1] * A[1];
pace[1] = T[0] * B[0] + T[1] * B[1];
if (pace[0] == pace[1]) {
puts("infinity");
}
else {
if ((A[0] < B[0] && pace[0] < pace[1]) || (A[0] > B[0] && pace[0] > pace[1])) {
puts("0");
}
else {
uint64_t cnt = 0;
if (ABSS(A[0], B[0]) * T[0] % ABSS(pace[0], pace[1]) == 0) {
uint64_t cC = ABSS(A[0], B[0]) * T[0] / ABSS(pace[0], pace[1]);
cnt++;
cC--;
if (0 < cC) {
cnt += 2 * cC;
}
cnt++;
}
else {
uint64_t cC = ABSS(A[0], B[0]) * T[0] / ABSS(pace[0], pace[1]) + 1;
cnt++;
cC--;
if (0 < cC) {
cnt += 2 * cC;
}
}
printf("%"PRIu64"\n", cnt);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211575/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211575/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [19 x i8] c"%lu%lu%lu%lu%lu%lu\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"infinity\00", align 1
@.str.2 = private unnamed_addr constant [2 x i8] c"0\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%lu\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_sz_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp ult i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_sz_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp ugt i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_i64_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_i64_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_u64_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp ult i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_u64_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp ugt i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_c_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !9
%1 = load i8, ptr %b, align 1, !tbaa !9
%cmp = icmp slt i8 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_c_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !9
%1 = load i8, ptr %b, align 1, !tbaa !9
%cmp = icmp sgt i8 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_dp_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !10
%1 = load double, ptr %b, align 8, !tbaa !10
%cmp = fcmp olt double %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%T = alloca [2 x i64], align 16
%A = alloca [2 x i64], align 16
%B = alloca [2 x i64], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %T) #4
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %B) #4
%arrayidx1 = getelementptr inbounds [2 x i64], ptr %T, i64 0, i64 1
%arrayidx3 = getelementptr inbounds [2 x i64], ptr %A, i64 0, i64 1
%arrayidx5 = getelementptr inbounds [2 x i64], ptr %B, i64 0, i64 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %A, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %B, ptr noundef nonnull %arrayidx5)
%0 = load i64, ptr %T, align 16, !tbaa !5
%1 = load i64, ptr %A, align 16, !tbaa !5
%mul = mul i64 %1, %0
%2 = load i64, ptr %arrayidx1, align 8, !tbaa !5
%3 = load i64, ptr %arrayidx3, align 8, !tbaa !5
%mul10 = mul i64 %3, %2
%add = add i64 %mul10, %mul
%4 = load i64, ptr %B, align 16, !tbaa !5
%mul14 = mul i64 %4, %0
%5 = load i64, ptr %arrayidx5, align 8, !tbaa !5
%mul17 = mul i64 %5, %2
%add18 = add i64 %mul17, %mul14
%cmp = icmp eq i64 %add, %add18
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call22 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end139
if.else: ; preds = %entry
%cmp25 = icmp ult i64 %1, %4
%cmp28 = icmp ult i64 %add, %add18
%or.cond = and i1 %cmp25, %cmp28
br i1 %or.cond, label %if.then36, label %lor.lhs.false
lor.lhs.false: ; preds = %if.else
%cmp31 = icmp ugt i64 %1, %4
%cmp35 = icmp ugt i64 %add, %add18
%or.cond181 = and i1 %cmp31, %cmp35
br i1 %or.cond181, label %if.then36, label %if.else38
if.then36: ; preds = %lor.lhs.false, %if.else
%call37 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end139
if.else38: ; preds = %lor.lhs.false
%sub = sub i64 %1, %4
%sub46 = sub i64 %4, %1
%cond = select i1 %cmp31, i64 %sub, i64 %sub46
%mul48 = mul i64 %cond, %0
%sub55 = sub i64 %add, %add18
%sub59 = sub i64 %add18, %add
%cond61 = select i1 %cmp35, i64 %sub55, i64 %sub59
%rem = urem i64 %mul48, %cond61
%div127 = udiv i64 %mul48, %cond61
%cmp62 = icmp eq i64 %rem, 0
br i1 %cmp62, label %if.then63, label %if.else97
if.then63: ; preds = %if.else38
%div = udiv i64 %mul48, %cond61
%dec = shl i64 %div, 1
br label %if.end136
if.else97: ; preds = %if.else38
%cmp131.not = icmp ugt i64 %cond61, %mul48
br i1 %cmp131.not, label %if.end136, label %if.then132
if.then132: ; preds = %if.else97
%mul133 = shl i64 %div127, 1
%add134 = or i64 %mul133, 1
br label %if.end136
if.end136: ; preds = %if.else97, %if.then132, %if.then63
%cnt.2 = phi i64 [ %dec, %if.then63 ], [ %add134, %if.then132 ], [ 1, %if.else97 ]
%call137 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %cnt.2)
br label %if.end139
if.end139: ; preds = %if.then36, %if.end136, %if.then
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %T) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"double", !7, i64 0}
|
#include <stdio.h>
void selection(int a[], int l, int r);
int main(void)
{
int n, x;
int a[110];
scanf("%d %d", &n, &x);
for (int i=0; i < n; i++) {scanf("%d", &a[i]);}
selection(a,0,n);
int ans = 0;
for (int i=0;i<n;i++) {
if (x >= a[i]) {
ans++;
x -= a[i];
}
}
if (x > 0&&ans == n) {--ans;}
printf("%d\n", ans);
return 0;
}
void selection(int a[], int l, int r)
{
for (int i=l; i < r-1; i++) {
int min = i;
for (int j=i+1; j < r; j++) { if (a[j] < a[min]) { min = j;} }
int t = a[i];
a[i] = a[min];
a[min] = t;
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211618/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211618/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%a = alloca [110 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %x)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp32 = icmp sgt i32 %0, 0
br i1 %cmp32, label %for.body, label %selection.exit.thread
selection.exit.thread: ; preds = %entry
%x.promoted50 = load i32, ptr %x, align 4, !tbaa !5
br label %for.cond.cleanup5
for.cond.cleanup: ; preds = %for.body
%cmp38.i = icmp sgt i32 %9, 1
br i1 %cmp38.i, label %for.body.preheader.i, label %selection.exit
for.body.preheader.i: ; preds = %for.cond.cleanup
%sub.i = add nsw i32 %9, -1
%1 = zext i32 %9 to i64
%wide.trip.count.i = zext i32 %sub.i to i64
br label %for.body.i
for.body.i: ; preds = %for.cond.cleanup3.i, %for.body.preheader.i
%indvars.iv43.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next44.i, %for.cond.cleanup3.i ]
%indvars.iv.next44.i = add nuw nsw i64 %indvars.iv43.i, 1
%cmp235.i = icmp ult i64 %indvars.iv.next44.i, %1
%2 = trunc i64 %indvars.iv43.i to i32
br i1 %cmp235.i, label %for.body4.i, label %for.cond.cleanup3.i
for.cond.cleanup3.i: ; preds = %for.body4.i, %for.body.i
%min.0.lcssa.i = phi i32 [ %2, %for.body.i ], [ %spec.select.i, %for.body4.i ]
%arrayidx9.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv43.i
%3 = load i32, ptr %arrayidx9.i, align 4, !tbaa !5
%idxprom10.i = sext i32 %min.0.lcssa.i to i64
%arrayidx11.i = getelementptr inbounds i32, ptr %a, i64 %idxprom10.i
%4 = load i32, ptr %arrayidx11.i, align 4, !tbaa !5
store i32 %4, ptr %arrayidx9.i, align 4, !tbaa !5
store i32 %3, ptr %arrayidx11.i, align 4, !tbaa !5
%exitcond.not.i = icmp eq i64 %indvars.iv.next44.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %selection.exit, label %for.body.i, !llvm.loop !9
for.body4.i: ; preds = %for.body.i, %for.body4.i
%indvars.iv40.i = phi i64 [ %indvars.iv.next41.i, %for.body4.i ], [ %indvars.iv.next44.i, %for.body.i ]
%min.036.i = phi i32 [ %spec.select.i, %for.body4.i ], [ %2, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv40.i
%5 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom5.i = sext i32 %min.036.i to i64
%arrayidx6.i = getelementptr inbounds i32, ptr %a, i64 %idxprom5.i
%6 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5
%cmp7.i = icmp slt i32 %5, %6
%7 = trunc i64 %indvars.iv40.i to i32
%spec.select.i = select i1 %cmp7.i, i32 %7, i32 %min.036.i
%indvars.iv.next41.i = add nuw nsw i64 %indvars.iv40.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next41.i, %1
br i1 %cmp2.i, label %for.body4.i, label %for.cond.cleanup3.i, !llvm.loop !11
selection.exit: ; preds = %for.cond.cleanup3.i, %for.cond.cleanup
%x.promoted = load i32, ptr %x, align 4, !tbaa !5
%cmp436 = icmp sgt i32 %9, 0
br i1 %cmp436, label %for.body6.preheader, label %for.cond.cleanup5
for.body6.preheader: ; preds = %selection.exit
%wide.trip.count = zext i32 %9 to i64
%xtraiter = and i64 %wide.trip.count, 1
%8 = icmp eq i32 %9, 1
br i1 %8, label %for.cond.cleanup5.loopexit.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [110 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp = icmp slt i64 %indvars.iv.next, %10
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !12
for.cond.cleanup5.loopexit.unr-lcssa: ; preds = %for.inc13.1, %for.body6.preheader
%sub34.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %sub34.1, %for.inc13.1 ]
%ans.1.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %ans.1.1, %for.inc13.1 ]
%indvars.iv43.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next44.1, %for.inc13.1 ]
%ans.038.unr = phi i32 [ 0, %for.body6.preheader ], [ %ans.1.1, %for.inc13.1 ]
%sub3537.unr = phi i32 [ %x.promoted, %for.body6.preheader ], [ %sub34.1, %for.inc13.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup5, label %for.body6.epil
for.body6.epil: ; preds = %for.cond.cleanup5.loopexit.unr-lcssa
%arrayidx8.epil = getelementptr inbounds [110 x i32], ptr %a, i64 0, i64 %indvars.iv43.unr
%11 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5
%cmp9.not.epil = icmp slt i32 %sub3537.unr, %11
br i1 %cmp9.not.epil, label %for.cond.cleanup5, label %if.then.epil
if.then.epil: ; preds = %for.body6.epil
%inc10.epil = add nsw i32 %ans.038.unr, 1
%sub.epil = sub nsw i32 %sub3537.unr, %11
store i32 %sub.epil, ptr %x, align 4, !tbaa !5
br label %for.cond.cleanup5
for.cond.cleanup5: ; preds = %for.cond.cleanup5.loopexit.unr-lcssa, %if.then.epil, %for.body6.epil, %selection.exit.thread, %selection.exit
%.lcssa4852 = phi i32 [ %9, %selection.exit ], [ %0, %selection.exit.thread ], [ %9, %for.body6.epil ], [ %9, %if.then.epil ], [ %9, %for.cond.cleanup5.loopexit.unr-lcssa ]
%12 = phi i32 [ %x.promoted, %selection.exit ], [ %x.promoted50, %selection.exit.thread ], [ %sub34.lcssa.ph, %for.cond.cleanup5.loopexit.unr-lcssa ], [ %sub.epil, %if.then.epil ], [ %sub3537.unr, %for.body6.epil ]
%ans.0.lcssa = phi i32 [ 0, %selection.exit ], [ 0, %selection.exit.thread ], [ %ans.1.lcssa.ph, %for.cond.cleanup5.loopexit.unr-lcssa ], [ %inc10.epil, %if.then.epil ], [ %ans.038.unr, %for.body6.epil ]
%cmp16 = icmp sgt i32 %12, 0
%cmp17 = icmp eq i32 %ans.0.lcssa, %.lcssa4852
%or.cond = and i1 %cmp16, %cmp17
%dec = sext i1 %or.cond to i32
%ans.2 = add nsw i32 %ans.0.lcssa, %dec
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.2)
call void @llvm.lifetime.end.p0(i64 440, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body6: ; preds = %for.inc13.1, %for.body6.preheader.new
%indvars.iv43 = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next44.1, %for.inc13.1 ]
%ans.038 = phi i32 [ 0, %for.body6.preheader.new ], [ %ans.1.1, %for.inc13.1 ]
%sub3537 = phi i32 [ %x.promoted, %for.body6.preheader.new ], [ %sub34.1, %for.inc13.1 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.inc13.1 ]
%arrayidx8 = getelementptr inbounds [110 x i32], ptr %a, i64 0, i64 %indvars.iv43
%13 = load i32, ptr %arrayidx8, align 8, !tbaa !5
%cmp9.not = icmp slt i32 %sub3537, %13
br i1 %cmp9.not, label %for.inc13, label %if.then
if.then: ; preds = %for.body6
%inc10 = add nsw i32 %ans.038, 1
%sub = sub nsw i32 %sub3537, %13
store i32 %sub, ptr %x, align 4, !tbaa !5
br label %for.inc13
for.inc13: ; preds = %for.body6, %if.then
%sub34 = phi i32 [ %sub, %if.then ], [ %sub3537, %for.body6 ]
%ans.1 = phi i32 [ %inc10, %if.then ], [ %ans.038, %for.body6 ]
%indvars.iv.next44 = or i64 %indvars.iv43, 1
%arrayidx8.1 = getelementptr inbounds [110 x i32], ptr %a, i64 0, i64 %indvars.iv.next44
%14 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5
%cmp9.not.1 = icmp slt i32 %sub34, %14
br i1 %cmp9.not.1, label %for.inc13.1, label %if.then.1
if.then.1: ; preds = %for.inc13
%inc10.1 = add nsw i32 %ans.1, 1
%sub.1 = sub nsw i32 %sub34, %14
store i32 %sub.1, ptr %x, align 4, !tbaa !5
br label %for.inc13.1
for.inc13.1: ; preds = %if.then.1, %for.inc13
%sub34.1 = phi i32 [ %sub.1, %if.then.1 ], [ %sub34, %for.inc13 ]
%ans.1.1 = phi i32 [ %inc10.1, %if.then.1 ], [ %ans.1, %for.inc13 ]
%indvars.iv.next44.1 = add nuw nsw i64 %indvars.iv43, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup5.loopexit.unr-lcssa, label %for.body6, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @selection(ptr nocapture noundef %a, i32 noundef %l, i32 noundef %r) local_unnamed_addr #3 {
entry:
%sub = add nsw i32 %r, -1
%cmp38 = icmp sgt i32 %sub, %l
br i1 %cmp38, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = sext i32 %l to i64
%1 = sext i32 %r to i64
%wide.trip.count = sext i32 %sub to i64
br label %for.body
for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry
ret void
for.body: ; preds = %for.body.preheader, %for.cond.cleanup3
%indvars.iv43 = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next44, %for.cond.cleanup3 ]
%indvars.iv.in = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv, %for.cond.cleanup3 ]
%indvars.iv = add nsw i64 %indvars.iv.in, 1
%indvars.iv.next44 = add nsw i64 %indvars.iv43, 1
%cmp235 = icmp slt i64 %indvars.iv.next44, %1
%2 = trunc i64 %indvars.iv43 to i32
br i1 %cmp235, label %for.body4, label %for.cond.cleanup3
for.cond.cleanup3: ; preds = %for.body4, %for.body
%min.0.lcssa = phi i32 [ %2, %for.body ], [ %spec.select, %for.body4 ]
%arrayidx9 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv43
%3 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%idxprom10 = sext i32 %min.0.lcssa to i64
%arrayidx11 = getelementptr inbounds i32, ptr %a, i64 %idxprom10
%4 = load i32, ptr %arrayidx11, align 4, !tbaa !5
store i32 %4, ptr %arrayidx9, align 4, !tbaa !5
store i32 %3, ptr %arrayidx11, align 4, !tbaa !5
%exitcond.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
for.body4: ; preds = %for.body, %for.body4
%indvars.iv40 = phi i64 [ %indvars.iv.next41, %for.body4 ], [ %indvars.iv, %for.body ]
%min.036 = phi i32 [ %spec.select, %for.body4 ], [ %2, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv40
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom5 = sext i32 %min.036 to i64
%arrayidx6 = getelementptr inbounds i32, ptr %a, i64 %idxprom5
%6 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp slt i32 %5, %6
%7 = trunc i64 %indvars.iv40 to i32
%spec.select = select i1 %cmp7, i32 %7, i32 %min.036
%indvars.iv.next41 = add nsw i64 %indvars.iv40, 1
%cmp2 = icmp slt i64 %indvars.iv.next41, %1
br i1 %cmp2, label %for.body4, label %for.cond.cleanup3, !llvm.loop !11
}
; 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 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int list[105];
void qsort_v2(int d[], int s, int e)
{
int i, j, p, temp;
if(e - s <= 1) {
return;
}
p = d[s];
i = s;
j = e - 1;
while (1) {
while (d[i] < p && i < e)
i++;
while (p < d[j] && j > s)
j--;
if (i >= j)
break;
temp = d[i];
d[i] = d[j];
d[j] = temp;
i++;
j--;
}
qsort_v2(d, s, i);
qsort_v2(d, j + 1, e);
for(i = 0; i <= e; i++) {
list[i] = d[i];
}
}
int main(void)
{
int n, x;
int i;
scanf("%d %d\n", &n, &x);
for(i = 0; i < n; i++) {
if(i == n - 1) {
scanf("%d", &list[i]);
} else {
scanf("%d ", &list[i]);
}
}
qsort_v2(list, 0, n);
for(i = 0; i < n; i++) {
if(list[i] > x) {
printf("%d\n", i);
break;
} else if(i == n - 1) {
if(list[i] == x) {
printf("%d\n", i + 1);
} else {
printf("%d\n", i);
}
} else {
x -= list[i];
//printf("%d人目に配った、残りは%dこだ\n", i + 1, x);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211676/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211676/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@list = dso_local global [105 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 [4 x i8] c"%d \00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @qsort_v2(ptr noundef %d, i32 noundef %s, i32 noundef %e) local_unnamed_addr #0 {
entry:
%d93 = ptrtoint ptr %d to i64
%sub = sub nsw i32 %e, %s
%cmp = icmp slt i32 %sub, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%idxprom = sext i32 %s to i64
%arrayidx = getelementptr inbounds i32, ptr %d, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%1 = sext i32 %e to i64
br label %while.cond
while.cond: ; preds = %if.end19, %if.end
%j.0.in = phi i32 [ %e, %if.end ], [ %9, %if.end19 ]
%i.0 = phi i32 [ %s, %if.end ], [ %inc28, %if.end19 ]
%2 = sext i32 %i.0 to i64
br label %while.cond2
while.cond2: ; preds = %while.cond2, %while.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond2 ], [ %2, %while.cond ]
%arrayidx4 = getelementptr inbounds i32, ptr %d, i64 %indvars.iv
%3 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp5 = icmp slt i32 %3, %0
%cmp6 = icmp slt i64 %indvars.iv, %1
%4 = and i1 %cmp6, %cmp5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
br i1 %4, label %while.cond2, label %while.cond8.preheader, !llvm.loop !9
while.cond8.preheader: ; preds = %while.cond2
%arrayidx4.le = getelementptr inbounds i32, ptr %d, i64 %indvars.iv
%5 = trunc i64 %indvars.iv to i32
%6 = sext i32 %j.0.in to i64
br label %while.cond8
while.cond8: ; preds = %while.cond8.preheader, %while.cond8
%indvars.iv81 = phi i64 [ %6, %while.cond8.preheader ], [ %indvars.iv.next82, %while.cond8 ]
%indvars.iv.next82 = add nsw i64 %indvars.iv81, -1
%arrayidx10 = getelementptr inbounds i32, ptr %d, i64 %indvars.iv.next82
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp slt i32 %0, %7
%cmp13 = icmp sgt i64 %indvars.iv.next82, %idxprom
%8 = and i1 %cmp11, %cmp13
br i1 %8, label %while.cond8, label %while.end16, !llvm.loop !11
while.end16: ; preds = %while.cond8
%9 = trunc i64 %indvars.iv.next82 to i32
%cmp17.not = icmp slt i32 %5, %9
br i1 %cmp17.not, label %if.end19, label %while.end30
if.end19: ; preds = %while.end16
%arrayidx10.le = getelementptr inbounds i32, ptr %d, i64 %indvars.iv.next82
store i32 %7, ptr %arrayidx4.le, align 4, !tbaa !5
store i32 %3, ptr %arrayidx10.le, align 4, !tbaa !5
%inc28 = add nsw i32 %5, 1
br label %while.cond
while.end30: ; preds = %while.end16
%10 = trunc i64 %indvars.iv81 to i32
tail call void @qsort_v2(ptr noundef nonnull %d, i32 noundef %s, i32 noundef %5)
tail call void @qsort_v2(ptr noundef nonnull %d, i32 noundef %10, i32 noundef %e)
%cmp31.not77 = icmp slt i32 %e, 0
br i1 %cmp31.not77, label %cleanup, label %for.body.preheader
for.body.preheader: ; preds = %while.end30
%11 = add i32 %e, 1
%wide.trip.count = zext i32 %11 to i64
%min.iters.check = icmp ult i32 %e, 7
%12 = sub i64 ptrtoint (ptr @list to i64), %d93
%diff.check = icmp ult i64 %12, 32
%or.cond = or i1 %min.iters.check, %diff.check
br i1 %or.cond, label %for.body.preheader95, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%13 = getelementptr inbounds i32, ptr %d, i64 %index
%wide.load = load <4 x i32>, ptr %13, align 4, !tbaa !5
%14 = getelementptr inbounds i32, ptr %13, i64 4
%wide.load94 = load <4 x i32>, ptr %14, align 4, !tbaa !5
%15 = getelementptr inbounds [105 x i32], ptr @list, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %15, align 16, !tbaa !5
%16 = getelementptr inbounds i32, ptr %15, i64 4
store <4 x i32> %wide.load94, ptr %16, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%17 = icmp eq i64 %index.next, %n.vec
br i1 %17, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %cleanup, label %for.body.preheader95
for.body.preheader95: ; preds = %for.body.preheader, %middle.block
%indvars.iv84.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%18 = xor i64 %indvars.iv84.ph, -1
%19 = add nsw i64 %18, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader95, %for.body.prol
%indvars.iv84.prol = phi i64 [ %indvars.iv.next85.prol, %for.body.prol ], [ %indvars.iv84.ph, %for.body.preheader95 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader95 ]
%arrayidx33.prol = getelementptr inbounds i32, ptr %d, i64 %indvars.iv84.prol
%20 = load i32, ptr %arrayidx33.prol, align 4, !tbaa !5
%arrayidx35.prol = getelementptr inbounds [105 x i32], ptr @list, i64 0, i64 %indvars.iv84.prol
store i32 %20, ptr %arrayidx35.prol, align 4, !tbaa !5
%indvars.iv.next85.prol = add nuw nsw i64 %indvars.iv84.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !15
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader95
%indvars.iv84.unr = phi i64 [ %indvars.iv84.ph, %for.body.preheader95 ], [ %indvars.iv.next85.prol, %for.body.prol ]
%21 = icmp ult i64 %19, 3
br i1 %21, label %cleanup, label %for.body
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv84 = phi i64 [ %indvars.iv.next85.3, %for.body ], [ %indvars.iv84.unr, %for.body.prol.loopexit ]
%arrayidx33 = getelementptr inbounds i32, ptr %d, i64 %indvars.iv84
%22 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%arrayidx35 = getelementptr inbounds [105 x i32], ptr @list, i64 0, i64 %indvars.iv84
store i32 %22, ptr %arrayidx35, align 4, !tbaa !5
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%arrayidx33.1 = getelementptr inbounds i32, ptr %d, i64 %indvars.iv.next85
%23 = load i32, ptr %arrayidx33.1, align 4, !tbaa !5
%arrayidx35.1 = getelementptr inbounds [105 x i32], ptr @list, i64 0, i64 %indvars.iv.next85
store i32 %23, ptr %arrayidx35.1, align 4, !tbaa !5
%indvars.iv.next85.1 = add nuw nsw i64 %indvars.iv84, 2
%arrayidx33.2 = getelementptr inbounds i32, ptr %d, i64 %indvars.iv.next85.1
%24 = load i32, ptr %arrayidx33.2, align 4, !tbaa !5
%arrayidx35.2 = getelementptr inbounds [105 x i32], ptr @list, i64 0, i64 %indvars.iv.next85.1
store i32 %24, ptr %arrayidx35.2, align 4, !tbaa !5
%indvars.iv.next85.2 = add nuw nsw i64 %indvars.iv84, 3
%arrayidx33.3 = getelementptr inbounds i32, ptr %d, i64 %indvars.iv.next85.2
%25 = load i32, ptr %arrayidx33.3, align 4, !tbaa !5
%arrayidx35.3 = getelementptr inbounds [105 x i32], ptr @list, i64 0, i64 %indvars.iv.next85.2
store i32 %25, ptr %arrayidx35.3, align 4, !tbaa !5
%indvars.iv.next85.3 = add nuw nsw i64 %indvars.iv84, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next85.3, %wide.trip.count
br i1 %exitcond.not.3, label %cleanup, label %for.body, !llvm.loop !17
cleanup: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %while.end30, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %x)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp52 = icmp sgt i32 %0, 0
br i1 %cmp52, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%1 = phi i32 [ %3, %for.body ], [ %0, %entry ]
%sub = add nsw i32 %1, -1
%2 = zext i32 %sub to i64
%cmp1 = icmp eq i64 %indvars.iv, %2
%arrayidx = getelementptr inbounds [105 x i32], ptr @list, i64 0, i64 %indvars.iv
%.str.1..str.2 = select i1 %cmp1, ptr @.str.1, ptr @.str.2
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull %.str.1..str.2, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !18
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %3, %for.body ]
call void @qsort_v2(ptr noundef nonnull @list, i32 noundef 0, i32 noundef %.lcssa)
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp754 = icmp sgt i32 %5, 0
br i1 %cmp754, label %for.body8, label %for.end34
for.body8: ; preds = %for.end, %for.inc32
%indvars.iv59 = phi i64 [ %indvars.iv.next60, %for.inc32 ], [ 0, %for.end ]
%6 = phi i32 [ %13, %for.inc32 ], [ %5, %for.end ]
%arrayidx10 = getelementptr inbounds [105 x i32], ptr @list, i64 0, i64 %indvars.iv59
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%8 = load i32, ptr %x, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %7, %8
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %for.body8
%9 = trunc i64 %indvars.iv59 to i32
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %9)
br label %for.end34
if.else14: ; preds = %for.body8
%sub15 = add nsw i32 %6, -1
%10 = zext i32 %sub15 to i64
%cmp16 = icmp eq i64 %indvars.iv59, %10
br i1 %cmp16, label %if.then17, label %if.else26
if.then17: ; preds = %if.else14
%cmp20 = icmp eq i32 %7, %8
%11 = trunc i64 %indvars.iv59 to i32
br i1 %cmp20, label %if.then21, label %if.else23
if.then21: ; preds = %if.then17
%12 = add i32 %11, 1
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %12)
br label %for.inc32
if.else23: ; preds = %if.then17
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %11)
br label %for.inc32
if.else26: ; preds = %if.else14
%sub29 = sub nsw i32 %8, %7
store i32 %sub29, ptr %x, align 4, !tbaa !5
br label %for.inc32
for.inc32: ; preds = %if.then21, %if.else23, %if.else26
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%13 = load i32, ptr %n, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp7 = icmp slt i64 %indvars.iv.next60, %14
br i1 %cmp7, label %for.body8, label %for.end34, !llvm.loop !19
for.end34: ; preds = %for.inc32, %for.end, %if.then12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !10, !13}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.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);
}
int main(){
int n, i, x;
char com[20];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s", com);
if(strcmp(com,"insert") == 0){
scanf("%d",&x);
insert(x);
}
else if(strcmp(com,"print") == 0){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211726/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211726/source.c"
target datalayout = "e-m:e-p270: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.3 = private unnamed_addr constant [7 x i8] c"insert\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"print\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 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
%cmp16 = icmp sgt i32 %0, 0
br i1 %cmp16, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.017 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %com, ptr noundef nonnull dereferenceable(7) @.str.3, i64 7)
%cmp4 = icmp eq i32 %bcmp, 0
br i1 %cmp4, label %if.then, label %if.else
if.then: ; preds = %for.body
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !17
%2 = load ptr, ptr @root, align 8, !tbaa !5
%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 %1, ptr %key.i, align 8, !tbaa !9
%cmp.not34.i = icmp eq ptr %2, 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.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %2, %if.then ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%3 = load i32, ptr %key2.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %3, %1
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, 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.then
%.sink = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then ], [ %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.else: ; preds = %for.body
%bcmp14 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %com, ptr noundef nonnull dereferenceable(6) @.str.4, i64 6)
%cmp8 = icmp eq i32 %bcmp14, 0
br i1 %cmp8, label %if.then9, label %for.inc
if.then9: ; preds = %if.else
%4 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %4)
%putchar = call i32 @putchar(i32 10)
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %5)
%putchar15 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %insert.exit, %if.then9, %if.else
%inc = add nuw nsw i32 %i.017, 1
%6 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %6
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 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 willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4
; 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) #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 nounwind willreturn memory(argmem: read) }
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 = distinct !{!18, !13}
|
/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <stdio.h>
int main()
{
int n,i,k,x,y,a,b;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&k);
if(k==100 || k==0){
printf("1\n");
}
else{
x=k;
y = (100 - k);
while(x != (y)){
if(x> (y)){
x -= y;
}
else{
y -= x;
}
}
a = k/x;
b = (100-k)/x;
a = a+b;
printf("%d\n",a);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21177/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21177/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %0, 0
br i1 %cmp28, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.029 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4
switch i32 %1, label %if.else [
i32 100, label %if.then
i32 0, label %if.then
]
if.then: ; preds = %for.body, %for.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.else: ; preds = %for.body
%sub = sub nsw i32 100, %1
%cmp5.not25 = icmp eq i32 %1, %sub
br i1 %cmp5.not25, label %while.end, label %while.body
while.body: ; preds = %if.else, %while.body
%x.027 = phi i32 [ %x.1, %while.body ], [ %1, %if.else ]
%y.026 = phi i32 [ %y.1, %while.body ], [ %sub, %if.else ]
%cmp6 = icmp sgt i32 %x.027, %y.026
%sub10 = select i1 %cmp6, i32 0, i32 %x.027
%y.1 = sub nsw i32 %y.026, %sub10
%sub8 = select i1 %cmp6, i32 %y.026, i32 0
%x.1 = sub nsw i32 %x.027, %sub8
%cmp5.not = icmp eq i32 %x.1, %y.1
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %if.else
%x.0.lcssa = phi i32 [ %1, %if.else ], [ %y.1, %while.body ]
%div = sdiv i32 %1, %x.0.lcssa
%div12 = sdiv i32 %sub, %x.0.lcssa
%add = add nsw i32 %div12, %div
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add)
br label %for.inc
for.inc: ; preds = %if.then, %while.end
%inc = add nuw nsw i32 %i.029, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h> // 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;
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 '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_211812/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211812/source.c"
target datalayout = "e-m:e-p270: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
@root = dso_local local_unnamed_addr global i32 0, align 4
@ix = dso_local local_unnamed_addr global i32 0, align 4
@t = dso_local local_unnamed_addr global [500001 x %struct.node_tbl] 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"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @root, align 4, !tbaa !5
%1 = load i32, ptr @ix, align 4, !tbaa !5
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @ix, align 4, !tbaa !5
%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 !9
%left = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 2
store i32 -1, ptr %left, align 8, !tbaa !11
%right = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 3
store i32 -1, ptr %right, align 4, !tbaa !12
%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 !9
%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 !5
%cmp.not = icmp eq i32 %x.1, -1
br i1 %cmp.not, label %if.else22, label %while.body, !llvm.loop !13
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 !15
store i32 %1, ptr @root, align 4, !tbaa !5
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 !15
%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 !9
%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 !11
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 !12
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) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(i32 noundef %u) local_unnamed_addr #2 {
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 !11
tail call void @inorder(i32 noundef %0)
%1 = load i32, ptr %arrayidx, align 16, !tbaa !9
%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 !12
%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 #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(i32 noundef %u) local_unnamed_addr #2 {
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 !9
%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 !11
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 !12
%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 #2 {
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) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
store i32 -1, ptr @root, align 4, !tbaa !5
store i32 0, ptr @ix, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %0, 0
br i1 %cmp8, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.09 = 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 !16
%cond = icmp eq i8 %1, 105
br i1 %cond, label %sw.bb, label %sw.default
sw.bb: ; preds = %for.body
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !5
%3 = load i32, ptr @root, align 4, !tbaa !5
%4 = load i32, ptr @ix, align 4, !tbaa !5
%inc.i = add nsw i32 %4, 1
store i32 %inc.i, ptr @ix, align 4, !tbaa !5
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom.i
store i32 %2, ptr %arrayidx.i, align 16, !tbaa !9
%left.i = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom.i, i32 2
store i32 -1, ptr %left.i, align 8, !tbaa !11
%right.i = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom.i, i32 3
store i32 -1, ptr %right.i, align 4, !tbaa !12
%cmp.not56.i = icmp eq i32 %3, -1
br i1 %cmp.not56.i, label %if.then21.i, label %while.body.i
while.body.i: ; preds = %sw.bb, %while.body.i
%x.057.i = phi i32 [ %x.1.i, %while.body.i ], [ %3, %sw.bb ]
%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
%5 = load i32, ptr %arrayidx9.i, align 16, !tbaa !9
%cmp11.i = icmp sgt i32 %5, %2
%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 !5
%cmp.not.i = icmp eq i32 %x.1.i, -1
br i1 %cmp.not.i, label %if.else22.i, label %while.body.i, !llvm.loop !13
if.then21.i: ; preds = %sw.bb
%parent59.i = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom.i, i32 1
store i32 -1, ptr %parent59.i, align 4, !tbaa !15
store i32 %4, ptr @root, align 4, !tbaa !5
br label %for.inc
if.else22.i: ; preds = %while.body.i
%parent.i = getelementptr inbounds [500001 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom.i, i32 1
store i32 %x.057.i, ptr %parent.i, align 4, !tbaa !15
br i1 %cmp11.i, label %if.then30.i, label %if.else34.i
if.then30.i: ; preds = %if.else22.i
store i32 %4, ptr %left14.i, align 8, !tbaa !11
br label %for.inc
if.else34.i: ; preds = %if.else22.i
store i32 %4, ptr %right17.i, align 4, !tbaa !12
br label %for.inc
sw.default: ; preds = %for.body
%6 = load i32, ptr @root, align 4, !tbaa !5
call void @inorder(i32 noundef %6)
%putchar = call i32 @putchar(i32 10)
%7 = load i32, ptr @root, align 4, !tbaa !5
call void @preorder(i32 noundef %7)
%putchar7 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %if.else34.i, %if.then30.i, %if.then21.i, %sw.default
%inc = add nuw nsw i32 %i.09, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %8
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 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %command) #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 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"node_tbl", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 12}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 4}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !14}
|
#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 treeMaximum(Node x){
while(x->right!=NIL){
x=x->right;
}
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;
}
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->left=x;
else y->parent->right=x;
if(y!=z) z->key=y->key;
free(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) 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] == '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_211856/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211856/source.c"
target datalayout = "e-m:e-p270: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 @treeMaximum(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 ]
%0 = load ptr, ptr %x.addr.0, align 8, !tbaa !13
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !14
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 !15
%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 !16
%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 !13
%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 !17
%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 !13
%cmp4 = icmp eq ptr %x.addr.0, %2
br i1 %cmp4, label %while.cond, label %cleanup, !llvm.loop !18
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: nounwind 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 !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 !13
%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 !13
%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 !17
%parent11 = getelementptr inbounds %struct.node, ptr %x.055, i64 0, i32 2
store ptr %4, ptr %parent11, align 8, !tbaa !17
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 !17
%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 !16
%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 !15
%key30 = getelementptr inbounds %struct.node, ptr %z, i64 0, i32 3
store i32 %7, ptr %key30, align 8, !tbaa !15
br label %if.end31
if.end31: ; preds = %if.then29, %if.end27
tail call void @free(ptr noundef nonnull %y.061) #9
ret void
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #4 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !16
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #10
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !15
%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 !15
%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 !16
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !19
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 !15
%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 !16
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 #5
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #4 {
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 !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 !15
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !13
%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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #4 {
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 !15
%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 !13
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
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 !20
%cmp66 = icmp sgt i32 %0, 0
br i1 %cmp66, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.067 = 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 !21
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 !16
%3 = load i32, ptr %x, align 4, !tbaa !20
%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 !15
%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 !16
%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
%puts40 = 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 !20
%6 = load ptr, ptr @root, align 8, !tbaa !16
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #10
%key.i41 = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %5, ptr %key.i41, align 8, !tbaa !15
%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 !15
%cmp3.i42 = 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.i42, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !16
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !19
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 !17
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !16
br label %for.inc
if.then23: ; preds = %for.body
%8 = load ptr, ptr @root, align 8, !tbaa !16
call void @inorder(ptr noundef %8)
%putchar = call i32 @putchar(i32 10)
%9 = load ptr, ptr @root, align 8, !tbaa !16
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 !16
%11 = load i32, ptr %x, align 4, !tbaa !20
%cmp14.i44 = icmp eq ptr %10, null
br i1 %cmp14.i44, label %treeSearch.exit56, label %lor.lhs.false.i45
lor.lhs.false.i45: ; preds = %if.then31, %if.end.i49
%u.tr15.i46 = phi ptr [ %u.tr.be.i53, %if.end.i49 ], [ %10, %if.then31 ]
%key.i47 = getelementptr inbounds %struct.node, ptr %u.tr15.i46, i64 0, i32 3
%12 = load i32, ptr %key.i47, align 8, !tbaa !15
%cmp1.i48 = icmp eq i32 %12, %11
br i1 %cmp1.i48, label %treeSearch.exit56, label %if.end.i49
if.end.i49: ; preds = %lor.lhs.false.i45
%cmp3.i50 = icmp sgt i32 %12, %11
%left.i51 = getelementptr inbounds %struct.node, ptr %u.tr15.i46, i64 0, i32 1
%spec.select.i52 = select i1 %cmp3.i50, ptr %left.i51, ptr %u.tr15.i46
%u.tr.be.i53 = load ptr, ptr %spec.select.i52, align 8, !tbaa !16
%cmp.i54 = icmp eq ptr %u.tr.be.i53, null
br i1 %cmp.i54, label %treeSearch.exit56, label %lor.lhs.false.i45
treeSearch.exit56: ; preds = %lor.lhs.false.i45, %if.end.i49, %if.then31
%retval.0.i55 = phi ptr [ null, %if.then31 ], [ %u.tr15.i46, %lor.lhs.false.i45 ], [ null, %if.end.i49 ]
%left.i57 = getelementptr inbounds %struct.node, ptr %retval.0.i55, i64 0, i32 1
%13 = load ptr, ptr %left.i57, align 8, !tbaa !5
%cmp.i58 = icmp eq ptr %13, null
br i1 %cmp.i58, label %if.end8.i, label %lor.lhs.false.i59
lor.lhs.false.i59: ; preds = %treeSearch.exit56
%14 = load ptr, ptr %retval.0.i55, align 8, !tbaa !13
%cmp1.i60 = icmp eq ptr %14, null
br i1 %cmp1.i60, label %if.then10.i, label %while.cond.i.i.i
while.cond.i.i.i: ; preds = %lor.lhs.false.i59, %while.cond.i.i.i
%x.addr.0.i.i.i = phi ptr [ %15, %while.cond.i.i.i ], [ %14, %lor.lhs.false.i59 ]
%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.exit56
%y.0.ph.i = phi ptr [ %retval.0.i55, %treeSearch.exit56 ], [ %x.addr.0.i.i.i, %while.cond.i.i.i ]
%16 = load ptr, ptr %y.0.ph.i, align 8, !tbaa !13
%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.i59
%y.059.i = phi ptr [ %y.0.ph.i, %if.end8.i ], [ %retval.0.i55, %lor.lhs.false.i59 ]
%x.055.i = phi ptr [ %16, %if.end8.i ], [ %13, %lor.lhs.false.i59 ]
%parent.i61 = getelementptr inbounds %struct.node, ptr %y.059.i, i64 0, i32 2
%17 = load ptr, ptr %parent.i61, align 8, !tbaa !17
%parent11.i = getelementptr inbounds %struct.node, ptr %x.055.i, i64 0, i32 2
store ptr %17, ptr %parent11.i, align 8, !tbaa !17
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 !17
%cmp14.i62 = icmp eq ptr %18, null
br i1 %cmp14.i62, 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 !16
%cmp28.not.i = icmp eq ptr %y.061.i, %retval.0.i55
br i1 %cmp28.not.i, label %treeDelete.exit, label %if.then29.i
if.then29.i: ; preds = %if.end27.i
%key.i63 = getelementptr inbounds %struct.node, ptr %y.061.i, i64 0, i32 3
%20 = load i32, ptr %key.i63, align 8, !tbaa !15
%key30.i = getelementptr inbounds %struct.node, ptr %retval.0.i55, i64 0, i32 3
store i32 %20, ptr %key30.i, align 8, !tbaa !15
br label %treeDelete.exit
treeDelete.exit: ; preds = %if.end27.i, %if.then29.i
call void @free(ptr noundef nonnull %y.061.i) #9
br label %for.inc
for.inc: ; preds = %for.body, %if.then8, %if.else, %if.then23, %treeDelete.exit, %insert.exit
%inc = add nuw nsw i32 %i.067, 1
%21 = load i32, ptr %n, align 4, !tbaa !20
%cmp = icmp slt i32 %inc, %21
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !22
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 #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 = { 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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 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 #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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind "no-trapping-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 }
attributes #10 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !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, !7, i64 0}
!14 = distinct !{!14, !12}
!15 = !{!6, !10, i64 24}
!16 = !{!7, !7, i64 0}
!17 = !{!6, !7, i64 16}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = !{!10, !10, i64 0}
!21 = !{!8, !8, i64 0}
!22 = distinct !{!22, !12}
|
#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 treeMaximum(Node x){
}
Node treeSearch(Node u, int k){
}
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 ) 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] == '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_211913/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211913/source.c"
target datalayout = "e-m:e-p270: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
; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeMaximum(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 noalias ptr @treeSearch(ptr nocapture noundef readnone %u, i32 noundef %k) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; 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) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #2 {
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 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 uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #2 {
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 #4
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #2 {
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 nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
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
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.041 = 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
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)
br label %for.inc
if.then16: ; preds = %for.body
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !17
%3 = load ptr, ptr @root, align 8, !tbaa !5
%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 !9
%cmp.not34.i = icmp eq ptr %3, 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 ], [ %3, %if.then16 ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%4 = load i32, ptr %key2.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %4, %2
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, 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
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %6)
%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 = %for.body, %if.then, %if.then23, %if.then31, %insert.exit
%inc = add nuw nsw i32 %i.041, 1
%7 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %7
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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
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 = { 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, !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>
#define NIL NULL
typedef struct node{
struct node *right;
struct node *left;
struct node *parent;
int key;
}*Node;
Node root;
void insert(int);
void inorder(Node);
void preorder(Node);
int main(){
int n, i, x;
char S[20];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s", S);
if ( S[0] == 'i' ){
scanf("%d", &x);
insert(x);
} else if ( S[0] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
}
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 A){
if(A != NIL){
inorder(A->left);
printf(" %d",A->key);
inorder(A->right);
}
}
void preorder(Node A){
if(A!=NIL){
printf(" %d",A->key);
preorder(A->left);
preorder(A->right);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211957/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211957/source.c"
target datalayout = "e-m:e-p270: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 [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
@.str.3 = 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:
%n = alloca i32, align 4
%x = alloca i32, align 4
%S = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %S) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.016 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %S)
%1 = load i8, ptr %S, align 16, !tbaa !9
switch i8 %1, label %for.inc [
i8 105, label %if.then
i8 112, label %if.then9
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !5
%3 = load ptr, ptr @root, align 8, !tbaa !10
%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 !12
%cmp.not34.i = icmp eq ptr %3, 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.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%4 = load i32, ptr %key2.i, align 8, !tbaa !12
%cmp3.i = icmp sgt i32 %4, %2
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !10
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !14
insert.exit: ; preds = %while.body.i, %if.then
%.sink = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then ], [ %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 !10
br label %for.inc
if.then9: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !10
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !10
call void @preorder(ptr noundef %6)
%putchar14 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %insert.exit, %if.then9
%inc = add nuw nsw i32 %i.016, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %7
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 20, ptr nonnull %S) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !10
%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 !12
%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 !12
%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 !10
%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 !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 !12
%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 !10
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %A) local_unnamed_addr #0 {
entry:
%cmp.not4 = icmp eq ptr %A, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%A.tr5 = phi ptr [ %2, %if.then ], [ %A, %entry ]
%left = getelementptr inbounds %struct.node, ptr %A.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !18
tail call void @inorder(ptr noundef %0)
%key = getelementptr inbounds %struct.node, ptr %A.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !12
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %1)
%2 = load ptr, ptr %A.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
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 %A) local_unnamed_addr #0 {
entry:
%cmp.not4 = icmp eq ptr %A, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%A.tr5 = phi ptr [ %2, %if.then ], [ %A, %entry ]
%key = getelementptr inbounds %struct.node, ptr %A.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !12
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %A.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !18
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %A.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 #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !6, i64 24}
!13 = !{!"node", !11, i64 0, !11, i64 8, !11, i64 16, !6, i64 24}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!13, !11, i64 16}
!17 = distinct !{!17, !15}
!18 = !{!13, !11, i64 8}
!19 = !{!13, !11, i64 0}
|
#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 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);
}
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] == '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_212020/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212020/source.c"
target datalayout = "e-m:e-p270: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
; 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
%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 !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
%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 !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 !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 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 ]
%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 !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)
%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.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
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.016 = 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 105, label %if.then
i8 112, label %if.then9
]
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 !17
%3 = load ptr, ptr @root, align 8, !tbaa !11
%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
%cmp.not34.i = icmp eq ptr %3, 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.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%4 = load i32, ptr %key2.i, align 8, !tbaa !5
%cmp3.i = icmp sgt i32 %4, %2
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.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.then
%.sink = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then ], [ %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 !11
br label %for.inc
if.then9: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !11
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !11
call void @preorder(ptr noundef %6)
%putchar14 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %insert.exit, %if.then9
%inc = add nuw nsw i32 %i.016, 1
%7 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %7
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: 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>
#define NIL NULL
struct node{
int key;
struct node *right;
struct node *left;
struct node *parent;
};
typedef struct node * Node;
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;
}
}
Node treeMinimum(Node x){
while(x->left != NIL)
x = x->left;
}
void inorder(Node x){
if(x != NIL){
inorder(x->left);
printf(" %d",x->key);
inorder(x->right);
}
}
void preorder(Node x){
if(x != NIL){
printf(" %d",x->key);
preorder(x->left);
preorder(x->right);
}
}
int main(){
int n,i,x;
char com[20];
root = NIL;
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] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212064/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212064/source.c"
target datalayout = "e-m:e-p270: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 }
@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
; 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
store i32 %k, ptr %call, align 8, !tbaa !9
%right = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %right, 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 ]
%1 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %1, %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, 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 3
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 3
store ptr %x.035, ptr %parent, align 8, !tbaa !14
%2 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %2, %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 = %if.then12, %if.else14, %if.then7
%left13.sink = phi ptr [ %left13, %if.then12 ], [ %right15, %if.else14 ], [ @root, %if.then7 ]
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: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeMinimum(ptr nocapture noundef readonly %x) local_unnamed_addr #3 {
entry:
ret ptr undef
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(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.node, ptr %x.tr5, i64 0, i32 2
%0 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @inorder(ptr noundef %0)
%1 = load i32, ptr %x.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%right = getelementptr inbounds %struct.node, ptr %x.tr5, i64 0, i32 1
%2 = load ptr, ptr %right, 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 %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 ]
%0 = load i32, ptr %x.tr5, 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 %x.tr5, i64 0, i32 2
%1 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @preorder(ptr noundef %1)
%right = getelementptr inbounds %struct.node, ptr %x.tr5, i64 0, i32 1
%2 = load ptr, ptr %right, 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 #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
store ptr null, ptr @root, align 8, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.016 = 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 105, label %if.then
i8 112, label %if.then9
]
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 !17
%3 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
store i32 %2, ptr %call.i, align 8, !tbaa !9
%right.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1
%cmp.not34.i = icmp eq ptr %3, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %right.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ]
%4 = load i32, ptr %x.035.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %4, %2
%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.i, ptr %left4.i, ptr %right5.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.then
%x.035.i.lcssa.sink = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ]
%parent.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store ptr %x.035.i.lcssa.sink, ptr %parent.i, align 8, !tbaa !14
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.then9: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %6)
%putchar14 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %insert.exit, %if.then9
%inc = add nuw nsw i32 %i.016, 1
%7 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %7
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: 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 = { 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 #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, !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 24}
!15 = !{!10, !6, i64 16}
!16 = !{!10, !6, i64 8}
!17 = !{!11, !11, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !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;}
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->left=x;}
else {y->parent->right=x;}
if(y!=z){
z->key=y->key;
}
return y;
}
void insert(int k){
Node y = NIL, x = root, 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);
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_212107/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212107/source.c"
target datalayout = "e-m:e-p270: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>
struct node {
int key;
struct node *parent;
struct node *left;
struct node *right;
};
struct node *tree = NULL;
void insert(struct node **root, struct node *node)
{
struct node *parent = NULL;
struct node *current = *root;
while (current != NULL) {
parent = current;
if (node->key < current->key) {
current = current->left;
} else {
current = current->right;
}
}
node->parent = parent;
if (parent == NULL) {
*root = node;
} else if (node->key < parent->key) {
parent->left = node;
} else {
parent->right = node;
}
}
void preorder_traverse(struct node* node)
{
if (node != NULL) {
printf(" %d", node->key);
preorder_traverse(node->left);
preorder_traverse(node->right);
}
}
void inorder_traverse(struct node *node)
{
if (node != NULL) {
inorder_traverse(node->left);
printf(" %d", node->key);
inorder_traverse(node->right);
}
}
int main (int argc, char** argv)
{
int i, num;
char str[32] = {0};
fgets(str, 32, stdin);
num = atoi(str);
for (i = 0; i < num; i++) {
fgets(str, 32, stdin);
strtok(str, "\r\n");
if (strstr(str, "insert")) {
struct node *node = (struct node *)malloc(sizeof(struct node));
node->key = atoi(&str[7]);
node->left = NULL;
node->right = NULL;
insert(&tree, node);
} else if (strstr(str, "print")) {
inorder_traverse(tree);
printf("\n");
preorder_traverse(tree);
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212158/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212158/source.c"
target datalayout = "e-m:e-p270: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 [4 x i8] c" %d\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.1 = private unnamed_addr constant [3 x i8] c"\0D\0A\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"insert\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"print\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insert(ptr nocapture noundef %root, ptr noundef %node) local_unnamed_addr #0 {
entry:
%current.030 = load ptr, ptr %root, align 8, !tbaa !5
%cmp.not31 = icmp eq ptr %current.030, null
br i1 %cmp.not31, label %if.then5, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %node, align 8, !tbaa !9
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%current.032 = phi ptr [ %current.030, %while.body.lr.ph ], [ %current.0, %while.body ]
%1 = load i32, ptr %current.032, align 8, !tbaa !9
%cmp2 = icmp slt i32 %0, %1
%left = getelementptr inbounds %struct.node, ptr %current.032, i64 0, i32 2
%right = getelementptr inbounds %struct.node, ptr %current.032, i64 0, i32 3
%current.1.in = select i1 %cmp2, ptr %left, ptr %right
%current.0 = load ptr, ptr %current.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %current.0, null
br i1 %cmp.not, label %if.else6, label %while.body, !llvm.loop !12
if.then5: ; preds = %entry
%parent334 = getelementptr inbounds %struct.node, ptr %node, i64 0, i32 1
store ptr null, ptr %parent334, align 8, !tbaa !14
br label %if.end15
if.else6: ; preds = %while.body
%parent3 = getelementptr inbounds %struct.node, ptr %node, i64 0, i32 1
store ptr %current.032, ptr %parent3, align 8, !tbaa !14
%2 = load i32, ptr %node, align 8, !tbaa !9
%3 = load i32, ptr %current.032, align 8, !tbaa !9
%cmp9 = icmp slt i32 %2, %3
br i1 %cmp9, label %if.then10, label %if.else12
if.then10: ; preds = %if.else6
%left11 = getelementptr inbounds %struct.node, ptr %current.032, i64 0, i32 2
br label %if.end15
if.else12: ; preds = %if.else6
%right13 = getelementptr inbounds %struct.node, ptr %current.032, i64 0, i32 3
br label %if.end15
if.end15: ; preds = %if.then10, %if.else12, %if.then5
%left11.sink = phi ptr [ %left11, %if.then10 ], [ %right13, %if.else12 ], [ %root, %if.then5 ]
store ptr %node, ptr %left11.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 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 @preorder_traverse(ptr noundef readonly %node) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq ptr %node, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%node.tr5 = phi ptr [ %2, %if.then ], [ %node, %entry ]
%0 = load i32, ptr %node.tr5, 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 %node.tr5, i64 0, i32 2
%1 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @preorder_traverse(ptr noundef %1)
%right = getelementptr inbounds %struct.node, ptr %node.tr5, i64 0, i32 3
%2 = load ptr, ptr %right, 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 #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder_traverse(ptr noundef readonly %node) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq ptr %node, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%node.tr5 = phi ptr [ %2, %if.then ], [ %node, %entry ]
%left = getelementptr inbounds %struct.node, ptr %node.tr5, i64 0, i32 2
%0 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @inorder_traverse(ptr noundef %0)
%1 = load i32, ptr %node.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%right = getelementptr inbounds %struct.node, ptr %node.tr5, i64 0, i32 3
%2 = load ptr, ptr %right, 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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #2 {
entry:
%str = alloca [32 x i8], align 16
call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %str) #9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %str, i8 0, i64 32, i1 false)
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 32, ptr noundef %0)
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %str, ptr noundef null, i32 noundef 10) #9
%conv.i = trunc i64 %call.i to i32
%cmp25 = icmp sgt i32 %conv.i, 0
br i1 %cmp25, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%arrayidx = getelementptr inbounds [32 x i8], ptr %str, i64 0, i64 7
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%i.026 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call4 = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 32, ptr noundef %1)
%call6 = call ptr @strtok(ptr noundef nonnull %str, ptr noundef nonnull @.str.1) #9
%call8 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str.2) #10
%tobool.not = icmp eq ptr %call8, null
br i1 %tobool.not, label %if.else, label %if.then
if.then: ; preds = %for.body
%call9 = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #11
%call.i23 = call i64 @strtol(ptr nocapture noundef nonnull %arrayidx, ptr noundef null, i32 noundef 10) #9
%conv.i24 = trunc i64 %call.i23 to i32
store i32 %conv.i24, ptr %call9, align 8, !tbaa !9
%left = getelementptr inbounds %struct.node, ptr %call9, i64 0, i32 2
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left, i8 0, i64 16, i1 false)
%current.030.i = load ptr, ptr @tree, align 8, !tbaa !5
%cmp.not31.i = icmp eq ptr %current.030.i, null
br i1 %cmp.not31.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%current.032.i = phi ptr [ %current.0.i, %while.body.i ], [ %current.030.i, %if.then ]
%2 = load i32, ptr %current.032.i, align 8, !tbaa !9
%cmp2.i = icmp sgt i32 %2, %conv.i24
%left.i = getelementptr inbounds %struct.node, ptr %current.032.i, i64 0, i32 2
%right.i = getelementptr inbounds %struct.node, ptr %current.032.i, i64 0, i32 3
%current.1.in.i = select i1 %cmp2.i, ptr %left.i, ptr %right.i
%current.0.i = load ptr, ptr %current.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %current.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
%current.032.i.lcssa.sink = phi ptr [ null, %if.then ], [ %current.032.i, %while.body.i ]
%left11.sink.i = phi ptr [ @tree, %if.then ], [ %current.1.in.i, %while.body.i ]
%parent3.i = getelementptr inbounds %struct.node, ptr %call9, i64 0, i32 1
store ptr %current.032.i.lcssa.sink, ptr %parent3.i, align 8, !tbaa !14
store ptr %call9, ptr %left11.sink.i, align 8, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%call12 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str.3) #10
%tobool13.not = icmp eq ptr %call12, null
br i1 %tobool13.not, label %for.inc, label %if.then14
if.then14: ; preds = %if.else
%3 = load ptr, ptr @tree, align 8, !tbaa !5
call void @inorder_traverse(ptr noundef %3)
%putchar = call i32 @putchar(i32 10)
%4 = load ptr, ptr @tree, align 8, !tbaa !5
call void @preorder_traverse(ptr noundef %4)
%putchar22 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %insert.exit, %if.then14, %if.else
%inc = add nuw nsw i32 %i.026, 1
%exitcond.not = icmp eq i32 %inc, %conv.i
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !17
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %str) #9
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn
declare ptr @strtok(ptr noundef, ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #7
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #8
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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { 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 #8 = { nofree nounwind }
attributes #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { 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, !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 8}
!15 = !{!10, !6, i64 16}
!16 = !{!10, !6, i64 24}
!17 = distinct !{!17, !13}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct Node{
int key;
struct Node *right,*left,*parent;
};
//typedef struct Node;
struct Node *root,*NIL;
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,i,x;
char str1[]="insert";
char str2[]="print";
char com[1000];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",com);
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_212200/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212200/source.c"
target datalayout = "e-m:e-p270: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
; 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 @root, 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
%left = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 2
store ptr %0, ptr %left, align 8, !tbaa !12
%right = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1
store ptr %0, ptr %right, 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
%parent37 = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %0, ptr %parent37, 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
%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 !15
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 !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
%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) #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:
%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 !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)
%right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%3 = load ptr, ptr %right, 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 #3
; 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)
%left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%2 = load ptr, ptr %left, align 8, !tbaa !12
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 !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:
%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) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %com) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.020 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %com, ptr noundef nonnull dereferenceable(7) @__const.main.str1, i64 7)
%cmp5 = icmp eq i32 %bcmp, 0
br i1 %cmp5, label %if.then, label %if.else
if.then: ; preds = %for.body
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !17
%2 = load ptr, ptr @NIL, align 8, !tbaa !5
%3 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %1, ptr %call.i, align 8, !tbaa !9
%left.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 2
store ptr %2, ptr %left.i, align 8, !tbaa !12
%right.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1
store ptr %2, ptr %right.i, align 8, !tbaa !13
%cmp.not34.i = icmp eq ptr %3, %2
br i1 %cmp.not34.i, label %while.end.thread.i, label %while.body.i
while.end.thread.i: ; preds = %if.then
%parent37.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %2, ptr %parent37.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 ], [ %3, %if.then ]
%4 = load i32, ptr %x.035.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %4, %1
%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.i, ptr %left4.i, ptr %right5.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.1.i, %2
br i1 %cmp.not.i, label %while.end.i, label %while.body.i, !llvm.loop !15
while.end.i: ; preds = %while.body.i
%parent.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %x.035.i, ptr %parent.i, align 8, !tbaa !14
%cmp6.i = icmp eq ptr %x.035.i, %2
%spec.select18 = 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.select18, %while.end.i ]
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%bcmp16 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %com, ptr noundef nonnull dereferenceable(6) @__const.main.str2, i64 6)
%cmp10 = icmp eq i32 %bcmp16, 0
br i1 %cmp10, label %if.then11, label %for.inc
if.then11: ; preds = %if.else
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %6)
%putchar17 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %insert.exit, %if.then11, %if.else
%inc = add nuw nsw i32 %i.020, 1
%7 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %7
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 1000, ptr nonnull %com) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4
; 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 nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind willreturn memory(argmem: read) }
attributes #5 = { 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 = !{!11, !11, i64 0}
!18 = distinct !{!18, !16}
|
#include <stdio.h>
#include <stdlib.h>
#define MAX 500001
#define NIL NULL
struct node{
int key;
struct node *p;
struct node *l;
struct node *r;
};
typedef struct node * Node;
void insert(int);
void preorder(Node);
void inorder(Node);
Node root;
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] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
}
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 x){
if(x!=NIL){
inorder(x->l);
printf(" %d",x->key);
inorder(x->r);
}
}
void preorder(Node x){
if(x!=NIL){
printf(" %d",x->key);
preorder(x->l);
preorder(x->r);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212244/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212244/source.c"
target datalayout = "e-m:e-p270: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 }
@.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
@.str.3 = 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:
%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) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.016 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !9
switch i8 %1, label %for.inc [
i8 105, label %if.then
i8 112, label %if.then9
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !5
%3 = load ptr, ptr @root, align 8, !tbaa !10
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
store i32 %2, ptr %call.i, align 8, !tbaa !12
%l.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
%cmp.not34.i = icmp eq ptr %3, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %l.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ]
%4 = load i32, ptr %x.035.i, align 8, !tbaa !12
%cmp3.i = icmp sgt i32 %4, %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 3
%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 !10
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !14
insert.exit: ; preds = %while.body.i, %if.then
%x.035.i.lcssa.sink = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ]
%l13.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ]
%p.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1
store ptr %x.035.i.lcssa.sink, ptr %p.i, align 8, !tbaa !16
store ptr %call.i, ptr %l13.sink.i, align 8, !tbaa !10
br label %for.inc
if.then9: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !10
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !10
call void @preorder(ptr noundef %6)
%putchar14 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %insert.exit, %if.then9
%inc = add nuw nsw i32 %i.016, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %7
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 20, ptr nonnull %com) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !10
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
store i32 %k, ptr %call, align 8, !tbaa !12
%l = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %l, 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 ]
%1 = load i32, ptr %x.035, align 8, !tbaa !12
%cmp3 = icmp sgt i32 %1, %k
%l4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 2
%r5 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%x.1.in = select i1 %cmp3, ptr %l4, ptr %r5
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !10
%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
%p37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1
store ptr null, ptr %p37, align 8, !tbaa !16
br label %if.end17
if.else8: ; preds = %while.body
%p = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1
store ptr %x.035, ptr %p, align 8, !tbaa !16
%2 = load i32, ptr %x.035, align 8, !tbaa !12
%cmp11 = icmp sgt i32 %2, %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 3
br label %if.end17
if.end17: ; preds = %if.then12, %if.else14, %if.then7
%l13.sink = phi ptr [ %l13, %if.then12 ], [ %r15, %if.else14 ], [ @root, %if.then7 ]
store ptr %call, ptr %l13.sink, align 8, !tbaa !10
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(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 ]
%l = getelementptr inbounds %struct.node, ptr %x.tr5, i64 0, i32 2
%0 = load ptr, ptr %l, align 8, !tbaa !18
tail call void @inorder(ptr noundef %0)
%1 = load i32, ptr %x.tr5, align 8, !tbaa !12
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %1)
%r = getelementptr inbounds %struct.node, ptr %x.tr5, i64 0, i32 3
%2 = load ptr, ptr %r, 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
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:
%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 ]
%0 = load i32, ptr %x.tr5, align 8, !tbaa !12
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %0)
%l = getelementptr inbounds %struct.node, ptr %x.tr5, i64 0, i32 2
%1 = load ptr, ptr %l, align 8, !tbaa !18
tail call void @preorder(ptr noundef %1)
%r = getelementptr inbounds %struct.node, ptr %x.tr5, i64 0, i32 3
%2 = load ptr, ptr %r, 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 #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"node", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!13, !11, i64 8}
!17 = distinct !{!17, !15}
!18 = !{!13, !11, i64 16}
!19 = !{!13, !11, i64 24}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct Tree{
int key;
struct Tree *parent;
struct Tree *left;
struct Tree *right;
}Tree;
Tree *t;
void Print1(Tree*);
void Print2(Tree*);
void Insert(int);
int main(){
int m,i,key;
char comma[7];
scanf("%d",&m);
t=(Tree*)malloc(sizeof(Tree)*1);
t->parent=t->left=t->right=NULL;
t->key=2000000001;
for(i=0;i<m;i++){
scanf("%s",&comma);
if(strcmp(comma,"insert")==0){
scanf("%d",&key);
Insert(key);
}
else if(strcmp(comma,"print")==0){
Print1(t);
printf("\n");
Print2(t);
printf("\n");
}
}
free(t);
return 0;
}
void Insert(int key){
Tree *y;
Tree *x;
Tree *hoge;
if(t->key==2000000001){
t->key=key;
return;
}
x=t;
y=NULL;
hoge=(Tree*)malloc(sizeof(Tree)*1);
hoge->key=key;
hoge->parent=hoge->left=hoge->right=NULL;
while(x!=NULL){
y=x;
if(key<x->key)
x=x->left;
else
x=x->right;
hoge->parent=y;
}
if(hoge->key<y->key)
y->left=hoge;
else
y->right=hoge;
}
void Print1(Tree *x){
if(x==NULL)
return;
else{
Print1(x->left);
printf(" %d",x->key);
Print1(x->right);
}
}
void Print2(Tree *x){
if(x==NULL)
return;
else{
printf(" %d",x->key);
Print2(x->left);
Print2(x->right);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212295/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212295/source.c"
target datalayout = "e-m:e-p270: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, ptr, ptr, ptr }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@t = dso_local local_unnamed_addr global ptr null, align 8
@.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
@.str.3 = private unnamed_addr constant [6 x i8] c"print\00", align 1
@.str.5 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%key = alloca i32, align 4
%comma = alloca [7 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #9
call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %comma) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%call1 = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #10
store ptr %call1, ptr @t, align 8, !tbaa !5
%parent = getelementptr inbounds %struct.Tree, ptr %call1, i64 0, i32 1
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %parent, i8 0, i64 24, i1 false)
store i32 2000000001, ptr %call1, align 8, !tbaa !9
%0 = load i32, ptr %m, align 4, !tbaa !12
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.018 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %comma)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %comma, ptr noundef nonnull dereferenceable(7) @.str.2, i64 7)
%cmp5 = icmp eq i32 %bcmp, 0
br i1 %cmp5, label %if.then, label %if.else
if.then: ; preds = %for.body
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%1 = load i32, ptr %key, align 4, !tbaa !12
%2 = load ptr, ptr @t, align 8, !tbaa !5
%3 = load i32, ptr %2, align 8, !tbaa !9
%cmp.i = icmp eq i32 %3, 2000000001
br i1 %cmp.i, label %if.then.i, label %if.end.i
if.then.i: ; preds = %if.then
store i32 %1, ptr %2, align 8, !tbaa !9
br label %for.inc
if.end.i: ; preds = %if.then
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #10
store i32 %1, ptr %call.i, align 8, !tbaa !9
%parent.i = getelementptr inbounds %struct.Tree, ptr %call.i, i64 0, i32 1
%4 = getelementptr inbounds %struct.Tree, ptr %call.i, i64 0, i32 2
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, i8 0, i64 16, i1 false)
br label %while.body.i
while.body.i: ; preds = %while.body.i, %if.end.i
%x.038.i = phi ptr [ %2, %if.end.i ], [ %x.1.i, %while.body.i ]
%5 = load i32, ptr %x.038.i, align 8, !tbaa !9
%cmp6.i = icmp sgt i32 %5, %1
%left8.i = getelementptr inbounds %struct.Tree, ptr %x.038.i, i64 0, i32 2
%right9.i = getelementptr inbounds %struct.Tree, ptr %x.038.i, i64 0, i32 3
%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
store ptr %x.038.i, ptr %parent.i, align 8, !tbaa !13
%cmp4.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp4.not.i, label %while.end.i, label %while.body.i, !llvm.loop !14
while.end.i: ; preds = %while.body.i
br i1 %cmp6.i, label %if.then15.i, label %if.else17.i
if.then15.i: ; preds = %while.end.i
store ptr %call.i, ptr %left8.i, align 8, !tbaa !16
br label %for.inc
if.else17.i: ; preds = %while.end.i
store ptr %call.i, ptr %right9.i, align 8, !tbaa !17
br label %for.inc
if.else: ; preds = %for.body
%bcmp15 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %comma, ptr noundef nonnull dereferenceable(6) @.str.3, i64 6)
%cmp9 = icmp eq i32 %bcmp15, 0
br i1 %cmp9, label %if.then10, label %for.inc
if.then10: ; preds = %if.else
%6 = load ptr, ptr @t, align 8, !tbaa !5
call void @Print1(ptr noundef %6)
%putchar = call i32 @putchar(i32 10)
%7 = load ptr, ptr @t, align 8, !tbaa !5
call void @Print2(ptr noundef %7)
%putchar16 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %if.else17.i, %if.then15.i, %if.then.i, %if.then10, %if.else
%inc = add nuw nsw i32 %i.018, 1
%8 = load i32, ptr %m, align 4, !tbaa !12
%cmp = icmp slt i32 %inc, %8
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !18
for.end.loopexit: ; preds = %for.inc
%.pre = load ptr, ptr @t, align 8, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%9 = phi ptr [ %.pre, %for.end.loopexit ], [ %call1, %entry ]
call void @free(ptr noundef %9) #9
call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %comma) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #9
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @Insert(i32 noundef %key) local_unnamed_addr #4 {
entry:
%0 = load ptr, ptr @t, align 8, !tbaa !5
%1 = load i32, ptr %0, align 8, !tbaa !9
%cmp = icmp eq i32 %1, 2000000001
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i32 %key, ptr %0, align 8, !tbaa !9
br label %cleanup
if.end: ; preds = %entry
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #10
store i32 %key, ptr %call, align 8, !tbaa !9
%parent = getelementptr inbounds %struct.Tree, ptr %call, i64 0, i32 1
%2 = getelementptr inbounds %struct.Tree, ptr %call, i64 0, i32 2
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %2, i8 0, i64 16, i1 false)
br label %while.body
while.body: ; preds = %if.end, %while.body
%x.038 = phi ptr [ %0, %if.end ], [ %x.1, %while.body ]
%3 = load i32, ptr %x.038, align 8, !tbaa !9
%cmp6 = icmp sgt i32 %3, %key
%left8 = getelementptr inbounds %struct.Tree, ptr %x.038, i64 0, i32 2
%right9 = getelementptr inbounds %struct.Tree, ptr %x.038, i64 0, i32 3
%x.1.in = select i1 %cmp6, ptr %left8, ptr %right9
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
store ptr %x.038, ptr %parent, align 8, !tbaa !13
%cmp4.not = icmp eq ptr %x.1, null
br i1 %cmp4.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body
br i1 %cmp6, label %if.then15, label %if.else17
if.then15: ; preds = %while.end
store ptr %call, ptr %left8, align 8, !tbaa !16
br label %cleanup
if.else17: ; preds = %while.end
store ptr %call, ptr %right9, align 8, !tbaa !17
br label %cleanup
cleanup: ; preds = %if.then15, %if.else17, %if.then
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Print1(ptr noundef readonly %x) local_unnamed_addr #4 {
entry:
%cmp4 = icmp eq ptr %x, null
br i1 %cmp4, label %if.end, label %if.else
if.else: ; preds = %entry, %if.else
%x.tr5 = phi ptr [ %2, %if.else ], [ %x, %entry ]
%left = getelementptr inbounds %struct.Tree, ptr %x.tr5, i64 0, i32 2
%0 = load ptr, ptr %left, align 8, !tbaa !16
tail call void @Print1(ptr noundef %0)
%1 = load i32, ptr %x.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %1)
%right = getelementptr inbounds %struct.Tree, ptr %x.tr5, i64 0, i32 3
%2 = load ptr, ptr %right, align 8, !tbaa !17
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %if.end, label %if.else
if.end: ; preds = %if.else, %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 @Print2(ptr noundef readonly %x) local_unnamed_addr #4 {
entry:
%cmp4 = icmp eq ptr %x, null
br i1 %cmp4, label %if.end, label %if.else
if.else: ; preds = %entry, %if.else
%x.tr5 = phi ptr [ %2, %if.else ], [ %x, %entry ]
%0 = load i32, ptr %x.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %0)
%left = getelementptr inbounds %struct.Tree, ptr %x.tr5, i64 0, i32 2
%1 = load ptr, ptr %left, align 8, !tbaa !16
tail call void @Print2(ptr noundef %1)
%right = getelementptr inbounds %struct.Tree, ptr %x.tr5, i64 0, i32 3
%2 = load ptr, ptr %right, align 8, !tbaa !17
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %if.end, label %if.else
if.end: ; preds = %if.else, %entry
ret void
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #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 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 #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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 uwtable "min-legal-vector-width"="0" "no-trapping-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 = { nofree nounwind willreturn memory(argmem: read) }
attributes #7 = { nofree nounwind }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { nounwind }
attributes #10 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"Tree", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !6, i64 8}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!10, !6, i64 16}
!17 = !{!10, !6, i64 24}
!18 = distinct !{!18, !15}
|
#include <stdio.h>
#include <stdlib.h>
typedef struct Node_ Node;
struct Node_
{
int key;
Node* parent;
Node* left;
Node* right;
};
Node* root;
static void insert(int key)
{
Node* node = (Node*)malloc(sizeof(Node));
node->key = key;
node->parent = NULL;
node->left = NULL;
node->right = NULL;
Node* parent = NULL;
Node* cur = root;
while (cur != NULL) {
parent = cur;
if (node->key < cur->key) {
cur = cur->left;
} else {
cur = cur->right;
}
}
node->parent = parent;
if (parent == NULL) {
root = node;
} else {
if (node->key < parent->key) {
parent->left = node;
} else {
parent->right = node;
}
}
}
static void printInorder(Node* node)
{
if (node == NULL)
return;
printInorder(node->left);
printf(" %d", node->key);
printInorder(node->right);
}
static void printPreorder(Node* node)
{
if (node == NULL)
return;
printf(" %d", node->key);
printPreorder(node->left);
printPreorder(node->right);
}
static void printTree()
{
printInorder(root);
printf("\n");
printPreorder(root);
printf("\n");
}
static void freeTree(Node* node)
{
if (node->left != NULL) {
freeTree(node->left);
}
if (node->right != NULL) {
freeTree(node->right);
}
free(node);
}
int main()
{
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
char command[10];
scanf("%s", command);
if (command[0] == 'i') {
int key;
scanf("%d", &key);
insert(key);
} else if (command[0] == 'p') {
printTree();
}
}
freeTree(root);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212338/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212338/source.c"
target datalayout = "e-m:e-p270: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 }
@.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
@.str.3 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
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) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %0, 0
br i1 %cmp12, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %if.end10, %entry
%1 = load ptr, ptr @root, align 8, !tbaa !9
call fastcc void @freeTree(ptr noundef %1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
for.body: ; preds = %entry, %if.end10
%i.013 = phi i32 [ %inc, %if.end10 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %command) #8
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %command)
%2 = load i8, ptr %command, align 1, !tbaa !11
switch i8 %2, label %if.end10 [
i8 105, label %if.then
i8 112, label %if.then9
]
if.then: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #8
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%3 = load i32, ptr %key, align 4, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #9
store i32 %3, ptr %call.i, align 8, !tbaa !12
%parent.i = getelementptr inbounds %struct.Node_, ptr %call.i, i64 0, i32 1
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %parent.i, i8 0, i64 24, i1 false)
%cur.038.i = load ptr, ptr @root, align 8, !tbaa !9
%cmp.not39.i = icmp eq ptr %cur.038.i, null
br i1 %cmp.not39.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%cur.040.i = phi ptr [ %cur.0.i, %while.body.i ], [ %cur.038.i, %if.then ]
%4 = load i32, ptr %cur.040.i, align 8, !tbaa !12
%cmp5.i = icmp sgt i32 %4, %3
%left6.i = getelementptr inbounds %struct.Node_, ptr %cur.040.i, i64 0, i32 2
%right7.i = getelementptr inbounds %struct.Node_, ptr %cur.040.i, i64 0, i32 3
%cur.1.in.i = select i1 %cmp5.i, ptr %left6.i, ptr %right7.i
%cur.0.i = load ptr, ptr %cur.1.in.i, align 8, !tbaa !9
%cmp.not.i = icmp eq ptr %cur.0.i, null
br i1 %cmp.not.i, label %if.else11.i, label %while.body.i, !llvm.loop !14
if.else11.i: ; preds = %while.body.i
store ptr %cur.040.i, ptr %parent.i, align 8, !tbaa !16
br label %insert.exit
insert.exit: ; preds = %if.else11.i, %if.then
%left16.sink.i = phi ptr [ @root, %if.then ], [ %cur.1.in.i, %if.else11.i ]
store ptr %call.i, ptr %left16.sink.i, align 8, !tbaa !9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #8
br label %if.end10
if.then9: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !9
call fastcc void @printInorder(ptr noundef %5)
%putchar.i = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !9
call fastcc void @printPreorder(ptr noundef %6)
%putchar2.i = call i32 @putchar(i32 10)
br label %if.end10
if.end10: ; preds = %for.body, %if.then9, %insert.exit
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %command) #8
%inc = add nuw nsw i32 %i.013, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !17
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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: nounwind uwtable
define internal fastcc void @freeTree(ptr nocapture noundef %node) unnamed_addr #0 {
entry:
%left = getelementptr inbounds %struct.Node_, ptr %node, 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 = %entry
tail call fastcc void @freeTree(ptr noundef nonnull %0)
br label %if.end
if.end: ; preds = %if.then, %entry
%right = getelementptr inbounds %struct.Node_, ptr %node, i64 0, i32 3
%1 = load ptr, ptr %right, align 8, !tbaa !19
%cmp2.not = icmp eq ptr %1, null
br i1 %cmp2.not, label %if.end5, label %if.then3
if.then3: ; preds = %if.end
tail call fastcc void @freeTree(ptr noundef nonnull %1)
br label %if.end5
if.end5: ; preds = %if.then3, %if.end
tail call void @free(ptr noundef nonnull %node) #8
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 #3
; Function Attrs: nofree nounwind uwtable
define internal fastcc void @printInorder(ptr noundef readonly %node) unnamed_addr #4 {
entry:
%cmp4 = icmp eq ptr %node, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%node.tr5 = phi ptr [ %2, %if.end ], [ %node, %entry ]
%left = getelementptr inbounds %struct.Node_, ptr %node.tr5, i64 0, i32 2
%0 = load ptr, ptr %left, align 8, !tbaa !18
tail call fastcc void @printInorder(ptr noundef %0)
%1 = load i32, ptr %node.tr5, align 8, !tbaa !12
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %1)
%right = getelementptr inbounds %struct.Node_, ptr %node.tr5, i64 0, i32 3
%2 = load ptr, ptr %right, align 8, !tbaa !19
%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 #2
; Function Attrs: nofree nounwind uwtable
define internal fastcc void @printPreorder(ptr noundef readonly %node) unnamed_addr #4 {
entry:
%cmp4 = icmp eq ptr %node, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%node.tr5 = phi ptr [ %2, %if.end ], [ %node, %entry ]
%0 = load i32, ptr %node.tr5, align 8, !tbaa !12
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %0)
%left = getelementptr inbounds %struct.Node_, ptr %node.tr5, i64 0, i32 2
%1 = load ptr, ptr %left, align 8, !tbaa !18
tail call fastcc void @printPreorder(ptr noundef %1)
%right = getelementptr inbounds %struct.Node_, ptr %node.tr5, i64 0, i32 3
%2 = load ptr, ptr %right, align 8, !tbaa !19
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) 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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 uwtable "min-legal-vector-width"="0" "no-trapping-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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"Node_", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!13, !10, i64 8}
!17 = distinct !{!17, !15}
!18 = !{!13, !10, i64 16}
!19 = !{!13, !10, i64 24}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.